bundle.min.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122
  1. (function(FuseBox){FuseBox.$fuse$=FuseBox;
  2. var __fsbx_css = function (__filename, contents) {
  3. if (FuseBox.isServer) {
  4. return;
  5. }
  6. var styleId = __filename.replace(/[\.\/]+/g, '-');
  7. if (styleId.charAt(0) === '-')
  8. styleId = styleId.substring(1);
  9. var exists = document.getElementById(styleId);
  10. if (!exists) {
  11. //<link href="//fonts.googleapis.com/css?family=Covered+By+Your+Grace" rel="stylesheet" type="text/css">
  12. var s = document.createElement(contents ? 'style' : 'link');
  13. s.id = styleId;
  14. s.type = 'text/css';
  15. if (contents) {
  16. s.innerHTML = contents;
  17. }
  18. else {
  19. s.rel = 'stylesheet';
  20. s.href = __filename;
  21. }
  22. document.getElementsByTagName('head')[0].appendChild(s);
  23. }
  24. else {
  25. if (contents) {
  26. exists.innerHTML = contents;
  27. }
  28. }
  29. };
  30. /**
  31. * Listens to 'async' requets and if the name is a css file
  32. * wires it to `__fsbx_css`
  33. */
  34. FuseBox.on('async', function (name) {
  35. if (FuseBox.isServer) {
  36. return;
  37. }
  38. if (/\.css$/.test(name)) {
  39. __fsbx_css(name);
  40. return false;
  41. }
  42. });
  43. FuseBox.pkg("default", {}, function(___scope___){
  44. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  45. 'use strict';
  46. var logic = document.documentElement.dataset.logic;
  47. switch (logic) {
  48. case 'login':
  49. require('./scss/login.scss');
  50. require('./js/login.js');
  51. break;
  52. default:
  53. require('./node_modules/highlight.js/styles/tomorrow.css');
  54. require('./node_modules/simplemde/dist/simplemde.min.css');
  55. require('./scss/app.scss');
  56. require('./js/app.js');
  57. break;
  58. }
  59. });
  60. ___scope___.file("scss/login.scss", function(exports, require, module, __filename, __dirname){
  61. __fsbx_css("scss/login.scss", "@charset \"UTF-8\";\n/*\r\n\tHTML5 Reset :: style.css\r\n\t----------------------------------------------------------\r\n\tWe have learned much from/been inspired by/taken code where offered from:\r\n\tEric Meyer\t\t\t\t\t:: http://meyerweb.com\r\n\tHTML5 Doctor\t\t\t\t:: http://html5doctor.com\r\n\tand the HTML5 Boilerplate\t:: http://html5boilerplate.com\r\n-------------------------------------------------------------------------------*/\n/* Let's default this puppy out\r\n-------------------------------------------------------------------------------*/\nhtml, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, menu, nav, section, time, mark, audio, video, details, summary {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font-weight: normal;\n vertical-align: baseline;\n background: transparent; }\n\nmain, article, aside, figure, footer, header, nav, section, details, summary {\n display: block; }\n\n/* Handle box-sizing while better addressing child elements:\r\n http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ */\nhtml {\n box-sizing: border-box; }\n\n*,\n*:before,\n*:after {\n box-sizing: inherit; }\n\n/* consider resetting the default cursor: https://gist.github.com/murtaugh/5247154 */\n/* Responsive images and other embedded objects */\n/* if you don't have full control over `img` tags (if you have to overcome attributes), consider adding height: auto */\nimg,\nobject,\nembed {\n max-width: 100%; }\n\n/*\r\n Note: keeping IMG here will cause problems if you're using foreground images as sprites.\r\n\tIn fact, it *will* cause problems with Google Maps' controls at small size.\r\n\tIf this is the case for you, try uncommenting the following:\r\n#map img {\r\n\t\tmax-width: none;\r\n}\r\n*/\n/* force a vertical scrollbar to prevent a jumpy page */\nhtml {\n overflow-y: scroll; }\n\n/* we use a lot of ULs that aren't bulleted.\r\n\tyou'll have to restore the bullets within content,\r\n\twhich is fine because they're probably customized anyway */\nul {\n list-style: none; }\n\nblockquote, q {\n quotes: none; }\n\nblockquote:before,\nblockquote:after,\nq:before,\nq:after {\n content: '';\n content: none; }\n\na {\n margin: 0;\n padding: 0;\n font-size: 100%;\n vertical-align: baseline;\n background: transparent; }\n\ndel {\n text-decoration: line-through; }\n\nabbr[title], dfn[title] {\n border-bottom: 1px dotted #000;\n cursor: help; }\n\n/* tables still need cellspacing=\"0\" in the markup */\ntable {\n border-collapse: separate;\n border-spacing: 0; }\n\nth {\n font-weight: bold;\n vertical-align: bottom; }\n\ntd {\n font-weight: normal;\n vertical-align: top; }\n\nhr {\n display: block;\n height: 1px;\n border: 0;\n border-top: 1px solid #ccc;\n margin: 1em 0;\n padding: 0; }\n\ninput, select {\n vertical-align: middle; }\n\npre {\n white-space: pre;\n /* CSS2 */\n white-space: pre-wrap;\n /* CSS 2.1 */\n white-space: pre-line;\n /* CSS 3 (and 2.1 as well, actually) */\n word-wrap: break-word;\n /* IE */ }\n\ninput[type=\"radio\"] {\n vertical-align: text-bottom; }\n\ninput[type=\"checkbox\"] {\n vertical-align: bottom; }\n\n.ie7 input[type=\"checkbox\"] {\n vertical-align: baseline; }\n\n.ie6 input {\n vertical-align: text-bottom; }\n\nselect, input, textarea {\n font: 99% sans-serif; }\n\ntable {\n font-size: inherit;\n font: 100%; }\n\nsmall {\n font-size: 85%; }\n\nstrong {\n font-weight: bold; }\n\ntd, td img {\n vertical-align: top; }\n\n/* Make sure sup and sub don't mess with your line-heights http://gist.github.com/413930 */\nsub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative; }\n\nsup {\n top: -0.5em; }\n\nsub {\n bottom: -0.25em; }\n\n/* standardize any monospaced elements */\npre, code, kbd, samp {\n font-family: monospace, sans-serif; }\n\n/* hand cursor on clickable elements */\n.clickable,\nlabel,\ninput[type=button],\ninput[type=submit],\ninput[type=file],\nbutton {\n cursor: pointer; }\n\n/* Webkit browsers add a 2px margin outside the chrome of form elements */\nbutton, input, select, textarea {\n margin: 0; }\n\n/* make buttons play nice in IE */\nbutton,\ninput[type=button] {\n width: auto;\n overflow: visible; }\n\n/* scale images in IE7 more attractively */\n.ie7 img {\n -ms-interpolation-mode: bicubic; }\n\n/* prevent BG image flicker upon hover\r\n (commented out as usage is rare, and the filter syntax messes with some pre-processors)\r\n.ie6 html {filter: expression(document.execCommand(\"BackgroundImageCache\", false, true));}\r\n*/\n/* let's clear some floats */\n.clearfix:after {\n content: \" \";\n display: block;\n clear: both; }\n\n/**\r\n * Clearfix\r\n *\r\n * @return {string} Clearfix attribute\r\n */\n/**\r\n * Placeholder attribute for inputs\r\n *\r\n * @return {string} Placeholder attributes\r\n */\n/**\r\n * Spinner element\r\n *\r\n * @param {string} $color - Color\r\n * @param {string} $dur - Animation Duration\r\n * @param {int} $width - Width\r\n * @param {int} $height [$width] - height\r\n *\r\n * @return {string} Spinner element\r\n */\n/**\r\n * Prefixes for keyframes\r\n *\r\n * @param {string} $animation-name - The animation name\r\n *\r\n * @return {string} Prefixed keyframes attributes\r\n */\n/**\r\n * Prefix function for browser compatibility\r\n *\r\n * @param {string} $property - Property name\r\n * @param {any} $value - Property value\r\n *\r\n * @return {string} Prefixed attributes\r\n */\n/**\r\n * Layout Mixins\r\n */\n@font-face {\n font-family: 'core-icons';\n src: url(\"/fonts/core-icons.ttf?e6rn1i\") format(\"truetype\"), url(\"/fonts/core-icons.woff?e6rn1i\") format(\"woff\"), url(\"/fonts/core-icons.svg?e6rn1i#core-icons\") format(\"svg\");\n font-weight: normal;\n font-style: normal; }\n\n[class^=\"icon-\"], [class*=\" icon-\"] {\n /* use !important to prevent issues with browser extensions that change fonts */\n font-family: 'core-icons' !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale; }\n\n.icon-minus2:before {\n content: \"\"; }\n\n.icon-font:before {\n content: \"\"; }\n\n.icon-bold:before {\n content: \"\"; }\n\n.icon-italic:before {\n content: \"\"; }\n\n.icon-align-left2:before {\n content: \"\"; }\n\n.icon-align-center2:before {\n content: \"\"; }\n\n.icon-align-right2:before {\n content: \"\"; }\n\n.icon-align-justify2:before {\n content: \"\"; }\n\n.icon-list:before {\n content: \"\"; }\n\n.icon-video-camera2:before {\n content: \"\"; }\n\n.icon-image3:before {\n content: \"\"; }\n\n.icon-photo:before {\n content: \"\"; }\n\n.icon-picture-o:before {\n content: \"\"; }\n\n.icon-twitter-square:before {\n content: \"\"; }\n\n.icon-facebook-square:before {\n content: \"\"; }\n\n.icon-linkedin-square:before {\n content: \"\"; }\n\n.icon-github-square:before {\n content: \"\"; }\n\n.icon-twitter:before {\n content: \"\"; }\n\n.icon-facebook:before {\n content: \"\"; }\n\n.icon-facebook-f:before {\n content: \"\"; }\n\n.icon-github:before {\n content: \"\"; }\n\n.icon-chain:before {\n content: \"\"; }\n\n.icon-link3:before {\n content: \"\"; }\n\n.icon-bars:before {\n content: \"\"; }\n\n.icon-navicon:before {\n content: \"\"; }\n\n.icon-reorder:before {\n content: \"\"; }\n\n.icon-list-ul:before {\n content: \"\"; }\n\n.icon-list-ol:before {\n content: \"\"; }\n\n.icon-strikethrough:before {\n content: \"\"; }\n\n.icon-underline:before {\n content: \"\"; }\n\n.icon-table:before {\n content: \"\"; }\n\n.icon-linkedin:before {\n content: \"\"; }\n\n.icon-file-text-o:before {\n content: \"\"; }\n\n.icon-quote-left:before {\n content: \"\"; }\n\n.icon-terminal:before {\n content: \"\"; }\n\n.icon-code:before {\n content: \"\"; }\n\n.icon-youtube-play:before {\n content: \"\"; }\n\n.icon-dropbox:before {\n content: \"\"; }\n\n.icon-stack-overflow:before {\n content: \"\"; }\n\n.icon-bitbucket:before {\n content: \"\"; }\n\n.icon-apple:before {\n content: \"\"; }\n\n.icon-windows2:before {\n content: \"\"; }\n\n.icon-android:before {\n content: \"\"; }\n\n.icon-linux:before {\n content: \"\"; }\n\n.icon-vimeo-square:before {\n content: \"\"; }\n\n.icon-slack:before {\n content: \"\"; }\n\n.icon-google:before {\n content: \"\"; }\n\n.icon-git-square:before {\n content: \"\"; }\n\n.icon-git:before {\n content: \"\"; }\n\n.icon-header:before {\n content: \"\"; }\n\n.icon-safari:before {\n content: \"\"; }\n\n.icon-chrome:before {\n content: \"\"; }\n\n.icon-firefox:before {\n content: \"\"; }\n\n.icon-opera:before {\n content: \"\"; }\n\n.icon-internet-explorer:before {\n content: \"\"; }\n\n.icon-vimeo:before {\n content: \"\"; }\n\n.icon-edge:before {\n content: \"\"; }\n\n.icon-gitlab:before {\n content: \"\"; }\n\n.icon-th-small:before {\n content: \"\"; }\n\n.icon-th-menu:before {\n content: \"\"; }\n\n.icon-th-list:before {\n content: \"\"; }\n\n.icon-th-large:before {\n content: \"\"; }\n\n.icon-home:before {\n content: \"\"; }\n\n.icon-location:before {\n content: \"\"; }\n\n.icon-link:before {\n content: \"\"; }\n\n.icon-starburst:before {\n content: \"\"; }\n\n.icon-starburst-outline:before {\n content: \"\"; }\n\n.icon-star:before {\n content: \"\"; }\n\n.icon-flow-children:before {\n content: \"\"; }\n\n.icon-export:before {\n content: \"\"; }\n\n.icon-delete:before {\n content: \"\"; }\n\n.icon-delete-outline:before {\n content: \"\"; }\n\n.icon-cloud-storage:before {\n content: \"\"; }\n\n.icon-backspace:before {\n content: \"\"; }\n\n.icon-attachment:before {\n content: \"\"; }\n\n.icon-arrow-move:before {\n content: \"\"; }\n\n.icon-warning:before {\n content: \"\"; }\n\n.icon-location-arrow:before {\n content: \"\"; }\n\n.icon-point-of-interest:before {\n content: \"\"; }\n\n.icon-infinity:before {\n content: \"\"; }\n\n.icon-eye:before {\n content: \"\"; }\n\n.icon-refresh:before {\n content: \"\"; }\n\n.icon-pin:before {\n content: \"\"; }\n\n.icon-eject:before {\n content: \"\"; }\n\n.icon-arrow-sync:before {\n content: \"\"; }\n\n.icon-arrow-shuffle:before {\n content: \"\"; }\n\n.icon-arrow-repeat:before {\n content: \"\"; }\n\n.icon-arrow-minimise:before {\n content: \"\"; }\n\n.icon-arrow-maximise:before {\n content: \"\"; }\n\n.icon-arrow-loop:before {\n content: \"\"; }\n\n.icon-spanner:before {\n content: \"\"; }\n\n.icon-power:before {\n content: \"\"; }\n\n.icon-flag:before {\n content: \"\"; }\n\n.icon-th-large-outline:before {\n content: \"\"; }\n\n.icon-th-small-outline:before {\n content: \"\"; }\n\n.icon-th-menu-outline:before {\n content: \"\"; }\n\n.icon-th-list-outline:before {\n content: \"\"; }\n\n.icon-home-outline:before {\n content: \"\"; }\n\n.icon-trash:before {\n content: \"\"; }\n\n.icon-star-outline:before {\n content: \"\"; }\n\n.icon-mail:before {\n content: \"\"; }\n\n.icon-heart-outline:before {\n content: \"\"; }\n\n.icon-flash-outline:before {\n content: \"\"; }\n\n.icon-watch:before {\n content: \"\"; }\n\n.icon-warning-outline:before {\n content: \"\"; }\n\n.icon-location-arrow-outline:before {\n content: \"\"; }\n\n.icon-info-outline:before {\n content: \"\"; }\n\n.icon-backspace-outline:before {\n content: \"\"; }\n\n.icon-upload-outline:before {\n content: \"\"; }\n\n.icon-tag:before {\n content: \"\"; }\n\n.icon-tabs-outline:before {\n content: \"\"; }\n\n.icon-pin-outline:before {\n content: \"\"; }\n\n.icon-pipette:before {\n content: \"\"; }\n\n.icon-pencil:before {\n content: \"\"; }\n\n.icon-folder:before {\n content: \"\"; }\n\n.icon-folder-delete:before {\n content: \"\"; }\n\n.icon-folder-add:before {\n content: \"\"; }\n\n.icon-edit:before {\n content: \"\"; }\n\n.icon-document:before {\n content: \"\"; }\n\n.icon-document-delete:before {\n content: \"\"; }\n\n.icon-document-add:before {\n content: \"\"; }\n\n.icon-brush:before {\n content: \"\"; }\n\n.icon-thumbs-up:before {\n content: \"\"; }\n\n.icon-thumbs-down:before {\n content: \"\"; }\n\n.icon-pen:before {\n content: \"\"; }\n\n.icon-bookmark:before {\n content: \"\"; }\n\n.icon-arrow-up:before {\n content: \"\"; }\n\n.icon-arrow-sync-outline:before {\n content: \"\"; }\n\n.icon-arrow-right:before {\n content: \"\"; }\n\n.icon-arrow-repeat-outline:before {\n content: \"\"; }\n\n.icon-arrow-loop-outline:before {\n content: \"\"; }\n\n.icon-arrow-left:before {\n content: \"\"; }\n\n.icon-flow-switch:before {\n content: \"\"; }\n\n.icon-flow-parallel:before {\n content: \"\"; }\n\n.icon-flow-merge:before {\n content: \"\"; }\n\n.icon-document-text:before {\n content: \"\"; }\n\n.icon-arrow-down:before {\n content: \"\"; }\n\n.icon-bell:before {\n content: \"\"; }\n\n.icon-adjust-contrast:before {\n content: \"\"; }\n\n.icon-lightbulb:before {\n content: \"\"; }\n\n.icon-tags:before {\n content: \"\"; }\n\n.icon-eye2:before {\n content: \"\"; }\n\n.icon-paper-clip:before {\n content: \"\"; }\n\n.icon-mail2:before {\n content: \"\"; }\n\n.icon-toggle:before {\n content: \"\"; }\n\n.icon-layout:before {\n content: \"\"; }\n\n.icon-link2:before {\n content: \"\"; }\n\n.icon-bell2:before {\n content: \"\"; }\n\n.icon-lock:before {\n content: \"\"; }\n\n.icon-unlock:before {\n content: \"\"; }\n\n.icon-ribbon:before {\n content: \"\"; }\n\n.icon-image:before {\n content: \"\"; }\n\n.icon-signal:before {\n content: \"\"; }\n\n.icon-target:before {\n content: \"\"; }\n\n.icon-clipboard:before {\n content: \"\"; }\n\n.icon-clock:before {\n content: \"\"; }\n\n.icon-watch2:before {\n content: \"\"; }\n\n.icon-air-play:before {\n content: \"\"; }\n\n.icon-camera:before {\n content: \"\"; }\n\n.icon-video:before {\n content: \"\"; }\n\n.icon-disc:before {\n content: \"\"; }\n\n.icon-printer:before {\n content: \"\"; }\n\n.icon-monitor:before {\n content: \"\"; }\n\n.icon-server:before {\n content: \"\"; }\n\n.icon-cog:before {\n content: \"\"; }\n\n.icon-heart:before {\n content: \"\"; }\n\n.icon-paragraph:before {\n content: \"\"; }\n\n.icon-align-justify:before {\n content: \"\"; }\n\n.icon-align-left:before {\n content: \"\"; }\n\n.icon-align-center:before {\n content: \"\"; }\n\n.icon-align-right:before {\n content: \"\"; }\n\n.icon-book:before {\n content: \"\"; }\n\n.icon-layers:before {\n content: \"\"; }\n\n.icon-stack:before {\n content: \"\"; }\n\n.icon-stack-2:before {\n content: \"\"; }\n\n.icon-paper:before {\n content: \"\"; }\n\n.icon-paper-stack:before {\n content: \"\"; }\n\n.icon-search:before {\n content: \"\"; }\n\n.icon-zoom-in:before {\n content: \"\"; }\n\n.icon-zoom-out:before {\n content: \"\"; }\n\n.icon-reply:before {\n content: \"\"; }\n\n.icon-circle-plus:before {\n content: \"\"; }\n\n.icon-circle-minus:before {\n content: \"\"; }\n\n.icon-circle-check:before {\n content: \"\"; }\n\n.icon-circle-cross:before {\n content: \"\"; }\n\n.icon-square-plus:before {\n content: \"\"; }\n\n.icon-square-minus:before {\n content: \"\"; }\n\n.icon-square-check:before {\n content: \"\"; }\n\n.icon-square-cross:before {\n content: \"\"; }\n\n.icon-microphone:before {\n content: \"\"; }\n\n.icon-record:before {\n content: \"\"; }\n\n.icon-skip-back:before {\n content: \"\"; }\n\n.icon-rewind:before {\n content: \"\"; }\n\n.icon-play:before {\n content: \"\"; }\n\n.icon-pause:before {\n content: \"\"; }\n\n.icon-stop:before {\n content: \"\"; }\n\n.icon-fast-forward:before {\n content: \"\"; }\n\n.icon-skip-forward:before {\n content: \"\"; }\n\n.icon-shuffle:before {\n content: \"\"; }\n\n.icon-repeat:before {\n content: \"\"; }\n\n.icon-folder2:before {\n content: \"\"; }\n\n.icon-umbrella:before {\n content: \"\"; }\n\n.icon-moon:before {\n content: \"\"; }\n\n.icon-thermometer:before {\n content: \"\"; }\n\n.icon-drop:before {\n content: \"\"; }\n\n.icon-sun:before {\n content: \"\"; }\n\n.icon-cloud:before {\n content: \"\"; }\n\n.icon-cloud-upload:before {\n content: \"\"; }\n\n.icon-cloud-download:before {\n content: \"\"; }\n\n.icon-upload:before {\n content: \"\"; }\n\n.icon-download:before {\n content: \"\"; }\n\n.icon-location2:before {\n content: \"\"; }\n\n.icon-location-2:before {\n content: \"\"; }\n\n.icon-map:before {\n content: \"\"; }\n\n.icon-battery:before {\n content: \"\"; }\n\n.icon-head:before {\n content: \"\"; }\n\n.icon-briefcase:before {\n content: \"\"; }\n\n.icon-speech-bubble:before {\n content: \"\"; }\n\n.icon-anchor:before {\n content: \"\"; }\n\n.icon-globe:before {\n content: \"\"; }\n\n.icon-box:before {\n content: \"\"; }\n\n.icon-reload:before {\n content: \"\"; }\n\n.icon-share:before {\n content: \"\"; }\n\n.icon-marquee:before {\n content: \"\"; }\n\n.icon-marquee-plus:before {\n content: \"\"; }\n\n.icon-marquee-minus:before {\n content: \"\"; }\n\n.icon-tag2:before {\n content: \"\"; }\n\n.icon-power2:before {\n content: \"\"; }\n\n.icon-command:before {\n content: \"\"; }\n\n.icon-alt:before {\n content: \"\"; }\n\n.icon-esc:before {\n content: \"\"; }\n\n.icon-bar-graph:before {\n content: \"\"; }\n\n.icon-bar-graph-2:before {\n content: \"\"; }\n\n.icon-pie-graph:before {\n content: \"\"; }\n\n.icon-star2:before {\n content: \"\"; }\n\n.icon-arrow-left2:before {\n content: \"\"; }\n\n.icon-arrow-right2:before {\n content: \"\"; }\n\n.icon-arrow-up2:before {\n content: \"\"; }\n\n.icon-arrow-down2:before {\n content: \"\"; }\n\n.icon-volume:before {\n content: \"\"; }\n\n.icon-mute:before {\n content: \"\"; }\n\n.icon-content-right:before {\n content: \"\"; }\n\n.icon-content-left:before {\n content: \"\"; }\n\n.icon-grid:before {\n content: \"\"; }\n\n.icon-grid-2:before {\n content: \"\"; }\n\n.icon-columns:before {\n content: \"\"; }\n\n.icon-loader:before {\n content: \"\"; }\n\n.icon-bag:before {\n content: \"\"; }\n\n.icon-ban:before {\n content: \"\"; }\n\n.icon-flag2:before {\n content: \"\"; }\n\n.icon-trash2:before {\n content: \"\"; }\n\n.icon-expand:before {\n content: \"\"; }\n\n.icon-contract:before {\n content: \"\"; }\n\n.icon-maximize:before {\n content: \"\"; }\n\n.icon-minimize:before {\n content: \"\"; }\n\n.icon-plus:before {\n content: \"\"; }\n\n.icon-minus:before {\n content: \"\"; }\n\n.icon-check:before {\n content: \"\"; }\n\n.icon-cross:before {\n content: \"\"; }\n\n.icon-move:before {\n content: \"\"; }\n\n.icon-delete2:before {\n content: \"\"; }\n\n.icon-menu:before {\n content: \"\"; }\n\n.icon-archive:before {\n content: \"\"; }\n\n.icon-inbox:before {\n content: \"\"; }\n\n.icon-outbox:before {\n content: \"\"; }\n\n.icon-file:before {\n content: \"\"; }\n\n.icon-file-add:before {\n content: \"\"; }\n\n.icon-file-subtract:before {\n content: \"\"; }\n\n.icon-help:before {\n content: \"\"; }\n\n.icon-open:before {\n content: \"\"; }\n\n.icon-ellipsis:before {\n content: \"\"; }\n\n.icon-box2:before {\n content: \"\"; }\n\n.icon-write:before {\n content: \"\"; }\n\n.icon-clock2:before {\n content: \"\"; }\n\n.icon-reply2:before {\n content: \"\"; }\n\n.icon-reply-all:before {\n content: \"\"; }\n\n.icon-forward:before {\n content: \"\"; }\n\n.icon-flag3:before {\n content: \"\"; }\n\n.icon-search2:before {\n content: \"\"; }\n\n.icon-trash3:before {\n content: \"\"; }\n\n.icon-envelope:before {\n content: \"\"; }\n\n.icon-bubble:before {\n content: \"\"; }\n\n.icon-bubbles:before {\n content: \"\"; }\n\n.icon-user:before {\n content: \"\"; }\n\n.icon-users:before {\n content: \"\"; }\n\n.icon-cloud2:before {\n content: \"\"; }\n\n.icon-download2:before {\n content: \"\"; }\n\n.icon-upload2:before {\n content: \"\"; }\n\n.icon-rain:before {\n content: \"\"; }\n\n.icon-sun2:before {\n content: \"\"; }\n\n.icon-moon2:before {\n content: \"\"; }\n\n.icon-bell3:before {\n content: \"\"; }\n\n.icon-folder3:before {\n content: \"\"; }\n\n.icon-pin2:before {\n content: \"\"; }\n\n.icon-sound:before {\n content: \"\"; }\n\n.icon-microphone2:before {\n content: \"\"; }\n\n.icon-camera2:before {\n content: \"\"; }\n\n.icon-image2:before {\n content: \"\"; }\n\n.icon-cog2:before {\n content: \"\"; }\n\n.icon-calendar:before {\n content: \"\"; }\n\n.icon-book2:before {\n content: \"\"; }\n\n.icon-map-marker:before {\n content: \"\"; }\n\n.icon-store:before {\n content: \"\"; }\n\n.icon-support:before {\n content: \"\"; }\n\n.icon-tag3:before {\n content: \"\"; }\n\n.icon-heart2:before {\n content: \"\"; }\n\n.icon-video-camera:before {\n content: \"\"; }\n\n.icon-trophy:before {\n content: \"\"; }\n\n.icon-cart:before {\n content: \"\"; }\n\n.icon-eye3:before {\n content: \"\"; }\n\n.icon-cancel:before {\n content: \"\"; }\n\n.icon-chart:before {\n content: \"\"; }\n\n.icon-target2:before {\n content: \"\"; }\n\n.icon-printer2:before {\n content: \"\"; }\n\n.icon-location3:before {\n content: \"\"; }\n\n.icon-bookmark2:before {\n content: \"\"; }\n\n.icon-monitor2:before {\n content: \"\"; }\n\n.icon-cross2:before {\n content: \"\"; }\n\n.icon-plus2:before {\n content: \"\"; }\n\n.icon-left:before {\n content: \"\"; }\n\n.icon-up:before {\n content: \"\"; }\n\n.icon-browser:before {\n content: \"\"; }\n\n.icon-windows:before {\n content: \"\"; }\n\n.icon-switch:before {\n content: \"\"; }\n\n.icon-dashboard:before {\n content: \"\"; }\n\n.icon-play2:before {\n content: \"\"; }\n\n.icon-fast-forward2:before {\n content: \"\"; }\n\n.icon-next:before {\n content: \"\"; }\n\n.icon-refresh2:before {\n content: \"\"; }\n\n.icon-film:before {\n content: \"\"; }\n\n.icon-home2:before {\n content: \"\"; }\n\nhtml {\n box-sizing: border-box;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"; }\n\n*, *:before, *:after {\n box-sizing: inherit; }\n\n[v-cloak], .is-hidden {\n display: none; }\n\nbody {\n background-color: #cfd8dc; }\n\nmain {\n background-color: #FFF; }\n\na {\n color: #3949ab;\n text-decoration: none; }\n a:hover {\n color: #303f9f;\n text-decoration: underline; }\n\n.has-stickynav {\n padding-top: 50px; }\n\n.container {\n position: relative; }\n @media screen and (min-width: 980px) {\n .container {\n margin: 0 auto;\n max-width: 960px; }\n .container.is-fluid {\n margin: 0;\n max-width: none; } }\n @media screen and (min-width: 1180px) {\n .container {\n max-width: 1200px; } }\n\n.content {\n padding: 20px; }\n\n.is-hidden {\n display: none !important; }\n\n@media screen and (max-width: 768px) {\n .is-hidden-mobile {\n display: none !important; } }\n\n@media screen and (min-width: 769px) {\n .is-hidden-tablet {\n display: none !important; } }\n\n@media screen and (min-width: 769px) and (max-width: 979px) {\n .is-hidden-tablet-only {\n display: none !important; } }\n\n@media screen and (max-width: 979px) {\n .is-hidden-touch {\n display: none !important; } }\n\n@media screen and (min-width: 980px) {\n .is-hidden-desktop {\n display: none !important; } }\n\n@media screen and (min-width: 980px) and (max-width: 1179px) {\n .is-hidden-desktop-only {\n display: none !important; } }\n\n@media screen and (min-width: 1180px) {\n .is-hidden-widescreen {\n display: none !important; } }\n\n/*!\r\n * animate.css -http://daneden.me/animate\r\n * Version - 3.5.1\r\n * Licensed under the MIT license - http://opensource.org/licenses/MIT\r\n *\r\n * Copyright (c) 2016 Daniel Eden\r\n */\n.animated {\n -webkit-animation-duration: 1s;\n animation-duration: 1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both; }\n .animated.infinite {\n -webkit-animation-iteration-count: infinite;\n animation-iteration-count: infinite; }\n .animated.hinge {\n -webkit-animation-duration: 2s;\n animation-duration: 2s; }\n .animated.flipOutX, .animated.flipOutY, .animated.bounceIn, .animated.bounceOut {\n -webkit-animation-duration: .75s;\n animation-duration: .75s; }\n\n@-webkit-keyframes bounce {\n from, 20%, 53%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 40%, 43% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -30px, 0);\n transform: translate3d(0, -30px, 0); }\n 70% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -15px, 0);\n transform: translate3d(0, -15px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -4px, 0);\n transform: translate3d(0, -4px, 0); } }\n\n@keyframes bounce {\n from, 20%, 53%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 40%, 43% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -30px, 0);\n transform: translate3d(0, -30px, 0); }\n 70% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -15px, 0);\n transform: translate3d(0, -15px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -4px, 0);\n transform: translate3d(0, -4px, 0); } }\n\n.bounce {\n -webkit-animation-name: bounce;\n animation-name: bounce;\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom; }\n\n@-webkit-keyframes flash {\n from, 50%, to {\n opacity: 1; }\n 25%, 75% {\n opacity: 0; } }\n\n@keyframes flash {\n from, 50%, to {\n opacity: 1; }\n 25%, 75% {\n opacity: 0; } }\n\n.flash {\n -webkit-animation-name: flash;\n animation-name: flash; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes pulse {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 50% {\n -webkit-transform: scale3d(1.05, 1.05, 1.05);\n transform: scale3d(1.05, 1.05, 1.05); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes pulse {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 50% {\n -webkit-transform: scale3d(1.05, 1.05, 1.05);\n transform: scale3d(1.05, 1.05, 1.05); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.pulse {\n -webkit-animation-name: pulse;\n animation-name: pulse; }\n\n@-webkit-keyframes rubberBand {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 30% {\n -webkit-transform: scale3d(1.25, 0.75, 1);\n transform: scale3d(1.25, 0.75, 1); }\n 40% {\n -webkit-transform: scale3d(0.75, 1.25, 1);\n transform: scale3d(0.75, 1.25, 1); }\n 50% {\n -webkit-transform: scale3d(1.15, 0.85, 1);\n transform: scale3d(1.15, 0.85, 1); }\n 65% {\n -webkit-transform: scale3d(0.95, 1.05, 1);\n transform: scale3d(0.95, 1.05, 1); }\n 75% {\n -webkit-transform: scale3d(1.05, 0.95, 1);\n transform: scale3d(1.05, 0.95, 1); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes rubberBand {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 30% {\n -webkit-transform: scale3d(1.25, 0.75, 1);\n transform: scale3d(1.25, 0.75, 1); }\n 40% {\n -webkit-transform: scale3d(0.75, 1.25, 1);\n transform: scale3d(0.75, 1.25, 1); }\n 50% {\n -webkit-transform: scale3d(1.15, 0.85, 1);\n transform: scale3d(1.15, 0.85, 1); }\n 65% {\n -webkit-transform: scale3d(0.95, 1.05, 1);\n transform: scale3d(0.95, 1.05, 1); }\n 75% {\n -webkit-transform: scale3d(1.05, 0.95, 1);\n transform: scale3d(1.05, 0.95, 1); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.rubberBand {\n -webkit-animation-name: rubberBand;\n animation-name: rubberBand; }\n\n@-webkit-keyframes shake {\n from, to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 10%, 30%, 50%, 70%, 90% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 20%, 40%, 60%, 80% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); } }\n\n@keyframes shake {\n from, to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 10%, 30%, 50%, 70%, 90% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 20%, 40%, 60%, 80% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); } }\n\n.shake {\n -webkit-animation-name: shake;\n animation-name: shake; }\n\n@-webkit-keyframes headShake {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 6.5% {\n -webkit-transform: translateX(-6px) rotateY(-9deg);\n transform: translateX(-6px) rotateY(-9deg); }\n 18.5% {\n -webkit-transform: translateX(5px) rotateY(7deg);\n transform: translateX(5px) rotateY(7deg); }\n 31.5% {\n -webkit-transform: translateX(-3px) rotateY(-5deg);\n transform: translateX(-3px) rotateY(-5deg); }\n 43.5% {\n -webkit-transform: translateX(2px) rotateY(3deg);\n transform: translateX(2px) rotateY(3deg); }\n 50% {\n -webkit-transform: translateX(0);\n transform: translateX(0); } }\n\n@keyframes headShake {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 6.5% {\n -webkit-transform: translateX(-6px) rotateY(-9deg);\n transform: translateX(-6px) rotateY(-9deg); }\n 18.5% {\n -webkit-transform: translateX(5px) rotateY(7deg);\n transform: translateX(5px) rotateY(7deg); }\n 31.5% {\n -webkit-transform: translateX(-3px) rotateY(-5deg);\n transform: translateX(-3px) rotateY(-5deg); }\n 43.5% {\n -webkit-transform: translateX(2px) rotateY(3deg);\n transform: translateX(2px) rotateY(3deg); }\n 50% {\n -webkit-transform: translateX(0);\n transform: translateX(0); } }\n\n.headShake {\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n -webkit-animation-name: headShake;\n animation-name: headShake; }\n\n@-webkit-keyframes swing {\n 20% {\n -webkit-transform: rotate3d(0, 0, 1, 15deg);\n transform: rotate3d(0, 0, 1, 15deg); }\n 40% {\n -webkit-transform: rotate3d(0, 0, 1, -10deg);\n transform: rotate3d(0, 0, 1, -10deg); }\n 60% {\n -webkit-transform: rotate3d(0, 0, 1, 5deg);\n transform: rotate3d(0, 0, 1, 5deg); }\n 80% {\n -webkit-transform: rotate3d(0, 0, 1, -5deg);\n transform: rotate3d(0, 0, 1, -5deg); }\n to {\n -webkit-transform: rotate3d(0, 0, 1, 0deg);\n transform: rotate3d(0, 0, 1, 0deg); } }\n\n@keyframes swing {\n 20% {\n -webkit-transform: rotate3d(0, 0, 1, 15deg);\n transform: rotate3d(0, 0, 1, 15deg); }\n 40% {\n -webkit-transform: rotate3d(0, 0, 1, -10deg);\n transform: rotate3d(0, 0, 1, -10deg); }\n 60% {\n -webkit-transform: rotate3d(0, 0, 1, 5deg);\n transform: rotate3d(0, 0, 1, 5deg); }\n 80% {\n -webkit-transform: rotate3d(0, 0, 1, -5deg);\n transform: rotate3d(0, 0, 1, -5deg); }\n to {\n -webkit-transform: rotate3d(0, 0, 1, 0deg);\n transform: rotate3d(0, 0, 1, 0deg); } }\n\n.swing {\n -webkit-transform-origin: top center;\n transform-origin: top center;\n -webkit-animation-name: swing;\n animation-name: swing; }\n\n@-webkit-keyframes tada {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 10%, 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); }\n 30%, 50%, 70%, 90% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); }\n 40%, 60%, 80% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes tada {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 10%, 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); }\n 30%, 50%, 70%, 90% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); }\n 40%, 60%, 80% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.tada {\n -webkit-animation-name: tada;\n animation-name: tada; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes wobble {\n from {\n -webkit-transform: none;\n transform: none; }\n 15% {\n -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);\n transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); }\n 30% {\n -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);\n transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); }\n 45% {\n -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);\n transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); }\n 60% {\n -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);\n transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); }\n 75% {\n -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);\n transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes wobble {\n from {\n -webkit-transform: none;\n transform: none; }\n 15% {\n -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);\n transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); }\n 30% {\n -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);\n transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); }\n 45% {\n -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);\n transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); }\n 60% {\n -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);\n transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); }\n 75% {\n -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);\n transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.wobble {\n -webkit-animation-name: wobble;\n animation-name: wobble; }\n\n@-webkit-keyframes jello {\n from, 11.1%, to {\n -webkit-transform: none;\n transform: none; }\n 22.2% {\n -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);\n transform: skewX(-12.5deg) skewY(-12.5deg); }\n 33.3% {\n -webkit-transform: skewX(6.25deg) skewY(6.25deg);\n transform: skewX(6.25deg) skewY(6.25deg); }\n 44.4% {\n -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);\n transform: skewX(-3.125deg) skewY(-3.125deg); }\n 55.5% {\n -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);\n transform: skewX(1.5625deg) skewY(1.5625deg); }\n 66.6% {\n -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);\n transform: skewX(-0.78125deg) skewY(-0.78125deg); }\n 77.7% {\n -webkit-transform: skewX(0.39063deg) skewY(0.39063deg);\n transform: skewX(0.39063deg) skewY(0.39063deg); }\n 88.8% {\n -webkit-transform: skewX(-0.19531deg) skewY(-0.19531deg);\n transform: skewX(-0.19531deg) skewY(-0.19531deg); } }\n\n@keyframes jello {\n from, 11.1%, to {\n -webkit-transform: none;\n transform: none; }\n 22.2% {\n -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);\n transform: skewX(-12.5deg) skewY(-12.5deg); }\n 33.3% {\n -webkit-transform: skewX(6.25deg) skewY(6.25deg);\n transform: skewX(6.25deg) skewY(6.25deg); }\n 44.4% {\n -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);\n transform: skewX(-3.125deg) skewY(-3.125deg); }\n 55.5% {\n -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);\n transform: skewX(1.5625deg) skewY(1.5625deg); }\n 66.6% {\n -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);\n transform: skewX(-0.78125deg) skewY(-0.78125deg); }\n 77.7% {\n -webkit-transform: skewX(0.39063deg) skewY(0.39063deg);\n transform: skewX(0.39063deg) skewY(0.39063deg); }\n 88.8% {\n -webkit-transform: skewX(-0.19531deg) skewY(-0.19531deg);\n transform: skewX(-0.19531deg) skewY(-0.19531deg); } }\n\n.jello {\n -webkit-animation-name: jello;\n animation-name: jello;\n -webkit-transform-origin: center;\n transform-origin: center; }\n\n@-webkit-keyframes bounceIn {\n from, 20%, 40%, 60%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 20% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n 40% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(1.03, 1.03, 1.03);\n transform: scale3d(1.03, 1.03, 1.03); }\n 80% {\n -webkit-transform: scale3d(0.97, 0.97, 0.97);\n transform: scale3d(0.97, 0.97, 0.97); }\n to {\n opacity: 1;\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes bounceIn {\n from, 20%, 40%, 60%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 20% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n 40% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(1.03, 1.03, 1.03);\n transform: scale3d(1.03, 1.03, 1.03); }\n 80% {\n -webkit-transform: scale3d(0.97, 0.97, 0.97);\n transform: scale3d(0.97, 0.97, 0.97); }\n to {\n opacity: 1;\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.bounceIn {\n -webkit-animation-name: bounceIn;\n animation-name: bounceIn; }\n\n@-webkit-keyframes bounceInDown {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(0, -3000px, 0);\n transform: translate3d(0, -3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, 25px, 0);\n transform: translate3d(0, 25px, 0); }\n 75% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, 5px, 0);\n transform: translate3d(0, 5px, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInDown {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(0, -3000px, 0);\n transform: translate3d(0, -3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, 25px, 0);\n transform: translate3d(0, 25px, 0); }\n 75% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, 5px, 0);\n transform: translate3d(0, 5px, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInDown {\n -webkit-animation-name: bounceInDown;\n animation-name: bounceInDown; }\n\n@-webkit-keyframes bounceInLeft {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(-3000px, 0, 0);\n transform: translate3d(-3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(25px, 0, 0);\n transform: translate3d(25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(5px, 0, 0);\n transform: translate3d(5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInLeft {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(-3000px, 0, 0);\n transform: translate3d(-3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(25px, 0, 0);\n transform: translate3d(25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(5px, 0, 0);\n transform: translate3d(5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInLeft {\n -webkit-animation-name: bounceInLeft;\n animation-name: bounceInLeft; }\n\n@-webkit-keyframes bounceInRight {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(3000px, 0, 0);\n transform: translate3d(3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(-25px, 0, 0);\n transform: translate3d(-25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(-5px, 0, 0);\n transform: translate3d(-5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInRight {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(3000px, 0, 0);\n transform: translate3d(3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(-25px, 0, 0);\n transform: translate3d(-25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(-5px, 0, 0);\n transform: translate3d(-5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInRight {\n -webkit-animation-name: bounceInRight;\n animation-name: bounceInRight; }\n\n@-webkit-keyframes bounceInUp {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 3000px, 0);\n transform: translate3d(0, 3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n 75% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -5px, 0);\n transform: translate3d(0, -5px, 0); }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes bounceInUp {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 3000px, 0);\n transform: translate3d(0, 3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n 75% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -5px, 0);\n transform: translate3d(0, -5px, 0); }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.bounceInUp {\n -webkit-animation-name: bounceInUp;\n animation-name: bounceInUp; }\n\n@-webkit-keyframes bounceOut {\n 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 50%, 55% {\n opacity: 1;\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); } }\n\n@keyframes bounceOut {\n 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 50%, 55% {\n opacity: 1;\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); } }\n\n.bounceOut {\n -webkit-animation-name: bounceOut;\n animation-name: bounceOut; }\n\n@-webkit-keyframes bounceOutDown {\n 20% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n@keyframes bounceOutDown {\n 20% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n.bounceOutDown {\n -webkit-animation-name: bounceOutDown;\n animation-name: bounceOutDown; }\n\n@-webkit-keyframes bounceOutLeft {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(20px, 0, 0);\n transform: translate3d(20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n@keyframes bounceOutLeft {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(20px, 0, 0);\n transform: translate3d(20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n.bounceOutLeft {\n -webkit-animation-name: bounceOutLeft;\n animation-name: bounceOutLeft; }\n\n@-webkit-keyframes bounceOutRight {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(-20px, 0, 0);\n transform: translate3d(-20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n@keyframes bounceOutRight {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(-20px, 0, 0);\n transform: translate3d(-20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n.bounceOutRight {\n -webkit-animation-name: bounceOutRight;\n animation-name: bounceOutRight; }\n\n@-webkit-keyframes bounceOutUp {\n 20% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, 20px, 0);\n transform: translate3d(0, 20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n@keyframes bounceOutUp {\n 20% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, 20px, 0);\n transform: translate3d(0, 20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n.bounceOutUp {\n -webkit-animation-name: bounceOutUp;\n animation-name: bounceOutUp; }\n\n@-webkit-keyframes fadeIn {\n from {\n opacity: 0; }\n to {\n opacity: 1; } }\n\n@keyframes fadeIn {\n from {\n opacity: 0; }\n to {\n opacity: 1; } }\n\n.fadeIn {\n -webkit-animation-name: fadeIn;\n animation-name: fadeIn; }\n\n@-webkit-keyframes fadeInDown {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInDown {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInDown {\n -webkit-animation-name: fadeInDown;\n animation-name: fadeInDown; }\n\n@-webkit-keyframes fadeInDownBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInDownBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInDownBig {\n -webkit-animation-name: fadeInDownBig;\n animation-name: fadeInDownBig; }\n\n@-webkit-keyframes fadeInLeft {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInLeft {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInLeft {\n -webkit-animation-name: fadeInLeft;\n animation-name: fadeInLeft; }\n\n@-webkit-keyframes fadeInLeftBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInLeftBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInLeftBig {\n -webkit-animation-name: fadeInLeftBig;\n animation-name: fadeInLeftBig; }\n\n@-webkit-keyframes fadeInRight {\n from {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInRight {\n from {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInRight {\n -webkit-animation-name: fadeInRight;\n animation-name: fadeInRight; }\n\n@-webkit-keyframes fadeInRightBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInRightBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInRightBig {\n -webkit-animation-name: fadeInRightBig;\n animation-name: fadeInRightBig; }\n\n@-webkit-keyframes fadeInUp {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInUp {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInUp {\n -webkit-animation-name: fadeInUp;\n animation-name: fadeInUp; }\n\n@-webkit-keyframes fadeInUpBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInUpBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInUpBig {\n -webkit-animation-name: fadeInUpBig;\n animation-name: fadeInUpBig; }\n\n@-webkit-keyframes fadeOut {\n from {\n opacity: 1; }\n to {\n opacity: 0; } }\n\n@keyframes fadeOut {\n from {\n opacity: 1; }\n to {\n opacity: 0; } }\n\n.fadeOut {\n -webkit-animation-name: fadeOut;\n animation-name: fadeOut; }\n\n@-webkit-keyframes fadeOutDown {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n@keyframes fadeOutDown {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n.fadeOutDown {\n -webkit-animation-name: fadeOutDown;\n animation-name: fadeOutDown; }\n\n@-webkit-keyframes fadeOutDownBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n@keyframes fadeOutDownBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n.fadeOutDownBig {\n -webkit-animation-name: fadeOutDownBig;\n animation-name: fadeOutDownBig; }\n\n@-webkit-keyframes fadeOutLeft {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n@keyframes fadeOutLeft {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n.fadeOutLeft {\n -webkit-animation-name: fadeOutLeft;\n animation-name: fadeOutLeft; }\n\n@-webkit-keyframes fadeOutLeftBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n@keyframes fadeOutLeftBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n.fadeOutLeftBig {\n -webkit-animation-name: fadeOutLeftBig;\n animation-name: fadeOutLeftBig; }\n\n@-webkit-keyframes fadeOutRight {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n@keyframes fadeOutRight {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n.fadeOutRight {\n -webkit-animation-name: fadeOutRight;\n animation-name: fadeOutRight; }\n\n@-webkit-keyframes fadeOutRightBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n@keyframes fadeOutRightBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n.fadeOutRightBig {\n -webkit-animation-name: fadeOutRightBig;\n animation-name: fadeOutRightBig; }\n\n@-webkit-keyframes fadeOutUp {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n@keyframes fadeOutUp {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n.fadeOutUp {\n -webkit-animation-name: fadeOutUp;\n animation-name: fadeOutUp; }\n\n@-webkit-keyframes fadeOutUpBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n@keyframes fadeOutUpBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n.fadeOutUpBig {\n -webkit-animation-name: fadeOutUpBig;\n animation-name: fadeOutUpBig; }\n\n@-webkit-keyframes flip {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 40% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 80% {\n -webkit-transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; } }\n\n@keyframes flip {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 40% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 80% {\n -webkit-transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; } }\n\n.animated.flip {\n -webkit-backface-visibility: visible;\n backface-visibility: visible;\n -webkit-animation-name: flip;\n animation-name: flip; }\n\n@-webkit-keyframes flipInX {\n from {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n@keyframes flipInX {\n from {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n.flipInX {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipInX;\n animation-name: flipInX; }\n\n@-webkit-keyframes flipInY {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n@keyframes flipInY {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n.flipInY {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipInY;\n animation-name: flipInY; }\n\n@-webkit-keyframes flipOutX {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n opacity: 0; } }\n\n@keyframes flipOutX {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n opacity: 0; } }\n\n.flipOutX {\n -webkit-animation-name: flipOutX;\n animation-name: flipOutX;\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important; }\n\n@-webkit-keyframes flipOutY {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n opacity: 0; } }\n\n@keyframes flipOutY {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n opacity: 0; } }\n\n.flipOutY {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipOutY;\n animation-name: flipOutY; }\n\n@-webkit-keyframes lightSpeedIn {\n from {\n -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg);\n transform: translate3d(100%, 0, 0) skewX(-30deg);\n opacity: 0; }\n 60% {\n -webkit-transform: skewX(20deg);\n transform: skewX(20deg);\n opacity: 1; }\n 80% {\n -webkit-transform: skewX(-5deg);\n transform: skewX(-5deg);\n opacity: 1; }\n to {\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes lightSpeedIn {\n from {\n -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg);\n transform: translate3d(100%, 0, 0) skewX(-30deg);\n opacity: 0; }\n 60% {\n -webkit-transform: skewX(20deg);\n transform: skewX(20deg);\n opacity: 1; }\n 80% {\n -webkit-transform: skewX(-5deg);\n transform: skewX(-5deg);\n opacity: 1; }\n to {\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.lightSpeedIn {\n -webkit-animation-name: lightSpeedIn;\n animation-name: lightSpeedIn;\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n\n@-webkit-keyframes lightSpeedOut {\n from {\n opacity: 1; }\n to {\n -webkit-transform: translate3d(100%, 0, 0) skewX(30deg);\n transform: translate3d(100%, 0, 0) skewX(30deg);\n opacity: 0; } }\n\n@keyframes lightSpeedOut {\n from {\n opacity: 1; }\n to {\n -webkit-transform: translate3d(100%, 0, 0) skewX(30deg);\n transform: translate3d(100%, 0, 0) skewX(30deg);\n opacity: 0; } }\n\n.lightSpeedOut {\n -webkit-animation-name: lightSpeedOut;\n animation-name: lightSpeedOut;\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n\n@-webkit-keyframes rotateIn {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, -200deg);\n transform: rotate3d(0, 0, 1, -200deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateIn {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, -200deg);\n transform: rotate3d(0, 0, 1, -200deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateIn {\n -webkit-animation-name: rotateIn;\n animation-name: rotateIn; }\n\n@-webkit-keyframes rotateInDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInDownLeft {\n -webkit-animation-name: rotateInDownLeft;\n animation-name: rotateInDownLeft; }\n\n@-webkit-keyframes rotateInDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInDownRight {\n -webkit-animation-name: rotateInDownRight;\n animation-name: rotateInDownRight; }\n\n@-webkit-keyframes rotateInUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInUpLeft {\n -webkit-animation-name: rotateInUpLeft;\n animation-name: rotateInUpLeft; }\n\n@-webkit-keyframes rotateInUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -90deg);\n transform: rotate3d(0, 0, 1, -90deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -90deg);\n transform: rotate3d(0, 0, 1, -90deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInUpRight {\n -webkit-animation-name: rotateInUpRight;\n animation-name: rotateInUpRight; }\n\n@-webkit-keyframes rotateOut {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n opacity: 1; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, 200deg);\n transform: rotate3d(0, 0, 1, 200deg);\n opacity: 0; } }\n\n@keyframes rotateOut {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n opacity: 1; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, 200deg);\n transform: rotate3d(0, 0, 1, 200deg);\n opacity: 0; } }\n\n.rotateOut {\n -webkit-animation-name: rotateOut;\n animation-name: rotateOut; }\n\n@-webkit-keyframes rotateOutDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; } }\n\n@keyframes rotateOutDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; } }\n\n.rotateOutDownLeft {\n -webkit-animation-name: rotateOutDownLeft;\n animation-name: rotateOutDownLeft; }\n\n@-webkit-keyframes rotateOutDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n@keyframes rotateOutDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n.rotateOutDownRight {\n -webkit-animation-name: rotateOutDownRight;\n animation-name: rotateOutDownRight; }\n\n@-webkit-keyframes rotateOutUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n@keyframes rotateOutUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n.rotateOutUpLeft {\n -webkit-animation-name: rotateOutUpLeft;\n animation-name: rotateOutUpLeft; }\n\n@-webkit-keyframes rotateOutUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 90deg);\n transform: rotate3d(0, 0, 1, 90deg);\n opacity: 0; } }\n\n@keyframes rotateOutUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 90deg);\n transform: rotate3d(0, 0, 1, 90deg);\n opacity: 0; } }\n\n.rotateOutUpRight {\n -webkit-animation-name: rotateOutUpRight;\n animation-name: rotateOutUpRight; }\n\n@-webkit-keyframes hinge {\n 0% {\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 20%, 60% {\n -webkit-transform: rotate3d(0, 0, 1, 80deg);\n transform: rotate3d(0, 0, 1, 80deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 40%, 80% {\n -webkit-transform: rotate3d(0, 0, 1, 60deg);\n transform: rotate3d(0, 0, 1, 60deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n opacity: 1; }\n to {\n -webkit-transform: translate3d(0, 700px, 0);\n transform: translate3d(0, 700px, 0);\n opacity: 0; } }\n\n@keyframes hinge {\n 0% {\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 20%, 60% {\n -webkit-transform: rotate3d(0, 0, 1, 80deg);\n transform: rotate3d(0, 0, 1, 80deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 40%, 80% {\n -webkit-transform: rotate3d(0, 0, 1, 60deg);\n transform: rotate3d(0, 0, 1, 60deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n opacity: 1; }\n to {\n -webkit-transform: translate3d(0, 700px, 0);\n transform: translate3d(0, 700px, 0);\n opacity: 0; } }\n\n.hinge {\n -webkit-animation-name: hinge;\n animation-name: hinge; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes rollIn {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);\n transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes rollIn {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);\n transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.rollIn {\n -webkit-animation-name: rollIn;\n animation-name: rollIn; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes rollOut {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);\n transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); } }\n\n@keyframes rollOut {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);\n transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); } }\n\n.rollOut {\n -webkit-animation-name: rollOut;\n animation-name: rollOut; }\n\n@-webkit-keyframes zoomIn {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 50% {\n opacity: 1; } }\n\n@keyframes zoomIn {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 50% {\n opacity: 1; } }\n\n.zoomIn {\n -webkit-animation-name: zoomIn;\n animation-name: zoomIn; }\n\n@-webkit-keyframes zoomInDown {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInDown {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInDown {\n -webkit-animation-name: zoomInDown;\n animation-name: zoomInDown; }\n\n@-webkit-keyframes zoomInLeft {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInLeft {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInLeft {\n -webkit-animation-name: zoomInLeft;\n animation-name: zoomInLeft; }\n\n@-webkit-keyframes zoomInRight {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInRight {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInRight {\n -webkit-animation-name: zoomInRight;\n animation-name: zoomInRight; }\n\n@-webkit-keyframes zoomInUp {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInUp {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInUp {\n -webkit-animation-name: zoomInUp;\n animation-name: zoomInUp; }\n\n@-webkit-keyframes zoomOut {\n from {\n opacity: 1; }\n 50% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n to {\n opacity: 0; } }\n\n@keyframes zoomOut {\n from {\n opacity: 1; }\n 50% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n to {\n opacity: 0; } }\n\n.zoomOut {\n -webkit-animation-name: zoomOut;\n animation-name: zoomOut; }\n\n@-webkit-keyframes zoomOutDown {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomOutDown {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomOutDown {\n -webkit-animation-name: zoomOutDown;\n animation-name: zoomOutDown; }\n\n@-webkit-keyframes zoomOutLeft {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0);\n transform: scale(0.1) translate3d(-2000px, 0, 0);\n -webkit-transform-origin: left center;\n transform-origin: left center; } }\n\n@keyframes zoomOutLeft {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0);\n transform: scale(0.1) translate3d(-2000px, 0, 0);\n -webkit-transform-origin: left center;\n transform-origin: left center; } }\n\n.zoomOutLeft {\n -webkit-animation-name: zoomOutLeft;\n animation-name: zoomOutLeft; }\n\n@-webkit-keyframes zoomOutRight {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(2000px, 0, 0);\n transform: scale(0.1) translate3d(2000px, 0, 0);\n -webkit-transform-origin: right center;\n transform-origin: right center; } }\n\n@keyframes zoomOutRight {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(2000px, 0, 0);\n transform: scale(0.1) translate3d(2000px, 0, 0);\n -webkit-transform-origin: right center;\n transform-origin: right center; } }\n\n.zoomOutRight {\n -webkit-animation-name: zoomOutRight;\n animation-name: zoomOutRight; }\n\n@-webkit-keyframes zoomOutUp {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomOutUp {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomOutUp {\n -webkit-animation-name: zoomOutUp;\n animation-name: zoomOutUp; }\n\n@-webkit-keyframes slideInDown {\n from {\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInDown {\n from {\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInDown {\n -webkit-animation-name: slideInDown;\n animation-name: slideInDown; }\n\n@-webkit-keyframes slideInLeft {\n from {\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInLeft {\n from {\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInLeft {\n -webkit-animation-name: slideInLeft;\n animation-name: slideInLeft; }\n\n@-webkit-keyframes slideInRight {\n from {\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInRight {\n from {\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInRight {\n -webkit-animation-name: slideInRight;\n animation-name: slideInRight; }\n\n@-webkit-keyframes slideInUp {\n from {\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInUp {\n from {\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInUp {\n -webkit-animation-name: slideInUp;\n animation-name: slideInUp; }\n\n@-webkit-keyframes slideOutDown {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n@keyframes slideOutDown {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n.slideOutDown {\n -webkit-animation-name: slideOutDown;\n animation-name: slideOutDown; }\n\n@-webkit-keyframes slideOutLeft {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n@keyframes slideOutLeft {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n.slideOutLeft {\n -webkit-animation-name: slideOutLeft;\n animation-name: slideOutLeft; }\n\n@-webkit-keyframes slideOutRight {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n@keyframes slideOutRight {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n.slideOutRight {\n -webkit-animation-name: slideOutRight;\n animation-name: slideOutRight; }\n\n@-webkit-keyframes slideOutUp {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n@keyframes slideOutUp {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n.slideOutUp {\n -webkit-animation-name: slideOutUp;\n animation-name: slideOutUp; }\n\nbody {\n padding: 0;\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n font-size: 14px; }\n\na {\n color: #FFF;\n transition: color 0.4s ease;\n text-decoration: none; }\n a:hover {\n color: #fb8c00;\n text-decoration: underline; }\n\n#bg {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1;\n background-color: #000; }\n #bg > div {\n background-size: cover;\n background-position: center center;\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n visibility: hidden;\n transition: opacity 3s ease, visibility 3s;\n animation: bg 30s linear infinite; }\n #bg > div:nth-child(1) {\n animation-delay: 10s; }\n #bg > div:nth-child(2) {\n animation-delay: 20s; }\n\n#root {\n position: fixed;\n top: 15vh;\n left: 10vw;\n z-index: 2;\n color: #FFF;\n display: flex;\n flex-direction: column; }\n #root h1 {\n font-size: 4rem;\n font-weight: bold;\n color: #FFF;\n padding: 0;\n margin: 0;\n animation: headerIntro 3s ease; }\n #root h2 {\n font-size: 1.5rem;\n font-weight: normal;\n color: rgba(255, 255, 255, 0.7);\n padding: 0;\n margin: 0 0 25px 0;\n animation: headerIntro 3s ease; }\n #root h3 {\n font-size: 1.25rem;\n font-weight: normal;\n color: #FB8C00;\n padding: 0;\n margin: 0;\n animation: shake 1s ease; }\n #root h3 > .fa {\n margin-right: 7px; }\n #root h4 {\n font-size: 0.8rem;\n font-weight: normal;\n color: rgba(255, 255, 255, 0.7);\n padding: 0;\n margin: 0 0 15px 0;\n animation: fadeIn 3s ease; }\n #root form {\n display: flex;\n flex-direction: column; }\n #root input[type=text], #root input[type=password] {\n width: 350px;\n max-width: 80vw;\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: 3px;\n background-color: rgba(0, 0, 0, 0.2);\n padding: 0 15px;\n height: 40px;\n margin: 0 0 10px 0;\n color: #FFF;\n font-weight: bold;\n font-size: 14px;\n transition: all 0.4s ease; }\n #root input[type=text]:focus, #root input[type=password]:focus {\n outline: none;\n border-color: #fb8c00; }\n #root button {\n background-color: #fb8c00;\n color: #FFF;\n border: 1px solid #ffa32f;\n border-radius: 3px;\n height: 40px;\n width: 125px;\n padding: 0;\n font-weight: bold;\n margin: 15px 0 0 0;\n transition: all 0.4s ease;\n cursor: pointer; }\n #root button span {\n font-weight: bold; }\n #root button:focus {\n outline: none;\n border-color: #FFF; }\n #root button:hover {\n background-color: #c87000; }\n #root #social {\n margin-top: 25px; }\n #root #social > span {\n display: block;\n font-weight: bold;\n color: rgba(255, 255, 255, 0.7); }\n #root #social button {\n margin-right: 5px;\n width: auto;\n padding: 0 15px; }\n #root #social button > i {\n margin-right: 10px;\n font-size: 16px; }\n #root #social button.ms {\n background-color: #1e88e5;\n border-color: #4ca0ea; }\n #root #social button.ms:focus {\n border-color: #FFF; }\n #root #social button.ms:hover {\n background-color: #166dba; }\n #root #social button.google {\n background-color: #039be5;\n border-color: #1fb4fc; }\n #root #social button.google:focus {\n border-color: #FFF; }\n #root #social button.google:hover {\n background-color: #0279b3; }\n #root #social button.facebook {\n background-color: #3949ab;\n border-color: #5262c5; }\n #root #social button.facebook:focus {\n border-color: #FFF; }\n #root #social button.facebook:hover {\n background-color: #2c3985; }\n #root #social button.github {\n background-color: #455a64;\n border-color: #5a7582; }\n #root #social button.github:focus {\n border-color: #FFF; }\n #root #social button.github:hover {\n background-color: #303f46; }\n #root #social button.slack {\n background-color: #7b1fa2;\n border-color: #9c27cd; }\n #root #social button.slack:focus {\n border-color: #FFF; }\n #root #social button.slack:hover {\n background-color: #5a1777; }\n\n#copyright {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n position: absolute;\n left: 10vw;\n bottom: 10vh;\n z-index: 2;\n color: rgba(255, 255, 255, 0.5);\n font-weight: bold; }\n #copyright .icon {\n font-size: 1.2rem;\n margin: 0 8px; }\n #copyright a {\n opacity: 0.75; }\n\n@-webkit-keyframes bg {\n 0% {\n -webkit-transform: scale(1, 1);\n -moz-transform: scale(1, 1);\n -ms-transform: scale(1, 1);\n -o-transform: scale(1, 1);\n transform: scale(1, 1);\n visibility: visible;\n opacity: 0; }\n \n 5% {\n opacity: 0.5; }\n \n 33% {\n opacity: 0.5; }\n \n 38% {\n -webkit-transform: scale(1.2, 1.2);\n -moz-transform: scale(1.2, 1.2);\n -ms-transform: scale(1.2, 1.2);\n -o-transform: scale(1.2, 1.2);\n transform: scale(1.2, 1.2);\n opacity: 0; }\n \n 39% {\n visibility: hidden; }\n 100% {\n visibility: hidden;\n opacity: 0; } }\n\n@-moz-keyframes bg {\n 0% {\n -webkit-transform: scale(1, 1);\n -moz-transform: scale(1, 1);\n -ms-transform: scale(1, 1);\n -o-transform: scale(1, 1);\n transform: scale(1, 1);\n visibility: visible;\n opacity: 0; }\n \n 5% {\n opacity: 0.5; }\n \n 33% {\n opacity: 0.5; }\n \n 38% {\n -webkit-transform: scale(1.2, 1.2);\n -moz-transform: scale(1.2, 1.2);\n -ms-transform: scale(1.2, 1.2);\n -o-transform: scale(1.2, 1.2);\n transform: scale(1.2, 1.2);\n opacity: 0; }\n \n 39% {\n visibility: hidden; }\n 100% {\n visibility: hidden;\n opacity: 0; } }\n\n@-o-keyframes bg {\n 0% {\n -webkit-transform: scale(1, 1);\n -moz-transform: scale(1, 1);\n -ms-transform: scale(1, 1);\n -o-transform: scale(1, 1);\n transform: scale(1, 1);\n visibility: visible;\n opacity: 0; }\n \n 5% {\n opacity: 0.5; }\n \n 33% {\n opacity: 0.5; }\n \n 38% {\n -webkit-transform: scale(1.2, 1.2);\n -moz-transform: scale(1.2, 1.2);\n -ms-transform: scale(1.2, 1.2);\n -o-transform: scale(1.2, 1.2);\n transform: scale(1.2, 1.2);\n opacity: 0; }\n \n 39% {\n visibility: hidden; }\n 100% {\n visibility: hidden;\n opacity: 0; } }\n\n@keyframes bg {\n 0% {\n -webkit-transform: scale(1, 1);\n -moz-transform: scale(1, 1);\n -ms-transform: scale(1, 1);\n -o-transform: scale(1, 1);\n transform: scale(1, 1);\n visibility: visible;\n opacity: 0; }\n \n 5% {\n opacity: 0.5; }\n \n 33% {\n opacity: 0.5; }\n \n 38% {\n -webkit-transform: scale(1.2, 1.2);\n -moz-transform: scale(1.2, 1.2);\n -ms-transform: scale(1.2, 1.2);\n -o-transform: scale(1.2, 1.2);\n transform: scale(1.2, 1.2);\n opacity: 0; }\n \n 39% {\n visibility: hidden; }\n 100% {\n visibility: hidden;\n opacity: 0; } }\n\n@-webkit-keyframes headerIntro {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@-moz-keyframes headerIntro {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@-o-keyframes headerIntro {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n@keyframes headerIntro {\n 0% {\n opacity: 0; }\n 100% {\n opacity: 1; } }\n\n/*# sourceMappingURL=login.scss.map */");
  62. });
  63. ___scope___.file("js/login.js", function(exports, require, module, __filename, __dirname){
  64. 'use strict';
  65. var _jquery = require('jquery');
  66. var _jquery2 = _interopRequireDefault(_jquery);
  67. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  68. (0, _jquery2.default)(document).ready(function ($) {
  69. $('#login-user').focus();
  70. });
  71. });
  72. ___scope___.file("scss/app.scss", function(exports, require, module, __filename, __dirname){
  73. __fsbx_css("scss/app.scss", "@charset \"UTF-8\";\n/*\r\n\tHTML5 Reset :: style.css\r\n\t----------------------------------------------------------\r\n\tWe have learned much from/been inspired by/taken code where offered from:\r\n\tEric Meyer\t\t\t\t\t:: http://meyerweb.com\r\n\tHTML5 Doctor\t\t\t\t:: http://html5doctor.com\r\n\tand the HTML5 Boilerplate\t:: http://html5boilerplate.com\r\n-------------------------------------------------------------------------------*/\n/* Let's default this puppy out\r\n-------------------------------------------------------------------------------*/\nhtml, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, menu, nav, section, time, mark, audio, video, details, summary {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font-weight: normal;\n vertical-align: baseline;\n background: transparent; }\n\nmain, article, aside, figure, footer, header, nav, section, details, summary {\n display: block; }\n\n/* Handle box-sizing while better addressing child elements:\r\n http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ */\nhtml {\n box-sizing: border-box; }\n\n*,\n*:before,\n*:after {\n box-sizing: inherit; }\n\n/* consider resetting the default cursor: https://gist.github.com/murtaugh/5247154 */\n/* Responsive images and other embedded objects */\n/* if you don't have full control over `img` tags (if you have to overcome attributes), consider adding height: auto */\nimg,\nobject,\nembed {\n max-width: 100%; }\n\n/*\r\n Note: keeping IMG here will cause problems if you're using foreground images as sprites.\r\n\tIn fact, it *will* cause problems with Google Maps' controls at small size.\r\n\tIf this is the case for you, try uncommenting the following:\r\n#map img {\r\n\t\tmax-width: none;\r\n}\r\n*/\n/* force a vertical scrollbar to prevent a jumpy page */\nhtml {\n overflow-y: scroll; }\n\n/* we use a lot of ULs that aren't bulleted.\r\n\tyou'll have to restore the bullets within content,\r\n\twhich is fine because they're probably customized anyway */\nul {\n list-style: none; }\n\nblockquote, q {\n quotes: none; }\n\nblockquote:before,\nblockquote:after,\nq:before,\nq:after {\n content: '';\n content: none; }\n\na {\n margin: 0;\n padding: 0;\n font-size: 100%;\n vertical-align: baseline;\n background: transparent; }\n\ndel {\n text-decoration: line-through; }\n\nabbr[title], dfn[title] {\n border-bottom: 1px dotted #000;\n cursor: help; }\n\n/* tables still need cellspacing=\"0\" in the markup */\ntable {\n border-collapse: separate;\n border-spacing: 0; }\n\nth {\n font-weight: bold;\n vertical-align: bottom; }\n\ntd {\n font-weight: normal;\n vertical-align: top; }\n\nhr {\n display: block;\n height: 1px;\n border: 0;\n border-top: 1px solid #ccc;\n margin: 1em 0;\n padding: 0; }\n\ninput, select {\n vertical-align: middle; }\n\npre {\n white-space: pre;\n /* CSS2 */\n white-space: pre-wrap;\n /* CSS 2.1 */\n white-space: pre-line;\n /* CSS 3 (and 2.1 as well, actually) */\n word-wrap: break-word;\n /* IE */ }\n\ninput[type=\"radio\"] {\n vertical-align: text-bottom; }\n\ninput[type=\"checkbox\"] {\n vertical-align: bottom; }\n\n.ie7 input[type=\"checkbox\"] {\n vertical-align: baseline; }\n\n.ie6 input {\n vertical-align: text-bottom; }\n\nselect, input, textarea {\n font: 99% sans-serif; }\n\ntable {\n font-size: inherit;\n font: 100%; }\n\nsmall {\n font-size: 85%; }\n\nstrong {\n font-weight: bold; }\n\ntd, td img {\n vertical-align: top; }\n\n/* Make sure sup and sub don't mess with your line-heights http://gist.github.com/413930 */\nsub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative; }\n\nsup {\n top: -0.5em; }\n\nsub {\n bottom: -0.25em; }\n\n/* standardize any monospaced elements */\npre, code, kbd, samp {\n font-family: monospace, sans-serif; }\n\n/* hand cursor on clickable elements */\n.clickable,\nlabel,\ninput[type=button],\ninput[type=submit],\ninput[type=file],\nbutton {\n cursor: pointer; }\n\n/* Webkit browsers add a 2px margin outside the chrome of form elements */\nbutton, input, select, textarea {\n margin: 0; }\n\n/* make buttons play nice in IE */\nbutton,\ninput[type=button] {\n width: auto;\n overflow: visible; }\n\n/* scale images in IE7 more attractively */\n.ie7 img {\n -ms-interpolation-mode: bicubic; }\n\n/* prevent BG image flicker upon hover\r\n (commented out as usage is rare, and the filter syntax messes with some pre-processors)\r\n.ie6 html {filter: expression(document.execCommand(\"BackgroundImageCache\", false, true));}\r\n*/\n/* let's clear some floats */\n.clearfix:after {\n content: \" \";\n display: block;\n clear: both; }\n\n/**\r\n * Clearfix\r\n *\r\n * @return {string} Clearfix attribute\r\n */\n/**\r\n * Placeholder attribute for inputs\r\n *\r\n * @return {string} Placeholder attributes\r\n */\n/**\r\n * Spinner element\r\n *\r\n * @param {string} $color - Color\r\n * @param {string} $dur - Animation Duration\r\n * @param {int} $width - Width\r\n * @param {int} $height [$width] - height\r\n *\r\n * @return {string} Spinner element\r\n */\n/**\r\n * Prefixes for keyframes\r\n *\r\n * @param {string} $animation-name - The animation name\r\n *\r\n * @return {string} Prefixed keyframes attributes\r\n */\n/**\r\n * Prefix function for browser compatibility\r\n *\r\n * @param {string} $property - Property name\r\n * @param {any} $value - Property value\r\n *\r\n * @return {string} Prefixed attributes\r\n */\n/**\r\n * Layout Mixins\r\n */\n@font-face {\n font-family: 'core-icons';\n src: url(\"/fonts/core-icons.ttf?e6rn1i\") format(\"truetype\"), url(\"/fonts/core-icons.woff?e6rn1i\") format(\"woff\"), url(\"/fonts/core-icons.svg?e6rn1i#core-icons\") format(\"svg\");\n font-weight: normal;\n font-style: normal; }\n\n[class^=\"icon-\"], [class*=\" icon-\"] {\n /* use !important to prevent issues with browser extensions that change fonts */\n font-family: 'core-icons' !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale; }\n\n.icon-minus2:before {\n content: \"\"; }\n\n.icon-font:before {\n content: \"\"; }\n\n.icon-bold:before {\n content: \"\"; }\n\n.icon-italic:before {\n content: \"\"; }\n\n.icon-align-left2:before {\n content: \"\"; }\n\n.icon-align-center2:before {\n content: \"\"; }\n\n.icon-align-right2:before {\n content: \"\"; }\n\n.icon-align-justify2:before {\n content: \"\"; }\n\n.icon-list:before {\n content: \"\"; }\n\n.icon-video-camera2:before {\n content: \"\"; }\n\n.icon-image3:before {\n content: \"\"; }\n\n.icon-photo:before {\n content: \"\"; }\n\n.icon-picture-o:before {\n content: \"\"; }\n\n.icon-twitter-square:before {\n content: \"\"; }\n\n.icon-facebook-square:before {\n content: \"\"; }\n\n.icon-linkedin-square:before {\n content: \"\"; }\n\n.icon-github-square:before {\n content: \"\"; }\n\n.icon-twitter:before {\n content: \"\"; }\n\n.icon-facebook:before {\n content: \"\"; }\n\n.icon-facebook-f:before {\n content: \"\"; }\n\n.icon-github:before {\n content: \"\"; }\n\n.icon-chain:before {\n content: \"\"; }\n\n.icon-link3:before {\n content: \"\"; }\n\n.icon-bars:before {\n content: \"\"; }\n\n.icon-navicon:before {\n content: \"\"; }\n\n.icon-reorder:before {\n content: \"\"; }\n\n.icon-list-ul:before {\n content: \"\"; }\n\n.icon-list-ol:before {\n content: \"\"; }\n\n.icon-strikethrough:before {\n content: \"\"; }\n\n.icon-underline:before {\n content: \"\"; }\n\n.icon-table:before {\n content: \"\"; }\n\n.icon-linkedin:before {\n content: \"\"; }\n\n.icon-file-text-o:before {\n content: \"\"; }\n\n.icon-quote-left:before {\n content: \"\"; }\n\n.icon-terminal:before {\n content: \"\"; }\n\n.icon-code:before {\n content: \"\"; }\n\n.icon-youtube-play:before {\n content: \"\"; }\n\n.icon-dropbox:before {\n content: \"\"; }\n\n.icon-stack-overflow:before {\n content: \"\"; }\n\n.icon-bitbucket:before {\n content: \"\"; }\n\n.icon-apple:before {\n content: \"\"; }\n\n.icon-windows2:before {\n content: \"\"; }\n\n.icon-android:before {\n content: \"\"; }\n\n.icon-linux:before {\n content: \"\"; }\n\n.icon-vimeo-square:before {\n content: \"\"; }\n\n.icon-slack:before {\n content: \"\"; }\n\n.icon-google:before {\n content: \"\"; }\n\n.icon-git-square:before {\n content: \"\"; }\n\n.icon-git:before {\n content: \"\"; }\n\n.icon-header:before {\n content: \"\"; }\n\n.icon-safari:before {\n content: \"\"; }\n\n.icon-chrome:before {\n content: \"\"; }\n\n.icon-firefox:before {\n content: \"\"; }\n\n.icon-opera:before {\n content: \"\"; }\n\n.icon-internet-explorer:before {\n content: \"\"; }\n\n.icon-vimeo:before {\n content: \"\"; }\n\n.icon-edge:before {\n content: \"\"; }\n\n.icon-gitlab:before {\n content: \"\"; }\n\n.icon-th-small:before {\n content: \"\"; }\n\n.icon-th-menu:before {\n content: \"\"; }\n\n.icon-th-list:before {\n content: \"\"; }\n\n.icon-th-large:before {\n content: \"\"; }\n\n.icon-home:before {\n content: \"\"; }\n\n.icon-location:before {\n content: \"\"; }\n\n.icon-link:before {\n content: \"\"; }\n\n.icon-starburst:before {\n content: \"\"; }\n\n.icon-starburst-outline:before {\n content: \"\"; }\n\n.icon-star:before {\n content: \"\"; }\n\n.icon-flow-children:before {\n content: \"\"; }\n\n.icon-export:before {\n content: \"\"; }\n\n.icon-delete:before {\n content: \"\"; }\n\n.icon-delete-outline:before {\n content: \"\"; }\n\n.icon-cloud-storage:before {\n content: \"\"; }\n\n.icon-backspace:before {\n content: \"\"; }\n\n.icon-attachment:before {\n content: \"\"; }\n\n.icon-arrow-move:before {\n content: \"\"; }\n\n.icon-warning:before {\n content: \"\"; }\n\n.icon-location-arrow:before {\n content: \"\"; }\n\n.icon-point-of-interest:before {\n content: \"\"; }\n\n.icon-infinity:before {\n content: \"\"; }\n\n.icon-eye:before {\n content: \"\"; }\n\n.icon-refresh:before {\n content: \"\"; }\n\n.icon-pin:before {\n content: \"\"; }\n\n.icon-eject:before {\n content: \"\"; }\n\n.icon-arrow-sync:before {\n content: \"\"; }\n\n.icon-arrow-shuffle:before {\n content: \"\"; }\n\n.icon-arrow-repeat:before {\n content: \"\"; }\n\n.icon-arrow-minimise:before {\n content: \"\"; }\n\n.icon-arrow-maximise:before {\n content: \"\"; }\n\n.icon-arrow-loop:before {\n content: \"\"; }\n\n.icon-spanner:before {\n content: \"\"; }\n\n.icon-power:before {\n content: \"\"; }\n\n.icon-flag:before {\n content: \"\"; }\n\n.icon-th-large-outline:before {\n content: \"\"; }\n\n.icon-th-small-outline:before {\n content: \"\"; }\n\n.icon-th-menu-outline:before {\n content: \"\"; }\n\n.icon-th-list-outline:before {\n content: \"\"; }\n\n.icon-home-outline:before {\n content: \"\"; }\n\n.icon-trash:before {\n content: \"\"; }\n\n.icon-star-outline:before {\n content: \"\"; }\n\n.icon-mail:before {\n content: \"\"; }\n\n.icon-heart-outline:before {\n content: \"\"; }\n\n.icon-flash-outline:before {\n content: \"\"; }\n\n.icon-watch:before {\n content: \"\"; }\n\n.icon-warning-outline:before {\n content: \"\"; }\n\n.icon-location-arrow-outline:before {\n content: \"\"; }\n\n.icon-info-outline:before {\n content: \"\"; }\n\n.icon-backspace-outline:before {\n content: \"\"; }\n\n.icon-upload-outline:before {\n content: \"\"; }\n\n.icon-tag:before {\n content: \"\"; }\n\n.icon-tabs-outline:before {\n content: \"\"; }\n\n.icon-pin-outline:before {\n content: \"\"; }\n\n.icon-pipette:before {\n content: \"\"; }\n\n.icon-pencil:before {\n content: \"\"; }\n\n.icon-folder:before {\n content: \"\"; }\n\n.icon-folder-delete:before {\n content: \"\"; }\n\n.icon-folder-add:before {\n content: \"\"; }\n\n.icon-edit:before {\n content: \"\"; }\n\n.icon-document:before {\n content: \"\"; }\n\n.icon-document-delete:before {\n content: \"\"; }\n\n.icon-document-add:before {\n content: \"\"; }\n\n.icon-brush:before {\n content: \"\"; }\n\n.icon-thumbs-up:before {\n content: \"\"; }\n\n.icon-thumbs-down:before {\n content: \"\"; }\n\n.icon-pen:before {\n content: \"\"; }\n\n.icon-bookmark:before {\n content: \"\"; }\n\n.icon-arrow-up:before {\n content: \"\"; }\n\n.icon-arrow-sync-outline:before {\n content: \"\"; }\n\n.icon-arrow-right:before {\n content: \"\"; }\n\n.icon-arrow-repeat-outline:before {\n content: \"\"; }\n\n.icon-arrow-loop-outline:before {\n content: \"\"; }\n\n.icon-arrow-left:before {\n content: \"\"; }\n\n.icon-flow-switch:before {\n content: \"\"; }\n\n.icon-flow-parallel:before {\n content: \"\"; }\n\n.icon-flow-merge:before {\n content: \"\"; }\n\n.icon-document-text:before {\n content: \"\"; }\n\n.icon-arrow-down:before {\n content: \"\"; }\n\n.icon-bell:before {\n content: \"\"; }\n\n.icon-adjust-contrast:before {\n content: \"\"; }\n\n.icon-lightbulb:before {\n content: \"\"; }\n\n.icon-tags:before {\n content: \"\"; }\n\n.icon-eye2:before {\n content: \"\"; }\n\n.icon-paper-clip:before {\n content: \"\"; }\n\n.icon-mail2:before {\n content: \"\"; }\n\n.icon-toggle:before {\n content: \"\"; }\n\n.icon-layout:before {\n content: \"\"; }\n\n.icon-link2:before {\n content: \"\"; }\n\n.icon-bell2:before {\n content: \"\"; }\n\n.icon-lock:before {\n content: \"\"; }\n\n.icon-unlock:before {\n content: \"\"; }\n\n.icon-ribbon:before {\n content: \"\"; }\n\n.icon-image:before {\n content: \"\"; }\n\n.icon-signal:before {\n content: \"\"; }\n\n.icon-target:before {\n content: \"\"; }\n\n.icon-clipboard:before {\n content: \"\"; }\n\n.icon-clock:before {\n content: \"\"; }\n\n.icon-watch2:before {\n content: \"\"; }\n\n.icon-air-play:before {\n content: \"\"; }\n\n.icon-camera:before {\n content: \"\"; }\n\n.icon-video:before {\n content: \"\"; }\n\n.icon-disc:before {\n content: \"\"; }\n\n.icon-printer:before {\n content: \"\"; }\n\n.icon-monitor:before {\n content: \"\"; }\n\n.icon-server:before {\n content: \"\"; }\n\n.icon-cog:before {\n content: \"\"; }\n\n.icon-heart:before {\n content: \"\"; }\n\n.icon-paragraph:before {\n content: \"\"; }\n\n.icon-align-justify:before {\n content: \"\"; }\n\n.icon-align-left:before {\n content: \"\"; }\n\n.icon-align-center:before {\n content: \"\"; }\n\n.icon-align-right:before {\n content: \"\"; }\n\n.icon-book:before {\n content: \"\"; }\n\n.icon-layers:before {\n content: \"\"; }\n\n.icon-stack:before {\n content: \"\"; }\n\n.icon-stack-2:before {\n content: \"\"; }\n\n.icon-paper:before {\n content: \"\"; }\n\n.icon-paper-stack:before {\n content: \"\"; }\n\n.icon-search:before {\n content: \"\"; }\n\n.icon-zoom-in:before {\n content: \"\"; }\n\n.icon-zoom-out:before {\n content: \"\"; }\n\n.icon-reply:before {\n content: \"\"; }\n\n.icon-circle-plus:before {\n content: \"\"; }\n\n.icon-circle-minus:before {\n content: \"\"; }\n\n.icon-circle-check:before {\n content: \"\"; }\n\n.icon-circle-cross:before {\n content: \"\"; }\n\n.icon-square-plus:before {\n content: \"\"; }\n\n.icon-square-minus:before {\n content: \"\"; }\n\n.icon-square-check:before {\n content: \"\"; }\n\n.icon-square-cross:before {\n content: \"\"; }\n\n.icon-microphone:before {\n content: \"\"; }\n\n.icon-record:before {\n content: \"\"; }\n\n.icon-skip-back:before {\n content: \"\"; }\n\n.icon-rewind:before {\n content: \"\"; }\n\n.icon-play:before {\n content: \"\"; }\n\n.icon-pause:before {\n content: \"\"; }\n\n.icon-stop:before {\n content: \"\"; }\n\n.icon-fast-forward:before {\n content: \"\"; }\n\n.icon-skip-forward:before {\n content: \"\"; }\n\n.icon-shuffle:before {\n content: \"\"; }\n\n.icon-repeat:before {\n content: \"\"; }\n\n.icon-folder2:before {\n content: \"\"; }\n\n.icon-umbrella:before {\n content: \"\"; }\n\n.icon-moon:before {\n content: \"\"; }\n\n.icon-thermometer:before {\n content: \"\"; }\n\n.icon-drop:before {\n content: \"\"; }\n\n.icon-sun:before {\n content: \"\"; }\n\n.icon-cloud:before {\n content: \"\"; }\n\n.icon-cloud-upload:before {\n content: \"\"; }\n\n.icon-cloud-download:before {\n content: \"\"; }\n\n.icon-upload:before {\n content: \"\"; }\n\n.icon-download:before {\n content: \"\"; }\n\n.icon-location2:before {\n content: \"\"; }\n\n.icon-location-2:before {\n content: \"\"; }\n\n.icon-map:before {\n content: \"\"; }\n\n.icon-battery:before {\n content: \"\"; }\n\n.icon-head:before {\n content: \"\"; }\n\n.icon-briefcase:before {\n content: \"\"; }\n\n.icon-speech-bubble:before {\n content: \"\"; }\n\n.icon-anchor:before {\n content: \"\"; }\n\n.icon-globe:before {\n content: \"\"; }\n\n.icon-box:before {\n content: \"\"; }\n\n.icon-reload:before {\n content: \"\"; }\n\n.icon-share:before {\n content: \"\"; }\n\n.icon-marquee:before {\n content: \"\"; }\n\n.icon-marquee-plus:before {\n content: \"\"; }\n\n.icon-marquee-minus:before {\n content: \"\"; }\n\n.icon-tag2:before {\n content: \"\"; }\n\n.icon-power2:before {\n content: \"\"; }\n\n.icon-command:before {\n content: \"\"; }\n\n.icon-alt:before {\n content: \"\"; }\n\n.icon-esc:before {\n content: \"\"; }\n\n.icon-bar-graph:before {\n content: \"\"; }\n\n.icon-bar-graph-2:before {\n content: \"\"; }\n\n.icon-pie-graph:before {\n content: \"\"; }\n\n.icon-star2:before {\n content: \"\"; }\n\n.icon-arrow-left2:before {\n content: \"\"; }\n\n.icon-arrow-right2:before {\n content: \"\"; }\n\n.icon-arrow-up2:before {\n content: \"\"; }\n\n.icon-arrow-down2:before {\n content: \"\"; }\n\n.icon-volume:before {\n content: \"\"; }\n\n.icon-mute:before {\n content: \"\"; }\n\n.icon-content-right:before {\n content: \"\"; }\n\n.icon-content-left:before {\n content: \"\"; }\n\n.icon-grid:before {\n content: \"\"; }\n\n.icon-grid-2:before {\n content: \"\"; }\n\n.icon-columns:before {\n content: \"\"; }\n\n.icon-loader:before {\n content: \"\"; }\n\n.icon-bag:before {\n content: \"\"; }\n\n.icon-ban:before {\n content: \"\"; }\n\n.icon-flag2:before {\n content: \"\"; }\n\n.icon-trash2:before {\n content: \"\"; }\n\n.icon-expand:before {\n content: \"\"; }\n\n.icon-contract:before {\n content: \"\"; }\n\n.icon-maximize:before {\n content: \"\"; }\n\n.icon-minimize:before {\n content: \"\"; }\n\n.icon-plus:before {\n content: \"\"; }\n\n.icon-minus:before {\n content: \"\"; }\n\n.icon-check:before {\n content: \"\"; }\n\n.icon-cross:before {\n content: \"\"; }\n\n.icon-move:before {\n content: \"\"; }\n\n.icon-delete2:before {\n content: \"\"; }\n\n.icon-menu:before {\n content: \"\"; }\n\n.icon-archive:before {\n content: \"\"; }\n\n.icon-inbox:before {\n content: \"\"; }\n\n.icon-outbox:before {\n content: \"\"; }\n\n.icon-file:before {\n content: \"\"; }\n\n.icon-file-add:before {\n content: \"\"; }\n\n.icon-file-subtract:before {\n content: \"\"; }\n\n.icon-help:before {\n content: \"\"; }\n\n.icon-open:before {\n content: \"\"; }\n\n.icon-ellipsis:before {\n content: \"\"; }\n\n.icon-box2:before {\n content: \"\"; }\n\n.icon-write:before {\n content: \"\"; }\n\n.icon-clock2:before {\n content: \"\"; }\n\n.icon-reply2:before {\n content: \"\"; }\n\n.icon-reply-all:before {\n content: \"\"; }\n\n.icon-forward:before {\n content: \"\"; }\n\n.icon-flag3:before {\n content: \"\"; }\n\n.icon-search2:before {\n content: \"\"; }\n\n.icon-trash3:before {\n content: \"\"; }\n\n.icon-envelope:before {\n content: \"\"; }\n\n.icon-bubble:before {\n content: \"\"; }\n\n.icon-bubbles:before {\n content: \"\"; }\n\n.icon-user:before {\n content: \"\"; }\n\n.icon-users:before {\n content: \"\"; }\n\n.icon-cloud2:before {\n content: \"\"; }\n\n.icon-download2:before {\n content: \"\"; }\n\n.icon-upload2:before {\n content: \"\"; }\n\n.icon-rain:before {\n content: \"\"; }\n\n.icon-sun2:before {\n content: \"\"; }\n\n.icon-moon2:before {\n content: \"\"; }\n\n.icon-bell3:before {\n content: \"\"; }\n\n.icon-folder3:before {\n content: \"\"; }\n\n.icon-pin2:before {\n content: \"\"; }\n\n.icon-sound:before {\n content: \"\"; }\n\n.icon-microphone2:before {\n content: \"\"; }\n\n.icon-camera2:before {\n content: \"\"; }\n\n.icon-image2:before {\n content: \"\"; }\n\n.icon-cog2:before {\n content: \"\"; }\n\n.icon-calendar:before {\n content: \"\"; }\n\n.icon-book2:before {\n content: \"\"; }\n\n.icon-map-marker:before {\n content: \"\"; }\n\n.icon-store:before {\n content: \"\"; }\n\n.icon-support:before {\n content: \"\"; }\n\n.icon-tag3:before {\n content: \"\"; }\n\n.icon-heart2:before {\n content: \"\"; }\n\n.icon-video-camera:before {\n content: \"\"; }\n\n.icon-trophy:before {\n content: \"\"; }\n\n.icon-cart:before {\n content: \"\"; }\n\n.icon-eye3:before {\n content: \"\"; }\n\n.icon-cancel:before {\n content: \"\"; }\n\n.icon-chart:before {\n content: \"\"; }\n\n.icon-target2:before {\n content: \"\"; }\n\n.icon-printer2:before {\n content: \"\"; }\n\n.icon-location3:before {\n content: \"\"; }\n\n.icon-bookmark2:before {\n content: \"\"; }\n\n.icon-monitor2:before {\n content: \"\"; }\n\n.icon-cross2:before {\n content: \"\"; }\n\n.icon-plus2:before {\n content: \"\"; }\n\n.icon-left:before {\n content: \"\"; }\n\n.icon-up:before {\n content: \"\"; }\n\n.icon-browser:before {\n content: \"\"; }\n\n.icon-windows:before {\n content: \"\"; }\n\n.icon-switch:before {\n content: \"\"; }\n\n.icon-dashboard:before {\n content: \"\"; }\n\n.icon-play2:before {\n content: \"\"; }\n\n.icon-fast-forward2:before {\n content: \"\"; }\n\n.icon-next:before {\n content: \"\"; }\n\n.icon-refresh2:before {\n content: \"\"; }\n\n.icon-film:before {\n content: \"\"; }\n\n.icon-home2:before {\n content: \"\"; }\n\nhtml {\n box-sizing: border-box;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"; }\n\n*, *:before, *:after {\n box-sizing: inherit; }\n\n[v-cloak], .is-hidden {\n display: none; }\n\nbody {\n background-color: #cfd8dc; }\n\nmain {\n background-color: #FFF; }\n\na {\n color: #3949ab;\n text-decoration: none; }\n a:hover {\n color: #303f9f;\n text-decoration: underline; }\n\n.has-stickynav {\n padding-top: 50px; }\n\n.container {\n position: relative; }\n @media screen and (min-width: 980px) {\n .container {\n margin: 0 auto;\n max-width: 960px; }\n .container.is-fluid {\n margin: 0;\n max-width: none; } }\n @media screen and (min-width: 1180px) {\n .container {\n max-width: 1200px; } }\n\n.content {\n padding: 20px; }\n\n.is-hidden {\n display: none !important; }\n\n@media screen and (max-width: 768px) {\n .is-hidden-mobile {\n display: none !important; } }\n\n@media screen and (min-width: 769px) {\n .is-hidden-tablet {\n display: none !important; } }\n\n@media screen and (min-width: 769px) and (max-width: 979px) {\n .is-hidden-tablet-only {\n display: none !important; } }\n\n@media screen and (max-width: 979px) {\n .is-hidden-touch {\n display: none !important; } }\n\n@media screen and (min-width: 980px) {\n .is-hidden-desktop {\n display: none !important; } }\n\n@media screen and (min-width: 980px) and (max-width: 1179px) {\n .is-hidden-desktop-only {\n display: none !important; } }\n\n@media screen and (min-width: 1180px) {\n .is-hidden-widescreen {\n display: none !important; } }\n\n/*!\r\n * animate.css -http://daneden.me/animate\r\n * Version - 3.5.1\r\n * Licensed under the MIT license - http://opensource.org/licenses/MIT\r\n *\r\n * Copyright (c) 2016 Daniel Eden\r\n */\n.animated {\n -webkit-animation-duration: 1s;\n animation-duration: 1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both; }\n .animated.infinite {\n -webkit-animation-iteration-count: infinite;\n animation-iteration-count: infinite; }\n .animated.hinge {\n -webkit-animation-duration: 2s;\n animation-duration: 2s; }\n .animated.flipOutX, .animated.flipOutY, .animated.bounceIn, .animated.bounceOut {\n -webkit-animation-duration: .75s;\n animation-duration: .75s; }\n\n@-webkit-keyframes bounce {\n from, 20%, 53%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 40%, 43% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -30px, 0);\n transform: translate3d(0, -30px, 0); }\n 70% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -15px, 0);\n transform: translate3d(0, -15px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -4px, 0);\n transform: translate3d(0, -4px, 0); } }\n\n@keyframes bounce {\n from, 20%, 53%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 40%, 43% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -30px, 0);\n transform: translate3d(0, -30px, 0); }\n 70% {\n -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n -webkit-transform: translate3d(0, -15px, 0);\n transform: translate3d(0, -15px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -4px, 0);\n transform: translate3d(0, -4px, 0); } }\n\n.bounce {\n -webkit-animation-name: bounce;\n animation-name: bounce;\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom; }\n\n@-webkit-keyframes flash {\n from, 50%, to {\n opacity: 1; }\n 25%, 75% {\n opacity: 0; } }\n\n@keyframes flash {\n from, 50%, to {\n opacity: 1; }\n 25%, 75% {\n opacity: 0; } }\n\n.flash {\n -webkit-animation-name: flash;\n animation-name: flash; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes pulse {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 50% {\n -webkit-transform: scale3d(1.05, 1.05, 1.05);\n transform: scale3d(1.05, 1.05, 1.05); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes pulse {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 50% {\n -webkit-transform: scale3d(1.05, 1.05, 1.05);\n transform: scale3d(1.05, 1.05, 1.05); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.pulse {\n -webkit-animation-name: pulse;\n animation-name: pulse; }\n\n@-webkit-keyframes rubberBand {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 30% {\n -webkit-transform: scale3d(1.25, 0.75, 1);\n transform: scale3d(1.25, 0.75, 1); }\n 40% {\n -webkit-transform: scale3d(0.75, 1.25, 1);\n transform: scale3d(0.75, 1.25, 1); }\n 50% {\n -webkit-transform: scale3d(1.15, 0.85, 1);\n transform: scale3d(1.15, 0.85, 1); }\n 65% {\n -webkit-transform: scale3d(0.95, 1.05, 1);\n transform: scale3d(0.95, 1.05, 1); }\n 75% {\n -webkit-transform: scale3d(1.05, 0.95, 1);\n transform: scale3d(1.05, 0.95, 1); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes rubberBand {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 30% {\n -webkit-transform: scale3d(1.25, 0.75, 1);\n transform: scale3d(1.25, 0.75, 1); }\n 40% {\n -webkit-transform: scale3d(0.75, 1.25, 1);\n transform: scale3d(0.75, 1.25, 1); }\n 50% {\n -webkit-transform: scale3d(1.15, 0.85, 1);\n transform: scale3d(1.15, 0.85, 1); }\n 65% {\n -webkit-transform: scale3d(0.95, 1.05, 1);\n transform: scale3d(0.95, 1.05, 1); }\n 75% {\n -webkit-transform: scale3d(1.05, 0.95, 1);\n transform: scale3d(1.05, 0.95, 1); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.rubberBand {\n -webkit-animation-name: rubberBand;\n animation-name: rubberBand; }\n\n@-webkit-keyframes shake {\n from, to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 10%, 30%, 50%, 70%, 90% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 20%, 40%, 60%, 80% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); } }\n\n@keyframes shake {\n from, to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n 10%, 30%, 50%, 70%, 90% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 20%, 40%, 60%, 80% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); } }\n\n.shake {\n -webkit-animation-name: shake;\n animation-name: shake; }\n\n@-webkit-keyframes headShake {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 6.5% {\n -webkit-transform: translateX(-6px) rotateY(-9deg);\n transform: translateX(-6px) rotateY(-9deg); }\n 18.5% {\n -webkit-transform: translateX(5px) rotateY(7deg);\n transform: translateX(5px) rotateY(7deg); }\n 31.5% {\n -webkit-transform: translateX(-3px) rotateY(-5deg);\n transform: translateX(-3px) rotateY(-5deg); }\n 43.5% {\n -webkit-transform: translateX(2px) rotateY(3deg);\n transform: translateX(2px) rotateY(3deg); }\n 50% {\n -webkit-transform: translateX(0);\n transform: translateX(0); } }\n\n@keyframes headShake {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 6.5% {\n -webkit-transform: translateX(-6px) rotateY(-9deg);\n transform: translateX(-6px) rotateY(-9deg); }\n 18.5% {\n -webkit-transform: translateX(5px) rotateY(7deg);\n transform: translateX(5px) rotateY(7deg); }\n 31.5% {\n -webkit-transform: translateX(-3px) rotateY(-5deg);\n transform: translateX(-3px) rotateY(-5deg); }\n 43.5% {\n -webkit-transform: translateX(2px) rotateY(3deg);\n transform: translateX(2px) rotateY(3deg); }\n 50% {\n -webkit-transform: translateX(0);\n transform: translateX(0); } }\n\n.headShake {\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n -webkit-animation-name: headShake;\n animation-name: headShake; }\n\n@-webkit-keyframes swing {\n 20% {\n -webkit-transform: rotate3d(0, 0, 1, 15deg);\n transform: rotate3d(0, 0, 1, 15deg); }\n 40% {\n -webkit-transform: rotate3d(0, 0, 1, -10deg);\n transform: rotate3d(0, 0, 1, -10deg); }\n 60% {\n -webkit-transform: rotate3d(0, 0, 1, 5deg);\n transform: rotate3d(0, 0, 1, 5deg); }\n 80% {\n -webkit-transform: rotate3d(0, 0, 1, -5deg);\n transform: rotate3d(0, 0, 1, -5deg); }\n to {\n -webkit-transform: rotate3d(0, 0, 1, 0deg);\n transform: rotate3d(0, 0, 1, 0deg); } }\n\n@keyframes swing {\n 20% {\n -webkit-transform: rotate3d(0, 0, 1, 15deg);\n transform: rotate3d(0, 0, 1, 15deg); }\n 40% {\n -webkit-transform: rotate3d(0, 0, 1, -10deg);\n transform: rotate3d(0, 0, 1, -10deg); }\n 60% {\n -webkit-transform: rotate3d(0, 0, 1, 5deg);\n transform: rotate3d(0, 0, 1, 5deg); }\n 80% {\n -webkit-transform: rotate3d(0, 0, 1, -5deg);\n transform: rotate3d(0, 0, 1, -5deg); }\n to {\n -webkit-transform: rotate3d(0, 0, 1, 0deg);\n transform: rotate3d(0, 0, 1, 0deg); } }\n\n.swing {\n -webkit-transform-origin: top center;\n transform-origin: top center;\n -webkit-animation-name: swing;\n animation-name: swing; }\n\n@-webkit-keyframes tada {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 10%, 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); }\n 30%, 50%, 70%, 90% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); }\n 40%, 60%, 80% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes tada {\n from {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n 10%, 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); }\n 30%, 50%, 70%, 90% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); }\n 40%, 60%, 80% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);\n transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); }\n to {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.tada {\n -webkit-animation-name: tada;\n animation-name: tada; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes wobble {\n from {\n -webkit-transform: none;\n transform: none; }\n 15% {\n -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);\n transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); }\n 30% {\n -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);\n transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); }\n 45% {\n -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);\n transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); }\n 60% {\n -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);\n transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); }\n 75% {\n -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);\n transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes wobble {\n from {\n -webkit-transform: none;\n transform: none; }\n 15% {\n -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);\n transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); }\n 30% {\n -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);\n transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); }\n 45% {\n -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);\n transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); }\n 60% {\n -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);\n transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); }\n 75% {\n -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);\n transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.wobble {\n -webkit-animation-name: wobble;\n animation-name: wobble; }\n\n@-webkit-keyframes jello {\n from, 11.1%, to {\n -webkit-transform: none;\n transform: none; }\n 22.2% {\n -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);\n transform: skewX(-12.5deg) skewY(-12.5deg); }\n 33.3% {\n -webkit-transform: skewX(6.25deg) skewY(6.25deg);\n transform: skewX(6.25deg) skewY(6.25deg); }\n 44.4% {\n -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);\n transform: skewX(-3.125deg) skewY(-3.125deg); }\n 55.5% {\n -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);\n transform: skewX(1.5625deg) skewY(1.5625deg); }\n 66.6% {\n -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);\n transform: skewX(-0.78125deg) skewY(-0.78125deg); }\n 77.7% {\n -webkit-transform: skewX(0.39063deg) skewY(0.39063deg);\n transform: skewX(0.39063deg) skewY(0.39063deg); }\n 88.8% {\n -webkit-transform: skewX(-0.19531deg) skewY(-0.19531deg);\n transform: skewX(-0.19531deg) skewY(-0.19531deg); } }\n\n@keyframes jello {\n from, 11.1%, to {\n -webkit-transform: none;\n transform: none; }\n 22.2% {\n -webkit-transform: skewX(-12.5deg) skewY(-12.5deg);\n transform: skewX(-12.5deg) skewY(-12.5deg); }\n 33.3% {\n -webkit-transform: skewX(6.25deg) skewY(6.25deg);\n transform: skewX(6.25deg) skewY(6.25deg); }\n 44.4% {\n -webkit-transform: skewX(-3.125deg) skewY(-3.125deg);\n transform: skewX(-3.125deg) skewY(-3.125deg); }\n 55.5% {\n -webkit-transform: skewX(1.5625deg) skewY(1.5625deg);\n transform: skewX(1.5625deg) skewY(1.5625deg); }\n 66.6% {\n -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg);\n transform: skewX(-0.78125deg) skewY(-0.78125deg); }\n 77.7% {\n -webkit-transform: skewX(0.39063deg) skewY(0.39063deg);\n transform: skewX(0.39063deg) skewY(0.39063deg); }\n 88.8% {\n -webkit-transform: skewX(-0.19531deg) skewY(-0.19531deg);\n transform: skewX(-0.19531deg) skewY(-0.19531deg); } }\n\n.jello {\n -webkit-animation-name: jello;\n animation-name: jello;\n -webkit-transform-origin: center;\n transform-origin: center; }\n\n@-webkit-keyframes bounceIn {\n from, 20%, 40%, 60%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 20% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n 40% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(1.03, 1.03, 1.03);\n transform: scale3d(1.03, 1.03, 1.03); }\n 80% {\n -webkit-transform: scale3d(0.97, 0.97, 0.97);\n transform: scale3d(0.97, 0.97, 0.97); }\n to {\n opacity: 1;\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n@keyframes bounceIn {\n from, 20%, 40%, 60%, 80%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 20% {\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n 40% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(1.03, 1.03, 1.03);\n transform: scale3d(1.03, 1.03, 1.03); }\n 80% {\n -webkit-transform: scale3d(0.97, 0.97, 0.97);\n transform: scale3d(0.97, 0.97, 0.97); }\n to {\n opacity: 1;\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); } }\n\n.bounceIn {\n -webkit-animation-name: bounceIn;\n animation-name: bounceIn; }\n\n@-webkit-keyframes bounceInDown {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(0, -3000px, 0);\n transform: translate3d(0, -3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, 25px, 0);\n transform: translate3d(0, 25px, 0); }\n 75% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, 5px, 0);\n transform: translate3d(0, 5px, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInDown {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(0, -3000px, 0);\n transform: translate3d(0, -3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, 25px, 0);\n transform: translate3d(0, 25px, 0); }\n 75% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, 5px, 0);\n transform: translate3d(0, 5px, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInDown {\n -webkit-animation-name: bounceInDown;\n animation-name: bounceInDown; }\n\n@-webkit-keyframes bounceInLeft {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(-3000px, 0, 0);\n transform: translate3d(-3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(25px, 0, 0);\n transform: translate3d(25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(5px, 0, 0);\n transform: translate3d(5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInLeft {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n 0% {\n opacity: 0;\n -webkit-transform: translate3d(-3000px, 0, 0);\n transform: translate3d(-3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(25px, 0, 0);\n transform: translate3d(25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(-10px, 0, 0);\n transform: translate3d(-10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(5px, 0, 0);\n transform: translate3d(5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInLeft {\n -webkit-animation-name: bounceInLeft;\n animation-name: bounceInLeft; }\n\n@-webkit-keyframes bounceInRight {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(3000px, 0, 0);\n transform: translate3d(3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(-25px, 0, 0);\n transform: translate3d(-25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(-5px, 0, 0);\n transform: translate3d(-5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes bounceInRight {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(3000px, 0, 0);\n transform: translate3d(3000px, 0, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(-25px, 0, 0);\n transform: translate3d(-25px, 0, 0); }\n 75% {\n -webkit-transform: translate3d(10px, 0, 0);\n transform: translate3d(10px, 0, 0); }\n 90% {\n -webkit-transform: translate3d(-5px, 0, 0);\n transform: translate3d(-5px, 0, 0); }\n to {\n -webkit-transform: none;\n transform: none; } }\n\n.bounceInRight {\n -webkit-animation-name: bounceInRight;\n animation-name: bounceInRight; }\n\n@-webkit-keyframes bounceInUp {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 3000px, 0);\n transform: translate3d(0, 3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n 75% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -5px, 0);\n transform: translate3d(0, -5px, 0); }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes bounceInUp {\n from, 60%, 75%, 90%, to {\n -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 3000px, 0);\n transform: translate3d(0, 3000px, 0); }\n 60% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n 75% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 90% {\n -webkit-transform: translate3d(0, -5px, 0);\n transform: translate3d(0, -5px, 0); }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.bounceInUp {\n -webkit-animation-name: bounceInUp;\n animation-name: bounceInUp; }\n\n@-webkit-keyframes bounceOut {\n 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 50%, 55% {\n opacity: 1;\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); } }\n\n@keyframes bounceOut {\n 20% {\n -webkit-transform: scale3d(0.9, 0.9, 0.9);\n transform: scale3d(0.9, 0.9, 0.9); }\n 50%, 55% {\n opacity: 1;\n -webkit-transform: scale3d(1.1, 1.1, 1.1);\n transform: scale3d(1.1, 1.1, 1.1); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); } }\n\n.bounceOut {\n -webkit-animation-name: bounceOut;\n animation-name: bounceOut; }\n\n@-webkit-keyframes bounceOutDown {\n 20% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n@keyframes bounceOutDown {\n 20% {\n -webkit-transform: translate3d(0, 10px, 0);\n transform: translate3d(0, 10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, -20px, 0);\n transform: translate3d(0, -20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n.bounceOutDown {\n -webkit-animation-name: bounceOutDown;\n animation-name: bounceOutDown; }\n\n@-webkit-keyframes bounceOutLeft {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(20px, 0, 0);\n transform: translate3d(20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n@keyframes bounceOutLeft {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(20px, 0, 0);\n transform: translate3d(20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n.bounceOutLeft {\n -webkit-animation-name: bounceOutLeft;\n animation-name: bounceOutLeft; }\n\n@-webkit-keyframes bounceOutRight {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(-20px, 0, 0);\n transform: translate3d(-20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n@keyframes bounceOutRight {\n 20% {\n opacity: 1;\n -webkit-transform: translate3d(-20px, 0, 0);\n transform: translate3d(-20px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n.bounceOutRight {\n -webkit-animation-name: bounceOutRight;\n animation-name: bounceOutRight; }\n\n@-webkit-keyframes bounceOutUp {\n 20% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, 20px, 0);\n transform: translate3d(0, 20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n@keyframes bounceOutUp {\n 20% {\n -webkit-transform: translate3d(0, -10px, 0);\n transform: translate3d(0, -10px, 0); }\n 40%, 45% {\n opacity: 1;\n -webkit-transform: translate3d(0, 20px, 0);\n transform: translate3d(0, 20px, 0); }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n.bounceOutUp {\n -webkit-animation-name: bounceOutUp;\n animation-name: bounceOutUp; }\n\n@-webkit-keyframes fadeIn {\n from {\n opacity: 0; }\n to {\n opacity: 1; } }\n\n@keyframes fadeIn {\n from {\n opacity: 0; }\n to {\n opacity: 1; } }\n\n.fadeIn {\n -webkit-animation-name: fadeIn;\n animation-name: fadeIn; }\n\n@-webkit-keyframes fadeInDown {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInDown {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInDown {\n -webkit-animation-name: fadeInDown;\n animation-name: fadeInDown; }\n\n@-webkit-keyframes fadeInDownBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInDownBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInDownBig {\n -webkit-animation-name: fadeInDownBig;\n animation-name: fadeInDownBig; }\n\n@-webkit-keyframes fadeInLeft {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInLeft {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInLeft {\n -webkit-animation-name: fadeInLeft;\n animation-name: fadeInLeft; }\n\n@-webkit-keyframes fadeInLeftBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInLeftBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInLeftBig {\n -webkit-animation-name: fadeInLeftBig;\n animation-name: fadeInLeftBig; }\n\n@-webkit-keyframes fadeInRight {\n from {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInRight {\n from {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInRight {\n -webkit-animation-name: fadeInRight;\n animation-name: fadeInRight; }\n\n@-webkit-keyframes fadeInRightBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInRightBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInRightBig {\n -webkit-animation-name: fadeInRightBig;\n animation-name: fadeInRightBig; }\n\n@-webkit-keyframes fadeInUp {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInUp {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInUp {\n -webkit-animation-name: fadeInUp;\n animation-name: fadeInUp; }\n\n@-webkit-keyframes fadeInUpBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes fadeInUpBig {\n from {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.fadeInUpBig {\n -webkit-animation-name: fadeInUpBig;\n animation-name: fadeInUpBig; }\n\n@-webkit-keyframes fadeOut {\n from {\n opacity: 1; }\n to {\n opacity: 0; } }\n\n@keyframes fadeOut {\n from {\n opacity: 1; }\n to {\n opacity: 0; } }\n\n.fadeOut {\n -webkit-animation-name: fadeOut;\n animation-name: fadeOut; }\n\n@-webkit-keyframes fadeOutDown {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n@keyframes fadeOutDown {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n.fadeOutDown {\n -webkit-animation-name: fadeOutDown;\n animation-name: fadeOutDown; }\n\n@-webkit-keyframes fadeOutDownBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n@keyframes fadeOutDownBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, 2000px, 0);\n transform: translate3d(0, 2000px, 0); } }\n\n.fadeOutDownBig {\n -webkit-animation-name: fadeOutDownBig;\n animation-name: fadeOutDownBig; }\n\n@-webkit-keyframes fadeOutLeft {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n@keyframes fadeOutLeft {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n.fadeOutLeft {\n -webkit-animation-name: fadeOutLeft;\n animation-name: fadeOutLeft; }\n\n@-webkit-keyframes fadeOutLeftBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n@keyframes fadeOutLeftBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(-2000px, 0, 0);\n transform: translate3d(-2000px, 0, 0); } }\n\n.fadeOutLeftBig {\n -webkit-animation-name: fadeOutLeftBig;\n animation-name: fadeOutLeftBig; }\n\n@-webkit-keyframes fadeOutRight {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n@keyframes fadeOutRight {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n.fadeOutRight {\n -webkit-animation-name: fadeOutRight;\n animation-name: fadeOutRight; }\n\n@-webkit-keyframes fadeOutRightBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n@keyframes fadeOutRightBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(2000px, 0, 0);\n transform: translate3d(2000px, 0, 0); } }\n\n.fadeOutRightBig {\n -webkit-animation-name: fadeOutRightBig;\n animation-name: fadeOutRightBig; }\n\n@-webkit-keyframes fadeOutUp {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n@keyframes fadeOutUp {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n.fadeOutUp {\n -webkit-animation-name: fadeOutUp;\n animation-name: fadeOutUp; }\n\n@-webkit-keyframes fadeOutUpBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n@keyframes fadeOutUpBig {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(0, -2000px, 0);\n transform: translate3d(0, -2000px, 0); } }\n\n.fadeOutUpBig {\n -webkit-animation-name: fadeOutUpBig;\n animation-name: fadeOutUpBig; }\n\n@-webkit-keyframes flip {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 40% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 80% {\n -webkit-transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; } }\n\n@keyframes flip {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -360deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 40% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 80% {\n -webkit-transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n transform: perspective(400px) scale3d(0.95, 0.95, 0.95);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; } }\n\n.animated.flip {\n -webkit-backface-visibility: visible;\n backface-visibility: visible;\n -webkit-animation-name: flip;\n animation-name: flip; }\n\n@-webkit-keyframes flipInX {\n from {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n@keyframes flipInX {\n from {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n.flipInX {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipInX;\n animation-name: flipInX; }\n\n@-webkit-keyframes flipInY {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n@keyframes flipInY {\n from {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n opacity: 0; }\n 40% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -20deg);\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n 60% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 10deg);\n opacity: 1; }\n 80% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -5deg); }\n to {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); } }\n\n.flipInY {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipInY;\n animation-name: flipInY; }\n\n@-webkit-keyframes flipOutX {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n opacity: 0; } }\n\n@keyframes flipOutX {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n opacity: 0; } }\n\n.flipOutX {\n -webkit-animation-name: flipOutX;\n animation-name: flipOutX;\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important; }\n\n@-webkit-keyframes flipOutY {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n opacity: 0; } }\n\n@keyframes flipOutY {\n from {\n -webkit-transform: perspective(400px);\n transform: perspective(400px); }\n 30% {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n transform: perspective(400px) rotate3d(0, 1, 0, -15deg);\n opacity: 1; }\n to {\n -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n transform: perspective(400px) rotate3d(0, 1, 0, 90deg);\n opacity: 0; } }\n\n.flipOutY {\n -webkit-backface-visibility: visible !important;\n backface-visibility: visible !important;\n -webkit-animation-name: flipOutY;\n animation-name: flipOutY; }\n\n@-webkit-keyframes lightSpeedIn {\n from {\n -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg);\n transform: translate3d(100%, 0, 0) skewX(-30deg);\n opacity: 0; }\n 60% {\n -webkit-transform: skewX(20deg);\n transform: skewX(20deg);\n opacity: 1; }\n 80% {\n -webkit-transform: skewX(-5deg);\n transform: skewX(-5deg);\n opacity: 1; }\n to {\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes lightSpeedIn {\n from {\n -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg);\n transform: translate3d(100%, 0, 0) skewX(-30deg);\n opacity: 0; }\n 60% {\n -webkit-transform: skewX(20deg);\n transform: skewX(20deg);\n opacity: 1; }\n 80% {\n -webkit-transform: skewX(-5deg);\n transform: skewX(-5deg);\n opacity: 1; }\n to {\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.lightSpeedIn {\n -webkit-animation-name: lightSpeedIn;\n animation-name: lightSpeedIn;\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n\n@-webkit-keyframes lightSpeedOut {\n from {\n opacity: 1; }\n to {\n -webkit-transform: translate3d(100%, 0, 0) skewX(30deg);\n transform: translate3d(100%, 0, 0) skewX(30deg);\n opacity: 0; } }\n\n@keyframes lightSpeedOut {\n from {\n opacity: 1; }\n to {\n -webkit-transform: translate3d(100%, 0, 0) skewX(30deg);\n transform: translate3d(100%, 0, 0) skewX(30deg);\n opacity: 0; } }\n\n.lightSpeedOut {\n -webkit-animation-name: lightSpeedOut;\n animation-name: lightSpeedOut;\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in; }\n\n@-webkit-keyframes rotateIn {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, -200deg);\n transform: rotate3d(0, 0, 1, -200deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateIn {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, -200deg);\n transform: rotate3d(0, 0, 1, -200deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateIn {\n -webkit-animation-name: rotateIn;\n animation-name: rotateIn; }\n\n@-webkit-keyframes rotateInDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInDownLeft {\n -webkit-animation-name: rotateInDownLeft;\n animation-name: rotateInDownLeft; }\n\n@-webkit-keyframes rotateInDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInDownRight {\n -webkit-animation-name: rotateInDownRight;\n animation-name: rotateInDownRight; }\n\n@-webkit-keyframes rotateInUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInUpLeft {\n -webkit-animation-name: rotateInUpLeft;\n animation-name: rotateInUpLeft; }\n\n@-webkit-keyframes rotateInUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -90deg);\n transform: rotate3d(0, 0, 1, -90deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n@keyframes rotateInUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -90deg);\n transform: rotate3d(0, 0, 1, -90deg);\n opacity: 0; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: none;\n transform: none;\n opacity: 1; } }\n\n.rotateInUpRight {\n -webkit-animation-name: rotateInUpRight;\n animation-name: rotateInUpRight; }\n\n@-webkit-keyframes rotateOut {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n opacity: 1; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, 200deg);\n transform: rotate3d(0, 0, 1, 200deg);\n opacity: 0; } }\n\n@keyframes rotateOut {\n from {\n -webkit-transform-origin: center;\n transform-origin: center;\n opacity: 1; }\n to {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: rotate3d(0, 0, 1, 200deg);\n transform: rotate3d(0, 0, 1, 200deg);\n opacity: 0; } }\n\n.rotateOut {\n -webkit-animation-name: rotateOut;\n animation-name: rotateOut; }\n\n@-webkit-keyframes rotateOutDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; } }\n\n@keyframes rotateOutDownLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, 45deg);\n transform: rotate3d(0, 0, 1, 45deg);\n opacity: 0; } }\n\n.rotateOutDownLeft {\n -webkit-animation-name: rotateOutDownLeft;\n animation-name: rotateOutDownLeft; }\n\n@-webkit-keyframes rotateOutDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n@keyframes rotateOutDownRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n.rotateOutDownRight {\n -webkit-animation-name: rotateOutDownRight;\n animation-name: rotateOutDownRight; }\n\n@-webkit-keyframes rotateOutUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n@keyframes rotateOutUpLeft {\n from {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate3d(0, 0, 1, -45deg);\n transform: rotate3d(0, 0, 1, -45deg);\n opacity: 0; } }\n\n.rotateOutUpLeft {\n -webkit-animation-name: rotateOutUpLeft;\n animation-name: rotateOutUpLeft; }\n\n@-webkit-keyframes rotateOutUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 90deg);\n transform: rotate3d(0, 0, 1, 90deg);\n opacity: 0; } }\n\n@keyframes rotateOutUpRight {\n from {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n opacity: 1; }\n to {\n -webkit-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate3d(0, 0, 1, 90deg);\n transform: rotate3d(0, 0, 1, 90deg);\n opacity: 0; } }\n\n.rotateOutUpRight {\n -webkit-animation-name: rotateOutUpRight;\n animation-name: rotateOutUpRight; }\n\n@-webkit-keyframes hinge {\n 0% {\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 20%, 60% {\n -webkit-transform: rotate3d(0, 0, 1, 80deg);\n transform: rotate3d(0, 0, 1, 80deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 40%, 80% {\n -webkit-transform: rotate3d(0, 0, 1, 60deg);\n transform: rotate3d(0, 0, 1, 60deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n opacity: 1; }\n to {\n -webkit-transform: translate3d(0, 700px, 0);\n transform: translate3d(0, 700px, 0);\n opacity: 0; } }\n\n@keyframes hinge {\n 0% {\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 20%, 60% {\n -webkit-transform: rotate3d(0, 0, 1, 80deg);\n transform: rotate3d(0, 0, 1, 80deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out; }\n 40%, 80% {\n -webkit-transform: rotate3d(0, 0, 1, 60deg);\n transform: rotate3d(0, 0, 1, 60deg);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n -webkit-animation-timing-function: ease-in-out;\n animation-timing-function: ease-in-out;\n opacity: 1; }\n to {\n -webkit-transform: translate3d(0, 700px, 0);\n transform: translate3d(0, 700px, 0);\n opacity: 0; } }\n\n.hinge {\n -webkit-animation-name: hinge;\n animation-name: hinge; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes rollIn {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);\n transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n@keyframes rollIn {\n from {\n opacity: 0;\n -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg);\n transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); }\n to {\n opacity: 1;\n -webkit-transform: none;\n transform: none; } }\n\n.rollIn {\n -webkit-animation-name: rollIn;\n animation-name: rollIn; }\n\n/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */\n@-webkit-keyframes rollOut {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);\n transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); } }\n\n@keyframes rollOut {\n from {\n opacity: 1; }\n to {\n opacity: 0;\n -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg);\n transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); } }\n\n.rollOut {\n -webkit-animation-name: rollOut;\n animation-name: rollOut; }\n\n@-webkit-keyframes zoomIn {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 50% {\n opacity: 1; } }\n\n@keyframes zoomIn {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n 50% {\n opacity: 1; } }\n\n.zoomIn {\n -webkit-animation-name: zoomIn;\n animation-name: zoomIn; }\n\n@-webkit-keyframes zoomInDown {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInDown {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInDown {\n -webkit-animation-name: zoomInDown;\n animation-name: zoomInDown; }\n\n@-webkit-keyframes zoomInLeft {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInLeft {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInLeft {\n -webkit-animation-name: zoomInLeft;\n animation-name: zoomInLeft; }\n\n@-webkit-keyframes zoomInRight {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInRight {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInRight {\n -webkit-animation-name: zoomInRight;\n animation-name: zoomInRight; }\n\n@-webkit-keyframes zoomInUp {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomInUp {\n from {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n 60% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomInUp {\n -webkit-animation-name: zoomInUp;\n animation-name: zoomInUp; }\n\n@-webkit-keyframes zoomOut {\n from {\n opacity: 1; }\n 50% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n to {\n opacity: 0; } }\n\n@keyframes zoomOut {\n from {\n opacity: 1; }\n 50% {\n opacity: 0;\n -webkit-transform: scale3d(0.3, 0.3, 0.3);\n transform: scale3d(0.3, 0.3, 0.3); }\n to {\n opacity: 0; } }\n\n.zoomOut {\n -webkit-animation-name: zoomOut;\n animation-name: zoomOut; }\n\n@-webkit-keyframes zoomOutDown {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomOutDown {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomOutDown {\n -webkit-animation-name: zoomOutDown;\n animation-name: zoomOutDown; }\n\n@-webkit-keyframes zoomOutLeft {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0);\n transform: scale(0.1) translate3d(-2000px, 0, 0);\n -webkit-transform-origin: left center;\n transform-origin: left center; } }\n\n@keyframes zoomOutLeft {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0);\n transform: scale(0.1) translate3d(-2000px, 0, 0);\n -webkit-transform-origin: left center;\n transform-origin: left center; } }\n\n.zoomOutLeft {\n -webkit-animation-name: zoomOutLeft;\n animation-name: zoomOutLeft; }\n\n@-webkit-keyframes zoomOutRight {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(2000px, 0, 0);\n transform: scale(0.1) translate3d(2000px, 0, 0);\n -webkit-transform-origin: right center;\n transform-origin: right center; } }\n\n@keyframes zoomOutRight {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); }\n to {\n opacity: 0;\n -webkit-transform: scale(0.1) translate3d(2000px, 0, 0);\n transform: scale(0.1) translate3d(2000px, 0, 0);\n -webkit-transform-origin: right center;\n transform-origin: right center; } }\n\n.zoomOutRight {\n -webkit-animation-name: zoomOutRight;\n animation-name: zoomOutRight; }\n\n@-webkit-keyframes zoomOutUp {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n@keyframes zoomOutUp {\n 40% {\n opacity: 1;\n -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);\n -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }\n to {\n opacity: 0;\n -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);\n animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } }\n\n.zoomOutUp {\n -webkit-animation-name: zoomOutUp;\n animation-name: zoomOutUp; }\n\n@-webkit-keyframes slideInDown {\n from {\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInDown {\n from {\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInDown {\n -webkit-animation-name: slideInDown;\n animation-name: slideInDown; }\n\n@-webkit-keyframes slideInLeft {\n from {\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInLeft {\n from {\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInLeft {\n -webkit-animation-name: slideInLeft;\n animation-name: slideInLeft; }\n\n@-webkit-keyframes slideInRight {\n from {\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInRight {\n from {\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInRight {\n -webkit-animation-name: slideInRight;\n animation-name: slideInRight; }\n\n@-webkit-keyframes slideInUp {\n from {\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n@keyframes slideInUp {\n from {\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0);\n visibility: visible; }\n to {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); } }\n\n.slideInUp {\n -webkit-animation-name: slideInUp;\n animation-name: slideInUp; }\n\n@-webkit-keyframes slideOutDown {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n@keyframes slideOutDown {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, 100%, 0);\n transform: translate3d(0, 100%, 0); } }\n\n.slideOutDown {\n -webkit-animation-name: slideOutDown;\n animation-name: slideOutDown; }\n\n@-webkit-keyframes slideOutLeft {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n@keyframes slideOutLeft {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0); } }\n\n.slideOutLeft {\n -webkit-animation-name: slideOutLeft;\n animation-name: slideOutLeft; }\n\n@-webkit-keyframes slideOutRight {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n@keyframes slideOutRight {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0); } }\n\n.slideOutRight {\n -webkit-animation-name: slideOutRight;\n animation-name: slideOutRight; }\n\n@-webkit-keyframes slideOutUp {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n@keyframes slideOutUp {\n from {\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n -webkit-transform: translate3d(0, -100%, 0);\n transform: translate3d(0, -100%, 0); } }\n\n.slideOutUp {\n -webkit-animation-name: slideOutUp;\n animation-name: slideOutUp; }\n\n/*#alerts {\r\n\tposition: fixed;\r\n\ttop: 60px;\r\n\tright: 10px;\r\n\twidth: 350px;\r\n\tz-index: 10;\r\n\ttext-shadow: 1px 1px 0 rgba(0,0,0,0.1);\r\n\r\n\t.notification {\r\n\t\tanimation: 0.5s ease slideInRight;\r\n\t\tmargin-top: 5px;\r\n\r\n\t\t&.exit {\r\n\t\t\tanimation: 0.5s ease fadeOutRight;\r\n\t\t}\r\n\r\n\t}\r\n\r\n\th3 {\r\n\t\tfont-size: 16px;\r\n\t\tfont-size: 500;\r\n\t}\r\n\r\n}*/\n#alerts {\n position: fixed;\n top: 55px;\n right: 10px;\n width: 350px;\n z-index: 100; }\n #alerts > ul {\n margin: 0;\n padding: 0;\n list-style-type: none; }\n #alerts > ul > li {\n background-color: #37474f;\n box-shadow: 5px 5px 0 rgba(38, 50, 56, 0.3);\n border: 1px solid #607d8b;\n border-left-width: 5px;\n margin-top: 5px;\n padding: 8px 12px;\n animation-name: slideFromRight;\n animation-duration: 1s;\n cursor: pointer;\n position: relative; }\n #alerts > ul > li:hover {\n background-color: #263238; }\n #alerts > ul > li.exit {\n animation-name: zoomOut;\n animation-duration: 1s;\n transform-origin: top center; }\n #alerts > ul > li > button {\n background-color: transparent;\n border: none;\n color: #FFF;\n width: 15px;\n height: 15px;\n padding: 0;\n position: absolute;\n top: 10px;\n right: 10px; }\n #alerts > ul > li > button:before {\n content: 'X'; }\n #alerts > ul > li > strong {\n display: block;\n font-size: 13px;\n font-weight: 500;\n color: #FFF; }\n #alerts > ul > li > strong > i {\n margin-right: 5px; }\n #alerts > ul > li > span {\n font-size: 12px;\n font-weight: 500;\n color: #cfd8dc; }\n #alerts > ul > li.error {\n border-color: #ef5350;\n background-color: #e53935; }\n #alerts > ul > li.error > span {\n color: #ffebee; }\n #alerts > ul > li.success {\n border-color: #66bb6a;\n background-color: #388e3c; }\n #alerts > ul > li.success > span {\n color: #e8f5e9; }\n\n.button {\n background-color: #fb8c00;\n color: #FFF;\n border: 1px solid #f57c00;\n border-radius: 3px;\n display: inline-flex;\n height: 30px;\n align-items: center;\n padding: 0 15px;\n font-size: 13px;\n font-weight: 600;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n margin: 0;\n transition: all .4s ease;\n cursor: pointer;\n text-decoration: none;\n text-transform: uppercase; }\n .button span {\n font-weight: 600;\n display: inline-flex;\n align-items: center;\n line-height: 14px;\n height: 14px; }\n .button i {\n margin-right: 8px;\n font-size: 14px;\n line-height: 14px;\n height: 14px; }\n .button:focus {\n outline: none;\n border-color: #FFF; }\n .button:hover {\n background-color: #ef6c00;\n text-decoration: none; }\n .button.is-red {\n background-color: #e53935;\n border-color: #d32f2f;\n color: #FFF; }\n .button.is-red.is-outlined {\n background-color: #FFF;\n color: #d32f2f; }\n .button.is-red.is-inverted {\n background-color: rgba(198, 40, 40, 0);\n border-color: #f44336; }\n .button.is-red:hover {\n background-color: #c62828;\n color: #FFF;\n animation: none; }\n .button.is-pink {\n background-color: #d81b60;\n border-color: #c2185b;\n color: #FFF; }\n .button.is-pink.is-outlined {\n background-color: #FFF;\n color: #c2185b; }\n .button.is-pink.is-inverted {\n background-color: rgba(173, 20, 87, 0);\n border-color: #e91e63; }\n .button.is-pink:hover {\n background-color: #ad1457;\n color: #FFF;\n animation: none; }\n .button.is-purple {\n background-color: #8e24aa;\n border-color: #7b1fa2;\n color: #FFF; }\n .button.is-purple.is-outlined {\n background-color: #FFF;\n color: #7b1fa2; }\n .button.is-purple.is-inverted {\n background-color: rgba(106, 27, 154, 0);\n border-color: #9c27b0; }\n .button.is-purple:hover {\n background-color: #6a1b9a;\n color: #FFF;\n animation: none; }\n .button.is-deep-purple {\n background-color: #5e35b1;\n border-color: #512da8;\n color: #FFF; }\n .button.is-deep-purple.is-outlined {\n background-color: #FFF;\n color: #512da8; }\n .button.is-deep-purple.is-inverted {\n background-color: rgba(69, 39, 160, 0);\n border-color: #673ab7; }\n .button.is-deep-purple:hover {\n background-color: #4527a0;\n color: #FFF;\n animation: none; }\n .button.is-indigo {\n background-color: #3949ab;\n border-color: #303f9f;\n color: #FFF; }\n .button.is-indigo.is-outlined {\n background-color: #FFF;\n color: #303f9f; }\n .button.is-indigo.is-inverted {\n background-color: rgba(40, 53, 147, 0);\n border-color: #3f51b5; }\n .button.is-indigo:hover {\n background-color: #283593;\n color: #FFF;\n animation: none; }\n .button.is-blue {\n background-color: #1e88e5;\n border-color: #1976d2;\n color: #FFF; }\n .button.is-blue.is-outlined {\n background-color: #FFF;\n color: #1976d2; }\n .button.is-blue.is-inverted {\n background-color: rgba(21, 101, 192, 0);\n border-color: #2196f3; }\n .button.is-blue:hover {\n background-color: #1565c0;\n color: #FFF;\n animation: none; }\n .button.is-light-blue {\n background-color: #039be5;\n border-color: #0288d1;\n color: #FFF; }\n .button.is-light-blue.is-outlined {\n background-color: #FFF;\n color: #0288d1; }\n .button.is-light-blue.is-inverted {\n background-color: rgba(2, 119, 189, 0);\n border-color: #03a9f4; }\n .button.is-light-blue:hover {\n background-color: #0277bd;\n color: #FFF;\n animation: none; }\n .button.is-cyan {\n background-color: #00acc1;\n border-color: #0097a7;\n color: #FFF; }\n .button.is-cyan.is-outlined {\n background-color: #FFF;\n color: #0097a7; }\n .button.is-cyan.is-inverted {\n background-color: rgba(0, 131, 143, 0);\n border-color: #00bcd4; }\n .button.is-cyan:hover {\n background-color: #00838f;\n color: #FFF;\n animation: none; }\n .button.is-teal {\n background-color: #00897b;\n border-color: #00796b;\n color: #FFF; }\n .button.is-teal.is-outlined {\n background-color: #FFF;\n color: #00796b; }\n .button.is-teal.is-inverted {\n background-color: rgba(0, 105, 92, 0);\n border-color: #009688; }\n .button.is-teal:hover {\n background-color: #00695c;\n color: #FFF;\n animation: none; }\n .button.is-green {\n background-color: #43a047;\n border-color: #388e3c;\n color: #FFF; }\n .button.is-green.is-outlined {\n background-color: #FFF;\n color: #388e3c; }\n .button.is-green.is-inverted {\n background-color: rgba(46, 125, 50, 0);\n border-color: #4caf50; }\n .button.is-green:hover {\n background-color: #2e7d32;\n color: #FFF;\n animation: none; }\n .button.is-light-green {\n background-color: #7cb342;\n border-color: #689f38;\n color: #FFF; }\n .button.is-light-green.is-outlined {\n background-color: #FFF;\n color: #689f38; }\n .button.is-light-green.is-inverted {\n background-color: rgba(85, 139, 47, 0);\n border-color: #8bc34a; }\n .button.is-light-green:hover {\n background-color: #558b2f;\n color: #FFF;\n animation: none; }\n .button.is-lime {\n background-color: #c0ca33;\n border-color: #afb42b;\n color: #FFF; }\n .button.is-lime.is-outlined {\n background-color: #FFF;\n color: #afb42b; }\n .button.is-lime.is-inverted {\n background-color: rgba(158, 157, 36, 0);\n border-color: #cddc39; }\n .button.is-lime:hover {\n background-color: #9e9d24;\n color: #FFF;\n animation: none; }\n .button.is-yellow {\n background-color: #fdd835;\n border-color: #fbc02d;\n color: #FFF; }\n .button.is-yellow.is-outlined {\n background-color: #FFF;\n color: #fbc02d; }\n .button.is-yellow.is-inverted {\n background-color: rgba(249, 168, 37, 0);\n border-color: #ffeb3b; }\n .button.is-yellow:hover {\n background-color: #f9a825;\n color: #FFF;\n animation: none; }\n .button.is-amber {\n background-color: #ffb300;\n border-color: #ffa000;\n color: #FFF; }\n .button.is-amber.is-outlined {\n background-color: #FFF;\n color: #ffa000; }\n .button.is-amber.is-inverted {\n background-color: rgba(255, 143, 0, 0);\n border-color: #ffc107; }\n .button.is-amber:hover {\n background-color: #ff8f00;\n color: #FFF;\n animation: none; }\n .button.is-orange {\n background-color: #fb8c00;\n border-color: #f57c00;\n color: #FFF; }\n .button.is-orange.is-outlined {\n background-color: #FFF;\n color: #f57c00; }\n .button.is-orange.is-inverted {\n background-color: rgba(239, 108, 0, 0);\n border-color: #ff9800; }\n .button.is-orange:hover {\n background-color: #ef6c00;\n color: #FFF;\n animation: none; }\n .button.is-deep-orange {\n background-color: #f4511e;\n border-color: #e64a19;\n color: #FFF; }\n .button.is-deep-orange.is-outlined {\n background-color: #FFF;\n color: #e64a19; }\n .button.is-deep-orange.is-inverted {\n background-color: rgba(216, 67, 21, 0);\n border-color: #ff5722; }\n .button.is-deep-orange:hover {\n background-color: #d84315;\n color: #FFF;\n animation: none; }\n .button.is-brown {\n background-color: #6d4c41;\n border-color: #5d4037;\n color: #FFF; }\n .button.is-brown.is-outlined {\n background-color: #FFF;\n color: #5d4037; }\n .button.is-brown.is-inverted {\n background-color: rgba(78, 52, 46, 0);\n border-color: #795548; }\n .button.is-brown:hover {\n background-color: #4e342e;\n color: #FFF;\n animation: none; }\n .button.is-grey {\n background-color: #757575;\n border-color: #616161;\n color: #FFF; }\n .button.is-grey.is-outlined {\n background-color: #FFF;\n color: #616161; }\n .button.is-grey.is-inverted {\n background-color: rgba(66, 66, 66, 0);\n border-color: #9e9e9e; }\n .button.is-grey:hover {\n background-color: #424242;\n color: #FFF;\n animation: none; }\n .button.is-blue-grey {\n background-color: #546e7a;\n border-color: #455a64;\n color: #FFF; }\n .button.is-blue-grey.is-outlined {\n background-color: #FFF;\n color: #455a64; }\n .button.is-blue-grey.is-inverted {\n background-color: rgba(55, 71, 79, 0);\n border-color: #607d8b; }\n .button.is-blue-grey:hover {\n background-color: #37474f;\n color: #FFF;\n animation: none; }\n .button.is-icon-only i {\n margin-right: 0; }\n .button.is-featured {\n animation: btnInvertedPulse .6s ease alternate infinite; }\n .button.is-disabled, .button:disabled {\n background-color: #e0e0e0;\n border: 1px solid #bdbdbd;\n color: #9e9e9e;\n cursor: default;\n transition: none; }\n .button.is-disabled:hover, .button:disabled:hover {\n background-color: #e0e0e0 !important;\n color: #9e9e9e !important; }\n\n.button-group .button {\n border-radius: 0;\n margin-left: 1px; }\n .button-group .button:first-child {\n margin-left: 0;\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px; }\n .button-group .button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px; }\n\n@-webkit-keyframes btnInvertedPulse {\n 0% {\n background-color: rgba(158, 158, 158, 0); }\n 100% {\n background-color: rgba(158, 158, 158, 0.25); } }\n\n@-moz-keyframes btnInvertedPulse {\n 0% {\n background-color: rgba(158, 158, 158, 0); }\n 100% {\n background-color: rgba(158, 158, 158, 0.25); } }\n\n@-o-keyframes btnInvertedPulse {\n 0% {\n background-color: rgba(158, 158, 158, 0); }\n 100% {\n background-color: rgba(158, 158, 158, 0.25); } }\n\n@keyframes btnInvertedPulse {\n 0% {\n background-color: rgba(158, 158, 158, 0); }\n 100% {\n background-color: rgba(158, 158, 158, 0.25); } }\n\n.footer {\n background-color: #eceff1;\n border-bottom: 5px solid #cfd8dc;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 25px;\n font-size: 13px;\n font-weight: 500;\n color: #607d8b; }\n .footer ul {\n padding: 0;\n margin: 0;\n list-style-type: none;\n display: flex;\n justify-content: center;\n align-items: center; }\n .footer ul li {\n padding: 0 15px; }\n\n.control + .control {\n margin-top: 15px; }\n\n.control input[type=text], .control input[type=password] {\n background-color: #FFF;\n display: flex;\n height: 30px;\n align-items: center;\n padding: 0 12px;\n border: 1px solid #bdbdbd;\n border-radius: 3px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n font-size: 14px;\n color: #616161;\n transition: all .4s ease;\n box-shadow: inset 0 0 5px 0 rgba(0, 0, 0, 0.1); }\n .control input[type=text]:focus, .control input[type=password]:focus {\n outline: none;\n border-color: #03a9f4;\n box-shadow: inset 0 0 5px 0 rgba(3, 169, 244, 0.3); }\n .control input[type=text]:disabled, .control input[type=password]:disabled {\n background-color: #f5f5f5; }\n .control input[type=text].is-dirty.is-invalid, .control input[type=password].is-dirty.is-invalid {\n border-color: #f44336;\n box-shadow: inset 0 0 5px 0 #ffcdd2; }\n\n.control.is-fullwidth input[type=text], .control.is-fullwidth input[type=password], .control.is-fullwidth select, .control.is-fullwidth textarea {\n width: 100%; }\n\n.control select {\n background-color: #FFF;\n display: flex;\n height: 30px;\n align-items: center;\n padding: 0 12px;\n border: 1px solid #bdbdbd;\n border-radius: 3px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n font-size: 14px;\n color: #616161;\n transition: all .4s ease;\n box-shadow: inset 0 0 5px 0 rgba(0, 0, 0, 0.1);\n cursor: pointer; }\n .control select:focus {\n outline: none;\n border-color: #03a9f4;\n box-shadow: inset 0 0 5px 0 rgba(3, 169, 244, 0.3); }\n .control select:disabled {\n background-color: #f5f5f5; }\n\n.control input[type=radio], .control input[type=checkbox] {\n position: absolute;\n left: -9999px;\n opacity: 0; }\n .control input[type=radio] + label, .control input[type=checkbox] + label {\n position: relative;\n padding: 0 15px 0 25px;\n cursor: pointer;\n display: inline-block;\n height: 25px;\n line-height: 25px;\n font-size: 14px;\n transition: .28s ease;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none; }\n .control input[type=radio] + label:before, .control input[type=radio] + label:after, .control input[type=checkbox] + label:before, .control input[type=checkbox] + label:after {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n margin: 4px;\n border: 2px solid #3949ab;\n margin: 4px;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n z-index: 0;\n transition: .28s ease; }\n .control input[type=radio]:checked + label:before, .control input[type=radio]:checked + label:after, .control input[type=checkbox]:checked + label:before, .control input[type=checkbox]:checked + label:after {\n border-color: #3949ab; }\n .control input[type=radio]:checked + label:after, .control input[type=checkbox]:checked + label:after {\n -webkit-transform: scale(0.5);\n -moz-transform: scale(0.5);\n -ms-transform: scale(0.5);\n -o-transform: scale(0.5);\n transform: scale(0.5);\n background-color: #3949ab; }\n\n.control input[type=checkbox] + label:before, .control input[type=checkbox] + label:after {\n border-radius: 0; }\n\n.control .help {\n font-size: 12px; }\n .control .help.is-red {\n color: #e53935; }\n\n.control + label {\n margin-top: 20px; }\n\n.control > i:first-child {\n margin-right: 8px; }\n\n.label {\n margin-bottom: 5px;\n font-size: 14px;\n font-weight: 500;\n display: block; }\n\n.form-sections section {\n border-top: 1px solid #eeeeee;\n padding: 20px;\n -webkit-animation-duration: 0.6s;\n -moz-animation-duration: 0.6s;\n -ms-animation-duration: 0.6s;\n -o-animation-duration: 0.6s;\n animation-duration: 0.6s; }\n .form-sections section:first-child {\n border-top: none; }\n .form-sections section .button + .button {\n margin-left: 10px; }\n .form-sections section .desc {\n display: inline-block;\n padding: 10px 0 0 0px;\n font-size: 12px;\n color: #9e9e9e; }\n .form-sections section .section-block {\n padding-left: 20px;\n font-size: 14px;\n color: #37474f; }\n .form-sections section .section-block h6 {\n font-size: 14px;\n font-weight: 500;\n color: #546e7a;\n margin-top: 15px;\n border-bottom: 1px dotted #b0bec5; }\n .form-sections section .section-block p {\n padding: 5px 0; }\n .form-sections section .section-block p.is-small {\n font-size: 13px; }\n\n.column {\n flex-basis: 0;\n flex-grow: 1;\n flex-shrink: 1;\n padding: 10px; }\n .columns.is-mobile > .column.is-narrow {\n flex: none; }\n .columns.is-mobile > .column.is-full {\n flex: none;\n width: 100%; }\n .columns.is-mobile > .column.is-three-quarters {\n flex: none;\n width: 75%; }\n .columns.is-mobile > .column.is-two-thirds {\n flex: none;\n width: 66.6666%; }\n .columns.is-mobile > .column.is-half {\n flex: none;\n width: 50%; }\n .columns.is-mobile > .column.is-one-third {\n flex: none;\n width: 33.3333%; }\n .columns.is-mobile > .column.is-one-quarter {\n flex: none;\n width: 25%; }\n .columns.is-mobile > .column.is-offset-three-quarters {\n margin-left: 75%; }\n .columns.is-mobile > .column.is-offset-two-thirds {\n margin-left: 66.6666%; }\n .columns.is-mobile > .column.is-offset-half {\n margin-left: 50%; }\n .columns.is-mobile > .column.is-offset-one-third {\n margin-left: 33.3333%; }\n .columns.is-mobile > .column.is-offset-one-quarter {\n margin-left: 25%; }\n .columns.is-mobile > .column.is-1 {\n flex: none;\n width: 8.33333%; }\n .columns.is-mobile > .column.is-offset-1 {\n margin-left: 8.33333%; }\n .columns.is-mobile > .column.is-2 {\n flex: none;\n width: 16.66667%; }\n .columns.is-mobile > .column.is-offset-2 {\n margin-left: 16.66667%; }\n .columns.is-mobile > .column.is-3 {\n flex: none;\n width: 25%; }\n .columns.is-mobile > .column.is-offset-3 {\n margin-left: 25%; }\n .columns.is-mobile > .column.is-4 {\n flex: none;\n width: 33.33333%; }\n .columns.is-mobile > .column.is-offset-4 {\n margin-left: 33.33333%; }\n .columns.is-mobile > .column.is-5 {\n flex: none;\n width: 41.66667%; }\n .columns.is-mobile > .column.is-offset-5 {\n margin-left: 41.66667%; }\n .columns.is-mobile > .column.is-6 {\n flex: none;\n width: 50%; }\n .columns.is-mobile > .column.is-offset-6 {\n margin-left: 50%; }\n .columns.is-mobile > .column.is-7 {\n flex: none;\n width: 58.33333%; }\n .columns.is-mobile > .column.is-offset-7 {\n margin-left: 58.33333%; }\n .columns.is-mobile > .column.is-8 {\n flex: none;\n width: 66.66667%; }\n .columns.is-mobile > .column.is-offset-8 {\n margin-left: 66.66667%; }\n .columns.is-mobile > .column.is-9 {\n flex: none;\n width: 75%; }\n .columns.is-mobile > .column.is-offset-9 {\n margin-left: 75%; }\n .columns.is-mobile > .column.is-10 {\n flex: none;\n width: 83.33333%; }\n .columns.is-mobile > .column.is-offset-10 {\n margin-left: 83.33333%; }\n .columns.is-mobile > .column.is-11 {\n flex: none;\n width: 91.66667%; }\n .columns.is-mobile > .column.is-offset-11 {\n margin-left: 91.66667%; }\n .columns.is-mobile > .column.is-12 {\n flex: none;\n width: 100%; }\n .columns.is-mobile > .column.is-offset-12 {\n margin-left: 100%; }\n @media screen and (max-width: 768px) {\n .column.is-narrow-mobile {\n flex: none; }\n .column.is-full-mobile {\n flex: none;\n width: 100%; }\n .column.is-three-quarters-mobile {\n flex: none;\n width: 75%; }\n .column.is-two-thirds-mobile {\n flex: none;\n width: 66.6666%; }\n .column.is-half-mobile {\n flex: none;\n width: 50%; }\n .column.is-one-third-mobile {\n flex: none;\n width: 33.3333%; }\n .column.is-one-quarter-mobile {\n flex: none;\n width: 25%; }\n .column.is-offset-three-quarters-mobile {\n margin-left: 75%; }\n .column.is-offset-two-thirds-mobile {\n margin-left: 66.6666%; }\n .column.is-offset-half-mobile {\n margin-left: 50%; }\n .column.is-offset-one-third-mobile {\n margin-left: 33.3333%; }\n .column.is-offset-one-quarter-mobile {\n margin-left: 25%; }\n .column.is-1-mobile {\n flex: none;\n width: 8.33333%; }\n .column.is-offset-1-mobile {\n margin-left: 8.33333%; }\n .column.is-2-mobile {\n flex: none;\n width: 16.66667%; }\n .column.is-offset-2-mobile {\n margin-left: 16.66667%; }\n .column.is-3-mobile {\n flex: none;\n width: 25%; }\n .column.is-offset-3-mobile {\n margin-left: 25%; }\n .column.is-4-mobile {\n flex: none;\n width: 33.33333%; }\n .column.is-offset-4-mobile {\n margin-left: 33.33333%; }\n .column.is-5-mobile {\n flex: none;\n width: 41.66667%; }\n .column.is-offset-5-mobile {\n margin-left: 41.66667%; }\n .column.is-6-mobile {\n flex: none;\n width: 50%; }\n .column.is-offset-6-mobile {\n margin-left: 50%; }\n .column.is-7-mobile {\n flex: none;\n width: 58.33333%; }\n .column.is-offset-7-mobile {\n margin-left: 58.33333%; }\n .column.is-8-mobile {\n flex: none;\n width: 66.66667%; }\n .column.is-offset-8-mobile {\n margin-left: 66.66667%; }\n .column.is-9-mobile {\n flex: none;\n width: 75%; }\n .column.is-offset-9-mobile {\n margin-left: 75%; }\n .column.is-10-mobile {\n flex: none;\n width: 83.33333%; }\n .column.is-offset-10-mobile {\n margin-left: 83.33333%; }\n .column.is-11-mobile {\n flex: none;\n width: 91.66667%; }\n .column.is-offset-11-mobile {\n margin-left: 91.66667%; }\n .column.is-12-mobile {\n flex: none;\n width: 100%; }\n .column.is-offset-12-mobile {\n margin-left: 100%; } }\n @media screen and (min-width: 769px) {\n .column.is-narrow, .column.is-narrow-tablet {\n flex: none; }\n .column.is-full, .column.is-full-tablet {\n flex: none;\n width: 100%; }\n .column.is-three-quarters, .column.is-three-quarters-tablet {\n flex: none;\n width: 75%; }\n .column.is-two-thirds, .column.is-two-thirds-tablet {\n flex: none;\n width: 66.6666%; }\n .column.is-half, .column.is-half-tablet {\n flex: none;\n width: 50%; }\n .column.is-one-third, .column.is-one-third-tablet {\n flex: none;\n width: 33.3333%; }\n .column.is-one-quarter, .column.is-one-quarter-tablet {\n flex: none;\n width: 25%; }\n .column.is-offset-three-quarters, .column.is-offset-three-quarters-tablet {\n margin-left: 75%; }\n .column.is-offset-two-thirds, .column.is-offset-two-thirds-tablet {\n margin-left: 66.6666%; }\n .column.is-offset-half, .column.is-offset-half-tablet {\n margin-left: 50%; }\n .column.is-offset-one-third, .column.is-offset-one-third-tablet {\n margin-left: 33.3333%; }\n .column.is-offset-one-quarter, .column.is-offset-one-quarter-tablet {\n margin-left: 25%; }\n .column.is-1, .column.is-1-tablet {\n flex: none;\n width: 8.33333%; }\n .column.is-offset-1, .column.is-offset-1-tablet {\n margin-left: 8.33333%; }\n .column.is-2, .column.is-2-tablet {\n flex: none;\n width: 16.66667%; }\n .column.is-offset-2, .column.is-offset-2-tablet {\n margin-left: 16.66667%; }\n .column.is-3, .column.is-3-tablet {\n flex: none;\n width: 25%; }\n .column.is-offset-3, .column.is-offset-3-tablet {\n margin-left: 25%; }\n .column.is-4, .column.is-4-tablet {\n flex: none;\n width: 33.33333%; }\n .column.is-offset-4, .column.is-offset-4-tablet {\n margin-left: 33.33333%; }\n .column.is-5, .column.is-5-tablet {\n flex: none;\n width: 41.66667%; }\n .column.is-offset-5, .column.is-offset-5-tablet {\n margin-left: 41.66667%; }\n .column.is-6, .column.is-6-tablet {\n flex: none;\n width: 50%; }\n .column.is-offset-6, .column.is-offset-6-tablet {\n margin-left: 50%; }\n .column.is-7, .column.is-7-tablet {\n flex: none;\n width: 58.33333%; }\n .column.is-offset-7, .column.is-offset-7-tablet {\n margin-left: 58.33333%; }\n .column.is-8, .column.is-8-tablet {\n flex: none;\n width: 66.66667%; }\n .column.is-offset-8, .column.is-offset-8-tablet {\n margin-left: 66.66667%; }\n .column.is-9, .column.is-9-tablet {\n flex: none;\n width: 75%; }\n .column.is-offset-9, .column.is-offset-9-tablet {\n margin-left: 75%; }\n .column.is-10, .column.is-10-tablet {\n flex: none;\n width: 83.33333%; }\n .column.is-offset-10, .column.is-offset-10-tablet {\n margin-left: 83.33333%; }\n .column.is-11, .column.is-11-tablet {\n flex: none;\n width: 91.66667%; }\n .column.is-offset-11, .column.is-offset-11-tablet {\n margin-left: 91.66667%; }\n .column.is-12, .column.is-12-tablet {\n flex: none;\n width: 100%; }\n .column.is-offset-12, .column.is-offset-12-tablet {\n margin-left: 100%; } }\n @media screen and (min-width: 980px) {\n .column.is-narrow-desktop {\n flex: none; }\n .column.is-full-desktop {\n flex: none;\n width: 100%; }\n .column.is-three-quarters-desktop {\n flex: none;\n width: 75%; }\n .column.is-two-thirds-desktop {\n flex: none;\n width: 66.6666%; }\n .column.is-half-desktop {\n flex: none;\n width: 50%; }\n .column.is-one-third-desktop {\n flex: none;\n width: 33.3333%; }\n .column.is-one-quarter-desktop {\n flex: none;\n width: 25%; }\n .column.is-offset-three-quarters-desktop {\n margin-left: 75%; }\n .column.is-offset-two-thirds-desktop {\n margin-left: 66.6666%; }\n .column.is-offset-half-desktop {\n margin-left: 50%; }\n .column.is-offset-one-third-desktop {\n margin-left: 33.3333%; }\n .column.is-offset-one-quarter-desktop {\n margin-left: 25%; }\n .column.is-1-desktop {\n flex: none;\n width: 8.33333%; }\n .column.is-offset-1-desktop {\n margin-left: 8.33333%; }\n .column.is-2-desktop {\n flex: none;\n width: 16.66667%; }\n .column.is-offset-2-desktop {\n margin-left: 16.66667%; }\n .column.is-3-desktop {\n flex: none;\n width: 25%; }\n .column.is-offset-3-desktop {\n margin-left: 25%; }\n .column.is-4-desktop {\n flex: none;\n width: 33.33333%; }\n .column.is-offset-4-desktop {\n margin-left: 33.33333%; }\n .column.is-5-desktop {\n flex: none;\n width: 41.66667%; }\n .column.is-offset-5-desktop {\n margin-left: 41.66667%; }\n .column.is-6-desktop {\n flex: none;\n width: 50%; }\n .column.is-offset-6-desktop {\n margin-left: 50%; }\n .column.is-7-desktop {\n flex: none;\n width: 58.33333%; }\n .column.is-offset-7-desktop {\n margin-left: 58.33333%; }\n .column.is-8-desktop {\n flex: none;\n width: 66.66667%; }\n .column.is-offset-8-desktop {\n margin-left: 66.66667%; }\n .column.is-9-desktop {\n flex: none;\n width: 75%; }\n .column.is-offset-9-desktop {\n margin-left: 75%; }\n .column.is-10-desktop {\n flex: none;\n width: 83.33333%; }\n .column.is-offset-10-desktop {\n margin-left: 83.33333%; }\n .column.is-11-desktop {\n flex: none;\n width: 91.66667%; }\n .column.is-offset-11-desktop {\n margin-left: 91.66667%; }\n .column.is-12-desktop {\n flex: none;\n width: 100%; }\n .column.is-offset-12-desktop {\n margin-left: 100%; } }\n @media screen and (min-width: 1180px) {\n .column.is-narrow-widescreen {\n flex: none; }\n .column.is-full-widescreen {\n flex: none;\n width: 100%; }\n .column.is-three-quarters-widescreen {\n flex: none;\n width: 75%; }\n .column.is-two-thirds-widescreen {\n flex: none;\n width: 66.6666%; }\n .column.is-half-widescreen {\n flex: none;\n width: 50%; }\n .column.is-one-third-widescreen {\n flex: none;\n width: 33.3333%; }\n .column.is-one-quarter-widescreen {\n flex: none;\n width: 25%; }\n .column.is-offset-three-quarters-widescreen {\n margin-left: 75%; }\n .column.is-offset-two-thirds-widescreen {\n margin-left: 66.6666%; }\n .column.is-offset-half-widescreen {\n margin-left: 50%; }\n .column.is-offset-one-third-widescreen {\n margin-left: 33.3333%; }\n .column.is-offset-one-quarter-widescreen {\n margin-left: 25%; }\n .column.is-1-widescreen {\n flex: none;\n width: 8.33333%; }\n .column.is-offset-1-widescreen {\n margin-left: 8.33333%; }\n .column.is-2-widescreen {\n flex: none;\n width: 16.66667%; }\n .column.is-offset-2-widescreen {\n margin-left: 16.66667%; }\n .column.is-3-widescreen {\n flex: none;\n width: 25%; }\n .column.is-offset-3-widescreen {\n margin-left: 25%; }\n .column.is-4-widescreen {\n flex: none;\n width: 33.33333%; }\n .column.is-offset-4-widescreen {\n margin-left: 33.33333%; }\n .column.is-5-widescreen {\n flex: none;\n width: 41.66667%; }\n .column.is-offset-5-widescreen {\n margin-left: 41.66667%; }\n .column.is-6-widescreen {\n flex: none;\n width: 50%; }\n .column.is-offset-6-widescreen {\n margin-left: 50%; }\n .column.is-7-widescreen {\n flex: none;\n width: 58.33333%; }\n .column.is-offset-7-widescreen {\n margin-left: 58.33333%; }\n .column.is-8-widescreen {\n flex: none;\n width: 66.66667%; }\n .column.is-offset-8-widescreen {\n margin-left: 66.66667%; }\n .column.is-9-widescreen {\n flex: none;\n width: 75%; }\n .column.is-offset-9-widescreen {\n margin-left: 75%; }\n .column.is-10-widescreen {\n flex: none;\n width: 83.33333%; }\n .column.is-offset-10-widescreen {\n margin-left: 83.33333%; }\n .column.is-11-widescreen {\n flex: none;\n width: 91.66667%; }\n .column.is-offset-11-widescreen {\n margin-left: 91.66667%; }\n .column.is-12-widescreen {\n flex: none;\n width: 100%; }\n .column.is-offset-12-widescreen {\n margin-left: 100%; } }\n\n.columns {\n margin-left: -10px;\n margin-right: -10px;\n margin-top: -10px; }\n .columns:last-child {\n margin-bottom: -10px; }\n .columns:not(:last-child) {\n margin-bottom: 10px; }\n .columns.is-centered {\n justify-content: center; }\n .columns.is-gapless {\n margin-left: 0;\n margin-right: 0;\n margin-top: 0; }\n .columns.is-gapless:last-child {\n margin-bottom: 0; }\n .columns.is-gapless:not(:last-child) {\n margin-bottom: 20px; }\n .columns.is-gapless > .column {\n margin: 0;\n padding: 0; }\n .columns.is-stretched {\n flex-grow: 1;\n align-items: stretch;\n align-self: stretch; }\n @media screen and (min-width: 769px) {\n .columns.is-grid {\n flex-wrap: wrap; }\n .columns.is-grid > .column {\n max-width: 33.3333%;\n padding: 10px;\n width: 33.3333%; }\n .columns.is-grid > .column + .column {\n margin-left: 0; } }\n .columns.is-mobile {\n display: flex; }\n .columns.is-multiline {\n flex-wrap: wrap; }\n .columns.is-vcentered {\n align-items: center; }\n @media screen and (min-width: 769px) {\n .columns:not(.is-desktop) {\n display: flex; } }\n @media screen and (min-width: 980px) {\n .columns.is-desktop {\n display: flex; } }\n\n.tile {\n align-items: stretch;\n flex-basis: auto;\n flex-grow: 1;\n flex-shrink: 1;\n min-height: min-content; }\n .tile.is-ancestor {\n margin-left: -10px;\n margin-right: -10px;\n margin-top: -10px; }\n .tile.is-ancestor:last-child {\n margin-bottom: -10px; }\n .tile.is-ancestor:not(:last-child) {\n margin-bottom: 10px; }\n .tile.is-child {\n margin: 0 !important; }\n .tile.is-parent {\n padding: 10px; }\n .tile.is-vertical {\n flex-direction: column; }\n .tile.is-vertical > .tile.is-child:not(:last-child) {\n margin-bottom: 20px !important; }\n @media screen and (min-width: 769px) {\n .tile:not(.is-child) {\n display: flex; }\n .tile.is-1 {\n flex: none;\n width: 8.33333%; }\n .tile.is-2 {\n flex: none;\n width: 16.66667%; }\n .tile.is-3 {\n flex: none;\n width: 25%; }\n .tile.is-4 {\n flex: none;\n width: 33.33333%; }\n .tile.is-5 {\n flex: none;\n width: 41.66667%; }\n .tile.is-6 {\n flex: none;\n width: 50%; }\n .tile.is-7 {\n flex: none;\n width: 58.33333%; }\n .tile.is-8 {\n flex: none;\n width: 66.66667%; }\n .tile.is-9 {\n flex: none;\n width: 75%; }\n .tile.is-10 {\n flex: none;\n width: 83.33333%; }\n .tile.is-11 {\n flex: none;\n width: 91.66667%; }\n .tile.is-12 {\n flex: none;\n width: 100%; } }\n\n.column.is-white {\n background-color: #FFF; }\n\n.hero {\n padding: 20px;\n background-color: #fafafa;\n border-bottom: 1px solid #eeeeee;\n position: relative; }\n .hero h1 {\n font-size: 28px;\n color: #3f51b5;\n font-weight: 300; }\n .hero h2 {\n font-size: 18px;\n color: #9e9e9e;\n font-weight: 400; }\n .hero .hero-menu {\n position: absolute;\n right: 20px;\n bottom: -1px;\n z-index: 1;\n display: flex; }\n .hero .hero-menu li {\n display: flex;\n margin-left: 1px; }\n .hero .hero-menu li a, .hero .hero-menu li button {\n background-color: #03a9f4;\n color: #FFF;\n display: inline-flex;\n align-items: center;\n justify-items: center;\n padding: 0 15px;\n height: 32px;\n border: 1px solid #039be5;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n font-size: 13px;\n transition: all 0.4s ease;\n cursor: pointer;\n text-decoration: none;\n text-transform: uppercase; }\n .hero .hero-menu li a i, .hero .hero-menu li button i {\n margin-right: 10px; }\n .hero .hero-menu li a.is-red, .hero .hero-menu li button.is-red {\n background-color: #e53935;\n border-color: #e53935; }\n .hero .hero-menu li a.is-red:hover, .hero .hero-menu li button.is-red:hover {\n background-color: #c62828; }\n .hero .hero-menu li a.is-pink, .hero .hero-menu li button.is-pink {\n background-color: #d81b60;\n border-color: #d81b60; }\n .hero .hero-menu li a.is-pink:hover, .hero .hero-menu li button.is-pink:hover {\n background-color: #ad1457; }\n .hero .hero-menu li a.is-purple, .hero .hero-menu li button.is-purple {\n background-color: #8e24aa;\n border-color: #8e24aa; }\n .hero .hero-menu li a.is-purple:hover, .hero .hero-menu li button.is-purple:hover {\n background-color: #6a1b9a; }\n .hero .hero-menu li a.is-deep-purple, .hero .hero-menu li button.is-deep-purple {\n background-color: #5e35b1;\n border-color: #5e35b1; }\n .hero .hero-menu li a.is-deep-purple:hover, .hero .hero-menu li button.is-deep-purple:hover {\n background-color: #4527a0; }\n .hero .hero-menu li a.is-indigo, .hero .hero-menu li button.is-indigo {\n background-color: #3949ab;\n border-color: #3949ab; }\n .hero .hero-menu li a.is-indigo:hover, .hero .hero-menu li button.is-indigo:hover {\n background-color: #283593; }\n .hero .hero-menu li a.is-blue, .hero .hero-menu li button.is-blue {\n background-color: #1e88e5;\n border-color: #1e88e5; }\n .hero .hero-menu li a.is-blue:hover, .hero .hero-menu li button.is-blue:hover {\n background-color: #1565c0; }\n .hero .hero-menu li a.is-light-blue, .hero .hero-menu li button.is-light-blue {\n background-color: #039be5;\n border-color: #039be5; }\n .hero .hero-menu li a.is-light-blue:hover, .hero .hero-menu li button.is-light-blue:hover {\n background-color: #0277bd; }\n .hero .hero-menu li a.is-cyan, .hero .hero-menu li button.is-cyan {\n background-color: #00acc1;\n border-color: #00acc1; }\n .hero .hero-menu li a.is-cyan:hover, .hero .hero-menu li button.is-cyan:hover {\n background-color: #00838f; }\n .hero .hero-menu li a.is-teal, .hero .hero-menu li button.is-teal {\n background-color: #00897b;\n border-color: #00897b; }\n .hero .hero-menu li a.is-teal:hover, .hero .hero-menu li button.is-teal:hover {\n background-color: #00695c; }\n .hero .hero-menu li a.is-green, .hero .hero-menu li button.is-green {\n background-color: #43a047;\n border-color: #43a047; }\n .hero .hero-menu li a.is-green:hover, .hero .hero-menu li button.is-green:hover {\n background-color: #2e7d32; }\n .hero .hero-menu li a.is-light-green, .hero .hero-menu li button.is-light-green {\n background-color: #7cb342;\n border-color: #7cb342; }\n .hero .hero-menu li a.is-light-green:hover, .hero .hero-menu li button.is-light-green:hover {\n background-color: #558b2f; }\n .hero .hero-menu li a.is-lime, .hero .hero-menu li button.is-lime {\n background-color: #c0ca33;\n border-color: #c0ca33; }\n .hero .hero-menu li a.is-lime:hover, .hero .hero-menu li button.is-lime:hover {\n background-color: #9e9d24; }\n .hero .hero-menu li a.is-yellow, .hero .hero-menu li button.is-yellow {\n background-color: #fdd835;\n border-color: #fdd835; }\n .hero .hero-menu li a.is-yellow:hover, .hero .hero-menu li button.is-yellow:hover {\n background-color: #f9a825; }\n .hero .hero-menu li a.is-amber, .hero .hero-menu li button.is-amber {\n background-color: #ffb300;\n border-color: #ffb300; }\n .hero .hero-menu li a.is-amber:hover, .hero .hero-menu li button.is-amber:hover {\n background-color: #ff8f00; }\n .hero .hero-menu li a.is-orange, .hero .hero-menu li button.is-orange {\n background-color: #fb8c00;\n border-color: #fb8c00; }\n .hero .hero-menu li a.is-orange:hover, .hero .hero-menu li button.is-orange:hover {\n background-color: #ef6c00; }\n .hero .hero-menu li a.is-deep-orange, .hero .hero-menu li button.is-deep-orange {\n background-color: #f4511e;\n border-color: #f4511e; }\n .hero .hero-menu li a.is-deep-orange:hover, .hero .hero-menu li button.is-deep-orange:hover {\n background-color: #d84315; }\n .hero .hero-menu li a.is-brown, .hero .hero-menu li button.is-brown {\n background-color: #6d4c41;\n border-color: #6d4c41; }\n .hero .hero-menu li a.is-brown:hover, .hero .hero-menu li button.is-brown:hover {\n background-color: #4e342e; }\n .hero .hero-menu li a.is-grey, .hero .hero-menu li button.is-grey {\n background-color: #757575;\n border-color: #757575; }\n .hero .hero-menu li a.is-grey:hover, .hero .hero-menu li button.is-grey:hover {\n background-color: #424242; }\n .hero .hero-menu li a.is-blue-grey, .hero .hero-menu li button.is-blue-grey {\n background-color: #546e7a;\n border-color: #546e7a; }\n .hero .hero-menu li a.is-blue-grey:hover, .hero .hero-menu li button.is-blue-grey:hover {\n background-color: #37474f; }\n\n.mkcontent {\n font-size: 14px;\n color: #616161;\n padding: 0 0 20px 0; }\n .mkcontent h1, .mkcontent h2, .mkcontent h3 {\n font-weight: 400;\n margin: 10px 0 0;\n padding: 7px 20px;\n font-weight: 500; }\n .mkcontent h1 {\n background-color: #e8eaf6;\n border-bottom: 2px solid #c5cae9;\n font-size: 18px;\n color: #3f51b5;\n /*& + h2 {\r\n\t\t\tmargin-top: 1px;\r\n\t\t\tborder-top: none;\r\n\t\t}*/ }\n .mkcontent h1:first-child {\n margin-top: 1px; }\n .mkcontent h1 + p {\n padding-top: 20px; }\n .mkcontent h2 {\n background-color: #f2faf9;\n border: 1px solid #b2dfdb;\n border-right-width: 5px;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n font-size: 16px;\n color: #004d40;\n margin-left: 20px; }\n .mkcontent .indent-h2 {\n border-right: 5px solid #b2dfdb;\n margin-left: 20px;\n padding-top: 1px;\n padding-bottom: 20px;\n overflow: hidden; }\n .mkcontent .indent-h2 + h1, .mkcontent .indent-h2 + h2 {\n margin-top: 1px; }\n .mkcontent .indent-h2:last-child {\n padding-bottom: 5px; }\n .mkcontent .indent-h2 h3:first-child {\n margin-top: 0;\n border-top: none; }\n .mkcontent h3 {\n background-color: #f1f9fe;\n border: 1px solid #bbdefb;\n border-right-width: 5px;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n font-size: 14px;\n color: #1976d2;\n margin-left: 20px;\n margin-right: 1px;\n padding: 5px 20px; }\n .mkcontent .indent-h3 {\n border-right: 5px solid #b2dfdb;\n margin-left: 20px;\n margin-right: 1px;\n padding-bottom: 10px; }\n .mkcontent .indent-h3 + h1, .mkcontent .indent-h3 + h2, .mkcontent .indent-h3 + h3 {\n margin-top: 1px; }\n .mkcontent .indent-h3:last-child {\n padding-bottom: 0; }\n .mkcontent a {\n text-decoration: underline;\n font-weight: 400; }\n .mkcontent a:hover {\n color: #1976d2; }\n .mkcontent a.toc-anchor {\n font-size: 80%;\n color: #7986cb;\n border-bottom: none;\n text-decoration: none; }\n .mkcontent a.toc-anchor:visited {\n color: #7986cb !important; }\n .mkcontent a.external-link {\n position: relative;\n padding-left: 5px; }\n .mkcontent a.external-link:before {\n content: \"\";\n display: inline-block;\n font-family: 'core-icons';\n font-style: normal;\n font-weight: normal;\n text-decoration: none;\n color: #9e9e9e;\n font-size: 14px;\n margin-right: 5px; }\n .mkcontent a.external-link:hover:before {\n text-decoration: none; }\n .mkcontent ul {\n padding: 10px 0 10px 40px;\n list-style-type: square; }\n .mkcontent ul li {\n padding: 1px 0; }\n .mkcontent ul li > ul {\n padding: 5px 0 5px 15px;\n list-style-type: disc; }\n .mkcontent ul li p {\n padding: 0; }\n .mkcontent ul li p:first-child {\n padding: 0; }\n .mkcontent ol {\n padding: 10px 40px;\n list-style-type: decimal; }\n .mkcontent ol li {\n padding: 1px 0; }\n .mkcontent p {\n padding: 10px 20px; }\n .mkcontent p:first-child {\n padding-top: 20px; }\n .mkcontent p.is-gapless {\n padding: 0 20px; }\n .mkcontent p.is-gapless + p {\n padding-top: 20px; }\n .mkcontent p.is-gapless + h1 {\n margin-top: 1px; }\n .mkcontent table {\n width: auto;\n border-collapse: collapse;\n margin: 10px 20px;\n font-size: 14px; }\n .mkcontent table th {\n background-color: #2196f3;\n color: #FFF;\n border: 1px solid #2196f3;\n padding: 5px 15px; }\n .mkcontent table th:first-child {\n border-left-color: #2196f3; }\n .mkcontent table th:last-child {\n border-right-color: #2196f3; }\n .mkcontent table td {\n border: 1px solid #9e9e9e;\n padding: 5px 15px; }\n .mkcontent table tr:nth-child(even) {\n background-color: #f5f5f5; }\n .mkcontent code {\n font-weight: 500;\n color: #9c27b0;\n background-color: #fcf7fc;\n padding: 0 5px;\n border-radius: 4px; }\n .mkcontent pre {\n background-color: #fafafa;\n border-top: 1px solid #f5f5f5;\n box-shadow: inset 0 0 5px 0 rgba(158, 158, 158, 0.3);\n padding: 20px;\n font-family: Consolas, \"Liberation Mono\", Menlo, Courier, monospace;\n white-space: pre; }\n .mkcontent pre > code {\n box-shadow: inset 0 0 5px 0 #f5f5f5;\n border-radius: 5px;\n font-weight: 400;\n background-color: none;\n color: #616161;\n padding: 0; }\n .mkcontent pre + p {\n padding-top: 1em; }\n .mkcontent pre + h1, .mkcontent pre + h2, .mkcontent pre + h3 {\n margin-top: 1px; }\n .mkcontent .align-right {\n float: right;\n margin: 0 0 10px 10px;\n max-width: 30vw; }\n .mkcontent .align-center {\n text-align: center; }\n .mkcontent img.pagelogo {\n position: absolute;\n right: 20px;\n top: 20px;\n max-width: 200px;\n max-height: 100px;\n z-index: 3; }\n .mkcontent strong {\n color: #616161; }\n .mkcontent .twa {\n font-size: 120%; }\n .mkcontent hr {\n margin: 20px;\n border-top: 1px dotted #9e9e9e; }\n .mkcontent blockquote {\n background-color: #e0f2f1;\n border: 1px solid #b2dfdb;\n border-bottom-width: 2px;\n box-shadow: inset 0px 0px 0px 1px white;\n border-radius: 5px;\n padding: 0 10px;\n margin: 10px 20px; }\n .mkcontent blockquote p {\n padding: 10px 0;\n color: #00695c; }\n .mkcontent blockquote p:first-child {\n padding: 10px 0; }\n .mkcontent blockquote p strong {\n color: inherit; }\n .mkcontent blockquote.is-danger {\n background-color: #ffcdd2;\n border-color: #ef9a9a; }\n .mkcontent blockquote.is-danger p {\n color: #b71c1c; }\n .mkcontent blockquote.is-warning {\n background-color: #fff8e1;\n border-color: #ffe082; }\n .mkcontent blockquote.is-warning p {\n color: #cc5900; }\n .mkcontent blockquote.is-success {\n background-color: #e8f5e9;\n border-color: #a5d6a7; }\n .mkcontent blockquote.is-success p {\n color: #103613; }\n .mkcontent blockquote.is-info {\n background-color: #e3f2fd;\n border-color: #90caf9; }\n .mkcontent blockquote.is-info p {\n color: #093272; }\n\n.modal {\n align-items: flex-start;\n display: none; }\n .modal.is-active {\n display: block; }\n .modal.is-superimposed .modal-background {\n z-index: 20; }\n .modal.is-superimposed .modal-container {\n z-index: 21; }\n\n.modal-background {\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n position: fixed;\n background-color: rgba(0, 0, 0, 0.85);\n animation: .4s ease fadeIn;\n z-index: 10; }\n\n.modal-container {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 11;\n display: flex;\n justify-content: center;\n align-items: center; }\n\n.modal-content {\n animation: .3s ease zoomIn;\n width: 600px;\n background-color: #FFF; }\n .modal-content.is-expanded {\n align-self: stretch;\n width: 100%;\n margin: 20px;\n display: flex;\n flex-direction: column; }\n .modal-content.is-expanded > section {\n flex-grow: 1; }\n .modal-content header {\n background-color: #00897b;\n color: #FFF;\n display: flex;\n flex-shrink: 0;\n height: 40px;\n align-items: center;\n font-weight: 400;\n font-size: 16px;\n padding: 0 20px;\n position: relative; }\n .modal-content header.is-red {\n background-color: #e53935; }\n .modal-content header.is-pink {\n background-color: #d81b60; }\n .modal-content header.is-purple {\n background-color: #8e24aa; }\n .modal-content header.is-deep-purple {\n background-color: #5e35b1; }\n .modal-content header.is-indigo {\n background-color: #3949ab; }\n .modal-content header.is-blue {\n background-color: #1e88e5; }\n .modal-content header.is-light-blue {\n background-color: #039be5; }\n .modal-content header.is-cyan {\n background-color: #00acc1; }\n .modal-content header.is-teal {\n background-color: #00897b; }\n .modal-content header.is-green {\n background-color: #43a047; }\n .modal-content header.is-light-green {\n background-color: #7cb342; }\n .modal-content header.is-lime {\n background-color: #c0ca33; }\n .modal-content header.is-yellow {\n background-color: #fdd835; }\n .modal-content header.is-amber {\n background-color: #ffb300; }\n .modal-content header.is-orange {\n background-color: #fb8c00; }\n .modal-content header.is-deep-orange {\n background-color: #f4511e; }\n .modal-content header.is-brown {\n background-color: #6d4c41; }\n .modal-content header.is-grey {\n background-color: #757575; }\n .modal-content header.is-blue-grey {\n background-color: #546e7a; }\n .modal-content header .modal-notify {\n position: absolute;\n display: none;\n align-items: center;\n height: 40px;\n right: 20px;\n top: 0; }\n .modal-content header .modal-notify.is-active {\n display: flex; }\n .modal-content header .modal-notify span {\n font-size: 12px;\n letter-spacing: 1px;\n text-transform: uppercase; }\n .modal-content header .modal-notify i {\n margin-left: 15px;\n display: inline-block;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #FFF;\n -webkit-animation: spin 0.5s linear infinite;\n -moz-animation: spin 0.5s linear infinite;\n -ms-animation: spin 0.5s linear infinite;\n -o-animation: spin 0.5s linear infinite;\n animation: spin 0.5s linear infinite; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .modal-content section {\n padding: 20px;\n border-top: 1px dotted #e0e0e0; }\n .modal-content section:first-of-type {\n border-top: none;\n padding-top: 20px; }\n .modal-content section:last-of-type {\n padding-bottom: 20px; }\n .modal-content section.is-gapless {\n padding: 10px;\n display: flex; }\n .modal-content section.modal-loading {\n display: flex;\n flex-direction: column;\n align-items: center; }\n .modal-content section.modal-loading > i {\n display: block;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #2196f3;\n -webkit-animation: spin 0.4s linear infinite;\n -moz-animation: spin 0.4s linear infinite;\n -ms-animation: spin 0.4s linear infinite;\n -o-animation: spin 0.4s linear infinite;\n animation: spin 0.4s linear infinite;\n margin-bottom: 10px; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .modal-content section.modal-loading > span {\n color: #757575; }\n .modal-content section.modal-loading > em {\n font-size: 12px;\n color: #9e9e9e;\n font-style: normal; }\n .modal-content section.modal-instructions {\n display: flex;\n flex-direction: column;\n align-items: center;\n color: #424242; }\n .modal-content section.modal-instructions img {\n height: 100px; }\n .modal-content section.modal-instructions img + * {\n margin-top: 10px; }\n .modal-content section.modal-instructions i.is-huge {\n font-size: 72px;\n margin-bottom: 10px; }\n .modal-content section.modal-instructions > span {\n color: #424242; }\n .modal-content section.modal-instructions > em {\n font-size: 12px;\n color: #757575;\n font-style: normal;\n margin-top: 10px;\n display: block; }\n .modal-content section .bullets {\n list-style-type: square;\n padding: 5px 0 0 30px;\n font-size: 14px;\n color: #424242; }\n .modal-content section .note {\n display: block;\n margin-top: 10px;\n font-size: 14px;\n color: #424242; }\n .modal-content section .note:first-child {\n margin-top: 0; }\n .modal-content section .note ul {\n color: #424242;\n padding-left: 10px; }\n .modal-content section .note ul li {\n margin-top: 5px;\n display: flex;\n align-items: center; }\n .modal-content section .note ul li > i {\n margin-right: 8px;\n font-size: 18px; }\n .modal-content footer {\n padding: 20px;\n text-align: right; }\n .modal-content footer .button {\n margin-left: 10px; }\n\n.modal-toolbar {\n background-color: #00796b;\n padding: 7px 20px;\n display: flex;\n flex-shrink: 0;\n justify-content: center; }\n .modal-toolbar.is-red {\n background-color: #d32f2f; }\n .modal-toolbar.is-red .button {\n border-color: #b71c1c;\n background-color: #b71c1c; }\n .modal-toolbar.is-red .button:hover {\n border-color: #b71c1c;\n background-color: #c62828; }\n .modal-toolbar.is-pink {\n background-color: #c2185b; }\n .modal-toolbar.is-pink .button {\n border-color: #880e4f;\n background-color: #880e4f; }\n .modal-toolbar.is-pink .button:hover {\n border-color: #880e4f;\n background-color: #ad1457; }\n .modal-toolbar.is-purple {\n background-color: #7b1fa2; }\n .modal-toolbar.is-purple .button {\n border-color: #4a148c;\n background-color: #4a148c; }\n .modal-toolbar.is-purple .button:hover {\n border-color: #4a148c;\n background-color: #6a1b9a; }\n .modal-toolbar.is-deep-purple {\n background-color: #512da8; }\n .modal-toolbar.is-deep-purple .button {\n border-color: #311b92;\n background-color: #311b92; }\n .modal-toolbar.is-deep-purple .button:hover {\n border-color: #311b92;\n background-color: #4527a0; }\n .modal-toolbar.is-indigo {\n background-color: #303f9f; }\n .modal-toolbar.is-indigo .button {\n border-color: #1a237e;\n background-color: #1a237e; }\n .modal-toolbar.is-indigo .button:hover {\n border-color: #1a237e;\n background-color: #283593; }\n .modal-toolbar.is-blue {\n background-color: #1976d2; }\n .modal-toolbar.is-blue .button {\n border-color: #0d47a1;\n background-color: #0d47a1; }\n .modal-toolbar.is-blue .button:hover {\n border-color: #0d47a1;\n background-color: #1565c0; }\n .modal-toolbar.is-light-blue {\n background-color: #0288d1; }\n .modal-toolbar.is-light-blue .button {\n border-color: #01579b;\n background-color: #01579b; }\n .modal-toolbar.is-light-blue .button:hover {\n border-color: #01579b;\n background-color: #0277bd; }\n .modal-toolbar.is-cyan {\n background-color: #0097a7; }\n .modal-toolbar.is-cyan .button {\n border-color: #006064;\n background-color: #006064; }\n .modal-toolbar.is-cyan .button:hover {\n border-color: #006064;\n background-color: #00838f; }\n .modal-toolbar.is-teal {\n background-color: #00796b; }\n .modal-toolbar.is-teal .button {\n border-color: #004d40;\n background-color: #004d40; }\n .modal-toolbar.is-teal .button:hover {\n border-color: #004d40;\n background-color: #00695c; }\n .modal-toolbar.is-green {\n background-color: #388e3c; }\n .modal-toolbar.is-green .button {\n border-color: #1b5e20;\n background-color: #1b5e20; }\n .modal-toolbar.is-green .button:hover {\n border-color: #1b5e20;\n background-color: #2e7d32; }\n .modal-toolbar.is-light-green {\n background-color: #689f38; }\n .modal-toolbar.is-light-green .button {\n border-color: #33691e;\n background-color: #33691e; }\n .modal-toolbar.is-light-green .button:hover {\n border-color: #33691e;\n background-color: #558b2f; }\n .modal-toolbar.is-lime {\n background-color: #afb42b; }\n .modal-toolbar.is-lime .button {\n border-color: #827717;\n background-color: #827717; }\n .modal-toolbar.is-lime .button:hover {\n border-color: #827717;\n background-color: #9e9d24; }\n .modal-toolbar.is-yellow {\n background-color: #fbc02d; }\n .modal-toolbar.is-yellow .button {\n border-color: #f57f17;\n background-color: #f57f17; }\n .modal-toolbar.is-yellow .button:hover {\n border-color: #f57f17;\n background-color: #f9a825; }\n .modal-toolbar.is-amber {\n background-color: #ffa000; }\n .modal-toolbar.is-amber .button {\n border-color: #ff6f00;\n background-color: #ff6f00; }\n .modal-toolbar.is-amber .button:hover {\n border-color: #ff6f00;\n background-color: #ff8f00; }\n .modal-toolbar.is-orange {\n background-color: #f57c00; }\n .modal-toolbar.is-orange .button {\n border-color: #e65100;\n background-color: #e65100; }\n .modal-toolbar.is-orange .button:hover {\n border-color: #e65100;\n background-color: #ef6c00; }\n .modal-toolbar.is-deep-orange {\n background-color: #e64a19; }\n .modal-toolbar.is-deep-orange .button {\n border-color: #bf360c;\n background-color: #bf360c; }\n .modal-toolbar.is-deep-orange .button:hover {\n border-color: #bf360c;\n background-color: #d84315; }\n .modal-toolbar.is-brown {\n background-color: #5d4037; }\n .modal-toolbar.is-brown .button {\n border-color: #3e2723;\n background-color: #3e2723; }\n .modal-toolbar.is-brown .button:hover {\n border-color: #3e2723;\n background-color: #4e342e; }\n .modal-toolbar.is-grey {\n background-color: #616161; }\n .modal-toolbar.is-grey .button {\n border-color: #212121;\n background-color: #212121; }\n .modal-toolbar.is-grey .button:hover {\n border-color: #212121;\n background-color: #424242; }\n .modal-toolbar.is-blue-grey {\n background-color: #455a64; }\n .modal-toolbar.is-blue-grey .button {\n border-color: #263238;\n background-color: #263238; }\n .modal-toolbar.is-blue-grey .button:hover {\n border-color: #263238;\n background-color: #37474f; }\n .modal-toolbar .button {\n border: 1px solid #004d40;\n background-color: #004d40;\n transition: all .4s ease;\n color: #FFF;\n border-radius: 0; }\n .modal-toolbar .button:first-child {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px; }\n .modal-toolbar .button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px; }\n .modal-toolbar .button:hover {\n border-color: #004d40;\n background-color: #00695c;\n color: #FFF; }\n .modal-toolbar .button + .button {\n margin-left: 1px; }\n\n.modal-sidebar {\n background-color: #e0f2f1;\n padding: 0; }\n .modal-sidebar.is-red {\n background-color: #ffebee; }\n .modal-sidebar.is-red .model-sidebar-header {\n background-color: #ffcdd2;\n color: #c62828; }\n .modal-sidebar.is-red .model-sidebar-list > li a:hover {\n background-color: #ef9a9a; }\n .modal-sidebar.is-red .model-sidebar-list > li a.is-active {\n background-color: #f44336; }\n .modal-sidebar.is-pink {\n background-color: #fce4ec; }\n .modal-sidebar.is-pink .model-sidebar-header {\n background-color: #f8bbd0;\n color: #ad1457; }\n .modal-sidebar.is-pink .model-sidebar-list > li a:hover {\n background-color: #f48fb1; }\n .modal-sidebar.is-pink .model-sidebar-list > li a.is-active {\n background-color: #e91e63; }\n .modal-sidebar.is-purple {\n background-color: #f3e5f5; }\n .modal-sidebar.is-purple .model-sidebar-header {\n background-color: #e1bee7;\n color: #6a1b9a; }\n .modal-sidebar.is-purple .model-sidebar-list > li a:hover {\n background-color: #ce93d8; }\n .modal-sidebar.is-purple .model-sidebar-list > li a.is-active {\n background-color: #9c27b0; }\n .modal-sidebar.is-deep-purple {\n background-color: #ede7f6; }\n .modal-sidebar.is-deep-purple .model-sidebar-header {\n background-color: #d1c4e9;\n color: #4527a0; }\n .modal-sidebar.is-deep-purple .model-sidebar-list > li a:hover {\n background-color: #b39ddb; }\n .modal-sidebar.is-deep-purple .model-sidebar-list > li a.is-active {\n background-color: #673ab7; }\n .modal-sidebar.is-indigo {\n background-color: #e8eaf6; }\n .modal-sidebar.is-indigo .model-sidebar-header {\n background-color: #c5cae9;\n color: #283593; }\n .modal-sidebar.is-indigo .model-sidebar-list > li a:hover {\n background-color: #9fa8da; }\n .modal-sidebar.is-indigo .model-sidebar-list > li a.is-active {\n background-color: #3f51b5; }\n .modal-sidebar.is-blue {\n background-color: #e3f2fd; }\n .modal-sidebar.is-blue .model-sidebar-header {\n background-color: #bbdefb;\n color: #1565c0; }\n .modal-sidebar.is-blue .model-sidebar-list > li a:hover {\n background-color: #90caf9; }\n .modal-sidebar.is-blue .model-sidebar-list > li a.is-active {\n background-color: #2196f3; }\n .modal-sidebar.is-light-blue {\n background-color: #e1f5fe; }\n .modal-sidebar.is-light-blue .model-sidebar-header {\n background-color: #b3e5fc;\n color: #0277bd; }\n .modal-sidebar.is-light-blue .model-sidebar-list > li a:hover {\n background-color: #81d4fa; }\n .modal-sidebar.is-light-blue .model-sidebar-list > li a.is-active {\n background-color: #03a9f4; }\n .modal-sidebar.is-cyan {\n background-color: #e0f7fa; }\n .modal-sidebar.is-cyan .model-sidebar-header {\n background-color: #b2ebf2;\n color: #00838f; }\n .modal-sidebar.is-cyan .model-sidebar-list > li a:hover {\n background-color: #80deea; }\n .modal-sidebar.is-cyan .model-sidebar-list > li a.is-active {\n background-color: #00bcd4; }\n .modal-sidebar.is-teal {\n background-color: #e0f2f1; }\n .modal-sidebar.is-teal .model-sidebar-header {\n background-color: #b2dfdb;\n color: #00695c; }\n .modal-sidebar.is-teal .model-sidebar-list > li a:hover {\n background-color: #80cbc4; }\n .modal-sidebar.is-teal .model-sidebar-list > li a.is-active {\n background-color: #009688; }\n .modal-sidebar.is-green {\n background-color: #e8f5e9; }\n .modal-sidebar.is-green .model-sidebar-header {\n background-color: #c8e6c9;\n color: #2e7d32; }\n .modal-sidebar.is-green .model-sidebar-list > li a:hover {\n background-color: #a5d6a7; }\n .modal-sidebar.is-green .model-sidebar-list > li a.is-active {\n background-color: #4caf50; }\n .modal-sidebar.is-light-green {\n background-color: #f1f8e9; }\n .modal-sidebar.is-light-green .model-sidebar-header {\n background-color: #dcedc8;\n color: #558b2f; }\n .modal-sidebar.is-light-green .model-sidebar-list > li a:hover {\n background-color: #c5e1a5; }\n .modal-sidebar.is-light-green .model-sidebar-list > li a.is-active {\n background-color: #8bc34a; }\n .modal-sidebar.is-lime {\n background-color: #f9fbe7; }\n .modal-sidebar.is-lime .model-sidebar-header {\n background-color: #f0f4c3;\n color: #9e9d24; }\n .modal-sidebar.is-lime .model-sidebar-list > li a:hover {\n background-color: #e6ee9c; }\n .modal-sidebar.is-lime .model-sidebar-list > li a.is-active {\n background-color: #cddc39; }\n .modal-sidebar.is-yellow {\n background-color: #fffde7; }\n .modal-sidebar.is-yellow .model-sidebar-header {\n background-color: #fff9c4;\n color: #f9a825; }\n .modal-sidebar.is-yellow .model-sidebar-list > li a:hover {\n background-color: #fff59d; }\n .modal-sidebar.is-yellow .model-sidebar-list > li a.is-active {\n background-color: #ffeb3b; }\n .modal-sidebar.is-amber {\n background-color: #fff8e1; }\n .modal-sidebar.is-amber .model-sidebar-header {\n background-color: #ffecb3;\n color: #ff8f00; }\n .modal-sidebar.is-amber .model-sidebar-list > li a:hover {\n background-color: #ffe082; }\n .modal-sidebar.is-amber .model-sidebar-list > li a.is-active {\n background-color: #ffc107; }\n .modal-sidebar.is-orange {\n background-color: #fff3e0; }\n .modal-sidebar.is-orange .model-sidebar-header {\n background-color: #ffe0b2;\n color: #ef6c00; }\n .modal-sidebar.is-orange .model-sidebar-list > li a:hover {\n background-color: #ffcc80; }\n .modal-sidebar.is-orange .model-sidebar-list > li a.is-active {\n background-color: #ff9800; }\n .modal-sidebar.is-deep-orange {\n background-color: #fbe9e7; }\n .modal-sidebar.is-deep-orange .model-sidebar-header {\n background-color: #ffccbc;\n color: #d84315; }\n .modal-sidebar.is-deep-orange .model-sidebar-list > li a:hover {\n background-color: #ffab91; }\n .modal-sidebar.is-deep-orange .model-sidebar-list > li a.is-active {\n background-color: #ff5722; }\n .modal-sidebar.is-brown {\n background-color: #efebe9; }\n .modal-sidebar.is-brown .model-sidebar-header {\n background-color: #d7ccc8;\n color: #4e342e; }\n .modal-sidebar.is-brown .model-sidebar-list > li a:hover {\n background-color: #bcaaa4; }\n .modal-sidebar.is-brown .model-sidebar-list > li a.is-active {\n background-color: #795548; }\n .modal-sidebar.is-grey {\n background-color: #fafafa; }\n .modal-sidebar.is-grey .model-sidebar-header {\n background-color: #f5f5f5;\n color: #424242; }\n .modal-sidebar.is-grey .model-sidebar-list > li a:hover {\n background-color: #eeeeee; }\n .modal-sidebar.is-grey .model-sidebar-list > li a.is-active {\n background-color: #9e9e9e; }\n .modal-sidebar.is-blue-grey {\n background-color: #eceff1; }\n .modal-sidebar.is-blue-grey .model-sidebar-header {\n background-color: #cfd8dc;\n color: #37474f; }\n .modal-sidebar.is-blue-grey .model-sidebar-list > li a:hover {\n background-color: #b0bec5; }\n .modal-sidebar.is-blue-grey .model-sidebar-list > li a.is-active {\n background-color: #607d8b; }\n .modal-sidebar .model-sidebar-header {\n padding: 7px 20px; }\n .modal-sidebar .model-sidebar-content {\n padding: 7px 20px; }\n .modal-sidebar .model-sidebar-list > li {\n padding: 0; }\n .modal-sidebar .model-sidebar-list > li a {\n display: flex;\n align-items: center;\n height: 34px;\n padding: 0 20px;\n cursor: pointer;\n color: #424242; }\n .modal-sidebar .model-sidebar-list > li a:hover {\n background-color: #80cbc4; }\n .modal-sidebar .model-sidebar-list > li a.is-active {\n color: #FFF; }\n .modal-sidebar .model-sidebar-list > li a i {\n margin-right: 7px; }\n\n.modal-content .card-footer-item.featured {\n animation: flash 4s ease 0 infinite; }\n\n.nav {\n align-items: stretch;\n background-color: #3f51b5;\n display: flex;\n min-height: 50px;\n position: relative;\n text-align: center;\n box-shadow: 0 2px 3px rgba(63, 81, 181, 0.2);\n z-index: 2;\n color: #FFF; }\n .nav.is-red {\n background-color: #f44336;\n box-shadow: 0 2px 3px rgba(244, 67, 54, 0.2); }\n .nav.is-red .nav-item .button {\n border: 1px solid #b71c1c;\n background-color: #c62828; }\n .nav.is-red .nav-item .button.is-outlined {\n background-color: #e53935;\n border-color: #c62828;\n color: #ffcdd2; }\n .nav.is-red .nav-item .button:hover {\n border-color: #b71c1c;\n background-color: #b71c1c; }\n .nav.is-pink {\n background-color: #e91e63;\n box-shadow: 0 2px 3px rgba(233, 30, 99, 0.2); }\n .nav.is-pink .nav-item .button {\n border: 1px solid #880e4f;\n background-color: #ad1457; }\n .nav.is-pink .nav-item .button.is-outlined {\n background-color: #d81b60;\n border-color: #ad1457;\n color: #f8bbd0; }\n .nav.is-pink .nav-item .button:hover {\n border-color: #880e4f;\n background-color: #880e4f; }\n .nav.is-purple {\n background-color: #9c27b0;\n box-shadow: 0 2px 3px rgba(156, 39, 176, 0.2); }\n .nav.is-purple .nav-item .button {\n border: 1px solid #4a148c;\n background-color: #6a1b9a; }\n .nav.is-purple .nav-item .button.is-outlined {\n background-color: #8e24aa;\n border-color: #6a1b9a;\n color: #e1bee7; }\n .nav.is-purple .nav-item .button:hover {\n border-color: #4a148c;\n background-color: #4a148c; }\n .nav.is-deep-purple {\n background-color: #673ab7;\n box-shadow: 0 2px 3px rgba(103, 58, 183, 0.2); }\n .nav.is-deep-purple .nav-item .button {\n border: 1px solid #311b92;\n background-color: #4527a0; }\n .nav.is-deep-purple .nav-item .button.is-outlined {\n background-color: #5e35b1;\n border-color: #4527a0;\n color: #d1c4e9; }\n .nav.is-deep-purple .nav-item .button:hover {\n border-color: #311b92;\n background-color: #311b92; }\n .nav.is-indigo {\n background-color: #3f51b5;\n box-shadow: 0 2px 3px rgba(63, 81, 181, 0.2); }\n .nav.is-indigo .nav-item .button {\n border: 1px solid #1a237e;\n background-color: #283593; }\n .nav.is-indigo .nav-item .button.is-outlined {\n background-color: #3949ab;\n border-color: #283593;\n color: #c5cae9; }\n .nav.is-indigo .nav-item .button:hover {\n border-color: #1a237e;\n background-color: #1a237e; }\n .nav.is-blue {\n background-color: #2196f3;\n box-shadow: 0 2px 3px rgba(33, 150, 243, 0.2); }\n .nav.is-blue .nav-item .button {\n border: 1px solid #0d47a1;\n background-color: #1565c0; }\n .nav.is-blue .nav-item .button.is-outlined {\n background-color: #1e88e5;\n border-color: #1565c0;\n color: #bbdefb; }\n .nav.is-blue .nav-item .button:hover {\n border-color: #0d47a1;\n background-color: #0d47a1; }\n .nav.is-light-blue {\n background-color: #03a9f4;\n box-shadow: 0 2px 3px rgba(3, 169, 244, 0.2); }\n .nav.is-light-blue .nav-item .button {\n border: 1px solid #01579b;\n background-color: #0277bd; }\n .nav.is-light-blue .nav-item .button.is-outlined {\n background-color: #039be5;\n border-color: #0277bd;\n color: #b3e5fc; }\n .nav.is-light-blue .nav-item .button:hover {\n border-color: #01579b;\n background-color: #01579b; }\n .nav.is-cyan {\n background-color: #00bcd4;\n box-shadow: 0 2px 3px rgba(0, 188, 212, 0.2); }\n .nav.is-cyan .nav-item .button {\n border: 1px solid #006064;\n background-color: #00838f; }\n .nav.is-cyan .nav-item .button.is-outlined {\n background-color: #00acc1;\n border-color: #00838f;\n color: #b2ebf2; }\n .nav.is-cyan .nav-item .button:hover {\n border-color: #006064;\n background-color: #006064; }\n .nav.is-teal {\n background-color: #009688;\n box-shadow: 0 2px 3px rgba(0, 150, 136, 0.2); }\n .nav.is-teal .nav-item .button {\n border: 1px solid #004d40;\n background-color: #00695c; }\n .nav.is-teal .nav-item .button.is-outlined {\n background-color: #00897b;\n border-color: #00695c;\n color: #b2dfdb; }\n .nav.is-teal .nav-item .button:hover {\n border-color: #004d40;\n background-color: #004d40; }\n .nav.is-green {\n background-color: #4caf50;\n box-shadow: 0 2px 3px rgba(76, 175, 80, 0.2); }\n .nav.is-green .nav-item .button {\n border: 1px solid #1b5e20;\n background-color: #2e7d32; }\n .nav.is-green .nav-item .button.is-outlined {\n background-color: #43a047;\n border-color: #2e7d32;\n color: #c8e6c9; }\n .nav.is-green .nav-item .button:hover {\n border-color: #1b5e20;\n background-color: #1b5e20; }\n .nav.is-light-green {\n background-color: #8bc34a;\n box-shadow: 0 2px 3px rgba(139, 195, 74, 0.2); }\n .nav.is-light-green .nav-item .button {\n border: 1px solid #33691e;\n background-color: #558b2f; }\n .nav.is-light-green .nav-item .button.is-outlined {\n background-color: #7cb342;\n border-color: #558b2f;\n color: #dcedc8; }\n .nav.is-light-green .nav-item .button:hover {\n border-color: #33691e;\n background-color: #33691e; }\n .nav.is-lime {\n background-color: #cddc39;\n box-shadow: 0 2px 3px rgba(205, 220, 57, 0.2); }\n .nav.is-lime .nav-item .button {\n border: 1px solid #827717;\n background-color: #9e9d24; }\n .nav.is-lime .nav-item .button.is-outlined {\n background-color: #c0ca33;\n border-color: #9e9d24;\n color: #f0f4c3; }\n .nav.is-lime .nav-item .button:hover {\n border-color: #827717;\n background-color: #827717; }\n .nav.is-yellow {\n background-color: #ffeb3b;\n box-shadow: 0 2px 3px rgba(255, 235, 59, 0.2); }\n .nav.is-yellow .nav-item .button {\n border: 1px solid #f57f17;\n background-color: #f9a825; }\n .nav.is-yellow .nav-item .button.is-outlined {\n background-color: #fdd835;\n border-color: #f9a825;\n color: #fff9c4; }\n .nav.is-yellow .nav-item .button:hover {\n border-color: #f57f17;\n background-color: #f57f17; }\n .nav.is-amber {\n background-color: #ffc107;\n box-shadow: 0 2px 3px rgba(255, 193, 7, 0.2); }\n .nav.is-amber .nav-item .button {\n border: 1px solid #ff6f00;\n background-color: #ff8f00; }\n .nav.is-amber .nav-item .button.is-outlined {\n background-color: #ffb300;\n border-color: #ff8f00;\n color: #ffecb3; }\n .nav.is-amber .nav-item .button:hover {\n border-color: #ff6f00;\n background-color: #ff6f00; }\n .nav.is-orange {\n background-color: #ff9800;\n box-shadow: 0 2px 3px rgba(255, 152, 0, 0.2); }\n .nav.is-orange .nav-item .button {\n border: 1px solid #e65100;\n background-color: #ef6c00; }\n .nav.is-orange .nav-item .button.is-outlined {\n background-color: #fb8c00;\n border-color: #ef6c00;\n color: #ffe0b2; }\n .nav.is-orange .nav-item .button:hover {\n border-color: #e65100;\n background-color: #e65100; }\n .nav.is-deep-orange {\n background-color: #ff5722;\n box-shadow: 0 2px 3px rgba(255, 87, 34, 0.2); }\n .nav.is-deep-orange .nav-item .button {\n border: 1px solid #bf360c;\n background-color: #d84315; }\n .nav.is-deep-orange .nav-item .button.is-outlined {\n background-color: #f4511e;\n border-color: #d84315;\n color: #ffccbc; }\n .nav.is-deep-orange .nav-item .button:hover {\n border-color: #bf360c;\n background-color: #bf360c; }\n .nav.is-brown {\n background-color: #795548;\n box-shadow: 0 2px 3px rgba(121, 85, 72, 0.2); }\n .nav.is-brown .nav-item .button {\n border: 1px solid #3e2723;\n background-color: #4e342e; }\n .nav.is-brown .nav-item .button.is-outlined {\n background-color: #6d4c41;\n border-color: #4e342e;\n color: #d7ccc8; }\n .nav.is-brown .nav-item .button:hover {\n border-color: #3e2723;\n background-color: #3e2723; }\n .nav.is-grey {\n background-color: #9e9e9e;\n box-shadow: 0 2px 3px rgba(158, 158, 158, 0.2); }\n .nav.is-grey .nav-item .button {\n border: 1px solid #212121;\n background-color: #424242; }\n .nav.is-grey .nav-item .button.is-outlined {\n background-color: #757575;\n border-color: #424242;\n color: #f5f5f5; }\n .nav.is-grey .nav-item .button:hover {\n border-color: #212121;\n background-color: #212121; }\n .nav.is-blue-grey {\n background-color: #607d8b;\n box-shadow: 0 2px 3px rgba(96, 125, 139, 0.2); }\n .nav.is-blue-grey .nav-item .button {\n border: 1px solid #263238;\n background-color: #37474f; }\n .nav.is-blue-grey .nav-item .button.is-outlined {\n background-color: #546e7a;\n border-color: #37474f;\n color: #cfd8dc; }\n .nav.is-blue-grey .nav-item .button:hover {\n border-color: #263238;\n background-color: #263238; }\n\n.nav-left {\n align-items: stretch;\n display: flex;\n flex-basis: 0;\n flex-grow: 1;\n justify-content: flex-start;\n overflow: hidden;\n overflow-x: auto;\n white-space: nowrap; }\n\n.nav-center {\n align-items: stretch;\n display: flex;\n justify-content: center;\n margin-left: auto;\n margin-right: auto; }\n\n@media screen and (min-width: 769px) {\n .nav-right {\n align-items: stretch;\n display: flex;\n flex-basis: 0;\n flex-grow: 1;\n justify-content: flex-end; } }\n\n.nav-item {\n align-items: center;\n display: flex;\n justify-content: center;\n padding: 0 10px; }\n .nav-item a, a.nav-item {\n color: #e8eaf6;\n transition: color .4s ease;\n cursor: pointer; }\n .nav-item a:hover, a.nav-item:hover {\n color: #9fa8da;\n text-decoration: none; }\n .nav-item img {\n max-height: 34px; }\n .nav-item h1 {\n font-size: 16px;\n font-weight: 400;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n transition: color .4s ease;\n color: #FFF;\n padding-left: 10px; }\n .nav-item h1 i {\n margin-right: 8px; }\n .nav-item h1:hover {\n color: #c5cae9; }\n h2.nav-item, .nav-item h2 {\n color: #e8eaf6; }\n .nav-item .button {\n border: 1px solid #1a237e;\n background-color: #283593;\n transition: all .4s ease;\n color: #FFF;\n border-radius: 0; }\n .nav-item .button:first-child {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px; }\n .nav-item .button:last-child {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px; }\n .nav-item .button.is-outlined {\n background-color: #3949ab;\n border-color: #283593;\n color: #c5cae9; }\n .nav-item .button:hover {\n border-color: #1a237e;\n background-color: #1a237e;\n color: #FFF; }\n .nav-item .button + .button {\n margin-left: 1px; }\n .nav-item .control input[type=text] {\n background-color: #283593;\n border-color: #5c6bc0;\n color: #e8eaf6; }\n .nav-item .control input[type=text]:focus {\n border-color: #9fa8da;\n box-shadow: inset 0 0 5px 0 rgba(26, 35, 126, 0.5); }\n .nav-item .control input[type=text]::-webkit-input-placeholder {\n color: #9fa8da; }\n .nav-item .control input[type=text]::-moz-placeholder {\n color: #9fa8da; }\n .nav-item .control input[type=text]:-ms-input-placeholder {\n color: #9fa8da; }\n .nav-item .control input[type=text]:placeholder-shown {\n color: #9fa8da; }\n\n.panel-aside {\n background-color: #37474f;\n border: 1px solid #37474f;\n border-bottom-left-radius: 8px;\n padding: 20px;\n color: #cfd8dc; }\n .panel-aside label {\n color: #FFF; }\n\n.panel {\n background-color: #FFF;\n box-shadow: 0 0 12px 0 rgba(66, 66, 66, 0.1), 1px 6px 8px 0 rgba(66, 66, 66, 0.1);\n padding: 0 0 1px 0;\n border-radius: 4px; }\n .panel .panel-title {\n border-bottom: 1px solid #e4e6f0;\n padding: 0 15px;\n color: mc(\"grey\", \"800\");\n font-size: 16px;\n font-weight: 500;\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 40px; }\n .panel .panel-title.is-featured {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n background-color: #7986cb;\n border-bottom-color: #5c6bc0;\n color: #FFF; }\n .panel .panel-title.is-featured > i::before {\n width: 18px;\n height: 18px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #FFF;\n -webkit-animation: spin 0.4s linear infinite;\n -moz-animation: spin 0.4s linear infinite;\n -ms-animation: spin 0.4s linear infinite;\n -o-animation: spin 0.4s linear infinite;\n animation: spin 0.4s linear infinite; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .panel .panel-title > span {\n font-weight: 500; }\n .panel .panel-title > i {\n display: flex;\n width: 18px;\n align-items: center; }\n .panel .panel-title > i::before {\n content: \" \";\n width: 18px;\n height: 18px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #3f51b5;\n -webkit-animation: spin 0.4s linear infinite;\n -moz-animation: spin 0.4s linear infinite;\n -ms-animation: spin 0.4s linear infinite;\n -o-animation: spin 0.4s linear infinite;\n animation: spin 0.4s linear infinite; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .panel .panel-content {\n padding: 0 15px; }\n .panel .panel-content.is-text {\n padding: 25px; }\n .panel .panel-content.is-text p + p, .panel .panel-content.is-text p + h3 {\n margin-top: 25px; }\n .panel .panel-content.is-text h3 {\n margin-bottom: 15px;\n font-weight: 500; }\n .panel .panel-content.is-text ul li {\n color: #616161; }\n .panel .panel-content.is-text strong {\n font-weight: 500;\n color: #283593; }\n .panel .panel-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n height: 50px;\n background-color: #F4F5F9;\n padding: 0 15px;\n margin: 0 1px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n position: relative; }\n .panel .panel-footer .button + .button {\n margin-left: 10px; }\n .panel + .panel {\n margin-top: 25px; }\n\n.searchresults {\n position: fixed;\n top: 45px;\n left: 0;\n right: 0;\n margin: 0 auto;\n width: 500px;\n z-index: 1;\n background-color: #303f9f;\n border-bottom: 5px solid #283593;\n box-shadow: 0 0 5px #3f51b5;\n color: #FFF; }\n .searchresults.slideInDown {\n -webkit-animation-duration: 0.6s;\n -moz-animation-duration: 0.6s;\n -ms-animation-duration: 0.6s;\n -o-animation-duration: 0.6s;\n animation-duration: 0.6s; }\n .searchresults .searchresults-label {\n color: #9fa8da;\n padding: 15px 10px 10px;\n font-size: 13px;\n text-transform: uppercase;\n border-bottom: 1px dotted #5c6bc0; }\n .searchresults .searchresults-list > li {\n display: flex;\n font-size: 14px;\n transition: background-color .3s linear; }\n .searchresults .searchresults-list > li:nth-child(odd) {\n background-color: #3949ab; }\n .searchresults .searchresults-list > li.is-active, .searchresults .searchresults-list > li:hover {\n background-color: #5c6bc0;\n color: #FFF;\n border-left: 5px solid #9fa8da; }\n .searchresults .searchresults-list > li a {\n color: #e8eaf6;\n display: flex;\n align-items: center;\n height: 30px;\n padding: 0 20px;\n width: 100%;\n cursor: pointer; }\n\n.sidebar {\n background-color: #263238;\n color: #eceff1;\n width: 250px;\n max-width: 250px;\n min-height: 80vh; }\n .sidebar aside:last-child {\n padding-bottom: 20px; }\n .sidebar aside .sidebar-label {\n padding: 0 0 5px 0;\n color: #78909c;\n font-size: 13px;\n letter-spacing: 1px;\n text-transform: uppercase;\n border-bottom: 1px solid #455a64;\n margin: 25px 10px 15px 10px; }\n .sidebar aside .sidebar-label i {\n margin-right: 5px; }\n .sidebar aside .sidebar-menu li {\n display: block; }\n .sidebar aside .sidebar-menu li a {\n display: flex;\n min-height: 30px;\n align-items: center;\n padding: 5px 20px;\n color: #eceff1;\n font-size: 14px;\n transition: all .4s ease;\n line-height: 14px; }\n .sidebar aside .sidebar-menu li a i {\n margin-right: 7px;\n color: #90a4ae; }\n .sidebar aside .sidebar-menu li a:hover {\n color: #78909c;\n text-decoration: none; }\n .sidebar aside .sidebar-menu li > ul {\n border-top: 1px solid #2c3a41;\n border-bottom: 1px solid #2a373e;\n background-color: #222d32;\n margin-bottom: 10px;\n padding: 10px 0; }\n .sidebar aside .sidebar-menu li > ul li {\n padding-left: 10px; }\n .sidebar aside .sidebar-menu li > ul li a {\n min-height: 24px;\n color: #cfd8dc; }\n\n.table {\n border-spacing: collapse;\n padding: 1px;\n width: 100%;\n font-size: 14px; }\n .table thead {\n background-color: #607d8b;\n color: #FFF; }\n .table thead th {\n padding: 5px 10px;\n font-weight: 500;\n text-align: center;\n border-left: 1px solid #b0bec5; }\n .table thead th:first-child {\n border-left: none; }\n .table thead.is-red {\n background-color: #f44336; }\n .table thead.is-red th {\n border-left-color: #ef9a9a; }\n .table thead.is-pink {\n background-color: #e91e63; }\n .table thead.is-pink th {\n border-left-color: #f48fb1; }\n .table thead.is-purple {\n background-color: #9c27b0; }\n .table thead.is-purple th {\n border-left-color: #ce93d8; }\n .table thead.is-deep-purple {\n background-color: #673ab7; }\n .table thead.is-deep-purple th {\n border-left-color: #b39ddb; }\n .table thead.is-indigo {\n background-color: #3f51b5; }\n .table thead.is-indigo th {\n border-left-color: #9fa8da; }\n .table thead.is-blue {\n background-color: #2196f3; }\n .table thead.is-blue th {\n border-left-color: #90caf9; }\n .table thead.is-light-blue {\n background-color: #03a9f4; }\n .table thead.is-light-blue th {\n border-left-color: #81d4fa; }\n .table thead.is-cyan {\n background-color: #00bcd4; }\n .table thead.is-cyan th {\n border-left-color: #80deea; }\n .table thead.is-teal {\n background-color: #009688; }\n .table thead.is-teal th {\n border-left-color: #80cbc4; }\n .table thead.is-green {\n background-color: #4caf50; }\n .table thead.is-green th {\n border-left-color: #a5d6a7; }\n .table thead.is-light-green {\n background-color: #8bc34a; }\n .table thead.is-light-green th {\n border-left-color: #c5e1a5; }\n .table thead.is-lime {\n background-color: #cddc39; }\n .table thead.is-lime th {\n border-left-color: #e6ee9c; }\n .table thead.is-yellow {\n background-color: #ffeb3b; }\n .table thead.is-yellow th {\n border-left-color: #fff59d; }\n .table thead.is-amber {\n background-color: #ffc107; }\n .table thead.is-amber th {\n border-left-color: #ffe082; }\n .table thead.is-orange {\n background-color: #ff9800; }\n .table thead.is-orange th {\n border-left-color: #ffcc80; }\n .table thead.is-deep-orange {\n background-color: #ff5722; }\n .table thead.is-deep-orange th {\n border-left-color: #ffab91; }\n .table thead.is-brown {\n background-color: #795548; }\n .table thead.is-brown th {\n border-left-color: #bcaaa4; }\n .table thead.is-grey {\n background-color: #9e9e9e; }\n .table thead.is-grey th {\n border-left-color: #eeeeee; }\n .table thead.is-blue-grey {\n background-color: #607d8b; }\n .table thead.is-blue-grey th {\n border-left-color: #b0bec5; }\n .table tbody tr {\n background-color: #cfd8dc; }\n .table tbody tr:nth-child(odd) {\n background-color: #eceff1; }\n .table tbody tr td {\n padding: 5px 10px;\n border-left: 1px solid #FFF;\n vertical-align: middle; }\n .table tbody tr td:first-child {\n border-left: none; }\n .table .is-centered {\n text-align: center; }\n .table .has-icons i {\n margin-right: 8px; }\n .table .is-icon {\n font-size: 14px;\n width: 20px; }\n .table .has-action-icons i {\n cursor: pointer;\n font-size: 20px; }\n\n.table-actions {\n text-align: right; }\n .table-actions .button {\n border-top-left-radius: 0;\n border-top-right-radius: 0; }\n\nh1 {\n font-size: 28px; }\n\nh2 {\n font-size: 18px; }\n\nh3 {\n font-size: 16px; }\n\ni.is-red {\n color: #e53935; }\n\ni.is-pink {\n color: #d81b60; }\n\ni.is-purple {\n color: #8e24aa; }\n\ni.is-deep-purple {\n color: #5e35b1; }\n\ni.is-indigo {\n color: #3949ab; }\n\ni.is-blue {\n color: #1e88e5; }\n\ni.is-light-blue {\n color: #039be5; }\n\ni.is-cyan {\n color: #00acc1; }\n\ni.is-teal {\n color: #00897b; }\n\ni.is-green {\n color: #43a047; }\n\ni.is-light-green {\n color: #7cb342; }\n\ni.is-lime {\n color: #c0ca33; }\n\ni.is-yellow {\n color: #fdd835; }\n\ni.is-amber {\n color: #ffb300; }\n\ni.is-orange {\n color: #fb8c00; }\n\ni.is-deep-orange {\n color: #f4511e; }\n\ni.is-brown {\n color: #6d4c41; }\n\ni.is-grey {\n color: #757575; }\n\ni.is-blue-grey {\n color: #546e7a; }\n\n.twa {\n display: inline-block;\n height: 1em;\n width: 1em;\n margin: 0 .05em 0 .1em;\n vertical-align: -0.1em;\n background-repeat: no-repeat;\n background-position: center center;\n background-size: 1em 1em; }\n\n.twa-lg {\n height: 1.33em;\n width: 1.33em;\n margin: 0 0.0665em 0 0.133em;\n vertical-align: -0.133em;\n background-size: 1.33em 1.33em; }\n\n.twa-2x {\n height: 2em;\n width: 2em;\n margin: 0 0.1em 0 0.2em;\n vertical-align: -0.2em;\n background-size: 2em 2em; }\n\n.twa-3x {\n height: 3em;\n width: 3em;\n margin: 0 0.15em 0 0.3em;\n vertical-align: -0.3em;\n background-size: 3em 3em; }\n\n.twa-4x {\n height: 4em;\n width: 4em;\n margin: 0 0.2em 0 0.4em;\n vertical-align: -0.4em;\n background-size: 4em 4em; }\n\n.twa-5x {\n height: 5em;\n width: 5em;\n margin: 0 0.25em 0 0.5em;\n vertical-align: -0.5em;\n background-size: 5em 5em; }\n\n.twa-smile {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f604.svg\"); }\n\n.twa-laughing {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f606.svg\"); }\n\n.twa-blush {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f60a.svg\"); }\n\n.twa-smiley {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f603.svg\"); }\n\n.twa-relaxed {\n background-image: url(\"https://twemoji.maxcdn.com/svg/263a.svg\"); }\n\n.twa-smirk {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f60f.svg\"); }\n\n.twa-heart-eyes {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f60d.svg\"); }\n\n.twa-kissing-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f618.svg\"); }\n\n.twa-kissing-closed-eyes {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f61a.svg\"); }\n\n.twa-flushed {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f633.svg\"); }\n\n.twa-relieved {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f625.svg\"); }\n\n.twa-satisfied {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f60c.svg\"); }\n\n.twa-grin {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f601.svg\"); }\n\n.twa-wink {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f609.svg\"); }\n\n.twa-stuck-out-tongue-winking-eye {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f61c.svg\"); }\n\n.twa-stuck-out-tongue-closed-eyes {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f61d.svg\"); }\n\n.twa-grinning {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f600.svg\"); }\n\n.twa-kissing {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f617.svg\"); }\n\n.twa-kissing-smiling-eyes {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f619.svg\"); }\n\n.twa-stuck-out-tongue {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f61b.svg\"); }\n\n.twa-sleeping {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f634.svg\"); }\n\n.twa-worried {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f61f.svg\"); }\n\n.twa-frowning {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f626.svg\"); }\n\n.twa-anguished {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f627.svg\"); }\n\n.twa-open-mouth {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f62e.svg\"); }\n\n.twa-grimacing {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f62c.svg\"); }\n\n.twa-confused {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f615.svg\"); }\n\n.twa-hushed {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f62f.svg\"); }\n\n.twa-expressionless {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f611.svg\"); }\n\n.twa-unamused {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f612.svg\"); }\n\n.twa-sweat-smile {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f605.svg\"); }\n\n.twa-sweat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f613.svg\"); }\n\n.twa-weary {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f629.svg\"); }\n\n.twa-pensive {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f614.svg\"); }\n\n.twa-disappointed {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f61e.svg\"); }\n\n.twa-confounded {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f616.svg\"); }\n\n.twa-fearful {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f628.svg\"); }\n\n.twa-cold-sweat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f630.svg\"); }\n\n.twa-persevere {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f623.svg\"); }\n\n.twa-cry {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f622.svg\"); }\n\n.twa-sob {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f62d.svg\"); }\n\n.twa-joy {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f602.svg\"); }\n\n.twa-astonished {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f632.svg\"); }\n\n.twa-scream {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f631.svg\"); }\n\n.twa-tired-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f62b.svg\"); }\n\n.twa-angry {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f620.svg\"); }\n\n.twa-rage {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f621.svg\"); }\n\n.twa-triumph {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f624.svg\"); }\n\n.twa-sleepy {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f62a.svg\"); }\n\n.twa-yum {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f60b.svg\"); }\n\n.twa-mask {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f637.svg\"); }\n\n.twa-sunglasses {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f60e.svg\"); }\n\n.twa-dizzy-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f635.svg\"); }\n\n.twa-imp {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f47f.svg\"); }\n\n.twa-smiling-imp {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f608.svg\"); }\n\n.twa-neutral-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f610.svg\"); }\n\n.twa-no-mouth {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f636.svg\"); }\n\n.twa-innocent {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f607.svg\"); }\n\n.twa-alien {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f47d.svg\"); }\n\n.twa-yellow-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f49b.svg\"); }\n\n.twa-blue-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f499.svg\"); }\n\n.twa-purple-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f49c.svg\"); }\n\n.twa-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2764.svg\"); }\n\n.twa-green-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f49a.svg\"); }\n\n.twa-broken-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f494.svg\"); }\n\n.twa-heartbeat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f493.svg\"); }\n\n.twa-heartpulse {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f497.svg\"); }\n\n.twa-two-hearts {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f495.svg\"); }\n\n.twa-revolving-hearts {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f49e.svg\"); }\n\n.twa-cupid {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f498.svg\"); }\n\n.twa-sparkling-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f496.svg\"); }\n\n.twa-sparkles {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2728.svg\"); }\n\n.twa-star {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2b50.svg\"); }\n\n.twa-star2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f31f.svg\"); }\n\n.twa-dizzy {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ab.svg\"); }\n\n.twa-boom {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a5.svg\"); }\n\n.twa-anger {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a2.svg\"); }\n\n.twa-exclamation {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2757.svg\"); }\n\n.twa-question {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2753.svg\"); }\n\n.twa-grey-exclamation {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2755.svg\"); }\n\n.twa-grey-question {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2754.svg\"); }\n\n.twa-zzz {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a4.svg\"); }\n\n.twa-dash {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a8.svg\"); }\n\n.twa-sweat-drops {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a6.svg\"); }\n\n.twa-notes {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b6.svg\"); }\n\n.twa-musical-note {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b5.svg\"); }\n\n.twa-fire {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f525.svg\"); }\n\n.twa-poop {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a9.svg\"); }\n\n.twa-thumbsup {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f44d.svg\"); }\n\n.twa-thumbsdown {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f44e.svg\"); }\n\n.twa-ok-hand {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f44c.svg\"); }\n\n.twa-punch {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f44a.svg\"); }\n\n.twa-fist {\n background-image: url(\"https://twemoji.maxcdn.com/svg/270a.svg\"); }\n\n.twa-v {\n background-image: url(\"https://twemoji.maxcdn.com/svg/270c.svg\"); }\n\n.twa-wave {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f44b.svg\"); }\n\n.twa-hand {\n background-image: url(\"https://twemoji.maxcdn.com/svg/270b.svg\"); }\n\n.twa-open-hands {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f450.svg\"); }\n\n.twa-point-up {\n background-image: url(\"https://twemoji.maxcdn.com/svg/261d.svg\"); }\n\n.twa-point-down {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f447.svg\"); }\n\n.twa-point-left {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f448.svg\"); }\n\n.twa-point-right {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f449.svg\"); }\n\n.twa-raised-hands {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f64c.svg\"); }\n\n.twa-pray {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f64f.svg\"); }\n\n.twa-point-up-2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f446.svg\"); }\n\n.twa-clap {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f44f.svg\"); }\n\n.twa-muscle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4aa.svg\"); }\n\n.twa-walking {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b6.svg\"); }\n\n.twa-runner {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c3.svg\"); }\n\n.twa-couple {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f46b.svg\"); }\n\n.twa-family {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f46a.svg\"); }\n\n.twa-two-men-holding-hands {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f46c.svg\"); }\n\n.twa-two-women-holding-hands {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f46d.svg\"); }\n\n.twa-dancer {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f483.svg\"); }\n\n.twa-dancers {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f46f.svg\"); }\n\n.twa-ok-woman {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f646.svg\"); }\n\n.twa-no-good {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f645.svg\"); }\n\n.twa-information-desk-person {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f481.svg\"); }\n\n.twa-raised-hand {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f64b.svg\"); }\n\n.twa-bride-with-veil {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f470.svg\"); }\n\n.twa-person-with-pouting-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f64e.svg\"); }\n\n.twa-person-frowning {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f64d.svg\"); }\n\n.twa-bow {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f647.svg\"); }\n\n.twa-couplekiss {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f48f.svg\"); }\n\n.twa-couple-with-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f491.svg\"); }\n\n.twa-massage {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f486.svg\"); }\n\n.twa-haircut {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f487.svg\"); }\n\n.twa-nail-care {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f485.svg\"); }\n\n.twa-boy {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f466.svg\"); }\n\n.twa-girl {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f467.svg\"); }\n\n.twa-woman {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f469.svg\"); }\n\n.twa-man {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f468.svg\"); }\n\n.twa-baby {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f476.svg\"); }\n\n.twa-older-woman {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f475.svg\"); }\n\n.twa-older-man {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f474.svg\"); }\n\n.twa-person-with-blond-hair {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f471.svg\"); }\n\n.twa-man-with-gua-pi-mao {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f472.svg\"); }\n\n.twa-man-with-turban {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f473.svg\"); }\n\n.twa-construction-worker {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f477.svg\"); }\n\n.twa-cop {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f46e.svg\"); }\n\n.twa-angel {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f47c.svg\"); }\n\n.twa-princess {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f478.svg\"); }\n\n.twa-smiley-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f63a.svg\"); }\n\n.twa-smile-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f638.svg\"); }\n\n.twa-heart-eyes-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f63b.svg\"); }\n\n.twa-kissing-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f63d.svg\"); }\n\n.twa-smirk-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f63c.svg\"); }\n\n.twa-scream-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f640.svg\"); }\n\n.twa-crying-cat-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f63f.svg\"); }\n\n.twa-joy-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f639.svg\"); }\n\n.twa-pouting-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f63e.svg\"); }\n\n.twa-japanese-ogre {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f479.svg\"); }\n\n.twa-japanese-goblin {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f47a.svg\"); }\n\n.twa-see-no-evil {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f648.svg\"); }\n\n.twa-hear-no-evil {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f649.svg\"); }\n\n.twa-speak-no-evil {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f64a.svg\"); }\n\n.twa-guardsman {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f482.svg\"); }\n\n.twa-skull {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f480.svg\"); }\n\n.twa-feet {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f463.svg\"); }\n\n.twa-lips {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f444.svg\"); }\n\n.twa-kiss {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f48b.svg\"); }\n\n.twa-droplet {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a7.svg\"); }\n\n.twa-ear {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f442.svg\"); }\n\n.twa-eyes {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f440.svg\"); }\n\n.twa-nose {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f443.svg\"); }\n\n.twa-tongue {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f445.svg\"); }\n\n.twa-love-letter {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f48c.svg\"); }\n\n.twa-bust-in-silhouette {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f464.svg\"); }\n\n.twa-busts-in-silhouette {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f465.svg\"); }\n\n.twa-speech-balloon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ac.svg\"); }\n\n.twa-thought-balloon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ad.svg\"); }\n\n.twa-sunny {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2600.svg\"); }\n\n.twa-umbrella {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2614.svg\"); }\n\n.twa-cloud {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2601.svg\"); }\n\n.twa-snowflake {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2744.svg\"); }\n\n.twa-snowman {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26c4.svg\"); }\n\n.twa-zap {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26a1.svg\"); }\n\n.twa-cyclone {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f300.svg\"); }\n\n.twa-foggy {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f301.svg\"); }\n\n.twa-ocean {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f30a.svg\"); }\n\n.twa-cat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f431.svg\"); }\n\n.twa-dog {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f436.svg\"); }\n\n.twa-mouse {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f42d.svg\"); }\n\n.twa-hamster {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f439.svg\"); }\n\n.twa-rabbit {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f430.svg\"); }\n\n.twa-wolf {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f43a.svg\"); }\n\n.twa-frog {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f438.svg\"); }\n\n.twa-tiger {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f42f.svg\"); }\n\n.twa-koala {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f428.svg\"); }\n\n.twa-bear {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f43b.svg\"); }\n\n.twa-pig {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f437.svg\"); }\n\n.twa-pig-nose {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f43d.svg\"); }\n\n.twa-cow {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f42e.svg\"); }\n\n.twa-boar {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f417.svg\"); }\n\n.twa-monkey-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f435.svg\"); }\n\n.twa-monkey {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f412.svg\"); }\n\n.twa-horse {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f434.svg\"); }\n\n.twa-racehorse {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f40e.svg\"); }\n\n.twa-camel {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f42b.svg\"); }\n\n.twa-sheep {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f411.svg\"); }\n\n.twa-elephant {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f418.svg\"); }\n\n.twa-panda-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f43c.svg\"); }\n\n.twa-snake {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f40d.svg\"); }\n\n.twa-bird {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f426.svg\"); }\n\n.twa-baby-chick {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f424.svg\"); }\n\n.twa-hatched-chick {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f425.svg\"); }\n\n.twa-hatching-chick {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f423.svg\"); }\n\n.twa-chicken {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f414.svg\"); }\n\n.twa-penguin {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f427.svg\"); }\n\n.twa-turtle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f422.svg\"); }\n\n.twa-bug {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f41b.svg\"); }\n\n.twa-honeybee {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f41d.svg\"); }\n\n.twa-ant {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f41c.svg\"); }\n\n.twa-beetle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f41e.svg\"); }\n\n.twa-snail {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f40c.svg\"); }\n\n.twa-octopus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f419.svg\"); }\n\n.twa-tropical-fish {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f420.svg\"); }\n\n.twa-fish {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f41f.svg\"); }\n\n.twa-whale {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f433.svg\"); }\n\n.twa-whale2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f40b.svg\"); }\n\n.twa-dolphin {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f42c.svg\"); }\n\n.twa-cow2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f404.svg\"); }\n\n.twa-ram {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f40f.svg\"); }\n\n.twa-rat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f400.svg\"); }\n\n.twa-water-buffalo {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f403.svg\"); }\n\n.twa-tiger2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f405.svg\"); }\n\n.twa-rabbit2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f407.svg\"); }\n\n.twa-dragon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f409.svg\"); }\n\n.twa-goat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f410.svg\"); }\n\n.twa-rooster {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f413.svg\"); }\n\n.twa-dog2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f415.svg\"); }\n\n.twa-pig2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f416.svg\"); }\n\n.twa-mouse2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f401.svg\"); }\n\n.twa-ox {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f402.svg\"); }\n\n.twa-dragon-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f432.svg\"); }\n\n.twa-blowfish {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f421.svg\"); }\n\n.twa-crocodile {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f40a.svg\"); }\n\n.twa-dromedary-camel {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f42a.svg\"); }\n\n.twa-leopard {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f406.svg\"); }\n\n.twa-cat2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f408.svg\"); }\n\n.twa-poodle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f429.svg\"); }\n\n.twa-paw-prints {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f43e.svg\"); }\n\n.twa-bouquet {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f490.svg\"); }\n\n.twa-cherry-blossom {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f338.svg\"); }\n\n.twa-tulip {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f337.svg\"); }\n\n.twa-four-leaf-clover {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f340.svg\"); }\n\n.twa-rose {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f339.svg\"); }\n\n.twa-sunflower {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f33b.svg\"); }\n\n.twa-hibiscus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f33a.svg\"); }\n\n.twa-maple-leaf {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f341.svg\"); }\n\n.twa-leaves {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f343.svg\"); }\n\n.twa-fallen-leaf {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f342.svg\"); }\n\n.twa-herb {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f33f.svg\"); }\n\n.twa-mushroom {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f344.svg\"); }\n\n.twa-cactus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f335.svg\"); }\n\n.twa-palm-tree {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f334.svg\"); }\n\n.twa-evergreen-tree {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f332.svg\"); }\n\n.twa-deciduous-tree {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f333.svg\"); }\n\n.twa-chestnut {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f330.svg\"); }\n\n.twa-seedling {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f331.svg\"); }\n\n.twa-blossom {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f33c.svg\"); }\n\n.twa-ear-of-rice {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f33e.svg\"); }\n\n.twa-shell {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f41a.svg\"); }\n\n.twa-globe-with-meridians {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f310.svg\"); }\n\n.twa-sun-with-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f31e.svg\"); }\n\n.twa-full-moon-with-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f31d.svg\"); }\n\n.twa-new-moon-with-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f31a.svg\"); }\n\n.twa-new-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f311.svg\"); }\n\n.twa-waxing-crescent-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f312.svg\"); }\n\n.twa-first-quarter-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f313.svg\"); }\n\n.twa-waxing-gibbous-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f314.svg\"); }\n\n.twa-full-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f315.svg\"); }\n\n.twa-waning-gibbous-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f316.svg\"); }\n\n.twa-last-quarter-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f317.svg\"); }\n\n.twa-waning-crescent-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f318.svg\"); }\n\n.twa-last-quarter-moon-with-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f31c.svg\"); }\n\n.twa-first-quarter-moon-with-face {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f31b.svg\"); }\n\n.twa-moon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f319.svg\"); }\n\n.twa-earth-africa {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f30d.svg\"); }\n\n.twa-earth-americas {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f30e.svg\"); }\n\n.twa-earth-asia {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f30f.svg\"); }\n\n.twa-volcano {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f30b.svg\"); }\n\n.twa-milky-way {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f30c.svg\"); }\n\n.twa-partly-sunny {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26c5.svg\"); }\n\n.twa-bamboo {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f38d.svg\"); }\n\n.twa-gift-heart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f49d.svg\"); }\n\n.twa-dolls {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f38e.svg\"); }\n\n.twa-school-satchel {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f392.svg\"); }\n\n.twa-mortar-board {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f393.svg\"); }\n\n.twa-flags {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f38f.svg\"); }\n\n.twa-fireworks {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f386.svg\"); }\n\n.twa-sparkler {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f387.svg\"); }\n\n.twa-wind-chime {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f390.svg\"); }\n\n.twa-rice-scene {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f391.svg\"); }\n\n.twa-jack-o-lantern {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f383.svg\"); }\n\n.twa-ghost {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f47b.svg\"); }\n\n.twa-santa {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f385.svg\"); }\n\n.twa-8ball {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b1.svg\"); }\n\n.twa-alarm-clock {\n background-image: url(\"https://twemoji.maxcdn.com/svg/23f0.svg\"); }\n\n.twa-apple {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f34e.svg\"); }\n\n.twa-art {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a8.svg\"); }\n\n.twa-baby-bottle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f37c.svg\"); }\n\n.twa-balloon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f388.svg\"); }\n\n.twa-banana {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f34c.svg\"); }\n\n.twa-bar-chart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ca.svg\"); }\n\n.twa-baseball {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26be.svg\"); }\n\n.twa-basketball {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c0.svg\"); }\n\n.twa-bath {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6c0.svg\"); }\n\n.twa-bathtub {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6c1.svg\"); }\n\n.twa-battery {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f50b.svg\"); }\n\n.twa-beer {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f37a.svg\"); }\n\n.twa-beers {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f37b.svg\"); }\n\n.twa-bell {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f514.svg\"); }\n\n.twa-bento {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f371.svg\"); }\n\n.twa-bicyclist {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b4.svg\"); }\n\n.twa-bikini {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f459.svg\"); }\n\n.twa-birthday {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f382.svg\"); }\n\n.twa-black-joker {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f0cf.svg\"); }\n\n.twa-black-nib {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2712.svg\"); }\n\n.twa-blue-book {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d8.svg\"); }\n\n.twa-bomb {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a3.svg\"); }\n\n.twa-bookmark {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f516.svg\"); }\n\n.twa-bookmark-tabs {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d1.svg\"); }\n\n.twa-books {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4da.svg\"); }\n\n.twa-boot {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f462.svg\"); }\n\n.twa-bowling {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b3.svg\"); }\n\n.twa-bread {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f35e.svg\"); }\n\n.twa-briefcase {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4bc.svg\"); }\n\n.twa-bulb {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a1.svg\"); }\n\n.twa-cake {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f370.svg\"); }\n\n.twa-calendar {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c6.svg\"); }\n\n.twa-calling {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f2.svg\"); }\n\n.twa-camera {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f7.svg\"); }\n\n.twa-candy {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f36c.svg\"); }\n\n.twa-card-index {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c7.svg\"); }\n\n.twa-cd {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4bf.svg\"); }\n\n.twa-chart-with-downwards-trend {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c9.svg\"); }\n\n.twa-chart-with-upwards-trend {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c8.svg\"); }\n\n.twa-cherries {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f352.svg\"); }\n\n.twa-chocolate-bar {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f36b.svg\"); }\n\n.twa-christmas-tree {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f384.svg\"); }\n\n.twa-clapper {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ac.svg\"); }\n\n.twa-clipboard {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4cb.svg\"); }\n\n.twa-closed-book {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d5.svg\"); }\n\n.twa-closed-lock-with-key {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f510.svg\"); }\n\n.twa-closed-umbrella {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f302.svg\"); }\n\n.twa-clubs {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2663.svg\"); }\n\n.twa-cocktail {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f378.svg\"); }\n\n.twa-coffee {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2615.svg\"); }\n\n.twa-computer {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4bb.svg\"); }\n\n.twa-confetti-ball {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f38a.svg\"); }\n\n.twa-cookie {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f36a.svg\"); }\n\n.twa-corn {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f33d.svg\"); }\n\n.twa-credit-card {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b3.svg\"); }\n\n.twa-crown {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f451.svg\"); }\n\n.twa-crystal-ball {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f52e.svg\"); }\n\n.twa-curry {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f35b.svg\"); }\n\n.twa-custard {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f36e.svg\"); }\n\n.twa-dango {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f361.svg\"); }\n\n.twa-dart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3af.svg\"); }\n\n.twa-date {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c5.svg\"); }\n\n.twa-diamonds {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2666.svg\"); }\n\n.twa-dollar {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b5.svg\"); }\n\n.twa-door {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6aa.svg\"); }\n\n.twa-doughnut {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f369.svg\"); }\n\n.twa-dress {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f457.svg\"); }\n\n.twa-dvd {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c0.svg\"); }\n\n.twa-e-mail {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4e7.svg\"); }\n\n.twa-egg {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f373.svg\"); }\n\n.twa-eggplant {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f346.svg\"); }\n\n.twa-electric-plug {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f50c.svg\"); }\n\n.twa-email {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2709.svg\"); }\n\n.twa-euro {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b6.svg\"); }\n\n.twa-eyeglasses {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f453.svg\"); }\n\n.twa-fax {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4e0.svg\"); }\n\n.twa-file-folder {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c1.svg\"); }\n\n.twa-fish-cake {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f365.svg\"); }\n\n.twa-fishing-pole-and-fish {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a3.svg\"); }\n\n.twa-flashlight {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f526.svg\"); }\n\n.twa-floppy-disk {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4be.svg\"); }\n\n.twa-flower-playing-cards {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b4.svg\"); }\n\n.twa-football {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c8.svg\"); }\n\n.twa-fork-and-knife {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f374.svg\"); }\n\n.twa-fried-shrimp {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f364.svg\"); }\n\n.twa-fries {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f35f.svg\"); }\n\n.twa-game-die {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b2.svg\"); }\n\n.twa-gem {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f48e.svg\"); }\n\n.twa-gift {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f381.svg\"); }\n\n.twa-golf {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26f3.svg\"); }\n\n.twa-grapes {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f347.svg\"); }\n\n.twa-green-apple {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f34f.svg\"); }\n\n.twa-green-book {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d7.svg\"); }\n\n.twa-guitar {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b8.svg\"); }\n\n.twa-gun {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f52b.svg\"); }\n\n.twa-hamburger {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f354.svg\"); }\n\n.twa-hammer {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f528.svg\"); }\n\n.twa-handbag {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f45c.svg\"); }\n\n.twa-headphones {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a7.svg\"); }\n\n.twa-hearts {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2665.svg\"); }\n\n.twa-high-brightness {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f506.svg\"); }\n\n.twa-high-heel {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f460.svg\"); }\n\n.twa-hocho {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f52a.svg\"); }\n\n.twa-honey-pot {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f36f.svg\"); }\n\n.twa-horse-racing {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c7.svg\"); }\n\n.twa-hourglass {\n background-image: url(\"https://twemoji.maxcdn.com/svg/231b.svg\"); }\n\n.twa-hourglass-flowing-sand {\n background-image: url(\"https://twemoji.maxcdn.com/svg/23f3.svg\"); }\n\n.twa-ice-cream {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f368.svg\"); }\n\n.twa-icecream {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f366.svg\"); }\n\n.twa-inbox-tray {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4e5.svg\"); }\n\n.twa-incoming-envelope {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4e8.svg\"); }\n\n.twa-iphone {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f1.svg\"); }\n\n.twa-jeans {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f456.svg\"); }\n\n.twa-key {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f511.svg\"); }\n\n.twa-kimono {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f458.svg\"); }\n\n.twa-ledger {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d2.svg\"); }\n\n.twa-lemon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f34b.svg\"); }\n\n.twa-lipstick {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f484.svg\"); }\n\n.twa-lock {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f512.svg\"); }\n\n.twa-lock-with-ink-pen {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f50f.svg\"); }\n\n.twa-lollipop {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f36d.svg\"); }\n\n.twa-loop {\n background-image: url(\"https://twemoji.maxcdn.com/svg/27bf.svg\"); }\n\n.twa-loudspeaker {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4e2.svg\"); }\n\n.twa-low-brightness {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f505.svg\"); }\n\n.twa-mag {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f50d.svg\"); }\n\n.twa-mag-right {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f50e.svg\"); }\n\n.twa-mahjong {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f004.svg\"); }\n\n.twa-mailbox {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4eb.svg\"); }\n\n.twa-mailbox-closed {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ea.svg\"); }\n\n.twa-mailbox-with-mail {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ec.svg\"); }\n\n.twa-mailbox-with-no-mail {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ed.svg\"); }\n\n.twa-mans-shoe {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f45e.svg\"); }\n\n.twa-meat-on-bone {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f356.svg\"); }\n\n.twa-mega {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4e3.svg\"); }\n\n.twa-melon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f348.svg\"); }\n\n.twa-memo {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4dd.svg\"); }\n\n.twa-microphone {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a4.svg\"); }\n\n.twa-microscope {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f52c.svg\"); }\n\n.twa-minidisc {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4bd.svg\"); }\n\n.twa-money-with-wings {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b8.svg\"); }\n\n.twa-moneybag {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b0.svg\"); }\n\n.twa-mountain-bicyclist {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b5.svg\"); }\n\n.twa-movie-camera {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a5.svg\"); }\n\n.twa-musical-keyboard {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b9.svg\"); }\n\n.twa-musical-score {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3bc.svg\"); }\n\n.twa-mute {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f507.svg\"); }\n\n.twa-name-badge {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4db.svg\"); }\n\n.twa-necktie {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f454.svg\"); }\n\n.twa-newspaper {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f0.svg\"); }\n\n.twa-no-bell {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f515.svg\"); }\n\n.twa-notebook {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d3.svg\"); }\n\n.twa-notebook-with-decorative-cover {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d4.svg\"); }\n\n.twa-nut-and-bolt {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f529.svg\"); }\n\n.twa-oden {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f362.svg\"); }\n\n.twa-open-file-folder {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c2.svg\"); }\n\n.twa-orange-book {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d9.svg\"); }\n\n.twa-outbox-tray {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4e4.svg\"); }\n\n.twa-page-facing-up {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c4.svg\"); }\n\n.twa-page-with-curl {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4c3.svg\"); }\n\n.twa-pager {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4df.svg\"); }\n\n.twa-paperclip {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ce.svg\"); }\n\n.twa-peach {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f351.svg\"); }\n\n.twa-pear {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f350.svg\"); }\n\n.twa-pencil2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/270f.svg\"); }\n\n.twa-phone {\n background-image: url(\"https://twemoji.maxcdn.com/svg/260e.svg\"); }\n\n.twa-pill {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f48a.svg\"); }\n\n.twa-pineapple {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f34d.svg\"); }\n\n.twa-pizza {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f355.svg\"); }\n\n.twa-postal-horn {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ef.svg\"); }\n\n.twa-postbox {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ee.svg\"); }\n\n.twa-pouch {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f45d.svg\"); }\n\n.twa-poultry-leg {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f357.svg\"); }\n\n.twa-pound {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b7.svg\"); }\n\n.twa-purse {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f45b.svg\"); }\n\n.twa-pushpin {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4cc.svg\"); }\n\n.twa-radio {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4fb.svg\"); }\n\n.twa-ramen {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f35c.svg\"); }\n\n.twa-ribbon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f380.svg\"); }\n\n.twa-rice {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f35a.svg\"); }\n\n.twa-rice-ball {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f359.svg\"); }\n\n.twa-rice-cracker {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f358.svg\"); }\n\n.twa-ring {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f48d.svg\"); }\n\n.twa-rugby-football {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c9.svg\"); }\n\n.twa-running-shirt-with-sash {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3bd.svg\"); }\n\n.twa-sake {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f376.svg\"); }\n\n.twa-sandal {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f461.svg\"); }\n\n.twa-satellite {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4e1.svg\"); }\n\n.twa-saxophone {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b7.svg\"); }\n\n.twa-scissors {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2702.svg\"); }\n\n.twa-scroll {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4dc.svg\"); }\n\n.twa-seat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ba.svg\"); }\n\n.twa-shaved-ice {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f367.svg\"); }\n\n.twa-shirt {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f455.svg\"); }\n\n.twa-shower {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6bf.svg\"); }\n\n.twa-ski {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3bf.svg\"); }\n\n.twa-smoking {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6ac.svg\"); }\n\n.twa-snowboarder {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c2.svg\"); }\n\n.twa-soccer {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26bd.svg\"); }\n\n.twa-sound {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f509.svg\"); }\n\n.twa-space-invader {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f47e.svg\"); }\n\n.twa-spades {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2660.svg\"); }\n\n.twa-spaghetti {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f35d.svg\"); }\n\n.twa-speaker {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f50a.svg\"); }\n\n.twa-stew {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f372.svg\"); }\n\n.twa-straight-ruler {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4cf.svg\"); }\n\n.twa-strawberry {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f353.svg\"); }\n\n.twa-surfer {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c4.svg\"); }\n\n.twa-sushi {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f363.svg\"); }\n\n.twa-sweet-potato {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f360.svg\"); }\n\n.twa-swimmer {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ca.svg\"); }\n\n.twa-syringe {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f489.svg\"); }\n\n.twa-tada {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f389.svg\"); }\n\n.twa-tanabata-tree {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f38b.svg\"); }\n\n.twa-tangerine {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f34a.svg\"); }\n\n.twa-tea {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f375.svg\"); }\n\n.twa-telephone-receiver {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4de.svg\"); }\n\n.twa-telescope {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f52d.svg\"); }\n\n.twa-tennis {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3be.svg\"); }\n\n.twa-toilet {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6bd.svg\"); }\n\n.twa-tomato {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f345.svg\"); }\n\n.twa-tophat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a9.svg\"); }\n\n.twa-triangular-ruler {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4d0.svg\"); }\n\n.twa-trophy {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c6.svg\"); }\n\n.twa-tropical-drink {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f379.svg\"); }\n\n.twa-trumpet {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ba.svg\"); }\n\n.twa-tv {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4fa.svg\"); }\n\n.twa-unlock {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f513.svg\"); }\n\n.twa-vhs {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4fc.svg\"); }\n\n.twa-video-camera {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f9.svg\"); }\n\n.twa-video-game {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ae.svg\"); }\n\n.twa-violin {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3bb.svg\"); }\n\n.twa-watch {\n background-image: url(\"https://twemoji.maxcdn.com/svg/231a.svg\"); }\n\n.twa-watermelon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f349.svg\"); }\n\n.twa-wine-glass {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f377.svg\"); }\n\n.twa-womans-clothes {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f45a.svg\"); }\n\n.twa-womans-hat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f452.svg\"); }\n\n.twa-wrench {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f527.svg\"); }\n\n.twa-yen {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b4.svg\"); }\n\n.twa-aerial-tramway {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a1.svg\"); }\n\n.twa-airplane {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2708.svg\"); }\n\n.twa-ambulance {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f691.svg\"); }\n\n.twa-anchor {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2693.svg\"); }\n\n.twa-articulated-lorry {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f69b.svg\"); }\n\n.twa-atm {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e7.svg\"); }\n\n.twa-bank {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e6.svg\"); }\n\n.twa-barber {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f488.svg\"); }\n\n.twa-beginner {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f530.svg\"); }\n\n.twa-bike {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b2.svg\"); }\n\n.twa-blue-car {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f699.svg\"); }\n\n.twa-boat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26f5.svg\"); }\n\n.twa-bridge-at-night {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f309.svg\"); }\n\n.twa-bullettrain-front {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f685.svg\"); }\n\n.twa-bullettrain-side {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f684.svg\"); }\n\n.twa-bus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f68c.svg\"); }\n\n.twa-busstop {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f68f.svg\"); }\n\n.twa-car {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f697.svg\"); }\n\n.twa-carousel-horse {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a0.svg\"); }\n\n.twa-checkered-flag {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3c1.svg\"); }\n\n.twa-church {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26ea.svg\"); }\n\n.twa-circus-tent {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3aa.svg\"); }\n\n.twa-city-sunrise {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f307.svg\"); }\n\n.twa-city-sunset {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f306.svg\"); }\n\n.twa-construction {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a7.svg\"); }\n\n.twa-convenience-store {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ea.svg\"); }\n\n.twa-crossed-flags {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f38c.svg\"); }\n\n.twa-department-store {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ec.svg\"); }\n\n.twa-european-castle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3f0.svg\"); }\n\n.twa-european-post-office {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e4.svg\"); }\n\n.twa-factory {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ed.svg\"); }\n\n.twa-ferris-wheel {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a1.svg\"); }\n\n.twa-fire-engine {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f692.svg\"); }\n\n.twa-fountain {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26f2.svg\"); }\n\n.twa-fuelpump {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26fd.svg\"); }\n\n.twa-helicopter {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f681.svg\"); }\n\n.twa-hospital {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e5.svg\"); }\n\n.twa-hotel {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e8.svg\"); }\n\n.twa-hotsprings {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2668.svg\"); }\n\n.twa-house {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e0.svg\"); }\n\n.twa-house-with-garden {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e1.svg\"); }\n\n.twa-japan {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f5fe.svg\"); }\n\n.twa-japanese-castle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ef.svg\"); }\n\n.twa-light-rail {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f688.svg\"); }\n\n.twa-love-hotel {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e9.svg\"); }\n\n.twa-minibus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f690.svg\"); }\n\n.twa-monorail {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f69d.svg\"); }\n\n.twa-mount-fuji {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f5fb.svg\"); }\n\n.twa-mountain-cableway {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a0.svg\"); }\n\n.twa-mountain-railway {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f69e.svg\"); }\n\n.twa-moyai {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f5ff.svg\"); }\n\n.twa-office {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e2.svg\"); }\n\n.twa-oncoming-automobile {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f698.svg\"); }\n\n.twa-oncoming-bus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f68d.svg\"); }\n\n.twa-oncoming-police-car {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f694.svg\"); }\n\n.twa-oncoming-taxi {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f696.svg\"); }\n\n.twa-performing-arts {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ad.svg\"); }\n\n.twa-police-car {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f693.svg\"); }\n\n.twa-post-office {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3e3.svg\"); }\n\n.twa-railway-car {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f683.svg\"); }\n\n.twa-rainbow {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f308.svg\"); }\n\n.twa-rocket {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f680.svg\"); }\n\n.twa-roller-coaster {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a2.svg\"); }\n\n.twa-rotating-light {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a8.svg\"); }\n\n.twa-round-pushpin {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4cd.svg\"); }\n\n.twa-rowboat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a3.svg\"); }\n\n.twa-school {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3eb.svg\"); }\n\n.twa-ship {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a2.svg\"); }\n\n.twa-slot-machine {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3b0.svg\"); }\n\n.twa-speedboat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a4.svg\"); }\n\n.twa-stars {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f303.svg\"); }\n\n.twa-station {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f689.svg\"); }\n\n.twa-statue-of-liberty {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f5fd.svg\"); }\n\n.twa-steam-locomotive {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f682.svg\"); }\n\n.twa-sunrise {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f305.svg\"); }\n\n.twa-sunrise-over-mountains {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f304.svg\"); }\n\n.twa-suspension-railway {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f69f.svg\"); }\n\n.twa-taxi {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f695.svg\"); }\n\n.twa-tent {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26fa.svg\"); }\n\n.twa-ticket {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3ab.svg\"); }\n\n.twa-tokyo-tower {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f5fc.svg\"); }\n\n.twa-tractor {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f69c.svg\"); }\n\n.twa-traffic-light {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a5.svg\"); }\n\n.twa-train2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f686.svg\"); }\n\n.twa-tram {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f68a.svg\"); }\n\n.twa-triangular-flag-on-post {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a9.svg\"); }\n\n.twa-trolleybus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f68e.svg\"); }\n\n.twa-truck {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f69a.svg\"); }\n\n.twa-vertical-traffic-light {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6a6.svg\"); }\n\n.twa-warning {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26a0.svg\"); }\n\n.twa-wedding {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f492.svg\"); }\n\n.twa-jp {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1ef-1f1f5.svg\"); }\n\n.twa-kr {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1f0-1f1f7.svg\"); }\n\n.twa-cn {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1e8-1f1f3.svg\"); }\n\n.twa-us {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1fa-1f1f8.svg\"); }\n\n.twa-fr {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1eb-1f1f7.svg\"); }\n\n.twa-es {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1ea-1f1f8.svg\"); }\n\n.twa-it {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1ee-1f1f9.svg\"); }\n\n.twa-ru {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1f7-1f1fa.svg\"); }\n\n.twa-gb {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1ec-1f1e7.svg\"); }\n\n.twa-de {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f1e9-1f1ea.svg\"); }\n\n.twa-100 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4af.svg\"); }\n\n.twa-1234 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f522.svg\"); }\n\n.twa-a {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f170.svg\"); }\n\n.twa-ab {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f18e.svg\"); }\n\n.twa-abc {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f524.svg\"); }\n\n.twa-abcd {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f521.svg\"); }\n\n.twa-accept {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f251.svg\"); }\n\n.twa-aquarius {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2652.svg\"); }\n\n.twa-aries {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2648.svg\"); }\n\n.twa-arrow-backward {\n background-image: url(\"https://twemoji.maxcdn.com/svg/25c0.svg\"); }\n\n.twa-arrow-double-down {\n background-image: url(\"https://twemoji.maxcdn.com/svg/23ec.svg\"); }\n\n.twa-arrow-double-up {\n background-image: url(\"https://twemoji.maxcdn.com/svg/23eb.svg\"); }\n\n.twa-arrow-down {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2b07.svg\"); }\n\n.twa-arrow-down-small {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f53d.svg\"); }\n\n.twa-arrow-forward {\n background-image: url(\"https://twemoji.maxcdn.com/svg/25b6.svg\"); }\n\n.twa-arrow-heading-down {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2935.svg\"); }\n\n.twa-arrow-heading-up {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2934.svg\"); }\n\n.twa-arrow-left {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2b05.svg\"); }\n\n.twa-arrow-lower-left {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2199.svg\"); }\n\n.twa-arrow-lower-right {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2198.svg\"); }\n\n.twa-arrow-right {\n background-image: url(\"https://twemoji.maxcdn.com/svg/27a1.svg\"); }\n\n.twa-arrow-right-hook {\n background-image: url(\"https://twemoji.maxcdn.com/svg/21aa.svg\"); }\n\n.twa-arrow-up {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2b06.svg\"); }\n\n.twa-arrow-up-down {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2195.svg\"); }\n\n.twa-arrow-up-small {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f53c.svg\"); }\n\n.twa-arrow-upper-left {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2196.svg\"); }\n\n.twa-arrow-upper-right {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2197.svg\"); }\n\n.twa-arrows-clockwise {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f503.svg\"); }\n\n.twa-arrows-counterclockwise {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f504.svg\"); }\n\n.twa-b {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f171.svg\"); }\n\n.twa-baby-symbol {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6bc.svg\"); }\n\n.twa-baggage-claim {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6c4.svg\"); }\n\n.twa-ballot-box-with-check {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2611.svg\"); }\n\n.twa-bangbang {\n background-image: url(\"https://twemoji.maxcdn.com/svg/203c.svg\"); }\n\n.twa-black-circle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26ab.svg\"); }\n\n.twa-black-square-button {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f532.svg\"); }\n\n.twa-cancer {\n background-image: url(\"https://twemoji.maxcdn.com/svg/264b.svg\"); }\n\n.twa-capital-abcd {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f520.svg\"); }\n\n.twa-capricorn {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2651.svg\"); }\n\n.twa-chart {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b9.svg\"); }\n\n.twa-children-crossing {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b8.svg\"); }\n\n.twa-cinema {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f3a6.svg\"); }\n\n.twa-cl {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f191.svg\"); }\n\n.twa-clock1 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f550.svg\"); }\n\n.twa-clock10 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f559.svg\"); }\n\n.twa-clock1030 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f565.svg\"); }\n\n.twa-clock11 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f55a.svg\"); }\n\n.twa-clock1130 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f566.svg\"); }\n\n.twa-clock12 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f55b.svg\"); }\n\n.twa-clock1230 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f567.svg\"); }\n\n.twa-clock130 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f55c.svg\"); }\n\n.twa-clock2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f551.svg\"); }\n\n.twa-clock230 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f55d.svg\"); }\n\n.twa-clock3 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f552.svg\"); }\n\n.twa-clock330 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f55e.svg\"); }\n\n.twa-clock4 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f553.svg\"); }\n\n.twa-clock430 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f55f.svg\"); }\n\n.twa-clock5 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f554.svg\"); }\n\n.twa-clock530 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f560.svg\"); }\n\n.twa-clock6 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f555.svg\"); }\n\n.twa-clock630 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f561.svg\"); }\n\n.twa-clock7 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f556.svg\"); }\n\n.twa-clock730 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f562.svg\"); }\n\n.twa-clock8 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f557.svg\"); }\n\n.twa-clock830 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f563.svg\"); }\n\n.twa-clock9 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f558.svg\"); }\n\n.twa-clock930 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f564.svg\"); }\n\n.twa-congratulations {\n background-image: url(\"https://twemoji.maxcdn.com/svg/3297.svg\"); }\n\n.twa-cool {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f192.svg\"); }\n\n.twa-copyright {\n background-image: url(\"https://twemoji.maxcdn.com/svg/a9.svg\"); }\n\n.twa-curly-loop {\n background-image: url(\"https://twemoji.maxcdn.com/svg/27b0.svg\"); }\n\n.twa-currency-exchange {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b1.svg\"); }\n\n.twa-customs {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6c3.svg\"); }\n\n.twa-diamond-shape-with-a-dot-inside {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4a0.svg\"); }\n\n.twa-do-not-litter {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6af.svg\"); }\n\n.twa-eight {\n background-image: url(\"https://twemoji.maxcdn.com/svg/38-20e3.svg\"); }\n\n.twa-eight-pointed-black-star {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2734.svg\"); }\n\n.twa-eight-spoked-asterisk {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2733.svg\"); }\n\n.twa-end {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f51a.svg\"); }\n\n.twa-fast-forward {\n background-image: url(\"https://twemoji.maxcdn.com/svg/23e9.svg\"); }\n\n.twa-five {\n background-image: url(\"https://twemoji.maxcdn.com/svg/35-20e3.svg\"); }\n\n.twa-four {\n background-image: url(\"https://twemoji.maxcdn.com/svg/34-20e3.svg\"); }\n\n.twa-free {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f193.svg\"); }\n\n.twa-gemini {\n background-image: url(\"https://twemoji.maxcdn.com/svg/264a.svg\"); }\n\n.twa-hash {\n background-image: url(\"https://twemoji.maxcdn.com/svg/23-20e3.svg\"); }\n\n.twa-heart-decoration {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f49f.svg\"); }\n\n.twa-heavy-check-mark {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2714.svg\"); }\n\n.twa-heavy-division-sign {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2797.svg\"); }\n\n.twa-heavy-dollar-sign {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4b2.svg\"); }\n\n.twa-heavy-minus-sign {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2796.svg\"); }\n\n.twa-heavy-multiplication-x {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2716.svg\"); }\n\n.twa-heavy-plus-sign {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2795.svg\"); }\n\n.twa-id {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f194.svg\"); }\n\n.twa-ideograph-advantage {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f250.svg\"); }\n\n.twa-information-source {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2139.svg\"); }\n\n.twa-interrobang {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2049.svg\"); }\n\n.twa-keycap-ten {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f51f.svg\"); }\n\n.twa-koko {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f201.svg\"); }\n\n.twa-large-blue-circle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f535.svg\"); }\n\n.twa-large-blue-diamond {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f537.svg\"); }\n\n.twa-large-orange-diamond {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f536.svg\"); }\n\n.twa-left-luggage {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6c5.svg\"); }\n\n.twa-left-right-arrow {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2194.svg\"); }\n\n.twa-leftwards-arrow-with-hook {\n background-image: url(\"https://twemoji.maxcdn.com/svg/21a9.svg\"); }\n\n.twa-leo {\n background-image: url(\"https://twemoji.maxcdn.com/svg/264c.svg\"); }\n\n.twa-libra {\n background-image: url(\"https://twemoji.maxcdn.com/svg/264e.svg\"); }\n\n.twa-link {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f517.svg\"); }\n\n.twa-m {\n background-image: url(\"https://twemoji.maxcdn.com/svg/24c2.svg\"); }\n\n.twa-mens {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b9.svg\"); }\n\n.twa-metro {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f687.svg\"); }\n\n.twa-mobile-phone-off {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f4.svg\"); }\n\n.twa-negative-squared-cross-mark {\n background-image: url(\"https://twemoji.maxcdn.com/svg/274e.svg\"); }\n\n.twa-new {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f195.svg\"); }\n\n.twa-ng {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f196.svg\"); }\n\n.twa-nine {\n background-image: url(\"https://twemoji.maxcdn.com/svg/39-20e3.svg\"); }\n\n.twa-no-bicycles {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b3.svg\"); }\n\n.twa-no-entry {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26d4.svg\"); }\n\n.twa-no-entry-sign {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6ab.svg\"); }\n\n.twa-no-mobile-phones {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f5.svg\"); }\n\n.twa-no-pedestrians {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b7.svg\"); }\n\n.twa-no-smoking {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6ad.svg\"); }\n\n.twa-non-potable-water {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b1.svg\"); }\n\n.twa-o {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2b55.svg\"); }\n\n.twa-o2 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f17e.svg\"); }\n\n.twa-ok {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f197.svg\"); }\n\n.twa-on {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f51b.svg\"); }\n\n.twa-one {\n background-image: url(\"https://twemoji.maxcdn.com/svg/31-20e3.svg\"); }\n\n.twa-ophiuchus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26ce.svg\"); }\n\n.twa-parking {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f17f.svg\"); }\n\n.twa-part-alternation-mark {\n background-image: url(\"https://twemoji.maxcdn.com/svg/303d.svg\"); }\n\n.twa-passport-control {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6c2.svg\"); }\n\n.twa-pisces {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2653.svg\"); }\n\n.twa-potable-water {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6b0.svg\"); }\n\n.twa-put-litter-in-its-place {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6ae.svg\"); }\n\n.twa-radio-button {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f518.svg\"); }\n\n.twa-recycle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/267b.svg\"); }\n\n.twa-red-circle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f534.svg\"); }\n\n.twa-registered {\n background-image: url(\"https://twemoji.maxcdn.com/svg/ae.svg\"); }\n\n.twa-repeat {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f501.svg\"); }\n\n.twa-repeat-one {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f502.svg\"); }\n\n.twa-restroom {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6bb.svg\"); }\n\n.twa-rewind {\n background-image: url(\"https://twemoji.maxcdn.com/svg/23ea.svg\"); }\n\n.twa-sa {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f202.svg\"); }\n\n.twa-sagittarius {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2650.svg\"); }\n\n.twa-scorpius {\n background-image: url(\"https://twemoji.maxcdn.com/svg/264f.svg\"); }\n\n.twa-secret {\n background-image: url(\"https://twemoji.maxcdn.com/svg/3299.svg\"); }\n\n.twa-seven {\n background-image: url(\"https://twemoji.maxcdn.com/svg/37-20e3.svg\"); }\n\n.twa-signal-strength {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f6.svg\"); }\n\n.twa-six {\n background-image: url(\"https://twemoji.maxcdn.com/svg/36-20e3.svg\"); }\n\n.twa-six-pointed-star {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f52f.svg\"); }\n\n.twa-small-blue-diamond {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f539.svg\"); }\n\n.twa-small-orange-diamond {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f538.svg\"); }\n\n.twa-small-red-triangle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f53a.svg\"); }\n\n.twa-small-red-triangle-down {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f53b.svg\"); }\n\n.twa-soon {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f51c.svg\"); }\n\n.twa-sos {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f198.svg\"); }\n\n.twa-symbols {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f523.svg\"); }\n\n.twa-taurus {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2649.svg\"); }\n\n.twa-three {\n background-image: url(\"https://twemoji.maxcdn.com/svg/33-20e3.svg\"); }\n\n.twa-tm {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2122.svg\"); }\n\n.twa-top {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f51d.svg\"); }\n\n.twa-trident {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f531.svg\"); }\n\n.twa-twisted-rightwards-arrows {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f500.svg\"); }\n\n.twa-two {\n background-image: url(\"https://twemoji.maxcdn.com/svg/32-20e3.svg\"); }\n\n.twa-u5272 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f239.svg\"); }\n\n.twa-u5408 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f234.svg\"); }\n\n.twa-u55b6 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f23a.svg\"); }\n\n.twa-u6307 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f22f.svg\"); }\n\n.twa-u6708 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f237.svg\"); }\n\n.twa-u6709 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f236.svg\"); }\n\n.twa-u6e80 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f235.svg\"); }\n\n.twa-u7121 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f21a.svg\"); }\n\n.twa-u7533 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f238.svg\"); }\n\n.twa-u7981 {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f232.svg\"); }\n\n.twa-u7a7a {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f233.svg\"); }\n\n.twa-underage {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f51e.svg\"); }\n\n.twa-up {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f199.svg\"); }\n\n.twa-vibration-mode {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4f3.svg\"); }\n\n.twa-virgo {\n background-image: url(\"https://twemoji.maxcdn.com/svg/264d.svg\"); }\n\n.twa-vs {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f19a.svg\"); }\n\n.twa-wavy-dash {\n background-image: url(\"https://twemoji.maxcdn.com/svg/3030.svg\"); }\n\n.twa-wc {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6be.svg\"); }\n\n.twa-wheelchair {\n background-image: url(\"https://twemoji.maxcdn.com/svg/267f.svg\"); }\n\n.twa-white-check-mark {\n background-image: url(\"https://twemoji.maxcdn.com/svg/2705.svg\"); }\n\n.twa-white-circle {\n background-image: url(\"https://twemoji.maxcdn.com/svg/26aa.svg\"); }\n\n.twa-white-flower {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f4ae.svg\"); }\n\n.twa-white-square-button {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f533.svg\"); }\n\n.twa-womens {\n background-image: url(\"https://twemoji.maxcdn.com/svg/1f6ba.svg\"); }\n\n.twa-x {\n background-image: url(\"https://twemoji.maxcdn.com/svg/274c.svg\"); }\n\n.twa-zero {\n background-image: url(\"https://twemoji.maxcdn.com/svg/30-20e3.svg\"); }\n\n/*!\r\n * jQuery contextMenu - Plugin for simple contextMenu handling\r\n *\r\n * Version: v2.2.5-dev\r\n *\r\n * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)\r\n * Web: http://swisnl.github.io/jQuery-contextMenu/\r\n *\r\n * Copyright (c) 2011-2016 SWIS BV and contributors\r\n *\r\n * Licensed under\r\n * MIT License http://www.opensource.org/licenses/mit-license\r\n *\r\n * Date: 2016-08-27T11:09:08.919Z\r\n */\n.context-menu-icon {\n display: list-item;\n font-family: inherit; }\n\n.context-menu-icon::before {\n position: absolute;\n top: 50%;\n left: 0;\n width: 2em;\n font-family: FontAwesome;\n font-size: 14px;\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n color: #2196f3;\n text-align: center;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n -o-transform: translateY(-50%);\n transform: translateY(-50%);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale; }\n\n.context-menu-icon.context-menu-hover:before {\n color: #fff; }\n\n.context-menu-icon.context-menu-disabled::before {\n color: #bbb; }\n\n.context-menu-list {\n position: absolute;\n display: inline-block;\n min-width: 13em;\n max-width: 26em;\n padding: 0 0;\n margin: .3em;\n font-family: inherit;\n font-size: 14px;\n list-style-type: none;\n background: #fff;\n border: 1px solid #2196f3;\n border-radius: .2em;\n -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25); }\n\n.context-menu-item {\n position: relative;\n padding: 7px 2em;\n color: #69707a;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-color: #fff;\n font-size: 14px;\n text-align: left; }\n\n.context-menu-separator {\n padding: 0;\n margin: .35em 0;\n border-bottom: 1px solid #e6e6e6; }\n\n.context-menu-item.context-menu-hover {\n color: #fff;\n cursor: pointer;\n background-color: #2196f3; }\n\n.context-menu-item.context-menu-disabled {\n color: #bbb;\n cursor: default;\n background-color: #fff; }\n\n.context-menu-input.context-menu-hover {\n cursor: default; }\n\n.context-menu-submenu:after {\n position: absolute;\n top: 50%;\n right: .5em;\n z-index: 1;\n width: 0;\n height: 0;\n content: '';\n border-color: transparent transparent transparent #2f2f2f;\n border-style: solid;\n border-width: .25em 0 .25em .25em;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n -o-transform: translateY(-50%);\n transform: translateY(-50%); }\n\n.context-menu-item > .context-menu-list {\n top: .3em;\n /* re-positioned by js */\n right: -.3em;\n display: none; }\n\n.context-menu-item.context-menu-visible > .context-menu-list {\n display: block; }\n\n.context-menu-accesskey {\n text-decoration: underline; }\n\n.editor-toolbar {\n z-index: 2;\n background-color: #1a237e;\n border: none;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n opacity: 1;\n position: fixed;\n top: 50px;\n left: 0;\n width: 100%; }\n .editor-toolbar:hover {\n opacity: 1; }\n .editor-toolbar a {\n color: #FFF !important;\n border: none;\n transition: background-color 0.4s ease; }\n .editor-toolbar a.active, .editor-toolbar a:hover, .editor-toolbar a:focus {\n background-color: rgba(0, 0, 0, 0.5);\n outline: none; }\n .editor-toolbar i.separator {\n margin-top: 5px;\n border-left-color: #000;\n border-right-color: #AAA; }\n\n.editor-modal-load {\n display: flex;\n align-items: center;\n opacity: 0;\n transition: opacity .5s ease; }\n .editor-modal-load span {\n font-size: 12px;\n color: #2196f3; }\n .editor-modal-load i {\n margin-left: 10px;\n width: 32px;\n height: 32px;\n display: flex;\n justify-content: center;\n align-items: center; }\n .editor-modal-load i::before {\n content: \" \";\n width: 24px;\n height: 24px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #2196f3;\n -webkit-animation: spin 0.5s linear infinite;\n -moz-animation: spin 0.5s linear infinite;\n -ms-animation: spin 0.5s linear infinite;\n -o-animation: spin 0.5s linear infinite;\n animation: spin 0.5s linear infinite; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n .editor-modal-load.is-active {\n opacity: 1; }\n\n#btn-editor-image-upload, #btn-editor-file-upload {\n position: relative;\n overflow: hidden; }\n #btn-editor-image-upload > label, #btn-editor-file-upload > label {\n display: block;\n opacity: 0;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n cursor: pointer; }\n #btn-editor-image-upload > label input[type=file], #btn-editor-file-upload > label input[type=file] {\n opacity: 0;\n position: absolute;\n top: -9999px;\n left: -9999px; }\n\n.editor-modal-image-choices {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n overflow: auto;\n overflow-x: hidden; }\n .editor-modal-image-choices > em {\n display: flex;\n align-items: center;\n padding: 25px;\n color: #9e9e9e; }\n .editor-modal-image-choices > em > i {\n font-size: 32px;\n margin-right: 10px;\n color: #e0e0e0; }\n .editor-modal-image-choices > figure {\n display: flex;\n flex-direction: column;\n background-color: #FAFAFA;\n border-radius: 5px;\n padding: 5px;\n width: 160px;\n min-height: 205px;\n margin: 0 5px 10px 5px;\n cursor: pointer;\n justify-content: center;\n align-items: center;\n transition: background-color 0.4s ease; }\n .editor-modal-image-choices > figure > img {\n border: 1px solid #DDD;\n border-radius: 5px;\n padding: 2px;\n background-color: #FFF;\n margin: 0 0 5px 0; }\n .editor-modal-image-choices > figure > span {\n font-size: 12px; }\n .editor-modal-image-choices > figure > span > strong {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: block;\n width: 150px;\n text-align: center; }\n .editor-modal-image-choices > figure:hover {\n background-color: #DDD; }\n .editor-modal-image-choices > figure.is-active {\n background-color: #4caf50;\n color: #FFF; }\n .editor-modal-image-choices > figure.is-active > img {\n border-color: #3d8b40; }\n .editor-modal-image-choices > figure.is-active > span > strong {\n color: #FFF; }\n .editor-modal-image-choices > figure.is-contextopen {\n background-color: #2196f3;\n color: #FFF; }\n .editor-modal-image-choices > figure.is-contextopen > img {\n border-color: #0c7cd5; }\n .editor-modal-image-choices > figure.is-contextopen > span > strong {\n color: #FFF; }\n\n.editor-modal-file-choices {\n overflow: auto;\n overflow-x: hidden; }\n .editor-modal-file-choices > em {\n display: flex;\n align-items: center;\n padding: 25px;\n color: #9e9e9e; }\n .editor-modal-file-choices > em > i {\n font-size: 32px;\n margin-right: 10px;\n color: #e0e0e0; }\n .editor-modal-file-choices > figure {\n display: flex;\n background-color: #FAFAFA;\n border-radius: 3px;\n padding: 5px;\n height: 34px;\n margin: 0 0 5px 0;\n cursor: pointer;\n justify-content: flex-start;\n align-items: center;\n transition: background-color 0.4s ease; }\n .editor-modal-file-choices > figure > i {\n width: 16px; }\n .editor-modal-file-choices > figure > span {\n font-size: 14px;\n flex: 0 1 auto;\n padding: 0 15px;\n color: #757575; }\n .editor-modal-file-choices > figure > span:first-of-type {\n flex: 1 0 auto;\n color: #424242; }\n .editor-modal-file-choices > figure > span:last-of-type {\n width: 100px; }\n .editor-modal-file-choices > figure:hover {\n background-color: #DDD; }\n .editor-modal-file-choices > figure.is-active {\n background-color: #4caf50;\n color: #FFF; }\n .editor-modal-file-choices > figure.is-active > span, .editor-modal-file-choices > figure.is-active strong {\n color: #FFF; }\n .editor-modal-file-choices > figure.is-contextopen {\n background-color: #2196f3;\n color: #FFF; }\n .editor-modal-file-choices > figure.is-contextopen > span, .editor-modal-file-choices > figure.is-contextopen strong {\n color: #FFF; }\n\n.editor-modal-imagealign .control > span {\n letter-spacing: 1px;\n text-transform: uppercase;\n color: #aeb1b5;\n font-size: 11px; }\n\n.editor-modal-imagealign > .is-grouped {\n display: flex;\n align-items: center;\n justify-content: center; }\n\n.editor-modal-imagealign .button > .icon {\n margin: 0; }\n\n.editor-modal-folderlist {\n height: 100%;\n overflow: auto;\n overflow-x: hidden; }\n\n.CodeMirror {\n border-left: none;\n border-right: none;\n padding-top: 52px;\n font-family: Consolas, \"Liberation Mono\", Menlo, Courier, monospace; }\n\n.CodeMirror .CodeMirror-code .cm-url {\n color: #00ACC1; }\n\n.CodeMirror .CodeMirror-code .cm-header-1 {\n color: #635c8c;\n font-size: 2em;\n font-weight: 400; }\n\n.CodeMirror .CodeMirror-code .cm-header-2 {\n color: #222324;\n font-size: 1.75em;\n font-weight: 300; }\n\n.CodeMirror .CodeMirror-code .cm-header-3 {\n color: #222324;\n font-size: 1.5em;\n font-weight: 300; }\n\n.editor-toolbar .fa {\n font-size: 14px; }\n\n.ace-container {\n position: relative; }\n\n/*.ace_scroller {\r\n\twidth: 100%;\r\n}\r\n.ace_content {\r\n\theight: 100%;\r\n}*/\n#page-type-source .ace-container {\n min-height: 95vh; }\n\n#modal-editor-codeblock .ace-container {\n display: flex;\n align-items: stretch;\n padding: 0;\n position: relative;\n width: 100%;\n height: 100%; }\n\n#source-display, #codeblock-editor {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0; }\n\n#header-container {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 4; }\n\n#header {\n z-index: 5; }\n\n#notifload {\n width: 42px;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transition: opacity .5s ease; }\n #notifload::before {\n content: \" \";\n width: 24px;\n height: 24px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 2px 1px 0 #c5cae9;\n -webkit-animation: spin 0.5s linear infinite;\n -moz-animation: spin 0.5s linear infinite;\n -ms-animation: spin 0.5s linear infinite;\n -o-animation: spin 0.5s linear infinite;\n animation: spin 0.5s linear infinite; }\n\n@-webkit-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-moz-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@-o-keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes spin {\n 100% {\n -webkit-transform: rotate(360deg);\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -o-transform: rotate(360deg);\n transform: rotate(360deg); } }\n #notifload.active {\n opacity: 1; }\n\n#search-input {\n max-width: 300px;\n width: 33vw; }\n\n.welcome {\n text-align: center;\n padding: 50px 0;\n color: #616161; }\n .welcome h1 {\n margin-top: 15px; }\n .welcome h2 {\n margin-top: 15px;\n margin-bottom: 50px; }\n\n/*# sourceMappingURL=app.scss.map */");
  74. });
  75. ___scope___.file("js/app.js", function(exports, require, module, __filename, __dirname){
  76. 'use strict';
  77. /* global alertsData */
  78. var _jquery = require('jquery');
  79. var _jquery2 = _interopRequireDefault(_jquery);
  80. var _lodash = require('lodash');
  81. var _lodash2 = _interopRequireDefault(_lodash);
  82. var _stickyJs = require('sticky-js');
  83. var _stickyJs2 = _interopRequireDefault(_stickyJs);
  84. var _socket = require('socket.io-client');
  85. var _socket2 = _interopRequireDefault(_socket);
  86. var _alerts = require('./components/alerts.js');
  87. var _alerts2 = _interopRequireDefault(_alerts);
  88. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  89. /* eslint-disable spaced-comment */
  90. (0, _jquery2.default)(document).ready(function ($) {
  91. // ====================================
  92. // Scroll
  93. // ====================================
  94. $('a').smoothScroll({
  95. speed: 400,
  96. offset: -70
  97. });
  98. var sticky = new _stickyJs2.default('.stickyscroll'); // eslint-disable-line no-unused-vars
  99. // ====================================
  100. // Notifications
  101. // ====================================
  102. $(window).bind('beforeunload', function () {
  103. $('#notifload').addClass('active');
  104. });
  105. $(document).ajaxSend(function () {
  106. $('#notifload').addClass('active');
  107. }).ajaxComplete(function () {
  108. $('#notifload').removeClass('active');
  109. });
  110. var alerts = new _alerts2.default();
  111. if (alertsData) {
  112. _lodash2.default.forEach(alertsData, function (alertRow) {
  113. alerts.push(alertRow);
  114. });
  115. }
  116. // ====================================
  117. // Establish WebSocket connection
  118. // ====================================
  119. var socket = (0, _socket2.default)(window.location.origin); // eslint-disable-line no-unused-vars
  120. //=include components/search.js
  121. // ====================================
  122. // Pages logic
  123. // ====================================
  124. //=include pages/view.js
  125. //=include pages/create.js
  126. //=include pages/edit.js
  127. //=include pages/source.js
  128. //=include pages/admin.js
  129. });
  130. //=include helpers/form.js
  131. //=include helpers/pages.js
  132. //=include components/alerts.js
  133. /* eslint-enable spaced-comment */
  134. });
  135. ___scope___.file("js/components/alerts.js", function(exports, require, module, __filename, __dirname){
  136. 'use strict';
  137. Object.defineProperty(exports, "__esModule", {
  138. value: true
  139. });
  140. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  141. var _vue = require("vue/dist/vue.js");
  142. var _vue2 = _interopRequireDefault(_vue);
  143. var _lodash = require("lodash");
  144. var _lodash2 = _interopRequireDefault(_lodash);
  145. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  146. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  147. /**
  148. * Alerts
  149. */
  150. var Alerts = function () {
  151. /**
  152. * Constructor
  153. *
  154. * @class
  155. */
  156. function Alerts() {
  157. _classCallCheck(this, Alerts);
  158. var self = this;
  159. self.mdl = new _vue2.default({
  160. el: '#alerts',
  161. data: {
  162. children: []
  163. },
  164. methods: {
  165. acknowledge: function acknowledge(uid) {
  166. self.close(uid);
  167. }
  168. }
  169. });
  170. self.uidNext = 1;
  171. }
  172. /**
  173. * Show a new Alert
  174. *
  175. * @param {Object} options Alert properties
  176. * @return {null} Void
  177. */
  178. _createClass(Alerts, [{
  179. key: "push",
  180. value: function push(options) {
  181. var self = this;
  182. var nAlert = _lodash2.default.defaults(options, {
  183. _uid: self.uidNext,
  184. class: 'info',
  185. message: '---',
  186. sticky: false,
  187. title: '---'
  188. });
  189. self.mdl.children.push(nAlert);
  190. if (!nAlert.sticky) {
  191. _lodash2.default.delay(function () {
  192. self.close(nAlert._uid);
  193. }, 5000);
  194. }
  195. self.uidNext++;
  196. }
  197. /**
  198. * Shorthand method for pushing errors
  199. *
  200. * @param {String} title The title
  201. * @param {String} message The message
  202. */
  203. }, {
  204. key: "pushError",
  205. value: function pushError(title, message) {
  206. this.push({
  207. class: 'error',
  208. message: message,
  209. sticky: false,
  210. title: title
  211. });
  212. }
  213. /**
  214. * Shorthand method for pushing success messages
  215. *
  216. * @param {String} title The title
  217. * @param {String} message The message
  218. */
  219. }, {
  220. key: "pushSuccess",
  221. value: function pushSuccess(title, message) {
  222. this.push({
  223. class: 'success',
  224. message: message,
  225. sticky: false,
  226. title: title
  227. });
  228. }
  229. /**
  230. * Close an alert
  231. *
  232. * @param {Integer} uid The unique ID of the alert
  233. */
  234. }, {
  235. key: "close",
  236. value: function close(uid) {
  237. var self = this;
  238. var nAlertIdx = _lodash2.default.findIndex(self.mdl.children, ['_uid', uid]);
  239. var nAlert = _lodash2.default.nth(self.mdl.children, nAlertIdx);
  240. if (nAlertIdx >= 0 && nAlert) {
  241. nAlert.class += ' exit';
  242. _vue2.default.set(self.mdl.children, nAlertIdx, nAlert);
  243. _lodash2.default.delay(function () {
  244. self.mdl.children.splice(nAlertIdx, 1);
  245. }, 500);
  246. }
  247. }
  248. }]);
  249. return Alerts;
  250. }();
  251. exports.default = Alerts;
  252. });
  253. });
  254. FuseBox.pkg("fusebox-hot-reload", {}, function(___scope___){
  255. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  256. /**
  257. * @module listens to `source-changed` socket events and actions hot reload
  258. */
  259. "use strict";
  260. Object.defineProperty(exports, "__esModule", { value: true });
  261. var Client = require('fusebox-websocket').SocketClient;
  262. exports.connect = function (port, uri) {
  263. if (FuseBox.isServer) {
  264. return;
  265. }
  266. port = port || window.location.port;
  267. var client = new Client({
  268. port: port,
  269. uri: uri,
  270. });
  271. client.connect();
  272. console.log('connecting...');
  273. client.on('source-changed', function (data) {
  274. console.log("Updating \"" + data.path + "\" ...");
  275. /**
  276. * If a plugin handles this request then we don't have to do anything
  277. **/
  278. for (var index = 0; index < FuseBox.plugins.length; index++) {
  279. var plugin = FuseBox.plugins[index];
  280. if (plugin.hmrUpdate && plugin.hmrUpdate(data)) {
  281. return;
  282. }
  283. }
  284. if (data.type === 'js') {
  285. FuseBox.flush();
  286. FuseBox.dynamic(data.path, data.content);
  287. if (FuseBox.mainFile) {
  288. try {
  289. FuseBox.import(FuseBox.mainFile);
  290. }
  291. catch (e) {
  292. if (typeof e === 'string') {
  293. if (/not found/.test(e)) {
  294. return window.location.reload();
  295. }
  296. }
  297. console.error(e);
  298. }
  299. }
  300. }
  301. if (data.type === 'css' && __fsbx_css) {
  302. __fsbx_css(data.path, data.content);
  303. }
  304. });
  305. client.on('error', function (error) {
  306. console.log(error);
  307. });
  308. };
  309. });
  310. return ___scope___.entry = "index.js";
  311. });
  312. FuseBox.pkg("fusebox-websocket", {}, function(___scope___){
  313. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  314. "use strict";
  315. Object.defineProperty(exports, "__esModule", { value: true });
  316. var events = require('events');
  317. var SocketClient = (function () {
  318. function SocketClient(opts) {
  319. opts = opts || {};
  320. var port = opts.port || window.location.port;
  321. var protocol = location.protocol === 'https:' ? 'wss://' : 'ws://';
  322. var domain = location.hostname || 'localhost';
  323. this.url = opts.host || "" + protocol + domain + ":" + port;
  324. if (opts.uri) {
  325. this.url = opts.uri;
  326. }
  327. this.authSent = false;
  328. this.emitter = new events.EventEmitter();
  329. }
  330. SocketClient.prototype.reconnect = function (fn) {
  331. var _this = this;
  332. setTimeout(function () {
  333. _this.emitter.emit('reconnect', { message: 'Trying to reconnect' });
  334. _this.connect(fn);
  335. }, 5000);
  336. };
  337. SocketClient.prototype.on = function (event, fn) {
  338. this.emitter.on(event, fn);
  339. };
  340. SocketClient.prototype.connect = function (fn) {
  341. var _this = this;
  342. console.log('connect', this.url);
  343. setTimeout(function () {
  344. _this.client = new WebSocket(_this.url);
  345. _this.bindEvents(fn);
  346. }, 0);
  347. };
  348. SocketClient.prototype.close = function () {
  349. this.client.close();
  350. };
  351. SocketClient.prototype.send = function (eventName, data) {
  352. if (this.client.readyState === 1) {
  353. this.client.send(JSON.stringify({ event: eventName, data: data || {} }));
  354. }
  355. };
  356. SocketClient.prototype.error = function (data) {
  357. this.emitter.emit('error', data);
  358. };
  359. /** Wires up the socket client messages to be emitted on our event emitter */
  360. SocketClient.prototype.bindEvents = function (fn) {
  361. var _this = this;
  362. this.client.onopen = function (event) {
  363. if (fn) {
  364. fn(_this);
  365. }
  366. };
  367. this.client.onerror = function (event) {
  368. _this.error({ reason: event.reason, message: 'Socket error' });
  369. };
  370. this.client.onclose = function (event) {
  371. _this.emitter.emit('close', { message: 'Socket closed' });
  372. if (event.code !== 1011) {
  373. _this.reconnect(fn);
  374. }
  375. };
  376. this.client.onmessage = function (event) {
  377. var data = event.data;
  378. if (data) {
  379. var item = JSON.parse(data);
  380. _this.emitter.emit(item.type, item.data);
  381. _this.emitter.emit('*', item);
  382. }
  383. };
  384. };
  385. return SocketClient;
  386. }());
  387. exports.SocketClient = SocketClient;
  388. });
  389. return ___scope___.entry = "index.js";
  390. });
  391. FuseBox.pkg("events", {}, function(___scope___){
  392. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  393. // Copyright Joyent, Inc. and other Node contributors.
  394. //
  395. // Permission is hereby granted, free of charge, to any person obtaining a
  396. // copy of this software and associated documentation files (the
  397. // "Software"), to deal in the Software without restriction, including
  398. // without limitation the rights to use, copy, modify, merge, publish,
  399. // distribute, sublicense, and/or sell copies of the Software, and to permit
  400. // persons to whom the Software is furnished to do so, subject to the
  401. // following conditions:
  402. //
  403. // The above copyright notice and this permission notice shall be included
  404. // in all copies or substantial portions of the Software.
  405. //
  406. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  407. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  408. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  409. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  410. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  411. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  412. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  413. if (FuseBox.isServer) {
  414. module.exports = global.require("events");
  415. } else {
  416. function EventEmitter() {
  417. this._events = this._events || {};
  418. this._maxListeners = this._maxListeners || undefined;
  419. }
  420. module.exports = EventEmitter;
  421. // Backwards-compat with node 0.10.x
  422. EventEmitter.EventEmitter = EventEmitter;
  423. EventEmitter.prototype._events = undefined;
  424. EventEmitter.prototype._maxListeners = undefined;
  425. // By default EventEmitters will print a warning if more than 10 listeners are
  426. // added to it. This is a useful default which helps finding memory leaks.
  427. EventEmitter.defaultMaxListeners = 10;
  428. // Obviously not all Emitters should be limited to 10. This function allows
  429. // that to be increased. Set to zero for unlimited.
  430. EventEmitter.prototype.setMaxListeners = function(n) {
  431. if (!isNumber(n) || n < 0 || isNaN(n))
  432. throw TypeError("n must be a positive number");
  433. this._maxListeners = n;
  434. return this;
  435. };
  436. EventEmitter.prototype.emit = function(type) {
  437. var er, handler, len, args, i, listeners;
  438. if (!this._events)
  439. this._events = {};
  440. // If there is no 'error' event listener then throw.
  441. if (type === "error") {
  442. if (!this._events.error ||
  443. (isObject(this._events.error) && !this._events.error.length)) {
  444. er = arguments[1];
  445. if (er instanceof Error) {
  446. throw er; // Unhandled 'error' event
  447. }
  448. throw TypeError("Uncaught, unspecified \"error\" event.");
  449. }
  450. }
  451. handler = this._events[type];
  452. if (isUndefined(handler))
  453. return false;
  454. if (isFunction(handler)) {
  455. switch (arguments.length) {
  456. // fast cases
  457. case 1:
  458. handler.call(this);
  459. break;
  460. case 2:
  461. handler.call(this, arguments[1]);
  462. break;
  463. case 3:
  464. handler.call(this, arguments[1], arguments[2]);
  465. break;
  466. // slower
  467. default:
  468. args = Array.prototype.slice.call(arguments, 1);
  469. handler.apply(this, args);
  470. }
  471. } else if (isObject(handler)) {
  472. args = Array.prototype.slice.call(arguments, 1);
  473. listeners = handler.slice();
  474. len = listeners.length;
  475. for (i = 0; i < len; i++)
  476. listeners[i].apply(this, args);
  477. }
  478. return true;
  479. };
  480. EventEmitter.prototype.addListener = function(type, listener) {
  481. var m;
  482. if (!isFunction(listener))
  483. throw TypeError("listener must be a function");
  484. if (!this._events)
  485. this._events = {};
  486. // To avoid recursion in the case that type === "newListener"! Before
  487. // adding it to the listeners, first emit "newListener".
  488. if (this._events.newListener)
  489. this.emit("newListener", type,
  490. isFunction(listener.listener) ?
  491. listener.listener : listener);
  492. if (!this._events[type])
  493. // Optimize the case of one listener. Don't need the extra array object.
  494. this._events[type] = listener;
  495. else if (isObject(this._events[type]))
  496. // If we've already got an array, just append.
  497. this._events[type].push(listener);
  498. else
  499. // Adding the second element, need to change to array.
  500. this._events[type] = [this._events[type], listener];
  501. // Check for listener leak
  502. if (isObject(this._events[type]) && !this._events[type].warned) {
  503. if (!isUndefined(this._maxListeners)) {
  504. m = this._maxListeners;
  505. } else {
  506. m = EventEmitter.defaultMaxListeners;
  507. }
  508. if (m && m > 0 && this._events[type].length > m) {
  509. this._events[type].warned = true;
  510. console.error("(node) warning: possible EventEmitter memory " +
  511. "leak detected. %d listeners added. " +
  512. "Use emitter.setMaxListeners() to increase limit.",
  513. this._events[type].length);
  514. if (typeof console.trace === "function") {
  515. // not supported in IE 10
  516. console.trace();
  517. }
  518. }
  519. }
  520. return this;
  521. };
  522. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  523. EventEmitter.prototype.once = function(type, listener) {
  524. if (!isFunction(listener))
  525. throw TypeError("listener must be a function");
  526. var fired = false;
  527. function g() {
  528. this.removeListener(type, g);
  529. if (!fired) {
  530. fired = true;
  531. listener.apply(this, arguments);
  532. }
  533. }
  534. g.listener = listener;
  535. this.on(type, g);
  536. return this;
  537. };
  538. // emits a 'removeListener' event iff the listener was removed
  539. EventEmitter.prototype.removeListener = function(type, listener) {
  540. var list, position, length, i;
  541. if (!isFunction(listener))
  542. throw TypeError("listener must be a function");
  543. if (!this._events || !this._events[type])
  544. return this;
  545. list = this._events[type];
  546. length = list.length;
  547. position = -1;
  548. if (list === listener ||
  549. (isFunction(list.listener) && list.listener === listener)) {
  550. delete this._events[type];
  551. if (this._events.removeListener)
  552. this.emit("removeListener", type, listener);
  553. } else if (isObject(list)) {
  554. for (i = length; i-- > 0;) {
  555. if (list[i] === listener ||
  556. (list[i].listener && list[i].listener === listener)) {
  557. position = i;
  558. break;
  559. }
  560. }
  561. if (position < 0)
  562. return this;
  563. if (list.length === 1) {
  564. list.length = 0;
  565. delete this._events[type];
  566. } else {
  567. list.splice(position, 1);
  568. }
  569. if (this._events.removeListener)
  570. this.emit("removeListener", type, listener);
  571. }
  572. return this;
  573. };
  574. EventEmitter.prototype.removeAllListeners = function(type) {
  575. var key, listeners;
  576. if (!this._events)
  577. return this;
  578. // not listening for removeListener, no need to emit
  579. if (!this._events.removeListener) {
  580. if (arguments.length === 0)
  581. this._events = {};
  582. else if (this._events[type])
  583. delete this._events[type];
  584. return this;
  585. }
  586. // emit removeListener for all listeners on all events
  587. if (arguments.length === 0) {
  588. for (key in this._events) {
  589. if (key === "removeListener") continue;
  590. this.removeAllListeners(key);
  591. }
  592. this.removeAllListeners("removeListener");
  593. this._events = {};
  594. return this;
  595. }
  596. listeners = this._events[type];
  597. if (isFunction(listeners)) {
  598. this.removeListener(type, listeners);
  599. } else if (listeners) {
  600. // LIFO order
  601. while (listeners.length)
  602. this.removeListener(type, listeners[listeners.length - 1]);
  603. }
  604. delete this._events[type];
  605. return this;
  606. };
  607. EventEmitter.prototype.listeners = function(type) {
  608. var ret;
  609. if (!this._events || !this._events[type])
  610. ret = [];
  611. else if (isFunction(this._events[type]))
  612. ret = [this._events[type]];
  613. else
  614. ret = this._events[type].slice();
  615. return ret;
  616. };
  617. EventEmitter.prototype.listenerCount = function(type) {
  618. if (this._events) {
  619. var evlistener = this._events[type];
  620. if (isFunction(evlistener))
  621. return 1;
  622. else if (evlistener)
  623. return evlistener.length;
  624. }
  625. return 0;
  626. };
  627. EventEmitter.listenerCount = function(emitter, type) {
  628. return emitter.listenerCount(type);
  629. };
  630. function isFunction(arg) {
  631. return typeof arg === "function";
  632. }
  633. function isNumber(arg) {
  634. return typeof arg === "number";
  635. }
  636. function isObject(arg) {
  637. return typeof arg === "object" && arg !== null;
  638. }
  639. function isUndefined(arg) {
  640. return arg === void 0;
  641. }
  642. }
  643. });
  644. return ___scope___.entry = "index.js";
  645. });
  646. FuseBox.pkg("jquery", {}, function(___scope___){
  647. ___scope___.file("dist/jquery.js", function(exports, require, module, __filename, __dirname){
  648. /*!
  649. * jQuery JavaScript Library v3.2.1
  650. * https://jquery.com/
  651. *
  652. * Includes Sizzle.js
  653. * https://sizzlejs.com/
  654. *
  655. * Copyright JS Foundation and other contributors
  656. * Released under the MIT license
  657. * https://jquery.org/license
  658. *
  659. * Date: 2017-03-20T18:59Z
  660. */
  661. ( function( global, factory ) {
  662. "use strict";
  663. if ( typeof module === "object" && typeof module.exports === "object" ) {
  664. // For CommonJS and CommonJS-like environments where a proper `window`
  665. // is present, execute the factory and get jQuery.
  666. // For environments that do not have a `window` with a `document`
  667. // (such as Node.js), expose a factory as module.exports.
  668. // This accentuates the need for the creation of a real `window`.
  669. // e.g. var jQuery = require("jquery")(window);
  670. // See ticket #14549 for more info.
  671. module.exports = global.document ?
  672. factory( global, true ) :
  673. function( w ) {
  674. if ( !w.document ) {
  675. throw new Error( "jQuery requires a window with a document" );
  676. }
  677. return factory( w );
  678. };
  679. } else {
  680. factory( global );
  681. }
  682. // Pass this if window is not defined yet
  683. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  684. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  685. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  686. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  687. // enough that all such attempts are guarded in a try block.
  688. "use strict";
  689. var arr = [];
  690. var document = window.document;
  691. var getProto = Object.getPrototypeOf;
  692. var slice = arr.slice;
  693. var concat = arr.concat;
  694. var push = arr.push;
  695. var indexOf = arr.indexOf;
  696. var class2type = {};
  697. var toString = class2type.toString;
  698. var hasOwn = class2type.hasOwnProperty;
  699. var fnToString = hasOwn.toString;
  700. var ObjectFunctionString = fnToString.call( Object );
  701. var support = {};
  702. function DOMEval( code, doc ) {
  703. doc = doc || document;
  704. var script = doc.createElement( "script" );
  705. script.text = code;
  706. doc.head.appendChild( script ).parentNode.removeChild( script );
  707. }
  708. /* global Symbol */
  709. // Defining this global in .eslintrc.json would create a danger of using the global
  710. // unguarded in another place, it seems safer to define global only for this module
  711. var
  712. version = "3.2.1",
  713. // Define a local copy of jQuery
  714. jQuery = function( selector, context ) {
  715. // The jQuery object is actually just the init constructor 'enhanced'
  716. // Need init if jQuery is called (just allow error to be thrown if not included)
  717. return new jQuery.fn.init( selector, context );
  718. },
  719. // Support: Android <=4.0 only
  720. // Make sure we trim BOM and NBSP
  721. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  722. // Matches dashed string for camelizing
  723. rmsPrefix = /^-ms-/,
  724. rdashAlpha = /-([a-z])/g,
  725. // Used by jQuery.camelCase as callback to replace()
  726. fcamelCase = function( all, letter ) {
  727. return letter.toUpperCase();
  728. };
  729. jQuery.fn = jQuery.prototype = {
  730. // The current version of jQuery being used
  731. jquery: version,
  732. constructor: jQuery,
  733. // The default length of a jQuery object is 0
  734. length: 0,
  735. toArray: function() {
  736. return slice.call( this );
  737. },
  738. // Get the Nth element in the matched element set OR
  739. // Get the whole matched element set as a clean array
  740. get: function( num ) {
  741. // Return all the elements in a clean array
  742. if ( num == null ) {
  743. return slice.call( this );
  744. }
  745. // Return just the one element from the set
  746. return num < 0 ? this[ num + this.length ] : this[ num ];
  747. },
  748. // Take an array of elements and push it onto the stack
  749. // (returning the new matched element set)
  750. pushStack: function( elems ) {
  751. // Build a new jQuery matched element set
  752. var ret = jQuery.merge( this.constructor(), elems );
  753. // Add the old object onto the stack (as a reference)
  754. ret.prevObject = this;
  755. // Return the newly-formed element set
  756. return ret;
  757. },
  758. // Execute a callback for every element in the matched set.
  759. each: function( callback ) {
  760. return jQuery.each( this, callback );
  761. },
  762. map: function( callback ) {
  763. return this.pushStack( jQuery.map( this, function( elem, i ) {
  764. return callback.call( elem, i, elem );
  765. } ) );
  766. },
  767. slice: function() {
  768. return this.pushStack( slice.apply( this, arguments ) );
  769. },
  770. first: function() {
  771. return this.eq( 0 );
  772. },
  773. last: function() {
  774. return this.eq( -1 );
  775. },
  776. eq: function( i ) {
  777. var len = this.length,
  778. j = +i + ( i < 0 ? len : 0 );
  779. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  780. },
  781. end: function() {
  782. return this.prevObject || this.constructor();
  783. },
  784. // For internal use only.
  785. // Behaves like an Array's method, not like a jQuery method.
  786. push: push,
  787. sort: arr.sort,
  788. splice: arr.splice
  789. };
  790. jQuery.extend = jQuery.fn.extend = function() {
  791. var options, name, src, copy, copyIsArray, clone,
  792. target = arguments[ 0 ] || {},
  793. i = 1,
  794. length = arguments.length,
  795. deep = false;
  796. // Handle a deep copy situation
  797. if ( typeof target === "boolean" ) {
  798. deep = target;
  799. // Skip the boolean and the target
  800. target = arguments[ i ] || {};
  801. i++;
  802. }
  803. // Handle case when target is a string or something (possible in deep copy)
  804. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  805. target = {};
  806. }
  807. // Extend jQuery itself if only one argument is passed
  808. if ( i === length ) {
  809. target = this;
  810. i--;
  811. }
  812. for ( ; i < length; i++ ) {
  813. // Only deal with non-null/undefined values
  814. if ( ( options = arguments[ i ] ) != null ) {
  815. // Extend the base object
  816. for ( name in options ) {
  817. src = target[ name ];
  818. copy = options[ name ];
  819. // Prevent never-ending loop
  820. if ( target === copy ) {
  821. continue;
  822. }
  823. // Recurse if we're merging plain objects or arrays
  824. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  825. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  826. if ( copyIsArray ) {
  827. copyIsArray = false;
  828. clone = src && Array.isArray( src ) ? src : [];
  829. } else {
  830. clone = src && jQuery.isPlainObject( src ) ? src : {};
  831. }
  832. // Never move original objects, clone them
  833. target[ name ] = jQuery.extend( deep, clone, copy );
  834. // Don't bring in undefined values
  835. } else if ( copy !== undefined ) {
  836. target[ name ] = copy;
  837. }
  838. }
  839. }
  840. }
  841. // Return the modified object
  842. return target;
  843. };
  844. jQuery.extend( {
  845. // Unique for each copy of jQuery on the page
  846. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  847. // Assume jQuery is ready without the ready module
  848. isReady: true,
  849. error: function( msg ) {
  850. throw new Error( msg );
  851. },
  852. noop: function() {},
  853. isFunction: function( obj ) {
  854. return jQuery.type( obj ) === "function";
  855. },
  856. isWindow: function( obj ) {
  857. return obj != null && obj === obj.window;
  858. },
  859. isNumeric: function( obj ) {
  860. // As of jQuery 3.0, isNumeric is limited to
  861. // strings and numbers (primitives or objects)
  862. // that can be coerced to finite numbers (gh-2662)
  863. var type = jQuery.type( obj );
  864. return ( type === "number" || type === "string" ) &&
  865. // parseFloat NaNs numeric-cast false positives ("")
  866. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  867. // subtraction forces infinities to NaN
  868. !isNaN( obj - parseFloat( obj ) );
  869. },
  870. isPlainObject: function( obj ) {
  871. var proto, Ctor;
  872. // Detect obvious negatives
  873. // Use toString instead of jQuery.type to catch host objects
  874. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  875. return false;
  876. }
  877. proto = getProto( obj );
  878. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  879. if ( !proto ) {
  880. return true;
  881. }
  882. // Objects with prototype are plain iff they were constructed by a global Object function
  883. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  884. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  885. },
  886. isEmptyObject: function( obj ) {
  887. /* eslint-disable no-unused-vars */
  888. // See https://github.com/eslint/eslint/issues/6125
  889. var name;
  890. for ( name in obj ) {
  891. return false;
  892. }
  893. return true;
  894. },
  895. type: function( obj ) {
  896. if ( obj == null ) {
  897. return obj + "";
  898. }
  899. // Support: Android <=2.3 only (functionish RegExp)
  900. return typeof obj === "object" || typeof obj === "function" ?
  901. class2type[ toString.call( obj ) ] || "object" :
  902. typeof obj;
  903. },
  904. // Evaluates a script in a global context
  905. globalEval: function( code ) {
  906. DOMEval( code );
  907. },
  908. // Convert dashed to camelCase; used by the css and data modules
  909. // Support: IE <=9 - 11, Edge 12 - 13
  910. // Microsoft forgot to hump their vendor prefix (#9572)
  911. camelCase: function( string ) {
  912. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  913. },
  914. each: function( obj, callback ) {
  915. var length, i = 0;
  916. if ( isArrayLike( obj ) ) {
  917. length = obj.length;
  918. for ( ; i < length; i++ ) {
  919. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  920. break;
  921. }
  922. }
  923. } else {
  924. for ( i in obj ) {
  925. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  926. break;
  927. }
  928. }
  929. }
  930. return obj;
  931. },
  932. // Support: Android <=4.0 only
  933. trim: function( text ) {
  934. return text == null ?
  935. "" :
  936. ( text + "" ).replace( rtrim, "" );
  937. },
  938. // results is for internal usage only
  939. makeArray: function( arr, results ) {
  940. var ret = results || [];
  941. if ( arr != null ) {
  942. if ( isArrayLike( Object( arr ) ) ) {
  943. jQuery.merge( ret,
  944. typeof arr === "string" ?
  945. [ arr ] : arr
  946. );
  947. } else {
  948. push.call( ret, arr );
  949. }
  950. }
  951. return ret;
  952. },
  953. inArray: function( elem, arr, i ) {
  954. return arr == null ? -1 : indexOf.call( arr, elem, i );
  955. },
  956. // Support: Android <=4.0 only, PhantomJS 1 only
  957. // push.apply(_, arraylike) throws on ancient WebKit
  958. merge: function( first, second ) {
  959. var len = +second.length,
  960. j = 0,
  961. i = first.length;
  962. for ( ; j < len; j++ ) {
  963. first[ i++ ] = second[ j ];
  964. }
  965. first.length = i;
  966. return first;
  967. },
  968. grep: function( elems, callback, invert ) {
  969. var callbackInverse,
  970. matches = [],
  971. i = 0,
  972. length = elems.length,
  973. callbackExpect = !invert;
  974. // Go through the array, only saving the items
  975. // that pass the validator function
  976. for ( ; i < length; i++ ) {
  977. callbackInverse = !callback( elems[ i ], i );
  978. if ( callbackInverse !== callbackExpect ) {
  979. matches.push( elems[ i ] );
  980. }
  981. }
  982. return matches;
  983. },
  984. // arg is for internal usage only
  985. map: function( elems, callback, arg ) {
  986. var length, value,
  987. i = 0,
  988. ret = [];
  989. // Go through the array, translating each of the items to their new values
  990. if ( isArrayLike( elems ) ) {
  991. length = elems.length;
  992. for ( ; i < length; i++ ) {
  993. value = callback( elems[ i ], i, arg );
  994. if ( value != null ) {
  995. ret.push( value );
  996. }
  997. }
  998. // Go through every key on the object,
  999. } else {
  1000. for ( i in elems ) {
  1001. value = callback( elems[ i ], i, arg );
  1002. if ( value != null ) {
  1003. ret.push( value );
  1004. }
  1005. }
  1006. }
  1007. // Flatten any nested arrays
  1008. return concat.apply( [], ret );
  1009. },
  1010. // A global GUID counter for objects
  1011. guid: 1,
  1012. // Bind a function to a context, optionally partially applying any
  1013. // arguments.
  1014. proxy: function( fn, context ) {
  1015. var tmp, args, proxy;
  1016. if ( typeof context === "string" ) {
  1017. tmp = fn[ context ];
  1018. context = fn;
  1019. fn = tmp;
  1020. }
  1021. // Quick check to determine if target is callable, in the spec
  1022. // this throws a TypeError, but we will just return undefined.
  1023. if ( !jQuery.isFunction( fn ) ) {
  1024. return undefined;
  1025. }
  1026. // Simulated bind
  1027. args = slice.call( arguments, 2 );
  1028. proxy = function() {
  1029. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  1030. };
  1031. // Set the guid of unique handler to the same of original handler, so it can be removed
  1032. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  1033. return proxy;
  1034. },
  1035. now: Date.now,
  1036. // jQuery.support is not used in Core but other projects attach their
  1037. // properties to it so it needs to exist.
  1038. support: support
  1039. } );
  1040. if ( typeof Symbol === "function" ) {
  1041. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  1042. }
  1043. // Populate the class2type map
  1044. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  1045. function( i, name ) {
  1046. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  1047. } );
  1048. function isArrayLike( obj ) {
  1049. // Support: real iOS 8.2 only (not reproducible in simulator)
  1050. // `in` check used to prevent JIT error (gh-2145)
  1051. // hasOwn isn't used here due to false negatives
  1052. // regarding Nodelist length in IE
  1053. var length = !!obj && "length" in obj && obj.length,
  1054. type = jQuery.type( obj );
  1055. if ( type === "function" || jQuery.isWindow( obj ) ) {
  1056. return false;
  1057. }
  1058. return type === "array" || length === 0 ||
  1059. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  1060. }
  1061. var Sizzle =
  1062. /*!
  1063. * Sizzle CSS Selector Engine v2.3.3
  1064. * https://sizzlejs.com/
  1065. *
  1066. * Copyright jQuery Foundation and other contributors
  1067. * Released under the MIT license
  1068. * http://jquery.org/license
  1069. *
  1070. * Date: 2016-08-08
  1071. */
  1072. (function( window ) {
  1073. var i,
  1074. support,
  1075. Expr,
  1076. getText,
  1077. isXML,
  1078. tokenize,
  1079. compile,
  1080. select,
  1081. outermostContext,
  1082. sortInput,
  1083. hasDuplicate,
  1084. // Local document vars
  1085. setDocument,
  1086. document,
  1087. docElem,
  1088. documentIsHTML,
  1089. rbuggyQSA,
  1090. rbuggyMatches,
  1091. matches,
  1092. contains,
  1093. // Instance-specific data
  1094. expando = "sizzle" + 1 * new Date(),
  1095. preferredDoc = window.document,
  1096. dirruns = 0,
  1097. done = 0,
  1098. classCache = createCache(),
  1099. tokenCache = createCache(),
  1100. compilerCache = createCache(),
  1101. sortOrder = function( a, b ) {
  1102. if ( a === b ) {
  1103. hasDuplicate = true;
  1104. }
  1105. return 0;
  1106. },
  1107. // Instance methods
  1108. hasOwn = ({}).hasOwnProperty,
  1109. arr = [],
  1110. pop = arr.pop,
  1111. push_native = arr.push,
  1112. push = arr.push,
  1113. slice = arr.slice,
  1114. // Use a stripped-down indexOf as it's faster than native
  1115. // https://jsperf.com/thor-indexof-vs-for/5
  1116. indexOf = function( list, elem ) {
  1117. var i = 0,
  1118. len = list.length;
  1119. for ( ; i < len; i++ ) {
  1120. if ( list[i] === elem ) {
  1121. return i;
  1122. }
  1123. }
  1124. return -1;
  1125. },
  1126. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  1127. // Regular expressions
  1128. // http://www.w3.org/TR/css3-selectors/#whitespace
  1129. whitespace = "[\\x20\\t\\r\\n\\f]",
  1130. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  1131. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  1132. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  1133. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  1134. // Operator (capture 2)
  1135. "*([*^$|!~]?=)" + whitespace +
  1136. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  1137. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  1138. "*\\]",
  1139. pseudos = ":(" + identifier + ")(?:\\((" +
  1140. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  1141. // 1. quoted (capture 3; capture 4 or capture 5)
  1142. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  1143. // 2. simple (capture 6)
  1144. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  1145. // 3. anything else (capture 2)
  1146. ".*" +
  1147. ")\\)|)",
  1148. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  1149. rwhitespace = new RegExp( whitespace + "+", "g" ),
  1150. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  1151. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  1152. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  1153. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  1154. rpseudo = new RegExp( pseudos ),
  1155. ridentifier = new RegExp( "^" + identifier + "$" ),
  1156. matchExpr = {
  1157. "ID": new RegExp( "^#(" + identifier + ")" ),
  1158. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  1159. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  1160. "ATTR": new RegExp( "^" + attributes ),
  1161. "PSEUDO": new RegExp( "^" + pseudos ),
  1162. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  1163. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  1164. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  1165. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  1166. // For use in libraries implementing .is()
  1167. // We use this for POS matching in `select`
  1168. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  1169. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  1170. },
  1171. rinputs = /^(?:input|select|textarea|button)$/i,
  1172. rheader = /^h\d$/i,
  1173. rnative = /^[^{]+\{\s*\[native \w/,
  1174. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  1175. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  1176. rsibling = /[+~]/,
  1177. // CSS escapes
  1178. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  1179. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  1180. funescape = function( _, escaped, escapedWhitespace ) {
  1181. var high = "0x" + escaped - 0x10000;
  1182. // NaN means non-codepoint
  1183. // Support: Firefox<24
  1184. // Workaround erroneous numeric interpretation of +"0x"
  1185. return high !== high || escapedWhitespace ?
  1186. escaped :
  1187. high < 0 ?
  1188. // BMP codepoint
  1189. String.fromCharCode( high + 0x10000 ) :
  1190. // Supplemental Plane codepoint (surrogate pair)
  1191. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  1192. },
  1193. // CSS string/identifier serialization
  1194. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  1195. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  1196. fcssescape = function( ch, asCodePoint ) {
  1197. if ( asCodePoint ) {
  1198. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  1199. if ( ch === "\0" ) {
  1200. return "\uFFFD";
  1201. }
  1202. // Control characters and (dependent upon position) numbers get escaped as code points
  1203. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  1204. }
  1205. // Other potentially-special ASCII characters get backslash-escaped
  1206. return "\\" + ch;
  1207. },
  1208. // Used for iframes
  1209. // See setDocument()
  1210. // Removing the function wrapper causes a "Permission Denied"
  1211. // error in IE
  1212. unloadHandler = function() {
  1213. setDocument();
  1214. },
  1215. disabledAncestor = addCombinator(
  1216. function( elem ) {
  1217. return elem.disabled === true && ("form" in elem || "label" in elem);
  1218. },
  1219. { dir: "parentNode", next: "legend" }
  1220. );
  1221. // Optimize for push.apply( _, NodeList )
  1222. try {
  1223. push.apply(
  1224. (arr = slice.call( preferredDoc.childNodes )),
  1225. preferredDoc.childNodes
  1226. );
  1227. // Support: Android<4.0
  1228. // Detect silently failing push.apply
  1229. arr[ preferredDoc.childNodes.length ].nodeType;
  1230. } catch ( e ) {
  1231. push = { apply: arr.length ?
  1232. // Leverage slice if possible
  1233. function( target, els ) {
  1234. push_native.apply( target, slice.call(els) );
  1235. } :
  1236. // Support: IE<9
  1237. // Otherwise append directly
  1238. function( target, els ) {
  1239. var j = target.length,
  1240. i = 0;
  1241. // Can't trust NodeList.length
  1242. while ( (target[j++] = els[i++]) ) {}
  1243. target.length = j - 1;
  1244. }
  1245. };
  1246. }
  1247. function Sizzle( selector, context, results, seed ) {
  1248. var m, i, elem, nid, match, groups, newSelector,
  1249. newContext = context && context.ownerDocument,
  1250. // nodeType defaults to 9, since context defaults to document
  1251. nodeType = context ? context.nodeType : 9;
  1252. results = results || [];
  1253. // Return early from calls with invalid selector or context
  1254. if ( typeof selector !== "string" || !selector ||
  1255. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  1256. return results;
  1257. }
  1258. // Try to shortcut find operations (as opposed to filters) in HTML documents
  1259. if ( !seed ) {
  1260. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  1261. setDocument( context );
  1262. }
  1263. context = context || document;
  1264. if ( documentIsHTML ) {
  1265. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  1266. // (excepting DocumentFragment context, where the methods don't exist)
  1267. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  1268. // ID selector
  1269. if ( (m = match[1]) ) {
  1270. // Document context
  1271. if ( nodeType === 9 ) {
  1272. if ( (elem = context.getElementById( m )) ) {
  1273. // Support: IE, Opera, Webkit
  1274. // TODO: identify versions
  1275. // getElementById can match elements by name instead of ID
  1276. if ( elem.id === m ) {
  1277. results.push( elem );
  1278. return results;
  1279. }
  1280. } else {
  1281. return results;
  1282. }
  1283. // Element context
  1284. } else {
  1285. // Support: IE, Opera, Webkit
  1286. // TODO: identify versions
  1287. // getElementById can match elements by name instead of ID
  1288. if ( newContext && (elem = newContext.getElementById( m )) &&
  1289. contains( context, elem ) &&
  1290. elem.id === m ) {
  1291. results.push( elem );
  1292. return results;
  1293. }
  1294. }
  1295. // Type selector
  1296. } else if ( match[2] ) {
  1297. push.apply( results, context.getElementsByTagName( selector ) );
  1298. return results;
  1299. // Class selector
  1300. } else if ( (m = match[3]) && support.getElementsByClassName &&
  1301. context.getElementsByClassName ) {
  1302. push.apply( results, context.getElementsByClassName( m ) );
  1303. return results;
  1304. }
  1305. }
  1306. // Take advantage of querySelectorAll
  1307. if ( support.qsa &&
  1308. !compilerCache[ selector + " " ] &&
  1309. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  1310. if ( nodeType !== 1 ) {
  1311. newContext = context;
  1312. newSelector = selector;
  1313. // qSA looks outside Element context, which is not what we want
  1314. // Thanks to Andrew Dupont for this workaround technique
  1315. // Support: IE <=8
  1316. // Exclude object elements
  1317. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  1318. // Capture the context ID, setting it first if necessary
  1319. if ( (nid = context.getAttribute( "id" )) ) {
  1320. nid = nid.replace( rcssescape, fcssescape );
  1321. } else {
  1322. context.setAttribute( "id", (nid = expando) );
  1323. }
  1324. // Prefix every selector in the list
  1325. groups = tokenize( selector );
  1326. i = groups.length;
  1327. while ( i-- ) {
  1328. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  1329. }
  1330. newSelector = groups.join( "," );
  1331. // Expand context for sibling selectors
  1332. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  1333. context;
  1334. }
  1335. if ( newSelector ) {
  1336. try {
  1337. push.apply( results,
  1338. newContext.querySelectorAll( newSelector )
  1339. );
  1340. return results;
  1341. } catch ( qsaError ) {
  1342. } finally {
  1343. if ( nid === expando ) {
  1344. context.removeAttribute( "id" );
  1345. }
  1346. }
  1347. }
  1348. }
  1349. }
  1350. }
  1351. // All others
  1352. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  1353. }
  1354. /**
  1355. * Create key-value caches of limited size
  1356. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  1357. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1358. * deleting the oldest entry
  1359. */
  1360. function createCache() {
  1361. var keys = [];
  1362. function cache( key, value ) {
  1363. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  1364. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1365. // Only keep the most recent entries
  1366. delete cache[ keys.shift() ];
  1367. }
  1368. return (cache[ key + " " ] = value);
  1369. }
  1370. return cache;
  1371. }
  1372. /**
  1373. * Mark a function for special use by Sizzle
  1374. * @param {Function} fn The function to mark
  1375. */
  1376. function markFunction( fn ) {
  1377. fn[ expando ] = true;
  1378. return fn;
  1379. }
  1380. /**
  1381. * Support testing using an element
  1382. * @param {Function} fn Passed the created element and returns a boolean result
  1383. */
  1384. function assert( fn ) {
  1385. var el = document.createElement("fieldset");
  1386. try {
  1387. return !!fn( el );
  1388. } catch (e) {
  1389. return false;
  1390. } finally {
  1391. // Remove from its parent by default
  1392. if ( el.parentNode ) {
  1393. el.parentNode.removeChild( el );
  1394. }
  1395. // release memory in IE
  1396. el = null;
  1397. }
  1398. }
  1399. /**
  1400. * Adds the same handler for all of the specified attrs
  1401. * @param {String} attrs Pipe-separated list of attributes
  1402. * @param {Function} handler The method that will be applied
  1403. */
  1404. function addHandle( attrs, handler ) {
  1405. var arr = attrs.split("|"),
  1406. i = arr.length;
  1407. while ( i-- ) {
  1408. Expr.attrHandle[ arr[i] ] = handler;
  1409. }
  1410. }
  1411. /**
  1412. * Checks document order of two siblings
  1413. * @param {Element} a
  1414. * @param {Element} b
  1415. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  1416. */
  1417. function siblingCheck( a, b ) {
  1418. var cur = b && a,
  1419. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  1420. a.sourceIndex - b.sourceIndex;
  1421. // Use IE sourceIndex if available on both nodes
  1422. if ( diff ) {
  1423. return diff;
  1424. }
  1425. // Check if b follows a
  1426. if ( cur ) {
  1427. while ( (cur = cur.nextSibling) ) {
  1428. if ( cur === b ) {
  1429. return -1;
  1430. }
  1431. }
  1432. }
  1433. return a ? 1 : -1;
  1434. }
  1435. /**
  1436. * Returns a function to use in pseudos for input types
  1437. * @param {String} type
  1438. */
  1439. function createInputPseudo( type ) {
  1440. return function( elem ) {
  1441. var name = elem.nodeName.toLowerCase();
  1442. return name === "input" && elem.type === type;
  1443. };
  1444. }
  1445. /**
  1446. * Returns a function to use in pseudos for buttons
  1447. * @param {String} type
  1448. */
  1449. function createButtonPseudo( type ) {
  1450. return function( elem ) {
  1451. var name = elem.nodeName.toLowerCase();
  1452. return (name === "input" || name === "button") && elem.type === type;
  1453. };
  1454. }
  1455. /**
  1456. * Returns a function to use in pseudos for :enabled/:disabled
  1457. * @param {Boolean} disabled true for :disabled; false for :enabled
  1458. */
  1459. function createDisabledPseudo( disabled ) {
  1460. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  1461. return function( elem ) {
  1462. // Only certain elements can match :enabled or :disabled
  1463. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  1464. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  1465. if ( "form" in elem ) {
  1466. // Check for inherited disabledness on relevant non-disabled elements:
  1467. // * listed form-associated elements in a disabled fieldset
  1468. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  1469. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  1470. // * option elements in a disabled optgroup
  1471. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  1472. // All such elements have a "form" property.
  1473. if ( elem.parentNode && elem.disabled === false ) {
  1474. // Option elements defer to a parent optgroup if present
  1475. if ( "label" in elem ) {
  1476. if ( "label" in elem.parentNode ) {
  1477. return elem.parentNode.disabled === disabled;
  1478. } else {
  1479. return elem.disabled === disabled;
  1480. }
  1481. }
  1482. // Support: IE 6 - 11
  1483. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  1484. return elem.isDisabled === disabled ||
  1485. // Where there is no isDisabled, check manually
  1486. /* jshint -W018 */
  1487. elem.isDisabled !== !disabled &&
  1488. disabledAncestor( elem ) === disabled;
  1489. }
  1490. return elem.disabled === disabled;
  1491. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  1492. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  1493. // even exist on them, let alone have a boolean value.
  1494. } else if ( "label" in elem ) {
  1495. return elem.disabled === disabled;
  1496. }
  1497. // Remaining elements are neither :enabled nor :disabled
  1498. return false;
  1499. };
  1500. }
  1501. /**
  1502. * Returns a function to use in pseudos for positionals
  1503. * @param {Function} fn
  1504. */
  1505. function createPositionalPseudo( fn ) {
  1506. return markFunction(function( argument ) {
  1507. argument = +argument;
  1508. return markFunction(function( seed, matches ) {
  1509. var j,
  1510. matchIndexes = fn( [], seed.length, argument ),
  1511. i = matchIndexes.length;
  1512. // Match elements found at the specified indexes
  1513. while ( i-- ) {
  1514. if ( seed[ (j = matchIndexes[i]) ] ) {
  1515. seed[j] = !(matches[j] = seed[j]);
  1516. }
  1517. }
  1518. });
  1519. });
  1520. }
  1521. /**
  1522. * Checks a node for validity as a Sizzle context
  1523. * @param {Element|Object=} context
  1524. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  1525. */
  1526. function testContext( context ) {
  1527. return context && typeof context.getElementsByTagName !== "undefined" && context;
  1528. }
  1529. // Expose support vars for convenience
  1530. support = Sizzle.support = {};
  1531. /**
  1532. * Detects XML nodes
  1533. * @param {Element|Object} elem An element or a document
  1534. * @returns {Boolean} True iff elem is a non-HTML XML node
  1535. */
  1536. isXML = Sizzle.isXML = function( elem ) {
  1537. // documentElement is verified for cases where it doesn't yet exist
  1538. // (such as loading iframes in IE - #4833)
  1539. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  1540. return documentElement ? documentElement.nodeName !== "HTML" : false;
  1541. };
  1542. /**
  1543. * Sets document-related variables once based on the current document
  1544. * @param {Element|Object} [doc] An element or document object to use to set the document
  1545. * @returns {Object} Returns the current document
  1546. */
  1547. setDocument = Sizzle.setDocument = function( node ) {
  1548. var hasCompare, subWindow,
  1549. doc = node ? node.ownerDocument || node : preferredDoc;
  1550. // Return early if doc is invalid or already selected
  1551. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  1552. return document;
  1553. }
  1554. // Update global variables
  1555. document = doc;
  1556. docElem = document.documentElement;
  1557. documentIsHTML = !isXML( document );
  1558. // Support: IE 9-11, Edge
  1559. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  1560. if ( preferredDoc !== document &&
  1561. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  1562. // Support: IE 11, Edge
  1563. if ( subWindow.addEventListener ) {
  1564. subWindow.addEventListener( "unload", unloadHandler, false );
  1565. // Support: IE 9 - 10 only
  1566. } else if ( subWindow.attachEvent ) {
  1567. subWindow.attachEvent( "onunload", unloadHandler );
  1568. }
  1569. }
  1570. /* Attributes
  1571. ---------------------------------------------------------------------- */
  1572. // Support: IE<8
  1573. // Verify that getAttribute really returns attributes and not properties
  1574. // (excepting IE8 booleans)
  1575. support.attributes = assert(function( el ) {
  1576. el.className = "i";
  1577. return !el.getAttribute("className");
  1578. });
  1579. /* getElement(s)By*
  1580. ---------------------------------------------------------------------- */
  1581. // Check if getElementsByTagName("*") returns only elements
  1582. support.getElementsByTagName = assert(function( el ) {
  1583. el.appendChild( document.createComment("") );
  1584. return !el.getElementsByTagName("*").length;
  1585. });
  1586. // Support: IE<9
  1587. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  1588. // Support: IE<10
  1589. // Check if getElementById returns elements by name
  1590. // The broken getElementById methods don't pick up programmatically-set names,
  1591. // so use a roundabout getElementsByName test
  1592. support.getById = assert(function( el ) {
  1593. docElem.appendChild( el ).id = expando;
  1594. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  1595. });
  1596. // ID filter and find
  1597. if ( support.getById ) {
  1598. Expr.filter["ID"] = function( id ) {
  1599. var attrId = id.replace( runescape, funescape );
  1600. return function( elem ) {
  1601. return elem.getAttribute("id") === attrId;
  1602. };
  1603. };
  1604. Expr.find["ID"] = function( id, context ) {
  1605. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1606. var elem = context.getElementById( id );
  1607. return elem ? [ elem ] : [];
  1608. }
  1609. };
  1610. } else {
  1611. Expr.filter["ID"] = function( id ) {
  1612. var attrId = id.replace( runescape, funescape );
  1613. return function( elem ) {
  1614. var node = typeof elem.getAttributeNode !== "undefined" &&
  1615. elem.getAttributeNode("id");
  1616. return node && node.value === attrId;
  1617. };
  1618. };
  1619. // Support: IE 6 - 7 only
  1620. // getElementById is not reliable as a find shortcut
  1621. Expr.find["ID"] = function( id, context ) {
  1622. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1623. var node, i, elems,
  1624. elem = context.getElementById( id );
  1625. if ( elem ) {
  1626. // Verify the id attribute
  1627. node = elem.getAttributeNode("id");
  1628. if ( node && node.value === id ) {
  1629. return [ elem ];
  1630. }
  1631. // Fall back on getElementsByName
  1632. elems = context.getElementsByName( id );
  1633. i = 0;
  1634. while ( (elem = elems[i++]) ) {
  1635. node = elem.getAttributeNode("id");
  1636. if ( node && node.value === id ) {
  1637. return [ elem ];
  1638. }
  1639. }
  1640. }
  1641. return [];
  1642. }
  1643. };
  1644. }
  1645. // Tag
  1646. Expr.find["TAG"] = support.getElementsByTagName ?
  1647. function( tag, context ) {
  1648. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1649. return context.getElementsByTagName( tag );
  1650. // DocumentFragment nodes don't have gEBTN
  1651. } else if ( support.qsa ) {
  1652. return context.querySelectorAll( tag );
  1653. }
  1654. } :
  1655. function( tag, context ) {
  1656. var elem,
  1657. tmp = [],
  1658. i = 0,
  1659. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  1660. results = context.getElementsByTagName( tag );
  1661. // Filter out possible comments
  1662. if ( tag === "*" ) {
  1663. while ( (elem = results[i++]) ) {
  1664. if ( elem.nodeType === 1 ) {
  1665. tmp.push( elem );
  1666. }
  1667. }
  1668. return tmp;
  1669. }
  1670. return results;
  1671. };
  1672. // Class
  1673. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  1674. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1675. return context.getElementsByClassName( className );
  1676. }
  1677. };
  1678. /* QSA/matchesSelector
  1679. ---------------------------------------------------------------------- */
  1680. // QSA and matchesSelector support
  1681. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1682. rbuggyMatches = [];
  1683. // qSa(:focus) reports false when true (Chrome 21)
  1684. // We allow this because of a bug in IE8/9 that throws an error
  1685. // whenever `document.activeElement` is accessed on an iframe
  1686. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1687. // See https://bugs.jquery.com/ticket/13378
  1688. rbuggyQSA = [];
  1689. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1690. // Build QSA regex
  1691. // Regex strategy adopted from Diego Perini
  1692. assert(function( el ) {
  1693. // Select is set to empty string on purpose
  1694. // This is to test IE's treatment of not explicitly
  1695. // setting a boolean content attribute,
  1696. // since its presence should be enough
  1697. // https://bugs.jquery.com/ticket/12359
  1698. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1699. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1700. "<option selected=''></option></select>";
  1701. // Support: IE8, Opera 11-12.16
  1702. // Nothing should be selected when empty strings follow ^= or $= or *=
  1703. // The test attribute must be unknown in Opera but "safe" for WinRT
  1704. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1705. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1706. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1707. }
  1708. // Support: IE8
  1709. // Boolean attributes and "value" are not treated correctly
  1710. if ( !el.querySelectorAll("[selected]").length ) {
  1711. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1712. }
  1713. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1714. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1715. rbuggyQSA.push("~=");
  1716. }
  1717. // Webkit/Opera - :checked should return selected option elements
  1718. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1719. // IE8 throws error here and will not see later tests
  1720. if ( !el.querySelectorAll(":checked").length ) {
  1721. rbuggyQSA.push(":checked");
  1722. }
  1723. // Support: Safari 8+, iOS 8+
  1724. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1725. // In-page `selector#id sibling-combinator selector` fails
  1726. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1727. rbuggyQSA.push(".#.+[+~]");
  1728. }
  1729. });
  1730. assert(function( el ) {
  1731. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1732. "<select disabled='disabled'><option/></select>";
  1733. // Support: Windows 8 Native Apps
  1734. // The type and name attributes are restricted during .innerHTML assignment
  1735. var input = document.createElement("input");
  1736. input.setAttribute( "type", "hidden" );
  1737. el.appendChild( input ).setAttribute( "name", "D" );
  1738. // Support: IE8
  1739. // Enforce case-sensitivity of name attribute
  1740. if ( el.querySelectorAll("[name=d]").length ) {
  1741. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1742. }
  1743. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1744. // IE8 throws error here and will not see later tests
  1745. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1746. rbuggyQSA.push( ":enabled", ":disabled" );
  1747. }
  1748. // Support: IE9-11+
  1749. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1750. docElem.appendChild( el ).disabled = true;
  1751. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1752. rbuggyQSA.push( ":enabled", ":disabled" );
  1753. }
  1754. // Opera 10-11 does not throw on post-comma invalid pseudos
  1755. el.querySelectorAll("*,:x");
  1756. rbuggyQSA.push(",.*:");
  1757. });
  1758. }
  1759. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1760. docElem.webkitMatchesSelector ||
  1761. docElem.mozMatchesSelector ||
  1762. docElem.oMatchesSelector ||
  1763. docElem.msMatchesSelector) )) ) {
  1764. assert(function( el ) {
  1765. // Check to see if it's possible to do matchesSelector
  1766. // on a disconnected node (IE 9)
  1767. support.disconnectedMatch = matches.call( el, "*" );
  1768. // This should fail with an exception
  1769. // Gecko does not error, returns false instead
  1770. matches.call( el, "[s!='']:x" );
  1771. rbuggyMatches.push( "!=", pseudos );
  1772. });
  1773. }
  1774. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1775. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1776. /* Contains
  1777. ---------------------------------------------------------------------- */
  1778. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1779. // Element contains another
  1780. // Purposefully self-exclusive
  1781. // As in, an element does not contain itself
  1782. contains = hasCompare || rnative.test( docElem.contains ) ?
  1783. function( a, b ) {
  1784. var adown = a.nodeType === 9 ? a.documentElement : a,
  1785. bup = b && b.parentNode;
  1786. return a === bup || !!( bup && bup.nodeType === 1 && (
  1787. adown.contains ?
  1788. adown.contains( bup ) :
  1789. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1790. ));
  1791. } :
  1792. function( a, b ) {
  1793. if ( b ) {
  1794. while ( (b = b.parentNode) ) {
  1795. if ( b === a ) {
  1796. return true;
  1797. }
  1798. }
  1799. }
  1800. return false;
  1801. };
  1802. /* Sorting
  1803. ---------------------------------------------------------------------- */
  1804. // Document order sorting
  1805. sortOrder = hasCompare ?
  1806. function( a, b ) {
  1807. // Flag for duplicate removal
  1808. if ( a === b ) {
  1809. hasDuplicate = true;
  1810. return 0;
  1811. }
  1812. // Sort on method existence if only one input has compareDocumentPosition
  1813. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1814. if ( compare ) {
  1815. return compare;
  1816. }
  1817. // Calculate position if both inputs belong to the same document
  1818. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1819. a.compareDocumentPosition( b ) :
  1820. // Otherwise we know they are disconnected
  1821. 1;
  1822. // Disconnected nodes
  1823. if ( compare & 1 ||
  1824. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1825. // Choose the first element that is related to our preferred document
  1826. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1827. return -1;
  1828. }
  1829. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1830. return 1;
  1831. }
  1832. // Maintain original order
  1833. return sortInput ?
  1834. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1835. 0;
  1836. }
  1837. return compare & 4 ? -1 : 1;
  1838. } :
  1839. function( a, b ) {
  1840. // Exit early if the nodes are identical
  1841. if ( a === b ) {
  1842. hasDuplicate = true;
  1843. return 0;
  1844. }
  1845. var cur,
  1846. i = 0,
  1847. aup = a.parentNode,
  1848. bup = b.parentNode,
  1849. ap = [ a ],
  1850. bp = [ b ];
  1851. // Parentless nodes are either documents or disconnected
  1852. if ( !aup || !bup ) {
  1853. return a === document ? -1 :
  1854. b === document ? 1 :
  1855. aup ? -1 :
  1856. bup ? 1 :
  1857. sortInput ?
  1858. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1859. 0;
  1860. // If the nodes are siblings, we can do a quick check
  1861. } else if ( aup === bup ) {
  1862. return siblingCheck( a, b );
  1863. }
  1864. // Otherwise we need full lists of their ancestors for comparison
  1865. cur = a;
  1866. while ( (cur = cur.parentNode) ) {
  1867. ap.unshift( cur );
  1868. }
  1869. cur = b;
  1870. while ( (cur = cur.parentNode) ) {
  1871. bp.unshift( cur );
  1872. }
  1873. // Walk down the tree looking for a discrepancy
  1874. while ( ap[i] === bp[i] ) {
  1875. i++;
  1876. }
  1877. return i ?
  1878. // Do a sibling check if the nodes have a common ancestor
  1879. siblingCheck( ap[i], bp[i] ) :
  1880. // Otherwise nodes in our document sort first
  1881. ap[i] === preferredDoc ? -1 :
  1882. bp[i] === preferredDoc ? 1 :
  1883. 0;
  1884. };
  1885. return document;
  1886. };
  1887. Sizzle.matches = function( expr, elements ) {
  1888. return Sizzle( expr, null, null, elements );
  1889. };
  1890. Sizzle.matchesSelector = function( elem, expr ) {
  1891. // Set document vars if needed
  1892. if ( ( elem.ownerDocument || elem ) !== document ) {
  1893. setDocument( elem );
  1894. }
  1895. // Make sure that attribute selectors are quoted
  1896. expr = expr.replace( rattributeQuotes, "='$1']" );
  1897. if ( support.matchesSelector && documentIsHTML &&
  1898. !compilerCache[ expr + " " ] &&
  1899. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1900. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1901. try {
  1902. var ret = matches.call( elem, expr );
  1903. // IE 9's matchesSelector returns false on disconnected nodes
  1904. if ( ret || support.disconnectedMatch ||
  1905. // As well, disconnected nodes are said to be in a document
  1906. // fragment in IE 9
  1907. elem.document && elem.document.nodeType !== 11 ) {
  1908. return ret;
  1909. }
  1910. } catch (e) {}
  1911. }
  1912. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1913. };
  1914. Sizzle.contains = function( context, elem ) {
  1915. // Set document vars if needed
  1916. if ( ( context.ownerDocument || context ) !== document ) {
  1917. setDocument( context );
  1918. }
  1919. return contains( context, elem );
  1920. };
  1921. Sizzle.attr = function( elem, name ) {
  1922. // Set document vars if needed
  1923. if ( ( elem.ownerDocument || elem ) !== document ) {
  1924. setDocument( elem );
  1925. }
  1926. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1927. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1928. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1929. fn( elem, name, !documentIsHTML ) :
  1930. undefined;
  1931. return val !== undefined ?
  1932. val :
  1933. support.attributes || !documentIsHTML ?
  1934. elem.getAttribute( name ) :
  1935. (val = elem.getAttributeNode(name)) && val.specified ?
  1936. val.value :
  1937. null;
  1938. };
  1939. Sizzle.escape = function( sel ) {
  1940. return (sel + "").replace( rcssescape, fcssescape );
  1941. };
  1942. Sizzle.error = function( msg ) {
  1943. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1944. };
  1945. /**
  1946. * Document sorting and removing duplicates
  1947. * @param {ArrayLike} results
  1948. */
  1949. Sizzle.uniqueSort = function( results ) {
  1950. var elem,
  1951. duplicates = [],
  1952. j = 0,
  1953. i = 0;
  1954. // Unless we *know* we can detect duplicates, assume their presence
  1955. hasDuplicate = !support.detectDuplicates;
  1956. sortInput = !support.sortStable && results.slice( 0 );
  1957. results.sort( sortOrder );
  1958. if ( hasDuplicate ) {
  1959. while ( (elem = results[i++]) ) {
  1960. if ( elem === results[ i ] ) {
  1961. j = duplicates.push( i );
  1962. }
  1963. }
  1964. while ( j-- ) {
  1965. results.splice( duplicates[ j ], 1 );
  1966. }
  1967. }
  1968. // Clear input after sorting to release objects
  1969. // See https://github.com/jquery/sizzle/pull/225
  1970. sortInput = null;
  1971. return results;
  1972. };
  1973. /**
  1974. * Utility function for retrieving the text value of an array of DOM nodes
  1975. * @param {Array|Element} elem
  1976. */
  1977. getText = Sizzle.getText = function( elem ) {
  1978. var node,
  1979. ret = "",
  1980. i = 0,
  1981. nodeType = elem.nodeType;
  1982. if ( !nodeType ) {
  1983. // If no nodeType, this is expected to be an array
  1984. while ( (node = elem[i++]) ) {
  1985. // Do not traverse comment nodes
  1986. ret += getText( node );
  1987. }
  1988. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1989. // Use textContent for elements
  1990. // innerText usage removed for consistency of new lines (jQuery #11153)
  1991. if ( typeof elem.textContent === "string" ) {
  1992. return elem.textContent;
  1993. } else {
  1994. // Traverse its children
  1995. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1996. ret += getText( elem );
  1997. }
  1998. }
  1999. } else if ( nodeType === 3 || nodeType === 4 ) {
  2000. return elem.nodeValue;
  2001. }
  2002. // Do not include comment or processing instruction nodes
  2003. return ret;
  2004. };
  2005. Expr = Sizzle.selectors = {
  2006. // Can be adjusted by the user
  2007. cacheLength: 50,
  2008. createPseudo: markFunction,
  2009. match: matchExpr,
  2010. attrHandle: {},
  2011. find: {},
  2012. relative: {
  2013. ">": { dir: "parentNode", first: true },
  2014. " ": { dir: "parentNode" },
  2015. "+": { dir: "previousSibling", first: true },
  2016. "~": { dir: "previousSibling" }
  2017. },
  2018. preFilter: {
  2019. "ATTR": function( match ) {
  2020. match[1] = match[1].replace( runescape, funescape );
  2021. // Move the given value to match[3] whether quoted or unquoted
  2022. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  2023. if ( match[2] === "~=" ) {
  2024. match[3] = " " + match[3] + " ";
  2025. }
  2026. return match.slice( 0, 4 );
  2027. },
  2028. "CHILD": function( match ) {
  2029. /* matches from matchExpr["CHILD"]
  2030. 1 type (only|nth|...)
  2031. 2 what (child|of-type)
  2032. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  2033. 4 xn-component of xn+y argument ([+-]?\d*n|)
  2034. 5 sign of xn-component
  2035. 6 x of xn-component
  2036. 7 sign of y-component
  2037. 8 y of y-component
  2038. */
  2039. match[1] = match[1].toLowerCase();
  2040. if ( match[1].slice( 0, 3 ) === "nth" ) {
  2041. // nth-* requires argument
  2042. if ( !match[3] ) {
  2043. Sizzle.error( match[0] );
  2044. }
  2045. // numeric x and y parameters for Expr.filter.CHILD
  2046. // remember that false/true cast respectively to 0/1
  2047. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  2048. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  2049. // other types prohibit arguments
  2050. } else if ( match[3] ) {
  2051. Sizzle.error( match[0] );
  2052. }
  2053. return match;
  2054. },
  2055. "PSEUDO": function( match ) {
  2056. var excess,
  2057. unquoted = !match[6] && match[2];
  2058. if ( matchExpr["CHILD"].test( match[0] ) ) {
  2059. return null;
  2060. }
  2061. // Accept quoted arguments as-is
  2062. if ( match[3] ) {
  2063. match[2] = match[4] || match[5] || "";
  2064. // Strip excess characters from unquoted arguments
  2065. } else if ( unquoted && rpseudo.test( unquoted ) &&
  2066. // Get excess from tokenize (recursively)
  2067. (excess = tokenize( unquoted, true )) &&
  2068. // advance to the next closing parenthesis
  2069. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  2070. // excess is a negative index
  2071. match[0] = match[0].slice( 0, excess );
  2072. match[2] = unquoted.slice( 0, excess );
  2073. }
  2074. // Return only captures needed by the pseudo filter method (type and argument)
  2075. return match.slice( 0, 3 );
  2076. }
  2077. },
  2078. filter: {
  2079. "TAG": function( nodeNameSelector ) {
  2080. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  2081. return nodeNameSelector === "*" ?
  2082. function() { return true; } :
  2083. function( elem ) {
  2084. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  2085. };
  2086. },
  2087. "CLASS": function( className ) {
  2088. var pattern = classCache[ className + " " ];
  2089. return pattern ||
  2090. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  2091. classCache( className, function( elem ) {
  2092. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  2093. });
  2094. },
  2095. "ATTR": function( name, operator, check ) {
  2096. return function( elem ) {
  2097. var result = Sizzle.attr( elem, name );
  2098. if ( result == null ) {
  2099. return operator === "!=";
  2100. }
  2101. if ( !operator ) {
  2102. return true;
  2103. }
  2104. result += "";
  2105. return operator === "=" ? result === check :
  2106. operator === "!=" ? result !== check :
  2107. operator === "^=" ? check && result.indexOf( check ) === 0 :
  2108. operator === "*=" ? check && result.indexOf( check ) > -1 :
  2109. operator === "$=" ? check && result.slice( -check.length ) === check :
  2110. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  2111. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  2112. false;
  2113. };
  2114. },
  2115. "CHILD": function( type, what, argument, first, last ) {
  2116. var simple = type.slice( 0, 3 ) !== "nth",
  2117. forward = type.slice( -4 ) !== "last",
  2118. ofType = what === "of-type";
  2119. return first === 1 && last === 0 ?
  2120. // Shortcut for :nth-*(n)
  2121. function( elem ) {
  2122. return !!elem.parentNode;
  2123. } :
  2124. function( elem, context, xml ) {
  2125. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  2126. dir = simple !== forward ? "nextSibling" : "previousSibling",
  2127. parent = elem.parentNode,
  2128. name = ofType && elem.nodeName.toLowerCase(),
  2129. useCache = !xml && !ofType,
  2130. diff = false;
  2131. if ( parent ) {
  2132. // :(first|last|only)-(child|of-type)
  2133. if ( simple ) {
  2134. while ( dir ) {
  2135. node = elem;
  2136. while ( (node = node[ dir ]) ) {
  2137. if ( ofType ?
  2138. node.nodeName.toLowerCase() === name :
  2139. node.nodeType === 1 ) {
  2140. return false;
  2141. }
  2142. }
  2143. // Reverse direction for :only-* (if we haven't yet done so)
  2144. start = dir = type === "only" && !start && "nextSibling";
  2145. }
  2146. return true;
  2147. }
  2148. start = [ forward ? parent.firstChild : parent.lastChild ];
  2149. // non-xml :nth-child(...) stores cache data on `parent`
  2150. if ( forward && useCache ) {
  2151. // Seek `elem` from a previously-cached index
  2152. // ...in a gzip-friendly way
  2153. node = parent;
  2154. outerCache = node[ expando ] || (node[ expando ] = {});
  2155. // Support: IE <9 only
  2156. // Defend against cloned attroperties (jQuery gh-1709)
  2157. uniqueCache = outerCache[ node.uniqueID ] ||
  2158. (outerCache[ node.uniqueID ] = {});
  2159. cache = uniqueCache[ type ] || [];
  2160. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2161. diff = nodeIndex && cache[ 2 ];
  2162. node = nodeIndex && parent.childNodes[ nodeIndex ];
  2163. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2164. // Fallback to seeking `elem` from the start
  2165. (diff = nodeIndex = 0) || start.pop()) ) {
  2166. // When found, cache indexes on `parent` and break
  2167. if ( node.nodeType === 1 && ++diff && node === elem ) {
  2168. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  2169. break;
  2170. }
  2171. }
  2172. } else {
  2173. // Use previously-cached element index if available
  2174. if ( useCache ) {
  2175. // ...in a gzip-friendly way
  2176. node = elem;
  2177. outerCache = node[ expando ] || (node[ expando ] = {});
  2178. // Support: IE <9 only
  2179. // Defend against cloned attroperties (jQuery gh-1709)
  2180. uniqueCache = outerCache[ node.uniqueID ] ||
  2181. (outerCache[ node.uniqueID ] = {});
  2182. cache = uniqueCache[ type ] || [];
  2183. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2184. diff = nodeIndex;
  2185. }
  2186. // xml :nth-child(...)
  2187. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  2188. if ( diff === false ) {
  2189. // Use the same loop as above to seek `elem` from the start
  2190. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2191. (diff = nodeIndex = 0) || start.pop()) ) {
  2192. if ( ( ofType ?
  2193. node.nodeName.toLowerCase() === name :
  2194. node.nodeType === 1 ) &&
  2195. ++diff ) {
  2196. // Cache the index of each encountered element
  2197. if ( useCache ) {
  2198. outerCache = node[ expando ] || (node[ expando ] = {});
  2199. // Support: IE <9 only
  2200. // Defend against cloned attroperties (jQuery gh-1709)
  2201. uniqueCache = outerCache[ node.uniqueID ] ||
  2202. (outerCache[ node.uniqueID ] = {});
  2203. uniqueCache[ type ] = [ dirruns, diff ];
  2204. }
  2205. if ( node === elem ) {
  2206. break;
  2207. }
  2208. }
  2209. }
  2210. }
  2211. }
  2212. // Incorporate the offset, then check against cycle size
  2213. diff -= last;
  2214. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  2215. }
  2216. };
  2217. },
  2218. "PSEUDO": function( pseudo, argument ) {
  2219. // pseudo-class names are case-insensitive
  2220. // http://www.w3.org/TR/selectors/#pseudo-classes
  2221. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  2222. // Remember that setFilters inherits from pseudos
  2223. var args,
  2224. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  2225. Sizzle.error( "unsupported pseudo: " + pseudo );
  2226. // The user may use createPseudo to indicate that
  2227. // arguments are needed to create the filter function
  2228. // just as Sizzle does
  2229. if ( fn[ expando ] ) {
  2230. return fn( argument );
  2231. }
  2232. // But maintain support for old signatures
  2233. if ( fn.length > 1 ) {
  2234. args = [ pseudo, pseudo, "", argument ];
  2235. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  2236. markFunction(function( seed, matches ) {
  2237. var idx,
  2238. matched = fn( seed, argument ),
  2239. i = matched.length;
  2240. while ( i-- ) {
  2241. idx = indexOf( seed, matched[i] );
  2242. seed[ idx ] = !( matches[ idx ] = matched[i] );
  2243. }
  2244. }) :
  2245. function( elem ) {
  2246. return fn( elem, 0, args );
  2247. };
  2248. }
  2249. return fn;
  2250. }
  2251. },
  2252. pseudos: {
  2253. // Potentially complex pseudos
  2254. "not": markFunction(function( selector ) {
  2255. // Trim the selector passed to compile
  2256. // to avoid treating leading and trailing
  2257. // spaces as combinators
  2258. var input = [],
  2259. results = [],
  2260. matcher = compile( selector.replace( rtrim, "$1" ) );
  2261. return matcher[ expando ] ?
  2262. markFunction(function( seed, matches, context, xml ) {
  2263. var elem,
  2264. unmatched = matcher( seed, null, xml, [] ),
  2265. i = seed.length;
  2266. // Match elements unmatched by `matcher`
  2267. while ( i-- ) {
  2268. if ( (elem = unmatched[i]) ) {
  2269. seed[i] = !(matches[i] = elem);
  2270. }
  2271. }
  2272. }) :
  2273. function( elem, context, xml ) {
  2274. input[0] = elem;
  2275. matcher( input, null, xml, results );
  2276. // Don't keep the element (issue #299)
  2277. input[0] = null;
  2278. return !results.pop();
  2279. };
  2280. }),
  2281. "has": markFunction(function( selector ) {
  2282. return function( elem ) {
  2283. return Sizzle( selector, elem ).length > 0;
  2284. };
  2285. }),
  2286. "contains": markFunction(function( text ) {
  2287. text = text.replace( runescape, funescape );
  2288. return function( elem ) {
  2289. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  2290. };
  2291. }),
  2292. // "Whether an element is represented by a :lang() selector
  2293. // is based solely on the element's language value
  2294. // being equal to the identifier C,
  2295. // or beginning with the identifier C immediately followed by "-".
  2296. // The matching of C against the element's language value is performed case-insensitively.
  2297. // The identifier C does not have to be a valid language name."
  2298. // http://www.w3.org/TR/selectors/#lang-pseudo
  2299. "lang": markFunction( function( lang ) {
  2300. // lang value must be a valid identifier
  2301. if ( !ridentifier.test(lang || "") ) {
  2302. Sizzle.error( "unsupported lang: " + lang );
  2303. }
  2304. lang = lang.replace( runescape, funescape ).toLowerCase();
  2305. return function( elem ) {
  2306. var elemLang;
  2307. do {
  2308. if ( (elemLang = documentIsHTML ?
  2309. elem.lang :
  2310. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  2311. elemLang = elemLang.toLowerCase();
  2312. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  2313. }
  2314. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  2315. return false;
  2316. };
  2317. }),
  2318. // Miscellaneous
  2319. "target": function( elem ) {
  2320. var hash = window.location && window.location.hash;
  2321. return hash && hash.slice( 1 ) === elem.id;
  2322. },
  2323. "root": function( elem ) {
  2324. return elem === docElem;
  2325. },
  2326. "focus": function( elem ) {
  2327. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  2328. },
  2329. // Boolean properties
  2330. "enabled": createDisabledPseudo( false ),
  2331. "disabled": createDisabledPseudo( true ),
  2332. "checked": function( elem ) {
  2333. // In CSS3, :checked should return both checked and selected elements
  2334. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2335. var nodeName = elem.nodeName.toLowerCase();
  2336. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  2337. },
  2338. "selected": function( elem ) {
  2339. // Accessing this property makes selected-by-default
  2340. // options in Safari work properly
  2341. if ( elem.parentNode ) {
  2342. elem.parentNode.selectedIndex;
  2343. }
  2344. return elem.selected === true;
  2345. },
  2346. // Contents
  2347. "empty": function( elem ) {
  2348. // http://www.w3.org/TR/selectors/#empty-pseudo
  2349. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  2350. // but not by others (comment: 8; processing instruction: 7; etc.)
  2351. // nodeType < 6 works because attributes (2) do not appear as children
  2352. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2353. if ( elem.nodeType < 6 ) {
  2354. return false;
  2355. }
  2356. }
  2357. return true;
  2358. },
  2359. "parent": function( elem ) {
  2360. return !Expr.pseudos["empty"]( elem );
  2361. },
  2362. // Element/input types
  2363. "header": function( elem ) {
  2364. return rheader.test( elem.nodeName );
  2365. },
  2366. "input": function( elem ) {
  2367. return rinputs.test( elem.nodeName );
  2368. },
  2369. "button": function( elem ) {
  2370. var name = elem.nodeName.toLowerCase();
  2371. return name === "input" && elem.type === "button" || name === "button";
  2372. },
  2373. "text": function( elem ) {
  2374. var attr;
  2375. return elem.nodeName.toLowerCase() === "input" &&
  2376. elem.type === "text" &&
  2377. // Support: IE<8
  2378. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  2379. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  2380. },
  2381. // Position-in-collection
  2382. "first": createPositionalPseudo(function() {
  2383. return [ 0 ];
  2384. }),
  2385. "last": createPositionalPseudo(function( matchIndexes, length ) {
  2386. return [ length - 1 ];
  2387. }),
  2388. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2389. return [ argument < 0 ? argument + length : argument ];
  2390. }),
  2391. "even": createPositionalPseudo(function( matchIndexes, length ) {
  2392. var i = 0;
  2393. for ( ; i < length; i += 2 ) {
  2394. matchIndexes.push( i );
  2395. }
  2396. return matchIndexes;
  2397. }),
  2398. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  2399. var i = 1;
  2400. for ( ; i < length; i += 2 ) {
  2401. matchIndexes.push( i );
  2402. }
  2403. return matchIndexes;
  2404. }),
  2405. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2406. var i = argument < 0 ? argument + length : argument;
  2407. for ( ; --i >= 0; ) {
  2408. matchIndexes.push( i );
  2409. }
  2410. return matchIndexes;
  2411. }),
  2412. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2413. var i = argument < 0 ? argument + length : argument;
  2414. for ( ; ++i < length; ) {
  2415. matchIndexes.push( i );
  2416. }
  2417. return matchIndexes;
  2418. })
  2419. }
  2420. };
  2421. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  2422. // Add button/input type pseudos
  2423. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  2424. Expr.pseudos[ i ] = createInputPseudo( i );
  2425. }
  2426. for ( i in { submit: true, reset: true } ) {
  2427. Expr.pseudos[ i ] = createButtonPseudo( i );
  2428. }
  2429. // Easy API for creating new setFilters
  2430. function setFilters() {}
  2431. setFilters.prototype = Expr.filters = Expr.pseudos;
  2432. Expr.setFilters = new setFilters();
  2433. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  2434. var matched, match, tokens, type,
  2435. soFar, groups, preFilters,
  2436. cached = tokenCache[ selector + " " ];
  2437. if ( cached ) {
  2438. return parseOnly ? 0 : cached.slice( 0 );
  2439. }
  2440. soFar = selector;
  2441. groups = [];
  2442. preFilters = Expr.preFilter;
  2443. while ( soFar ) {
  2444. // Comma and first run
  2445. if ( !matched || (match = rcomma.exec( soFar )) ) {
  2446. if ( match ) {
  2447. // Don't consume trailing commas as valid
  2448. soFar = soFar.slice( match[0].length ) || soFar;
  2449. }
  2450. groups.push( (tokens = []) );
  2451. }
  2452. matched = false;
  2453. // Combinators
  2454. if ( (match = rcombinators.exec( soFar )) ) {
  2455. matched = match.shift();
  2456. tokens.push({
  2457. value: matched,
  2458. // Cast descendant combinators to space
  2459. type: match[0].replace( rtrim, " " )
  2460. });
  2461. soFar = soFar.slice( matched.length );
  2462. }
  2463. // Filters
  2464. for ( type in Expr.filter ) {
  2465. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  2466. (match = preFilters[ type ]( match ))) ) {
  2467. matched = match.shift();
  2468. tokens.push({
  2469. value: matched,
  2470. type: type,
  2471. matches: match
  2472. });
  2473. soFar = soFar.slice( matched.length );
  2474. }
  2475. }
  2476. if ( !matched ) {
  2477. break;
  2478. }
  2479. }
  2480. // Return the length of the invalid excess
  2481. // if we're just parsing
  2482. // Otherwise, throw an error or return tokens
  2483. return parseOnly ?
  2484. soFar.length :
  2485. soFar ?
  2486. Sizzle.error( selector ) :
  2487. // Cache the tokens
  2488. tokenCache( selector, groups ).slice( 0 );
  2489. };
  2490. function toSelector( tokens ) {
  2491. var i = 0,
  2492. len = tokens.length,
  2493. selector = "";
  2494. for ( ; i < len; i++ ) {
  2495. selector += tokens[i].value;
  2496. }
  2497. return selector;
  2498. }
  2499. function addCombinator( matcher, combinator, base ) {
  2500. var dir = combinator.dir,
  2501. skip = combinator.next,
  2502. key = skip || dir,
  2503. checkNonElements = base && key === "parentNode",
  2504. doneName = done++;
  2505. return combinator.first ?
  2506. // Check against closest ancestor/preceding element
  2507. function( elem, context, xml ) {
  2508. while ( (elem = elem[ dir ]) ) {
  2509. if ( elem.nodeType === 1 || checkNonElements ) {
  2510. return matcher( elem, context, xml );
  2511. }
  2512. }
  2513. return false;
  2514. } :
  2515. // Check against all ancestor/preceding elements
  2516. function( elem, context, xml ) {
  2517. var oldCache, uniqueCache, outerCache,
  2518. newCache = [ dirruns, doneName ];
  2519. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  2520. if ( xml ) {
  2521. while ( (elem = elem[ dir ]) ) {
  2522. if ( elem.nodeType === 1 || checkNonElements ) {
  2523. if ( matcher( elem, context, xml ) ) {
  2524. return true;
  2525. }
  2526. }
  2527. }
  2528. } else {
  2529. while ( (elem = elem[ dir ]) ) {
  2530. if ( elem.nodeType === 1 || checkNonElements ) {
  2531. outerCache = elem[ expando ] || (elem[ expando ] = {});
  2532. // Support: IE <9 only
  2533. // Defend against cloned attroperties (jQuery gh-1709)
  2534. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  2535. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  2536. elem = elem[ dir ] || elem;
  2537. } else if ( (oldCache = uniqueCache[ key ]) &&
  2538. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  2539. // Assign to newCache so results back-propagate to previous elements
  2540. return (newCache[ 2 ] = oldCache[ 2 ]);
  2541. } else {
  2542. // Reuse newcache so results back-propagate to previous elements
  2543. uniqueCache[ key ] = newCache;
  2544. // A match means we're done; a fail means we have to keep checking
  2545. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  2546. return true;
  2547. }
  2548. }
  2549. }
  2550. }
  2551. }
  2552. return false;
  2553. };
  2554. }
  2555. function elementMatcher( matchers ) {
  2556. return matchers.length > 1 ?
  2557. function( elem, context, xml ) {
  2558. var i = matchers.length;
  2559. while ( i-- ) {
  2560. if ( !matchers[i]( elem, context, xml ) ) {
  2561. return false;
  2562. }
  2563. }
  2564. return true;
  2565. } :
  2566. matchers[0];
  2567. }
  2568. function multipleContexts( selector, contexts, results ) {
  2569. var i = 0,
  2570. len = contexts.length;
  2571. for ( ; i < len; i++ ) {
  2572. Sizzle( selector, contexts[i], results );
  2573. }
  2574. return results;
  2575. }
  2576. function condense( unmatched, map, filter, context, xml ) {
  2577. var elem,
  2578. newUnmatched = [],
  2579. i = 0,
  2580. len = unmatched.length,
  2581. mapped = map != null;
  2582. for ( ; i < len; i++ ) {
  2583. if ( (elem = unmatched[i]) ) {
  2584. if ( !filter || filter( elem, context, xml ) ) {
  2585. newUnmatched.push( elem );
  2586. if ( mapped ) {
  2587. map.push( i );
  2588. }
  2589. }
  2590. }
  2591. }
  2592. return newUnmatched;
  2593. }
  2594. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2595. if ( postFilter && !postFilter[ expando ] ) {
  2596. postFilter = setMatcher( postFilter );
  2597. }
  2598. if ( postFinder && !postFinder[ expando ] ) {
  2599. postFinder = setMatcher( postFinder, postSelector );
  2600. }
  2601. return markFunction(function( seed, results, context, xml ) {
  2602. var temp, i, elem,
  2603. preMap = [],
  2604. postMap = [],
  2605. preexisting = results.length,
  2606. // Get initial elements from seed or context
  2607. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  2608. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2609. matcherIn = preFilter && ( seed || !selector ) ?
  2610. condense( elems, preMap, preFilter, context, xml ) :
  2611. elems,
  2612. matcherOut = matcher ?
  2613. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  2614. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2615. // ...intermediate processing is necessary
  2616. [] :
  2617. // ...otherwise use results directly
  2618. results :
  2619. matcherIn;
  2620. // Find primary matches
  2621. if ( matcher ) {
  2622. matcher( matcherIn, matcherOut, context, xml );
  2623. }
  2624. // Apply postFilter
  2625. if ( postFilter ) {
  2626. temp = condense( matcherOut, postMap );
  2627. postFilter( temp, [], context, xml );
  2628. // Un-match failing elements by moving them back to matcherIn
  2629. i = temp.length;
  2630. while ( i-- ) {
  2631. if ( (elem = temp[i]) ) {
  2632. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  2633. }
  2634. }
  2635. }
  2636. if ( seed ) {
  2637. if ( postFinder || preFilter ) {
  2638. if ( postFinder ) {
  2639. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2640. temp = [];
  2641. i = matcherOut.length;
  2642. while ( i-- ) {
  2643. if ( (elem = matcherOut[i]) ) {
  2644. // Restore matcherIn since elem is not yet a final match
  2645. temp.push( (matcherIn[i] = elem) );
  2646. }
  2647. }
  2648. postFinder( null, (matcherOut = []), temp, xml );
  2649. }
  2650. // Move matched elements from seed to results to keep them synchronized
  2651. i = matcherOut.length;
  2652. while ( i-- ) {
  2653. if ( (elem = matcherOut[i]) &&
  2654. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  2655. seed[temp] = !(results[temp] = elem);
  2656. }
  2657. }
  2658. }
  2659. // Add elements to results, through postFinder if defined
  2660. } else {
  2661. matcherOut = condense(
  2662. matcherOut === results ?
  2663. matcherOut.splice( preexisting, matcherOut.length ) :
  2664. matcherOut
  2665. );
  2666. if ( postFinder ) {
  2667. postFinder( null, results, matcherOut, xml );
  2668. } else {
  2669. push.apply( results, matcherOut );
  2670. }
  2671. }
  2672. });
  2673. }
  2674. function matcherFromTokens( tokens ) {
  2675. var checkContext, matcher, j,
  2676. len = tokens.length,
  2677. leadingRelative = Expr.relative[ tokens[0].type ],
  2678. implicitRelative = leadingRelative || Expr.relative[" "],
  2679. i = leadingRelative ? 1 : 0,
  2680. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2681. matchContext = addCombinator( function( elem ) {
  2682. return elem === checkContext;
  2683. }, implicitRelative, true ),
  2684. matchAnyContext = addCombinator( function( elem ) {
  2685. return indexOf( checkContext, elem ) > -1;
  2686. }, implicitRelative, true ),
  2687. matchers = [ function( elem, context, xml ) {
  2688. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2689. (checkContext = context).nodeType ?
  2690. matchContext( elem, context, xml ) :
  2691. matchAnyContext( elem, context, xml ) );
  2692. // Avoid hanging onto element (issue #299)
  2693. checkContext = null;
  2694. return ret;
  2695. } ];
  2696. for ( ; i < len; i++ ) {
  2697. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2698. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2699. } else {
  2700. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2701. // Return special upon seeing a positional matcher
  2702. if ( matcher[ expando ] ) {
  2703. // Find the next relative operator (if any) for proper handling
  2704. j = ++i;
  2705. for ( ; j < len; j++ ) {
  2706. if ( Expr.relative[ tokens[j].type ] ) {
  2707. break;
  2708. }
  2709. }
  2710. return setMatcher(
  2711. i > 1 && elementMatcher( matchers ),
  2712. i > 1 && toSelector(
  2713. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2714. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2715. ).replace( rtrim, "$1" ),
  2716. matcher,
  2717. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2718. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2719. j < len && toSelector( tokens )
  2720. );
  2721. }
  2722. matchers.push( matcher );
  2723. }
  2724. }
  2725. return elementMatcher( matchers );
  2726. }
  2727. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2728. var bySet = setMatchers.length > 0,
  2729. byElement = elementMatchers.length > 0,
  2730. superMatcher = function( seed, context, xml, results, outermost ) {
  2731. var elem, j, matcher,
  2732. matchedCount = 0,
  2733. i = "0",
  2734. unmatched = seed && [],
  2735. setMatched = [],
  2736. contextBackup = outermostContext,
  2737. // We must always have either seed elements or outermost context
  2738. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2739. // Use integer dirruns iff this is the outermost matcher
  2740. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2741. len = elems.length;
  2742. if ( outermost ) {
  2743. outermostContext = context === document || context || outermost;
  2744. }
  2745. // Add elements passing elementMatchers directly to results
  2746. // Support: IE<9, Safari
  2747. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2748. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2749. if ( byElement && elem ) {
  2750. j = 0;
  2751. if ( !context && elem.ownerDocument !== document ) {
  2752. setDocument( elem );
  2753. xml = !documentIsHTML;
  2754. }
  2755. while ( (matcher = elementMatchers[j++]) ) {
  2756. if ( matcher( elem, context || document, xml) ) {
  2757. results.push( elem );
  2758. break;
  2759. }
  2760. }
  2761. if ( outermost ) {
  2762. dirruns = dirrunsUnique;
  2763. }
  2764. }
  2765. // Track unmatched elements for set filters
  2766. if ( bySet ) {
  2767. // They will have gone through all possible matchers
  2768. if ( (elem = !matcher && elem) ) {
  2769. matchedCount--;
  2770. }
  2771. // Lengthen the array for every element, matched or not
  2772. if ( seed ) {
  2773. unmatched.push( elem );
  2774. }
  2775. }
  2776. }
  2777. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2778. // makes the latter nonnegative.
  2779. matchedCount += i;
  2780. // Apply set filters to unmatched elements
  2781. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2782. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2783. // no element matchers and no seed.
  2784. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2785. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2786. // numerically zero.
  2787. if ( bySet && i !== matchedCount ) {
  2788. j = 0;
  2789. while ( (matcher = setMatchers[j++]) ) {
  2790. matcher( unmatched, setMatched, context, xml );
  2791. }
  2792. if ( seed ) {
  2793. // Reintegrate element matches to eliminate the need for sorting
  2794. if ( matchedCount > 0 ) {
  2795. while ( i-- ) {
  2796. if ( !(unmatched[i] || setMatched[i]) ) {
  2797. setMatched[i] = pop.call( results );
  2798. }
  2799. }
  2800. }
  2801. // Discard index placeholder values to get only actual matches
  2802. setMatched = condense( setMatched );
  2803. }
  2804. // Add matches to results
  2805. push.apply( results, setMatched );
  2806. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2807. if ( outermost && !seed && setMatched.length > 0 &&
  2808. ( matchedCount + setMatchers.length ) > 1 ) {
  2809. Sizzle.uniqueSort( results );
  2810. }
  2811. }
  2812. // Override manipulation of globals by nested matchers
  2813. if ( outermost ) {
  2814. dirruns = dirrunsUnique;
  2815. outermostContext = contextBackup;
  2816. }
  2817. return unmatched;
  2818. };
  2819. return bySet ?
  2820. markFunction( superMatcher ) :
  2821. superMatcher;
  2822. }
  2823. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2824. var i,
  2825. setMatchers = [],
  2826. elementMatchers = [],
  2827. cached = compilerCache[ selector + " " ];
  2828. if ( !cached ) {
  2829. // Generate a function of recursive functions that can be used to check each element
  2830. if ( !match ) {
  2831. match = tokenize( selector );
  2832. }
  2833. i = match.length;
  2834. while ( i-- ) {
  2835. cached = matcherFromTokens( match[i] );
  2836. if ( cached[ expando ] ) {
  2837. setMatchers.push( cached );
  2838. } else {
  2839. elementMatchers.push( cached );
  2840. }
  2841. }
  2842. // Cache the compiled function
  2843. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2844. // Save selector and tokenization
  2845. cached.selector = selector;
  2846. }
  2847. return cached;
  2848. };
  2849. /**
  2850. * A low-level selection function that works with Sizzle's compiled
  2851. * selector functions
  2852. * @param {String|Function} selector A selector or a pre-compiled
  2853. * selector function built with Sizzle.compile
  2854. * @param {Element} context
  2855. * @param {Array} [results]
  2856. * @param {Array} [seed] A set of elements to match against
  2857. */
  2858. select = Sizzle.select = function( selector, context, results, seed ) {
  2859. var i, tokens, token, type, find,
  2860. compiled = typeof selector === "function" && selector,
  2861. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2862. results = results || [];
  2863. // Try to minimize operations if there is only one selector in the list and no seed
  2864. // (the latter of which guarantees us context)
  2865. if ( match.length === 1 ) {
  2866. // Reduce context if the leading compound selector is an ID
  2867. tokens = match[0] = match[0].slice( 0 );
  2868. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2869. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  2870. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2871. if ( !context ) {
  2872. return results;
  2873. // Precompiled matchers will still verify ancestry, so step up a level
  2874. } else if ( compiled ) {
  2875. context = context.parentNode;
  2876. }
  2877. selector = selector.slice( tokens.shift().value.length );
  2878. }
  2879. // Fetch a seed set for right-to-left matching
  2880. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2881. while ( i-- ) {
  2882. token = tokens[i];
  2883. // Abort if we hit a combinator
  2884. if ( Expr.relative[ (type = token.type) ] ) {
  2885. break;
  2886. }
  2887. if ( (find = Expr.find[ type ]) ) {
  2888. // Search, expanding context for leading sibling combinators
  2889. if ( (seed = find(
  2890. token.matches[0].replace( runescape, funescape ),
  2891. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2892. )) ) {
  2893. // If seed is empty or no tokens remain, we can return early
  2894. tokens.splice( i, 1 );
  2895. selector = seed.length && toSelector( tokens );
  2896. if ( !selector ) {
  2897. push.apply( results, seed );
  2898. return results;
  2899. }
  2900. break;
  2901. }
  2902. }
  2903. }
  2904. }
  2905. // Compile and execute a filtering function if one is not provided
  2906. // Provide `match` to avoid retokenization if we modified the selector above
  2907. ( compiled || compile( selector, match ) )(
  2908. seed,
  2909. context,
  2910. !documentIsHTML,
  2911. results,
  2912. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2913. );
  2914. return results;
  2915. };
  2916. // One-time assignments
  2917. // Sort stability
  2918. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2919. // Support: Chrome 14-35+
  2920. // Always assume duplicates if they aren't passed to the comparison function
  2921. support.detectDuplicates = !!hasDuplicate;
  2922. // Initialize against the default document
  2923. setDocument();
  2924. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2925. // Detached nodes confoundingly follow *each other*
  2926. support.sortDetached = assert(function( el ) {
  2927. // Should return 1, but returns 4 (following)
  2928. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  2929. });
  2930. // Support: IE<8
  2931. // Prevent attribute/property "interpolation"
  2932. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2933. if ( !assert(function( el ) {
  2934. el.innerHTML = "<a href='#'></a>";
  2935. return el.firstChild.getAttribute("href") === "#" ;
  2936. }) ) {
  2937. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2938. if ( !isXML ) {
  2939. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2940. }
  2941. });
  2942. }
  2943. // Support: IE<9
  2944. // Use defaultValue in place of getAttribute("value")
  2945. if ( !support.attributes || !assert(function( el ) {
  2946. el.innerHTML = "<input/>";
  2947. el.firstChild.setAttribute( "value", "" );
  2948. return el.firstChild.getAttribute( "value" ) === "";
  2949. }) ) {
  2950. addHandle( "value", function( elem, name, isXML ) {
  2951. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2952. return elem.defaultValue;
  2953. }
  2954. });
  2955. }
  2956. // Support: IE<9
  2957. // Use getAttributeNode to fetch booleans when getAttribute lies
  2958. if ( !assert(function( el ) {
  2959. return el.getAttribute("disabled") == null;
  2960. }) ) {
  2961. addHandle( booleans, function( elem, name, isXML ) {
  2962. var val;
  2963. if ( !isXML ) {
  2964. return elem[ name ] === true ? name.toLowerCase() :
  2965. (val = elem.getAttributeNode( name )) && val.specified ?
  2966. val.value :
  2967. null;
  2968. }
  2969. });
  2970. }
  2971. return Sizzle;
  2972. })( window );
  2973. jQuery.find = Sizzle;
  2974. jQuery.expr = Sizzle.selectors;
  2975. // Deprecated
  2976. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2977. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2978. jQuery.text = Sizzle.getText;
  2979. jQuery.isXMLDoc = Sizzle.isXML;
  2980. jQuery.contains = Sizzle.contains;
  2981. jQuery.escapeSelector = Sizzle.escape;
  2982. var dir = function( elem, dir, until ) {
  2983. var matched = [],
  2984. truncate = until !== undefined;
  2985. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2986. if ( elem.nodeType === 1 ) {
  2987. if ( truncate && jQuery( elem ).is( until ) ) {
  2988. break;
  2989. }
  2990. matched.push( elem );
  2991. }
  2992. }
  2993. return matched;
  2994. };
  2995. var siblings = function( n, elem ) {
  2996. var matched = [];
  2997. for ( ; n; n = n.nextSibling ) {
  2998. if ( n.nodeType === 1 && n !== elem ) {
  2999. matched.push( n );
  3000. }
  3001. }
  3002. return matched;
  3003. };
  3004. var rneedsContext = jQuery.expr.match.needsContext;
  3005. function nodeName( elem, name ) {
  3006. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  3007. };
  3008. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  3009. var risSimple = /^.[^:#\[\.,]*$/;
  3010. // Implement the identical functionality for filter and not
  3011. function winnow( elements, qualifier, not ) {
  3012. if ( jQuery.isFunction( qualifier ) ) {
  3013. return jQuery.grep( elements, function( elem, i ) {
  3014. return !!qualifier.call( elem, i, elem ) !== not;
  3015. } );
  3016. }
  3017. // Single element
  3018. if ( qualifier.nodeType ) {
  3019. return jQuery.grep( elements, function( elem ) {
  3020. return ( elem === qualifier ) !== not;
  3021. } );
  3022. }
  3023. // Arraylike of elements (jQuery, arguments, Array)
  3024. if ( typeof qualifier !== "string" ) {
  3025. return jQuery.grep( elements, function( elem ) {
  3026. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  3027. } );
  3028. }
  3029. // Simple selector that can be filtered directly, removing non-Elements
  3030. if ( risSimple.test( qualifier ) ) {
  3031. return jQuery.filter( qualifier, elements, not );
  3032. }
  3033. // Complex selector, compare the two sets, removing non-Elements
  3034. qualifier = jQuery.filter( qualifier, elements );
  3035. return jQuery.grep( elements, function( elem ) {
  3036. return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
  3037. } );
  3038. }
  3039. jQuery.filter = function( expr, elems, not ) {
  3040. var elem = elems[ 0 ];
  3041. if ( not ) {
  3042. expr = ":not(" + expr + ")";
  3043. }
  3044. if ( elems.length === 1 && elem.nodeType === 1 ) {
  3045. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  3046. }
  3047. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  3048. return elem.nodeType === 1;
  3049. } ) );
  3050. };
  3051. jQuery.fn.extend( {
  3052. find: function( selector ) {
  3053. var i, ret,
  3054. len = this.length,
  3055. self = this;
  3056. if ( typeof selector !== "string" ) {
  3057. return this.pushStack( jQuery( selector ).filter( function() {
  3058. for ( i = 0; i < len; i++ ) {
  3059. if ( jQuery.contains( self[ i ], this ) ) {
  3060. return true;
  3061. }
  3062. }
  3063. } ) );
  3064. }
  3065. ret = this.pushStack( [] );
  3066. for ( i = 0; i < len; i++ ) {
  3067. jQuery.find( selector, self[ i ], ret );
  3068. }
  3069. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  3070. },
  3071. filter: function( selector ) {
  3072. return this.pushStack( winnow( this, selector || [], false ) );
  3073. },
  3074. not: function( selector ) {
  3075. return this.pushStack( winnow( this, selector || [], true ) );
  3076. },
  3077. is: function( selector ) {
  3078. return !!winnow(
  3079. this,
  3080. // If this is a positional/relative selector, check membership in the returned set
  3081. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  3082. typeof selector === "string" && rneedsContext.test( selector ) ?
  3083. jQuery( selector ) :
  3084. selector || [],
  3085. false
  3086. ).length;
  3087. }
  3088. } );
  3089. // Initialize a jQuery object
  3090. // A central reference to the root jQuery(document)
  3091. var rootjQuery,
  3092. // A simple way to check for HTML strings
  3093. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  3094. // Strict HTML recognition (#11290: must start with <)
  3095. // Shortcut simple #id case for speed
  3096. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  3097. init = jQuery.fn.init = function( selector, context, root ) {
  3098. var match, elem;
  3099. // HANDLE: $(""), $(null), $(undefined), $(false)
  3100. if ( !selector ) {
  3101. return this;
  3102. }
  3103. // Method init() accepts an alternate rootjQuery
  3104. // so migrate can support jQuery.sub (gh-2101)
  3105. root = root || rootjQuery;
  3106. // Handle HTML strings
  3107. if ( typeof selector === "string" ) {
  3108. if ( selector[ 0 ] === "<" &&
  3109. selector[ selector.length - 1 ] === ">" &&
  3110. selector.length >= 3 ) {
  3111. // Assume that strings that start and end with <> are HTML and skip the regex check
  3112. match = [ null, selector, null ];
  3113. } else {
  3114. match = rquickExpr.exec( selector );
  3115. }
  3116. // Match html or make sure no context is specified for #id
  3117. if ( match && ( match[ 1 ] || !context ) ) {
  3118. // HANDLE: $(html) -> $(array)
  3119. if ( match[ 1 ] ) {
  3120. context = context instanceof jQuery ? context[ 0 ] : context;
  3121. // Option to run scripts is true for back-compat
  3122. // Intentionally let the error be thrown if parseHTML is not present
  3123. jQuery.merge( this, jQuery.parseHTML(
  3124. match[ 1 ],
  3125. context && context.nodeType ? context.ownerDocument || context : document,
  3126. true
  3127. ) );
  3128. // HANDLE: $(html, props)
  3129. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  3130. for ( match in context ) {
  3131. // Properties of context are called as methods if possible
  3132. if ( jQuery.isFunction( this[ match ] ) ) {
  3133. this[ match ]( context[ match ] );
  3134. // ...and otherwise set as attributes
  3135. } else {
  3136. this.attr( match, context[ match ] );
  3137. }
  3138. }
  3139. }
  3140. return this;
  3141. // HANDLE: $(#id)
  3142. } else {
  3143. elem = document.getElementById( match[ 2 ] );
  3144. if ( elem ) {
  3145. // Inject the element directly into the jQuery object
  3146. this[ 0 ] = elem;
  3147. this.length = 1;
  3148. }
  3149. return this;
  3150. }
  3151. // HANDLE: $(expr, $(...))
  3152. } else if ( !context || context.jquery ) {
  3153. return ( context || root ).find( selector );
  3154. // HANDLE: $(expr, context)
  3155. // (which is just equivalent to: $(context).find(expr)
  3156. } else {
  3157. return this.constructor( context ).find( selector );
  3158. }
  3159. // HANDLE: $(DOMElement)
  3160. } else if ( selector.nodeType ) {
  3161. this[ 0 ] = selector;
  3162. this.length = 1;
  3163. return this;
  3164. // HANDLE: $(function)
  3165. // Shortcut for document ready
  3166. } else if ( jQuery.isFunction( selector ) ) {
  3167. return root.ready !== undefined ?
  3168. root.ready( selector ) :
  3169. // Execute immediately if ready is not present
  3170. selector( jQuery );
  3171. }
  3172. return jQuery.makeArray( selector, this );
  3173. };
  3174. // Give the init function the jQuery prototype for later instantiation
  3175. init.prototype = jQuery.fn;
  3176. // Initialize central reference
  3177. rootjQuery = jQuery( document );
  3178. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  3179. // Methods guaranteed to produce a unique set when starting from a unique set
  3180. guaranteedUnique = {
  3181. children: true,
  3182. contents: true,
  3183. next: true,
  3184. prev: true
  3185. };
  3186. jQuery.fn.extend( {
  3187. has: function( target ) {
  3188. var targets = jQuery( target, this ),
  3189. l = targets.length;
  3190. return this.filter( function() {
  3191. var i = 0;
  3192. for ( ; i < l; i++ ) {
  3193. if ( jQuery.contains( this, targets[ i ] ) ) {
  3194. return true;
  3195. }
  3196. }
  3197. } );
  3198. },
  3199. closest: function( selectors, context ) {
  3200. var cur,
  3201. i = 0,
  3202. l = this.length,
  3203. matched = [],
  3204. targets = typeof selectors !== "string" && jQuery( selectors );
  3205. // Positional selectors never match, since there's no _selection_ context
  3206. if ( !rneedsContext.test( selectors ) ) {
  3207. for ( ; i < l; i++ ) {
  3208. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  3209. // Always skip document fragments
  3210. if ( cur.nodeType < 11 && ( targets ?
  3211. targets.index( cur ) > -1 :
  3212. // Don't pass non-elements to Sizzle
  3213. cur.nodeType === 1 &&
  3214. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  3215. matched.push( cur );
  3216. break;
  3217. }
  3218. }
  3219. }
  3220. }
  3221. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  3222. },
  3223. // Determine the position of an element within the set
  3224. index: function( elem ) {
  3225. // No argument, return index in parent
  3226. if ( !elem ) {
  3227. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  3228. }
  3229. // Index in selector
  3230. if ( typeof elem === "string" ) {
  3231. return indexOf.call( jQuery( elem ), this[ 0 ] );
  3232. }
  3233. // Locate the position of the desired element
  3234. return indexOf.call( this,
  3235. // If it receives a jQuery object, the first element is used
  3236. elem.jquery ? elem[ 0 ] : elem
  3237. );
  3238. },
  3239. add: function( selector, context ) {
  3240. return this.pushStack(
  3241. jQuery.uniqueSort(
  3242. jQuery.merge( this.get(), jQuery( selector, context ) )
  3243. )
  3244. );
  3245. },
  3246. addBack: function( selector ) {
  3247. return this.add( selector == null ?
  3248. this.prevObject : this.prevObject.filter( selector )
  3249. );
  3250. }
  3251. } );
  3252. function sibling( cur, dir ) {
  3253. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  3254. return cur;
  3255. }
  3256. jQuery.each( {
  3257. parent: function( elem ) {
  3258. var parent = elem.parentNode;
  3259. return parent && parent.nodeType !== 11 ? parent : null;
  3260. },
  3261. parents: function( elem ) {
  3262. return dir( elem, "parentNode" );
  3263. },
  3264. parentsUntil: function( elem, i, until ) {
  3265. return dir( elem, "parentNode", until );
  3266. },
  3267. next: function( elem ) {
  3268. return sibling( elem, "nextSibling" );
  3269. },
  3270. prev: function( elem ) {
  3271. return sibling( elem, "previousSibling" );
  3272. },
  3273. nextAll: function( elem ) {
  3274. return dir( elem, "nextSibling" );
  3275. },
  3276. prevAll: function( elem ) {
  3277. return dir( elem, "previousSibling" );
  3278. },
  3279. nextUntil: function( elem, i, until ) {
  3280. return dir( elem, "nextSibling", until );
  3281. },
  3282. prevUntil: function( elem, i, until ) {
  3283. return dir( elem, "previousSibling", until );
  3284. },
  3285. siblings: function( elem ) {
  3286. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  3287. },
  3288. children: function( elem ) {
  3289. return siblings( elem.firstChild );
  3290. },
  3291. contents: function( elem ) {
  3292. if ( nodeName( elem, "iframe" ) ) {
  3293. return elem.contentDocument;
  3294. }
  3295. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  3296. // Treat the template element as a regular one in browsers that
  3297. // don't support it.
  3298. if ( nodeName( elem, "template" ) ) {
  3299. elem = elem.content || elem;
  3300. }
  3301. return jQuery.merge( [], elem.childNodes );
  3302. }
  3303. }, function( name, fn ) {
  3304. jQuery.fn[ name ] = function( until, selector ) {
  3305. var matched = jQuery.map( this, fn, until );
  3306. if ( name.slice( -5 ) !== "Until" ) {
  3307. selector = until;
  3308. }
  3309. if ( selector && typeof selector === "string" ) {
  3310. matched = jQuery.filter( selector, matched );
  3311. }
  3312. if ( this.length > 1 ) {
  3313. // Remove duplicates
  3314. if ( !guaranteedUnique[ name ] ) {
  3315. jQuery.uniqueSort( matched );
  3316. }
  3317. // Reverse order for parents* and prev-derivatives
  3318. if ( rparentsprev.test( name ) ) {
  3319. matched.reverse();
  3320. }
  3321. }
  3322. return this.pushStack( matched );
  3323. };
  3324. } );
  3325. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  3326. // Convert String-formatted options into Object-formatted ones
  3327. function createOptions( options ) {
  3328. var object = {};
  3329. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  3330. object[ flag ] = true;
  3331. } );
  3332. return object;
  3333. }
  3334. /*
  3335. * Create a callback list using the following parameters:
  3336. *
  3337. * options: an optional list of space-separated options that will change how
  3338. * the callback list behaves or a more traditional option object
  3339. *
  3340. * By default a callback list will act like an event callback list and can be
  3341. * "fired" multiple times.
  3342. *
  3343. * Possible options:
  3344. *
  3345. * once: will ensure the callback list can only be fired once (like a Deferred)
  3346. *
  3347. * memory: will keep track of previous values and will call any callback added
  3348. * after the list has been fired right away with the latest "memorized"
  3349. * values (like a Deferred)
  3350. *
  3351. * unique: will ensure a callback can only be added once (no duplicate in the list)
  3352. *
  3353. * stopOnFalse: interrupt callings when a callback returns false
  3354. *
  3355. */
  3356. jQuery.Callbacks = function( options ) {
  3357. // Convert options from String-formatted to Object-formatted if needed
  3358. // (we check in cache first)
  3359. options = typeof options === "string" ?
  3360. createOptions( options ) :
  3361. jQuery.extend( {}, options );
  3362. var // Flag to know if list is currently firing
  3363. firing,
  3364. // Last fire value for non-forgettable lists
  3365. memory,
  3366. // Flag to know if list was already fired
  3367. fired,
  3368. // Flag to prevent firing
  3369. locked,
  3370. // Actual callback list
  3371. list = [],
  3372. // Queue of execution data for repeatable lists
  3373. queue = [],
  3374. // Index of currently firing callback (modified by add/remove as needed)
  3375. firingIndex = -1,
  3376. // Fire callbacks
  3377. fire = function() {
  3378. // Enforce single-firing
  3379. locked = locked || options.once;
  3380. // Execute callbacks for all pending executions,
  3381. // respecting firingIndex overrides and runtime changes
  3382. fired = firing = true;
  3383. for ( ; queue.length; firingIndex = -1 ) {
  3384. memory = queue.shift();
  3385. while ( ++firingIndex < list.length ) {
  3386. // Run callback and check for early termination
  3387. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  3388. options.stopOnFalse ) {
  3389. // Jump to end and forget the data so .add doesn't re-fire
  3390. firingIndex = list.length;
  3391. memory = false;
  3392. }
  3393. }
  3394. }
  3395. // Forget the data if we're done with it
  3396. if ( !options.memory ) {
  3397. memory = false;
  3398. }
  3399. firing = false;
  3400. // Clean up if we're done firing for good
  3401. if ( locked ) {
  3402. // Keep an empty list if we have data for future add calls
  3403. if ( memory ) {
  3404. list = [];
  3405. // Otherwise, this object is spent
  3406. } else {
  3407. list = "";
  3408. }
  3409. }
  3410. },
  3411. // Actual Callbacks object
  3412. self = {
  3413. // Add a callback or a collection of callbacks to the list
  3414. add: function() {
  3415. if ( list ) {
  3416. // If we have memory from a past run, we should fire after adding
  3417. if ( memory && !firing ) {
  3418. firingIndex = list.length - 1;
  3419. queue.push( memory );
  3420. }
  3421. ( function add( args ) {
  3422. jQuery.each( args, function( _, arg ) {
  3423. if ( jQuery.isFunction( arg ) ) {
  3424. if ( !options.unique || !self.has( arg ) ) {
  3425. list.push( arg );
  3426. }
  3427. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  3428. // Inspect recursively
  3429. add( arg );
  3430. }
  3431. } );
  3432. } )( arguments );
  3433. if ( memory && !firing ) {
  3434. fire();
  3435. }
  3436. }
  3437. return this;
  3438. },
  3439. // Remove a callback from the list
  3440. remove: function() {
  3441. jQuery.each( arguments, function( _, arg ) {
  3442. var index;
  3443. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  3444. list.splice( index, 1 );
  3445. // Handle firing indexes
  3446. if ( index <= firingIndex ) {
  3447. firingIndex--;
  3448. }
  3449. }
  3450. } );
  3451. return this;
  3452. },
  3453. // Check if a given callback is in the list.
  3454. // If no argument is given, return whether or not list has callbacks attached.
  3455. has: function( fn ) {
  3456. return fn ?
  3457. jQuery.inArray( fn, list ) > -1 :
  3458. list.length > 0;
  3459. },
  3460. // Remove all callbacks from the list
  3461. empty: function() {
  3462. if ( list ) {
  3463. list = [];
  3464. }
  3465. return this;
  3466. },
  3467. // Disable .fire and .add
  3468. // Abort any current/pending executions
  3469. // Clear all callbacks and values
  3470. disable: function() {
  3471. locked = queue = [];
  3472. list = memory = "";
  3473. return this;
  3474. },
  3475. disabled: function() {
  3476. return !list;
  3477. },
  3478. // Disable .fire
  3479. // Also disable .add unless we have memory (since it would have no effect)
  3480. // Abort any pending executions
  3481. lock: function() {
  3482. locked = queue = [];
  3483. if ( !memory && !firing ) {
  3484. list = memory = "";
  3485. }
  3486. return this;
  3487. },
  3488. locked: function() {
  3489. return !!locked;
  3490. },
  3491. // Call all callbacks with the given context and arguments
  3492. fireWith: function( context, args ) {
  3493. if ( !locked ) {
  3494. args = args || [];
  3495. args = [ context, args.slice ? args.slice() : args ];
  3496. queue.push( args );
  3497. if ( !firing ) {
  3498. fire();
  3499. }
  3500. }
  3501. return this;
  3502. },
  3503. // Call all the callbacks with the given arguments
  3504. fire: function() {
  3505. self.fireWith( this, arguments );
  3506. return this;
  3507. },
  3508. // To know if the callbacks have already been called at least once
  3509. fired: function() {
  3510. return !!fired;
  3511. }
  3512. };
  3513. return self;
  3514. };
  3515. function Identity( v ) {
  3516. return v;
  3517. }
  3518. function Thrower( ex ) {
  3519. throw ex;
  3520. }
  3521. function adoptValue( value, resolve, reject, noValue ) {
  3522. var method;
  3523. try {
  3524. // Check for promise aspect first to privilege synchronous behavior
  3525. if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
  3526. method.call( value ).done( resolve ).fail( reject );
  3527. // Other thenables
  3528. } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
  3529. method.call( value, resolve, reject );
  3530. // Other non-thenables
  3531. } else {
  3532. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  3533. // * false: [ value ].slice( 0 ) => resolve( value )
  3534. // * true: [ value ].slice( 1 ) => resolve()
  3535. resolve.apply( undefined, [ value ].slice( noValue ) );
  3536. }
  3537. // For Promises/A+, convert exceptions into rejections
  3538. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  3539. // Deferred#then to conditionally suppress rejection.
  3540. } catch ( value ) {
  3541. // Support: Android 4.0 only
  3542. // Strict mode functions invoked without .call/.apply get global-object context
  3543. reject.apply( undefined, [ value ] );
  3544. }
  3545. }
  3546. jQuery.extend( {
  3547. Deferred: function( func ) {
  3548. var tuples = [
  3549. // action, add listener, callbacks,
  3550. // ... .then handlers, argument index, [final state]
  3551. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  3552. jQuery.Callbacks( "memory" ), 2 ],
  3553. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  3554. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  3555. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  3556. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  3557. ],
  3558. state = "pending",
  3559. promise = {
  3560. state: function() {
  3561. return state;
  3562. },
  3563. always: function() {
  3564. deferred.done( arguments ).fail( arguments );
  3565. return this;
  3566. },
  3567. "catch": function( fn ) {
  3568. return promise.then( null, fn );
  3569. },
  3570. // Keep pipe for back-compat
  3571. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  3572. var fns = arguments;
  3573. return jQuery.Deferred( function( newDefer ) {
  3574. jQuery.each( tuples, function( i, tuple ) {
  3575. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  3576. var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  3577. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  3578. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  3579. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  3580. deferred[ tuple[ 1 ] ]( function() {
  3581. var returned = fn && fn.apply( this, arguments );
  3582. if ( returned && jQuery.isFunction( returned.promise ) ) {
  3583. returned.promise()
  3584. .progress( newDefer.notify )
  3585. .done( newDefer.resolve )
  3586. .fail( newDefer.reject );
  3587. } else {
  3588. newDefer[ tuple[ 0 ] + "With" ](
  3589. this,
  3590. fn ? [ returned ] : arguments
  3591. );
  3592. }
  3593. } );
  3594. } );
  3595. fns = null;
  3596. } ).promise();
  3597. },
  3598. then: function( onFulfilled, onRejected, onProgress ) {
  3599. var maxDepth = 0;
  3600. function resolve( depth, deferred, handler, special ) {
  3601. return function() {
  3602. var that = this,
  3603. args = arguments,
  3604. mightThrow = function() {
  3605. var returned, then;
  3606. // Support: Promises/A+ section 2.3.3.3.3
  3607. // https://promisesaplus.com/#point-59
  3608. // Ignore double-resolution attempts
  3609. if ( depth < maxDepth ) {
  3610. return;
  3611. }
  3612. returned = handler.apply( that, args );
  3613. // Support: Promises/A+ section 2.3.1
  3614. // https://promisesaplus.com/#point-48
  3615. if ( returned === deferred.promise() ) {
  3616. throw new TypeError( "Thenable self-resolution" );
  3617. }
  3618. // Support: Promises/A+ sections 2.3.3.1, 3.5
  3619. // https://promisesaplus.com/#point-54
  3620. // https://promisesaplus.com/#point-75
  3621. // Retrieve `then` only once
  3622. then = returned &&
  3623. // Support: Promises/A+ section 2.3.4
  3624. // https://promisesaplus.com/#point-64
  3625. // Only check objects and functions for thenability
  3626. ( typeof returned === "object" ||
  3627. typeof returned === "function" ) &&
  3628. returned.then;
  3629. // Handle a returned thenable
  3630. if ( jQuery.isFunction( then ) ) {
  3631. // Special processors (notify) just wait for resolution
  3632. if ( special ) {
  3633. then.call(
  3634. returned,
  3635. resolve( maxDepth, deferred, Identity, special ),
  3636. resolve( maxDepth, deferred, Thrower, special )
  3637. );
  3638. // Normal processors (resolve) also hook into progress
  3639. } else {
  3640. // ...and disregard older resolution values
  3641. maxDepth++;
  3642. then.call(
  3643. returned,
  3644. resolve( maxDepth, deferred, Identity, special ),
  3645. resolve( maxDepth, deferred, Thrower, special ),
  3646. resolve( maxDepth, deferred, Identity,
  3647. deferred.notifyWith )
  3648. );
  3649. }
  3650. // Handle all other returned values
  3651. } else {
  3652. // Only substitute handlers pass on context
  3653. // and multiple values (non-spec behavior)
  3654. if ( handler !== Identity ) {
  3655. that = undefined;
  3656. args = [ returned ];
  3657. }
  3658. // Process the value(s)
  3659. // Default process is resolve
  3660. ( special || deferred.resolveWith )( that, args );
  3661. }
  3662. },
  3663. // Only normal processors (resolve) catch and reject exceptions
  3664. process = special ?
  3665. mightThrow :
  3666. function() {
  3667. try {
  3668. mightThrow();
  3669. } catch ( e ) {
  3670. if ( jQuery.Deferred.exceptionHook ) {
  3671. jQuery.Deferred.exceptionHook( e,
  3672. process.stackTrace );
  3673. }
  3674. // Support: Promises/A+ section 2.3.3.3.4.1
  3675. // https://promisesaplus.com/#point-61
  3676. // Ignore post-resolution exceptions
  3677. if ( depth + 1 >= maxDepth ) {
  3678. // Only substitute handlers pass on context
  3679. // and multiple values (non-spec behavior)
  3680. if ( handler !== Thrower ) {
  3681. that = undefined;
  3682. args = [ e ];
  3683. }
  3684. deferred.rejectWith( that, args );
  3685. }
  3686. }
  3687. };
  3688. // Support: Promises/A+ section 2.3.3.3.1
  3689. // https://promisesaplus.com/#point-57
  3690. // Re-resolve promises immediately to dodge false rejection from
  3691. // subsequent errors
  3692. if ( depth ) {
  3693. process();
  3694. } else {
  3695. // Call an optional hook to record the stack, in case of exception
  3696. // since it's otherwise lost when execution goes async
  3697. if ( jQuery.Deferred.getStackHook ) {
  3698. process.stackTrace = jQuery.Deferred.getStackHook();
  3699. }
  3700. window.setTimeout( process );
  3701. }
  3702. };
  3703. }
  3704. return jQuery.Deferred( function( newDefer ) {
  3705. // progress_handlers.add( ... )
  3706. tuples[ 0 ][ 3 ].add(
  3707. resolve(
  3708. 0,
  3709. newDefer,
  3710. jQuery.isFunction( onProgress ) ?
  3711. onProgress :
  3712. Identity,
  3713. newDefer.notifyWith
  3714. )
  3715. );
  3716. // fulfilled_handlers.add( ... )
  3717. tuples[ 1 ][ 3 ].add(
  3718. resolve(
  3719. 0,
  3720. newDefer,
  3721. jQuery.isFunction( onFulfilled ) ?
  3722. onFulfilled :
  3723. Identity
  3724. )
  3725. );
  3726. // rejected_handlers.add( ... )
  3727. tuples[ 2 ][ 3 ].add(
  3728. resolve(
  3729. 0,
  3730. newDefer,
  3731. jQuery.isFunction( onRejected ) ?
  3732. onRejected :
  3733. Thrower
  3734. )
  3735. );
  3736. } ).promise();
  3737. },
  3738. // Get a promise for this deferred
  3739. // If obj is provided, the promise aspect is added to the object
  3740. promise: function( obj ) {
  3741. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3742. }
  3743. },
  3744. deferred = {};
  3745. // Add list-specific methods
  3746. jQuery.each( tuples, function( i, tuple ) {
  3747. var list = tuple[ 2 ],
  3748. stateString = tuple[ 5 ];
  3749. // promise.progress = list.add
  3750. // promise.done = list.add
  3751. // promise.fail = list.add
  3752. promise[ tuple[ 1 ] ] = list.add;
  3753. // Handle state
  3754. if ( stateString ) {
  3755. list.add(
  3756. function() {
  3757. // state = "resolved" (i.e., fulfilled)
  3758. // state = "rejected"
  3759. state = stateString;
  3760. },
  3761. // rejected_callbacks.disable
  3762. // fulfilled_callbacks.disable
  3763. tuples[ 3 - i ][ 2 ].disable,
  3764. // progress_callbacks.lock
  3765. tuples[ 0 ][ 2 ].lock
  3766. );
  3767. }
  3768. // progress_handlers.fire
  3769. // fulfilled_handlers.fire
  3770. // rejected_handlers.fire
  3771. list.add( tuple[ 3 ].fire );
  3772. // deferred.notify = function() { deferred.notifyWith(...) }
  3773. // deferred.resolve = function() { deferred.resolveWith(...) }
  3774. // deferred.reject = function() { deferred.rejectWith(...) }
  3775. deferred[ tuple[ 0 ] ] = function() {
  3776. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3777. return this;
  3778. };
  3779. // deferred.notifyWith = list.fireWith
  3780. // deferred.resolveWith = list.fireWith
  3781. // deferred.rejectWith = list.fireWith
  3782. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3783. } );
  3784. // Make the deferred a promise
  3785. promise.promise( deferred );
  3786. // Call given func if any
  3787. if ( func ) {
  3788. func.call( deferred, deferred );
  3789. }
  3790. // All done!
  3791. return deferred;
  3792. },
  3793. // Deferred helper
  3794. when: function( singleValue ) {
  3795. var
  3796. // count of uncompleted subordinates
  3797. remaining = arguments.length,
  3798. // count of unprocessed arguments
  3799. i = remaining,
  3800. // subordinate fulfillment data
  3801. resolveContexts = Array( i ),
  3802. resolveValues = slice.call( arguments ),
  3803. // the master Deferred
  3804. master = jQuery.Deferred(),
  3805. // subordinate callback factory
  3806. updateFunc = function( i ) {
  3807. return function( value ) {
  3808. resolveContexts[ i ] = this;
  3809. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3810. if ( !( --remaining ) ) {
  3811. master.resolveWith( resolveContexts, resolveValues );
  3812. }
  3813. };
  3814. };
  3815. // Single- and empty arguments are adopted like Promise.resolve
  3816. if ( remaining <= 1 ) {
  3817. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3818. !remaining );
  3819. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3820. if ( master.state() === "pending" ||
  3821. jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3822. return master.then();
  3823. }
  3824. }
  3825. // Multiple arguments are aggregated like Promise.all array elements
  3826. while ( i-- ) {
  3827. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  3828. }
  3829. return master.promise();
  3830. }
  3831. } );
  3832. // These usually indicate a programmer mistake during development,
  3833. // warn about them ASAP rather than swallowing them by default.
  3834. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3835. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3836. // Support: IE 8 - 9 only
  3837. // Console exists when dev tools are open, which can happen at any time
  3838. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3839. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  3840. }
  3841. };
  3842. jQuery.readyException = function( error ) {
  3843. window.setTimeout( function() {
  3844. throw error;
  3845. } );
  3846. };
  3847. // The deferred used on DOM ready
  3848. var readyList = jQuery.Deferred();
  3849. jQuery.fn.ready = function( fn ) {
  3850. readyList
  3851. .then( fn )
  3852. // Wrap jQuery.readyException in a function so that the lookup
  3853. // happens at the time of error handling instead of callback
  3854. // registration.
  3855. .catch( function( error ) {
  3856. jQuery.readyException( error );
  3857. } );
  3858. return this;
  3859. };
  3860. jQuery.extend( {
  3861. // Is the DOM ready to be used? Set to true once it occurs.
  3862. isReady: false,
  3863. // A counter to track how many items to wait for before
  3864. // the ready event fires. See #6781
  3865. readyWait: 1,
  3866. // Handle when the DOM is ready
  3867. ready: function( wait ) {
  3868. // Abort if there are pending holds or we're already ready
  3869. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3870. return;
  3871. }
  3872. // Remember that the DOM is ready
  3873. jQuery.isReady = true;
  3874. // If a normal DOM Ready event fired, decrement, and wait if need be
  3875. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3876. return;
  3877. }
  3878. // If there are functions bound, to execute
  3879. readyList.resolveWith( document, [ jQuery ] );
  3880. }
  3881. } );
  3882. jQuery.ready.then = readyList.then;
  3883. // The ready event handler and self cleanup method
  3884. function completed() {
  3885. document.removeEventListener( "DOMContentLoaded", completed );
  3886. window.removeEventListener( "load", completed );
  3887. jQuery.ready();
  3888. }
  3889. // Catch cases where $(document).ready() is called
  3890. // after the browser event has already occurred.
  3891. // Support: IE <=9 - 10 only
  3892. // Older IE sometimes signals "interactive" too soon
  3893. if ( document.readyState === "complete" ||
  3894. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3895. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3896. window.setTimeout( jQuery.ready );
  3897. } else {
  3898. // Use the handy event callback
  3899. document.addEventListener( "DOMContentLoaded", completed );
  3900. // A fallback to window.onload, that will always work
  3901. window.addEventListener( "load", completed );
  3902. }
  3903. // Multifunctional method to get and set values of a collection
  3904. // The value/s can optionally be executed if it's a function
  3905. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3906. var i = 0,
  3907. len = elems.length,
  3908. bulk = key == null;
  3909. // Sets many values
  3910. if ( jQuery.type( key ) === "object" ) {
  3911. chainable = true;
  3912. for ( i in key ) {
  3913. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3914. }
  3915. // Sets one value
  3916. } else if ( value !== undefined ) {
  3917. chainable = true;
  3918. if ( !jQuery.isFunction( value ) ) {
  3919. raw = true;
  3920. }
  3921. if ( bulk ) {
  3922. // Bulk operations run against the entire set
  3923. if ( raw ) {
  3924. fn.call( elems, value );
  3925. fn = null;
  3926. // ...except when executing function values
  3927. } else {
  3928. bulk = fn;
  3929. fn = function( elem, key, value ) {
  3930. return bulk.call( jQuery( elem ), value );
  3931. };
  3932. }
  3933. }
  3934. if ( fn ) {
  3935. for ( ; i < len; i++ ) {
  3936. fn(
  3937. elems[ i ], key, raw ?
  3938. value :
  3939. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3940. );
  3941. }
  3942. }
  3943. }
  3944. if ( chainable ) {
  3945. return elems;
  3946. }
  3947. // Gets
  3948. if ( bulk ) {
  3949. return fn.call( elems );
  3950. }
  3951. return len ? fn( elems[ 0 ], key ) : emptyGet;
  3952. };
  3953. var acceptData = function( owner ) {
  3954. // Accepts only:
  3955. // - Node
  3956. // - Node.ELEMENT_NODE
  3957. // - Node.DOCUMENT_NODE
  3958. // - Object
  3959. // - Any
  3960. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  3961. };
  3962. function Data() {
  3963. this.expando = jQuery.expando + Data.uid++;
  3964. }
  3965. Data.uid = 1;
  3966. Data.prototype = {
  3967. cache: function( owner ) {
  3968. // Check if the owner object already has a cache
  3969. var value = owner[ this.expando ];
  3970. // If not, create one
  3971. if ( !value ) {
  3972. value = {};
  3973. // We can accept data for non-element nodes in modern browsers,
  3974. // but we should not, see #8335.
  3975. // Always return an empty object.
  3976. if ( acceptData( owner ) ) {
  3977. // If it is a node unlikely to be stringify-ed or looped over
  3978. // use plain assignment
  3979. if ( owner.nodeType ) {
  3980. owner[ this.expando ] = value;
  3981. // Otherwise secure it in a non-enumerable property
  3982. // configurable must be true to allow the property to be
  3983. // deleted when data is removed
  3984. } else {
  3985. Object.defineProperty( owner, this.expando, {
  3986. value: value,
  3987. configurable: true
  3988. } );
  3989. }
  3990. }
  3991. }
  3992. return value;
  3993. },
  3994. set: function( owner, data, value ) {
  3995. var prop,
  3996. cache = this.cache( owner );
  3997. // Handle: [ owner, key, value ] args
  3998. // Always use camelCase key (gh-2257)
  3999. if ( typeof data === "string" ) {
  4000. cache[ jQuery.camelCase( data ) ] = value;
  4001. // Handle: [ owner, { properties } ] args
  4002. } else {
  4003. // Copy the properties one-by-one to the cache object
  4004. for ( prop in data ) {
  4005. cache[ jQuery.camelCase( prop ) ] = data[ prop ];
  4006. }
  4007. }
  4008. return cache;
  4009. },
  4010. get: function( owner, key ) {
  4011. return key === undefined ?
  4012. this.cache( owner ) :
  4013. // Always use camelCase key (gh-2257)
  4014. owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
  4015. },
  4016. access: function( owner, key, value ) {
  4017. // In cases where either:
  4018. //
  4019. // 1. No key was specified
  4020. // 2. A string key was specified, but no value provided
  4021. //
  4022. // Take the "read" path and allow the get method to determine
  4023. // which value to return, respectively either:
  4024. //
  4025. // 1. The entire cache object
  4026. // 2. The data stored at the key
  4027. //
  4028. if ( key === undefined ||
  4029. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  4030. return this.get( owner, key );
  4031. }
  4032. // When the key is not a string, or both a key and value
  4033. // are specified, set or extend (existing objects) with either:
  4034. //
  4035. // 1. An object of properties
  4036. // 2. A key and value
  4037. //
  4038. this.set( owner, key, value );
  4039. // Since the "set" path can have two possible entry points
  4040. // return the expected data based on which path was taken[*]
  4041. return value !== undefined ? value : key;
  4042. },
  4043. remove: function( owner, key ) {
  4044. var i,
  4045. cache = owner[ this.expando ];
  4046. if ( cache === undefined ) {
  4047. return;
  4048. }
  4049. if ( key !== undefined ) {
  4050. // Support array or space separated string of keys
  4051. if ( Array.isArray( key ) ) {
  4052. // If key is an array of keys...
  4053. // We always set camelCase keys, so remove that.
  4054. key = key.map( jQuery.camelCase );
  4055. } else {
  4056. key = jQuery.camelCase( key );
  4057. // If a key with the spaces exists, use it.
  4058. // Otherwise, create an array by matching non-whitespace
  4059. key = key in cache ?
  4060. [ key ] :
  4061. ( key.match( rnothtmlwhite ) || [] );
  4062. }
  4063. i = key.length;
  4064. while ( i-- ) {
  4065. delete cache[ key[ i ] ];
  4066. }
  4067. }
  4068. // Remove the expando if there's no more data
  4069. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  4070. // Support: Chrome <=35 - 45
  4071. // Webkit & Blink performance suffers when deleting properties
  4072. // from DOM nodes, so set to undefined instead
  4073. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  4074. if ( owner.nodeType ) {
  4075. owner[ this.expando ] = undefined;
  4076. } else {
  4077. delete owner[ this.expando ];
  4078. }
  4079. }
  4080. },
  4081. hasData: function( owner ) {
  4082. var cache = owner[ this.expando ];
  4083. return cache !== undefined && !jQuery.isEmptyObject( cache );
  4084. }
  4085. };
  4086. var dataPriv = new Data();
  4087. var dataUser = new Data();
  4088. // Implementation Summary
  4089. //
  4090. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  4091. // 2. Improve the module's maintainability by reducing the storage
  4092. // paths to a single mechanism.
  4093. // 3. Use the same single mechanism to support "private" and "user" data.
  4094. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  4095. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  4096. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  4097. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  4098. rmultiDash = /[A-Z]/g;
  4099. function getData( data ) {
  4100. if ( data === "true" ) {
  4101. return true;
  4102. }
  4103. if ( data === "false" ) {
  4104. return false;
  4105. }
  4106. if ( data === "null" ) {
  4107. return null;
  4108. }
  4109. // Only convert to a number if it doesn't change the string
  4110. if ( data === +data + "" ) {
  4111. return +data;
  4112. }
  4113. if ( rbrace.test( data ) ) {
  4114. return JSON.parse( data );
  4115. }
  4116. return data;
  4117. }
  4118. function dataAttr( elem, key, data ) {
  4119. var name;
  4120. // If nothing was found internally, try to fetch any
  4121. // data from the HTML5 data-* attribute
  4122. if ( data === undefined && elem.nodeType === 1 ) {
  4123. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  4124. data = elem.getAttribute( name );
  4125. if ( typeof data === "string" ) {
  4126. try {
  4127. data = getData( data );
  4128. } catch ( e ) {}
  4129. // Make sure we set the data so it isn't changed later
  4130. dataUser.set( elem, key, data );
  4131. } else {
  4132. data = undefined;
  4133. }
  4134. }
  4135. return data;
  4136. }
  4137. jQuery.extend( {
  4138. hasData: function( elem ) {
  4139. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  4140. },
  4141. data: function( elem, name, data ) {
  4142. return dataUser.access( elem, name, data );
  4143. },
  4144. removeData: function( elem, name ) {
  4145. dataUser.remove( elem, name );
  4146. },
  4147. // TODO: Now that all calls to _data and _removeData have been replaced
  4148. // with direct calls to dataPriv methods, these can be deprecated.
  4149. _data: function( elem, name, data ) {
  4150. return dataPriv.access( elem, name, data );
  4151. },
  4152. _removeData: function( elem, name ) {
  4153. dataPriv.remove( elem, name );
  4154. }
  4155. } );
  4156. jQuery.fn.extend( {
  4157. data: function( key, value ) {
  4158. var i, name, data,
  4159. elem = this[ 0 ],
  4160. attrs = elem && elem.attributes;
  4161. // Gets all values
  4162. if ( key === undefined ) {
  4163. if ( this.length ) {
  4164. data = dataUser.get( elem );
  4165. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  4166. i = attrs.length;
  4167. while ( i-- ) {
  4168. // Support: IE 11 only
  4169. // The attrs elements can be null (#14894)
  4170. if ( attrs[ i ] ) {
  4171. name = attrs[ i ].name;
  4172. if ( name.indexOf( "data-" ) === 0 ) {
  4173. name = jQuery.camelCase( name.slice( 5 ) );
  4174. dataAttr( elem, name, data[ name ] );
  4175. }
  4176. }
  4177. }
  4178. dataPriv.set( elem, "hasDataAttrs", true );
  4179. }
  4180. }
  4181. return data;
  4182. }
  4183. // Sets multiple values
  4184. if ( typeof key === "object" ) {
  4185. return this.each( function() {
  4186. dataUser.set( this, key );
  4187. } );
  4188. }
  4189. return access( this, function( value ) {
  4190. var data;
  4191. // The calling jQuery object (element matches) is not empty
  4192. // (and therefore has an element appears at this[ 0 ]) and the
  4193. // `value` parameter was not undefined. An empty jQuery object
  4194. // will result in `undefined` for elem = this[ 0 ] which will
  4195. // throw an exception if an attempt to read a data cache is made.
  4196. if ( elem && value === undefined ) {
  4197. // Attempt to get data from the cache
  4198. // The key will always be camelCased in Data
  4199. data = dataUser.get( elem, key );
  4200. if ( data !== undefined ) {
  4201. return data;
  4202. }
  4203. // Attempt to "discover" the data in
  4204. // HTML5 custom data-* attrs
  4205. data = dataAttr( elem, key );
  4206. if ( data !== undefined ) {
  4207. return data;
  4208. }
  4209. // We tried really hard, but the data doesn't exist.
  4210. return;
  4211. }
  4212. // Set the data...
  4213. this.each( function() {
  4214. // We always store the camelCased key
  4215. dataUser.set( this, key, value );
  4216. } );
  4217. }, null, value, arguments.length > 1, null, true );
  4218. },
  4219. removeData: function( key ) {
  4220. return this.each( function() {
  4221. dataUser.remove( this, key );
  4222. } );
  4223. }
  4224. } );
  4225. jQuery.extend( {
  4226. queue: function( elem, type, data ) {
  4227. var queue;
  4228. if ( elem ) {
  4229. type = ( type || "fx" ) + "queue";
  4230. queue = dataPriv.get( elem, type );
  4231. // Speed up dequeue by getting out quickly if this is just a lookup
  4232. if ( data ) {
  4233. if ( !queue || Array.isArray( data ) ) {
  4234. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  4235. } else {
  4236. queue.push( data );
  4237. }
  4238. }
  4239. return queue || [];
  4240. }
  4241. },
  4242. dequeue: function( elem, type ) {
  4243. type = type || "fx";
  4244. var queue = jQuery.queue( elem, type ),
  4245. startLength = queue.length,
  4246. fn = queue.shift(),
  4247. hooks = jQuery._queueHooks( elem, type ),
  4248. next = function() {
  4249. jQuery.dequeue( elem, type );
  4250. };
  4251. // If the fx queue is dequeued, always remove the progress sentinel
  4252. if ( fn === "inprogress" ) {
  4253. fn = queue.shift();
  4254. startLength--;
  4255. }
  4256. if ( fn ) {
  4257. // Add a progress sentinel to prevent the fx queue from being
  4258. // automatically dequeued
  4259. if ( type === "fx" ) {
  4260. queue.unshift( "inprogress" );
  4261. }
  4262. // Clear up the last queue stop function
  4263. delete hooks.stop;
  4264. fn.call( elem, next, hooks );
  4265. }
  4266. if ( !startLength && hooks ) {
  4267. hooks.empty.fire();
  4268. }
  4269. },
  4270. // Not public - generate a queueHooks object, or return the current one
  4271. _queueHooks: function( elem, type ) {
  4272. var key = type + "queueHooks";
  4273. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  4274. empty: jQuery.Callbacks( "once memory" ).add( function() {
  4275. dataPriv.remove( elem, [ type + "queue", key ] );
  4276. } )
  4277. } );
  4278. }
  4279. } );
  4280. jQuery.fn.extend( {
  4281. queue: function( type, data ) {
  4282. var setter = 2;
  4283. if ( typeof type !== "string" ) {
  4284. data = type;
  4285. type = "fx";
  4286. setter--;
  4287. }
  4288. if ( arguments.length < setter ) {
  4289. return jQuery.queue( this[ 0 ], type );
  4290. }
  4291. return data === undefined ?
  4292. this :
  4293. this.each( function() {
  4294. var queue = jQuery.queue( this, type, data );
  4295. // Ensure a hooks for this queue
  4296. jQuery._queueHooks( this, type );
  4297. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  4298. jQuery.dequeue( this, type );
  4299. }
  4300. } );
  4301. },
  4302. dequeue: function( type ) {
  4303. return this.each( function() {
  4304. jQuery.dequeue( this, type );
  4305. } );
  4306. },
  4307. clearQueue: function( type ) {
  4308. return this.queue( type || "fx", [] );
  4309. },
  4310. // Get a promise resolved when queues of a certain type
  4311. // are emptied (fx is the type by default)
  4312. promise: function( type, obj ) {
  4313. var tmp,
  4314. count = 1,
  4315. defer = jQuery.Deferred(),
  4316. elements = this,
  4317. i = this.length,
  4318. resolve = function() {
  4319. if ( !( --count ) ) {
  4320. defer.resolveWith( elements, [ elements ] );
  4321. }
  4322. };
  4323. if ( typeof type !== "string" ) {
  4324. obj = type;
  4325. type = undefined;
  4326. }
  4327. type = type || "fx";
  4328. while ( i-- ) {
  4329. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  4330. if ( tmp && tmp.empty ) {
  4331. count++;
  4332. tmp.empty.add( resolve );
  4333. }
  4334. }
  4335. resolve();
  4336. return defer.promise( obj );
  4337. }
  4338. } );
  4339. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  4340. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  4341. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  4342. var isHiddenWithinTree = function( elem, el ) {
  4343. // isHiddenWithinTree might be called from jQuery#filter function;
  4344. // in that case, element will be second argument
  4345. elem = el || elem;
  4346. // Inline style trumps all
  4347. return elem.style.display === "none" ||
  4348. elem.style.display === "" &&
  4349. // Otherwise, check computed style
  4350. // Support: Firefox <=43 - 45
  4351. // Disconnected elements can have computed display: none, so first confirm that elem is
  4352. // in the document.
  4353. jQuery.contains( elem.ownerDocument, elem ) &&
  4354. jQuery.css( elem, "display" ) === "none";
  4355. };
  4356. var swap = function( elem, options, callback, args ) {
  4357. var ret, name,
  4358. old = {};
  4359. // Remember the old values, and insert the new ones
  4360. for ( name in options ) {
  4361. old[ name ] = elem.style[ name ];
  4362. elem.style[ name ] = options[ name ];
  4363. }
  4364. ret = callback.apply( elem, args || [] );
  4365. // Revert the old values
  4366. for ( name in options ) {
  4367. elem.style[ name ] = old[ name ];
  4368. }
  4369. return ret;
  4370. };
  4371. function adjustCSS( elem, prop, valueParts, tween ) {
  4372. var adjusted,
  4373. scale = 1,
  4374. maxIterations = 20,
  4375. currentValue = tween ?
  4376. function() {
  4377. return tween.cur();
  4378. } :
  4379. function() {
  4380. return jQuery.css( elem, prop, "" );
  4381. },
  4382. initial = currentValue(),
  4383. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  4384. // Starting value computation is required for potential unit mismatches
  4385. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  4386. rcssNum.exec( jQuery.css( elem, prop ) );
  4387. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  4388. // Trust units reported by jQuery.css
  4389. unit = unit || initialInUnit[ 3 ];
  4390. // Make sure we update the tween properties later on
  4391. valueParts = valueParts || [];
  4392. // Iteratively approximate from a nonzero starting point
  4393. initialInUnit = +initial || 1;
  4394. do {
  4395. // If previous iteration zeroed out, double until we get *something*.
  4396. // Use string for doubling so we don't accidentally see scale as unchanged below
  4397. scale = scale || ".5";
  4398. // Adjust and apply
  4399. initialInUnit = initialInUnit / scale;
  4400. jQuery.style( elem, prop, initialInUnit + unit );
  4401. // Update scale, tolerating zero or NaN from tween.cur()
  4402. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  4403. } while (
  4404. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  4405. );
  4406. }
  4407. if ( valueParts ) {
  4408. initialInUnit = +initialInUnit || +initial || 0;
  4409. // Apply relative offset (+=/-=) if specified
  4410. adjusted = valueParts[ 1 ] ?
  4411. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  4412. +valueParts[ 2 ];
  4413. if ( tween ) {
  4414. tween.unit = unit;
  4415. tween.start = initialInUnit;
  4416. tween.end = adjusted;
  4417. }
  4418. }
  4419. return adjusted;
  4420. }
  4421. var defaultDisplayMap = {};
  4422. function getDefaultDisplay( elem ) {
  4423. var temp,
  4424. doc = elem.ownerDocument,
  4425. nodeName = elem.nodeName,
  4426. display = defaultDisplayMap[ nodeName ];
  4427. if ( display ) {
  4428. return display;
  4429. }
  4430. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  4431. display = jQuery.css( temp, "display" );
  4432. temp.parentNode.removeChild( temp );
  4433. if ( display === "none" ) {
  4434. display = "block";
  4435. }
  4436. defaultDisplayMap[ nodeName ] = display;
  4437. return display;
  4438. }
  4439. function showHide( elements, show ) {
  4440. var display, elem,
  4441. values = [],
  4442. index = 0,
  4443. length = elements.length;
  4444. // Determine new display value for elements that need to change
  4445. for ( ; index < length; index++ ) {
  4446. elem = elements[ index ];
  4447. if ( !elem.style ) {
  4448. continue;
  4449. }
  4450. display = elem.style.display;
  4451. if ( show ) {
  4452. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  4453. // check is required in this first loop unless we have a nonempty display value (either
  4454. // inline or about-to-be-restored)
  4455. if ( display === "none" ) {
  4456. values[ index ] = dataPriv.get( elem, "display" ) || null;
  4457. if ( !values[ index ] ) {
  4458. elem.style.display = "";
  4459. }
  4460. }
  4461. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  4462. values[ index ] = getDefaultDisplay( elem );
  4463. }
  4464. } else {
  4465. if ( display !== "none" ) {
  4466. values[ index ] = "none";
  4467. // Remember what we're overwriting
  4468. dataPriv.set( elem, "display", display );
  4469. }
  4470. }
  4471. }
  4472. // Set the display of the elements in a second loop to avoid constant reflow
  4473. for ( index = 0; index < length; index++ ) {
  4474. if ( values[ index ] != null ) {
  4475. elements[ index ].style.display = values[ index ];
  4476. }
  4477. }
  4478. return elements;
  4479. }
  4480. jQuery.fn.extend( {
  4481. show: function() {
  4482. return showHide( this, true );
  4483. },
  4484. hide: function() {
  4485. return showHide( this );
  4486. },
  4487. toggle: function( state ) {
  4488. if ( typeof state === "boolean" ) {
  4489. return state ? this.show() : this.hide();
  4490. }
  4491. return this.each( function() {
  4492. if ( isHiddenWithinTree( this ) ) {
  4493. jQuery( this ).show();
  4494. } else {
  4495. jQuery( this ).hide();
  4496. }
  4497. } );
  4498. }
  4499. } );
  4500. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  4501. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  4502. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  4503. // We have to close these tags to support XHTML (#13200)
  4504. var wrapMap = {
  4505. // Support: IE <=9 only
  4506. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4507. // XHTML parsers do not magically insert elements in the
  4508. // same way that tag soup parsers do. So we cannot shorten
  4509. // this by omitting <tbody> or other required elements.
  4510. thead: [ 1, "<table>", "</table>" ],
  4511. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4512. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4513. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4514. _default: [ 0, "", "" ]
  4515. };
  4516. // Support: IE <=9 only
  4517. wrapMap.optgroup = wrapMap.option;
  4518. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4519. wrapMap.th = wrapMap.td;
  4520. function getAll( context, tag ) {
  4521. // Support: IE <=9 - 11 only
  4522. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  4523. var ret;
  4524. if ( typeof context.getElementsByTagName !== "undefined" ) {
  4525. ret = context.getElementsByTagName( tag || "*" );
  4526. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  4527. ret = context.querySelectorAll( tag || "*" );
  4528. } else {
  4529. ret = [];
  4530. }
  4531. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  4532. return jQuery.merge( [ context ], ret );
  4533. }
  4534. return ret;
  4535. }
  4536. // Mark scripts as having already been evaluated
  4537. function setGlobalEval( elems, refElements ) {
  4538. var i = 0,
  4539. l = elems.length;
  4540. for ( ; i < l; i++ ) {
  4541. dataPriv.set(
  4542. elems[ i ],
  4543. "globalEval",
  4544. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  4545. );
  4546. }
  4547. }
  4548. var rhtml = /<|&#?\w+;/;
  4549. function buildFragment( elems, context, scripts, selection, ignored ) {
  4550. var elem, tmp, tag, wrap, contains, j,
  4551. fragment = context.createDocumentFragment(),
  4552. nodes = [],
  4553. i = 0,
  4554. l = elems.length;
  4555. for ( ; i < l; i++ ) {
  4556. elem = elems[ i ];
  4557. if ( elem || elem === 0 ) {
  4558. // Add nodes directly
  4559. if ( jQuery.type( elem ) === "object" ) {
  4560. // Support: Android <=4.0 only, PhantomJS 1 only
  4561. // push.apply(_, arraylike) throws on ancient WebKit
  4562. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4563. // Convert non-html into a text node
  4564. } else if ( !rhtml.test( elem ) ) {
  4565. nodes.push( context.createTextNode( elem ) );
  4566. // Convert html into DOM nodes
  4567. } else {
  4568. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  4569. // Deserialize a standard representation
  4570. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4571. wrap = wrapMap[ tag ] || wrapMap._default;
  4572. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  4573. // Descend through wrappers to the right content
  4574. j = wrap[ 0 ];
  4575. while ( j-- ) {
  4576. tmp = tmp.lastChild;
  4577. }
  4578. // Support: Android <=4.0 only, PhantomJS 1 only
  4579. // push.apply(_, arraylike) throws on ancient WebKit
  4580. jQuery.merge( nodes, tmp.childNodes );
  4581. // Remember the top-level container
  4582. tmp = fragment.firstChild;
  4583. // Ensure the created nodes are orphaned (#12392)
  4584. tmp.textContent = "";
  4585. }
  4586. }
  4587. }
  4588. // Remove wrapper from fragment
  4589. fragment.textContent = "";
  4590. i = 0;
  4591. while ( ( elem = nodes[ i++ ] ) ) {
  4592. // Skip elements already in the context collection (trac-4087)
  4593. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  4594. if ( ignored ) {
  4595. ignored.push( elem );
  4596. }
  4597. continue;
  4598. }
  4599. contains = jQuery.contains( elem.ownerDocument, elem );
  4600. // Append to fragment
  4601. tmp = getAll( fragment.appendChild( elem ), "script" );
  4602. // Preserve script evaluation history
  4603. if ( contains ) {
  4604. setGlobalEval( tmp );
  4605. }
  4606. // Capture executables
  4607. if ( scripts ) {
  4608. j = 0;
  4609. while ( ( elem = tmp[ j++ ] ) ) {
  4610. if ( rscriptType.test( elem.type || "" ) ) {
  4611. scripts.push( elem );
  4612. }
  4613. }
  4614. }
  4615. }
  4616. return fragment;
  4617. }
  4618. ( function() {
  4619. var fragment = document.createDocumentFragment(),
  4620. div = fragment.appendChild( document.createElement( "div" ) ),
  4621. input = document.createElement( "input" );
  4622. // Support: Android 4.0 - 4.3 only
  4623. // Check state lost if the name is set (#11217)
  4624. // Support: Windows Web Apps (WWA)
  4625. // `name` and `type` must use .setAttribute for WWA (#14901)
  4626. input.setAttribute( "type", "radio" );
  4627. input.setAttribute( "checked", "checked" );
  4628. input.setAttribute( "name", "t" );
  4629. div.appendChild( input );
  4630. // Support: Android <=4.1 only
  4631. // Older WebKit doesn't clone checked state correctly in fragments
  4632. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  4633. // Support: IE <=11 only
  4634. // Make sure textarea (and checkbox) defaultValue is properly cloned
  4635. div.innerHTML = "<textarea>x</textarea>";
  4636. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  4637. } )();
  4638. var documentElement = document.documentElement;
  4639. var
  4640. rkeyEvent = /^key/,
  4641. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  4642. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4643. function returnTrue() {
  4644. return true;
  4645. }
  4646. function returnFalse() {
  4647. return false;
  4648. }
  4649. // Support: IE <=9 only
  4650. // See #13393 for more info
  4651. function safeActiveElement() {
  4652. try {
  4653. return document.activeElement;
  4654. } catch ( err ) { }
  4655. }
  4656. function on( elem, types, selector, data, fn, one ) {
  4657. var origFn, type;
  4658. // Types can be a map of types/handlers
  4659. if ( typeof types === "object" ) {
  4660. // ( types-Object, selector, data )
  4661. if ( typeof selector !== "string" ) {
  4662. // ( types-Object, data )
  4663. data = data || selector;
  4664. selector = undefined;
  4665. }
  4666. for ( type in types ) {
  4667. on( elem, type, selector, data, types[ type ], one );
  4668. }
  4669. return elem;
  4670. }
  4671. if ( data == null && fn == null ) {
  4672. // ( types, fn )
  4673. fn = selector;
  4674. data = selector = undefined;
  4675. } else if ( fn == null ) {
  4676. if ( typeof selector === "string" ) {
  4677. // ( types, selector, fn )
  4678. fn = data;
  4679. data = undefined;
  4680. } else {
  4681. // ( types, data, fn )
  4682. fn = data;
  4683. data = selector;
  4684. selector = undefined;
  4685. }
  4686. }
  4687. if ( fn === false ) {
  4688. fn = returnFalse;
  4689. } else if ( !fn ) {
  4690. return elem;
  4691. }
  4692. if ( one === 1 ) {
  4693. origFn = fn;
  4694. fn = function( event ) {
  4695. // Can use an empty set, since event contains the info
  4696. jQuery().off( event );
  4697. return origFn.apply( this, arguments );
  4698. };
  4699. // Use same guid so caller can remove using origFn
  4700. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4701. }
  4702. return elem.each( function() {
  4703. jQuery.event.add( this, types, fn, data, selector );
  4704. } );
  4705. }
  4706. /*
  4707. * Helper functions for managing events -- not part of the public interface.
  4708. * Props to Dean Edwards' addEvent library for many of the ideas.
  4709. */
  4710. jQuery.event = {
  4711. global: {},
  4712. add: function( elem, types, handler, data, selector ) {
  4713. var handleObjIn, eventHandle, tmp,
  4714. events, t, handleObj,
  4715. special, handlers, type, namespaces, origType,
  4716. elemData = dataPriv.get( elem );
  4717. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4718. if ( !elemData ) {
  4719. return;
  4720. }
  4721. // Caller can pass in an object of custom data in lieu of the handler
  4722. if ( handler.handler ) {
  4723. handleObjIn = handler;
  4724. handler = handleObjIn.handler;
  4725. selector = handleObjIn.selector;
  4726. }
  4727. // Ensure that invalid selectors throw exceptions at attach time
  4728. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4729. if ( selector ) {
  4730. jQuery.find.matchesSelector( documentElement, selector );
  4731. }
  4732. // Make sure that the handler has a unique ID, used to find/remove it later
  4733. if ( !handler.guid ) {
  4734. handler.guid = jQuery.guid++;
  4735. }
  4736. // Init the element's event structure and main handler, if this is the first
  4737. if ( !( events = elemData.events ) ) {
  4738. events = elemData.events = {};
  4739. }
  4740. if ( !( eventHandle = elemData.handle ) ) {
  4741. eventHandle = elemData.handle = function( e ) {
  4742. // Discard the second event of a jQuery.event.trigger() and
  4743. // when an event is called after a page has unloaded
  4744. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4745. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4746. };
  4747. }
  4748. // Handle multiple events separated by a space
  4749. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4750. t = types.length;
  4751. while ( t-- ) {
  4752. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4753. type = origType = tmp[ 1 ];
  4754. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4755. // There *must* be a type, no attaching namespace-only handlers
  4756. if ( !type ) {
  4757. continue;
  4758. }
  4759. // If event changes its type, use the special event handlers for the changed type
  4760. special = jQuery.event.special[ type ] || {};
  4761. // If selector defined, determine special event api type, otherwise given type
  4762. type = ( selector ? special.delegateType : special.bindType ) || type;
  4763. // Update special based on newly reset type
  4764. special = jQuery.event.special[ type ] || {};
  4765. // handleObj is passed to all event handlers
  4766. handleObj = jQuery.extend( {
  4767. type: type,
  4768. origType: origType,
  4769. data: data,
  4770. handler: handler,
  4771. guid: handler.guid,
  4772. selector: selector,
  4773. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4774. namespace: namespaces.join( "." )
  4775. }, handleObjIn );
  4776. // Init the event handler queue if we're the first
  4777. if ( !( handlers = events[ type ] ) ) {
  4778. handlers = events[ type ] = [];
  4779. handlers.delegateCount = 0;
  4780. // Only use addEventListener if the special events handler returns false
  4781. if ( !special.setup ||
  4782. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4783. if ( elem.addEventListener ) {
  4784. elem.addEventListener( type, eventHandle );
  4785. }
  4786. }
  4787. }
  4788. if ( special.add ) {
  4789. special.add.call( elem, handleObj );
  4790. if ( !handleObj.handler.guid ) {
  4791. handleObj.handler.guid = handler.guid;
  4792. }
  4793. }
  4794. // Add to the element's handler list, delegates in front
  4795. if ( selector ) {
  4796. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4797. } else {
  4798. handlers.push( handleObj );
  4799. }
  4800. // Keep track of which events have ever been used, for event optimization
  4801. jQuery.event.global[ type ] = true;
  4802. }
  4803. },
  4804. // Detach an event or set of events from an element
  4805. remove: function( elem, types, handler, selector, mappedTypes ) {
  4806. var j, origCount, tmp,
  4807. events, t, handleObj,
  4808. special, handlers, type, namespaces, origType,
  4809. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4810. if ( !elemData || !( events = elemData.events ) ) {
  4811. return;
  4812. }
  4813. // Once for each type.namespace in types; type may be omitted
  4814. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4815. t = types.length;
  4816. while ( t-- ) {
  4817. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4818. type = origType = tmp[ 1 ];
  4819. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4820. // Unbind all events (on this namespace, if provided) for the element
  4821. if ( !type ) {
  4822. for ( type in events ) {
  4823. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4824. }
  4825. continue;
  4826. }
  4827. special = jQuery.event.special[ type ] || {};
  4828. type = ( selector ? special.delegateType : special.bindType ) || type;
  4829. handlers = events[ type ] || [];
  4830. tmp = tmp[ 2 ] &&
  4831. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4832. // Remove matching events
  4833. origCount = j = handlers.length;
  4834. while ( j-- ) {
  4835. handleObj = handlers[ j ];
  4836. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4837. ( !handler || handler.guid === handleObj.guid ) &&
  4838. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4839. ( !selector || selector === handleObj.selector ||
  4840. selector === "**" && handleObj.selector ) ) {
  4841. handlers.splice( j, 1 );
  4842. if ( handleObj.selector ) {
  4843. handlers.delegateCount--;
  4844. }
  4845. if ( special.remove ) {
  4846. special.remove.call( elem, handleObj );
  4847. }
  4848. }
  4849. }
  4850. // Remove generic event handler if we removed something and no more handlers exist
  4851. // (avoids potential for endless recursion during removal of special event handlers)
  4852. if ( origCount && !handlers.length ) {
  4853. if ( !special.teardown ||
  4854. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4855. jQuery.removeEvent( elem, type, elemData.handle );
  4856. }
  4857. delete events[ type ];
  4858. }
  4859. }
  4860. // Remove data and the expando if it's no longer used
  4861. if ( jQuery.isEmptyObject( events ) ) {
  4862. dataPriv.remove( elem, "handle events" );
  4863. }
  4864. },
  4865. dispatch: function( nativeEvent ) {
  4866. // Make a writable jQuery.Event from the native event object
  4867. var event = jQuery.event.fix( nativeEvent );
  4868. var i, j, ret, matched, handleObj, handlerQueue,
  4869. args = new Array( arguments.length ),
  4870. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  4871. special = jQuery.event.special[ event.type ] || {};
  4872. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4873. args[ 0 ] = event;
  4874. for ( i = 1; i < arguments.length; i++ ) {
  4875. args[ i ] = arguments[ i ];
  4876. }
  4877. event.delegateTarget = this;
  4878. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4879. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4880. return;
  4881. }
  4882. // Determine handlers
  4883. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4884. // Run delegates first; they may want to stop propagation beneath us
  4885. i = 0;
  4886. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4887. event.currentTarget = matched.elem;
  4888. j = 0;
  4889. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4890. !event.isImmediatePropagationStopped() ) {
  4891. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4892. // a subset or equal to those in the bound event (both can have no namespace).
  4893. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4894. event.handleObj = handleObj;
  4895. event.data = handleObj.data;
  4896. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4897. handleObj.handler ).apply( matched.elem, args );
  4898. if ( ret !== undefined ) {
  4899. if ( ( event.result = ret ) === false ) {
  4900. event.preventDefault();
  4901. event.stopPropagation();
  4902. }
  4903. }
  4904. }
  4905. }
  4906. }
  4907. // Call the postDispatch hook for the mapped type
  4908. if ( special.postDispatch ) {
  4909. special.postDispatch.call( this, event );
  4910. }
  4911. return event.result;
  4912. },
  4913. handlers: function( event, handlers ) {
  4914. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4915. handlerQueue = [],
  4916. delegateCount = handlers.delegateCount,
  4917. cur = event.target;
  4918. // Find delegate handlers
  4919. if ( delegateCount &&
  4920. // Support: IE <=9
  4921. // Black-hole SVG <use> instance trees (trac-13180)
  4922. cur.nodeType &&
  4923. // Support: Firefox <=42
  4924. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  4925. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  4926. // Support: IE 11 only
  4927. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  4928. !( event.type === "click" && event.button >= 1 ) ) {
  4929. for ( ; cur !== this; cur = cur.parentNode || this ) {
  4930. // Don't check non-elements (#13208)
  4931. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4932. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  4933. matchedHandlers = [];
  4934. matchedSelectors = {};
  4935. for ( i = 0; i < delegateCount; i++ ) {
  4936. handleObj = handlers[ i ];
  4937. // Don't conflict with Object.prototype properties (#13203)
  4938. sel = handleObj.selector + " ";
  4939. if ( matchedSelectors[ sel ] === undefined ) {
  4940. matchedSelectors[ sel ] = handleObj.needsContext ?
  4941. jQuery( sel, this ).index( cur ) > -1 :
  4942. jQuery.find( sel, this, null, [ cur ] ).length;
  4943. }
  4944. if ( matchedSelectors[ sel ] ) {
  4945. matchedHandlers.push( handleObj );
  4946. }
  4947. }
  4948. if ( matchedHandlers.length ) {
  4949. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  4950. }
  4951. }
  4952. }
  4953. }
  4954. // Add the remaining (directly-bound) handlers
  4955. cur = this;
  4956. if ( delegateCount < handlers.length ) {
  4957. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  4958. }
  4959. return handlerQueue;
  4960. },
  4961. addProp: function( name, hook ) {
  4962. Object.defineProperty( jQuery.Event.prototype, name, {
  4963. enumerable: true,
  4964. configurable: true,
  4965. get: jQuery.isFunction( hook ) ?
  4966. function() {
  4967. if ( this.originalEvent ) {
  4968. return hook( this.originalEvent );
  4969. }
  4970. } :
  4971. function() {
  4972. if ( this.originalEvent ) {
  4973. return this.originalEvent[ name ];
  4974. }
  4975. },
  4976. set: function( value ) {
  4977. Object.defineProperty( this, name, {
  4978. enumerable: true,
  4979. configurable: true,
  4980. writable: true,
  4981. value: value
  4982. } );
  4983. }
  4984. } );
  4985. },
  4986. fix: function( originalEvent ) {
  4987. return originalEvent[ jQuery.expando ] ?
  4988. originalEvent :
  4989. new jQuery.Event( originalEvent );
  4990. },
  4991. special: {
  4992. load: {
  4993. // Prevent triggered image.load events from bubbling to window.load
  4994. noBubble: true
  4995. },
  4996. focus: {
  4997. // Fire native event if possible so blur/focus sequence is correct
  4998. trigger: function() {
  4999. if ( this !== safeActiveElement() && this.focus ) {
  5000. this.focus();
  5001. return false;
  5002. }
  5003. },
  5004. delegateType: "focusin"
  5005. },
  5006. blur: {
  5007. trigger: function() {
  5008. if ( this === safeActiveElement() && this.blur ) {
  5009. this.blur();
  5010. return false;
  5011. }
  5012. },
  5013. delegateType: "focusout"
  5014. },
  5015. click: {
  5016. // For checkbox, fire native event so checked state will be right
  5017. trigger: function() {
  5018. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  5019. this.click();
  5020. return false;
  5021. }
  5022. },
  5023. // For cross-browser consistency, don't fire native .click() on links
  5024. _default: function( event ) {
  5025. return nodeName( event.target, "a" );
  5026. }
  5027. },
  5028. beforeunload: {
  5029. postDispatch: function( event ) {
  5030. // Support: Firefox 20+
  5031. // Firefox doesn't alert if the returnValue field is not set.
  5032. if ( event.result !== undefined && event.originalEvent ) {
  5033. event.originalEvent.returnValue = event.result;
  5034. }
  5035. }
  5036. }
  5037. }
  5038. };
  5039. jQuery.removeEvent = function( elem, type, handle ) {
  5040. // This "if" is needed for plain objects
  5041. if ( elem.removeEventListener ) {
  5042. elem.removeEventListener( type, handle );
  5043. }
  5044. };
  5045. jQuery.Event = function( src, props ) {
  5046. // Allow instantiation without the 'new' keyword
  5047. if ( !( this instanceof jQuery.Event ) ) {
  5048. return new jQuery.Event( src, props );
  5049. }
  5050. // Event object
  5051. if ( src && src.type ) {
  5052. this.originalEvent = src;
  5053. this.type = src.type;
  5054. // Events bubbling up the document may have been marked as prevented
  5055. // by a handler lower down the tree; reflect the correct value.
  5056. this.isDefaultPrevented = src.defaultPrevented ||
  5057. src.defaultPrevented === undefined &&
  5058. // Support: Android <=2.3 only
  5059. src.returnValue === false ?
  5060. returnTrue :
  5061. returnFalse;
  5062. // Create target properties
  5063. // Support: Safari <=6 - 7 only
  5064. // Target should not be a text node (#504, #13143)
  5065. this.target = ( src.target && src.target.nodeType === 3 ) ?
  5066. src.target.parentNode :
  5067. src.target;
  5068. this.currentTarget = src.currentTarget;
  5069. this.relatedTarget = src.relatedTarget;
  5070. // Event type
  5071. } else {
  5072. this.type = src;
  5073. }
  5074. // Put explicitly provided properties onto the event object
  5075. if ( props ) {
  5076. jQuery.extend( this, props );
  5077. }
  5078. // Create a timestamp if incoming event doesn't have one
  5079. this.timeStamp = src && src.timeStamp || jQuery.now();
  5080. // Mark it as fixed
  5081. this[ jQuery.expando ] = true;
  5082. };
  5083. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  5084. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  5085. jQuery.Event.prototype = {
  5086. constructor: jQuery.Event,
  5087. isDefaultPrevented: returnFalse,
  5088. isPropagationStopped: returnFalse,
  5089. isImmediatePropagationStopped: returnFalse,
  5090. isSimulated: false,
  5091. preventDefault: function() {
  5092. var e = this.originalEvent;
  5093. this.isDefaultPrevented = returnTrue;
  5094. if ( e && !this.isSimulated ) {
  5095. e.preventDefault();
  5096. }
  5097. },
  5098. stopPropagation: function() {
  5099. var e = this.originalEvent;
  5100. this.isPropagationStopped = returnTrue;
  5101. if ( e && !this.isSimulated ) {
  5102. e.stopPropagation();
  5103. }
  5104. },
  5105. stopImmediatePropagation: function() {
  5106. var e = this.originalEvent;
  5107. this.isImmediatePropagationStopped = returnTrue;
  5108. if ( e && !this.isSimulated ) {
  5109. e.stopImmediatePropagation();
  5110. }
  5111. this.stopPropagation();
  5112. }
  5113. };
  5114. // Includes all common event props including KeyEvent and MouseEvent specific props
  5115. jQuery.each( {
  5116. altKey: true,
  5117. bubbles: true,
  5118. cancelable: true,
  5119. changedTouches: true,
  5120. ctrlKey: true,
  5121. detail: true,
  5122. eventPhase: true,
  5123. metaKey: true,
  5124. pageX: true,
  5125. pageY: true,
  5126. shiftKey: true,
  5127. view: true,
  5128. "char": true,
  5129. charCode: true,
  5130. key: true,
  5131. keyCode: true,
  5132. button: true,
  5133. buttons: true,
  5134. clientX: true,
  5135. clientY: true,
  5136. offsetX: true,
  5137. offsetY: true,
  5138. pointerId: true,
  5139. pointerType: true,
  5140. screenX: true,
  5141. screenY: true,
  5142. targetTouches: true,
  5143. toElement: true,
  5144. touches: true,
  5145. which: function( event ) {
  5146. var button = event.button;
  5147. // Add which for key events
  5148. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  5149. return event.charCode != null ? event.charCode : event.keyCode;
  5150. }
  5151. // Add which for click: 1 === left; 2 === middle; 3 === right
  5152. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  5153. if ( button & 1 ) {
  5154. return 1;
  5155. }
  5156. if ( button & 2 ) {
  5157. return 3;
  5158. }
  5159. if ( button & 4 ) {
  5160. return 2;
  5161. }
  5162. return 0;
  5163. }
  5164. return event.which;
  5165. }
  5166. }, jQuery.event.addProp );
  5167. // Create mouseenter/leave events using mouseover/out and event-time checks
  5168. // so that event delegation works in jQuery.
  5169. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  5170. //
  5171. // Support: Safari 7 only
  5172. // Safari sends mouseenter too often; see:
  5173. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  5174. // for the description of the bug (it existed in older Chrome versions as well).
  5175. jQuery.each( {
  5176. mouseenter: "mouseover",
  5177. mouseleave: "mouseout",
  5178. pointerenter: "pointerover",
  5179. pointerleave: "pointerout"
  5180. }, function( orig, fix ) {
  5181. jQuery.event.special[ orig ] = {
  5182. delegateType: fix,
  5183. bindType: fix,
  5184. handle: function( event ) {
  5185. var ret,
  5186. target = this,
  5187. related = event.relatedTarget,
  5188. handleObj = event.handleObj;
  5189. // For mouseenter/leave call the handler if related is outside the target.
  5190. // NB: No relatedTarget if the mouse left/entered the browser window
  5191. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  5192. event.type = handleObj.origType;
  5193. ret = handleObj.handler.apply( this, arguments );
  5194. event.type = fix;
  5195. }
  5196. return ret;
  5197. }
  5198. };
  5199. } );
  5200. jQuery.fn.extend( {
  5201. on: function( types, selector, data, fn ) {
  5202. return on( this, types, selector, data, fn );
  5203. },
  5204. one: function( types, selector, data, fn ) {
  5205. return on( this, types, selector, data, fn, 1 );
  5206. },
  5207. off: function( types, selector, fn ) {
  5208. var handleObj, type;
  5209. if ( types && types.preventDefault && types.handleObj ) {
  5210. // ( event ) dispatched jQuery.Event
  5211. handleObj = types.handleObj;
  5212. jQuery( types.delegateTarget ).off(
  5213. handleObj.namespace ?
  5214. handleObj.origType + "." + handleObj.namespace :
  5215. handleObj.origType,
  5216. handleObj.selector,
  5217. handleObj.handler
  5218. );
  5219. return this;
  5220. }
  5221. if ( typeof types === "object" ) {
  5222. // ( types-object [, selector] )
  5223. for ( type in types ) {
  5224. this.off( type, selector, types[ type ] );
  5225. }
  5226. return this;
  5227. }
  5228. if ( selector === false || typeof selector === "function" ) {
  5229. // ( types [, fn] )
  5230. fn = selector;
  5231. selector = undefined;
  5232. }
  5233. if ( fn === false ) {
  5234. fn = returnFalse;
  5235. }
  5236. return this.each( function() {
  5237. jQuery.event.remove( this, types, fn, selector );
  5238. } );
  5239. }
  5240. } );
  5241. var
  5242. /* eslint-disable max-len */
  5243. // See https://github.com/eslint/eslint/issues/3229
  5244. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  5245. /* eslint-enable */
  5246. // Support: IE <=10 - 11, Edge 12 - 13
  5247. // In IE/Edge using regex groups here causes severe slowdowns.
  5248. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  5249. rnoInnerhtml = /<script|<style|<link/i,
  5250. // checked="checked" or checked
  5251. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  5252. rscriptTypeMasked = /^true\/(.*)/,
  5253. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  5254. // Prefer a tbody over its parent table for containing new rows
  5255. function manipulationTarget( elem, content ) {
  5256. if ( nodeName( elem, "table" ) &&
  5257. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  5258. return jQuery( ">tbody", elem )[ 0 ] || elem;
  5259. }
  5260. return elem;
  5261. }
  5262. // Replace/restore the type attribute of script elements for safe DOM manipulation
  5263. function disableScript( elem ) {
  5264. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  5265. return elem;
  5266. }
  5267. function restoreScript( elem ) {
  5268. var match = rscriptTypeMasked.exec( elem.type );
  5269. if ( match ) {
  5270. elem.type = match[ 1 ];
  5271. } else {
  5272. elem.removeAttribute( "type" );
  5273. }
  5274. return elem;
  5275. }
  5276. function cloneCopyEvent( src, dest ) {
  5277. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  5278. if ( dest.nodeType !== 1 ) {
  5279. return;
  5280. }
  5281. // 1. Copy private data: events, handlers, etc.
  5282. if ( dataPriv.hasData( src ) ) {
  5283. pdataOld = dataPriv.access( src );
  5284. pdataCur = dataPriv.set( dest, pdataOld );
  5285. events = pdataOld.events;
  5286. if ( events ) {
  5287. delete pdataCur.handle;
  5288. pdataCur.events = {};
  5289. for ( type in events ) {
  5290. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  5291. jQuery.event.add( dest, type, events[ type ][ i ] );
  5292. }
  5293. }
  5294. }
  5295. }
  5296. // 2. Copy user data
  5297. if ( dataUser.hasData( src ) ) {
  5298. udataOld = dataUser.access( src );
  5299. udataCur = jQuery.extend( {}, udataOld );
  5300. dataUser.set( dest, udataCur );
  5301. }
  5302. }
  5303. // Fix IE bugs, see support tests
  5304. function fixInput( src, dest ) {
  5305. var nodeName = dest.nodeName.toLowerCase();
  5306. // Fails to persist the checked state of a cloned checkbox or radio button.
  5307. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  5308. dest.checked = src.checked;
  5309. // Fails to return the selected option to the default selected state when cloning options
  5310. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  5311. dest.defaultValue = src.defaultValue;
  5312. }
  5313. }
  5314. function domManip( collection, args, callback, ignored ) {
  5315. // Flatten any nested arrays
  5316. args = concat.apply( [], args );
  5317. var fragment, first, scripts, hasScripts, node, doc,
  5318. i = 0,
  5319. l = collection.length,
  5320. iNoClone = l - 1,
  5321. value = args[ 0 ],
  5322. isFunction = jQuery.isFunction( value );
  5323. // We can't cloneNode fragments that contain checked, in WebKit
  5324. if ( isFunction ||
  5325. ( l > 1 && typeof value === "string" &&
  5326. !support.checkClone && rchecked.test( value ) ) ) {
  5327. return collection.each( function( index ) {
  5328. var self = collection.eq( index );
  5329. if ( isFunction ) {
  5330. args[ 0 ] = value.call( this, index, self.html() );
  5331. }
  5332. domManip( self, args, callback, ignored );
  5333. } );
  5334. }
  5335. if ( l ) {
  5336. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  5337. first = fragment.firstChild;
  5338. if ( fragment.childNodes.length === 1 ) {
  5339. fragment = first;
  5340. }
  5341. // Require either new content or an interest in ignored elements to invoke the callback
  5342. if ( first || ignored ) {
  5343. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  5344. hasScripts = scripts.length;
  5345. // Use the original fragment for the last item
  5346. // instead of the first because it can end up
  5347. // being emptied incorrectly in certain situations (#8070).
  5348. for ( ; i < l; i++ ) {
  5349. node = fragment;
  5350. if ( i !== iNoClone ) {
  5351. node = jQuery.clone( node, true, true );
  5352. // Keep references to cloned scripts for later restoration
  5353. if ( hasScripts ) {
  5354. // Support: Android <=4.0 only, PhantomJS 1 only
  5355. // push.apply(_, arraylike) throws on ancient WebKit
  5356. jQuery.merge( scripts, getAll( node, "script" ) );
  5357. }
  5358. }
  5359. callback.call( collection[ i ], node, i );
  5360. }
  5361. if ( hasScripts ) {
  5362. doc = scripts[ scripts.length - 1 ].ownerDocument;
  5363. // Reenable scripts
  5364. jQuery.map( scripts, restoreScript );
  5365. // Evaluate executable scripts on first document insertion
  5366. for ( i = 0; i < hasScripts; i++ ) {
  5367. node = scripts[ i ];
  5368. if ( rscriptType.test( node.type || "" ) &&
  5369. !dataPriv.access( node, "globalEval" ) &&
  5370. jQuery.contains( doc, node ) ) {
  5371. if ( node.src ) {
  5372. // Optional AJAX dependency, but won't run scripts if not present
  5373. if ( jQuery._evalUrl ) {
  5374. jQuery._evalUrl( node.src );
  5375. }
  5376. } else {
  5377. DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
  5378. }
  5379. }
  5380. }
  5381. }
  5382. }
  5383. }
  5384. return collection;
  5385. }
  5386. function remove( elem, selector, keepData ) {
  5387. var node,
  5388. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  5389. i = 0;
  5390. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  5391. if ( !keepData && node.nodeType === 1 ) {
  5392. jQuery.cleanData( getAll( node ) );
  5393. }
  5394. if ( node.parentNode ) {
  5395. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  5396. setGlobalEval( getAll( node, "script" ) );
  5397. }
  5398. node.parentNode.removeChild( node );
  5399. }
  5400. }
  5401. return elem;
  5402. }
  5403. jQuery.extend( {
  5404. htmlPrefilter: function( html ) {
  5405. return html.replace( rxhtmlTag, "<$1></$2>" );
  5406. },
  5407. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  5408. var i, l, srcElements, destElements,
  5409. clone = elem.cloneNode( true ),
  5410. inPage = jQuery.contains( elem.ownerDocument, elem );
  5411. // Fix IE cloning issues
  5412. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  5413. !jQuery.isXMLDoc( elem ) ) {
  5414. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  5415. destElements = getAll( clone );
  5416. srcElements = getAll( elem );
  5417. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5418. fixInput( srcElements[ i ], destElements[ i ] );
  5419. }
  5420. }
  5421. // Copy the events from the original to the clone
  5422. if ( dataAndEvents ) {
  5423. if ( deepDataAndEvents ) {
  5424. srcElements = srcElements || getAll( elem );
  5425. destElements = destElements || getAll( clone );
  5426. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5427. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  5428. }
  5429. } else {
  5430. cloneCopyEvent( elem, clone );
  5431. }
  5432. }
  5433. // Preserve script evaluation history
  5434. destElements = getAll( clone, "script" );
  5435. if ( destElements.length > 0 ) {
  5436. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  5437. }
  5438. // Return the cloned set
  5439. return clone;
  5440. },
  5441. cleanData: function( elems ) {
  5442. var data, elem, type,
  5443. special = jQuery.event.special,
  5444. i = 0;
  5445. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  5446. if ( acceptData( elem ) ) {
  5447. if ( ( data = elem[ dataPriv.expando ] ) ) {
  5448. if ( data.events ) {
  5449. for ( type in data.events ) {
  5450. if ( special[ type ] ) {
  5451. jQuery.event.remove( elem, type );
  5452. // This is a shortcut to avoid jQuery.event.remove's overhead
  5453. } else {
  5454. jQuery.removeEvent( elem, type, data.handle );
  5455. }
  5456. }
  5457. }
  5458. // Support: Chrome <=35 - 45+
  5459. // Assign undefined instead of using delete, see Data#remove
  5460. elem[ dataPriv.expando ] = undefined;
  5461. }
  5462. if ( elem[ dataUser.expando ] ) {
  5463. // Support: Chrome <=35 - 45+
  5464. // Assign undefined instead of using delete, see Data#remove
  5465. elem[ dataUser.expando ] = undefined;
  5466. }
  5467. }
  5468. }
  5469. }
  5470. } );
  5471. jQuery.fn.extend( {
  5472. detach: function( selector ) {
  5473. return remove( this, selector, true );
  5474. },
  5475. remove: function( selector ) {
  5476. return remove( this, selector );
  5477. },
  5478. text: function( value ) {
  5479. return access( this, function( value ) {
  5480. return value === undefined ?
  5481. jQuery.text( this ) :
  5482. this.empty().each( function() {
  5483. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5484. this.textContent = value;
  5485. }
  5486. } );
  5487. }, null, value, arguments.length );
  5488. },
  5489. append: function() {
  5490. return domManip( this, arguments, function( elem ) {
  5491. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5492. var target = manipulationTarget( this, elem );
  5493. target.appendChild( elem );
  5494. }
  5495. } );
  5496. },
  5497. prepend: function() {
  5498. return domManip( this, arguments, function( elem ) {
  5499. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5500. var target = manipulationTarget( this, elem );
  5501. target.insertBefore( elem, target.firstChild );
  5502. }
  5503. } );
  5504. },
  5505. before: function() {
  5506. return domManip( this, arguments, function( elem ) {
  5507. if ( this.parentNode ) {
  5508. this.parentNode.insertBefore( elem, this );
  5509. }
  5510. } );
  5511. },
  5512. after: function() {
  5513. return domManip( this, arguments, function( elem ) {
  5514. if ( this.parentNode ) {
  5515. this.parentNode.insertBefore( elem, this.nextSibling );
  5516. }
  5517. } );
  5518. },
  5519. empty: function() {
  5520. var elem,
  5521. i = 0;
  5522. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  5523. if ( elem.nodeType === 1 ) {
  5524. // Prevent memory leaks
  5525. jQuery.cleanData( getAll( elem, false ) );
  5526. // Remove any remaining nodes
  5527. elem.textContent = "";
  5528. }
  5529. }
  5530. return this;
  5531. },
  5532. clone: function( dataAndEvents, deepDataAndEvents ) {
  5533. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5534. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5535. return this.map( function() {
  5536. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  5537. } );
  5538. },
  5539. html: function( value ) {
  5540. return access( this, function( value ) {
  5541. var elem = this[ 0 ] || {},
  5542. i = 0,
  5543. l = this.length;
  5544. if ( value === undefined && elem.nodeType === 1 ) {
  5545. return elem.innerHTML;
  5546. }
  5547. // See if we can take a shortcut and just use innerHTML
  5548. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  5549. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  5550. value = jQuery.htmlPrefilter( value );
  5551. try {
  5552. for ( ; i < l; i++ ) {
  5553. elem = this[ i ] || {};
  5554. // Remove element nodes and prevent memory leaks
  5555. if ( elem.nodeType === 1 ) {
  5556. jQuery.cleanData( getAll( elem, false ) );
  5557. elem.innerHTML = value;
  5558. }
  5559. }
  5560. elem = 0;
  5561. // If using innerHTML throws an exception, use the fallback method
  5562. } catch ( e ) {}
  5563. }
  5564. if ( elem ) {
  5565. this.empty().append( value );
  5566. }
  5567. }, null, value, arguments.length );
  5568. },
  5569. replaceWith: function() {
  5570. var ignored = [];
  5571. // Make the changes, replacing each non-ignored context element with the new content
  5572. return domManip( this, arguments, function( elem ) {
  5573. var parent = this.parentNode;
  5574. if ( jQuery.inArray( this, ignored ) < 0 ) {
  5575. jQuery.cleanData( getAll( this ) );
  5576. if ( parent ) {
  5577. parent.replaceChild( elem, this );
  5578. }
  5579. }
  5580. // Force callback invocation
  5581. }, ignored );
  5582. }
  5583. } );
  5584. jQuery.each( {
  5585. appendTo: "append",
  5586. prependTo: "prepend",
  5587. insertBefore: "before",
  5588. insertAfter: "after",
  5589. replaceAll: "replaceWith"
  5590. }, function( name, original ) {
  5591. jQuery.fn[ name ] = function( selector ) {
  5592. var elems,
  5593. ret = [],
  5594. insert = jQuery( selector ),
  5595. last = insert.length - 1,
  5596. i = 0;
  5597. for ( ; i <= last; i++ ) {
  5598. elems = i === last ? this : this.clone( true );
  5599. jQuery( insert[ i ] )[ original ]( elems );
  5600. // Support: Android <=4.0 only, PhantomJS 1 only
  5601. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  5602. push.apply( ret, elems.get() );
  5603. }
  5604. return this.pushStack( ret );
  5605. };
  5606. } );
  5607. var rmargin = ( /^margin/ );
  5608. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  5609. var getStyles = function( elem ) {
  5610. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  5611. // IE throws on elements created in popups
  5612. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  5613. var view = elem.ownerDocument.defaultView;
  5614. if ( !view || !view.opener ) {
  5615. view = window;
  5616. }
  5617. return view.getComputedStyle( elem );
  5618. };
  5619. ( function() {
  5620. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  5621. // so they're executed at the same time to save the second computation.
  5622. function computeStyleTests() {
  5623. // This is a singleton, we need to execute it only once
  5624. if ( !div ) {
  5625. return;
  5626. }
  5627. div.style.cssText =
  5628. "box-sizing:border-box;" +
  5629. "position:relative;display:block;" +
  5630. "margin:auto;border:1px;padding:1px;" +
  5631. "top:1%;width:50%";
  5632. div.innerHTML = "";
  5633. documentElement.appendChild( container );
  5634. var divStyle = window.getComputedStyle( div );
  5635. pixelPositionVal = divStyle.top !== "1%";
  5636. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  5637. reliableMarginLeftVal = divStyle.marginLeft === "2px";
  5638. boxSizingReliableVal = divStyle.width === "4px";
  5639. // Support: Android 4.0 - 4.3 only
  5640. // Some styles come back with percentage values, even though they shouldn't
  5641. div.style.marginRight = "50%";
  5642. pixelMarginRightVal = divStyle.marginRight === "4px";
  5643. documentElement.removeChild( container );
  5644. // Nullify the div so it wouldn't be stored in the memory and
  5645. // it will also be a sign that checks already performed
  5646. div = null;
  5647. }
  5648. var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
  5649. container = document.createElement( "div" ),
  5650. div = document.createElement( "div" );
  5651. // Finish early in limited (non-browser) environments
  5652. if ( !div.style ) {
  5653. return;
  5654. }
  5655. // Support: IE <=9 - 11 only
  5656. // Style of cloned element affects source element cloned (#8908)
  5657. div.style.backgroundClip = "content-box";
  5658. div.cloneNode( true ).style.backgroundClip = "";
  5659. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5660. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  5661. "padding:0;margin-top:1px;position:absolute";
  5662. container.appendChild( div );
  5663. jQuery.extend( support, {
  5664. pixelPosition: function() {
  5665. computeStyleTests();
  5666. return pixelPositionVal;
  5667. },
  5668. boxSizingReliable: function() {
  5669. computeStyleTests();
  5670. return boxSizingReliableVal;
  5671. },
  5672. pixelMarginRight: function() {
  5673. computeStyleTests();
  5674. return pixelMarginRightVal;
  5675. },
  5676. reliableMarginLeft: function() {
  5677. computeStyleTests();
  5678. return reliableMarginLeftVal;
  5679. }
  5680. } );
  5681. } )();
  5682. function curCSS( elem, name, computed ) {
  5683. var width, minWidth, maxWidth, ret,
  5684. // Support: Firefox 51+
  5685. // Retrieving style before computed somehow
  5686. // fixes an issue with getting wrong values
  5687. // on detached elements
  5688. style = elem.style;
  5689. computed = computed || getStyles( elem );
  5690. // getPropertyValue is needed for:
  5691. // .css('filter') (IE 9 only, #12537)
  5692. // .css('--customProperty) (#3144)
  5693. if ( computed ) {
  5694. ret = computed.getPropertyValue( name ) || computed[ name ];
  5695. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5696. ret = jQuery.style( elem, name );
  5697. }
  5698. // A tribute to the "awesome hack by Dean Edwards"
  5699. // Android Browser returns percentage for some values,
  5700. // but width seems to be reliably pixels.
  5701. // This is against the CSSOM draft spec:
  5702. // https://drafts.csswg.org/cssom/#resolved-values
  5703. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  5704. // Remember the original values
  5705. width = style.width;
  5706. minWidth = style.minWidth;
  5707. maxWidth = style.maxWidth;
  5708. // Put in the new values to get a computed value out
  5709. style.minWidth = style.maxWidth = style.width = ret;
  5710. ret = computed.width;
  5711. // Revert the changed values
  5712. style.width = width;
  5713. style.minWidth = minWidth;
  5714. style.maxWidth = maxWidth;
  5715. }
  5716. }
  5717. return ret !== undefined ?
  5718. // Support: IE <=9 - 11 only
  5719. // IE returns zIndex value as an integer.
  5720. ret + "" :
  5721. ret;
  5722. }
  5723. function addGetHookIf( conditionFn, hookFn ) {
  5724. // Define the hook, we'll check on the first run if it's really needed.
  5725. return {
  5726. get: function() {
  5727. if ( conditionFn() ) {
  5728. // Hook not needed (or it's not possible to use it due
  5729. // to missing dependency), remove it.
  5730. delete this.get;
  5731. return;
  5732. }
  5733. // Hook needed; redefine it so that the support test is not executed again.
  5734. return ( this.get = hookFn ).apply( this, arguments );
  5735. }
  5736. };
  5737. }
  5738. var
  5739. // Swappable if display is none or starts with table
  5740. // except "table", "table-cell", or "table-caption"
  5741. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5742. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5743. rcustomProp = /^--/,
  5744. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5745. cssNormalTransform = {
  5746. letterSpacing: "0",
  5747. fontWeight: "400"
  5748. },
  5749. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5750. emptyStyle = document.createElement( "div" ).style;
  5751. // Return a css property mapped to a potentially vendor prefixed property
  5752. function vendorPropName( name ) {
  5753. // Shortcut for names that are not vendor prefixed
  5754. if ( name in emptyStyle ) {
  5755. return name;
  5756. }
  5757. // Check for vendor prefixed names
  5758. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5759. i = cssPrefixes.length;
  5760. while ( i-- ) {
  5761. name = cssPrefixes[ i ] + capName;
  5762. if ( name in emptyStyle ) {
  5763. return name;
  5764. }
  5765. }
  5766. }
  5767. // Return a property mapped along what jQuery.cssProps suggests or to
  5768. // a vendor prefixed property.
  5769. function finalPropName( name ) {
  5770. var ret = jQuery.cssProps[ name ];
  5771. if ( !ret ) {
  5772. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  5773. }
  5774. return ret;
  5775. }
  5776. function setPositiveNumber( elem, value, subtract ) {
  5777. // Any relative (+/-) values have already been
  5778. // normalized at this point
  5779. var matches = rcssNum.exec( value );
  5780. return matches ?
  5781. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5782. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5783. value;
  5784. }
  5785. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  5786. var i,
  5787. val = 0;
  5788. // If we already have the right measurement, avoid augmentation
  5789. if ( extra === ( isBorderBox ? "border" : "content" ) ) {
  5790. i = 4;
  5791. // Otherwise initialize for horizontal or vertical properties
  5792. } else {
  5793. i = name === "width" ? 1 : 0;
  5794. }
  5795. for ( ; i < 4; i += 2 ) {
  5796. // Both box models exclude margin, so add it if we want it
  5797. if ( extra === "margin" ) {
  5798. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  5799. }
  5800. if ( isBorderBox ) {
  5801. // border-box includes padding, so remove it if we want content
  5802. if ( extra === "content" ) {
  5803. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5804. }
  5805. // At this point, extra isn't border nor margin, so remove border
  5806. if ( extra !== "margin" ) {
  5807. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5808. }
  5809. } else {
  5810. // At this point, extra isn't content, so add padding
  5811. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5812. // At this point, extra isn't content nor padding, so add border
  5813. if ( extra !== "padding" ) {
  5814. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5815. }
  5816. }
  5817. }
  5818. return val;
  5819. }
  5820. function getWidthOrHeight( elem, name, extra ) {
  5821. // Start with computed style
  5822. var valueIsBorderBox,
  5823. styles = getStyles( elem ),
  5824. val = curCSS( elem, name, styles ),
  5825. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  5826. // Computed unit is not pixels. Stop here and return.
  5827. if ( rnumnonpx.test( val ) ) {
  5828. return val;
  5829. }
  5830. // Check for style in case a browser which returns unreliable values
  5831. // for getComputedStyle silently falls back to the reliable elem.style
  5832. valueIsBorderBox = isBorderBox &&
  5833. ( support.boxSizingReliable() || val === elem.style[ name ] );
  5834. // Fall back to offsetWidth/Height when value is "auto"
  5835. // This happens for inline elements with no explicit setting (gh-3571)
  5836. if ( val === "auto" ) {
  5837. val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
  5838. }
  5839. // Normalize "", auto, and prepare for extra
  5840. val = parseFloat( val ) || 0;
  5841. // Use the active box-sizing model to add/subtract irrelevant styles
  5842. return ( val +
  5843. augmentWidthOrHeight(
  5844. elem,
  5845. name,
  5846. extra || ( isBorderBox ? "border" : "content" ),
  5847. valueIsBorderBox,
  5848. styles
  5849. )
  5850. ) + "px";
  5851. }
  5852. jQuery.extend( {
  5853. // Add in style property hooks for overriding the default
  5854. // behavior of getting and setting a style property
  5855. cssHooks: {
  5856. opacity: {
  5857. get: function( elem, computed ) {
  5858. if ( computed ) {
  5859. // We should always get a number back from opacity
  5860. var ret = curCSS( elem, "opacity" );
  5861. return ret === "" ? "1" : ret;
  5862. }
  5863. }
  5864. }
  5865. },
  5866. // Don't automatically add "px" to these possibly-unitless properties
  5867. cssNumber: {
  5868. "animationIterationCount": true,
  5869. "columnCount": true,
  5870. "fillOpacity": true,
  5871. "flexGrow": true,
  5872. "flexShrink": true,
  5873. "fontWeight": true,
  5874. "lineHeight": true,
  5875. "opacity": true,
  5876. "order": true,
  5877. "orphans": true,
  5878. "widows": true,
  5879. "zIndex": true,
  5880. "zoom": true
  5881. },
  5882. // Add in properties whose names you wish to fix before
  5883. // setting or getting the value
  5884. cssProps: {
  5885. "float": "cssFloat"
  5886. },
  5887. // Get and set the style property on a DOM Node
  5888. style: function( elem, name, value, extra ) {
  5889. // Don't set styles on text and comment nodes
  5890. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5891. return;
  5892. }
  5893. // Make sure that we're working with the right name
  5894. var ret, type, hooks,
  5895. origName = jQuery.camelCase( name ),
  5896. isCustomProp = rcustomProp.test( name ),
  5897. style = elem.style;
  5898. // Make sure that we're working with the right name. We don't
  5899. // want to query the value if it is a CSS custom property
  5900. // since they are user-defined.
  5901. if ( !isCustomProp ) {
  5902. name = finalPropName( origName );
  5903. }
  5904. // Gets hook for the prefixed version, then unprefixed version
  5905. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5906. // Check if we're setting a value
  5907. if ( value !== undefined ) {
  5908. type = typeof value;
  5909. // Convert "+=" or "-=" to relative numbers (#7345)
  5910. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5911. value = adjustCSS( elem, name, ret );
  5912. // Fixes bug #9237
  5913. type = "number";
  5914. }
  5915. // Make sure that null and NaN values aren't set (#7116)
  5916. if ( value == null || value !== value ) {
  5917. return;
  5918. }
  5919. // If a number was passed in, add the unit (except for certain CSS properties)
  5920. if ( type === "number" ) {
  5921. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5922. }
  5923. // background-* props affect original clone's values
  5924. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5925. style[ name ] = "inherit";
  5926. }
  5927. // If a hook was provided, use that value, otherwise just set the specified value
  5928. if ( !hooks || !( "set" in hooks ) ||
  5929. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5930. if ( isCustomProp ) {
  5931. style.setProperty( name, value );
  5932. } else {
  5933. style[ name ] = value;
  5934. }
  5935. }
  5936. } else {
  5937. // If a hook was provided get the non-computed value from there
  5938. if ( hooks && "get" in hooks &&
  5939. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5940. return ret;
  5941. }
  5942. // Otherwise just get the value from the style object
  5943. return style[ name ];
  5944. }
  5945. },
  5946. css: function( elem, name, extra, styles ) {
  5947. var val, num, hooks,
  5948. origName = jQuery.camelCase( name ),
  5949. isCustomProp = rcustomProp.test( name );
  5950. // Make sure that we're working with the right name. We don't
  5951. // want to modify the value if it is a CSS custom property
  5952. // since they are user-defined.
  5953. if ( !isCustomProp ) {
  5954. name = finalPropName( origName );
  5955. }
  5956. // Try prefixed name followed by the unprefixed name
  5957. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5958. // If a hook was provided get the computed value from there
  5959. if ( hooks && "get" in hooks ) {
  5960. val = hooks.get( elem, true, extra );
  5961. }
  5962. // Otherwise, if a way to get the computed value exists, use that
  5963. if ( val === undefined ) {
  5964. val = curCSS( elem, name, styles );
  5965. }
  5966. // Convert "normal" to computed value
  5967. if ( val === "normal" && name in cssNormalTransform ) {
  5968. val = cssNormalTransform[ name ];
  5969. }
  5970. // Make numeric if forced or a qualifier was provided and val looks numeric
  5971. if ( extra === "" || extra ) {
  5972. num = parseFloat( val );
  5973. return extra === true || isFinite( num ) ? num || 0 : val;
  5974. }
  5975. return val;
  5976. }
  5977. } );
  5978. jQuery.each( [ "height", "width" ], function( i, name ) {
  5979. jQuery.cssHooks[ name ] = {
  5980. get: function( elem, computed, extra ) {
  5981. if ( computed ) {
  5982. // Certain elements can have dimension info if we invisibly show them
  5983. // but it must have a current display style that would benefit
  5984. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5985. // Support: Safari 8+
  5986. // Table columns in Safari have non-zero offsetWidth & zero
  5987. // getBoundingClientRect().width unless display is changed.
  5988. // Support: IE <=11 only
  5989. // Running getBoundingClientRect on a disconnected node
  5990. // in IE throws an error.
  5991. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  5992. swap( elem, cssShow, function() {
  5993. return getWidthOrHeight( elem, name, extra );
  5994. } ) :
  5995. getWidthOrHeight( elem, name, extra );
  5996. }
  5997. },
  5998. set: function( elem, value, extra ) {
  5999. var matches,
  6000. styles = extra && getStyles( elem ),
  6001. subtract = extra && augmentWidthOrHeight(
  6002. elem,
  6003. name,
  6004. extra,
  6005. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6006. styles
  6007. );
  6008. // Convert to pixels if value adjustment is needed
  6009. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  6010. ( matches[ 3 ] || "px" ) !== "px" ) {
  6011. elem.style[ name ] = value;
  6012. value = jQuery.css( elem, name );
  6013. }
  6014. return setPositiveNumber( elem, value, subtract );
  6015. }
  6016. };
  6017. } );
  6018. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  6019. function( elem, computed ) {
  6020. if ( computed ) {
  6021. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  6022. elem.getBoundingClientRect().left -
  6023. swap( elem, { marginLeft: 0 }, function() {
  6024. return elem.getBoundingClientRect().left;
  6025. } )
  6026. ) + "px";
  6027. }
  6028. }
  6029. );
  6030. // These hooks are used by animate to expand properties
  6031. jQuery.each( {
  6032. margin: "",
  6033. padding: "",
  6034. border: "Width"
  6035. }, function( prefix, suffix ) {
  6036. jQuery.cssHooks[ prefix + suffix ] = {
  6037. expand: function( value ) {
  6038. var i = 0,
  6039. expanded = {},
  6040. // Assumes a single number if not a string
  6041. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  6042. for ( ; i < 4; i++ ) {
  6043. expanded[ prefix + cssExpand[ i ] + suffix ] =
  6044. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  6045. }
  6046. return expanded;
  6047. }
  6048. };
  6049. if ( !rmargin.test( prefix ) ) {
  6050. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  6051. }
  6052. } );
  6053. jQuery.fn.extend( {
  6054. css: function( name, value ) {
  6055. return access( this, function( elem, name, value ) {
  6056. var styles, len,
  6057. map = {},
  6058. i = 0;
  6059. if ( Array.isArray( name ) ) {
  6060. styles = getStyles( elem );
  6061. len = name.length;
  6062. for ( ; i < len; i++ ) {
  6063. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  6064. }
  6065. return map;
  6066. }
  6067. return value !== undefined ?
  6068. jQuery.style( elem, name, value ) :
  6069. jQuery.css( elem, name );
  6070. }, name, value, arguments.length > 1 );
  6071. }
  6072. } );
  6073. function Tween( elem, options, prop, end, easing ) {
  6074. return new Tween.prototype.init( elem, options, prop, end, easing );
  6075. }
  6076. jQuery.Tween = Tween;
  6077. Tween.prototype = {
  6078. constructor: Tween,
  6079. init: function( elem, options, prop, end, easing, unit ) {
  6080. this.elem = elem;
  6081. this.prop = prop;
  6082. this.easing = easing || jQuery.easing._default;
  6083. this.options = options;
  6084. this.start = this.now = this.cur();
  6085. this.end = end;
  6086. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  6087. },
  6088. cur: function() {
  6089. var hooks = Tween.propHooks[ this.prop ];
  6090. return hooks && hooks.get ?
  6091. hooks.get( this ) :
  6092. Tween.propHooks._default.get( this );
  6093. },
  6094. run: function( percent ) {
  6095. var eased,
  6096. hooks = Tween.propHooks[ this.prop ];
  6097. if ( this.options.duration ) {
  6098. this.pos = eased = jQuery.easing[ this.easing ](
  6099. percent, this.options.duration * percent, 0, 1, this.options.duration
  6100. );
  6101. } else {
  6102. this.pos = eased = percent;
  6103. }
  6104. this.now = ( this.end - this.start ) * eased + this.start;
  6105. if ( this.options.step ) {
  6106. this.options.step.call( this.elem, this.now, this );
  6107. }
  6108. if ( hooks && hooks.set ) {
  6109. hooks.set( this );
  6110. } else {
  6111. Tween.propHooks._default.set( this );
  6112. }
  6113. return this;
  6114. }
  6115. };
  6116. Tween.prototype.init.prototype = Tween.prototype;
  6117. Tween.propHooks = {
  6118. _default: {
  6119. get: function( tween ) {
  6120. var result;
  6121. // Use a property on the element directly when it is not a DOM element,
  6122. // or when there is no matching style property that exists.
  6123. if ( tween.elem.nodeType !== 1 ||
  6124. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  6125. return tween.elem[ tween.prop ];
  6126. }
  6127. // Passing an empty string as a 3rd parameter to .css will automatically
  6128. // attempt a parseFloat and fallback to a string if the parse fails.
  6129. // Simple values such as "10px" are parsed to Float;
  6130. // complex values such as "rotate(1rad)" are returned as-is.
  6131. result = jQuery.css( tween.elem, tween.prop, "" );
  6132. // Empty strings, null, undefined and "auto" are converted to 0.
  6133. return !result || result === "auto" ? 0 : result;
  6134. },
  6135. set: function( tween ) {
  6136. // Use step hook for back compat.
  6137. // Use cssHook if its there.
  6138. // Use .style if available and use plain properties where available.
  6139. if ( jQuery.fx.step[ tween.prop ] ) {
  6140. jQuery.fx.step[ tween.prop ]( tween );
  6141. } else if ( tween.elem.nodeType === 1 &&
  6142. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  6143. jQuery.cssHooks[ tween.prop ] ) ) {
  6144. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  6145. } else {
  6146. tween.elem[ tween.prop ] = tween.now;
  6147. }
  6148. }
  6149. }
  6150. };
  6151. // Support: IE <=9 only
  6152. // Panic based approach to setting things on disconnected nodes
  6153. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  6154. set: function( tween ) {
  6155. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  6156. tween.elem[ tween.prop ] = tween.now;
  6157. }
  6158. }
  6159. };
  6160. jQuery.easing = {
  6161. linear: function( p ) {
  6162. return p;
  6163. },
  6164. swing: function( p ) {
  6165. return 0.5 - Math.cos( p * Math.PI ) / 2;
  6166. },
  6167. _default: "swing"
  6168. };
  6169. jQuery.fx = Tween.prototype.init;
  6170. // Back compat <1.8 extension point
  6171. jQuery.fx.step = {};
  6172. var
  6173. fxNow, inProgress,
  6174. rfxtypes = /^(?:toggle|show|hide)$/,
  6175. rrun = /queueHooks$/;
  6176. function schedule() {
  6177. if ( inProgress ) {
  6178. if ( document.hidden === false && window.requestAnimationFrame ) {
  6179. window.requestAnimationFrame( schedule );
  6180. } else {
  6181. window.setTimeout( schedule, jQuery.fx.interval );
  6182. }
  6183. jQuery.fx.tick();
  6184. }
  6185. }
  6186. // Animations created synchronously will run synchronously
  6187. function createFxNow() {
  6188. window.setTimeout( function() {
  6189. fxNow = undefined;
  6190. } );
  6191. return ( fxNow = jQuery.now() );
  6192. }
  6193. // Generate parameters to create a standard animation
  6194. function genFx( type, includeWidth ) {
  6195. var which,
  6196. i = 0,
  6197. attrs = { height: type };
  6198. // If we include width, step value is 1 to do all cssExpand values,
  6199. // otherwise step value is 2 to skip over Left and Right
  6200. includeWidth = includeWidth ? 1 : 0;
  6201. for ( ; i < 4; i += 2 - includeWidth ) {
  6202. which = cssExpand[ i ];
  6203. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  6204. }
  6205. if ( includeWidth ) {
  6206. attrs.opacity = attrs.width = type;
  6207. }
  6208. return attrs;
  6209. }
  6210. function createTween( value, prop, animation ) {
  6211. var tween,
  6212. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  6213. index = 0,
  6214. length = collection.length;
  6215. for ( ; index < length; index++ ) {
  6216. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  6217. // We're done with this property
  6218. return tween;
  6219. }
  6220. }
  6221. }
  6222. function defaultPrefilter( elem, props, opts ) {
  6223. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  6224. isBox = "width" in props || "height" in props,
  6225. anim = this,
  6226. orig = {},
  6227. style = elem.style,
  6228. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  6229. dataShow = dataPriv.get( elem, "fxshow" );
  6230. // Queue-skipping animations hijack the fx hooks
  6231. if ( !opts.queue ) {
  6232. hooks = jQuery._queueHooks( elem, "fx" );
  6233. if ( hooks.unqueued == null ) {
  6234. hooks.unqueued = 0;
  6235. oldfire = hooks.empty.fire;
  6236. hooks.empty.fire = function() {
  6237. if ( !hooks.unqueued ) {
  6238. oldfire();
  6239. }
  6240. };
  6241. }
  6242. hooks.unqueued++;
  6243. anim.always( function() {
  6244. // Ensure the complete handler is called before this completes
  6245. anim.always( function() {
  6246. hooks.unqueued--;
  6247. if ( !jQuery.queue( elem, "fx" ).length ) {
  6248. hooks.empty.fire();
  6249. }
  6250. } );
  6251. } );
  6252. }
  6253. // Detect show/hide animations
  6254. for ( prop in props ) {
  6255. value = props[ prop ];
  6256. if ( rfxtypes.test( value ) ) {
  6257. delete props[ prop ];
  6258. toggle = toggle || value === "toggle";
  6259. if ( value === ( hidden ? "hide" : "show" ) ) {
  6260. // Pretend to be hidden if this is a "show" and
  6261. // there is still data from a stopped show/hide
  6262. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  6263. hidden = true;
  6264. // Ignore all other no-op show/hide data
  6265. } else {
  6266. continue;
  6267. }
  6268. }
  6269. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  6270. }
  6271. }
  6272. // Bail out if this is a no-op like .hide().hide()
  6273. propTween = !jQuery.isEmptyObject( props );
  6274. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  6275. return;
  6276. }
  6277. // Restrict "overflow" and "display" styles during box animations
  6278. if ( isBox && elem.nodeType === 1 ) {
  6279. // Support: IE <=9 - 11, Edge 12 - 13
  6280. // Record all 3 overflow attributes because IE does not infer the shorthand
  6281. // from identically-valued overflowX and overflowY
  6282. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  6283. // Identify a display type, preferring old show/hide data over the CSS cascade
  6284. restoreDisplay = dataShow && dataShow.display;
  6285. if ( restoreDisplay == null ) {
  6286. restoreDisplay = dataPriv.get( elem, "display" );
  6287. }
  6288. display = jQuery.css( elem, "display" );
  6289. if ( display === "none" ) {
  6290. if ( restoreDisplay ) {
  6291. display = restoreDisplay;
  6292. } else {
  6293. // Get nonempty value(s) by temporarily forcing visibility
  6294. showHide( [ elem ], true );
  6295. restoreDisplay = elem.style.display || restoreDisplay;
  6296. display = jQuery.css( elem, "display" );
  6297. showHide( [ elem ] );
  6298. }
  6299. }
  6300. // Animate inline elements as inline-block
  6301. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  6302. if ( jQuery.css( elem, "float" ) === "none" ) {
  6303. // Restore the original display value at the end of pure show/hide animations
  6304. if ( !propTween ) {
  6305. anim.done( function() {
  6306. style.display = restoreDisplay;
  6307. } );
  6308. if ( restoreDisplay == null ) {
  6309. display = style.display;
  6310. restoreDisplay = display === "none" ? "" : display;
  6311. }
  6312. }
  6313. style.display = "inline-block";
  6314. }
  6315. }
  6316. }
  6317. if ( opts.overflow ) {
  6318. style.overflow = "hidden";
  6319. anim.always( function() {
  6320. style.overflow = opts.overflow[ 0 ];
  6321. style.overflowX = opts.overflow[ 1 ];
  6322. style.overflowY = opts.overflow[ 2 ];
  6323. } );
  6324. }
  6325. // Implement show/hide animations
  6326. propTween = false;
  6327. for ( prop in orig ) {
  6328. // General show/hide setup for this element animation
  6329. if ( !propTween ) {
  6330. if ( dataShow ) {
  6331. if ( "hidden" in dataShow ) {
  6332. hidden = dataShow.hidden;
  6333. }
  6334. } else {
  6335. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  6336. }
  6337. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  6338. if ( toggle ) {
  6339. dataShow.hidden = !hidden;
  6340. }
  6341. // Show elements before animating them
  6342. if ( hidden ) {
  6343. showHide( [ elem ], true );
  6344. }
  6345. /* eslint-disable no-loop-func */
  6346. anim.done( function() {
  6347. /* eslint-enable no-loop-func */
  6348. // The final step of a "hide" animation is actually hiding the element
  6349. if ( !hidden ) {
  6350. showHide( [ elem ] );
  6351. }
  6352. dataPriv.remove( elem, "fxshow" );
  6353. for ( prop in orig ) {
  6354. jQuery.style( elem, prop, orig[ prop ] );
  6355. }
  6356. } );
  6357. }
  6358. // Per-property setup
  6359. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  6360. if ( !( prop in dataShow ) ) {
  6361. dataShow[ prop ] = propTween.start;
  6362. if ( hidden ) {
  6363. propTween.end = propTween.start;
  6364. propTween.start = 0;
  6365. }
  6366. }
  6367. }
  6368. }
  6369. function propFilter( props, specialEasing ) {
  6370. var index, name, easing, value, hooks;
  6371. // camelCase, specialEasing and expand cssHook pass
  6372. for ( index in props ) {
  6373. name = jQuery.camelCase( index );
  6374. easing = specialEasing[ name ];
  6375. value = props[ index ];
  6376. if ( Array.isArray( value ) ) {
  6377. easing = value[ 1 ];
  6378. value = props[ index ] = value[ 0 ];
  6379. }
  6380. if ( index !== name ) {
  6381. props[ name ] = value;
  6382. delete props[ index ];
  6383. }
  6384. hooks = jQuery.cssHooks[ name ];
  6385. if ( hooks && "expand" in hooks ) {
  6386. value = hooks.expand( value );
  6387. delete props[ name ];
  6388. // Not quite $.extend, this won't overwrite existing keys.
  6389. // Reusing 'index' because we have the correct "name"
  6390. for ( index in value ) {
  6391. if ( !( index in props ) ) {
  6392. props[ index ] = value[ index ];
  6393. specialEasing[ index ] = easing;
  6394. }
  6395. }
  6396. } else {
  6397. specialEasing[ name ] = easing;
  6398. }
  6399. }
  6400. }
  6401. function Animation( elem, properties, options ) {
  6402. var result,
  6403. stopped,
  6404. index = 0,
  6405. length = Animation.prefilters.length,
  6406. deferred = jQuery.Deferred().always( function() {
  6407. // Don't match elem in the :animated selector
  6408. delete tick.elem;
  6409. } ),
  6410. tick = function() {
  6411. if ( stopped ) {
  6412. return false;
  6413. }
  6414. var currentTime = fxNow || createFxNow(),
  6415. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  6416. // Support: Android 2.3 only
  6417. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  6418. temp = remaining / animation.duration || 0,
  6419. percent = 1 - temp,
  6420. index = 0,
  6421. length = animation.tweens.length;
  6422. for ( ; index < length; index++ ) {
  6423. animation.tweens[ index ].run( percent );
  6424. }
  6425. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  6426. // If there's more to do, yield
  6427. if ( percent < 1 && length ) {
  6428. return remaining;
  6429. }
  6430. // If this was an empty animation, synthesize a final progress notification
  6431. if ( !length ) {
  6432. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6433. }
  6434. // Resolve the animation and report its conclusion
  6435. deferred.resolveWith( elem, [ animation ] );
  6436. return false;
  6437. },
  6438. animation = deferred.promise( {
  6439. elem: elem,
  6440. props: jQuery.extend( {}, properties ),
  6441. opts: jQuery.extend( true, {
  6442. specialEasing: {},
  6443. easing: jQuery.easing._default
  6444. }, options ),
  6445. originalProperties: properties,
  6446. originalOptions: options,
  6447. startTime: fxNow || createFxNow(),
  6448. duration: options.duration,
  6449. tweens: [],
  6450. createTween: function( prop, end ) {
  6451. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  6452. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  6453. animation.tweens.push( tween );
  6454. return tween;
  6455. },
  6456. stop: function( gotoEnd ) {
  6457. var index = 0,
  6458. // If we are going to the end, we want to run all the tweens
  6459. // otherwise we skip this part
  6460. length = gotoEnd ? animation.tweens.length : 0;
  6461. if ( stopped ) {
  6462. return this;
  6463. }
  6464. stopped = true;
  6465. for ( ; index < length; index++ ) {
  6466. animation.tweens[ index ].run( 1 );
  6467. }
  6468. // Resolve when we played the last frame; otherwise, reject
  6469. if ( gotoEnd ) {
  6470. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6471. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  6472. } else {
  6473. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  6474. }
  6475. return this;
  6476. }
  6477. } ),
  6478. props = animation.props;
  6479. propFilter( props, animation.opts.specialEasing );
  6480. for ( ; index < length; index++ ) {
  6481. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  6482. if ( result ) {
  6483. if ( jQuery.isFunction( result.stop ) ) {
  6484. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  6485. jQuery.proxy( result.stop, result );
  6486. }
  6487. return result;
  6488. }
  6489. }
  6490. jQuery.map( props, createTween, animation );
  6491. if ( jQuery.isFunction( animation.opts.start ) ) {
  6492. animation.opts.start.call( elem, animation );
  6493. }
  6494. // Attach callbacks from options
  6495. animation
  6496. .progress( animation.opts.progress )
  6497. .done( animation.opts.done, animation.opts.complete )
  6498. .fail( animation.opts.fail )
  6499. .always( animation.opts.always );
  6500. jQuery.fx.timer(
  6501. jQuery.extend( tick, {
  6502. elem: elem,
  6503. anim: animation,
  6504. queue: animation.opts.queue
  6505. } )
  6506. );
  6507. return animation;
  6508. }
  6509. jQuery.Animation = jQuery.extend( Animation, {
  6510. tweeners: {
  6511. "*": [ function( prop, value ) {
  6512. var tween = this.createTween( prop, value );
  6513. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  6514. return tween;
  6515. } ]
  6516. },
  6517. tweener: function( props, callback ) {
  6518. if ( jQuery.isFunction( props ) ) {
  6519. callback = props;
  6520. props = [ "*" ];
  6521. } else {
  6522. props = props.match( rnothtmlwhite );
  6523. }
  6524. var prop,
  6525. index = 0,
  6526. length = props.length;
  6527. for ( ; index < length; index++ ) {
  6528. prop = props[ index ];
  6529. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  6530. Animation.tweeners[ prop ].unshift( callback );
  6531. }
  6532. },
  6533. prefilters: [ defaultPrefilter ],
  6534. prefilter: function( callback, prepend ) {
  6535. if ( prepend ) {
  6536. Animation.prefilters.unshift( callback );
  6537. } else {
  6538. Animation.prefilters.push( callback );
  6539. }
  6540. }
  6541. } );
  6542. jQuery.speed = function( speed, easing, fn ) {
  6543. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  6544. complete: fn || !fn && easing ||
  6545. jQuery.isFunction( speed ) && speed,
  6546. duration: speed,
  6547. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  6548. };
  6549. // Go to the end state if fx are off
  6550. if ( jQuery.fx.off ) {
  6551. opt.duration = 0;
  6552. } else {
  6553. if ( typeof opt.duration !== "number" ) {
  6554. if ( opt.duration in jQuery.fx.speeds ) {
  6555. opt.duration = jQuery.fx.speeds[ opt.duration ];
  6556. } else {
  6557. opt.duration = jQuery.fx.speeds._default;
  6558. }
  6559. }
  6560. }
  6561. // Normalize opt.queue - true/undefined/null -> "fx"
  6562. if ( opt.queue == null || opt.queue === true ) {
  6563. opt.queue = "fx";
  6564. }
  6565. // Queueing
  6566. opt.old = opt.complete;
  6567. opt.complete = function() {
  6568. if ( jQuery.isFunction( opt.old ) ) {
  6569. opt.old.call( this );
  6570. }
  6571. if ( opt.queue ) {
  6572. jQuery.dequeue( this, opt.queue );
  6573. }
  6574. };
  6575. return opt;
  6576. };
  6577. jQuery.fn.extend( {
  6578. fadeTo: function( speed, to, easing, callback ) {
  6579. // Show any hidden elements after setting opacity to 0
  6580. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  6581. // Animate to the value specified
  6582. .end().animate( { opacity: to }, speed, easing, callback );
  6583. },
  6584. animate: function( prop, speed, easing, callback ) {
  6585. var empty = jQuery.isEmptyObject( prop ),
  6586. optall = jQuery.speed( speed, easing, callback ),
  6587. doAnimation = function() {
  6588. // Operate on a copy of prop so per-property easing won't be lost
  6589. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  6590. // Empty animations, or finishing resolves immediately
  6591. if ( empty || dataPriv.get( this, "finish" ) ) {
  6592. anim.stop( true );
  6593. }
  6594. };
  6595. doAnimation.finish = doAnimation;
  6596. return empty || optall.queue === false ?
  6597. this.each( doAnimation ) :
  6598. this.queue( optall.queue, doAnimation );
  6599. },
  6600. stop: function( type, clearQueue, gotoEnd ) {
  6601. var stopQueue = function( hooks ) {
  6602. var stop = hooks.stop;
  6603. delete hooks.stop;
  6604. stop( gotoEnd );
  6605. };
  6606. if ( typeof type !== "string" ) {
  6607. gotoEnd = clearQueue;
  6608. clearQueue = type;
  6609. type = undefined;
  6610. }
  6611. if ( clearQueue && type !== false ) {
  6612. this.queue( type || "fx", [] );
  6613. }
  6614. return this.each( function() {
  6615. var dequeue = true,
  6616. index = type != null && type + "queueHooks",
  6617. timers = jQuery.timers,
  6618. data = dataPriv.get( this );
  6619. if ( index ) {
  6620. if ( data[ index ] && data[ index ].stop ) {
  6621. stopQueue( data[ index ] );
  6622. }
  6623. } else {
  6624. for ( index in data ) {
  6625. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  6626. stopQueue( data[ index ] );
  6627. }
  6628. }
  6629. }
  6630. for ( index = timers.length; index--; ) {
  6631. if ( timers[ index ].elem === this &&
  6632. ( type == null || timers[ index ].queue === type ) ) {
  6633. timers[ index ].anim.stop( gotoEnd );
  6634. dequeue = false;
  6635. timers.splice( index, 1 );
  6636. }
  6637. }
  6638. // Start the next in the queue if the last step wasn't forced.
  6639. // Timers currently will call their complete callbacks, which
  6640. // will dequeue but only if they were gotoEnd.
  6641. if ( dequeue || !gotoEnd ) {
  6642. jQuery.dequeue( this, type );
  6643. }
  6644. } );
  6645. },
  6646. finish: function( type ) {
  6647. if ( type !== false ) {
  6648. type = type || "fx";
  6649. }
  6650. return this.each( function() {
  6651. var index,
  6652. data = dataPriv.get( this ),
  6653. queue = data[ type + "queue" ],
  6654. hooks = data[ type + "queueHooks" ],
  6655. timers = jQuery.timers,
  6656. length = queue ? queue.length : 0;
  6657. // Enable finishing flag on private data
  6658. data.finish = true;
  6659. // Empty the queue first
  6660. jQuery.queue( this, type, [] );
  6661. if ( hooks && hooks.stop ) {
  6662. hooks.stop.call( this, true );
  6663. }
  6664. // Look for any active animations, and finish them
  6665. for ( index = timers.length; index--; ) {
  6666. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6667. timers[ index ].anim.stop( true );
  6668. timers.splice( index, 1 );
  6669. }
  6670. }
  6671. // Look for any animations in the old queue and finish them
  6672. for ( index = 0; index < length; index++ ) {
  6673. if ( queue[ index ] && queue[ index ].finish ) {
  6674. queue[ index ].finish.call( this );
  6675. }
  6676. }
  6677. // Turn off finishing flag
  6678. delete data.finish;
  6679. } );
  6680. }
  6681. } );
  6682. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6683. var cssFn = jQuery.fn[ name ];
  6684. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6685. return speed == null || typeof speed === "boolean" ?
  6686. cssFn.apply( this, arguments ) :
  6687. this.animate( genFx( name, true ), speed, easing, callback );
  6688. };
  6689. } );
  6690. // Generate shortcuts for custom animations
  6691. jQuery.each( {
  6692. slideDown: genFx( "show" ),
  6693. slideUp: genFx( "hide" ),
  6694. slideToggle: genFx( "toggle" ),
  6695. fadeIn: { opacity: "show" },
  6696. fadeOut: { opacity: "hide" },
  6697. fadeToggle: { opacity: "toggle" }
  6698. }, function( name, props ) {
  6699. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6700. return this.animate( props, speed, easing, callback );
  6701. };
  6702. } );
  6703. jQuery.timers = [];
  6704. jQuery.fx.tick = function() {
  6705. var timer,
  6706. i = 0,
  6707. timers = jQuery.timers;
  6708. fxNow = jQuery.now();
  6709. for ( ; i < timers.length; i++ ) {
  6710. timer = timers[ i ];
  6711. // Run the timer and safely remove it when done (allowing for external removal)
  6712. if ( !timer() && timers[ i ] === timer ) {
  6713. timers.splice( i--, 1 );
  6714. }
  6715. }
  6716. if ( !timers.length ) {
  6717. jQuery.fx.stop();
  6718. }
  6719. fxNow = undefined;
  6720. };
  6721. jQuery.fx.timer = function( timer ) {
  6722. jQuery.timers.push( timer );
  6723. jQuery.fx.start();
  6724. };
  6725. jQuery.fx.interval = 13;
  6726. jQuery.fx.start = function() {
  6727. if ( inProgress ) {
  6728. return;
  6729. }
  6730. inProgress = true;
  6731. schedule();
  6732. };
  6733. jQuery.fx.stop = function() {
  6734. inProgress = null;
  6735. };
  6736. jQuery.fx.speeds = {
  6737. slow: 600,
  6738. fast: 200,
  6739. // Default speed
  6740. _default: 400
  6741. };
  6742. // Based off of the plugin by Clint Helfers, with permission.
  6743. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6744. jQuery.fn.delay = function( time, type ) {
  6745. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6746. type = type || "fx";
  6747. return this.queue( type, function( next, hooks ) {
  6748. var timeout = window.setTimeout( next, time );
  6749. hooks.stop = function() {
  6750. window.clearTimeout( timeout );
  6751. };
  6752. } );
  6753. };
  6754. ( function() {
  6755. var input = document.createElement( "input" ),
  6756. select = document.createElement( "select" ),
  6757. opt = select.appendChild( document.createElement( "option" ) );
  6758. input.type = "checkbox";
  6759. // Support: Android <=4.3 only
  6760. // Default value for a checkbox should be "on"
  6761. support.checkOn = input.value !== "";
  6762. // Support: IE <=11 only
  6763. // Must access selectedIndex to make default options select
  6764. support.optSelected = opt.selected;
  6765. // Support: IE <=11 only
  6766. // An input loses its value after becoming a radio
  6767. input = document.createElement( "input" );
  6768. input.value = "t";
  6769. input.type = "radio";
  6770. support.radioValue = input.value === "t";
  6771. } )();
  6772. var boolHook,
  6773. attrHandle = jQuery.expr.attrHandle;
  6774. jQuery.fn.extend( {
  6775. attr: function( name, value ) {
  6776. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6777. },
  6778. removeAttr: function( name ) {
  6779. return this.each( function() {
  6780. jQuery.removeAttr( this, name );
  6781. } );
  6782. }
  6783. } );
  6784. jQuery.extend( {
  6785. attr: function( elem, name, value ) {
  6786. var ret, hooks,
  6787. nType = elem.nodeType;
  6788. // Don't get/set attributes on text, comment and attribute nodes
  6789. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6790. return;
  6791. }
  6792. // Fallback to prop when attributes are not supported
  6793. if ( typeof elem.getAttribute === "undefined" ) {
  6794. return jQuery.prop( elem, name, value );
  6795. }
  6796. // Attribute hooks are determined by the lowercase version
  6797. // Grab necessary hook if one is defined
  6798. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6799. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  6800. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  6801. }
  6802. if ( value !== undefined ) {
  6803. if ( value === null ) {
  6804. jQuery.removeAttr( elem, name );
  6805. return;
  6806. }
  6807. if ( hooks && "set" in hooks &&
  6808. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6809. return ret;
  6810. }
  6811. elem.setAttribute( name, value + "" );
  6812. return value;
  6813. }
  6814. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6815. return ret;
  6816. }
  6817. ret = jQuery.find.attr( elem, name );
  6818. // Non-existent attributes return null, we normalize to undefined
  6819. return ret == null ? undefined : ret;
  6820. },
  6821. attrHooks: {
  6822. type: {
  6823. set: function( elem, value ) {
  6824. if ( !support.radioValue && value === "radio" &&
  6825. nodeName( elem, "input" ) ) {
  6826. var val = elem.value;
  6827. elem.setAttribute( "type", value );
  6828. if ( val ) {
  6829. elem.value = val;
  6830. }
  6831. return value;
  6832. }
  6833. }
  6834. }
  6835. },
  6836. removeAttr: function( elem, value ) {
  6837. var name,
  6838. i = 0,
  6839. // Attribute names can contain non-HTML whitespace characters
  6840. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  6841. attrNames = value && value.match( rnothtmlwhite );
  6842. if ( attrNames && elem.nodeType === 1 ) {
  6843. while ( ( name = attrNames[ i++ ] ) ) {
  6844. elem.removeAttribute( name );
  6845. }
  6846. }
  6847. }
  6848. } );
  6849. // Hooks for boolean attributes
  6850. boolHook = {
  6851. set: function( elem, value, name ) {
  6852. if ( value === false ) {
  6853. // Remove boolean attributes when set to false
  6854. jQuery.removeAttr( elem, name );
  6855. } else {
  6856. elem.setAttribute( name, name );
  6857. }
  6858. return name;
  6859. }
  6860. };
  6861. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6862. var getter = attrHandle[ name ] || jQuery.find.attr;
  6863. attrHandle[ name ] = function( elem, name, isXML ) {
  6864. var ret, handle,
  6865. lowercaseName = name.toLowerCase();
  6866. if ( !isXML ) {
  6867. // Avoid an infinite loop by temporarily removing this function from the getter
  6868. handle = attrHandle[ lowercaseName ];
  6869. attrHandle[ lowercaseName ] = ret;
  6870. ret = getter( elem, name, isXML ) != null ?
  6871. lowercaseName :
  6872. null;
  6873. attrHandle[ lowercaseName ] = handle;
  6874. }
  6875. return ret;
  6876. };
  6877. } );
  6878. var rfocusable = /^(?:input|select|textarea|button)$/i,
  6879. rclickable = /^(?:a|area)$/i;
  6880. jQuery.fn.extend( {
  6881. prop: function( name, value ) {
  6882. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  6883. },
  6884. removeProp: function( name ) {
  6885. return this.each( function() {
  6886. delete this[ jQuery.propFix[ name ] || name ];
  6887. } );
  6888. }
  6889. } );
  6890. jQuery.extend( {
  6891. prop: function( elem, name, value ) {
  6892. var ret, hooks,
  6893. nType = elem.nodeType;
  6894. // Don't get/set properties on text, comment and attribute nodes
  6895. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6896. return;
  6897. }
  6898. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6899. // Fix name and attach hooks
  6900. name = jQuery.propFix[ name ] || name;
  6901. hooks = jQuery.propHooks[ name ];
  6902. }
  6903. if ( value !== undefined ) {
  6904. if ( hooks && "set" in hooks &&
  6905. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6906. return ret;
  6907. }
  6908. return ( elem[ name ] = value );
  6909. }
  6910. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6911. return ret;
  6912. }
  6913. return elem[ name ];
  6914. },
  6915. propHooks: {
  6916. tabIndex: {
  6917. get: function( elem ) {
  6918. // Support: IE <=9 - 11 only
  6919. // elem.tabIndex doesn't always return the
  6920. // correct value when it hasn't been explicitly set
  6921. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  6922. // Use proper attribute retrieval(#12072)
  6923. var tabindex = jQuery.find.attr( elem, "tabindex" );
  6924. if ( tabindex ) {
  6925. return parseInt( tabindex, 10 );
  6926. }
  6927. if (
  6928. rfocusable.test( elem.nodeName ) ||
  6929. rclickable.test( elem.nodeName ) &&
  6930. elem.href
  6931. ) {
  6932. return 0;
  6933. }
  6934. return -1;
  6935. }
  6936. }
  6937. },
  6938. propFix: {
  6939. "for": "htmlFor",
  6940. "class": "className"
  6941. }
  6942. } );
  6943. // Support: IE <=11 only
  6944. // Accessing the selectedIndex property
  6945. // forces the browser to respect setting selected
  6946. // on the option
  6947. // The getter ensures a default option is selected
  6948. // when in an optgroup
  6949. // eslint rule "no-unused-expressions" is disabled for this code
  6950. // since it considers such accessions noop
  6951. if ( !support.optSelected ) {
  6952. jQuery.propHooks.selected = {
  6953. get: function( elem ) {
  6954. /* eslint no-unused-expressions: "off" */
  6955. var parent = elem.parentNode;
  6956. if ( parent && parent.parentNode ) {
  6957. parent.parentNode.selectedIndex;
  6958. }
  6959. return null;
  6960. },
  6961. set: function( elem ) {
  6962. /* eslint no-unused-expressions: "off" */
  6963. var parent = elem.parentNode;
  6964. if ( parent ) {
  6965. parent.selectedIndex;
  6966. if ( parent.parentNode ) {
  6967. parent.parentNode.selectedIndex;
  6968. }
  6969. }
  6970. }
  6971. };
  6972. }
  6973. jQuery.each( [
  6974. "tabIndex",
  6975. "readOnly",
  6976. "maxLength",
  6977. "cellSpacing",
  6978. "cellPadding",
  6979. "rowSpan",
  6980. "colSpan",
  6981. "useMap",
  6982. "frameBorder",
  6983. "contentEditable"
  6984. ], function() {
  6985. jQuery.propFix[ this.toLowerCase() ] = this;
  6986. } );
  6987. // Strip and collapse whitespace according to HTML spec
  6988. // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
  6989. function stripAndCollapse( value ) {
  6990. var tokens = value.match( rnothtmlwhite ) || [];
  6991. return tokens.join( " " );
  6992. }
  6993. function getClass( elem ) {
  6994. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  6995. }
  6996. jQuery.fn.extend( {
  6997. addClass: function( value ) {
  6998. var classes, elem, cur, curValue, clazz, j, finalValue,
  6999. i = 0;
  7000. if ( jQuery.isFunction( value ) ) {
  7001. return this.each( function( j ) {
  7002. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7003. } );
  7004. }
  7005. if ( typeof value === "string" && value ) {
  7006. classes = value.match( rnothtmlwhite ) || [];
  7007. while ( ( elem = this[ i++ ] ) ) {
  7008. curValue = getClass( elem );
  7009. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7010. if ( cur ) {
  7011. j = 0;
  7012. while ( ( clazz = classes[ j++ ] ) ) {
  7013. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  7014. cur += clazz + " ";
  7015. }
  7016. }
  7017. // Only assign if different to avoid unneeded rendering.
  7018. finalValue = stripAndCollapse( cur );
  7019. if ( curValue !== finalValue ) {
  7020. elem.setAttribute( "class", finalValue );
  7021. }
  7022. }
  7023. }
  7024. }
  7025. return this;
  7026. },
  7027. removeClass: function( value ) {
  7028. var classes, elem, cur, curValue, clazz, j, finalValue,
  7029. i = 0;
  7030. if ( jQuery.isFunction( value ) ) {
  7031. return this.each( function( j ) {
  7032. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7033. } );
  7034. }
  7035. if ( !arguments.length ) {
  7036. return this.attr( "class", "" );
  7037. }
  7038. if ( typeof value === "string" && value ) {
  7039. classes = value.match( rnothtmlwhite ) || [];
  7040. while ( ( elem = this[ i++ ] ) ) {
  7041. curValue = getClass( elem );
  7042. // This expression is here for better compressibility (see addClass)
  7043. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7044. if ( cur ) {
  7045. j = 0;
  7046. while ( ( clazz = classes[ j++ ] ) ) {
  7047. // Remove *all* instances
  7048. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  7049. cur = cur.replace( " " + clazz + " ", " " );
  7050. }
  7051. }
  7052. // Only assign if different to avoid unneeded rendering.
  7053. finalValue = stripAndCollapse( cur );
  7054. if ( curValue !== finalValue ) {
  7055. elem.setAttribute( "class", finalValue );
  7056. }
  7057. }
  7058. }
  7059. }
  7060. return this;
  7061. },
  7062. toggleClass: function( value, stateVal ) {
  7063. var type = typeof value;
  7064. if ( typeof stateVal === "boolean" && type === "string" ) {
  7065. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7066. }
  7067. if ( jQuery.isFunction( value ) ) {
  7068. return this.each( function( i ) {
  7069. jQuery( this ).toggleClass(
  7070. value.call( this, i, getClass( this ), stateVal ),
  7071. stateVal
  7072. );
  7073. } );
  7074. }
  7075. return this.each( function() {
  7076. var className, i, self, classNames;
  7077. if ( type === "string" ) {
  7078. // Toggle individual class names
  7079. i = 0;
  7080. self = jQuery( this );
  7081. classNames = value.match( rnothtmlwhite ) || [];
  7082. while ( ( className = classNames[ i++ ] ) ) {
  7083. // Check each className given, space separated list
  7084. if ( self.hasClass( className ) ) {
  7085. self.removeClass( className );
  7086. } else {
  7087. self.addClass( className );
  7088. }
  7089. }
  7090. // Toggle whole class name
  7091. } else if ( value === undefined || type === "boolean" ) {
  7092. className = getClass( this );
  7093. if ( className ) {
  7094. // Store className if set
  7095. dataPriv.set( this, "__className__", className );
  7096. }
  7097. // If the element has a class name or if we're passed `false`,
  7098. // then remove the whole classname (if there was one, the above saved it).
  7099. // Otherwise bring back whatever was previously saved (if anything),
  7100. // falling back to the empty string if nothing was stored.
  7101. if ( this.setAttribute ) {
  7102. this.setAttribute( "class",
  7103. className || value === false ?
  7104. "" :
  7105. dataPriv.get( this, "__className__" ) || ""
  7106. );
  7107. }
  7108. }
  7109. } );
  7110. },
  7111. hasClass: function( selector ) {
  7112. var className, elem,
  7113. i = 0;
  7114. className = " " + selector + " ";
  7115. while ( ( elem = this[ i++ ] ) ) {
  7116. if ( elem.nodeType === 1 &&
  7117. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  7118. return true;
  7119. }
  7120. }
  7121. return false;
  7122. }
  7123. } );
  7124. var rreturn = /\r/g;
  7125. jQuery.fn.extend( {
  7126. val: function( value ) {
  7127. var hooks, ret, isFunction,
  7128. elem = this[ 0 ];
  7129. if ( !arguments.length ) {
  7130. if ( elem ) {
  7131. hooks = jQuery.valHooks[ elem.type ] ||
  7132. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  7133. if ( hooks &&
  7134. "get" in hooks &&
  7135. ( ret = hooks.get( elem, "value" ) ) !== undefined
  7136. ) {
  7137. return ret;
  7138. }
  7139. ret = elem.value;
  7140. // Handle most common string cases
  7141. if ( typeof ret === "string" ) {
  7142. return ret.replace( rreturn, "" );
  7143. }
  7144. // Handle cases where value is null/undef or number
  7145. return ret == null ? "" : ret;
  7146. }
  7147. return;
  7148. }
  7149. isFunction = jQuery.isFunction( value );
  7150. return this.each( function( i ) {
  7151. var val;
  7152. if ( this.nodeType !== 1 ) {
  7153. return;
  7154. }
  7155. if ( isFunction ) {
  7156. val = value.call( this, i, jQuery( this ).val() );
  7157. } else {
  7158. val = value;
  7159. }
  7160. // Treat null/undefined as ""; convert numbers to string
  7161. if ( val == null ) {
  7162. val = "";
  7163. } else if ( typeof val === "number" ) {
  7164. val += "";
  7165. } else if ( Array.isArray( val ) ) {
  7166. val = jQuery.map( val, function( value ) {
  7167. return value == null ? "" : value + "";
  7168. } );
  7169. }
  7170. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  7171. // If set returns undefined, fall back to normal setting
  7172. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  7173. this.value = val;
  7174. }
  7175. } );
  7176. }
  7177. } );
  7178. jQuery.extend( {
  7179. valHooks: {
  7180. option: {
  7181. get: function( elem ) {
  7182. var val = jQuery.find.attr( elem, "value" );
  7183. return val != null ?
  7184. val :
  7185. // Support: IE <=10 - 11 only
  7186. // option.text throws exceptions (#14686, #14858)
  7187. // Strip and collapse whitespace
  7188. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  7189. stripAndCollapse( jQuery.text( elem ) );
  7190. }
  7191. },
  7192. select: {
  7193. get: function( elem ) {
  7194. var value, option, i,
  7195. options = elem.options,
  7196. index = elem.selectedIndex,
  7197. one = elem.type === "select-one",
  7198. values = one ? null : [],
  7199. max = one ? index + 1 : options.length;
  7200. if ( index < 0 ) {
  7201. i = max;
  7202. } else {
  7203. i = one ? index : 0;
  7204. }
  7205. // Loop through all the selected options
  7206. for ( ; i < max; i++ ) {
  7207. option = options[ i ];
  7208. // Support: IE <=9 only
  7209. // IE8-9 doesn't update selected after form reset (#2551)
  7210. if ( ( option.selected || i === index ) &&
  7211. // Don't return options that are disabled or in a disabled optgroup
  7212. !option.disabled &&
  7213. ( !option.parentNode.disabled ||
  7214. !nodeName( option.parentNode, "optgroup" ) ) ) {
  7215. // Get the specific value for the option
  7216. value = jQuery( option ).val();
  7217. // We don't need an array for one selects
  7218. if ( one ) {
  7219. return value;
  7220. }
  7221. // Multi-Selects return an array
  7222. values.push( value );
  7223. }
  7224. }
  7225. return values;
  7226. },
  7227. set: function( elem, value ) {
  7228. var optionSet, option,
  7229. options = elem.options,
  7230. values = jQuery.makeArray( value ),
  7231. i = options.length;
  7232. while ( i-- ) {
  7233. option = options[ i ];
  7234. /* eslint-disable no-cond-assign */
  7235. if ( option.selected =
  7236. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  7237. ) {
  7238. optionSet = true;
  7239. }
  7240. /* eslint-enable no-cond-assign */
  7241. }
  7242. // Force browsers to behave consistently when non-matching value is set
  7243. if ( !optionSet ) {
  7244. elem.selectedIndex = -1;
  7245. }
  7246. return values;
  7247. }
  7248. }
  7249. }
  7250. } );
  7251. // Radios and checkboxes getter/setter
  7252. jQuery.each( [ "radio", "checkbox" ], function() {
  7253. jQuery.valHooks[ this ] = {
  7254. set: function( elem, value ) {
  7255. if ( Array.isArray( value ) ) {
  7256. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  7257. }
  7258. }
  7259. };
  7260. if ( !support.checkOn ) {
  7261. jQuery.valHooks[ this ].get = function( elem ) {
  7262. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  7263. };
  7264. }
  7265. } );
  7266. // Return jQuery for attributes-only inclusion
  7267. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
  7268. jQuery.extend( jQuery.event, {
  7269. trigger: function( event, data, elem, onlyHandlers ) {
  7270. var i, cur, tmp, bubbleType, ontype, handle, special,
  7271. eventPath = [ elem || document ],
  7272. type = hasOwn.call( event, "type" ) ? event.type : event,
  7273. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  7274. cur = tmp = elem = elem || document;
  7275. // Don't do events on text and comment nodes
  7276. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  7277. return;
  7278. }
  7279. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  7280. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  7281. return;
  7282. }
  7283. if ( type.indexOf( "." ) > -1 ) {
  7284. // Namespaced trigger; create a regexp to match event type in handle()
  7285. namespaces = type.split( "." );
  7286. type = namespaces.shift();
  7287. namespaces.sort();
  7288. }
  7289. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  7290. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  7291. event = event[ jQuery.expando ] ?
  7292. event :
  7293. new jQuery.Event( type, typeof event === "object" && event );
  7294. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  7295. event.isTrigger = onlyHandlers ? 2 : 3;
  7296. event.namespace = namespaces.join( "." );
  7297. event.rnamespace = event.namespace ?
  7298. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  7299. null;
  7300. // Clean up the event in case it is being reused
  7301. event.result = undefined;
  7302. if ( !event.target ) {
  7303. event.target = elem;
  7304. }
  7305. // Clone any incoming data and prepend the event, creating the handler arg list
  7306. data = data == null ?
  7307. [ event ] :
  7308. jQuery.makeArray( data, [ event ] );
  7309. // Allow special events to draw outside the lines
  7310. special = jQuery.event.special[ type ] || {};
  7311. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  7312. return;
  7313. }
  7314. // Determine event propagation path in advance, per W3C events spec (#9951)
  7315. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  7316. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  7317. bubbleType = special.delegateType || type;
  7318. if ( !rfocusMorph.test( bubbleType + type ) ) {
  7319. cur = cur.parentNode;
  7320. }
  7321. for ( ; cur; cur = cur.parentNode ) {
  7322. eventPath.push( cur );
  7323. tmp = cur;
  7324. }
  7325. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  7326. if ( tmp === ( elem.ownerDocument || document ) ) {
  7327. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  7328. }
  7329. }
  7330. // Fire handlers on the event path
  7331. i = 0;
  7332. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  7333. event.type = i > 1 ?
  7334. bubbleType :
  7335. special.bindType || type;
  7336. // jQuery handler
  7337. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  7338. dataPriv.get( cur, "handle" );
  7339. if ( handle ) {
  7340. handle.apply( cur, data );
  7341. }
  7342. // Native handler
  7343. handle = ontype && cur[ ontype ];
  7344. if ( handle && handle.apply && acceptData( cur ) ) {
  7345. event.result = handle.apply( cur, data );
  7346. if ( event.result === false ) {
  7347. event.preventDefault();
  7348. }
  7349. }
  7350. }
  7351. event.type = type;
  7352. // If nobody prevented the default action, do it now
  7353. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  7354. if ( ( !special._default ||
  7355. special._default.apply( eventPath.pop(), data ) === false ) &&
  7356. acceptData( elem ) ) {
  7357. // Call a native DOM method on the target with the same name as the event.
  7358. // Don't do default actions on window, that's where global variables be (#6170)
  7359. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  7360. // Don't re-trigger an onFOO event when we call its FOO() method
  7361. tmp = elem[ ontype ];
  7362. if ( tmp ) {
  7363. elem[ ontype ] = null;
  7364. }
  7365. // Prevent re-triggering of the same event, since we already bubbled it above
  7366. jQuery.event.triggered = type;
  7367. elem[ type ]();
  7368. jQuery.event.triggered = undefined;
  7369. if ( tmp ) {
  7370. elem[ ontype ] = tmp;
  7371. }
  7372. }
  7373. }
  7374. }
  7375. return event.result;
  7376. },
  7377. // Piggyback on a donor event to simulate a different one
  7378. // Used only for `focus(in | out)` events
  7379. simulate: function( type, elem, event ) {
  7380. var e = jQuery.extend(
  7381. new jQuery.Event(),
  7382. event,
  7383. {
  7384. type: type,
  7385. isSimulated: true
  7386. }
  7387. );
  7388. jQuery.event.trigger( e, null, elem );
  7389. }
  7390. } );
  7391. jQuery.fn.extend( {
  7392. trigger: function( type, data ) {
  7393. return this.each( function() {
  7394. jQuery.event.trigger( type, data, this );
  7395. } );
  7396. },
  7397. triggerHandler: function( type, data ) {
  7398. var elem = this[ 0 ];
  7399. if ( elem ) {
  7400. return jQuery.event.trigger( type, data, elem, true );
  7401. }
  7402. }
  7403. } );
  7404. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  7405. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  7406. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  7407. function( i, name ) {
  7408. // Handle event binding
  7409. jQuery.fn[ name ] = function( data, fn ) {
  7410. return arguments.length > 0 ?
  7411. this.on( name, null, data, fn ) :
  7412. this.trigger( name );
  7413. };
  7414. } );
  7415. jQuery.fn.extend( {
  7416. hover: function( fnOver, fnOut ) {
  7417. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  7418. }
  7419. } );
  7420. support.focusin = "onfocusin" in window;
  7421. // Support: Firefox <=44
  7422. // Firefox doesn't have focus(in | out) events
  7423. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  7424. //
  7425. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  7426. // focus(in | out) events fire after focus & blur events,
  7427. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  7428. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  7429. if ( !support.focusin ) {
  7430. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  7431. // Attach a single capturing handler on the document while someone wants focusin/focusout
  7432. var handler = function( event ) {
  7433. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  7434. };
  7435. jQuery.event.special[ fix ] = {
  7436. setup: function() {
  7437. var doc = this.ownerDocument || this,
  7438. attaches = dataPriv.access( doc, fix );
  7439. if ( !attaches ) {
  7440. doc.addEventListener( orig, handler, true );
  7441. }
  7442. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  7443. },
  7444. teardown: function() {
  7445. var doc = this.ownerDocument || this,
  7446. attaches = dataPriv.access( doc, fix ) - 1;
  7447. if ( !attaches ) {
  7448. doc.removeEventListener( orig, handler, true );
  7449. dataPriv.remove( doc, fix );
  7450. } else {
  7451. dataPriv.access( doc, fix, attaches );
  7452. }
  7453. }
  7454. };
  7455. } );
  7456. }
  7457. var location = window.location;
  7458. var nonce = jQuery.now();
  7459. var rquery = ( /\?/ );
  7460. // Cross-browser xml parsing
  7461. jQuery.parseXML = function( data ) {
  7462. var xml;
  7463. if ( !data || typeof data !== "string" ) {
  7464. return null;
  7465. }
  7466. // Support: IE 9 - 11 only
  7467. // IE throws on parseFromString with invalid input.
  7468. try {
  7469. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  7470. } catch ( e ) {
  7471. xml = undefined;
  7472. }
  7473. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  7474. jQuery.error( "Invalid XML: " + data );
  7475. }
  7476. return xml;
  7477. };
  7478. var
  7479. rbracket = /\[\]$/,
  7480. rCRLF = /\r?\n/g,
  7481. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  7482. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  7483. function buildParams( prefix, obj, traditional, add ) {
  7484. var name;
  7485. if ( Array.isArray( obj ) ) {
  7486. // Serialize array item.
  7487. jQuery.each( obj, function( i, v ) {
  7488. if ( traditional || rbracket.test( prefix ) ) {
  7489. // Treat each array item as a scalar.
  7490. add( prefix, v );
  7491. } else {
  7492. // Item is non-scalar (array or object), encode its numeric index.
  7493. buildParams(
  7494. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  7495. v,
  7496. traditional,
  7497. add
  7498. );
  7499. }
  7500. } );
  7501. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  7502. // Serialize object item.
  7503. for ( name in obj ) {
  7504. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  7505. }
  7506. } else {
  7507. // Serialize scalar item.
  7508. add( prefix, obj );
  7509. }
  7510. }
  7511. // Serialize an array of form elements or a set of
  7512. // key/values into a query string
  7513. jQuery.param = function( a, traditional ) {
  7514. var prefix,
  7515. s = [],
  7516. add = function( key, valueOrFunction ) {
  7517. // If value is a function, invoke it and use its return value
  7518. var value = jQuery.isFunction( valueOrFunction ) ?
  7519. valueOrFunction() :
  7520. valueOrFunction;
  7521. s[ s.length ] = encodeURIComponent( key ) + "=" +
  7522. encodeURIComponent( value == null ? "" : value );
  7523. };
  7524. // If an array was passed in, assume that it is an array of form elements.
  7525. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  7526. // Serialize the form elements
  7527. jQuery.each( a, function() {
  7528. add( this.name, this.value );
  7529. } );
  7530. } else {
  7531. // If traditional, encode the "old" way (the way 1.3.2 or older
  7532. // did it), otherwise encode params recursively.
  7533. for ( prefix in a ) {
  7534. buildParams( prefix, a[ prefix ], traditional, add );
  7535. }
  7536. }
  7537. // Return the resulting serialization
  7538. return s.join( "&" );
  7539. };
  7540. jQuery.fn.extend( {
  7541. serialize: function() {
  7542. return jQuery.param( this.serializeArray() );
  7543. },
  7544. serializeArray: function() {
  7545. return this.map( function() {
  7546. // Can add propHook for "elements" to filter or add form elements
  7547. var elements = jQuery.prop( this, "elements" );
  7548. return elements ? jQuery.makeArray( elements ) : this;
  7549. } )
  7550. .filter( function() {
  7551. var type = this.type;
  7552. // Use .is( ":disabled" ) so that fieldset[disabled] works
  7553. return this.name && !jQuery( this ).is( ":disabled" ) &&
  7554. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  7555. ( this.checked || !rcheckableType.test( type ) );
  7556. } )
  7557. .map( function( i, elem ) {
  7558. var val = jQuery( this ).val();
  7559. if ( val == null ) {
  7560. return null;
  7561. }
  7562. if ( Array.isArray( val ) ) {
  7563. return jQuery.map( val, function( val ) {
  7564. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7565. } );
  7566. }
  7567. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7568. } ).get();
  7569. }
  7570. } );
  7571. var
  7572. r20 = /%20/g,
  7573. rhash = /#.*$/,
  7574. rantiCache = /([?&])_=[^&]*/,
  7575. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  7576. // #7653, #8125, #8152: local protocol detection
  7577. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  7578. rnoContent = /^(?:GET|HEAD)$/,
  7579. rprotocol = /^\/\//,
  7580. /* Prefilters
  7581. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  7582. * 2) These are called:
  7583. * - BEFORE asking for a transport
  7584. * - AFTER param serialization (s.data is a string if s.processData is true)
  7585. * 3) key is the dataType
  7586. * 4) the catchall symbol "*" can be used
  7587. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  7588. */
  7589. prefilters = {},
  7590. /* Transports bindings
  7591. * 1) key is the dataType
  7592. * 2) the catchall symbol "*" can be used
  7593. * 3) selection will start with transport dataType and THEN go to "*" if needed
  7594. */
  7595. transports = {},
  7596. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  7597. allTypes = "*/".concat( "*" ),
  7598. // Anchor tag for parsing the document origin
  7599. originAnchor = document.createElement( "a" );
  7600. originAnchor.href = location.href;
  7601. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  7602. function addToPrefiltersOrTransports( structure ) {
  7603. // dataTypeExpression is optional and defaults to "*"
  7604. return function( dataTypeExpression, func ) {
  7605. if ( typeof dataTypeExpression !== "string" ) {
  7606. func = dataTypeExpression;
  7607. dataTypeExpression = "*";
  7608. }
  7609. var dataType,
  7610. i = 0,
  7611. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  7612. if ( jQuery.isFunction( func ) ) {
  7613. // For each dataType in the dataTypeExpression
  7614. while ( ( dataType = dataTypes[ i++ ] ) ) {
  7615. // Prepend if requested
  7616. if ( dataType[ 0 ] === "+" ) {
  7617. dataType = dataType.slice( 1 ) || "*";
  7618. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  7619. // Otherwise append
  7620. } else {
  7621. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  7622. }
  7623. }
  7624. }
  7625. };
  7626. }
  7627. // Base inspection function for prefilters and transports
  7628. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  7629. var inspected = {},
  7630. seekingTransport = ( structure === transports );
  7631. function inspect( dataType ) {
  7632. var selected;
  7633. inspected[ dataType ] = true;
  7634. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  7635. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  7636. if ( typeof dataTypeOrTransport === "string" &&
  7637. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  7638. options.dataTypes.unshift( dataTypeOrTransport );
  7639. inspect( dataTypeOrTransport );
  7640. return false;
  7641. } else if ( seekingTransport ) {
  7642. return !( selected = dataTypeOrTransport );
  7643. }
  7644. } );
  7645. return selected;
  7646. }
  7647. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  7648. }
  7649. // A special extend for ajax options
  7650. // that takes "flat" options (not to be deep extended)
  7651. // Fixes #9887
  7652. function ajaxExtend( target, src ) {
  7653. var key, deep,
  7654. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7655. for ( key in src ) {
  7656. if ( src[ key ] !== undefined ) {
  7657. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  7658. }
  7659. }
  7660. if ( deep ) {
  7661. jQuery.extend( true, target, deep );
  7662. }
  7663. return target;
  7664. }
  7665. /* Handles responses to an ajax request:
  7666. * - finds the right dataType (mediates between content-type and expected dataType)
  7667. * - returns the corresponding response
  7668. */
  7669. function ajaxHandleResponses( s, jqXHR, responses ) {
  7670. var ct, type, finalDataType, firstDataType,
  7671. contents = s.contents,
  7672. dataTypes = s.dataTypes;
  7673. // Remove auto dataType and get content-type in the process
  7674. while ( dataTypes[ 0 ] === "*" ) {
  7675. dataTypes.shift();
  7676. if ( ct === undefined ) {
  7677. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7678. }
  7679. }
  7680. // Check if we're dealing with a known content-type
  7681. if ( ct ) {
  7682. for ( type in contents ) {
  7683. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7684. dataTypes.unshift( type );
  7685. break;
  7686. }
  7687. }
  7688. }
  7689. // Check to see if we have a response for the expected dataType
  7690. if ( dataTypes[ 0 ] in responses ) {
  7691. finalDataType = dataTypes[ 0 ];
  7692. } else {
  7693. // Try convertible dataTypes
  7694. for ( type in responses ) {
  7695. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7696. finalDataType = type;
  7697. break;
  7698. }
  7699. if ( !firstDataType ) {
  7700. firstDataType = type;
  7701. }
  7702. }
  7703. // Or just use first one
  7704. finalDataType = finalDataType || firstDataType;
  7705. }
  7706. // If we found a dataType
  7707. // We add the dataType to the list if needed
  7708. // and return the corresponding response
  7709. if ( finalDataType ) {
  7710. if ( finalDataType !== dataTypes[ 0 ] ) {
  7711. dataTypes.unshift( finalDataType );
  7712. }
  7713. return responses[ finalDataType ];
  7714. }
  7715. }
  7716. /* Chain conversions given the request and the original response
  7717. * Also sets the responseXXX fields on the jqXHR instance
  7718. */
  7719. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7720. var conv2, current, conv, tmp, prev,
  7721. converters = {},
  7722. // Work with a copy of dataTypes in case we need to modify it for conversion
  7723. dataTypes = s.dataTypes.slice();
  7724. // Create converters map with lowercased keys
  7725. if ( dataTypes[ 1 ] ) {
  7726. for ( conv in s.converters ) {
  7727. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7728. }
  7729. }
  7730. current = dataTypes.shift();
  7731. // Convert to each sequential dataType
  7732. while ( current ) {
  7733. if ( s.responseFields[ current ] ) {
  7734. jqXHR[ s.responseFields[ current ] ] = response;
  7735. }
  7736. // Apply the dataFilter if provided
  7737. if ( !prev && isSuccess && s.dataFilter ) {
  7738. response = s.dataFilter( response, s.dataType );
  7739. }
  7740. prev = current;
  7741. current = dataTypes.shift();
  7742. if ( current ) {
  7743. // There's only work to do if current dataType is non-auto
  7744. if ( current === "*" ) {
  7745. current = prev;
  7746. // Convert response if prev dataType is non-auto and differs from current
  7747. } else if ( prev !== "*" && prev !== current ) {
  7748. // Seek a direct converter
  7749. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7750. // If none found, seek a pair
  7751. if ( !conv ) {
  7752. for ( conv2 in converters ) {
  7753. // If conv2 outputs current
  7754. tmp = conv2.split( " " );
  7755. if ( tmp[ 1 ] === current ) {
  7756. // If prev can be converted to accepted input
  7757. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7758. converters[ "* " + tmp[ 0 ] ];
  7759. if ( conv ) {
  7760. // Condense equivalence converters
  7761. if ( conv === true ) {
  7762. conv = converters[ conv2 ];
  7763. // Otherwise, insert the intermediate dataType
  7764. } else if ( converters[ conv2 ] !== true ) {
  7765. current = tmp[ 0 ];
  7766. dataTypes.unshift( tmp[ 1 ] );
  7767. }
  7768. break;
  7769. }
  7770. }
  7771. }
  7772. }
  7773. // Apply converter (if not an equivalence)
  7774. if ( conv !== true ) {
  7775. // Unless errors are allowed to bubble, catch and return them
  7776. if ( conv && s.throws ) {
  7777. response = conv( response );
  7778. } else {
  7779. try {
  7780. response = conv( response );
  7781. } catch ( e ) {
  7782. return {
  7783. state: "parsererror",
  7784. error: conv ? e : "No conversion from " + prev + " to " + current
  7785. };
  7786. }
  7787. }
  7788. }
  7789. }
  7790. }
  7791. }
  7792. return { state: "success", data: response };
  7793. }
  7794. jQuery.extend( {
  7795. // Counter for holding the number of active queries
  7796. active: 0,
  7797. // Last-Modified header cache for next request
  7798. lastModified: {},
  7799. etag: {},
  7800. ajaxSettings: {
  7801. url: location.href,
  7802. type: "GET",
  7803. isLocal: rlocalProtocol.test( location.protocol ),
  7804. global: true,
  7805. processData: true,
  7806. async: true,
  7807. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7808. /*
  7809. timeout: 0,
  7810. data: null,
  7811. dataType: null,
  7812. username: null,
  7813. password: null,
  7814. cache: null,
  7815. throws: false,
  7816. traditional: false,
  7817. headers: {},
  7818. */
  7819. accepts: {
  7820. "*": allTypes,
  7821. text: "text/plain",
  7822. html: "text/html",
  7823. xml: "application/xml, text/xml",
  7824. json: "application/json, text/javascript"
  7825. },
  7826. contents: {
  7827. xml: /\bxml\b/,
  7828. html: /\bhtml/,
  7829. json: /\bjson\b/
  7830. },
  7831. responseFields: {
  7832. xml: "responseXML",
  7833. text: "responseText",
  7834. json: "responseJSON"
  7835. },
  7836. // Data converters
  7837. // Keys separate source (or catchall "*") and destination types with a single space
  7838. converters: {
  7839. // Convert anything to text
  7840. "* text": String,
  7841. // Text to html (true = no transformation)
  7842. "text html": true,
  7843. // Evaluate text as a json expression
  7844. "text json": JSON.parse,
  7845. // Parse text as xml
  7846. "text xml": jQuery.parseXML
  7847. },
  7848. // For options that shouldn't be deep extended:
  7849. // you can add your own custom options here if
  7850. // and when you create one that shouldn't be
  7851. // deep extended (see ajaxExtend)
  7852. flatOptions: {
  7853. url: true,
  7854. context: true
  7855. }
  7856. },
  7857. // Creates a full fledged settings object into target
  7858. // with both ajaxSettings and settings fields.
  7859. // If target is omitted, writes into ajaxSettings.
  7860. ajaxSetup: function( target, settings ) {
  7861. return settings ?
  7862. // Building a settings object
  7863. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  7864. // Extending ajaxSettings
  7865. ajaxExtend( jQuery.ajaxSettings, target );
  7866. },
  7867. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  7868. ajaxTransport: addToPrefiltersOrTransports( transports ),
  7869. // Main method
  7870. ajax: function( url, options ) {
  7871. // If url is an object, simulate pre-1.5 signature
  7872. if ( typeof url === "object" ) {
  7873. options = url;
  7874. url = undefined;
  7875. }
  7876. // Force options to be an object
  7877. options = options || {};
  7878. var transport,
  7879. // URL without anti-cache param
  7880. cacheURL,
  7881. // Response headers
  7882. responseHeadersString,
  7883. responseHeaders,
  7884. // timeout handle
  7885. timeoutTimer,
  7886. // Url cleanup var
  7887. urlAnchor,
  7888. // Request state (becomes false upon send and true upon completion)
  7889. completed,
  7890. // To know if global events are to be dispatched
  7891. fireGlobals,
  7892. // Loop variable
  7893. i,
  7894. // uncached part of the url
  7895. uncached,
  7896. // Create the final options object
  7897. s = jQuery.ajaxSetup( {}, options ),
  7898. // Callbacks context
  7899. callbackContext = s.context || s,
  7900. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7901. globalEventContext = s.context &&
  7902. ( callbackContext.nodeType || callbackContext.jquery ) ?
  7903. jQuery( callbackContext ) :
  7904. jQuery.event,
  7905. // Deferreds
  7906. deferred = jQuery.Deferred(),
  7907. completeDeferred = jQuery.Callbacks( "once memory" ),
  7908. // Status-dependent callbacks
  7909. statusCode = s.statusCode || {},
  7910. // Headers (they are sent all at once)
  7911. requestHeaders = {},
  7912. requestHeadersNames = {},
  7913. // Default abort message
  7914. strAbort = "canceled",
  7915. // Fake xhr
  7916. jqXHR = {
  7917. readyState: 0,
  7918. // Builds headers hashtable if needed
  7919. getResponseHeader: function( key ) {
  7920. var match;
  7921. if ( completed ) {
  7922. if ( !responseHeaders ) {
  7923. responseHeaders = {};
  7924. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  7925. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  7926. }
  7927. }
  7928. match = responseHeaders[ key.toLowerCase() ];
  7929. }
  7930. return match == null ? null : match;
  7931. },
  7932. // Raw string
  7933. getAllResponseHeaders: function() {
  7934. return completed ? responseHeadersString : null;
  7935. },
  7936. // Caches the header
  7937. setRequestHeader: function( name, value ) {
  7938. if ( completed == null ) {
  7939. name = requestHeadersNames[ name.toLowerCase() ] =
  7940. requestHeadersNames[ name.toLowerCase() ] || name;
  7941. requestHeaders[ name ] = value;
  7942. }
  7943. return this;
  7944. },
  7945. // Overrides response content-type header
  7946. overrideMimeType: function( type ) {
  7947. if ( completed == null ) {
  7948. s.mimeType = type;
  7949. }
  7950. return this;
  7951. },
  7952. // Status-dependent callbacks
  7953. statusCode: function( map ) {
  7954. var code;
  7955. if ( map ) {
  7956. if ( completed ) {
  7957. // Execute the appropriate callbacks
  7958. jqXHR.always( map[ jqXHR.status ] );
  7959. } else {
  7960. // Lazy-add the new callbacks in a way that preserves old ones
  7961. for ( code in map ) {
  7962. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  7963. }
  7964. }
  7965. }
  7966. return this;
  7967. },
  7968. // Cancel the request
  7969. abort: function( statusText ) {
  7970. var finalText = statusText || strAbort;
  7971. if ( transport ) {
  7972. transport.abort( finalText );
  7973. }
  7974. done( 0, finalText );
  7975. return this;
  7976. }
  7977. };
  7978. // Attach deferreds
  7979. deferred.promise( jqXHR );
  7980. // Add protocol if not provided (prefilters might expect it)
  7981. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7982. // We also use the url parameter if available
  7983. s.url = ( ( url || s.url || location.href ) + "" )
  7984. .replace( rprotocol, location.protocol + "//" );
  7985. // Alias method option to type as per ticket #12004
  7986. s.type = options.method || options.type || s.method || s.type;
  7987. // Extract dataTypes list
  7988. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  7989. // A cross-domain request is in order when the origin doesn't match the current origin.
  7990. if ( s.crossDomain == null ) {
  7991. urlAnchor = document.createElement( "a" );
  7992. // Support: IE <=8 - 11, Edge 12 - 13
  7993. // IE throws exception on accessing the href property if url is malformed,
  7994. // e.g. http://example.com:80x/
  7995. try {
  7996. urlAnchor.href = s.url;
  7997. // Support: IE <=8 - 11 only
  7998. // Anchor's host property isn't correctly set when s.url is relative
  7999. urlAnchor.href = urlAnchor.href;
  8000. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  8001. urlAnchor.protocol + "//" + urlAnchor.host;
  8002. } catch ( e ) {
  8003. // If there is an error parsing the URL, assume it is crossDomain,
  8004. // it can be rejected by the transport if it is invalid
  8005. s.crossDomain = true;
  8006. }
  8007. }
  8008. // Convert data if not already a string
  8009. if ( s.data && s.processData && typeof s.data !== "string" ) {
  8010. s.data = jQuery.param( s.data, s.traditional );
  8011. }
  8012. // Apply prefilters
  8013. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  8014. // If request was aborted inside a prefilter, stop there
  8015. if ( completed ) {
  8016. return jqXHR;
  8017. }
  8018. // We can fire global events as of now if asked to
  8019. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  8020. fireGlobals = jQuery.event && s.global;
  8021. // Watch for a new set of requests
  8022. if ( fireGlobals && jQuery.active++ === 0 ) {
  8023. jQuery.event.trigger( "ajaxStart" );
  8024. }
  8025. // Uppercase the type
  8026. s.type = s.type.toUpperCase();
  8027. // Determine if request has content
  8028. s.hasContent = !rnoContent.test( s.type );
  8029. // Save the URL in case we're toying with the If-Modified-Since
  8030. // and/or If-None-Match header later on
  8031. // Remove hash to simplify url manipulation
  8032. cacheURL = s.url.replace( rhash, "" );
  8033. // More options handling for requests with no content
  8034. if ( !s.hasContent ) {
  8035. // Remember the hash so we can put it back
  8036. uncached = s.url.slice( cacheURL.length );
  8037. // If data is available, append data to url
  8038. if ( s.data ) {
  8039. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  8040. // #9682: remove data so that it's not used in an eventual retry
  8041. delete s.data;
  8042. }
  8043. // Add or update anti-cache param if needed
  8044. if ( s.cache === false ) {
  8045. cacheURL = cacheURL.replace( rantiCache, "$1" );
  8046. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  8047. }
  8048. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  8049. s.url = cacheURL + uncached;
  8050. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  8051. } else if ( s.data && s.processData &&
  8052. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  8053. s.data = s.data.replace( r20, "+" );
  8054. }
  8055. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8056. if ( s.ifModified ) {
  8057. if ( jQuery.lastModified[ cacheURL ] ) {
  8058. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  8059. }
  8060. if ( jQuery.etag[ cacheURL ] ) {
  8061. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  8062. }
  8063. }
  8064. // Set the correct header, if data is being sent
  8065. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  8066. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  8067. }
  8068. // Set the Accepts header for the server, depending on the dataType
  8069. jqXHR.setRequestHeader(
  8070. "Accept",
  8071. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  8072. s.accepts[ s.dataTypes[ 0 ] ] +
  8073. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  8074. s.accepts[ "*" ]
  8075. );
  8076. // Check for headers option
  8077. for ( i in s.headers ) {
  8078. jqXHR.setRequestHeader( i, s.headers[ i ] );
  8079. }
  8080. // Allow custom headers/mimetypes and early abort
  8081. if ( s.beforeSend &&
  8082. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  8083. // Abort if not done already and return
  8084. return jqXHR.abort();
  8085. }
  8086. // Aborting is no longer a cancellation
  8087. strAbort = "abort";
  8088. // Install callbacks on deferreds
  8089. completeDeferred.add( s.complete );
  8090. jqXHR.done( s.success );
  8091. jqXHR.fail( s.error );
  8092. // Get transport
  8093. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  8094. // If no transport, we auto-abort
  8095. if ( !transport ) {
  8096. done( -1, "No Transport" );
  8097. } else {
  8098. jqXHR.readyState = 1;
  8099. // Send global event
  8100. if ( fireGlobals ) {
  8101. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  8102. }
  8103. // If request was aborted inside ajaxSend, stop there
  8104. if ( completed ) {
  8105. return jqXHR;
  8106. }
  8107. // Timeout
  8108. if ( s.async && s.timeout > 0 ) {
  8109. timeoutTimer = window.setTimeout( function() {
  8110. jqXHR.abort( "timeout" );
  8111. }, s.timeout );
  8112. }
  8113. try {
  8114. completed = false;
  8115. transport.send( requestHeaders, done );
  8116. } catch ( e ) {
  8117. // Rethrow post-completion exceptions
  8118. if ( completed ) {
  8119. throw e;
  8120. }
  8121. // Propagate others as results
  8122. done( -1, e );
  8123. }
  8124. }
  8125. // Callback for when everything is done
  8126. function done( status, nativeStatusText, responses, headers ) {
  8127. var isSuccess, success, error, response, modified,
  8128. statusText = nativeStatusText;
  8129. // Ignore repeat invocations
  8130. if ( completed ) {
  8131. return;
  8132. }
  8133. completed = true;
  8134. // Clear timeout if it exists
  8135. if ( timeoutTimer ) {
  8136. window.clearTimeout( timeoutTimer );
  8137. }
  8138. // Dereference transport for early garbage collection
  8139. // (no matter how long the jqXHR object will be used)
  8140. transport = undefined;
  8141. // Cache response headers
  8142. responseHeadersString = headers || "";
  8143. // Set readyState
  8144. jqXHR.readyState = status > 0 ? 4 : 0;
  8145. // Determine if successful
  8146. isSuccess = status >= 200 && status < 300 || status === 304;
  8147. // Get response data
  8148. if ( responses ) {
  8149. response = ajaxHandleResponses( s, jqXHR, responses );
  8150. }
  8151. // Convert no matter what (that way responseXXX fields are always set)
  8152. response = ajaxConvert( s, response, jqXHR, isSuccess );
  8153. // If successful, handle type chaining
  8154. if ( isSuccess ) {
  8155. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8156. if ( s.ifModified ) {
  8157. modified = jqXHR.getResponseHeader( "Last-Modified" );
  8158. if ( modified ) {
  8159. jQuery.lastModified[ cacheURL ] = modified;
  8160. }
  8161. modified = jqXHR.getResponseHeader( "etag" );
  8162. if ( modified ) {
  8163. jQuery.etag[ cacheURL ] = modified;
  8164. }
  8165. }
  8166. // if no content
  8167. if ( status === 204 || s.type === "HEAD" ) {
  8168. statusText = "nocontent";
  8169. // if not modified
  8170. } else if ( status === 304 ) {
  8171. statusText = "notmodified";
  8172. // If we have data, let's convert it
  8173. } else {
  8174. statusText = response.state;
  8175. success = response.data;
  8176. error = response.error;
  8177. isSuccess = !error;
  8178. }
  8179. } else {
  8180. // Extract error from statusText and normalize for non-aborts
  8181. error = statusText;
  8182. if ( status || !statusText ) {
  8183. statusText = "error";
  8184. if ( status < 0 ) {
  8185. status = 0;
  8186. }
  8187. }
  8188. }
  8189. // Set data for the fake xhr object
  8190. jqXHR.status = status;
  8191. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  8192. // Success/Error
  8193. if ( isSuccess ) {
  8194. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  8195. } else {
  8196. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  8197. }
  8198. // Status-dependent callbacks
  8199. jqXHR.statusCode( statusCode );
  8200. statusCode = undefined;
  8201. if ( fireGlobals ) {
  8202. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  8203. [ jqXHR, s, isSuccess ? success : error ] );
  8204. }
  8205. // Complete
  8206. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  8207. if ( fireGlobals ) {
  8208. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  8209. // Handle the global AJAX counter
  8210. if ( !( --jQuery.active ) ) {
  8211. jQuery.event.trigger( "ajaxStop" );
  8212. }
  8213. }
  8214. }
  8215. return jqXHR;
  8216. },
  8217. getJSON: function( url, data, callback ) {
  8218. return jQuery.get( url, data, callback, "json" );
  8219. },
  8220. getScript: function( url, callback ) {
  8221. return jQuery.get( url, undefined, callback, "script" );
  8222. }
  8223. } );
  8224. jQuery.each( [ "get", "post" ], function( i, method ) {
  8225. jQuery[ method ] = function( url, data, callback, type ) {
  8226. // Shift arguments if data argument was omitted
  8227. if ( jQuery.isFunction( data ) ) {
  8228. type = type || callback;
  8229. callback = data;
  8230. data = undefined;
  8231. }
  8232. // The url can be an options object (which then must have .url)
  8233. return jQuery.ajax( jQuery.extend( {
  8234. url: url,
  8235. type: method,
  8236. dataType: type,
  8237. data: data,
  8238. success: callback
  8239. }, jQuery.isPlainObject( url ) && url ) );
  8240. };
  8241. } );
  8242. jQuery._evalUrl = function( url ) {
  8243. return jQuery.ajax( {
  8244. url: url,
  8245. // Make this explicit, since user can override this through ajaxSetup (#11264)
  8246. type: "GET",
  8247. dataType: "script",
  8248. cache: true,
  8249. async: false,
  8250. global: false,
  8251. "throws": true
  8252. } );
  8253. };
  8254. jQuery.fn.extend( {
  8255. wrapAll: function( html ) {
  8256. var wrap;
  8257. if ( this[ 0 ] ) {
  8258. if ( jQuery.isFunction( html ) ) {
  8259. html = html.call( this[ 0 ] );
  8260. }
  8261. // The elements to wrap the target around
  8262. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8263. if ( this[ 0 ].parentNode ) {
  8264. wrap.insertBefore( this[ 0 ] );
  8265. }
  8266. wrap.map( function() {
  8267. var elem = this;
  8268. while ( elem.firstElementChild ) {
  8269. elem = elem.firstElementChild;
  8270. }
  8271. return elem;
  8272. } ).append( this );
  8273. }
  8274. return this;
  8275. },
  8276. wrapInner: function( html ) {
  8277. if ( jQuery.isFunction( html ) ) {
  8278. return this.each( function( i ) {
  8279. jQuery( this ).wrapInner( html.call( this, i ) );
  8280. } );
  8281. }
  8282. return this.each( function() {
  8283. var self = jQuery( this ),
  8284. contents = self.contents();
  8285. if ( contents.length ) {
  8286. contents.wrapAll( html );
  8287. } else {
  8288. self.append( html );
  8289. }
  8290. } );
  8291. },
  8292. wrap: function( html ) {
  8293. var isFunction = jQuery.isFunction( html );
  8294. return this.each( function( i ) {
  8295. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  8296. } );
  8297. },
  8298. unwrap: function( selector ) {
  8299. this.parent( selector ).not( "body" ).each( function() {
  8300. jQuery( this ).replaceWith( this.childNodes );
  8301. } );
  8302. return this;
  8303. }
  8304. } );
  8305. jQuery.expr.pseudos.hidden = function( elem ) {
  8306. return !jQuery.expr.pseudos.visible( elem );
  8307. };
  8308. jQuery.expr.pseudos.visible = function( elem ) {
  8309. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  8310. };
  8311. jQuery.ajaxSettings.xhr = function() {
  8312. try {
  8313. return new window.XMLHttpRequest();
  8314. } catch ( e ) {}
  8315. };
  8316. var xhrSuccessStatus = {
  8317. // File protocol always yields status code 0, assume 200
  8318. 0: 200,
  8319. // Support: IE <=9 only
  8320. // #1450: sometimes IE returns 1223 when it should be 204
  8321. 1223: 204
  8322. },
  8323. xhrSupported = jQuery.ajaxSettings.xhr();
  8324. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  8325. support.ajax = xhrSupported = !!xhrSupported;
  8326. jQuery.ajaxTransport( function( options ) {
  8327. var callback, errorCallback;
  8328. // Cross domain only allowed if supported through XMLHttpRequest
  8329. if ( support.cors || xhrSupported && !options.crossDomain ) {
  8330. return {
  8331. send: function( headers, complete ) {
  8332. var i,
  8333. xhr = options.xhr();
  8334. xhr.open(
  8335. options.type,
  8336. options.url,
  8337. options.async,
  8338. options.username,
  8339. options.password
  8340. );
  8341. // Apply custom fields if provided
  8342. if ( options.xhrFields ) {
  8343. for ( i in options.xhrFields ) {
  8344. xhr[ i ] = options.xhrFields[ i ];
  8345. }
  8346. }
  8347. // Override mime type if needed
  8348. if ( options.mimeType && xhr.overrideMimeType ) {
  8349. xhr.overrideMimeType( options.mimeType );
  8350. }
  8351. // X-Requested-With header
  8352. // For cross-domain requests, seeing as conditions for a preflight are
  8353. // akin to a jigsaw puzzle, we simply never set it to be sure.
  8354. // (it can always be set on a per-request basis or even using ajaxSetup)
  8355. // For same-domain requests, won't change header if already provided.
  8356. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  8357. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  8358. }
  8359. // Set headers
  8360. for ( i in headers ) {
  8361. xhr.setRequestHeader( i, headers[ i ] );
  8362. }
  8363. // Callback
  8364. callback = function( type ) {
  8365. return function() {
  8366. if ( callback ) {
  8367. callback = errorCallback = xhr.onload =
  8368. xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
  8369. if ( type === "abort" ) {
  8370. xhr.abort();
  8371. } else if ( type === "error" ) {
  8372. // Support: IE <=9 only
  8373. // On a manual native abort, IE9 throws
  8374. // errors on any property access that is not readyState
  8375. if ( typeof xhr.status !== "number" ) {
  8376. complete( 0, "error" );
  8377. } else {
  8378. complete(
  8379. // File: protocol always yields status 0; see #8605, #14207
  8380. xhr.status,
  8381. xhr.statusText
  8382. );
  8383. }
  8384. } else {
  8385. complete(
  8386. xhrSuccessStatus[ xhr.status ] || xhr.status,
  8387. xhr.statusText,
  8388. // Support: IE <=9 only
  8389. // IE9 has no XHR2 but throws on binary (trac-11426)
  8390. // For XHR2 non-text, let the caller handle it (gh-2498)
  8391. ( xhr.responseType || "text" ) !== "text" ||
  8392. typeof xhr.responseText !== "string" ?
  8393. { binary: xhr.response } :
  8394. { text: xhr.responseText },
  8395. xhr.getAllResponseHeaders()
  8396. );
  8397. }
  8398. }
  8399. };
  8400. };
  8401. // Listen to events
  8402. xhr.onload = callback();
  8403. errorCallback = xhr.onerror = callback( "error" );
  8404. // Support: IE 9 only
  8405. // Use onreadystatechange to replace onabort
  8406. // to handle uncaught aborts
  8407. if ( xhr.onabort !== undefined ) {
  8408. xhr.onabort = errorCallback;
  8409. } else {
  8410. xhr.onreadystatechange = function() {
  8411. // Check readyState before timeout as it changes
  8412. if ( xhr.readyState === 4 ) {
  8413. // Allow onerror to be called first,
  8414. // but that will not handle a native abort
  8415. // Also, save errorCallback to a variable
  8416. // as xhr.onerror cannot be accessed
  8417. window.setTimeout( function() {
  8418. if ( callback ) {
  8419. errorCallback();
  8420. }
  8421. } );
  8422. }
  8423. };
  8424. }
  8425. // Create the abort callback
  8426. callback = callback( "abort" );
  8427. try {
  8428. // Do send the request (this may raise an exception)
  8429. xhr.send( options.hasContent && options.data || null );
  8430. } catch ( e ) {
  8431. // #14683: Only rethrow if this hasn't been notified as an error yet
  8432. if ( callback ) {
  8433. throw e;
  8434. }
  8435. }
  8436. },
  8437. abort: function() {
  8438. if ( callback ) {
  8439. callback();
  8440. }
  8441. }
  8442. };
  8443. }
  8444. } );
  8445. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  8446. jQuery.ajaxPrefilter( function( s ) {
  8447. if ( s.crossDomain ) {
  8448. s.contents.script = false;
  8449. }
  8450. } );
  8451. // Install script dataType
  8452. jQuery.ajaxSetup( {
  8453. accepts: {
  8454. script: "text/javascript, application/javascript, " +
  8455. "application/ecmascript, application/x-ecmascript"
  8456. },
  8457. contents: {
  8458. script: /\b(?:java|ecma)script\b/
  8459. },
  8460. converters: {
  8461. "text script": function( text ) {
  8462. jQuery.globalEval( text );
  8463. return text;
  8464. }
  8465. }
  8466. } );
  8467. // Handle cache's special case and crossDomain
  8468. jQuery.ajaxPrefilter( "script", function( s ) {
  8469. if ( s.cache === undefined ) {
  8470. s.cache = false;
  8471. }
  8472. if ( s.crossDomain ) {
  8473. s.type = "GET";
  8474. }
  8475. } );
  8476. // Bind script tag hack transport
  8477. jQuery.ajaxTransport( "script", function( s ) {
  8478. // This transport only deals with cross domain requests
  8479. if ( s.crossDomain ) {
  8480. var script, callback;
  8481. return {
  8482. send: function( _, complete ) {
  8483. script = jQuery( "<script>" ).prop( {
  8484. charset: s.scriptCharset,
  8485. src: s.url
  8486. } ).on(
  8487. "load error",
  8488. callback = function( evt ) {
  8489. script.remove();
  8490. callback = null;
  8491. if ( evt ) {
  8492. complete( evt.type === "error" ? 404 : 200, evt.type );
  8493. }
  8494. }
  8495. );
  8496. // Use native DOM manipulation to avoid our domManip AJAX trickery
  8497. document.head.appendChild( script[ 0 ] );
  8498. },
  8499. abort: function() {
  8500. if ( callback ) {
  8501. callback();
  8502. }
  8503. }
  8504. };
  8505. }
  8506. } );
  8507. var oldCallbacks = [],
  8508. rjsonp = /(=)\?(?=&|$)|\?\?/;
  8509. // Default jsonp settings
  8510. jQuery.ajaxSetup( {
  8511. jsonp: "callback",
  8512. jsonpCallback: function() {
  8513. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  8514. this[ callback ] = true;
  8515. return callback;
  8516. }
  8517. } );
  8518. // Detect, normalize options and install callbacks for jsonp requests
  8519. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  8520. var callbackName, overwritten, responseContainer,
  8521. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  8522. "url" :
  8523. typeof s.data === "string" &&
  8524. ( s.contentType || "" )
  8525. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  8526. rjsonp.test( s.data ) && "data"
  8527. );
  8528. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  8529. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  8530. // Get callback name, remembering preexisting value associated with it
  8531. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  8532. s.jsonpCallback() :
  8533. s.jsonpCallback;
  8534. // Insert callback into url or form data
  8535. if ( jsonProp ) {
  8536. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  8537. } else if ( s.jsonp !== false ) {
  8538. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  8539. }
  8540. // Use data converter to retrieve json after script execution
  8541. s.converters[ "script json" ] = function() {
  8542. if ( !responseContainer ) {
  8543. jQuery.error( callbackName + " was not called" );
  8544. }
  8545. return responseContainer[ 0 ];
  8546. };
  8547. // Force json dataType
  8548. s.dataTypes[ 0 ] = "json";
  8549. // Install callback
  8550. overwritten = window[ callbackName ];
  8551. window[ callbackName ] = function() {
  8552. responseContainer = arguments;
  8553. };
  8554. // Clean-up function (fires after converters)
  8555. jqXHR.always( function() {
  8556. // If previous value didn't exist - remove it
  8557. if ( overwritten === undefined ) {
  8558. jQuery( window ).removeProp( callbackName );
  8559. // Otherwise restore preexisting value
  8560. } else {
  8561. window[ callbackName ] = overwritten;
  8562. }
  8563. // Save back as free
  8564. if ( s[ callbackName ] ) {
  8565. // Make sure that re-using the options doesn't screw things around
  8566. s.jsonpCallback = originalSettings.jsonpCallback;
  8567. // Save the callback name for future use
  8568. oldCallbacks.push( callbackName );
  8569. }
  8570. // Call if it was a function and we have a response
  8571. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  8572. overwritten( responseContainer[ 0 ] );
  8573. }
  8574. responseContainer = overwritten = undefined;
  8575. } );
  8576. // Delegate to script
  8577. return "script";
  8578. }
  8579. } );
  8580. // Support: Safari 8 only
  8581. // In Safari 8 documents created via document.implementation.createHTMLDocument
  8582. // collapse sibling forms: the second one becomes a child of the first one.
  8583. // Because of that, this security measure has to be disabled in Safari 8.
  8584. // https://bugs.webkit.org/show_bug.cgi?id=137337
  8585. support.createHTMLDocument = ( function() {
  8586. var body = document.implementation.createHTMLDocument( "" ).body;
  8587. body.innerHTML = "<form></form><form></form>";
  8588. return body.childNodes.length === 2;
  8589. } )();
  8590. // Argument "data" should be string of html
  8591. // context (optional): If specified, the fragment will be created in this context,
  8592. // defaults to document
  8593. // keepScripts (optional): If true, will include scripts passed in the html string
  8594. jQuery.parseHTML = function( data, context, keepScripts ) {
  8595. if ( typeof data !== "string" ) {
  8596. return [];
  8597. }
  8598. if ( typeof context === "boolean" ) {
  8599. keepScripts = context;
  8600. context = false;
  8601. }
  8602. var base, parsed, scripts;
  8603. if ( !context ) {
  8604. // Stop scripts or inline event handlers from being executed immediately
  8605. // by using document.implementation
  8606. if ( support.createHTMLDocument ) {
  8607. context = document.implementation.createHTMLDocument( "" );
  8608. // Set the base href for the created document
  8609. // so any parsed elements with URLs
  8610. // are based on the document's URL (gh-2965)
  8611. base = context.createElement( "base" );
  8612. base.href = document.location.href;
  8613. context.head.appendChild( base );
  8614. } else {
  8615. context = document;
  8616. }
  8617. }
  8618. parsed = rsingleTag.exec( data );
  8619. scripts = !keepScripts && [];
  8620. // Single tag
  8621. if ( parsed ) {
  8622. return [ context.createElement( parsed[ 1 ] ) ];
  8623. }
  8624. parsed = buildFragment( [ data ], context, scripts );
  8625. if ( scripts && scripts.length ) {
  8626. jQuery( scripts ).remove();
  8627. }
  8628. return jQuery.merge( [], parsed.childNodes );
  8629. };
  8630. /**
  8631. * Load a url into a page
  8632. */
  8633. jQuery.fn.load = function( url, params, callback ) {
  8634. var selector, type, response,
  8635. self = this,
  8636. off = url.indexOf( " " );
  8637. if ( off > -1 ) {
  8638. selector = stripAndCollapse( url.slice( off ) );
  8639. url = url.slice( 0, off );
  8640. }
  8641. // If it's a function
  8642. if ( jQuery.isFunction( params ) ) {
  8643. // We assume that it's the callback
  8644. callback = params;
  8645. params = undefined;
  8646. // Otherwise, build a param string
  8647. } else if ( params && typeof params === "object" ) {
  8648. type = "POST";
  8649. }
  8650. // If we have elements to modify, make the request
  8651. if ( self.length > 0 ) {
  8652. jQuery.ajax( {
  8653. url: url,
  8654. // If "type" variable is undefined, then "GET" method will be used.
  8655. // Make value of this field explicit since
  8656. // user can override it through ajaxSetup method
  8657. type: type || "GET",
  8658. dataType: "html",
  8659. data: params
  8660. } ).done( function( responseText ) {
  8661. // Save response for use in complete callback
  8662. response = arguments;
  8663. self.html( selector ?
  8664. // If a selector was specified, locate the right elements in a dummy div
  8665. // Exclude scripts to avoid IE 'Permission Denied' errors
  8666. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  8667. // Otherwise use the full result
  8668. responseText );
  8669. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8670. // but they are ignored because response was set above.
  8671. // If it fails, this function gets "jqXHR", "status", "error"
  8672. } ).always( callback && function( jqXHR, status ) {
  8673. self.each( function() {
  8674. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  8675. } );
  8676. } );
  8677. }
  8678. return this;
  8679. };
  8680. // Attach a bunch of functions for handling common AJAX events
  8681. jQuery.each( [
  8682. "ajaxStart",
  8683. "ajaxStop",
  8684. "ajaxComplete",
  8685. "ajaxError",
  8686. "ajaxSuccess",
  8687. "ajaxSend"
  8688. ], function( i, type ) {
  8689. jQuery.fn[ type ] = function( fn ) {
  8690. return this.on( type, fn );
  8691. };
  8692. } );
  8693. jQuery.expr.pseudos.animated = function( elem ) {
  8694. return jQuery.grep( jQuery.timers, function( fn ) {
  8695. return elem === fn.elem;
  8696. } ).length;
  8697. };
  8698. jQuery.offset = {
  8699. setOffset: function( elem, options, i ) {
  8700. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8701. position = jQuery.css( elem, "position" ),
  8702. curElem = jQuery( elem ),
  8703. props = {};
  8704. // Set position first, in-case top/left are set even on static elem
  8705. if ( position === "static" ) {
  8706. elem.style.position = "relative";
  8707. }
  8708. curOffset = curElem.offset();
  8709. curCSSTop = jQuery.css( elem, "top" );
  8710. curCSSLeft = jQuery.css( elem, "left" );
  8711. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8712. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8713. // Need to be able to calculate position if either
  8714. // top or left is auto and position is either absolute or fixed
  8715. if ( calculatePosition ) {
  8716. curPosition = curElem.position();
  8717. curTop = curPosition.top;
  8718. curLeft = curPosition.left;
  8719. } else {
  8720. curTop = parseFloat( curCSSTop ) || 0;
  8721. curLeft = parseFloat( curCSSLeft ) || 0;
  8722. }
  8723. if ( jQuery.isFunction( options ) ) {
  8724. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8725. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8726. }
  8727. if ( options.top != null ) {
  8728. props.top = ( options.top - curOffset.top ) + curTop;
  8729. }
  8730. if ( options.left != null ) {
  8731. props.left = ( options.left - curOffset.left ) + curLeft;
  8732. }
  8733. if ( "using" in options ) {
  8734. options.using.call( elem, props );
  8735. } else {
  8736. curElem.css( props );
  8737. }
  8738. }
  8739. };
  8740. jQuery.fn.extend( {
  8741. offset: function( options ) {
  8742. // Preserve chaining for setter
  8743. if ( arguments.length ) {
  8744. return options === undefined ?
  8745. this :
  8746. this.each( function( i ) {
  8747. jQuery.offset.setOffset( this, options, i );
  8748. } );
  8749. }
  8750. var doc, docElem, rect, win,
  8751. elem = this[ 0 ];
  8752. if ( !elem ) {
  8753. return;
  8754. }
  8755. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8756. // Support: IE <=11 only
  8757. // Running getBoundingClientRect on a
  8758. // disconnected node in IE throws an error
  8759. if ( !elem.getClientRects().length ) {
  8760. return { top: 0, left: 0 };
  8761. }
  8762. rect = elem.getBoundingClientRect();
  8763. doc = elem.ownerDocument;
  8764. docElem = doc.documentElement;
  8765. win = doc.defaultView;
  8766. return {
  8767. top: rect.top + win.pageYOffset - docElem.clientTop,
  8768. left: rect.left + win.pageXOffset - docElem.clientLeft
  8769. };
  8770. },
  8771. position: function() {
  8772. if ( !this[ 0 ] ) {
  8773. return;
  8774. }
  8775. var offsetParent, offset,
  8776. elem = this[ 0 ],
  8777. parentOffset = { top: 0, left: 0 };
  8778. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  8779. // because it is its only offset parent
  8780. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8781. // Assume getBoundingClientRect is there when computed position is fixed
  8782. offset = elem.getBoundingClientRect();
  8783. } else {
  8784. // Get *real* offsetParent
  8785. offsetParent = this.offsetParent();
  8786. // Get correct offsets
  8787. offset = this.offset();
  8788. if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
  8789. parentOffset = offsetParent.offset();
  8790. }
  8791. // Add offsetParent borders
  8792. parentOffset = {
  8793. top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
  8794. left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
  8795. };
  8796. }
  8797. // Subtract parent offsets and element margins
  8798. return {
  8799. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8800. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8801. };
  8802. },
  8803. // This method will return documentElement in the following cases:
  8804. // 1) For the element inside the iframe without offsetParent, this method will return
  8805. // documentElement of the parent window
  8806. // 2) For the hidden or detached element
  8807. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8808. //
  8809. // but those exceptions were never presented as a real life use-cases
  8810. // and might be considered as more preferable results.
  8811. //
  8812. // This logic, however, is not guaranteed and can change at any point in the future
  8813. offsetParent: function() {
  8814. return this.map( function() {
  8815. var offsetParent = this.offsetParent;
  8816. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8817. offsetParent = offsetParent.offsetParent;
  8818. }
  8819. return offsetParent || documentElement;
  8820. } );
  8821. }
  8822. } );
  8823. // Create scrollLeft and scrollTop methods
  8824. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8825. var top = "pageYOffset" === prop;
  8826. jQuery.fn[ method ] = function( val ) {
  8827. return access( this, function( elem, method, val ) {
  8828. // Coalesce documents and windows
  8829. var win;
  8830. if ( jQuery.isWindow( elem ) ) {
  8831. win = elem;
  8832. } else if ( elem.nodeType === 9 ) {
  8833. win = elem.defaultView;
  8834. }
  8835. if ( val === undefined ) {
  8836. return win ? win[ prop ] : elem[ method ];
  8837. }
  8838. if ( win ) {
  8839. win.scrollTo(
  8840. !top ? val : win.pageXOffset,
  8841. top ? val : win.pageYOffset
  8842. );
  8843. } else {
  8844. elem[ method ] = val;
  8845. }
  8846. }, method, val, arguments.length );
  8847. };
  8848. } );
  8849. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8850. // Add the top/left cssHooks using jQuery.fn.position
  8851. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8852. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8853. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8854. // rather than make the css module depend on the offset module, just check for it here
  8855. jQuery.each( [ "top", "left" ], function( i, prop ) {
  8856. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8857. function( elem, computed ) {
  8858. if ( computed ) {
  8859. computed = curCSS( elem, prop );
  8860. // If curCSS returns percentage, fallback to offset
  8861. return rnumnonpx.test( computed ) ?
  8862. jQuery( elem ).position()[ prop ] + "px" :
  8863. computed;
  8864. }
  8865. }
  8866. );
  8867. } );
  8868. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8869. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8870. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  8871. function( defaultExtra, funcName ) {
  8872. // Margin is only for outerHeight, outerWidth
  8873. jQuery.fn[ funcName ] = function( margin, value ) {
  8874. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8875. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8876. return access( this, function( elem, type, value ) {
  8877. var doc;
  8878. if ( jQuery.isWindow( elem ) ) {
  8879. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8880. return funcName.indexOf( "outer" ) === 0 ?
  8881. elem[ "inner" + name ] :
  8882. elem.document.documentElement[ "client" + name ];
  8883. }
  8884. // Get document width or height
  8885. if ( elem.nodeType === 9 ) {
  8886. doc = elem.documentElement;
  8887. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8888. // whichever is greatest
  8889. return Math.max(
  8890. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8891. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8892. doc[ "client" + name ]
  8893. );
  8894. }
  8895. return value === undefined ?
  8896. // Get width or height on the element, requesting but not forcing parseFloat
  8897. jQuery.css( elem, type, extra ) :
  8898. // Set width or height on the element
  8899. jQuery.style( elem, type, value, extra );
  8900. }, type, chainable ? margin : undefined, chainable );
  8901. };
  8902. } );
  8903. } );
  8904. jQuery.fn.extend( {
  8905. bind: function( types, data, fn ) {
  8906. return this.on( types, null, data, fn );
  8907. },
  8908. unbind: function( types, fn ) {
  8909. return this.off( types, null, fn );
  8910. },
  8911. delegate: function( selector, types, data, fn ) {
  8912. return this.on( types, selector, data, fn );
  8913. },
  8914. undelegate: function( selector, types, fn ) {
  8915. // ( namespace ) or ( selector, types [, fn] )
  8916. return arguments.length === 1 ?
  8917. this.off( selector, "**" ) :
  8918. this.off( types, selector || "**", fn );
  8919. }
  8920. } );
  8921. jQuery.holdReady = function( hold ) {
  8922. if ( hold ) {
  8923. jQuery.readyWait++;
  8924. } else {
  8925. jQuery.ready( true );
  8926. }
  8927. };
  8928. jQuery.isArray = Array.isArray;
  8929. jQuery.parseJSON = JSON.parse;
  8930. jQuery.nodeName = nodeName;
  8931. // Register as a named AMD module, since jQuery can be concatenated with other
  8932. // files that may use define, but not via a proper concatenation script that
  8933. // understands anonymous AMD modules. A named AMD is safest and most robust
  8934. // way to register. Lowercase jquery is used because AMD module names are
  8935. // derived from file names, and jQuery is normally delivered in a lowercase
  8936. // file name. Do this after creating the global so that if an AMD module wants
  8937. // to call noConflict to hide this version of jQuery, it will work.
  8938. // Note that for maximum portability, libraries that are not jQuery should
  8939. // declare themselves as anonymous modules, and avoid setting a global if an
  8940. // AMD loader is present. jQuery is a special case. For more information, see
  8941. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8942. if ( typeof define === "function" && define.amd ) {
  8943. define( "jquery", [], function() {
  8944. return jQuery;
  8945. } );
  8946. }
  8947. var
  8948. // Map over jQuery in case of overwrite
  8949. _jQuery = window.jQuery,
  8950. // Map over the $ in case of overwrite
  8951. _$ = window.$;
  8952. jQuery.noConflict = function( deep ) {
  8953. if ( window.$ === jQuery ) {
  8954. window.$ = _$;
  8955. }
  8956. if ( deep && window.jQuery === jQuery ) {
  8957. window.jQuery = _jQuery;
  8958. }
  8959. return jQuery;
  8960. };
  8961. // Expose jQuery and $ identifiers, even in AMD
  8962. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8963. // and CommonJS for browser emulators (#13566)
  8964. if ( !noGlobal ) {
  8965. window.jQuery = window.$ = jQuery;
  8966. }
  8967. return jQuery;
  8968. } );
  8969. });
  8970. return ___scope___.entry = "dist/jquery.js";
  8971. });
  8972. FuseBox.pkg("lodash", {}, function(___scope___){
  8973. ___scope___.file("lodash.js", function(exports, require, module, __filename, __dirname){
  8974. /**
  8975. * @license
  8976. * Lodash <https://lodash.com/>
  8977. * Copyright JS Foundation and other contributors <https://js.foundation/>
  8978. * Released under MIT license <https://lodash.com/license>
  8979. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  8980. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8981. */
  8982. ;(function() {
  8983. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  8984. var undefined;
  8985. /** Used as the semantic version number. */
  8986. var VERSION = '4.17.4';
  8987. /** Used as the size to enable large array optimizations. */
  8988. var LARGE_ARRAY_SIZE = 200;
  8989. /** Error message constants. */
  8990. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  8991. FUNC_ERROR_TEXT = 'Expected a function';
  8992. /** Used to stand-in for `undefined` hash values. */
  8993. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  8994. /** Used as the maximum memoize cache size. */
  8995. var MAX_MEMOIZE_SIZE = 500;
  8996. /** Used as the internal argument placeholder. */
  8997. var PLACEHOLDER = '__lodash_placeholder__';
  8998. /** Used to compose bitmasks for cloning. */
  8999. var CLONE_DEEP_FLAG = 1,
  9000. CLONE_FLAT_FLAG = 2,
  9001. CLONE_SYMBOLS_FLAG = 4;
  9002. /** Used to compose bitmasks for value comparisons. */
  9003. var COMPARE_PARTIAL_FLAG = 1,
  9004. COMPARE_UNORDERED_FLAG = 2;
  9005. /** Used to compose bitmasks for function metadata. */
  9006. var WRAP_BIND_FLAG = 1,
  9007. WRAP_BIND_KEY_FLAG = 2,
  9008. WRAP_CURRY_BOUND_FLAG = 4,
  9009. WRAP_CURRY_FLAG = 8,
  9010. WRAP_CURRY_RIGHT_FLAG = 16,
  9011. WRAP_PARTIAL_FLAG = 32,
  9012. WRAP_PARTIAL_RIGHT_FLAG = 64,
  9013. WRAP_ARY_FLAG = 128,
  9014. WRAP_REARG_FLAG = 256,
  9015. WRAP_FLIP_FLAG = 512;
  9016. /** Used as default options for `_.truncate`. */
  9017. var DEFAULT_TRUNC_LENGTH = 30,
  9018. DEFAULT_TRUNC_OMISSION = '...';
  9019. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  9020. var HOT_COUNT = 800,
  9021. HOT_SPAN = 16;
  9022. /** Used to indicate the type of lazy iteratees. */
  9023. var LAZY_FILTER_FLAG = 1,
  9024. LAZY_MAP_FLAG = 2,
  9025. LAZY_WHILE_FLAG = 3;
  9026. /** Used as references for various `Number` constants. */
  9027. var INFINITY = 1 / 0,
  9028. MAX_SAFE_INTEGER = 9007199254740991,
  9029. MAX_INTEGER = 1.7976931348623157e+308,
  9030. NAN = 0 / 0;
  9031. /** Used as references for the maximum length and index of an array. */
  9032. var MAX_ARRAY_LENGTH = 4294967295,
  9033. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  9034. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  9035. /** Used to associate wrap methods with their bit flags. */
  9036. var wrapFlags = [
  9037. ['ary', WRAP_ARY_FLAG],
  9038. ['bind', WRAP_BIND_FLAG],
  9039. ['bindKey', WRAP_BIND_KEY_FLAG],
  9040. ['curry', WRAP_CURRY_FLAG],
  9041. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  9042. ['flip', WRAP_FLIP_FLAG],
  9043. ['partial', WRAP_PARTIAL_FLAG],
  9044. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  9045. ['rearg', WRAP_REARG_FLAG]
  9046. ];
  9047. /** `Object#toString` result references. */
  9048. var argsTag = '[object Arguments]',
  9049. arrayTag = '[object Array]',
  9050. asyncTag = '[object AsyncFunction]',
  9051. boolTag = '[object Boolean]',
  9052. dateTag = '[object Date]',
  9053. domExcTag = '[object DOMException]',
  9054. errorTag = '[object Error]',
  9055. funcTag = '[object Function]',
  9056. genTag = '[object GeneratorFunction]',
  9057. mapTag = '[object Map]',
  9058. numberTag = '[object Number]',
  9059. nullTag = '[object Null]',
  9060. objectTag = '[object Object]',
  9061. promiseTag = '[object Promise]',
  9062. proxyTag = '[object Proxy]',
  9063. regexpTag = '[object RegExp]',
  9064. setTag = '[object Set]',
  9065. stringTag = '[object String]',
  9066. symbolTag = '[object Symbol]',
  9067. undefinedTag = '[object Undefined]',
  9068. weakMapTag = '[object WeakMap]',
  9069. weakSetTag = '[object WeakSet]';
  9070. var arrayBufferTag = '[object ArrayBuffer]',
  9071. dataViewTag = '[object DataView]',
  9072. float32Tag = '[object Float32Array]',
  9073. float64Tag = '[object Float64Array]',
  9074. int8Tag = '[object Int8Array]',
  9075. int16Tag = '[object Int16Array]',
  9076. int32Tag = '[object Int32Array]',
  9077. uint8Tag = '[object Uint8Array]',
  9078. uint8ClampedTag = '[object Uint8ClampedArray]',
  9079. uint16Tag = '[object Uint16Array]',
  9080. uint32Tag = '[object Uint32Array]';
  9081. /** Used to match empty string literals in compiled template source. */
  9082. var reEmptyStringLeading = /\b__p \+= '';/g,
  9083. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  9084. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  9085. /** Used to match HTML entities and HTML characters. */
  9086. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  9087. reUnescapedHtml = /[&<>"']/g,
  9088. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  9089. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  9090. /** Used to match template delimiters. */
  9091. var reEscape = /<%-([\s\S]+?)%>/g,
  9092. reEvaluate = /<%([\s\S]+?)%>/g,
  9093. reInterpolate = /<%=([\s\S]+?)%>/g;
  9094. /** Used to match property names within property paths. */
  9095. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  9096. reIsPlainProp = /^\w*$/,
  9097. reLeadingDot = /^\./,
  9098. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  9099. /**
  9100. * Used to match `RegExp`
  9101. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  9102. */
  9103. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  9104. reHasRegExpChar = RegExp(reRegExpChar.source);
  9105. /** Used to match leading and trailing whitespace. */
  9106. var reTrim = /^\s+|\s+$/g,
  9107. reTrimStart = /^\s+/,
  9108. reTrimEnd = /\s+$/;
  9109. /** Used to match wrap detail comments. */
  9110. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  9111. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  9112. reSplitDetails = /,? & /;
  9113. /** Used to match words composed of alphanumeric characters. */
  9114. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  9115. /** Used to match backslashes in property paths. */
  9116. var reEscapeChar = /\\(\\)?/g;
  9117. /**
  9118. * Used to match
  9119. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  9120. */
  9121. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  9122. /** Used to match `RegExp` flags from their coerced string values. */
  9123. var reFlags = /\w*$/;
  9124. /** Used to detect bad signed hexadecimal string values. */
  9125. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  9126. /** Used to detect binary string values. */
  9127. var reIsBinary = /^0b[01]+$/i;
  9128. /** Used to detect host constructors (Safari). */
  9129. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  9130. /** Used to detect octal string values. */
  9131. var reIsOctal = /^0o[0-7]+$/i;
  9132. /** Used to detect unsigned integer values. */
  9133. var reIsUint = /^(?:0|[1-9]\d*)$/;
  9134. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  9135. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  9136. /** Used to ensure capturing order of template delimiters. */
  9137. var reNoMatch = /($^)/;
  9138. /** Used to match unescaped characters in compiled string literals. */
  9139. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  9140. /** Used to compose unicode character classes. */
  9141. var rsAstralRange = '\\ud800-\\udfff',
  9142. rsComboMarksRange = '\\u0300-\\u036f',
  9143. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  9144. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  9145. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  9146. rsDingbatRange = '\\u2700-\\u27bf',
  9147. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  9148. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  9149. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  9150. rsPunctuationRange = '\\u2000-\\u206f',
  9151. rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
  9152. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  9153. rsVarRange = '\\ufe0e\\ufe0f',
  9154. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  9155. /** Used to compose unicode capture groups. */
  9156. var rsApos = "['\u2019]",
  9157. rsAstral = '[' + rsAstralRange + ']',
  9158. rsBreak = '[' + rsBreakRange + ']',
  9159. rsCombo = '[' + rsComboRange + ']',
  9160. rsDigits = '\\d+',
  9161. rsDingbat = '[' + rsDingbatRange + ']',
  9162. rsLower = '[' + rsLowerRange + ']',
  9163. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  9164. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  9165. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  9166. rsNonAstral = '[^' + rsAstralRange + ']',
  9167. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  9168. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  9169. rsUpper = '[' + rsUpperRange + ']',
  9170. rsZWJ = '\\u200d';
  9171. /** Used to compose unicode regexes. */
  9172. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  9173. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  9174. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  9175. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  9176. reOptMod = rsModifier + '?',
  9177. rsOptVar = '[' + rsVarRange + ']?',
  9178. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  9179. rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
  9180. rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
  9181. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  9182. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  9183. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  9184. /** Used to match apostrophes. */
  9185. var reApos = RegExp(rsApos, 'g');
  9186. /**
  9187. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  9188. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  9189. */
  9190. var reComboMark = RegExp(rsCombo, 'g');
  9191. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  9192. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  9193. /** Used to match complex or compound words. */
  9194. var reUnicodeWord = RegExp([
  9195. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  9196. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  9197. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  9198. rsUpper + '+' + rsOptContrUpper,
  9199. rsOrdUpper,
  9200. rsOrdLower,
  9201. rsDigits,
  9202. rsEmoji
  9203. ].join('|'), 'g');
  9204. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  9205. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  9206. /** Used to detect strings that need a more robust regexp to match words. */
  9207. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  9208. /** Used to assign default `context` object properties. */
  9209. var contextProps = [
  9210. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  9211. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  9212. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  9213. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  9214. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  9215. ];
  9216. /** Used to make template sourceURLs easier to identify. */
  9217. var templateCounter = -1;
  9218. /** Used to identify `toStringTag` values of typed arrays. */
  9219. var typedArrayTags = {};
  9220. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  9221. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  9222. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  9223. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  9224. typedArrayTags[uint32Tag] = true;
  9225. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  9226. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  9227. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  9228. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  9229. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  9230. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  9231. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  9232. typedArrayTags[weakMapTag] = false;
  9233. /** Used to identify `toStringTag` values supported by `_.clone`. */
  9234. var cloneableTags = {};
  9235. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  9236. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  9237. cloneableTags[boolTag] = cloneableTags[dateTag] =
  9238. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  9239. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  9240. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  9241. cloneableTags[numberTag] = cloneableTags[objectTag] =
  9242. cloneableTags[regexpTag] = cloneableTags[setTag] =
  9243. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  9244. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  9245. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  9246. cloneableTags[errorTag] = cloneableTags[funcTag] =
  9247. cloneableTags[weakMapTag] = false;
  9248. /** Used to map Latin Unicode letters to basic Latin letters. */
  9249. var deburredLetters = {
  9250. // Latin-1 Supplement block.
  9251. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  9252. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  9253. '\xc7': 'C', '\xe7': 'c',
  9254. '\xd0': 'D', '\xf0': 'd',
  9255. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  9256. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  9257. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  9258. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  9259. '\xd1': 'N', '\xf1': 'n',
  9260. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  9261. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  9262. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  9263. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  9264. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  9265. '\xc6': 'Ae', '\xe6': 'ae',
  9266. '\xde': 'Th', '\xfe': 'th',
  9267. '\xdf': 'ss',
  9268. // Latin Extended-A block.
  9269. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  9270. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  9271. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  9272. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  9273. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  9274. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  9275. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  9276. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  9277. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  9278. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  9279. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  9280. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  9281. '\u0134': 'J', '\u0135': 'j',
  9282. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  9283. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  9284. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  9285. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  9286. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  9287. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  9288. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  9289. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  9290. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  9291. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  9292. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  9293. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  9294. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  9295. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  9296. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  9297. '\u0174': 'W', '\u0175': 'w',
  9298. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  9299. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  9300. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  9301. '\u0132': 'IJ', '\u0133': 'ij',
  9302. '\u0152': 'Oe', '\u0153': 'oe',
  9303. '\u0149': "'n", '\u017f': 's'
  9304. };
  9305. /** Used to map characters to HTML entities. */
  9306. var htmlEscapes = {
  9307. '&': '&amp;',
  9308. '<': '&lt;',
  9309. '>': '&gt;',
  9310. '"': '&quot;',
  9311. "'": '&#39;'
  9312. };
  9313. /** Used to map HTML entities to characters. */
  9314. var htmlUnescapes = {
  9315. '&amp;': '&',
  9316. '&lt;': '<',
  9317. '&gt;': '>',
  9318. '&quot;': '"',
  9319. '&#39;': "'"
  9320. };
  9321. /** Used to escape characters for inclusion in compiled string literals. */
  9322. var stringEscapes = {
  9323. '\\': '\\',
  9324. "'": "'",
  9325. '\n': 'n',
  9326. '\r': 'r',
  9327. '\u2028': 'u2028',
  9328. '\u2029': 'u2029'
  9329. };
  9330. /** Built-in method references without a dependency on `root`. */
  9331. var freeParseFloat = parseFloat,
  9332. freeParseInt = parseInt;
  9333. /** Detect free variable `global` from Node.js. */
  9334. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  9335. /** Detect free variable `self`. */
  9336. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  9337. /** Used as a reference to the global object. */
  9338. var root = freeGlobal || freeSelf || Function('return this')();
  9339. /** Detect free variable `exports`. */
  9340. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  9341. /** Detect free variable `module`. */
  9342. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  9343. /** Detect the popular CommonJS extension `module.exports`. */
  9344. var moduleExports = freeModule && freeModule.exports === freeExports;
  9345. /** Detect free variable `process` from Node.js. */
  9346. var freeProcess = moduleExports && freeGlobal.process;
  9347. /** Used to access faster Node.js helpers. */
  9348. var nodeUtil = (function() {
  9349. try {
  9350. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  9351. } catch (e) {}
  9352. }());
  9353. /* Node.js helper references. */
  9354. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  9355. nodeIsDate = nodeUtil && nodeUtil.isDate,
  9356. nodeIsMap = nodeUtil && nodeUtil.isMap,
  9357. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  9358. nodeIsSet = nodeUtil && nodeUtil.isSet,
  9359. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  9360. /*--------------------------------------------------------------------------*/
  9361. /**
  9362. * Adds the key-value `pair` to `map`.
  9363. *
  9364. * @private
  9365. * @param {Object} map The map to modify.
  9366. * @param {Array} pair The key-value pair to add.
  9367. * @returns {Object} Returns `map`.
  9368. */
  9369. function addMapEntry(map, pair) {
  9370. // Don't return `map.set` because it's not chainable in IE 11.
  9371. map.set(pair[0], pair[1]);
  9372. return map;
  9373. }
  9374. /**
  9375. * Adds `value` to `set`.
  9376. *
  9377. * @private
  9378. * @param {Object} set The set to modify.
  9379. * @param {*} value The value to add.
  9380. * @returns {Object} Returns `set`.
  9381. */
  9382. function addSetEntry(set, value) {
  9383. // Don't return `set.add` because it's not chainable in IE 11.
  9384. set.add(value);
  9385. return set;
  9386. }
  9387. /**
  9388. * A faster alternative to `Function#apply`, this function invokes `func`
  9389. * with the `this` binding of `thisArg` and the arguments of `args`.
  9390. *
  9391. * @private
  9392. * @param {Function} func The function to invoke.
  9393. * @param {*} thisArg The `this` binding of `func`.
  9394. * @param {Array} args The arguments to invoke `func` with.
  9395. * @returns {*} Returns the result of `func`.
  9396. */
  9397. function apply(func, thisArg, args) {
  9398. switch (args.length) {
  9399. case 0: return func.call(thisArg);
  9400. case 1: return func.call(thisArg, args[0]);
  9401. case 2: return func.call(thisArg, args[0], args[1]);
  9402. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  9403. }
  9404. return func.apply(thisArg, args);
  9405. }
  9406. /**
  9407. * A specialized version of `baseAggregator` for arrays.
  9408. *
  9409. * @private
  9410. * @param {Array} [array] The array to iterate over.
  9411. * @param {Function} setter The function to set `accumulator` values.
  9412. * @param {Function} iteratee The iteratee to transform keys.
  9413. * @param {Object} accumulator The initial aggregated object.
  9414. * @returns {Function} Returns `accumulator`.
  9415. */
  9416. function arrayAggregator(array, setter, iteratee, accumulator) {
  9417. var index = -1,
  9418. length = array == null ? 0 : array.length;
  9419. while (++index < length) {
  9420. var value = array[index];
  9421. setter(accumulator, value, iteratee(value), array);
  9422. }
  9423. return accumulator;
  9424. }
  9425. /**
  9426. * A specialized version of `_.forEach` for arrays without support for
  9427. * iteratee shorthands.
  9428. *
  9429. * @private
  9430. * @param {Array} [array] The array to iterate over.
  9431. * @param {Function} iteratee The function invoked per iteration.
  9432. * @returns {Array} Returns `array`.
  9433. */
  9434. function arrayEach(array, iteratee) {
  9435. var index = -1,
  9436. length = array == null ? 0 : array.length;
  9437. while (++index < length) {
  9438. if (iteratee(array[index], index, array) === false) {
  9439. break;
  9440. }
  9441. }
  9442. return array;
  9443. }
  9444. /**
  9445. * A specialized version of `_.forEachRight` for arrays without support for
  9446. * iteratee shorthands.
  9447. *
  9448. * @private
  9449. * @param {Array} [array] The array to iterate over.
  9450. * @param {Function} iteratee The function invoked per iteration.
  9451. * @returns {Array} Returns `array`.
  9452. */
  9453. function arrayEachRight(array, iteratee) {
  9454. var length = array == null ? 0 : array.length;
  9455. while (length--) {
  9456. if (iteratee(array[length], length, array) === false) {
  9457. break;
  9458. }
  9459. }
  9460. return array;
  9461. }
  9462. /**
  9463. * A specialized version of `_.every` for arrays without support for
  9464. * iteratee shorthands.
  9465. *
  9466. * @private
  9467. * @param {Array} [array] The array to iterate over.
  9468. * @param {Function} predicate The function invoked per iteration.
  9469. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9470. * else `false`.
  9471. */
  9472. function arrayEvery(array, predicate) {
  9473. var index = -1,
  9474. length = array == null ? 0 : array.length;
  9475. while (++index < length) {
  9476. if (!predicate(array[index], index, array)) {
  9477. return false;
  9478. }
  9479. }
  9480. return true;
  9481. }
  9482. /**
  9483. * A specialized version of `_.filter` for arrays without support for
  9484. * iteratee shorthands.
  9485. *
  9486. * @private
  9487. * @param {Array} [array] The array to iterate over.
  9488. * @param {Function} predicate The function invoked per iteration.
  9489. * @returns {Array} Returns the new filtered array.
  9490. */
  9491. function arrayFilter(array, predicate) {
  9492. var index = -1,
  9493. length = array == null ? 0 : array.length,
  9494. resIndex = 0,
  9495. result = [];
  9496. while (++index < length) {
  9497. var value = array[index];
  9498. if (predicate(value, index, array)) {
  9499. result[resIndex++] = value;
  9500. }
  9501. }
  9502. return result;
  9503. }
  9504. /**
  9505. * A specialized version of `_.includes` for arrays without support for
  9506. * specifying an index to search from.
  9507. *
  9508. * @private
  9509. * @param {Array} [array] The array to inspect.
  9510. * @param {*} target The value to search for.
  9511. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  9512. */
  9513. function arrayIncludes(array, value) {
  9514. var length = array == null ? 0 : array.length;
  9515. return !!length && baseIndexOf(array, value, 0) > -1;
  9516. }
  9517. /**
  9518. * This function is like `arrayIncludes` except that it accepts a comparator.
  9519. *
  9520. * @private
  9521. * @param {Array} [array] The array to inspect.
  9522. * @param {*} target The value to search for.
  9523. * @param {Function} comparator The comparator invoked per element.
  9524. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  9525. */
  9526. function arrayIncludesWith(array, value, comparator) {
  9527. var index = -1,
  9528. length = array == null ? 0 : array.length;
  9529. while (++index < length) {
  9530. if (comparator(value, array[index])) {
  9531. return true;
  9532. }
  9533. }
  9534. return false;
  9535. }
  9536. /**
  9537. * A specialized version of `_.map` for arrays without support for iteratee
  9538. * shorthands.
  9539. *
  9540. * @private
  9541. * @param {Array} [array] The array to iterate over.
  9542. * @param {Function} iteratee The function invoked per iteration.
  9543. * @returns {Array} Returns the new mapped array.
  9544. */
  9545. function arrayMap(array, iteratee) {
  9546. var index = -1,
  9547. length = array == null ? 0 : array.length,
  9548. result = Array(length);
  9549. while (++index < length) {
  9550. result[index] = iteratee(array[index], index, array);
  9551. }
  9552. return result;
  9553. }
  9554. /**
  9555. * Appends the elements of `values` to `array`.
  9556. *
  9557. * @private
  9558. * @param {Array} array The array to modify.
  9559. * @param {Array} values The values to append.
  9560. * @returns {Array} Returns `array`.
  9561. */
  9562. function arrayPush(array, values) {
  9563. var index = -1,
  9564. length = values.length,
  9565. offset = array.length;
  9566. while (++index < length) {
  9567. array[offset + index] = values[index];
  9568. }
  9569. return array;
  9570. }
  9571. /**
  9572. * A specialized version of `_.reduce` for arrays without support for
  9573. * iteratee shorthands.
  9574. *
  9575. * @private
  9576. * @param {Array} [array] The array to iterate over.
  9577. * @param {Function} iteratee The function invoked per iteration.
  9578. * @param {*} [accumulator] The initial value.
  9579. * @param {boolean} [initAccum] Specify using the first element of `array` as
  9580. * the initial value.
  9581. * @returns {*} Returns the accumulated value.
  9582. */
  9583. function arrayReduce(array, iteratee, accumulator, initAccum) {
  9584. var index = -1,
  9585. length = array == null ? 0 : array.length;
  9586. if (initAccum && length) {
  9587. accumulator = array[++index];
  9588. }
  9589. while (++index < length) {
  9590. accumulator = iteratee(accumulator, array[index], index, array);
  9591. }
  9592. return accumulator;
  9593. }
  9594. /**
  9595. * A specialized version of `_.reduceRight` for arrays without support for
  9596. * iteratee shorthands.
  9597. *
  9598. * @private
  9599. * @param {Array} [array] The array to iterate over.
  9600. * @param {Function} iteratee The function invoked per iteration.
  9601. * @param {*} [accumulator] The initial value.
  9602. * @param {boolean} [initAccum] Specify using the last element of `array` as
  9603. * the initial value.
  9604. * @returns {*} Returns the accumulated value.
  9605. */
  9606. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  9607. var length = array == null ? 0 : array.length;
  9608. if (initAccum && length) {
  9609. accumulator = array[--length];
  9610. }
  9611. while (length--) {
  9612. accumulator = iteratee(accumulator, array[length], length, array);
  9613. }
  9614. return accumulator;
  9615. }
  9616. /**
  9617. * A specialized version of `_.some` for arrays without support for iteratee
  9618. * shorthands.
  9619. *
  9620. * @private
  9621. * @param {Array} [array] The array to iterate over.
  9622. * @param {Function} predicate The function invoked per iteration.
  9623. * @returns {boolean} Returns `true` if any element passes the predicate check,
  9624. * else `false`.
  9625. */
  9626. function arraySome(array, predicate) {
  9627. var index = -1,
  9628. length = array == null ? 0 : array.length;
  9629. while (++index < length) {
  9630. if (predicate(array[index], index, array)) {
  9631. return true;
  9632. }
  9633. }
  9634. return false;
  9635. }
  9636. /**
  9637. * Gets the size of an ASCII `string`.
  9638. *
  9639. * @private
  9640. * @param {string} string The string inspect.
  9641. * @returns {number} Returns the string size.
  9642. */
  9643. var asciiSize = baseProperty('length');
  9644. /**
  9645. * Converts an ASCII `string` to an array.
  9646. *
  9647. * @private
  9648. * @param {string} string The string to convert.
  9649. * @returns {Array} Returns the converted array.
  9650. */
  9651. function asciiToArray(string) {
  9652. return string.split('');
  9653. }
  9654. /**
  9655. * Splits an ASCII `string` into an array of its words.
  9656. *
  9657. * @private
  9658. * @param {string} The string to inspect.
  9659. * @returns {Array} Returns the words of `string`.
  9660. */
  9661. function asciiWords(string) {
  9662. return string.match(reAsciiWord) || [];
  9663. }
  9664. /**
  9665. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  9666. * without support for iteratee shorthands, which iterates over `collection`
  9667. * using `eachFunc`.
  9668. *
  9669. * @private
  9670. * @param {Array|Object} collection The collection to inspect.
  9671. * @param {Function} predicate The function invoked per iteration.
  9672. * @param {Function} eachFunc The function to iterate over `collection`.
  9673. * @returns {*} Returns the found element or its key, else `undefined`.
  9674. */
  9675. function baseFindKey(collection, predicate, eachFunc) {
  9676. var result;
  9677. eachFunc(collection, function(value, key, collection) {
  9678. if (predicate(value, key, collection)) {
  9679. result = key;
  9680. return false;
  9681. }
  9682. });
  9683. return result;
  9684. }
  9685. /**
  9686. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  9687. * support for iteratee shorthands.
  9688. *
  9689. * @private
  9690. * @param {Array} array The array to inspect.
  9691. * @param {Function} predicate The function invoked per iteration.
  9692. * @param {number} fromIndex The index to search from.
  9693. * @param {boolean} [fromRight] Specify iterating from right to left.
  9694. * @returns {number} Returns the index of the matched value, else `-1`.
  9695. */
  9696. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  9697. var length = array.length,
  9698. index = fromIndex + (fromRight ? 1 : -1);
  9699. while ((fromRight ? index-- : ++index < length)) {
  9700. if (predicate(array[index], index, array)) {
  9701. return index;
  9702. }
  9703. }
  9704. return -1;
  9705. }
  9706. /**
  9707. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  9708. *
  9709. * @private
  9710. * @param {Array} array The array to inspect.
  9711. * @param {*} value The value to search for.
  9712. * @param {number} fromIndex The index to search from.
  9713. * @returns {number} Returns the index of the matched value, else `-1`.
  9714. */
  9715. function baseIndexOf(array, value, fromIndex) {
  9716. return value === value
  9717. ? strictIndexOf(array, value, fromIndex)
  9718. : baseFindIndex(array, baseIsNaN, fromIndex);
  9719. }
  9720. /**
  9721. * This function is like `baseIndexOf` except that it accepts a comparator.
  9722. *
  9723. * @private
  9724. * @param {Array} array The array to inspect.
  9725. * @param {*} value The value to search for.
  9726. * @param {number} fromIndex The index to search from.
  9727. * @param {Function} comparator The comparator invoked per element.
  9728. * @returns {number} Returns the index of the matched value, else `-1`.
  9729. */
  9730. function baseIndexOfWith(array, value, fromIndex, comparator) {
  9731. var index = fromIndex - 1,
  9732. length = array.length;
  9733. while (++index < length) {
  9734. if (comparator(array[index], value)) {
  9735. return index;
  9736. }
  9737. }
  9738. return -1;
  9739. }
  9740. /**
  9741. * The base implementation of `_.isNaN` without support for number objects.
  9742. *
  9743. * @private
  9744. * @param {*} value The value to check.
  9745. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  9746. */
  9747. function baseIsNaN(value) {
  9748. return value !== value;
  9749. }
  9750. /**
  9751. * The base implementation of `_.mean` and `_.meanBy` without support for
  9752. * iteratee shorthands.
  9753. *
  9754. * @private
  9755. * @param {Array} array The array to iterate over.
  9756. * @param {Function} iteratee The function invoked per iteration.
  9757. * @returns {number} Returns the mean.
  9758. */
  9759. function baseMean(array, iteratee) {
  9760. var length = array == null ? 0 : array.length;
  9761. return length ? (baseSum(array, iteratee) / length) : NAN;
  9762. }
  9763. /**
  9764. * The base implementation of `_.property` without support for deep paths.
  9765. *
  9766. * @private
  9767. * @param {string} key The key of the property to get.
  9768. * @returns {Function} Returns the new accessor function.
  9769. */
  9770. function baseProperty(key) {
  9771. return function(object) {
  9772. return object == null ? undefined : object[key];
  9773. };
  9774. }
  9775. /**
  9776. * The base implementation of `_.propertyOf` without support for deep paths.
  9777. *
  9778. * @private
  9779. * @param {Object} object The object to query.
  9780. * @returns {Function} Returns the new accessor function.
  9781. */
  9782. function basePropertyOf(object) {
  9783. return function(key) {
  9784. return object == null ? undefined : object[key];
  9785. };
  9786. }
  9787. /**
  9788. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  9789. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  9790. *
  9791. * @private
  9792. * @param {Array|Object} collection The collection to iterate over.
  9793. * @param {Function} iteratee The function invoked per iteration.
  9794. * @param {*} accumulator The initial value.
  9795. * @param {boolean} initAccum Specify using the first or last element of
  9796. * `collection` as the initial value.
  9797. * @param {Function} eachFunc The function to iterate over `collection`.
  9798. * @returns {*} Returns the accumulated value.
  9799. */
  9800. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  9801. eachFunc(collection, function(value, index, collection) {
  9802. accumulator = initAccum
  9803. ? (initAccum = false, value)
  9804. : iteratee(accumulator, value, index, collection);
  9805. });
  9806. return accumulator;
  9807. }
  9808. /**
  9809. * The base implementation of `_.sortBy` which uses `comparer` to define the
  9810. * sort order of `array` and replaces criteria objects with their corresponding
  9811. * values.
  9812. *
  9813. * @private
  9814. * @param {Array} array The array to sort.
  9815. * @param {Function} comparer The function to define sort order.
  9816. * @returns {Array} Returns `array`.
  9817. */
  9818. function baseSortBy(array, comparer) {
  9819. var length = array.length;
  9820. array.sort(comparer);
  9821. while (length--) {
  9822. array[length] = array[length].value;
  9823. }
  9824. return array;
  9825. }
  9826. /**
  9827. * The base implementation of `_.sum` and `_.sumBy` without support for
  9828. * iteratee shorthands.
  9829. *
  9830. * @private
  9831. * @param {Array} array The array to iterate over.
  9832. * @param {Function} iteratee The function invoked per iteration.
  9833. * @returns {number} Returns the sum.
  9834. */
  9835. function baseSum(array, iteratee) {
  9836. var result,
  9837. index = -1,
  9838. length = array.length;
  9839. while (++index < length) {
  9840. var current = iteratee(array[index]);
  9841. if (current !== undefined) {
  9842. result = result === undefined ? current : (result + current);
  9843. }
  9844. }
  9845. return result;
  9846. }
  9847. /**
  9848. * The base implementation of `_.times` without support for iteratee shorthands
  9849. * or max array length checks.
  9850. *
  9851. * @private
  9852. * @param {number} n The number of times to invoke `iteratee`.
  9853. * @param {Function} iteratee The function invoked per iteration.
  9854. * @returns {Array} Returns the array of results.
  9855. */
  9856. function baseTimes(n, iteratee) {
  9857. var index = -1,
  9858. result = Array(n);
  9859. while (++index < n) {
  9860. result[index] = iteratee(index);
  9861. }
  9862. return result;
  9863. }
  9864. /**
  9865. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  9866. * of key-value pairs for `object` corresponding to the property names of `props`.
  9867. *
  9868. * @private
  9869. * @param {Object} object The object to query.
  9870. * @param {Array} props The property names to get values for.
  9871. * @returns {Object} Returns the key-value pairs.
  9872. */
  9873. function baseToPairs(object, props) {
  9874. return arrayMap(props, function(key) {
  9875. return [key, object[key]];
  9876. });
  9877. }
  9878. /**
  9879. * The base implementation of `_.unary` without support for storing metadata.
  9880. *
  9881. * @private
  9882. * @param {Function} func The function to cap arguments for.
  9883. * @returns {Function} Returns the new capped function.
  9884. */
  9885. function baseUnary(func) {
  9886. return function(value) {
  9887. return func(value);
  9888. };
  9889. }
  9890. /**
  9891. * The base implementation of `_.values` and `_.valuesIn` which creates an
  9892. * array of `object` property values corresponding to the property names
  9893. * of `props`.
  9894. *
  9895. * @private
  9896. * @param {Object} object The object to query.
  9897. * @param {Array} props The property names to get values for.
  9898. * @returns {Object} Returns the array of property values.
  9899. */
  9900. function baseValues(object, props) {
  9901. return arrayMap(props, function(key) {
  9902. return object[key];
  9903. });
  9904. }
  9905. /**
  9906. * Checks if a `cache` value for `key` exists.
  9907. *
  9908. * @private
  9909. * @param {Object} cache The cache to query.
  9910. * @param {string} key The key of the entry to check.
  9911. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  9912. */
  9913. function cacheHas(cache, key) {
  9914. return cache.has(key);
  9915. }
  9916. /**
  9917. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  9918. * that is not found in the character symbols.
  9919. *
  9920. * @private
  9921. * @param {Array} strSymbols The string symbols to inspect.
  9922. * @param {Array} chrSymbols The character symbols to find.
  9923. * @returns {number} Returns the index of the first unmatched string symbol.
  9924. */
  9925. function charsStartIndex(strSymbols, chrSymbols) {
  9926. var index = -1,
  9927. length = strSymbols.length;
  9928. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  9929. return index;
  9930. }
  9931. /**
  9932. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  9933. * that is not found in the character symbols.
  9934. *
  9935. * @private
  9936. * @param {Array} strSymbols The string symbols to inspect.
  9937. * @param {Array} chrSymbols The character symbols to find.
  9938. * @returns {number} Returns the index of the last unmatched string symbol.
  9939. */
  9940. function charsEndIndex(strSymbols, chrSymbols) {
  9941. var index = strSymbols.length;
  9942. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  9943. return index;
  9944. }
  9945. /**
  9946. * Gets the number of `placeholder` occurrences in `array`.
  9947. *
  9948. * @private
  9949. * @param {Array} array The array to inspect.
  9950. * @param {*} placeholder The placeholder to search for.
  9951. * @returns {number} Returns the placeholder count.
  9952. */
  9953. function countHolders(array, placeholder) {
  9954. var length = array.length,
  9955. result = 0;
  9956. while (length--) {
  9957. if (array[length] === placeholder) {
  9958. ++result;
  9959. }
  9960. }
  9961. return result;
  9962. }
  9963. /**
  9964. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  9965. * letters to basic Latin letters.
  9966. *
  9967. * @private
  9968. * @param {string} letter The matched letter to deburr.
  9969. * @returns {string} Returns the deburred letter.
  9970. */
  9971. var deburrLetter = basePropertyOf(deburredLetters);
  9972. /**
  9973. * Used by `_.escape` to convert characters to HTML entities.
  9974. *
  9975. * @private
  9976. * @param {string} chr The matched character to escape.
  9977. * @returns {string} Returns the escaped character.
  9978. */
  9979. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  9980. /**
  9981. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  9982. *
  9983. * @private
  9984. * @param {string} chr The matched character to escape.
  9985. * @returns {string} Returns the escaped character.
  9986. */
  9987. function escapeStringChar(chr) {
  9988. return '\\' + stringEscapes[chr];
  9989. }
  9990. /**
  9991. * Gets the value at `key` of `object`.
  9992. *
  9993. * @private
  9994. * @param {Object} [object] The object to query.
  9995. * @param {string} key The key of the property to get.
  9996. * @returns {*} Returns the property value.
  9997. */
  9998. function getValue(object, key) {
  9999. return object == null ? undefined : object[key];
  10000. }
  10001. /**
  10002. * Checks if `string` contains Unicode symbols.
  10003. *
  10004. * @private
  10005. * @param {string} string The string to inspect.
  10006. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  10007. */
  10008. function hasUnicode(string) {
  10009. return reHasUnicode.test(string);
  10010. }
  10011. /**
  10012. * Checks if `string` contains a word composed of Unicode symbols.
  10013. *
  10014. * @private
  10015. * @param {string} string The string to inspect.
  10016. * @returns {boolean} Returns `true` if a word is found, else `false`.
  10017. */
  10018. function hasUnicodeWord(string) {
  10019. return reHasUnicodeWord.test(string);
  10020. }
  10021. /**
  10022. * Converts `iterator` to an array.
  10023. *
  10024. * @private
  10025. * @param {Object} iterator The iterator to convert.
  10026. * @returns {Array} Returns the converted array.
  10027. */
  10028. function iteratorToArray(iterator) {
  10029. var data,
  10030. result = [];
  10031. while (!(data = iterator.next()).done) {
  10032. result.push(data.value);
  10033. }
  10034. return result;
  10035. }
  10036. /**
  10037. * Converts `map` to its key-value pairs.
  10038. *
  10039. * @private
  10040. * @param {Object} map The map to convert.
  10041. * @returns {Array} Returns the key-value pairs.
  10042. */
  10043. function mapToArray(map) {
  10044. var index = -1,
  10045. result = Array(map.size);
  10046. map.forEach(function(value, key) {
  10047. result[++index] = [key, value];
  10048. });
  10049. return result;
  10050. }
  10051. /**
  10052. * Creates a unary function that invokes `func` with its argument transformed.
  10053. *
  10054. * @private
  10055. * @param {Function} func The function to wrap.
  10056. * @param {Function} transform The argument transform.
  10057. * @returns {Function} Returns the new function.
  10058. */
  10059. function overArg(func, transform) {
  10060. return function(arg) {
  10061. return func(transform(arg));
  10062. };
  10063. }
  10064. /**
  10065. * Replaces all `placeholder` elements in `array` with an internal placeholder
  10066. * and returns an array of their indexes.
  10067. *
  10068. * @private
  10069. * @param {Array} array The array to modify.
  10070. * @param {*} placeholder The placeholder to replace.
  10071. * @returns {Array} Returns the new array of placeholder indexes.
  10072. */
  10073. function replaceHolders(array, placeholder) {
  10074. var index = -1,
  10075. length = array.length,
  10076. resIndex = 0,
  10077. result = [];
  10078. while (++index < length) {
  10079. var value = array[index];
  10080. if (value === placeholder || value === PLACEHOLDER) {
  10081. array[index] = PLACEHOLDER;
  10082. result[resIndex++] = index;
  10083. }
  10084. }
  10085. return result;
  10086. }
  10087. /**
  10088. * Converts `set` to an array of its values.
  10089. *
  10090. * @private
  10091. * @param {Object} set The set to convert.
  10092. * @returns {Array} Returns the values.
  10093. */
  10094. function setToArray(set) {
  10095. var index = -1,
  10096. result = Array(set.size);
  10097. set.forEach(function(value) {
  10098. result[++index] = value;
  10099. });
  10100. return result;
  10101. }
  10102. /**
  10103. * Converts `set` to its value-value pairs.
  10104. *
  10105. * @private
  10106. * @param {Object} set The set to convert.
  10107. * @returns {Array} Returns the value-value pairs.
  10108. */
  10109. function setToPairs(set) {
  10110. var index = -1,
  10111. result = Array(set.size);
  10112. set.forEach(function(value) {
  10113. result[++index] = [value, value];
  10114. });
  10115. return result;
  10116. }
  10117. /**
  10118. * A specialized version of `_.indexOf` which performs strict equality
  10119. * comparisons of values, i.e. `===`.
  10120. *
  10121. * @private
  10122. * @param {Array} array The array to inspect.
  10123. * @param {*} value The value to search for.
  10124. * @param {number} fromIndex The index to search from.
  10125. * @returns {number} Returns the index of the matched value, else `-1`.
  10126. */
  10127. function strictIndexOf(array, value, fromIndex) {
  10128. var index = fromIndex - 1,
  10129. length = array.length;
  10130. while (++index < length) {
  10131. if (array[index] === value) {
  10132. return index;
  10133. }
  10134. }
  10135. return -1;
  10136. }
  10137. /**
  10138. * A specialized version of `_.lastIndexOf` which performs strict equality
  10139. * comparisons of values, i.e. `===`.
  10140. *
  10141. * @private
  10142. * @param {Array} array The array to inspect.
  10143. * @param {*} value The value to search for.
  10144. * @param {number} fromIndex The index to search from.
  10145. * @returns {number} Returns the index of the matched value, else `-1`.
  10146. */
  10147. function strictLastIndexOf(array, value, fromIndex) {
  10148. var index = fromIndex + 1;
  10149. while (index--) {
  10150. if (array[index] === value) {
  10151. return index;
  10152. }
  10153. }
  10154. return index;
  10155. }
  10156. /**
  10157. * Gets the number of symbols in `string`.
  10158. *
  10159. * @private
  10160. * @param {string} string The string to inspect.
  10161. * @returns {number} Returns the string size.
  10162. */
  10163. function stringSize(string) {
  10164. return hasUnicode(string)
  10165. ? unicodeSize(string)
  10166. : asciiSize(string);
  10167. }
  10168. /**
  10169. * Converts `string` to an array.
  10170. *
  10171. * @private
  10172. * @param {string} string The string to convert.
  10173. * @returns {Array} Returns the converted array.
  10174. */
  10175. function stringToArray(string) {
  10176. return hasUnicode(string)
  10177. ? unicodeToArray(string)
  10178. : asciiToArray(string);
  10179. }
  10180. /**
  10181. * Used by `_.unescape` to convert HTML entities to characters.
  10182. *
  10183. * @private
  10184. * @param {string} chr The matched character to unescape.
  10185. * @returns {string} Returns the unescaped character.
  10186. */
  10187. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  10188. /**
  10189. * Gets the size of a Unicode `string`.
  10190. *
  10191. * @private
  10192. * @param {string} string The string inspect.
  10193. * @returns {number} Returns the string size.
  10194. */
  10195. function unicodeSize(string) {
  10196. var result = reUnicode.lastIndex = 0;
  10197. while (reUnicode.test(string)) {
  10198. ++result;
  10199. }
  10200. return result;
  10201. }
  10202. /**
  10203. * Converts a Unicode `string` to an array.
  10204. *
  10205. * @private
  10206. * @param {string} string The string to convert.
  10207. * @returns {Array} Returns the converted array.
  10208. */
  10209. function unicodeToArray(string) {
  10210. return string.match(reUnicode) || [];
  10211. }
  10212. /**
  10213. * Splits a Unicode `string` into an array of its words.
  10214. *
  10215. * @private
  10216. * @param {string} The string to inspect.
  10217. * @returns {Array} Returns the words of `string`.
  10218. */
  10219. function unicodeWords(string) {
  10220. return string.match(reUnicodeWord) || [];
  10221. }
  10222. /*--------------------------------------------------------------------------*/
  10223. /**
  10224. * Create a new pristine `lodash` function using the `context` object.
  10225. *
  10226. * @static
  10227. * @memberOf _
  10228. * @since 1.1.0
  10229. * @category Util
  10230. * @param {Object} [context=root] The context object.
  10231. * @returns {Function} Returns a new `lodash` function.
  10232. * @example
  10233. *
  10234. * _.mixin({ 'foo': _.constant('foo') });
  10235. *
  10236. * var lodash = _.runInContext();
  10237. * lodash.mixin({ 'bar': lodash.constant('bar') });
  10238. *
  10239. * _.isFunction(_.foo);
  10240. * // => true
  10241. * _.isFunction(_.bar);
  10242. * // => false
  10243. *
  10244. * lodash.isFunction(lodash.foo);
  10245. * // => false
  10246. * lodash.isFunction(lodash.bar);
  10247. * // => true
  10248. *
  10249. * // Create a suped-up `defer` in Node.js.
  10250. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  10251. */
  10252. var runInContext = (function runInContext(context) {
  10253. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  10254. /** Built-in constructor references. */
  10255. var Array = context.Array,
  10256. Date = context.Date,
  10257. Error = context.Error,
  10258. Function = context.Function,
  10259. Math = context.Math,
  10260. Object = context.Object,
  10261. RegExp = context.RegExp,
  10262. String = context.String,
  10263. TypeError = context.TypeError;
  10264. /** Used for built-in method references. */
  10265. var arrayProto = Array.prototype,
  10266. funcProto = Function.prototype,
  10267. objectProto = Object.prototype;
  10268. /** Used to detect overreaching core-js shims. */
  10269. var coreJsData = context['__core-js_shared__'];
  10270. /** Used to resolve the decompiled source of functions. */
  10271. var funcToString = funcProto.toString;
  10272. /** Used to check objects for own properties. */
  10273. var hasOwnProperty = objectProto.hasOwnProperty;
  10274. /** Used to generate unique IDs. */
  10275. var idCounter = 0;
  10276. /** Used to detect methods masquerading as native. */
  10277. var maskSrcKey = (function() {
  10278. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  10279. return uid ? ('Symbol(src)_1.' + uid) : '';
  10280. }());
  10281. /**
  10282. * Used to resolve the
  10283. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  10284. * of values.
  10285. */
  10286. var nativeObjectToString = objectProto.toString;
  10287. /** Used to infer the `Object` constructor. */
  10288. var objectCtorString = funcToString.call(Object);
  10289. /** Used to restore the original `_` reference in `_.noConflict`. */
  10290. var oldDash = root._;
  10291. /** Used to detect if a method is native. */
  10292. var reIsNative = RegExp('^' +
  10293. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  10294. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  10295. );
  10296. /** Built-in value references. */
  10297. var Buffer = moduleExports ? context.Buffer : undefined,
  10298. Symbol = context.Symbol,
  10299. Uint8Array = context.Uint8Array,
  10300. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  10301. getPrototype = overArg(Object.getPrototypeOf, Object),
  10302. objectCreate = Object.create,
  10303. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  10304. splice = arrayProto.splice,
  10305. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  10306. symIterator = Symbol ? Symbol.iterator : undefined,
  10307. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  10308. var defineProperty = (function() {
  10309. try {
  10310. var func = getNative(Object, 'defineProperty');
  10311. func({}, '', {});
  10312. return func;
  10313. } catch (e) {}
  10314. }());
  10315. /** Mocked built-ins. */
  10316. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  10317. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  10318. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  10319. /* Built-in method references for those with the same name as other `lodash` methods. */
  10320. var nativeCeil = Math.ceil,
  10321. nativeFloor = Math.floor,
  10322. nativeGetSymbols = Object.getOwnPropertySymbols,
  10323. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  10324. nativeIsFinite = context.isFinite,
  10325. nativeJoin = arrayProto.join,
  10326. nativeKeys = overArg(Object.keys, Object),
  10327. nativeMax = Math.max,
  10328. nativeMin = Math.min,
  10329. nativeNow = Date.now,
  10330. nativeParseInt = context.parseInt,
  10331. nativeRandom = Math.random,
  10332. nativeReverse = arrayProto.reverse;
  10333. /* Built-in method references that are verified to be native. */
  10334. var DataView = getNative(context, 'DataView'),
  10335. Map = getNative(context, 'Map'),
  10336. Promise = getNative(context, 'Promise'),
  10337. Set = getNative(context, 'Set'),
  10338. WeakMap = getNative(context, 'WeakMap'),
  10339. nativeCreate = getNative(Object, 'create');
  10340. /** Used to store function metadata. */
  10341. var metaMap = WeakMap && new WeakMap;
  10342. /** Used to lookup unminified function names. */
  10343. var realNames = {};
  10344. /** Used to detect maps, sets, and weakmaps. */
  10345. var dataViewCtorString = toSource(DataView),
  10346. mapCtorString = toSource(Map),
  10347. promiseCtorString = toSource(Promise),
  10348. setCtorString = toSource(Set),
  10349. weakMapCtorString = toSource(WeakMap);
  10350. /** Used to convert symbols to primitives and strings. */
  10351. var symbolProto = Symbol ? Symbol.prototype : undefined,
  10352. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  10353. symbolToString = symbolProto ? symbolProto.toString : undefined;
  10354. /*------------------------------------------------------------------------*/
  10355. /**
  10356. * Creates a `lodash` object which wraps `value` to enable implicit method
  10357. * chain sequences. Methods that operate on and return arrays, collections,
  10358. * and functions can be chained together. Methods that retrieve a single value
  10359. * or may return a primitive value will automatically end the chain sequence
  10360. * and return the unwrapped value. Otherwise, the value must be unwrapped
  10361. * with `_#value`.
  10362. *
  10363. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  10364. * enabled using `_.chain`.
  10365. *
  10366. * The execution of chained methods is lazy, that is, it's deferred until
  10367. * `_#value` is implicitly or explicitly called.
  10368. *
  10369. * Lazy evaluation allows several methods to support shortcut fusion.
  10370. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  10371. * the creation of intermediate arrays and can greatly reduce the number of
  10372. * iteratee executions. Sections of a chain sequence qualify for shortcut
  10373. * fusion if the section is applied to an array and iteratees accept only
  10374. * one argument. The heuristic for whether a section qualifies for shortcut
  10375. * fusion is subject to change.
  10376. *
  10377. * Chaining is supported in custom builds as long as the `_#value` method is
  10378. * directly or indirectly included in the build.
  10379. *
  10380. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  10381. *
  10382. * The wrapper `Array` methods are:
  10383. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  10384. *
  10385. * The wrapper `String` methods are:
  10386. * `replace` and `split`
  10387. *
  10388. * The wrapper methods that support shortcut fusion are:
  10389. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  10390. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  10391. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  10392. *
  10393. * The chainable wrapper methods are:
  10394. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  10395. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  10396. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  10397. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  10398. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  10399. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  10400. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  10401. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  10402. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  10403. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  10404. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  10405. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  10406. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  10407. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  10408. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  10409. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  10410. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  10411. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  10412. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  10413. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  10414. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  10415. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  10416. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  10417. * `zipObject`, `zipObjectDeep`, and `zipWith`
  10418. *
  10419. * The wrapper methods that are **not** chainable by default are:
  10420. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  10421. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  10422. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  10423. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  10424. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  10425. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  10426. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  10427. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  10428. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  10429. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  10430. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  10431. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  10432. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  10433. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  10434. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  10435. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  10436. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  10437. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  10438. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  10439. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  10440. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  10441. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  10442. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  10443. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  10444. * `upperFirst`, `value`, and `words`
  10445. *
  10446. * @name _
  10447. * @constructor
  10448. * @category Seq
  10449. * @param {*} value The value to wrap in a `lodash` instance.
  10450. * @returns {Object} Returns the new `lodash` wrapper instance.
  10451. * @example
  10452. *
  10453. * function square(n) {
  10454. * return n * n;
  10455. * }
  10456. *
  10457. * var wrapped = _([1, 2, 3]);
  10458. *
  10459. * // Returns an unwrapped value.
  10460. * wrapped.reduce(_.add);
  10461. * // => 6
  10462. *
  10463. * // Returns a wrapped value.
  10464. * var squares = wrapped.map(square);
  10465. *
  10466. * _.isArray(squares);
  10467. * // => false
  10468. *
  10469. * _.isArray(squares.value());
  10470. * // => true
  10471. */
  10472. function lodash(value) {
  10473. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  10474. if (value instanceof LodashWrapper) {
  10475. return value;
  10476. }
  10477. if (hasOwnProperty.call(value, '__wrapped__')) {
  10478. return wrapperClone(value);
  10479. }
  10480. }
  10481. return new LodashWrapper(value);
  10482. }
  10483. /**
  10484. * The base implementation of `_.create` without support for assigning
  10485. * properties to the created object.
  10486. *
  10487. * @private
  10488. * @param {Object} proto The object to inherit from.
  10489. * @returns {Object} Returns the new object.
  10490. */
  10491. var baseCreate = (function() {
  10492. function object() {}
  10493. return function(proto) {
  10494. if (!isObject(proto)) {
  10495. return {};
  10496. }
  10497. if (objectCreate) {
  10498. return objectCreate(proto);
  10499. }
  10500. object.prototype = proto;
  10501. var result = new object;
  10502. object.prototype = undefined;
  10503. return result;
  10504. };
  10505. }());
  10506. /**
  10507. * The function whose prototype chain sequence wrappers inherit from.
  10508. *
  10509. * @private
  10510. */
  10511. function baseLodash() {
  10512. // No operation performed.
  10513. }
  10514. /**
  10515. * The base constructor for creating `lodash` wrapper objects.
  10516. *
  10517. * @private
  10518. * @param {*} value The value to wrap.
  10519. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  10520. */
  10521. function LodashWrapper(value, chainAll) {
  10522. this.__wrapped__ = value;
  10523. this.__actions__ = [];
  10524. this.__chain__ = !!chainAll;
  10525. this.__index__ = 0;
  10526. this.__values__ = undefined;
  10527. }
  10528. /**
  10529. * By default, the template delimiters used by lodash are like those in
  10530. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  10531. * following template settings to use alternative delimiters.
  10532. *
  10533. * @static
  10534. * @memberOf _
  10535. * @type {Object}
  10536. */
  10537. lodash.templateSettings = {
  10538. /**
  10539. * Used to detect `data` property values to be HTML-escaped.
  10540. *
  10541. * @memberOf _.templateSettings
  10542. * @type {RegExp}
  10543. */
  10544. 'escape': reEscape,
  10545. /**
  10546. * Used to detect code to be evaluated.
  10547. *
  10548. * @memberOf _.templateSettings
  10549. * @type {RegExp}
  10550. */
  10551. 'evaluate': reEvaluate,
  10552. /**
  10553. * Used to detect `data` property values to inject.
  10554. *
  10555. * @memberOf _.templateSettings
  10556. * @type {RegExp}
  10557. */
  10558. 'interpolate': reInterpolate,
  10559. /**
  10560. * Used to reference the data object in the template text.
  10561. *
  10562. * @memberOf _.templateSettings
  10563. * @type {string}
  10564. */
  10565. 'variable': '',
  10566. /**
  10567. * Used to import variables into the compiled template.
  10568. *
  10569. * @memberOf _.templateSettings
  10570. * @type {Object}
  10571. */
  10572. 'imports': {
  10573. /**
  10574. * A reference to the `lodash` function.
  10575. *
  10576. * @memberOf _.templateSettings.imports
  10577. * @type {Function}
  10578. */
  10579. '_': lodash
  10580. }
  10581. };
  10582. // Ensure wrappers are instances of `baseLodash`.
  10583. lodash.prototype = baseLodash.prototype;
  10584. lodash.prototype.constructor = lodash;
  10585. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  10586. LodashWrapper.prototype.constructor = LodashWrapper;
  10587. /*------------------------------------------------------------------------*/
  10588. /**
  10589. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  10590. *
  10591. * @private
  10592. * @constructor
  10593. * @param {*} value The value to wrap.
  10594. */
  10595. function LazyWrapper(value) {
  10596. this.__wrapped__ = value;
  10597. this.__actions__ = [];
  10598. this.__dir__ = 1;
  10599. this.__filtered__ = false;
  10600. this.__iteratees__ = [];
  10601. this.__takeCount__ = MAX_ARRAY_LENGTH;
  10602. this.__views__ = [];
  10603. }
  10604. /**
  10605. * Creates a clone of the lazy wrapper object.
  10606. *
  10607. * @private
  10608. * @name clone
  10609. * @memberOf LazyWrapper
  10610. * @returns {Object} Returns the cloned `LazyWrapper` object.
  10611. */
  10612. function lazyClone() {
  10613. var result = new LazyWrapper(this.__wrapped__);
  10614. result.__actions__ = copyArray(this.__actions__);
  10615. result.__dir__ = this.__dir__;
  10616. result.__filtered__ = this.__filtered__;
  10617. result.__iteratees__ = copyArray(this.__iteratees__);
  10618. result.__takeCount__ = this.__takeCount__;
  10619. result.__views__ = copyArray(this.__views__);
  10620. return result;
  10621. }
  10622. /**
  10623. * Reverses the direction of lazy iteration.
  10624. *
  10625. * @private
  10626. * @name reverse
  10627. * @memberOf LazyWrapper
  10628. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  10629. */
  10630. function lazyReverse() {
  10631. if (this.__filtered__) {
  10632. var result = new LazyWrapper(this);
  10633. result.__dir__ = -1;
  10634. result.__filtered__ = true;
  10635. } else {
  10636. result = this.clone();
  10637. result.__dir__ *= -1;
  10638. }
  10639. return result;
  10640. }
  10641. /**
  10642. * Extracts the unwrapped value from its lazy wrapper.
  10643. *
  10644. * @private
  10645. * @name value
  10646. * @memberOf LazyWrapper
  10647. * @returns {*} Returns the unwrapped value.
  10648. */
  10649. function lazyValue() {
  10650. var array = this.__wrapped__.value(),
  10651. dir = this.__dir__,
  10652. isArr = isArray(array),
  10653. isRight = dir < 0,
  10654. arrLength = isArr ? array.length : 0,
  10655. view = getView(0, arrLength, this.__views__),
  10656. start = view.start,
  10657. end = view.end,
  10658. length = end - start,
  10659. index = isRight ? end : (start - 1),
  10660. iteratees = this.__iteratees__,
  10661. iterLength = iteratees.length,
  10662. resIndex = 0,
  10663. takeCount = nativeMin(length, this.__takeCount__);
  10664. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  10665. return baseWrapperValue(array, this.__actions__);
  10666. }
  10667. var result = [];
  10668. outer:
  10669. while (length-- && resIndex < takeCount) {
  10670. index += dir;
  10671. var iterIndex = -1,
  10672. value = array[index];
  10673. while (++iterIndex < iterLength) {
  10674. var data = iteratees[iterIndex],
  10675. iteratee = data.iteratee,
  10676. type = data.type,
  10677. computed = iteratee(value);
  10678. if (type == LAZY_MAP_FLAG) {
  10679. value = computed;
  10680. } else if (!computed) {
  10681. if (type == LAZY_FILTER_FLAG) {
  10682. continue outer;
  10683. } else {
  10684. break outer;
  10685. }
  10686. }
  10687. }
  10688. result[resIndex++] = value;
  10689. }
  10690. return result;
  10691. }
  10692. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  10693. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  10694. LazyWrapper.prototype.constructor = LazyWrapper;
  10695. /*------------------------------------------------------------------------*/
  10696. /**
  10697. * Creates a hash object.
  10698. *
  10699. * @private
  10700. * @constructor
  10701. * @param {Array} [entries] The key-value pairs to cache.
  10702. */
  10703. function Hash(entries) {
  10704. var index = -1,
  10705. length = entries == null ? 0 : entries.length;
  10706. this.clear();
  10707. while (++index < length) {
  10708. var entry = entries[index];
  10709. this.set(entry[0], entry[1]);
  10710. }
  10711. }
  10712. /**
  10713. * Removes all key-value entries from the hash.
  10714. *
  10715. * @private
  10716. * @name clear
  10717. * @memberOf Hash
  10718. */
  10719. function hashClear() {
  10720. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  10721. this.size = 0;
  10722. }
  10723. /**
  10724. * Removes `key` and its value from the hash.
  10725. *
  10726. * @private
  10727. * @name delete
  10728. * @memberOf Hash
  10729. * @param {Object} hash The hash to modify.
  10730. * @param {string} key The key of the value to remove.
  10731. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  10732. */
  10733. function hashDelete(key) {
  10734. var result = this.has(key) && delete this.__data__[key];
  10735. this.size -= result ? 1 : 0;
  10736. return result;
  10737. }
  10738. /**
  10739. * Gets the hash value for `key`.
  10740. *
  10741. * @private
  10742. * @name get
  10743. * @memberOf Hash
  10744. * @param {string} key The key of the value to get.
  10745. * @returns {*} Returns the entry value.
  10746. */
  10747. function hashGet(key) {
  10748. var data = this.__data__;
  10749. if (nativeCreate) {
  10750. var result = data[key];
  10751. return result === HASH_UNDEFINED ? undefined : result;
  10752. }
  10753. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  10754. }
  10755. /**
  10756. * Checks if a hash value for `key` exists.
  10757. *
  10758. * @private
  10759. * @name has
  10760. * @memberOf Hash
  10761. * @param {string} key The key of the entry to check.
  10762. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  10763. */
  10764. function hashHas(key) {
  10765. var data = this.__data__;
  10766. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  10767. }
  10768. /**
  10769. * Sets the hash `key` to `value`.
  10770. *
  10771. * @private
  10772. * @name set
  10773. * @memberOf Hash
  10774. * @param {string} key The key of the value to set.
  10775. * @param {*} value The value to set.
  10776. * @returns {Object} Returns the hash instance.
  10777. */
  10778. function hashSet(key, value) {
  10779. var data = this.__data__;
  10780. this.size += this.has(key) ? 0 : 1;
  10781. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  10782. return this;
  10783. }
  10784. // Add methods to `Hash`.
  10785. Hash.prototype.clear = hashClear;
  10786. Hash.prototype['delete'] = hashDelete;
  10787. Hash.prototype.get = hashGet;
  10788. Hash.prototype.has = hashHas;
  10789. Hash.prototype.set = hashSet;
  10790. /*------------------------------------------------------------------------*/
  10791. /**
  10792. * Creates an list cache object.
  10793. *
  10794. * @private
  10795. * @constructor
  10796. * @param {Array} [entries] The key-value pairs to cache.
  10797. */
  10798. function ListCache(entries) {
  10799. var index = -1,
  10800. length = entries == null ? 0 : entries.length;
  10801. this.clear();
  10802. while (++index < length) {
  10803. var entry = entries[index];
  10804. this.set(entry[0], entry[1]);
  10805. }
  10806. }
  10807. /**
  10808. * Removes all key-value entries from the list cache.
  10809. *
  10810. * @private
  10811. * @name clear
  10812. * @memberOf ListCache
  10813. */
  10814. function listCacheClear() {
  10815. this.__data__ = [];
  10816. this.size = 0;
  10817. }
  10818. /**
  10819. * Removes `key` and its value from the list cache.
  10820. *
  10821. * @private
  10822. * @name delete
  10823. * @memberOf ListCache
  10824. * @param {string} key The key of the value to remove.
  10825. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  10826. */
  10827. function listCacheDelete(key) {
  10828. var data = this.__data__,
  10829. index = assocIndexOf(data, key);
  10830. if (index < 0) {
  10831. return false;
  10832. }
  10833. var lastIndex = data.length - 1;
  10834. if (index == lastIndex) {
  10835. data.pop();
  10836. } else {
  10837. splice.call(data, index, 1);
  10838. }
  10839. --this.size;
  10840. return true;
  10841. }
  10842. /**
  10843. * Gets the list cache value for `key`.
  10844. *
  10845. * @private
  10846. * @name get
  10847. * @memberOf ListCache
  10848. * @param {string} key The key of the value to get.
  10849. * @returns {*} Returns the entry value.
  10850. */
  10851. function listCacheGet(key) {
  10852. var data = this.__data__,
  10853. index = assocIndexOf(data, key);
  10854. return index < 0 ? undefined : data[index][1];
  10855. }
  10856. /**
  10857. * Checks if a list cache value for `key` exists.
  10858. *
  10859. * @private
  10860. * @name has
  10861. * @memberOf ListCache
  10862. * @param {string} key The key of the entry to check.
  10863. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  10864. */
  10865. function listCacheHas(key) {
  10866. return assocIndexOf(this.__data__, key) > -1;
  10867. }
  10868. /**
  10869. * Sets the list cache `key` to `value`.
  10870. *
  10871. * @private
  10872. * @name set
  10873. * @memberOf ListCache
  10874. * @param {string} key The key of the value to set.
  10875. * @param {*} value The value to set.
  10876. * @returns {Object} Returns the list cache instance.
  10877. */
  10878. function listCacheSet(key, value) {
  10879. var data = this.__data__,
  10880. index = assocIndexOf(data, key);
  10881. if (index < 0) {
  10882. ++this.size;
  10883. data.push([key, value]);
  10884. } else {
  10885. data[index][1] = value;
  10886. }
  10887. return this;
  10888. }
  10889. // Add methods to `ListCache`.
  10890. ListCache.prototype.clear = listCacheClear;
  10891. ListCache.prototype['delete'] = listCacheDelete;
  10892. ListCache.prototype.get = listCacheGet;
  10893. ListCache.prototype.has = listCacheHas;
  10894. ListCache.prototype.set = listCacheSet;
  10895. /*------------------------------------------------------------------------*/
  10896. /**
  10897. * Creates a map cache object to store key-value pairs.
  10898. *
  10899. * @private
  10900. * @constructor
  10901. * @param {Array} [entries] The key-value pairs to cache.
  10902. */
  10903. function MapCache(entries) {
  10904. var index = -1,
  10905. length = entries == null ? 0 : entries.length;
  10906. this.clear();
  10907. while (++index < length) {
  10908. var entry = entries[index];
  10909. this.set(entry[0], entry[1]);
  10910. }
  10911. }
  10912. /**
  10913. * Removes all key-value entries from the map.
  10914. *
  10915. * @private
  10916. * @name clear
  10917. * @memberOf MapCache
  10918. */
  10919. function mapCacheClear() {
  10920. this.size = 0;
  10921. this.__data__ = {
  10922. 'hash': new Hash,
  10923. 'map': new (Map || ListCache),
  10924. 'string': new Hash
  10925. };
  10926. }
  10927. /**
  10928. * Removes `key` and its value from the map.
  10929. *
  10930. * @private
  10931. * @name delete
  10932. * @memberOf MapCache
  10933. * @param {string} key The key of the value to remove.
  10934. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  10935. */
  10936. function mapCacheDelete(key) {
  10937. var result = getMapData(this, key)['delete'](key);
  10938. this.size -= result ? 1 : 0;
  10939. return result;
  10940. }
  10941. /**
  10942. * Gets the map value for `key`.
  10943. *
  10944. * @private
  10945. * @name get
  10946. * @memberOf MapCache
  10947. * @param {string} key The key of the value to get.
  10948. * @returns {*} Returns the entry value.
  10949. */
  10950. function mapCacheGet(key) {
  10951. return getMapData(this, key).get(key);
  10952. }
  10953. /**
  10954. * Checks if a map value for `key` exists.
  10955. *
  10956. * @private
  10957. * @name has
  10958. * @memberOf MapCache
  10959. * @param {string} key The key of the entry to check.
  10960. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  10961. */
  10962. function mapCacheHas(key) {
  10963. return getMapData(this, key).has(key);
  10964. }
  10965. /**
  10966. * Sets the map `key` to `value`.
  10967. *
  10968. * @private
  10969. * @name set
  10970. * @memberOf MapCache
  10971. * @param {string} key The key of the value to set.
  10972. * @param {*} value The value to set.
  10973. * @returns {Object} Returns the map cache instance.
  10974. */
  10975. function mapCacheSet(key, value) {
  10976. var data = getMapData(this, key),
  10977. size = data.size;
  10978. data.set(key, value);
  10979. this.size += data.size == size ? 0 : 1;
  10980. return this;
  10981. }
  10982. // Add methods to `MapCache`.
  10983. MapCache.prototype.clear = mapCacheClear;
  10984. MapCache.prototype['delete'] = mapCacheDelete;
  10985. MapCache.prototype.get = mapCacheGet;
  10986. MapCache.prototype.has = mapCacheHas;
  10987. MapCache.prototype.set = mapCacheSet;
  10988. /*------------------------------------------------------------------------*/
  10989. /**
  10990. *
  10991. * Creates an array cache object to store unique values.
  10992. *
  10993. * @private
  10994. * @constructor
  10995. * @param {Array} [values] The values to cache.
  10996. */
  10997. function SetCache(values) {
  10998. var index = -1,
  10999. length = values == null ? 0 : values.length;
  11000. this.__data__ = new MapCache;
  11001. while (++index < length) {
  11002. this.add(values[index]);
  11003. }
  11004. }
  11005. /**
  11006. * Adds `value` to the array cache.
  11007. *
  11008. * @private
  11009. * @name add
  11010. * @memberOf SetCache
  11011. * @alias push
  11012. * @param {*} value The value to cache.
  11013. * @returns {Object} Returns the cache instance.
  11014. */
  11015. function setCacheAdd(value) {
  11016. this.__data__.set(value, HASH_UNDEFINED);
  11017. return this;
  11018. }
  11019. /**
  11020. * Checks if `value` is in the array cache.
  11021. *
  11022. * @private
  11023. * @name has
  11024. * @memberOf SetCache
  11025. * @param {*} value The value to search for.
  11026. * @returns {number} Returns `true` if `value` is found, else `false`.
  11027. */
  11028. function setCacheHas(value) {
  11029. return this.__data__.has(value);
  11030. }
  11031. // Add methods to `SetCache`.
  11032. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  11033. SetCache.prototype.has = setCacheHas;
  11034. /*------------------------------------------------------------------------*/
  11035. /**
  11036. * Creates a stack cache object to store key-value pairs.
  11037. *
  11038. * @private
  11039. * @constructor
  11040. * @param {Array} [entries] The key-value pairs to cache.
  11041. */
  11042. function Stack(entries) {
  11043. var data = this.__data__ = new ListCache(entries);
  11044. this.size = data.size;
  11045. }
  11046. /**
  11047. * Removes all key-value entries from the stack.
  11048. *
  11049. * @private
  11050. * @name clear
  11051. * @memberOf Stack
  11052. */
  11053. function stackClear() {
  11054. this.__data__ = new ListCache;
  11055. this.size = 0;
  11056. }
  11057. /**
  11058. * Removes `key` and its value from the stack.
  11059. *
  11060. * @private
  11061. * @name delete
  11062. * @memberOf Stack
  11063. * @param {string} key The key of the value to remove.
  11064. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  11065. */
  11066. function stackDelete(key) {
  11067. var data = this.__data__,
  11068. result = data['delete'](key);
  11069. this.size = data.size;
  11070. return result;
  11071. }
  11072. /**
  11073. * Gets the stack value for `key`.
  11074. *
  11075. * @private
  11076. * @name get
  11077. * @memberOf Stack
  11078. * @param {string} key The key of the value to get.
  11079. * @returns {*} Returns the entry value.
  11080. */
  11081. function stackGet(key) {
  11082. return this.__data__.get(key);
  11083. }
  11084. /**
  11085. * Checks if a stack value for `key` exists.
  11086. *
  11087. * @private
  11088. * @name has
  11089. * @memberOf Stack
  11090. * @param {string} key The key of the entry to check.
  11091. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  11092. */
  11093. function stackHas(key) {
  11094. return this.__data__.has(key);
  11095. }
  11096. /**
  11097. * Sets the stack `key` to `value`.
  11098. *
  11099. * @private
  11100. * @name set
  11101. * @memberOf Stack
  11102. * @param {string} key The key of the value to set.
  11103. * @param {*} value The value to set.
  11104. * @returns {Object} Returns the stack cache instance.
  11105. */
  11106. function stackSet(key, value) {
  11107. var data = this.__data__;
  11108. if (data instanceof ListCache) {
  11109. var pairs = data.__data__;
  11110. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  11111. pairs.push([key, value]);
  11112. this.size = ++data.size;
  11113. return this;
  11114. }
  11115. data = this.__data__ = new MapCache(pairs);
  11116. }
  11117. data.set(key, value);
  11118. this.size = data.size;
  11119. return this;
  11120. }
  11121. // Add methods to `Stack`.
  11122. Stack.prototype.clear = stackClear;
  11123. Stack.prototype['delete'] = stackDelete;
  11124. Stack.prototype.get = stackGet;
  11125. Stack.prototype.has = stackHas;
  11126. Stack.prototype.set = stackSet;
  11127. /*------------------------------------------------------------------------*/
  11128. /**
  11129. * Creates an array of the enumerable property names of the array-like `value`.
  11130. *
  11131. * @private
  11132. * @param {*} value The value to query.
  11133. * @param {boolean} inherited Specify returning inherited property names.
  11134. * @returns {Array} Returns the array of property names.
  11135. */
  11136. function arrayLikeKeys(value, inherited) {
  11137. var isArr = isArray(value),
  11138. isArg = !isArr && isArguments(value),
  11139. isBuff = !isArr && !isArg && isBuffer(value),
  11140. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  11141. skipIndexes = isArr || isArg || isBuff || isType,
  11142. result = skipIndexes ? baseTimes(value.length, String) : [],
  11143. length = result.length;
  11144. for (var key in value) {
  11145. if ((inherited || hasOwnProperty.call(value, key)) &&
  11146. !(skipIndexes && (
  11147. // Safari 9 has enumerable `arguments.length` in strict mode.
  11148. key == 'length' ||
  11149. // Node.js 0.10 has enumerable non-index properties on buffers.
  11150. (isBuff && (key == 'offset' || key == 'parent')) ||
  11151. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  11152. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  11153. // Skip index properties.
  11154. isIndex(key, length)
  11155. ))) {
  11156. result.push(key);
  11157. }
  11158. }
  11159. return result;
  11160. }
  11161. /**
  11162. * A specialized version of `_.sample` for arrays.
  11163. *
  11164. * @private
  11165. * @param {Array} array The array to sample.
  11166. * @returns {*} Returns the random element.
  11167. */
  11168. function arraySample(array) {
  11169. var length = array.length;
  11170. return length ? array[baseRandom(0, length - 1)] : undefined;
  11171. }
  11172. /**
  11173. * A specialized version of `_.sampleSize` for arrays.
  11174. *
  11175. * @private
  11176. * @param {Array} array The array to sample.
  11177. * @param {number} n The number of elements to sample.
  11178. * @returns {Array} Returns the random elements.
  11179. */
  11180. function arraySampleSize(array, n) {
  11181. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  11182. }
  11183. /**
  11184. * A specialized version of `_.shuffle` for arrays.
  11185. *
  11186. * @private
  11187. * @param {Array} array The array to shuffle.
  11188. * @returns {Array} Returns the new shuffled array.
  11189. */
  11190. function arrayShuffle(array) {
  11191. return shuffleSelf(copyArray(array));
  11192. }
  11193. /**
  11194. * This function is like `assignValue` except that it doesn't assign
  11195. * `undefined` values.
  11196. *
  11197. * @private
  11198. * @param {Object} object The object to modify.
  11199. * @param {string} key The key of the property to assign.
  11200. * @param {*} value The value to assign.
  11201. */
  11202. function assignMergeValue(object, key, value) {
  11203. if ((value !== undefined && !eq(object[key], value)) ||
  11204. (value === undefined && !(key in object))) {
  11205. baseAssignValue(object, key, value);
  11206. }
  11207. }
  11208. /**
  11209. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  11210. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11211. * for equality comparisons.
  11212. *
  11213. * @private
  11214. * @param {Object} object The object to modify.
  11215. * @param {string} key The key of the property to assign.
  11216. * @param {*} value The value to assign.
  11217. */
  11218. function assignValue(object, key, value) {
  11219. var objValue = object[key];
  11220. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  11221. (value === undefined && !(key in object))) {
  11222. baseAssignValue(object, key, value);
  11223. }
  11224. }
  11225. /**
  11226. * Gets the index at which the `key` is found in `array` of key-value pairs.
  11227. *
  11228. * @private
  11229. * @param {Array} array The array to inspect.
  11230. * @param {*} key The key to search for.
  11231. * @returns {number} Returns the index of the matched value, else `-1`.
  11232. */
  11233. function assocIndexOf(array, key) {
  11234. var length = array.length;
  11235. while (length--) {
  11236. if (eq(array[length][0], key)) {
  11237. return length;
  11238. }
  11239. }
  11240. return -1;
  11241. }
  11242. /**
  11243. * Aggregates elements of `collection` on `accumulator` with keys transformed
  11244. * by `iteratee` and values set by `setter`.
  11245. *
  11246. * @private
  11247. * @param {Array|Object} collection The collection to iterate over.
  11248. * @param {Function} setter The function to set `accumulator` values.
  11249. * @param {Function} iteratee The iteratee to transform keys.
  11250. * @param {Object} accumulator The initial aggregated object.
  11251. * @returns {Function} Returns `accumulator`.
  11252. */
  11253. function baseAggregator(collection, setter, iteratee, accumulator) {
  11254. baseEach(collection, function(value, key, collection) {
  11255. setter(accumulator, value, iteratee(value), collection);
  11256. });
  11257. return accumulator;
  11258. }
  11259. /**
  11260. * The base implementation of `_.assign` without support for multiple sources
  11261. * or `customizer` functions.
  11262. *
  11263. * @private
  11264. * @param {Object} object The destination object.
  11265. * @param {Object} source The source object.
  11266. * @returns {Object} Returns `object`.
  11267. */
  11268. function baseAssign(object, source) {
  11269. return object && copyObject(source, keys(source), object);
  11270. }
  11271. /**
  11272. * The base implementation of `_.assignIn` without support for multiple sources
  11273. * or `customizer` functions.
  11274. *
  11275. * @private
  11276. * @param {Object} object The destination object.
  11277. * @param {Object} source The source object.
  11278. * @returns {Object} Returns `object`.
  11279. */
  11280. function baseAssignIn(object, source) {
  11281. return object && copyObject(source, keysIn(source), object);
  11282. }
  11283. /**
  11284. * The base implementation of `assignValue` and `assignMergeValue` without
  11285. * value checks.
  11286. *
  11287. * @private
  11288. * @param {Object} object The object to modify.
  11289. * @param {string} key The key of the property to assign.
  11290. * @param {*} value The value to assign.
  11291. */
  11292. function baseAssignValue(object, key, value) {
  11293. if (key == '__proto__' && defineProperty) {
  11294. defineProperty(object, key, {
  11295. 'configurable': true,
  11296. 'enumerable': true,
  11297. 'value': value,
  11298. 'writable': true
  11299. });
  11300. } else {
  11301. object[key] = value;
  11302. }
  11303. }
  11304. /**
  11305. * The base implementation of `_.at` without support for individual paths.
  11306. *
  11307. * @private
  11308. * @param {Object} object The object to iterate over.
  11309. * @param {string[]} paths The property paths to pick.
  11310. * @returns {Array} Returns the picked elements.
  11311. */
  11312. function baseAt(object, paths) {
  11313. var index = -1,
  11314. length = paths.length,
  11315. result = Array(length),
  11316. skip = object == null;
  11317. while (++index < length) {
  11318. result[index] = skip ? undefined : get(object, paths[index]);
  11319. }
  11320. return result;
  11321. }
  11322. /**
  11323. * The base implementation of `_.clamp` which doesn't coerce arguments.
  11324. *
  11325. * @private
  11326. * @param {number} number The number to clamp.
  11327. * @param {number} [lower] The lower bound.
  11328. * @param {number} upper The upper bound.
  11329. * @returns {number} Returns the clamped number.
  11330. */
  11331. function baseClamp(number, lower, upper) {
  11332. if (number === number) {
  11333. if (upper !== undefined) {
  11334. number = number <= upper ? number : upper;
  11335. }
  11336. if (lower !== undefined) {
  11337. number = number >= lower ? number : lower;
  11338. }
  11339. }
  11340. return number;
  11341. }
  11342. /**
  11343. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  11344. * traversed objects.
  11345. *
  11346. * @private
  11347. * @param {*} value The value to clone.
  11348. * @param {boolean} bitmask The bitmask flags.
  11349. * 1 - Deep clone
  11350. * 2 - Flatten inherited properties
  11351. * 4 - Clone symbols
  11352. * @param {Function} [customizer] The function to customize cloning.
  11353. * @param {string} [key] The key of `value`.
  11354. * @param {Object} [object] The parent object of `value`.
  11355. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  11356. * @returns {*} Returns the cloned value.
  11357. */
  11358. function baseClone(value, bitmask, customizer, key, object, stack) {
  11359. var result,
  11360. isDeep = bitmask & CLONE_DEEP_FLAG,
  11361. isFlat = bitmask & CLONE_FLAT_FLAG,
  11362. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  11363. if (customizer) {
  11364. result = object ? customizer(value, key, object, stack) : customizer(value);
  11365. }
  11366. if (result !== undefined) {
  11367. return result;
  11368. }
  11369. if (!isObject(value)) {
  11370. return value;
  11371. }
  11372. var isArr = isArray(value);
  11373. if (isArr) {
  11374. result = initCloneArray(value);
  11375. if (!isDeep) {
  11376. return copyArray(value, result);
  11377. }
  11378. } else {
  11379. var tag = getTag(value),
  11380. isFunc = tag == funcTag || tag == genTag;
  11381. if (isBuffer(value)) {
  11382. return cloneBuffer(value, isDeep);
  11383. }
  11384. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  11385. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  11386. if (!isDeep) {
  11387. return isFlat
  11388. ? copySymbolsIn(value, baseAssignIn(result, value))
  11389. : copySymbols(value, baseAssign(result, value));
  11390. }
  11391. } else {
  11392. if (!cloneableTags[tag]) {
  11393. return object ? value : {};
  11394. }
  11395. result = initCloneByTag(value, tag, baseClone, isDeep);
  11396. }
  11397. }
  11398. // Check for circular references and return its corresponding clone.
  11399. stack || (stack = new Stack);
  11400. var stacked = stack.get(value);
  11401. if (stacked) {
  11402. return stacked;
  11403. }
  11404. stack.set(value, result);
  11405. var keysFunc = isFull
  11406. ? (isFlat ? getAllKeysIn : getAllKeys)
  11407. : (isFlat ? keysIn : keys);
  11408. var props = isArr ? undefined : keysFunc(value);
  11409. arrayEach(props || value, function(subValue, key) {
  11410. if (props) {
  11411. key = subValue;
  11412. subValue = value[key];
  11413. }
  11414. // Recursively populate clone (susceptible to call stack limits).
  11415. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  11416. });
  11417. return result;
  11418. }
  11419. /**
  11420. * The base implementation of `_.conforms` which doesn't clone `source`.
  11421. *
  11422. * @private
  11423. * @param {Object} source The object of property predicates to conform to.
  11424. * @returns {Function} Returns the new spec function.
  11425. */
  11426. function baseConforms(source) {
  11427. var props = keys(source);
  11428. return function(object) {
  11429. return baseConformsTo(object, source, props);
  11430. };
  11431. }
  11432. /**
  11433. * The base implementation of `_.conformsTo` which accepts `props` to check.
  11434. *
  11435. * @private
  11436. * @param {Object} object The object to inspect.
  11437. * @param {Object} source The object of property predicates to conform to.
  11438. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11439. */
  11440. function baseConformsTo(object, source, props) {
  11441. var length = props.length;
  11442. if (object == null) {
  11443. return !length;
  11444. }
  11445. object = Object(object);
  11446. while (length--) {
  11447. var key = props[length],
  11448. predicate = source[key],
  11449. value = object[key];
  11450. if ((value === undefined && !(key in object)) || !predicate(value)) {
  11451. return false;
  11452. }
  11453. }
  11454. return true;
  11455. }
  11456. /**
  11457. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  11458. * to provide to `func`.
  11459. *
  11460. * @private
  11461. * @param {Function} func The function to delay.
  11462. * @param {number} wait The number of milliseconds to delay invocation.
  11463. * @param {Array} args The arguments to provide to `func`.
  11464. * @returns {number|Object} Returns the timer id or timeout object.
  11465. */
  11466. function baseDelay(func, wait, args) {
  11467. if (typeof func != 'function') {
  11468. throw new TypeError(FUNC_ERROR_TEXT);
  11469. }
  11470. return setTimeout(function() { func.apply(undefined, args); }, wait);
  11471. }
  11472. /**
  11473. * The base implementation of methods like `_.difference` without support
  11474. * for excluding multiple arrays or iteratee shorthands.
  11475. *
  11476. * @private
  11477. * @param {Array} array The array to inspect.
  11478. * @param {Array} values The values to exclude.
  11479. * @param {Function} [iteratee] The iteratee invoked per element.
  11480. * @param {Function} [comparator] The comparator invoked per element.
  11481. * @returns {Array} Returns the new array of filtered values.
  11482. */
  11483. function baseDifference(array, values, iteratee, comparator) {
  11484. var index = -1,
  11485. includes = arrayIncludes,
  11486. isCommon = true,
  11487. length = array.length,
  11488. result = [],
  11489. valuesLength = values.length;
  11490. if (!length) {
  11491. return result;
  11492. }
  11493. if (iteratee) {
  11494. values = arrayMap(values, baseUnary(iteratee));
  11495. }
  11496. if (comparator) {
  11497. includes = arrayIncludesWith;
  11498. isCommon = false;
  11499. }
  11500. else if (values.length >= LARGE_ARRAY_SIZE) {
  11501. includes = cacheHas;
  11502. isCommon = false;
  11503. values = new SetCache(values);
  11504. }
  11505. outer:
  11506. while (++index < length) {
  11507. var value = array[index],
  11508. computed = iteratee == null ? value : iteratee(value);
  11509. value = (comparator || value !== 0) ? value : 0;
  11510. if (isCommon && computed === computed) {
  11511. var valuesIndex = valuesLength;
  11512. while (valuesIndex--) {
  11513. if (values[valuesIndex] === computed) {
  11514. continue outer;
  11515. }
  11516. }
  11517. result.push(value);
  11518. }
  11519. else if (!includes(values, computed, comparator)) {
  11520. result.push(value);
  11521. }
  11522. }
  11523. return result;
  11524. }
  11525. /**
  11526. * The base implementation of `_.forEach` without support for iteratee shorthands.
  11527. *
  11528. * @private
  11529. * @param {Array|Object} collection The collection to iterate over.
  11530. * @param {Function} iteratee The function invoked per iteration.
  11531. * @returns {Array|Object} Returns `collection`.
  11532. */
  11533. var baseEach = createBaseEach(baseForOwn);
  11534. /**
  11535. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  11536. *
  11537. * @private
  11538. * @param {Array|Object} collection The collection to iterate over.
  11539. * @param {Function} iteratee The function invoked per iteration.
  11540. * @returns {Array|Object} Returns `collection`.
  11541. */
  11542. var baseEachRight = createBaseEach(baseForOwnRight, true);
  11543. /**
  11544. * The base implementation of `_.every` without support for iteratee shorthands.
  11545. *
  11546. * @private
  11547. * @param {Array|Object} collection The collection to iterate over.
  11548. * @param {Function} predicate The function invoked per iteration.
  11549. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  11550. * else `false`
  11551. */
  11552. function baseEvery(collection, predicate) {
  11553. var result = true;
  11554. baseEach(collection, function(value, index, collection) {
  11555. result = !!predicate(value, index, collection);
  11556. return result;
  11557. });
  11558. return result;
  11559. }
  11560. /**
  11561. * The base implementation of methods like `_.max` and `_.min` which accepts a
  11562. * `comparator` to determine the extremum value.
  11563. *
  11564. * @private
  11565. * @param {Array} array The array to iterate over.
  11566. * @param {Function} iteratee The iteratee invoked per iteration.
  11567. * @param {Function} comparator The comparator used to compare values.
  11568. * @returns {*} Returns the extremum value.
  11569. */
  11570. function baseExtremum(array, iteratee, comparator) {
  11571. var index = -1,
  11572. length = array.length;
  11573. while (++index < length) {
  11574. var value = array[index],
  11575. current = iteratee(value);
  11576. if (current != null && (computed === undefined
  11577. ? (current === current && !isSymbol(current))
  11578. : comparator(current, computed)
  11579. )) {
  11580. var computed = current,
  11581. result = value;
  11582. }
  11583. }
  11584. return result;
  11585. }
  11586. /**
  11587. * The base implementation of `_.fill` without an iteratee call guard.
  11588. *
  11589. * @private
  11590. * @param {Array} array The array to fill.
  11591. * @param {*} value The value to fill `array` with.
  11592. * @param {number} [start=0] The start position.
  11593. * @param {number} [end=array.length] The end position.
  11594. * @returns {Array} Returns `array`.
  11595. */
  11596. function baseFill(array, value, start, end) {
  11597. var length = array.length;
  11598. start = toInteger(start);
  11599. if (start < 0) {
  11600. start = -start > length ? 0 : (length + start);
  11601. }
  11602. end = (end === undefined || end > length) ? length : toInteger(end);
  11603. if (end < 0) {
  11604. end += length;
  11605. }
  11606. end = start > end ? 0 : toLength(end);
  11607. while (start < end) {
  11608. array[start++] = value;
  11609. }
  11610. return array;
  11611. }
  11612. /**
  11613. * The base implementation of `_.filter` without support for iteratee shorthands.
  11614. *
  11615. * @private
  11616. * @param {Array|Object} collection The collection to iterate over.
  11617. * @param {Function} predicate The function invoked per iteration.
  11618. * @returns {Array} Returns the new filtered array.
  11619. */
  11620. function baseFilter(collection, predicate) {
  11621. var result = [];
  11622. baseEach(collection, function(value, index, collection) {
  11623. if (predicate(value, index, collection)) {
  11624. result.push(value);
  11625. }
  11626. });
  11627. return result;
  11628. }
  11629. /**
  11630. * The base implementation of `_.flatten` with support for restricting flattening.
  11631. *
  11632. * @private
  11633. * @param {Array} array The array to flatten.
  11634. * @param {number} depth The maximum recursion depth.
  11635. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  11636. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  11637. * @param {Array} [result=[]] The initial result value.
  11638. * @returns {Array} Returns the new flattened array.
  11639. */
  11640. function baseFlatten(array, depth, predicate, isStrict, result) {
  11641. var index = -1,
  11642. length = array.length;
  11643. predicate || (predicate = isFlattenable);
  11644. result || (result = []);
  11645. while (++index < length) {
  11646. var value = array[index];
  11647. if (depth > 0 && predicate(value)) {
  11648. if (depth > 1) {
  11649. // Recursively flatten arrays (susceptible to call stack limits).
  11650. baseFlatten(value, depth - 1, predicate, isStrict, result);
  11651. } else {
  11652. arrayPush(result, value);
  11653. }
  11654. } else if (!isStrict) {
  11655. result[result.length] = value;
  11656. }
  11657. }
  11658. return result;
  11659. }
  11660. /**
  11661. * The base implementation of `baseForOwn` which iterates over `object`
  11662. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  11663. * Iteratee functions may exit iteration early by explicitly returning `false`.
  11664. *
  11665. * @private
  11666. * @param {Object} object The object to iterate over.
  11667. * @param {Function} iteratee The function invoked per iteration.
  11668. * @param {Function} keysFunc The function to get the keys of `object`.
  11669. * @returns {Object} Returns `object`.
  11670. */
  11671. var baseFor = createBaseFor();
  11672. /**
  11673. * This function is like `baseFor` except that it iterates over properties
  11674. * in the opposite order.
  11675. *
  11676. * @private
  11677. * @param {Object} object The object to iterate over.
  11678. * @param {Function} iteratee The function invoked per iteration.
  11679. * @param {Function} keysFunc The function to get the keys of `object`.
  11680. * @returns {Object} Returns `object`.
  11681. */
  11682. var baseForRight = createBaseFor(true);
  11683. /**
  11684. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  11685. *
  11686. * @private
  11687. * @param {Object} object The object to iterate over.
  11688. * @param {Function} iteratee The function invoked per iteration.
  11689. * @returns {Object} Returns `object`.
  11690. */
  11691. function baseForOwn(object, iteratee) {
  11692. return object && baseFor(object, iteratee, keys);
  11693. }
  11694. /**
  11695. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  11696. *
  11697. * @private
  11698. * @param {Object} object The object to iterate over.
  11699. * @param {Function} iteratee The function invoked per iteration.
  11700. * @returns {Object} Returns `object`.
  11701. */
  11702. function baseForOwnRight(object, iteratee) {
  11703. return object && baseForRight(object, iteratee, keys);
  11704. }
  11705. /**
  11706. * The base implementation of `_.functions` which creates an array of
  11707. * `object` function property names filtered from `props`.
  11708. *
  11709. * @private
  11710. * @param {Object} object The object to inspect.
  11711. * @param {Array} props The property names to filter.
  11712. * @returns {Array} Returns the function names.
  11713. */
  11714. function baseFunctions(object, props) {
  11715. return arrayFilter(props, function(key) {
  11716. return isFunction(object[key]);
  11717. });
  11718. }
  11719. /**
  11720. * The base implementation of `_.get` without support for default values.
  11721. *
  11722. * @private
  11723. * @param {Object} object The object to query.
  11724. * @param {Array|string} path The path of the property to get.
  11725. * @returns {*} Returns the resolved value.
  11726. */
  11727. function baseGet(object, path) {
  11728. path = castPath(path, object);
  11729. var index = 0,
  11730. length = path.length;
  11731. while (object != null && index < length) {
  11732. object = object[toKey(path[index++])];
  11733. }
  11734. return (index && index == length) ? object : undefined;
  11735. }
  11736. /**
  11737. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  11738. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  11739. * symbols of `object`.
  11740. *
  11741. * @private
  11742. * @param {Object} object The object to query.
  11743. * @param {Function} keysFunc The function to get the keys of `object`.
  11744. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  11745. * @returns {Array} Returns the array of property names and symbols.
  11746. */
  11747. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  11748. var result = keysFunc(object);
  11749. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  11750. }
  11751. /**
  11752. * The base implementation of `getTag` without fallbacks for buggy environments.
  11753. *
  11754. * @private
  11755. * @param {*} value The value to query.
  11756. * @returns {string} Returns the `toStringTag`.
  11757. */
  11758. function baseGetTag(value) {
  11759. if (value == null) {
  11760. return value === undefined ? undefinedTag : nullTag;
  11761. }
  11762. return (symToStringTag && symToStringTag in Object(value))
  11763. ? getRawTag(value)
  11764. : objectToString(value);
  11765. }
  11766. /**
  11767. * The base implementation of `_.gt` which doesn't coerce arguments.
  11768. *
  11769. * @private
  11770. * @param {*} value The value to compare.
  11771. * @param {*} other The other value to compare.
  11772. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11773. * else `false`.
  11774. */
  11775. function baseGt(value, other) {
  11776. return value > other;
  11777. }
  11778. /**
  11779. * The base implementation of `_.has` without support for deep paths.
  11780. *
  11781. * @private
  11782. * @param {Object} [object] The object to query.
  11783. * @param {Array|string} key The key to check.
  11784. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  11785. */
  11786. function baseHas(object, key) {
  11787. return object != null && hasOwnProperty.call(object, key);
  11788. }
  11789. /**
  11790. * The base implementation of `_.hasIn` without support for deep paths.
  11791. *
  11792. * @private
  11793. * @param {Object} [object] The object to query.
  11794. * @param {Array|string} key The key to check.
  11795. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  11796. */
  11797. function baseHasIn(object, key) {
  11798. return object != null && key in Object(object);
  11799. }
  11800. /**
  11801. * The base implementation of `_.inRange` which doesn't coerce arguments.
  11802. *
  11803. * @private
  11804. * @param {number} number The number to check.
  11805. * @param {number} start The start of the range.
  11806. * @param {number} end The end of the range.
  11807. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  11808. */
  11809. function baseInRange(number, start, end) {
  11810. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  11811. }
  11812. /**
  11813. * The base implementation of methods like `_.intersection`, without support
  11814. * for iteratee shorthands, that accepts an array of arrays to inspect.
  11815. *
  11816. * @private
  11817. * @param {Array} arrays The arrays to inspect.
  11818. * @param {Function} [iteratee] The iteratee invoked per element.
  11819. * @param {Function} [comparator] The comparator invoked per element.
  11820. * @returns {Array} Returns the new array of shared values.
  11821. */
  11822. function baseIntersection(arrays, iteratee, comparator) {
  11823. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  11824. length = arrays[0].length,
  11825. othLength = arrays.length,
  11826. othIndex = othLength,
  11827. caches = Array(othLength),
  11828. maxLength = Infinity,
  11829. result = [];
  11830. while (othIndex--) {
  11831. var array = arrays[othIndex];
  11832. if (othIndex && iteratee) {
  11833. array = arrayMap(array, baseUnary(iteratee));
  11834. }
  11835. maxLength = nativeMin(array.length, maxLength);
  11836. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  11837. ? new SetCache(othIndex && array)
  11838. : undefined;
  11839. }
  11840. array = arrays[0];
  11841. var index = -1,
  11842. seen = caches[0];
  11843. outer:
  11844. while (++index < length && result.length < maxLength) {
  11845. var value = array[index],
  11846. computed = iteratee ? iteratee(value) : value;
  11847. value = (comparator || value !== 0) ? value : 0;
  11848. if (!(seen
  11849. ? cacheHas(seen, computed)
  11850. : includes(result, computed, comparator)
  11851. )) {
  11852. othIndex = othLength;
  11853. while (--othIndex) {
  11854. var cache = caches[othIndex];
  11855. if (!(cache
  11856. ? cacheHas(cache, computed)
  11857. : includes(arrays[othIndex], computed, comparator))
  11858. ) {
  11859. continue outer;
  11860. }
  11861. }
  11862. if (seen) {
  11863. seen.push(computed);
  11864. }
  11865. result.push(value);
  11866. }
  11867. }
  11868. return result;
  11869. }
  11870. /**
  11871. * The base implementation of `_.invert` and `_.invertBy` which inverts
  11872. * `object` with values transformed by `iteratee` and set by `setter`.
  11873. *
  11874. * @private
  11875. * @param {Object} object The object to iterate over.
  11876. * @param {Function} setter The function to set `accumulator` values.
  11877. * @param {Function} iteratee The iteratee to transform values.
  11878. * @param {Object} accumulator The initial inverted object.
  11879. * @returns {Function} Returns `accumulator`.
  11880. */
  11881. function baseInverter(object, setter, iteratee, accumulator) {
  11882. baseForOwn(object, function(value, key, object) {
  11883. setter(accumulator, iteratee(value), key, object);
  11884. });
  11885. return accumulator;
  11886. }
  11887. /**
  11888. * The base implementation of `_.invoke` without support for individual
  11889. * method arguments.
  11890. *
  11891. * @private
  11892. * @param {Object} object The object to query.
  11893. * @param {Array|string} path The path of the method to invoke.
  11894. * @param {Array} args The arguments to invoke the method with.
  11895. * @returns {*} Returns the result of the invoked method.
  11896. */
  11897. function baseInvoke(object, path, args) {
  11898. path = castPath(path, object);
  11899. object = parent(object, path);
  11900. var func = object == null ? object : object[toKey(last(path))];
  11901. return func == null ? undefined : apply(func, object, args);
  11902. }
  11903. /**
  11904. * The base implementation of `_.isArguments`.
  11905. *
  11906. * @private
  11907. * @param {*} value The value to check.
  11908. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11909. */
  11910. function baseIsArguments(value) {
  11911. return isObjectLike(value) && baseGetTag(value) == argsTag;
  11912. }
  11913. /**
  11914. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  11915. *
  11916. * @private
  11917. * @param {*} value The value to check.
  11918. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  11919. */
  11920. function baseIsArrayBuffer(value) {
  11921. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  11922. }
  11923. /**
  11924. * The base implementation of `_.isDate` without Node.js optimizations.
  11925. *
  11926. * @private
  11927. * @param {*} value The value to check.
  11928. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  11929. */
  11930. function baseIsDate(value) {
  11931. return isObjectLike(value) && baseGetTag(value) == dateTag;
  11932. }
  11933. /**
  11934. * The base implementation of `_.isEqual` which supports partial comparisons
  11935. * and tracks traversed objects.
  11936. *
  11937. * @private
  11938. * @param {*} value The value to compare.
  11939. * @param {*} other The other value to compare.
  11940. * @param {boolean} bitmask The bitmask flags.
  11941. * 1 - Unordered comparison
  11942. * 2 - Partial comparison
  11943. * @param {Function} [customizer] The function to customize comparisons.
  11944. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  11945. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11946. */
  11947. function baseIsEqual(value, other, bitmask, customizer, stack) {
  11948. if (value === other) {
  11949. return true;
  11950. }
  11951. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  11952. return value !== value && other !== other;
  11953. }
  11954. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  11955. }
  11956. /**
  11957. * A specialized version of `baseIsEqual` for arrays and objects which performs
  11958. * deep comparisons and tracks traversed objects enabling objects with circular
  11959. * references to be compared.
  11960. *
  11961. * @private
  11962. * @param {Object} object The object to compare.
  11963. * @param {Object} other The other object to compare.
  11964. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  11965. * @param {Function} customizer The function to customize comparisons.
  11966. * @param {Function} equalFunc The function to determine equivalents of values.
  11967. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  11968. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  11969. */
  11970. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  11971. var objIsArr = isArray(object),
  11972. othIsArr = isArray(other),
  11973. objTag = objIsArr ? arrayTag : getTag(object),
  11974. othTag = othIsArr ? arrayTag : getTag(other);
  11975. objTag = objTag == argsTag ? objectTag : objTag;
  11976. othTag = othTag == argsTag ? objectTag : othTag;
  11977. var objIsObj = objTag == objectTag,
  11978. othIsObj = othTag == objectTag,
  11979. isSameTag = objTag == othTag;
  11980. if (isSameTag && isBuffer(object)) {
  11981. if (!isBuffer(other)) {
  11982. return false;
  11983. }
  11984. objIsArr = true;
  11985. objIsObj = false;
  11986. }
  11987. if (isSameTag && !objIsObj) {
  11988. stack || (stack = new Stack);
  11989. return (objIsArr || isTypedArray(object))
  11990. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  11991. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  11992. }
  11993. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  11994. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  11995. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  11996. if (objIsWrapped || othIsWrapped) {
  11997. var objUnwrapped = objIsWrapped ? object.value() : object,
  11998. othUnwrapped = othIsWrapped ? other.value() : other;
  11999. stack || (stack = new Stack);
  12000. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  12001. }
  12002. }
  12003. if (!isSameTag) {
  12004. return false;
  12005. }
  12006. stack || (stack = new Stack);
  12007. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  12008. }
  12009. /**
  12010. * The base implementation of `_.isMap` without Node.js optimizations.
  12011. *
  12012. * @private
  12013. * @param {*} value The value to check.
  12014. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  12015. */
  12016. function baseIsMap(value) {
  12017. return isObjectLike(value) && getTag(value) == mapTag;
  12018. }
  12019. /**
  12020. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  12021. *
  12022. * @private
  12023. * @param {Object} object The object to inspect.
  12024. * @param {Object} source The object of property values to match.
  12025. * @param {Array} matchData The property names, values, and compare flags to match.
  12026. * @param {Function} [customizer] The function to customize comparisons.
  12027. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12028. */
  12029. function baseIsMatch(object, source, matchData, customizer) {
  12030. var index = matchData.length,
  12031. length = index,
  12032. noCustomizer = !customizer;
  12033. if (object == null) {
  12034. return !length;
  12035. }
  12036. object = Object(object);
  12037. while (index--) {
  12038. var data = matchData[index];
  12039. if ((noCustomizer && data[2])
  12040. ? data[1] !== object[data[0]]
  12041. : !(data[0] in object)
  12042. ) {
  12043. return false;
  12044. }
  12045. }
  12046. while (++index < length) {
  12047. data = matchData[index];
  12048. var key = data[0],
  12049. objValue = object[key],
  12050. srcValue = data[1];
  12051. if (noCustomizer && data[2]) {
  12052. if (objValue === undefined && !(key in object)) {
  12053. return false;
  12054. }
  12055. } else {
  12056. var stack = new Stack;
  12057. if (customizer) {
  12058. var result = customizer(objValue, srcValue, key, object, source, stack);
  12059. }
  12060. if (!(result === undefined
  12061. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  12062. : result
  12063. )) {
  12064. return false;
  12065. }
  12066. }
  12067. }
  12068. return true;
  12069. }
  12070. /**
  12071. * The base implementation of `_.isNative` without bad shim checks.
  12072. *
  12073. * @private
  12074. * @param {*} value The value to check.
  12075. * @returns {boolean} Returns `true` if `value` is a native function,
  12076. * else `false`.
  12077. */
  12078. function baseIsNative(value) {
  12079. if (!isObject(value) || isMasked(value)) {
  12080. return false;
  12081. }
  12082. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  12083. return pattern.test(toSource(value));
  12084. }
  12085. /**
  12086. * The base implementation of `_.isRegExp` without Node.js optimizations.
  12087. *
  12088. * @private
  12089. * @param {*} value The value to check.
  12090. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12091. */
  12092. function baseIsRegExp(value) {
  12093. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  12094. }
  12095. /**
  12096. * The base implementation of `_.isSet` without Node.js optimizations.
  12097. *
  12098. * @private
  12099. * @param {*} value The value to check.
  12100. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12101. */
  12102. function baseIsSet(value) {
  12103. return isObjectLike(value) && getTag(value) == setTag;
  12104. }
  12105. /**
  12106. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  12107. *
  12108. * @private
  12109. * @param {*} value The value to check.
  12110. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12111. */
  12112. function baseIsTypedArray(value) {
  12113. return isObjectLike(value) &&
  12114. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  12115. }
  12116. /**
  12117. * The base implementation of `_.iteratee`.
  12118. *
  12119. * @private
  12120. * @param {*} [value=_.identity] The value to convert to an iteratee.
  12121. * @returns {Function} Returns the iteratee.
  12122. */
  12123. function baseIteratee(value) {
  12124. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  12125. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  12126. if (typeof value == 'function') {
  12127. return value;
  12128. }
  12129. if (value == null) {
  12130. return identity;
  12131. }
  12132. if (typeof value == 'object') {
  12133. return isArray(value)
  12134. ? baseMatchesProperty(value[0], value[1])
  12135. : baseMatches(value);
  12136. }
  12137. return property(value);
  12138. }
  12139. /**
  12140. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  12141. *
  12142. * @private
  12143. * @param {Object} object The object to query.
  12144. * @returns {Array} Returns the array of property names.
  12145. */
  12146. function baseKeys(object) {
  12147. if (!isPrototype(object)) {
  12148. return nativeKeys(object);
  12149. }
  12150. var result = [];
  12151. for (var key in Object(object)) {
  12152. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  12153. result.push(key);
  12154. }
  12155. }
  12156. return result;
  12157. }
  12158. /**
  12159. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  12160. *
  12161. * @private
  12162. * @param {Object} object The object to query.
  12163. * @returns {Array} Returns the array of property names.
  12164. */
  12165. function baseKeysIn(object) {
  12166. if (!isObject(object)) {
  12167. return nativeKeysIn(object);
  12168. }
  12169. var isProto = isPrototype(object),
  12170. result = [];
  12171. for (var key in object) {
  12172. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  12173. result.push(key);
  12174. }
  12175. }
  12176. return result;
  12177. }
  12178. /**
  12179. * The base implementation of `_.lt` which doesn't coerce arguments.
  12180. *
  12181. * @private
  12182. * @param {*} value The value to compare.
  12183. * @param {*} other The other value to compare.
  12184. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12185. * else `false`.
  12186. */
  12187. function baseLt(value, other) {
  12188. return value < other;
  12189. }
  12190. /**
  12191. * The base implementation of `_.map` without support for iteratee shorthands.
  12192. *
  12193. * @private
  12194. * @param {Array|Object} collection The collection to iterate over.
  12195. * @param {Function} iteratee The function invoked per iteration.
  12196. * @returns {Array} Returns the new mapped array.
  12197. */
  12198. function baseMap(collection, iteratee) {
  12199. var index = -1,
  12200. result = isArrayLike(collection) ? Array(collection.length) : [];
  12201. baseEach(collection, function(value, key, collection) {
  12202. result[++index] = iteratee(value, key, collection);
  12203. });
  12204. return result;
  12205. }
  12206. /**
  12207. * The base implementation of `_.matches` which doesn't clone `source`.
  12208. *
  12209. * @private
  12210. * @param {Object} source The object of property values to match.
  12211. * @returns {Function} Returns the new spec function.
  12212. */
  12213. function baseMatches(source) {
  12214. var matchData = getMatchData(source);
  12215. if (matchData.length == 1 && matchData[0][2]) {
  12216. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  12217. }
  12218. return function(object) {
  12219. return object === source || baseIsMatch(object, source, matchData);
  12220. };
  12221. }
  12222. /**
  12223. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  12224. *
  12225. * @private
  12226. * @param {string} path The path of the property to get.
  12227. * @param {*} srcValue The value to match.
  12228. * @returns {Function} Returns the new spec function.
  12229. */
  12230. function baseMatchesProperty(path, srcValue) {
  12231. if (isKey(path) && isStrictComparable(srcValue)) {
  12232. return matchesStrictComparable(toKey(path), srcValue);
  12233. }
  12234. return function(object) {
  12235. var objValue = get(object, path);
  12236. return (objValue === undefined && objValue === srcValue)
  12237. ? hasIn(object, path)
  12238. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  12239. };
  12240. }
  12241. /**
  12242. * The base implementation of `_.merge` without support for multiple sources.
  12243. *
  12244. * @private
  12245. * @param {Object} object The destination object.
  12246. * @param {Object} source The source object.
  12247. * @param {number} srcIndex The index of `source`.
  12248. * @param {Function} [customizer] The function to customize merged values.
  12249. * @param {Object} [stack] Tracks traversed source values and their merged
  12250. * counterparts.
  12251. */
  12252. function baseMerge(object, source, srcIndex, customizer, stack) {
  12253. if (object === source) {
  12254. return;
  12255. }
  12256. baseFor(source, function(srcValue, key) {
  12257. if (isObject(srcValue)) {
  12258. stack || (stack = new Stack);
  12259. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  12260. }
  12261. else {
  12262. var newValue = customizer
  12263. ? customizer(object[key], srcValue, (key + ''), object, source, stack)
  12264. : undefined;
  12265. if (newValue === undefined) {
  12266. newValue = srcValue;
  12267. }
  12268. assignMergeValue(object, key, newValue);
  12269. }
  12270. }, keysIn);
  12271. }
  12272. /**
  12273. * A specialized version of `baseMerge` for arrays and objects which performs
  12274. * deep merges and tracks traversed objects enabling objects with circular
  12275. * references to be merged.
  12276. *
  12277. * @private
  12278. * @param {Object} object The destination object.
  12279. * @param {Object} source The source object.
  12280. * @param {string} key The key of the value to merge.
  12281. * @param {number} srcIndex The index of `source`.
  12282. * @param {Function} mergeFunc The function to merge values.
  12283. * @param {Function} [customizer] The function to customize assigned values.
  12284. * @param {Object} [stack] Tracks traversed source values and their merged
  12285. * counterparts.
  12286. */
  12287. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  12288. var objValue = object[key],
  12289. srcValue = source[key],
  12290. stacked = stack.get(srcValue);
  12291. if (stacked) {
  12292. assignMergeValue(object, key, stacked);
  12293. return;
  12294. }
  12295. var newValue = customizer
  12296. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  12297. : undefined;
  12298. var isCommon = newValue === undefined;
  12299. if (isCommon) {
  12300. var isArr = isArray(srcValue),
  12301. isBuff = !isArr && isBuffer(srcValue),
  12302. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  12303. newValue = srcValue;
  12304. if (isArr || isBuff || isTyped) {
  12305. if (isArray(objValue)) {
  12306. newValue = objValue;
  12307. }
  12308. else if (isArrayLikeObject(objValue)) {
  12309. newValue = copyArray(objValue);
  12310. }
  12311. else if (isBuff) {
  12312. isCommon = false;
  12313. newValue = cloneBuffer(srcValue, true);
  12314. }
  12315. else if (isTyped) {
  12316. isCommon = false;
  12317. newValue = cloneTypedArray(srcValue, true);
  12318. }
  12319. else {
  12320. newValue = [];
  12321. }
  12322. }
  12323. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  12324. newValue = objValue;
  12325. if (isArguments(objValue)) {
  12326. newValue = toPlainObject(objValue);
  12327. }
  12328. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  12329. newValue = initCloneObject(srcValue);
  12330. }
  12331. }
  12332. else {
  12333. isCommon = false;
  12334. }
  12335. }
  12336. if (isCommon) {
  12337. // Recursively merge objects and arrays (susceptible to call stack limits).
  12338. stack.set(srcValue, newValue);
  12339. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  12340. stack['delete'](srcValue);
  12341. }
  12342. assignMergeValue(object, key, newValue);
  12343. }
  12344. /**
  12345. * The base implementation of `_.nth` which doesn't coerce arguments.
  12346. *
  12347. * @private
  12348. * @param {Array} array The array to query.
  12349. * @param {number} n The index of the element to return.
  12350. * @returns {*} Returns the nth element of `array`.
  12351. */
  12352. function baseNth(array, n) {
  12353. var length = array.length;
  12354. if (!length) {
  12355. return;
  12356. }
  12357. n += n < 0 ? length : 0;
  12358. return isIndex(n, length) ? array[n] : undefined;
  12359. }
  12360. /**
  12361. * The base implementation of `_.orderBy` without param guards.
  12362. *
  12363. * @private
  12364. * @param {Array|Object} collection The collection to iterate over.
  12365. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  12366. * @param {string[]} orders The sort orders of `iteratees`.
  12367. * @returns {Array} Returns the new sorted array.
  12368. */
  12369. function baseOrderBy(collection, iteratees, orders) {
  12370. var index = -1;
  12371. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  12372. var result = baseMap(collection, function(value, key, collection) {
  12373. var criteria = arrayMap(iteratees, function(iteratee) {
  12374. return iteratee(value);
  12375. });
  12376. return { 'criteria': criteria, 'index': ++index, 'value': value };
  12377. });
  12378. return baseSortBy(result, function(object, other) {
  12379. return compareMultiple(object, other, orders);
  12380. });
  12381. }
  12382. /**
  12383. * The base implementation of `_.pick` without support for individual
  12384. * property identifiers.
  12385. *
  12386. * @private
  12387. * @param {Object} object The source object.
  12388. * @param {string[]} paths The property paths to pick.
  12389. * @returns {Object} Returns the new object.
  12390. */
  12391. function basePick(object, paths) {
  12392. return basePickBy(object, paths, function(value, path) {
  12393. return hasIn(object, path);
  12394. });
  12395. }
  12396. /**
  12397. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  12398. *
  12399. * @private
  12400. * @param {Object} object The source object.
  12401. * @param {string[]} paths The property paths to pick.
  12402. * @param {Function} predicate The function invoked per property.
  12403. * @returns {Object} Returns the new object.
  12404. */
  12405. function basePickBy(object, paths, predicate) {
  12406. var index = -1,
  12407. length = paths.length,
  12408. result = {};
  12409. while (++index < length) {
  12410. var path = paths[index],
  12411. value = baseGet(object, path);
  12412. if (predicate(value, path)) {
  12413. baseSet(result, castPath(path, object), value);
  12414. }
  12415. }
  12416. return result;
  12417. }
  12418. /**
  12419. * A specialized version of `baseProperty` which supports deep paths.
  12420. *
  12421. * @private
  12422. * @param {Array|string} path The path of the property to get.
  12423. * @returns {Function} Returns the new accessor function.
  12424. */
  12425. function basePropertyDeep(path) {
  12426. return function(object) {
  12427. return baseGet(object, path);
  12428. };
  12429. }
  12430. /**
  12431. * The base implementation of `_.pullAllBy` without support for iteratee
  12432. * shorthands.
  12433. *
  12434. * @private
  12435. * @param {Array} array The array to modify.
  12436. * @param {Array} values The values to remove.
  12437. * @param {Function} [iteratee] The iteratee invoked per element.
  12438. * @param {Function} [comparator] The comparator invoked per element.
  12439. * @returns {Array} Returns `array`.
  12440. */
  12441. function basePullAll(array, values, iteratee, comparator) {
  12442. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  12443. index = -1,
  12444. length = values.length,
  12445. seen = array;
  12446. if (array === values) {
  12447. values = copyArray(values);
  12448. }
  12449. if (iteratee) {
  12450. seen = arrayMap(array, baseUnary(iteratee));
  12451. }
  12452. while (++index < length) {
  12453. var fromIndex = 0,
  12454. value = values[index],
  12455. computed = iteratee ? iteratee(value) : value;
  12456. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  12457. if (seen !== array) {
  12458. splice.call(seen, fromIndex, 1);
  12459. }
  12460. splice.call(array, fromIndex, 1);
  12461. }
  12462. }
  12463. return array;
  12464. }
  12465. /**
  12466. * The base implementation of `_.pullAt` without support for individual
  12467. * indexes or capturing the removed elements.
  12468. *
  12469. * @private
  12470. * @param {Array} array The array to modify.
  12471. * @param {number[]} indexes The indexes of elements to remove.
  12472. * @returns {Array} Returns `array`.
  12473. */
  12474. function basePullAt(array, indexes) {
  12475. var length = array ? indexes.length : 0,
  12476. lastIndex = length - 1;
  12477. while (length--) {
  12478. var index = indexes[length];
  12479. if (length == lastIndex || index !== previous) {
  12480. var previous = index;
  12481. if (isIndex(index)) {
  12482. splice.call(array, index, 1);
  12483. } else {
  12484. baseUnset(array, index);
  12485. }
  12486. }
  12487. }
  12488. return array;
  12489. }
  12490. /**
  12491. * The base implementation of `_.random` without support for returning
  12492. * floating-point numbers.
  12493. *
  12494. * @private
  12495. * @param {number} lower The lower bound.
  12496. * @param {number} upper The upper bound.
  12497. * @returns {number} Returns the random number.
  12498. */
  12499. function baseRandom(lower, upper) {
  12500. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  12501. }
  12502. /**
  12503. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  12504. * coerce arguments.
  12505. *
  12506. * @private
  12507. * @param {number} start The start of the range.
  12508. * @param {number} end The end of the range.
  12509. * @param {number} step The value to increment or decrement by.
  12510. * @param {boolean} [fromRight] Specify iterating from right to left.
  12511. * @returns {Array} Returns the range of numbers.
  12512. */
  12513. function baseRange(start, end, step, fromRight) {
  12514. var index = -1,
  12515. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  12516. result = Array(length);
  12517. while (length--) {
  12518. result[fromRight ? length : ++index] = start;
  12519. start += step;
  12520. }
  12521. return result;
  12522. }
  12523. /**
  12524. * The base implementation of `_.repeat` which doesn't coerce arguments.
  12525. *
  12526. * @private
  12527. * @param {string} string The string to repeat.
  12528. * @param {number} n The number of times to repeat the string.
  12529. * @returns {string} Returns the repeated string.
  12530. */
  12531. function baseRepeat(string, n) {
  12532. var result = '';
  12533. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  12534. return result;
  12535. }
  12536. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  12537. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  12538. do {
  12539. if (n % 2) {
  12540. result += string;
  12541. }
  12542. n = nativeFloor(n / 2);
  12543. if (n) {
  12544. string += string;
  12545. }
  12546. } while (n);
  12547. return result;
  12548. }
  12549. /**
  12550. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  12551. *
  12552. * @private
  12553. * @param {Function} func The function to apply a rest parameter to.
  12554. * @param {number} [start=func.length-1] The start position of the rest parameter.
  12555. * @returns {Function} Returns the new function.
  12556. */
  12557. function baseRest(func, start) {
  12558. return setToString(overRest(func, start, identity), func + '');
  12559. }
  12560. /**
  12561. * The base implementation of `_.sample`.
  12562. *
  12563. * @private
  12564. * @param {Array|Object} collection The collection to sample.
  12565. * @returns {*} Returns the random element.
  12566. */
  12567. function baseSample(collection) {
  12568. return arraySample(values(collection));
  12569. }
  12570. /**
  12571. * The base implementation of `_.sampleSize` without param guards.
  12572. *
  12573. * @private
  12574. * @param {Array|Object} collection The collection to sample.
  12575. * @param {number} n The number of elements to sample.
  12576. * @returns {Array} Returns the random elements.
  12577. */
  12578. function baseSampleSize(collection, n) {
  12579. var array = values(collection);
  12580. return shuffleSelf(array, baseClamp(n, 0, array.length));
  12581. }
  12582. /**
  12583. * The base implementation of `_.set`.
  12584. *
  12585. * @private
  12586. * @param {Object} object The object to modify.
  12587. * @param {Array|string} path The path of the property to set.
  12588. * @param {*} value The value to set.
  12589. * @param {Function} [customizer] The function to customize path creation.
  12590. * @returns {Object} Returns `object`.
  12591. */
  12592. function baseSet(object, path, value, customizer) {
  12593. if (!isObject(object)) {
  12594. return object;
  12595. }
  12596. path = castPath(path, object);
  12597. var index = -1,
  12598. length = path.length,
  12599. lastIndex = length - 1,
  12600. nested = object;
  12601. while (nested != null && ++index < length) {
  12602. var key = toKey(path[index]),
  12603. newValue = value;
  12604. if (index != lastIndex) {
  12605. var objValue = nested[key];
  12606. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  12607. if (newValue === undefined) {
  12608. newValue = isObject(objValue)
  12609. ? objValue
  12610. : (isIndex(path[index + 1]) ? [] : {});
  12611. }
  12612. }
  12613. assignValue(nested, key, newValue);
  12614. nested = nested[key];
  12615. }
  12616. return object;
  12617. }
  12618. /**
  12619. * The base implementation of `setData` without support for hot loop shorting.
  12620. *
  12621. * @private
  12622. * @param {Function} func The function to associate metadata with.
  12623. * @param {*} data The metadata.
  12624. * @returns {Function} Returns `func`.
  12625. */
  12626. var baseSetData = !metaMap ? identity : function(func, data) {
  12627. metaMap.set(func, data);
  12628. return func;
  12629. };
  12630. /**
  12631. * The base implementation of `setToString` without support for hot loop shorting.
  12632. *
  12633. * @private
  12634. * @param {Function} func The function to modify.
  12635. * @param {Function} string The `toString` result.
  12636. * @returns {Function} Returns `func`.
  12637. */
  12638. var baseSetToString = !defineProperty ? identity : function(func, string) {
  12639. return defineProperty(func, 'toString', {
  12640. 'configurable': true,
  12641. 'enumerable': false,
  12642. 'value': constant(string),
  12643. 'writable': true
  12644. });
  12645. };
  12646. /**
  12647. * The base implementation of `_.shuffle`.
  12648. *
  12649. * @private
  12650. * @param {Array|Object} collection The collection to shuffle.
  12651. * @returns {Array} Returns the new shuffled array.
  12652. */
  12653. function baseShuffle(collection) {
  12654. return shuffleSelf(values(collection));
  12655. }
  12656. /**
  12657. * The base implementation of `_.slice` without an iteratee call guard.
  12658. *
  12659. * @private
  12660. * @param {Array} array The array to slice.
  12661. * @param {number} [start=0] The start position.
  12662. * @param {number} [end=array.length] The end position.
  12663. * @returns {Array} Returns the slice of `array`.
  12664. */
  12665. function baseSlice(array, start, end) {
  12666. var index = -1,
  12667. length = array.length;
  12668. if (start < 0) {
  12669. start = -start > length ? 0 : (length + start);
  12670. }
  12671. end = end > length ? length : end;
  12672. if (end < 0) {
  12673. end += length;
  12674. }
  12675. length = start > end ? 0 : ((end - start) >>> 0);
  12676. start >>>= 0;
  12677. var result = Array(length);
  12678. while (++index < length) {
  12679. result[index] = array[index + start];
  12680. }
  12681. return result;
  12682. }
  12683. /**
  12684. * The base implementation of `_.some` without support for iteratee shorthands.
  12685. *
  12686. * @private
  12687. * @param {Array|Object} collection The collection to iterate over.
  12688. * @param {Function} predicate The function invoked per iteration.
  12689. * @returns {boolean} Returns `true` if any element passes the predicate check,
  12690. * else `false`.
  12691. */
  12692. function baseSome(collection, predicate) {
  12693. var result;
  12694. baseEach(collection, function(value, index, collection) {
  12695. result = predicate(value, index, collection);
  12696. return !result;
  12697. });
  12698. return !!result;
  12699. }
  12700. /**
  12701. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  12702. * performs a binary search of `array` to determine the index at which `value`
  12703. * should be inserted into `array` in order to maintain its sort order.
  12704. *
  12705. * @private
  12706. * @param {Array} array The sorted array to inspect.
  12707. * @param {*} value The value to evaluate.
  12708. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  12709. * @returns {number} Returns the index at which `value` should be inserted
  12710. * into `array`.
  12711. */
  12712. function baseSortedIndex(array, value, retHighest) {
  12713. var low = 0,
  12714. high = array == null ? low : array.length;
  12715. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  12716. while (low < high) {
  12717. var mid = (low + high) >>> 1,
  12718. computed = array[mid];
  12719. if (computed !== null && !isSymbol(computed) &&
  12720. (retHighest ? (computed <= value) : (computed < value))) {
  12721. low = mid + 1;
  12722. } else {
  12723. high = mid;
  12724. }
  12725. }
  12726. return high;
  12727. }
  12728. return baseSortedIndexBy(array, value, identity, retHighest);
  12729. }
  12730. /**
  12731. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  12732. * which invokes `iteratee` for `value` and each element of `array` to compute
  12733. * their sort ranking. The iteratee is invoked with one argument; (value).
  12734. *
  12735. * @private
  12736. * @param {Array} array The sorted array to inspect.
  12737. * @param {*} value The value to evaluate.
  12738. * @param {Function} iteratee The iteratee invoked per element.
  12739. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  12740. * @returns {number} Returns the index at which `value` should be inserted
  12741. * into `array`.
  12742. */
  12743. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  12744. value = iteratee(value);
  12745. var low = 0,
  12746. high = array == null ? 0 : array.length,
  12747. valIsNaN = value !== value,
  12748. valIsNull = value === null,
  12749. valIsSymbol = isSymbol(value),
  12750. valIsUndefined = value === undefined;
  12751. while (low < high) {
  12752. var mid = nativeFloor((low + high) / 2),
  12753. computed = iteratee(array[mid]),
  12754. othIsDefined = computed !== undefined,
  12755. othIsNull = computed === null,
  12756. othIsReflexive = computed === computed,
  12757. othIsSymbol = isSymbol(computed);
  12758. if (valIsNaN) {
  12759. var setLow = retHighest || othIsReflexive;
  12760. } else if (valIsUndefined) {
  12761. setLow = othIsReflexive && (retHighest || othIsDefined);
  12762. } else if (valIsNull) {
  12763. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  12764. } else if (valIsSymbol) {
  12765. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  12766. } else if (othIsNull || othIsSymbol) {
  12767. setLow = false;
  12768. } else {
  12769. setLow = retHighest ? (computed <= value) : (computed < value);
  12770. }
  12771. if (setLow) {
  12772. low = mid + 1;
  12773. } else {
  12774. high = mid;
  12775. }
  12776. }
  12777. return nativeMin(high, MAX_ARRAY_INDEX);
  12778. }
  12779. /**
  12780. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  12781. * support for iteratee shorthands.
  12782. *
  12783. * @private
  12784. * @param {Array} array The array to inspect.
  12785. * @param {Function} [iteratee] The iteratee invoked per element.
  12786. * @returns {Array} Returns the new duplicate free array.
  12787. */
  12788. function baseSortedUniq(array, iteratee) {
  12789. var index = -1,
  12790. length = array.length,
  12791. resIndex = 0,
  12792. result = [];
  12793. while (++index < length) {
  12794. var value = array[index],
  12795. computed = iteratee ? iteratee(value) : value;
  12796. if (!index || !eq(computed, seen)) {
  12797. var seen = computed;
  12798. result[resIndex++] = value === 0 ? 0 : value;
  12799. }
  12800. }
  12801. return result;
  12802. }
  12803. /**
  12804. * The base implementation of `_.toNumber` which doesn't ensure correct
  12805. * conversions of binary, hexadecimal, or octal string values.
  12806. *
  12807. * @private
  12808. * @param {*} value The value to process.
  12809. * @returns {number} Returns the number.
  12810. */
  12811. function baseToNumber(value) {
  12812. if (typeof value == 'number') {
  12813. return value;
  12814. }
  12815. if (isSymbol(value)) {
  12816. return NAN;
  12817. }
  12818. return +value;
  12819. }
  12820. /**
  12821. * The base implementation of `_.toString` which doesn't convert nullish
  12822. * values to empty strings.
  12823. *
  12824. * @private
  12825. * @param {*} value The value to process.
  12826. * @returns {string} Returns the string.
  12827. */
  12828. function baseToString(value) {
  12829. // Exit early for strings to avoid a performance hit in some environments.
  12830. if (typeof value == 'string') {
  12831. return value;
  12832. }
  12833. if (isArray(value)) {
  12834. // Recursively convert values (susceptible to call stack limits).
  12835. return arrayMap(value, baseToString) + '';
  12836. }
  12837. if (isSymbol(value)) {
  12838. return symbolToString ? symbolToString.call(value) : '';
  12839. }
  12840. var result = (value + '');
  12841. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  12842. }
  12843. /**
  12844. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  12845. *
  12846. * @private
  12847. * @param {Array} array The array to inspect.
  12848. * @param {Function} [iteratee] The iteratee invoked per element.
  12849. * @param {Function} [comparator] The comparator invoked per element.
  12850. * @returns {Array} Returns the new duplicate free array.
  12851. */
  12852. function baseUniq(array, iteratee, comparator) {
  12853. var index = -1,
  12854. includes = arrayIncludes,
  12855. length = array.length,
  12856. isCommon = true,
  12857. result = [],
  12858. seen = result;
  12859. if (comparator) {
  12860. isCommon = false;
  12861. includes = arrayIncludesWith;
  12862. }
  12863. else if (length >= LARGE_ARRAY_SIZE) {
  12864. var set = iteratee ? null : createSet(array);
  12865. if (set) {
  12866. return setToArray(set);
  12867. }
  12868. isCommon = false;
  12869. includes = cacheHas;
  12870. seen = new SetCache;
  12871. }
  12872. else {
  12873. seen = iteratee ? [] : result;
  12874. }
  12875. outer:
  12876. while (++index < length) {
  12877. var value = array[index],
  12878. computed = iteratee ? iteratee(value) : value;
  12879. value = (comparator || value !== 0) ? value : 0;
  12880. if (isCommon && computed === computed) {
  12881. var seenIndex = seen.length;
  12882. while (seenIndex--) {
  12883. if (seen[seenIndex] === computed) {
  12884. continue outer;
  12885. }
  12886. }
  12887. if (iteratee) {
  12888. seen.push(computed);
  12889. }
  12890. result.push(value);
  12891. }
  12892. else if (!includes(seen, computed, comparator)) {
  12893. if (seen !== result) {
  12894. seen.push(computed);
  12895. }
  12896. result.push(value);
  12897. }
  12898. }
  12899. return result;
  12900. }
  12901. /**
  12902. * The base implementation of `_.unset`.
  12903. *
  12904. * @private
  12905. * @param {Object} object The object to modify.
  12906. * @param {Array|string} path The property path to unset.
  12907. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  12908. */
  12909. function baseUnset(object, path) {
  12910. path = castPath(path, object);
  12911. object = parent(object, path);
  12912. return object == null || delete object[toKey(last(path))];
  12913. }
  12914. /**
  12915. * The base implementation of `_.update`.
  12916. *
  12917. * @private
  12918. * @param {Object} object The object to modify.
  12919. * @param {Array|string} path The path of the property to update.
  12920. * @param {Function} updater The function to produce the updated value.
  12921. * @param {Function} [customizer] The function to customize path creation.
  12922. * @returns {Object} Returns `object`.
  12923. */
  12924. function baseUpdate(object, path, updater, customizer) {
  12925. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  12926. }
  12927. /**
  12928. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  12929. * without support for iteratee shorthands.
  12930. *
  12931. * @private
  12932. * @param {Array} array The array to query.
  12933. * @param {Function} predicate The function invoked per iteration.
  12934. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  12935. * @param {boolean} [fromRight] Specify iterating from right to left.
  12936. * @returns {Array} Returns the slice of `array`.
  12937. */
  12938. function baseWhile(array, predicate, isDrop, fromRight) {
  12939. var length = array.length,
  12940. index = fromRight ? length : -1;
  12941. while ((fromRight ? index-- : ++index < length) &&
  12942. predicate(array[index], index, array)) {}
  12943. return isDrop
  12944. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  12945. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  12946. }
  12947. /**
  12948. * The base implementation of `wrapperValue` which returns the result of
  12949. * performing a sequence of actions on the unwrapped `value`, where each
  12950. * successive action is supplied the return value of the previous.
  12951. *
  12952. * @private
  12953. * @param {*} value The unwrapped value.
  12954. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  12955. * @returns {*} Returns the resolved value.
  12956. */
  12957. function baseWrapperValue(value, actions) {
  12958. var result = value;
  12959. if (result instanceof LazyWrapper) {
  12960. result = result.value();
  12961. }
  12962. return arrayReduce(actions, function(result, action) {
  12963. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  12964. }, result);
  12965. }
  12966. /**
  12967. * The base implementation of methods like `_.xor`, without support for
  12968. * iteratee shorthands, that accepts an array of arrays to inspect.
  12969. *
  12970. * @private
  12971. * @param {Array} arrays The arrays to inspect.
  12972. * @param {Function} [iteratee] The iteratee invoked per element.
  12973. * @param {Function} [comparator] The comparator invoked per element.
  12974. * @returns {Array} Returns the new array of values.
  12975. */
  12976. function baseXor(arrays, iteratee, comparator) {
  12977. var length = arrays.length;
  12978. if (length < 2) {
  12979. return length ? baseUniq(arrays[0]) : [];
  12980. }
  12981. var index = -1,
  12982. result = Array(length);
  12983. while (++index < length) {
  12984. var array = arrays[index],
  12985. othIndex = -1;
  12986. while (++othIndex < length) {
  12987. if (othIndex != index) {
  12988. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  12989. }
  12990. }
  12991. }
  12992. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  12993. }
  12994. /**
  12995. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  12996. *
  12997. * @private
  12998. * @param {Array} props The property identifiers.
  12999. * @param {Array} values The property values.
  13000. * @param {Function} assignFunc The function to assign values.
  13001. * @returns {Object} Returns the new object.
  13002. */
  13003. function baseZipObject(props, values, assignFunc) {
  13004. var index = -1,
  13005. length = props.length,
  13006. valsLength = values.length,
  13007. result = {};
  13008. while (++index < length) {
  13009. var value = index < valsLength ? values[index] : undefined;
  13010. assignFunc(result, props[index], value);
  13011. }
  13012. return result;
  13013. }
  13014. /**
  13015. * Casts `value` to an empty array if it's not an array like object.
  13016. *
  13017. * @private
  13018. * @param {*} value The value to inspect.
  13019. * @returns {Array|Object} Returns the cast array-like object.
  13020. */
  13021. function castArrayLikeObject(value) {
  13022. return isArrayLikeObject(value) ? value : [];
  13023. }
  13024. /**
  13025. * Casts `value` to `identity` if it's not a function.
  13026. *
  13027. * @private
  13028. * @param {*} value The value to inspect.
  13029. * @returns {Function} Returns cast function.
  13030. */
  13031. function castFunction(value) {
  13032. return typeof value == 'function' ? value : identity;
  13033. }
  13034. /**
  13035. * Casts `value` to a path array if it's not one.
  13036. *
  13037. * @private
  13038. * @param {*} value The value to inspect.
  13039. * @param {Object} [object] The object to query keys on.
  13040. * @returns {Array} Returns the cast property path array.
  13041. */
  13042. function castPath(value, object) {
  13043. if (isArray(value)) {
  13044. return value;
  13045. }
  13046. return isKey(value, object) ? [value] : stringToPath(toString(value));
  13047. }
  13048. /**
  13049. * A `baseRest` alias which can be replaced with `identity` by module
  13050. * replacement plugins.
  13051. *
  13052. * @private
  13053. * @type {Function}
  13054. * @param {Function} func The function to apply a rest parameter to.
  13055. * @returns {Function} Returns the new function.
  13056. */
  13057. var castRest = baseRest;
  13058. /**
  13059. * Casts `array` to a slice if it's needed.
  13060. *
  13061. * @private
  13062. * @param {Array} array The array to inspect.
  13063. * @param {number} start The start position.
  13064. * @param {number} [end=array.length] The end position.
  13065. * @returns {Array} Returns the cast slice.
  13066. */
  13067. function castSlice(array, start, end) {
  13068. var length = array.length;
  13069. end = end === undefined ? length : end;
  13070. return (!start && end >= length) ? array : baseSlice(array, start, end);
  13071. }
  13072. /**
  13073. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  13074. *
  13075. * @private
  13076. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  13077. */
  13078. var clearTimeout = ctxClearTimeout || function(id) {
  13079. return root.clearTimeout(id);
  13080. };
  13081. /**
  13082. * Creates a clone of `buffer`.
  13083. *
  13084. * @private
  13085. * @param {Buffer} buffer The buffer to clone.
  13086. * @param {boolean} [isDeep] Specify a deep clone.
  13087. * @returns {Buffer} Returns the cloned buffer.
  13088. */
  13089. function cloneBuffer(buffer, isDeep) {
  13090. if (isDeep) {
  13091. return buffer.slice();
  13092. }
  13093. var length = buffer.length,
  13094. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  13095. buffer.copy(result);
  13096. return result;
  13097. }
  13098. /**
  13099. * Creates a clone of `arrayBuffer`.
  13100. *
  13101. * @private
  13102. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  13103. * @returns {ArrayBuffer} Returns the cloned array buffer.
  13104. */
  13105. function cloneArrayBuffer(arrayBuffer) {
  13106. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  13107. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  13108. return result;
  13109. }
  13110. /**
  13111. * Creates a clone of `dataView`.
  13112. *
  13113. * @private
  13114. * @param {Object} dataView The data view to clone.
  13115. * @param {boolean} [isDeep] Specify a deep clone.
  13116. * @returns {Object} Returns the cloned data view.
  13117. */
  13118. function cloneDataView(dataView, isDeep) {
  13119. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  13120. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  13121. }
  13122. /**
  13123. * Creates a clone of `map`.
  13124. *
  13125. * @private
  13126. * @param {Object} map The map to clone.
  13127. * @param {Function} cloneFunc The function to clone values.
  13128. * @param {boolean} [isDeep] Specify a deep clone.
  13129. * @returns {Object} Returns the cloned map.
  13130. */
  13131. function cloneMap(map, isDeep, cloneFunc) {
  13132. var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
  13133. return arrayReduce(array, addMapEntry, new map.constructor);
  13134. }
  13135. /**
  13136. * Creates a clone of `regexp`.
  13137. *
  13138. * @private
  13139. * @param {Object} regexp The regexp to clone.
  13140. * @returns {Object} Returns the cloned regexp.
  13141. */
  13142. function cloneRegExp(regexp) {
  13143. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  13144. result.lastIndex = regexp.lastIndex;
  13145. return result;
  13146. }
  13147. /**
  13148. * Creates a clone of `set`.
  13149. *
  13150. * @private
  13151. * @param {Object} set The set to clone.
  13152. * @param {Function} cloneFunc The function to clone values.
  13153. * @param {boolean} [isDeep] Specify a deep clone.
  13154. * @returns {Object} Returns the cloned set.
  13155. */
  13156. function cloneSet(set, isDeep, cloneFunc) {
  13157. var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
  13158. return arrayReduce(array, addSetEntry, new set.constructor);
  13159. }
  13160. /**
  13161. * Creates a clone of the `symbol` object.
  13162. *
  13163. * @private
  13164. * @param {Object} symbol The symbol object to clone.
  13165. * @returns {Object} Returns the cloned symbol object.
  13166. */
  13167. function cloneSymbol(symbol) {
  13168. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  13169. }
  13170. /**
  13171. * Creates a clone of `typedArray`.
  13172. *
  13173. * @private
  13174. * @param {Object} typedArray The typed array to clone.
  13175. * @param {boolean} [isDeep] Specify a deep clone.
  13176. * @returns {Object} Returns the cloned typed array.
  13177. */
  13178. function cloneTypedArray(typedArray, isDeep) {
  13179. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  13180. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  13181. }
  13182. /**
  13183. * Compares values to sort them in ascending order.
  13184. *
  13185. * @private
  13186. * @param {*} value The value to compare.
  13187. * @param {*} other The other value to compare.
  13188. * @returns {number} Returns the sort order indicator for `value`.
  13189. */
  13190. function compareAscending(value, other) {
  13191. if (value !== other) {
  13192. var valIsDefined = value !== undefined,
  13193. valIsNull = value === null,
  13194. valIsReflexive = value === value,
  13195. valIsSymbol = isSymbol(value);
  13196. var othIsDefined = other !== undefined,
  13197. othIsNull = other === null,
  13198. othIsReflexive = other === other,
  13199. othIsSymbol = isSymbol(other);
  13200. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  13201. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  13202. (valIsNull && othIsDefined && othIsReflexive) ||
  13203. (!valIsDefined && othIsReflexive) ||
  13204. !valIsReflexive) {
  13205. return 1;
  13206. }
  13207. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  13208. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  13209. (othIsNull && valIsDefined && valIsReflexive) ||
  13210. (!othIsDefined && valIsReflexive) ||
  13211. !othIsReflexive) {
  13212. return -1;
  13213. }
  13214. }
  13215. return 0;
  13216. }
  13217. /**
  13218. * Used by `_.orderBy` to compare multiple properties of a value to another
  13219. * and stable sort them.
  13220. *
  13221. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  13222. * specify an order of "desc" for descending or "asc" for ascending sort order
  13223. * of corresponding values.
  13224. *
  13225. * @private
  13226. * @param {Object} object The object to compare.
  13227. * @param {Object} other The other object to compare.
  13228. * @param {boolean[]|string[]} orders The order to sort by for each property.
  13229. * @returns {number} Returns the sort order indicator for `object`.
  13230. */
  13231. function compareMultiple(object, other, orders) {
  13232. var index = -1,
  13233. objCriteria = object.criteria,
  13234. othCriteria = other.criteria,
  13235. length = objCriteria.length,
  13236. ordersLength = orders.length;
  13237. while (++index < length) {
  13238. var result = compareAscending(objCriteria[index], othCriteria[index]);
  13239. if (result) {
  13240. if (index >= ordersLength) {
  13241. return result;
  13242. }
  13243. var order = orders[index];
  13244. return result * (order == 'desc' ? -1 : 1);
  13245. }
  13246. }
  13247. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  13248. // that causes it, under certain circumstances, to provide the same value for
  13249. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  13250. // for more details.
  13251. //
  13252. // This also ensures a stable sort in V8 and other engines.
  13253. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  13254. return object.index - other.index;
  13255. }
  13256. /**
  13257. * Creates an array that is the composition of partially applied arguments,
  13258. * placeholders, and provided arguments into a single array of arguments.
  13259. *
  13260. * @private
  13261. * @param {Array} args The provided arguments.
  13262. * @param {Array} partials The arguments to prepend to those provided.
  13263. * @param {Array} holders The `partials` placeholder indexes.
  13264. * @params {boolean} [isCurried] Specify composing for a curried function.
  13265. * @returns {Array} Returns the new array of composed arguments.
  13266. */
  13267. function composeArgs(args, partials, holders, isCurried) {
  13268. var argsIndex = -1,
  13269. argsLength = args.length,
  13270. holdersLength = holders.length,
  13271. leftIndex = -1,
  13272. leftLength = partials.length,
  13273. rangeLength = nativeMax(argsLength - holdersLength, 0),
  13274. result = Array(leftLength + rangeLength),
  13275. isUncurried = !isCurried;
  13276. while (++leftIndex < leftLength) {
  13277. result[leftIndex] = partials[leftIndex];
  13278. }
  13279. while (++argsIndex < holdersLength) {
  13280. if (isUncurried || argsIndex < argsLength) {
  13281. result[holders[argsIndex]] = args[argsIndex];
  13282. }
  13283. }
  13284. while (rangeLength--) {
  13285. result[leftIndex++] = args[argsIndex++];
  13286. }
  13287. return result;
  13288. }
  13289. /**
  13290. * This function is like `composeArgs` except that the arguments composition
  13291. * is tailored for `_.partialRight`.
  13292. *
  13293. * @private
  13294. * @param {Array} args The provided arguments.
  13295. * @param {Array} partials The arguments to append to those provided.
  13296. * @param {Array} holders The `partials` placeholder indexes.
  13297. * @params {boolean} [isCurried] Specify composing for a curried function.
  13298. * @returns {Array} Returns the new array of composed arguments.
  13299. */
  13300. function composeArgsRight(args, partials, holders, isCurried) {
  13301. var argsIndex = -1,
  13302. argsLength = args.length,
  13303. holdersIndex = -1,
  13304. holdersLength = holders.length,
  13305. rightIndex = -1,
  13306. rightLength = partials.length,
  13307. rangeLength = nativeMax(argsLength - holdersLength, 0),
  13308. result = Array(rangeLength + rightLength),
  13309. isUncurried = !isCurried;
  13310. while (++argsIndex < rangeLength) {
  13311. result[argsIndex] = args[argsIndex];
  13312. }
  13313. var offset = argsIndex;
  13314. while (++rightIndex < rightLength) {
  13315. result[offset + rightIndex] = partials[rightIndex];
  13316. }
  13317. while (++holdersIndex < holdersLength) {
  13318. if (isUncurried || argsIndex < argsLength) {
  13319. result[offset + holders[holdersIndex]] = args[argsIndex++];
  13320. }
  13321. }
  13322. return result;
  13323. }
  13324. /**
  13325. * Copies the values of `source` to `array`.
  13326. *
  13327. * @private
  13328. * @param {Array} source The array to copy values from.
  13329. * @param {Array} [array=[]] The array to copy values to.
  13330. * @returns {Array} Returns `array`.
  13331. */
  13332. function copyArray(source, array) {
  13333. var index = -1,
  13334. length = source.length;
  13335. array || (array = Array(length));
  13336. while (++index < length) {
  13337. array[index] = source[index];
  13338. }
  13339. return array;
  13340. }
  13341. /**
  13342. * Copies properties of `source` to `object`.
  13343. *
  13344. * @private
  13345. * @param {Object} source The object to copy properties from.
  13346. * @param {Array} props The property identifiers to copy.
  13347. * @param {Object} [object={}] The object to copy properties to.
  13348. * @param {Function} [customizer] The function to customize copied values.
  13349. * @returns {Object} Returns `object`.
  13350. */
  13351. function copyObject(source, props, object, customizer) {
  13352. var isNew = !object;
  13353. object || (object = {});
  13354. var index = -1,
  13355. length = props.length;
  13356. while (++index < length) {
  13357. var key = props[index];
  13358. var newValue = customizer
  13359. ? customizer(object[key], source[key], key, object, source)
  13360. : undefined;
  13361. if (newValue === undefined) {
  13362. newValue = source[key];
  13363. }
  13364. if (isNew) {
  13365. baseAssignValue(object, key, newValue);
  13366. } else {
  13367. assignValue(object, key, newValue);
  13368. }
  13369. }
  13370. return object;
  13371. }
  13372. /**
  13373. * Copies own symbols of `source` to `object`.
  13374. *
  13375. * @private
  13376. * @param {Object} source The object to copy symbols from.
  13377. * @param {Object} [object={}] The object to copy symbols to.
  13378. * @returns {Object} Returns `object`.
  13379. */
  13380. function copySymbols(source, object) {
  13381. return copyObject(source, getSymbols(source), object);
  13382. }
  13383. /**
  13384. * Copies own and inherited symbols of `source` to `object`.
  13385. *
  13386. * @private
  13387. * @param {Object} source The object to copy symbols from.
  13388. * @param {Object} [object={}] The object to copy symbols to.
  13389. * @returns {Object} Returns `object`.
  13390. */
  13391. function copySymbolsIn(source, object) {
  13392. return copyObject(source, getSymbolsIn(source), object);
  13393. }
  13394. /**
  13395. * Creates a function like `_.groupBy`.
  13396. *
  13397. * @private
  13398. * @param {Function} setter The function to set accumulator values.
  13399. * @param {Function} [initializer] The accumulator object initializer.
  13400. * @returns {Function} Returns the new aggregator function.
  13401. */
  13402. function createAggregator(setter, initializer) {
  13403. return function(collection, iteratee) {
  13404. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  13405. accumulator = initializer ? initializer() : {};
  13406. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  13407. };
  13408. }
  13409. /**
  13410. * Creates a function like `_.assign`.
  13411. *
  13412. * @private
  13413. * @param {Function} assigner The function to assign values.
  13414. * @returns {Function} Returns the new assigner function.
  13415. */
  13416. function createAssigner(assigner) {
  13417. return baseRest(function(object, sources) {
  13418. var index = -1,
  13419. length = sources.length,
  13420. customizer = length > 1 ? sources[length - 1] : undefined,
  13421. guard = length > 2 ? sources[2] : undefined;
  13422. customizer = (assigner.length > 3 && typeof customizer == 'function')
  13423. ? (length--, customizer)
  13424. : undefined;
  13425. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  13426. customizer = length < 3 ? undefined : customizer;
  13427. length = 1;
  13428. }
  13429. object = Object(object);
  13430. while (++index < length) {
  13431. var source = sources[index];
  13432. if (source) {
  13433. assigner(object, source, index, customizer);
  13434. }
  13435. }
  13436. return object;
  13437. });
  13438. }
  13439. /**
  13440. * Creates a `baseEach` or `baseEachRight` function.
  13441. *
  13442. * @private
  13443. * @param {Function} eachFunc The function to iterate over a collection.
  13444. * @param {boolean} [fromRight] Specify iterating from right to left.
  13445. * @returns {Function} Returns the new base function.
  13446. */
  13447. function createBaseEach(eachFunc, fromRight) {
  13448. return function(collection, iteratee) {
  13449. if (collection == null) {
  13450. return collection;
  13451. }
  13452. if (!isArrayLike(collection)) {
  13453. return eachFunc(collection, iteratee);
  13454. }
  13455. var length = collection.length,
  13456. index = fromRight ? length : -1,
  13457. iterable = Object(collection);
  13458. while ((fromRight ? index-- : ++index < length)) {
  13459. if (iteratee(iterable[index], index, iterable) === false) {
  13460. break;
  13461. }
  13462. }
  13463. return collection;
  13464. };
  13465. }
  13466. /**
  13467. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  13468. *
  13469. * @private
  13470. * @param {boolean} [fromRight] Specify iterating from right to left.
  13471. * @returns {Function} Returns the new base function.
  13472. */
  13473. function createBaseFor(fromRight) {
  13474. return function(object, iteratee, keysFunc) {
  13475. var index = -1,
  13476. iterable = Object(object),
  13477. props = keysFunc(object),
  13478. length = props.length;
  13479. while (length--) {
  13480. var key = props[fromRight ? length : ++index];
  13481. if (iteratee(iterable[key], key, iterable) === false) {
  13482. break;
  13483. }
  13484. }
  13485. return object;
  13486. };
  13487. }
  13488. /**
  13489. * Creates a function that wraps `func` to invoke it with the optional `this`
  13490. * binding of `thisArg`.
  13491. *
  13492. * @private
  13493. * @param {Function} func The function to wrap.
  13494. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13495. * @param {*} [thisArg] The `this` binding of `func`.
  13496. * @returns {Function} Returns the new wrapped function.
  13497. */
  13498. function createBind(func, bitmask, thisArg) {
  13499. var isBind = bitmask & WRAP_BIND_FLAG,
  13500. Ctor = createCtor(func);
  13501. function wrapper() {
  13502. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  13503. return fn.apply(isBind ? thisArg : this, arguments);
  13504. }
  13505. return wrapper;
  13506. }
  13507. /**
  13508. * Creates a function like `_.lowerFirst`.
  13509. *
  13510. * @private
  13511. * @param {string} methodName The name of the `String` case method to use.
  13512. * @returns {Function} Returns the new case function.
  13513. */
  13514. function createCaseFirst(methodName) {
  13515. return function(string) {
  13516. string = toString(string);
  13517. var strSymbols = hasUnicode(string)
  13518. ? stringToArray(string)
  13519. : undefined;
  13520. var chr = strSymbols
  13521. ? strSymbols[0]
  13522. : string.charAt(0);
  13523. var trailing = strSymbols
  13524. ? castSlice(strSymbols, 1).join('')
  13525. : string.slice(1);
  13526. return chr[methodName]() + trailing;
  13527. };
  13528. }
  13529. /**
  13530. * Creates a function like `_.camelCase`.
  13531. *
  13532. * @private
  13533. * @param {Function} callback The function to combine each word.
  13534. * @returns {Function} Returns the new compounder function.
  13535. */
  13536. function createCompounder(callback) {
  13537. return function(string) {
  13538. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  13539. };
  13540. }
  13541. /**
  13542. * Creates a function that produces an instance of `Ctor` regardless of
  13543. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  13544. *
  13545. * @private
  13546. * @param {Function} Ctor The constructor to wrap.
  13547. * @returns {Function} Returns the new wrapped function.
  13548. */
  13549. function createCtor(Ctor) {
  13550. return function() {
  13551. // Use a `switch` statement to work with class constructors. See
  13552. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  13553. // for more details.
  13554. var args = arguments;
  13555. switch (args.length) {
  13556. case 0: return new Ctor;
  13557. case 1: return new Ctor(args[0]);
  13558. case 2: return new Ctor(args[0], args[1]);
  13559. case 3: return new Ctor(args[0], args[1], args[2]);
  13560. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  13561. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  13562. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  13563. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  13564. }
  13565. var thisBinding = baseCreate(Ctor.prototype),
  13566. result = Ctor.apply(thisBinding, args);
  13567. // Mimic the constructor's `return` behavior.
  13568. // See https://es5.github.io/#x13.2.2 for more details.
  13569. return isObject(result) ? result : thisBinding;
  13570. };
  13571. }
  13572. /**
  13573. * Creates a function that wraps `func` to enable currying.
  13574. *
  13575. * @private
  13576. * @param {Function} func The function to wrap.
  13577. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13578. * @param {number} arity The arity of `func`.
  13579. * @returns {Function} Returns the new wrapped function.
  13580. */
  13581. function createCurry(func, bitmask, arity) {
  13582. var Ctor = createCtor(func);
  13583. function wrapper() {
  13584. var length = arguments.length,
  13585. args = Array(length),
  13586. index = length,
  13587. placeholder = getHolder(wrapper);
  13588. while (index--) {
  13589. args[index] = arguments[index];
  13590. }
  13591. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  13592. ? []
  13593. : replaceHolders(args, placeholder);
  13594. length -= holders.length;
  13595. if (length < arity) {
  13596. return createRecurry(
  13597. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  13598. args, holders, undefined, undefined, arity - length);
  13599. }
  13600. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  13601. return apply(fn, this, args);
  13602. }
  13603. return wrapper;
  13604. }
  13605. /**
  13606. * Creates a `_.find` or `_.findLast` function.
  13607. *
  13608. * @private
  13609. * @param {Function} findIndexFunc The function to find the collection index.
  13610. * @returns {Function} Returns the new find function.
  13611. */
  13612. function createFind(findIndexFunc) {
  13613. return function(collection, predicate, fromIndex) {
  13614. var iterable = Object(collection);
  13615. if (!isArrayLike(collection)) {
  13616. var iteratee = getIteratee(predicate, 3);
  13617. collection = keys(collection);
  13618. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  13619. }
  13620. var index = findIndexFunc(collection, predicate, fromIndex);
  13621. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  13622. };
  13623. }
  13624. /**
  13625. * Creates a `_.flow` or `_.flowRight` function.
  13626. *
  13627. * @private
  13628. * @param {boolean} [fromRight] Specify iterating from right to left.
  13629. * @returns {Function} Returns the new flow function.
  13630. */
  13631. function createFlow(fromRight) {
  13632. return flatRest(function(funcs) {
  13633. var length = funcs.length,
  13634. index = length,
  13635. prereq = LodashWrapper.prototype.thru;
  13636. if (fromRight) {
  13637. funcs.reverse();
  13638. }
  13639. while (index--) {
  13640. var func = funcs[index];
  13641. if (typeof func != 'function') {
  13642. throw new TypeError(FUNC_ERROR_TEXT);
  13643. }
  13644. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  13645. var wrapper = new LodashWrapper([], true);
  13646. }
  13647. }
  13648. index = wrapper ? index : length;
  13649. while (++index < length) {
  13650. func = funcs[index];
  13651. var funcName = getFuncName(func),
  13652. data = funcName == 'wrapper' ? getData(func) : undefined;
  13653. if (data && isLaziable(data[0]) &&
  13654. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  13655. !data[4].length && data[9] == 1
  13656. ) {
  13657. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  13658. } else {
  13659. wrapper = (func.length == 1 && isLaziable(func))
  13660. ? wrapper[funcName]()
  13661. : wrapper.thru(func);
  13662. }
  13663. }
  13664. return function() {
  13665. var args = arguments,
  13666. value = args[0];
  13667. if (wrapper && args.length == 1 && isArray(value)) {
  13668. return wrapper.plant(value).value();
  13669. }
  13670. var index = 0,
  13671. result = length ? funcs[index].apply(this, args) : value;
  13672. while (++index < length) {
  13673. result = funcs[index].call(this, result);
  13674. }
  13675. return result;
  13676. };
  13677. });
  13678. }
  13679. /**
  13680. * Creates a function that wraps `func` to invoke it with optional `this`
  13681. * binding of `thisArg`, partial application, and currying.
  13682. *
  13683. * @private
  13684. * @param {Function|string} func The function or method name to wrap.
  13685. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13686. * @param {*} [thisArg] The `this` binding of `func`.
  13687. * @param {Array} [partials] The arguments to prepend to those provided to
  13688. * the new function.
  13689. * @param {Array} [holders] The `partials` placeholder indexes.
  13690. * @param {Array} [partialsRight] The arguments to append to those provided
  13691. * to the new function.
  13692. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  13693. * @param {Array} [argPos] The argument positions of the new function.
  13694. * @param {number} [ary] The arity cap of `func`.
  13695. * @param {number} [arity] The arity of `func`.
  13696. * @returns {Function} Returns the new wrapped function.
  13697. */
  13698. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  13699. var isAry = bitmask & WRAP_ARY_FLAG,
  13700. isBind = bitmask & WRAP_BIND_FLAG,
  13701. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  13702. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  13703. isFlip = bitmask & WRAP_FLIP_FLAG,
  13704. Ctor = isBindKey ? undefined : createCtor(func);
  13705. function wrapper() {
  13706. var length = arguments.length,
  13707. args = Array(length),
  13708. index = length;
  13709. while (index--) {
  13710. args[index] = arguments[index];
  13711. }
  13712. if (isCurried) {
  13713. var placeholder = getHolder(wrapper),
  13714. holdersCount = countHolders(args, placeholder);
  13715. }
  13716. if (partials) {
  13717. args = composeArgs(args, partials, holders, isCurried);
  13718. }
  13719. if (partialsRight) {
  13720. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  13721. }
  13722. length -= holdersCount;
  13723. if (isCurried && length < arity) {
  13724. var newHolders = replaceHolders(args, placeholder);
  13725. return createRecurry(
  13726. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  13727. args, newHolders, argPos, ary, arity - length
  13728. );
  13729. }
  13730. var thisBinding = isBind ? thisArg : this,
  13731. fn = isBindKey ? thisBinding[func] : func;
  13732. length = args.length;
  13733. if (argPos) {
  13734. args = reorder(args, argPos);
  13735. } else if (isFlip && length > 1) {
  13736. args.reverse();
  13737. }
  13738. if (isAry && ary < length) {
  13739. args.length = ary;
  13740. }
  13741. if (this && this !== root && this instanceof wrapper) {
  13742. fn = Ctor || createCtor(fn);
  13743. }
  13744. return fn.apply(thisBinding, args);
  13745. }
  13746. return wrapper;
  13747. }
  13748. /**
  13749. * Creates a function like `_.invertBy`.
  13750. *
  13751. * @private
  13752. * @param {Function} setter The function to set accumulator values.
  13753. * @param {Function} toIteratee The function to resolve iteratees.
  13754. * @returns {Function} Returns the new inverter function.
  13755. */
  13756. function createInverter(setter, toIteratee) {
  13757. return function(object, iteratee) {
  13758. return baseInverter(object, setter, toIteratee(iteratee), {});
  13759. };
  13760. }
  13761. /**
  13762. * Creates a function that performs a mathematical operation on two values.
  13763. *
  13764. * @private
  13765. * @param {Function} operator The function to perform the operation.
  13766. * @param {number} [defaultValue] The value used for `undefined` arguments.
  13767. * @returns {Function} Returns the new mathematical operation function.
  13768. */
  13769. function createMathOperation(operator, defaultValue) {
  13770. return function(value, other) {
  13771. var result;
  13772. if (value === undefined && other === undefined) {
  13773. return defaultValue;
  13774. }
  13775. if (value !== undefined) {
  13776. result = value;
  13777. }
  13778. if (other !== undefined) {
  13779. if (result === undefined) {
  13780. return other;
  13781. }
  13782. if (typeof value == 'string' || typeof other == 'string') {
  13783. value = baseToString(value);
  13784. other = baseToString(other);
  13785. } else {
  13786. value = baseToNumber(value);
  13787. other = baseToNumber(other);
  13788. }
  13789. result = operator(value, other);
  13790. }
  13791. return result;
  13792. };
  13793. }
  13794. /**
  13795. * Creates a function like `_.over`.
  13796. *
  13797. * @private
  13798. * @param {Function} arrayFunc The function to iterate over iteratees.
  13799. * @returns {Function} Returns the new over function.
  13800. */
  13801. function createOver(arrayFunc) {
  13802. return flatRest(function(iteratees) {
  13803. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  13804. return baseRest(function(args) {
  13805. var thisArg = this;
  13806. return arrayFunc(iteratees, function(iteratee) {
  13807. return apply(iteratee, thisArg, args);
  13808. });
  13809. });
  13810. });
  13811. }
  13812. /**
  13813. * Creates the padding for `string` based on `length`. The `chars` string
  13814. * is truncated if the number of characters exceeds `length`.
  13815. *
  13816. * @private
  13817. * @param {number} length The padding length.
  13818. * @param {string} [chars=' '] The string used as padding.
  13819. * @returns {string} Returns the padding for `string`.
  13820. */
  13821. function createPadding(length, chars) {
  13822. chars = chars === undefined ? ' ' : baseToString(chars);
  13823. var charsLength = chars.length;
  13824. if (charsLength < 2) {
  13825. return charsLength ? baseRepeat(chars, length) : chars;
  13826. }
  13827. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  13828. return hasUnicode(chars)
  13829. ? castSlice(stringToArray(result), 0, length).join('')
  13830. : result.slice(0, length);
  13831. }
  13832. /**
  13833. * Creates a function that wraps `func` to invoke it with the `this` binding
  13834. * of `thisArg` and `partials` prepended to the arguments it receives.
  13835. *
  13836. * @private
  13837. * @param {Function} func The function to wrap.
  13838. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13839. * @param {*} thisArg The `this` binding of `func`.
  13840. * @param {Array} partials The arguments to prepend to those provided to
  13841. * the new function.
  13842. * @returns {Function} Returns the new wrapped function.
  13843. */
  13844. function createPartial(func, bitmask, thisArg, partials) {
  13845. var isBind = bitmask & WRAP_BIND_FLAG,
  13846. Ctor = createCtor(func);
  13847. function wrapper() {
  13848. var argsIndex = -1,
  13849. argsLength = arguments.length,
  13850. leftIndex = -1,
  13851. leftLength = partials.length,
  13852. args = Array(leftLength + argsLength),
  13853. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  13854. while (++leftIndex < leftLength) {
  13855. args[leftIndex] = partials[leftIndex];
  13856. }
  13857. while (argsLength--) {
  13858. args[leftIndex++] = arguments[++argsIndex];
  13859. }
  13860. return apply(fn, isBind ? thisArg : this, args);
  13861. }
  13862. return wrapper;
  13863. }
  13864. /**
  13865. * Creates a `_.range` or `_.rangeRight` function.
  13866. *
  13867. * @private
  13868. * @param {boolean} [fromRight] Specify iterating from right to left.
  13869. * @returns {Function} Returns the new range function.
  13870. */
  13871. function createRange(fromRight) {
  13872. return function(start, end, step) {
  13873. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  13874. end = step = undefined;
  13875. }
  13876. // Ensure the sign of `-0` is preserved.
  13877. start = toFinite(start);
  13878. if (end === undefined) {
  13879. end = start;
  13880. start = 0;
  13881. } else {
  13882. end = toFinite(end);
  13883. }
  13884. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  13885. return baseRange(start, end, step, fromRight);
  13886. };
  13887. }
  13888. /**
  13889. * Creates a function that performs a relational operation on two values.
  13890. *
  13891. * @private
  13892. * @param {Function} operator The function to perform the operation.
  13893. * @returns {Function} Returns the new relational operation function.
  13894. */
  13895. function createRelationalOperation(operator) {
  13896. return function(value, other) {
  13897. if (!(typeof value == 'string' && typeof other == 'string')) {
  13898. value = toNumber(value);
  13899. other = toNumber(other);
  13900. }
  13901. return operator(value, other);
  13902. };
  13903. }
  13904. /**
  13905. * Creates a function that wraps `func` to continue currying.
  13906. *
  13907. * @private
  13908. * @param {Function} func The function to wrap.
  13909. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  13910. * @param {Function} wrapFunc The function to create the `func` wrapper.
  13911. * @param {*} placeholder The placeholder value.
  13912. * @param {*} [thisArg] The `this` binding of `func`.
  13913. * @param {Array} [partials] The arguments to prepend to those provided to
  13914. * the new function.
  13915. * @param {Array} [holders] The `partials` placeholder indexes.
  13916. * @param {Array} [argPos] The argument positions of the new function.
  13917. * @param {number} [ary] The arity cap of `func`.
  13918. * @param {number} [arity] The arity of `func`.
  13919. * @returns {Function} Returns the new wrapped function.
  13920. */
  13921. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  13922. var isCurry = bitmask & WRAP_CURRY_FLAG,
  13923. newHolders = isCurry ? holders : undefined,
  13924. newHoldersRight = isCurry ? undefined : holders,
  13925. newPartials = isCurry ? partials : undefined,
  13926. newPartialsRight = isCurry ? undefined : partials;
  13927. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  13928. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  13929. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  13930. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  13931. }
  13932. var newData = [
  13933. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  13934. newHoldersRight, argPos, ary, arity
  13935. ];
  13936. var result = wrapFunc.apply(undefined, newData);
  13937. if (isLaziable(func)) {
  13938. setData(result, newData);
  13939. }
  13940. result.placeholder = placeholder;
  13941. return setWrapToString(result, func, bitmask);
  13942. }
  13943. /**
  13944. * Creates a function like `_.round`.
  13945. *
  13946. * @private
  13947. * @param {string} methodName The name of the `Math` method to use when rounding.
  13948. * @returns {Function} Returns the new round function.
  13949. */
  13950. function createRound(methodName) {
  13951. var func = Math[methodName];
  13952. return function(number, precision) {
  13953. number = toNumber(number);
  13954. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  13955. if (precision) {
  13956. // Shift with exponential notation to avoid floating-point issues.
  13957. // See [MDN](https://mdn.io/round#Examples) for more details.
  13958. var pair = (toString(number) + 'e').split('e'),
  13959. value = func(pair[0] + 'e' + (+pair[1] + precision));
  13960. pair = (toString(value) + 'e').split('e');
  13961. return +(pair[0] + 'e' + (+pair[1] - precision));
  13962. }
  13963. return func(number);
  13964. };
  13965. }
  13966. /**
  13967. * Creates a set object of `values`.
  13968. *
  13969. * @private
  13970. * @param {Array} values The values to add to the set.
  13971. * @returns {Object} Returns the new set.
  13972. */
  13973. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  13974. return new Set(values);
  13975. };
  13976. /**
  13977. * Creates a `_.toPairs` or `_.toPairsIn` function.
  13978. *
  13979. * @private
  13980. * @param {Function} keysFunc The function to get the keys of a given object.
  13981. * @returns {Function} Returns the new pairs function.
  13982. */
  13983. function createToPairs(keysFunc) {
  13984. return function(object) {
  13985. var tag = getTag(object);
  13986. if (tag == mapTag) {
  13987. return mapToArray(object);
  13988. }
  13989. if (tag == setTag) {
  13990. return setToPairs(object);
  13991. }
  13992. return baseToPairs(object, keysFunc(object));
  13993. };
  13994. }
  13995. /**
  13996. * Creates a function that either curries or invokes `func` with optional
  13997. * `this` binding and partially applied arguments.
  13998. *
  13999. * @private
  14000. * @param {Function|string} func The function or method name to wrap.
  14001. * @param {number} bitmask The bitmask flags.
  14002. * 1 - `_.bind`
  14003. * 2 - `_.bindKey`
  14004. * 4 - `_.curry` or `_.curryRight` of a bound function
  14005. * 8 - `_.curry`
  14006. * 16 - `_.curryRight`
  14007. * 32 - `_.partial`
  14008. * 64 - `_.partialRight`
  14009. * 128 - `_.rearg`
  14010. * 256 - `_.ary`
  14011. * 512 - `_.flip`
  14012. * @param {*} [thisArg] The `this` binding of `func`.
  14013. * @param {Array} [partials] The arguments to be partially applied.
  14014. * @param {Array} [holders] The `partials` placeholder indexes.
  14015. * @param {Array} [argPos] The argument positions of the new function.
  14016. * @param {number} [ary] The arity cap of `func`.
  14017. * @param {number} [arity] The arity of `func`.
  14018. * @returns {Function} Returns the new wrapped function.
  14019. */
  14020. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  14021. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  14022. if (!isBindKey && typeof func != 'function') {
  14023. throw new TypeError(FUNC_ERROR_TEXT);
  14024. }
  14025. var length = partials ? partials.length : 0;
  14026. if (!length) {
  14027. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  14028. partials = holders = undefined;
  14029. }
  14030. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  14031. arity = arity === undefined ? arity : toInteger(arity);
  14032. length -= holders ? holders.length : 0;
  14033. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  14034. var partialsRight = partials,
  14035. holdersRight = holders;
  14036. partials = holders = undefined;
  14037. }
  14038. var data = isBindKey ? undefined : getData(func);
  14039. var newData = [
  14040. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  14041. argPos, ary, arity
  14042. ];
  14043. if (data) {
  14044. mergeData(newData, data);
  14045. }
  14046. func = newData[0];
  14047. bitmask = newData[1];
  14048. thisArg = newData[2];
  14049. partials = newData[3];
  14050. holders = newData[4];
  14051. arity = newData[9] = newData[9] === undefined
  14052. ? (isBindKey ? 0 : func.length)
  14053. : nativeMax(newData[9] - length, 0);
  14054. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  14055. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  14056. }
  14057. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  14058. var result = createBind(func, bitmask, thisArg);
  14059. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  14060. result = createCurry(func, bitmask, arity);
  14061. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  14062. result = createPartial(func, bitmask, thisArg, partials);
  14063. } else {
  14064. result = createHybrid.apply(undefined, newData);
  14065. }
  14066. var setter = data ? baseSetData : setData;
  14067. return setWrapToString(setter(result, newData), func, bitmask);
  14068. }
  14069. /**
  14070. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  14071. * of source objects to the destination object for all destination properties
  14072. * that resolve to `undefined`.
  14073. *
  14074. * @private
  14075. * @param {*} objValue The destination value.
  14076. * @param {*} srcValue The source value.
  14077. * @param {string} key The key of the property to assign.
  14078. * @param {Object} object The parent object of `objValue`.
  14079. * @returns {*} Returns the value to assign.
  14080. */
  14081. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  14082. if (objValue === undefined ||
  14083. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  14084. return srcValue;
  14085. }
  14086. return objValue;
  14087. }
  14088. /**
  14089. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  14090. * objects into destination objects that are passed thru.
  14091. *
  14092. * @private
  14093. * @param {*} objValue The destination value.
  14094. * @param {*} srcValue The source value.
  14095. * @param {string} key The key of the property to merge.
  14096. * @param {Object} object The parent object of `objValue`.
  14097. * @param {Object} source The parent object of `srcValue`.
  14098. * @param {Object} [stack] Tracks traversed source values and their merged
  14099. * counterparts.
  14100. * @returns {*} Returns the value to assign.
  14101. */
  14102. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  14103. if (isObject(objValue) && isObject(srcValue)) {
  14104. // Recursively merge objects and arrays (susceptible to call stack limits).
  14105. stack.set(srcValue, objValue);
  14106. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  14107. stack['delete'](srcValue);
  14108. }
  14109. return objValue;
  14110. }
  14111. /**
  14112. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  14113. * objects.
  14114. *
  14115. * @private
  14116. * @param {*} value The value to inspect.
  14117. * @param {string} key The key of the property to inspect.
  14118. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  14119. */
  14120. function customOmitClone(value) {
  14121. return isPlainObject(value) ? undefined : value;
  14122. }
  14123. /**
  14124. * A specialized version of `baseIsEqualDeep` for arrays with support for
  14125. * partial deep comparisons.
  14126. *
  14127. * @private
  14128. * @param {Array} array The array to compare.
  14129. * @param {Array} other The other array to compare.
  14130. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  14131. * @param {Function} customizer The function to customize comparisons.
  14132. * @param {Function} equalFunc The function to determine equivalents of values.
  14133. * @param {Object} stack Tracks traversed `array` and `other` objects.
  14134. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  14135. */
  14136. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  14137. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  14138. arrLength = array.length,
  14139. othLength = other.length;
  14140. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  14141. return false;
  14142. }
  14143. // Assume cyclic values are equal.
  14144. var stacked = stack.get(array);
  14145. if (stacked && stack.get(other)) {
  14146. return stacked == other;
  14147. }
  14148. var index = -1,
  14149. result = true,
  14150. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  14151. stack.set(array, other);
  14152. stack.set(other, array);
  14153. // Ignore non-index properties.
  14154. while (++index < arrLength) {
  14155. var arrValue = array[index],
  14156. othValue = other[index];
  14157. if (customizer) {
  14158. var compared = isPartial
  14159. ? customizer(othValue, arrValue, index, other, array, stack)
  14160. : customizer(arrValue, othValue, index, array, other, stack);
  14161. }
  14162. if (compared !== undefined) {
  14163. if (compared) {
  14164. continue;
  14165. }
  14166. result = false;
  14167. break;
  14168. }
  14169. // Recursively compare arrays (susceptible to call stack limits).
  14170. if (seen) {
  14171. if (!arraySome(other, function(othValue, othIndex) {
  14172. if (!cacheHas(seen, othIndex) &&
  14173. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  14174. return seen.push(othIndex);
  14175. }
  14176. })) {
  14177. result = false;
  14178. break;
  14179. }
  14180. } else if (!(
  14181. arrValue === othValue ||
  14182. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  14183. )) {
  14184. result = false;
  14185. break;
  14186. }
  14187. }
  14188. stack['delete'](array);
  14189. stack['delete'](other);
  14190. return result;
  14191. }
  14192. /**
  14193. * A specialized version of `baseIsEqualDeep` for comparing objects of
  14194. * the same `toStringTag`.
  14195. *
  14196. * **Note:** This function only supports comparing values with tags of
  14197. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  14198. *
  14199. * @private
  14200. * @param {Object} object The object to compare.
  14201. * @param {Object} other The other object to compare.
  14202. * @param {string} tag The `toStringTag` of the objects to compare.
  14203. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  14204. * @param {Function} customizer The function to customize comparisons.
  14205. * @param {Function} equalFunc The function to determine equivalents of values.
  14206. * @param {Object} stack Tracks traversed `object` and `other` objects.
  14207. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  14208. */
  14209. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  14210. switch (tag) {
  14211. case dataViewTag:
  14212. if ((object.byteLength != other.byteLength) ||
  14213. (object.byteOffset != other.byteOffset)) {
  14214. return false;
  14215. }
  14216. object = object.buffer;
  14217. other = other.buffer;
  14218. case arrayBufferTag:
  14219. if ((object.byteLength != other.byteLength) ||
  14220. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  14221. return false;
  14222. }
  14223. return true;
  14224. case boolTag:
  14225. case dateTag:
  14226. case numberTag:
  14227. // Coerce booleans to `1` or `0` and dates to milliseconds.
  14228. // Invalid dates are coerced to `NaN`.
  14229. return eq(+object, +other);
  14230. case errorTag:
  14231. return object.name == other.name && object.message == other.message;
  14232. case regexpTag:
  14233. case stringTag:
  14234. // Coerce regexes to strings and treat strings, primitives and objects,
  14235. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  14236. // for more details.
  14237. return object == (other + '');
  14238. case mapTag:
  14239. var convert = mapToArray;
  14240. case setTag:
  14241. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  14242. convert || (convert = setToArray);
  14243. if (object.size != other.size && !isPartial) {
  14244. return false;
  14245. }
  14246. // Assume cyclic values are equal.
  14247. var stacked = stack.get(object);
  14248. if (stacked) {
  14249. return stacked == other;
  14250. }
  14251. bitmask |= COMPARE_UNORDERED_FLAG;
  14252. // Recursively compare objects (susceptible to call stack limits).
  14253. stack.set(object, other);
  14254. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  14255. stack['delete'](object);
  14256. return result;
  14257. case symbolTag:
  14258. if (symbolValueOf) {
  14259. return symbolValueOf.call(object) == symbolValueOf.call(other);
  14260. }
  14261. }
  14262. return false;
  14263. }
  14264. /**
  14265. * A specialized version of `baseIsEqualDeep` for objects with support for
  14266. * partial deep comparisons.
  14267. *
  14268. * @private
  14269. * @param {Object} object The object to compare.
  14270. * @param {Object} other The other object to compare.
  14271. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  14272. * @param {Function} customizer The function to customize comparisons.
  14273. * @param {Function} equalFunc The function to determine equivalents of values.
  14274. * @param {Object} stack Tracks traversed `object` and `other` objects.
  14275. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  14276. */
  14277. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  14278. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  14279. objProps = getAllKeys(object),
  14280. objLength = objProps.length,
  14281. othProps = getAllKeys(other),
  14282. othLength = othProps.length;
  14283. if (objLength != othLength && !isPartial) {
  14284. return false;
  14285. }
  14286. var index = objLength;
  14287. while (index--) {
  14288. var key = objProps[index];
  14289. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  14290. return false;
  14291. }
  14292. }
  14293. // Assume cyclic values are equal.
  14294. var stacked = stack.get(object);
  14295. if (stacked && stack.get(other)) {
  14296. return stacked == other;
  14297. }
  14298. var result = true;
  14299. stack.set(object, other);
  14300. stack.set(other, object);
  14301. var skipCtor = isPartial;
  14302. while (++index < objLength) {
  14303. key = objProps[index];
  14304. var objValue = object[key],
  14305. othValue = other[key];
  14306. if (customizer) {
  14307. var compared = isPartial
  14308. ? customizer(othValue, objValue, key, other, object, stack)
  14309. : customizer(objValue, othValue, key, object, other, stack);
  14310. }
  14311. // Recursively compare objects (susceptible to call stack limits).
  14312. if (!(compared === undefined
  14313. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  14314. : compared
  14315. )) {
  14316. result = false;
  14317. break;
  14318. }
  14319. skipCtor || (skipCtor = key == 'constructor');
  14320. }
  14321. if (result && !skipCtor) {
  14322. var objCtor = object.constructor,
  14323. othCtor = other.constructor;
  14324. // Non `Object` object instances with different constructors are not equal.
  14325. if (objCtor != othCtor &&
  14326. ('constructor' in object && 'constructor' in other) &&
  14327. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  14328. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  14329. result = false;
  14330. }
  14331. }
  14332. stack['delete'](object);
  14333. stack['delete'](other);
  14334. return result;
  14335. }
  14336. /**
  14337. * A specialized version of `baseRest` which flattens the rest array.
  14338. *
  14339. * @private
  14340. * @param {Function} func The function to apply a rest parameter to.
  14341. * @returns {Function} Returns the new function.
  14342. */
  14343. function flatRest(func) {
  14344. return setToString(overRest(func, undefined, flatten), func + '');
  14345. }
  14346. /**
  14347. * Creates an array of own enumerable property names and symbols of `object`.
  14348. *
  14349. * @private
  14350. * @param {Object} object The object to query.
  14351. * @returns {Array} Returns the array of property names and symbols.
  14352. */
  14353. function getAllKeys(object) {
  14354. return baseGetAllKeys(object, keys, getSymbols);
  14355. }
  14356. /**
  14357. * Creates an array of own and inherited enumerable property names and
  14358. * symbols of `object`.
  14359. *
  14360. * @private
  14361. * @param {Object} object The object to query.
  14362. * @returns {Array} Returns the array of property names and symbols.
  14363. */
  14364. function getAllKeysIn(object) {
  14365. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  14366. }
  14367. /**
  14368. * Gets metadata for `func`.
  14369. *
  14370. * @private
  14371. * @param {Function} func The function to query.
  14372. * @returns {*} Returns the metadata for `func`.
  14373. */
  14374. var getData = !metaMap ? noop : function(func) {
  14375. return metaMap.get(func);
  14376. };
  14377. /**
  14378. * Gets the name of `func`.
  14379. *
  14380. * @private
  14381. * @param {Function} func The function to query.
  14382. * @returns {string} Returns the function name.
  14383. */
  14384. function getFuncName(func) {
  14385. var result = (func.name + ''),
  14386. array = realNames[result],
  14387. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  14388. while (length--) {
  14389. var data = array[length],
  14390. otherFunc = data.func;
  14391. if (otherFunc == null || otherFunc == func) {
  14392. return data.name;
  14393. }
  14394. }
  14395. return result;
  14396. }
  14397. /**
  14398. * Gets the argument placeholder value for `func`.
  14399. *
  14400. * @private
  14401. * @param {Function} func The function to inspect.
  14402. * @returns {*} Returns the placeholder value.
  14403. */
  14404. function getHolder(func) {
  14405. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  14406. return object.placeholder;
  14407. }
  14408. /**
  14409. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  14410. * this function returns the custom method, otherwise it returns `baseIteratee`.
  14411. * If arguments are provided, the chosen function is invoked with them and
  14412. * its result is returned.
  14413. *
  14414. * @private
  14415. * @param {*} [value] The value to convert to an iteratee.
  14416. * @param {number} [arity] The arity of the created iteratee.
  14417. * @returns {Function} Returns the chosen function or its result.
  14418. */
  14419. function getIteratee() {
  14420. var result = lodash.iteratee || iteratee;
  14421. result = result === iteratee ? baseIteratee : result;
  14422. return arguments.length ? result(arguments[0], arguments[1]) : result;
  14423. }
  14424. /**
  14425. * Gets the data for `map`.
  14426. *
  14427. * @private
  14428. * @param {Object} map The map to query.
  14429. * @param {string} key The reference key.
  14430. * @returns {*} Returns the map data.
  14431. */
  14432. function getMapData(map, key) {
  14433. var data = map.__data__;
  14434. return isKeyable(key)
  14435. ? data[typeof key == 'string' ? 'string' : 'hash']
  14436. : data.map;
  14437. }
  14438. /**
  14439. * Gets the property names, values, and compare flags of `object`.
  14440. *
  14441. * @private
  14442. * @param {Object} object The object to query.
  14443. * @returns {Array} Returns the match data of `object`.
  14444. */
  14445. function getMatchData(object) {
  14446. var result = keys(object),
  14447. length = result.length;
  14448. while (length--) {
  14449. var key = result[length],
  14450. value = object[key];
  14451. result[length] = [key, value, isStrictComparable(value)];
  14452. }
  14453. return result;
  14454. }
  14455. /**
  14456. * Gets the native function at `key` of `object`.
  14457. *
  14458. * @private
  14459. * @param {Object} object The object to query.
  14460. * @param {string} key The key of the method to get.
  14461. * @returns {*} Returns the function if it's native, else `undefined`.
  14462. */
  14463. function getNative(object, key) {
  14464. var value = getValue(object, key);
  14465. return baseIsNative(value) ? value : undefined;
  14466. }
  14467. /**
  14468. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  14469. *
  14470. * @private
  14471. * @param {*} value The value to query.
  14472. * @returns {string} Returns the raw `toStringTag`.
  14473. */
  14474. function getRawTag(value) {
  14475. var isOwn = hasOwnProperty.call(value, symToStringTag),
  14476. tag = value[symToStringTag];
  14477. try {
  14478. value[symToStringTag] = undefined;
  14479. var unmasked = true;
  14480. } catch (e) {}
  14481. var result = nativeObjectToString.call(value);
  14482. if (unmasked) {
  14483. if (isOwn) {
  14484. value[symToStringTag] = tag;
  14485. } else {
  14486. delete value[symToStringTag];
  14487. }
  14488. }
  14489. return result;
  14490. }
  14491. /**
  14492. * Creates an array of the own enumerable symbols of `object`.
  14493. *
  14494. * @private
  14495. * @param {Object} object The object to query.
  14496. * @returns {Array} Returns the array of symbols.
  14497. */
  14498. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  14499. if (object == null) {
  14500. return [];
  14501. }
  14502. object = Object(object);
  14503. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  14504. return propertyIsEnumerable.call(object, symbol);
  14505. });
  14506. };
  14507. /**
  14508. * Creates an array of the own and inherited enumerable symbols of `object`.
  14509. *
  14510. * @private
  14511. * @param {Object} object The object to query.
  14512. * @returns {Array} Returns the array of symbols.
  14513. */
  14514. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  14515. var result = [];
  14516. while (object) {
  14517. arrayPush(result, getSymbols(object));
  14518. object = getPrototype(object);
  14519. }
  14520. return result;
  14521. };
  14522. /**
  14523. * Gets the `toStringTag` of `value`.
  14524. *
  14525. * @private
  14526. * @param {*} value The value to query.
  14527. * @returns {string} Returns the `toStringTag`.
  14528. */
  14529. var getTag = baseGetTag;
  14530. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  14531. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  14532. (Map && getTag(new Map) != mapTag) ||
  14533. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  14534. (Set && getTag(new Set) != setTag) ||
  14535. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  14536. getTag = function(value) {
  14537. var result = baseGetTag(value),
  14538. Ctor = result == objectTag ? value.constructor : undefined,
  14539. ctorString = Ctor ? toSource(Ctor) : '';
  14540. if (ctorString) {
  14541. switch (ctorString) {
  14542. case dataViewCtorString: return dataViewTag;
  14543. case mapCtorString: return mapTag;
  14544. case promiseCtorString: return promiseTag;
  14545. case setCtorString: return setTag;
  14546. case weakMapCtorString: return weakMapTag;
  14547. }
  14548. }
  14549. return result;
  14550. };
  14551. }
  14552. /**
  14553. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  14554. *
  14555. * @private
  14556. * @param {number} start The start of the view.
  14557. * @param {number} end The end of the view.
  14558. * @param {Array} transforms The transformations to apply to the view.
  14559. * @returns {Object} Returns an object containing the `start` and `end`
  14560. * positions of the view.
  14561. */
  14562. function getView(start, end, transforms) {
  14563. var index = -1,
  14564. length = transforms.length;
  14565. while (++index < length) {
  14566. var data = transforms[index],
  14567. size = data.size;
  14568. switch (data.type) {
  14569. case 'drop': start += size; break;
  14570. case 'dropRight': end -= size; break;
  14571. case 'take': end = nativeMin(end, start + size); break;
  14572. case 'takeRight': start = nativeMax(start, end - size); break;
  14573. }
  14574. }
  14575. return { 'start': start, 'end': end };
  14576. }
  14577. /**
  14578. * Extracts wrapper details from the `source` body comment.
  14579. *
  14580. * @private
  14581. * @param {string} source The source to inspect.
  14582. * @returns {Array} Returns the wrapper details.
  14583. */
  14584. function getWrapDetails(source) {
  14585. var match = source.match(reWrapDetails);
  14586. return match ? match[1].split(reSplitDetails) : [];
  14587. }
  14588. /**
  14589. * Checks if `path` exists on `object`.
  14590. *
  14591. * @private
  14592. * @param {Object} object The object to query.
  14593. * @param {Array|string} path The path to check.
  14594. * @param {Function} hasFunc The function to check properties.
  14595. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  14596. */
  14597. function hasPath(object, path, hasFunc) {
  14598. path = castPath(path, object);
  14599. var index = -1,
  14600. length = path.length,
  14601. result = false;
  14602. while (++index < length) {
  14603. var key = toKey(path[index]);
  14604. if (!(result = object != null && hasFunc(object, key))) {
  14605. break;
  14606. }
  14607. object = object[key];
  14608. }
  14609. if (result || ++index != length) {
  14610. return result;
  14611. }
  14612. length = object == null ? 0 : object.length;
  14613. return !!length && isLength(length) && isIndex(key, length) &&
  14614. (isArray(object) || isArguments(object));
  14615. }
  14616. /**
  14617. * Initializes an array clone.
  14618. *
  14619. * @private
  14620. * @param {Array} array The array to clone.
  14621. * @returns {Array} Returns the initialized clone.
  14622. */
  14623. function initCloneArray(array) {
  14624. var length = array.length,
  14625. result = array.constructor(length);
  14626. // Add properties assigned by `RegExp#exec`.
  14627. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  14628. result.index = array.index;
  14629. result.input = array.input;
  14630. }
  14631. return result;
  14632. }
  14633. /**
  14634. * Initializes an object clone.
  14635. *
  14636. * @private
  14637. * @param {Object} object The object to clone.
  14638. * @returns {Object} Returns the initialized clone.
  14639. */
  14640. function initCloneObject(object) {
  14641. return (typeof object.constructor == 'function' && !isPrototype(object))
  14642. ? baseCreate(getPrototype(object))
  14643. : {};
  14644. }
  14645. /**
  14646. * Initializes an object clone based on its `toStringTag`.
  14647. *
  14648. * **Note:** This function only supports cloning values with tags of
  14649. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  14650. *
  14651. * @private
  14652. * @param {Object} object The object to clone.
  14653. * @param {string} tag The `toStringTag` of the object to clone.
  14654. * @param {Function} cloneFunc The function to clone values.
  14655. * @param {boolean} [isDeep] Specify a deep clone.
  14656. * @returns {Object} Returns the initialized clone.
  14657. */
  14658. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  14659. var Ctor = object.constructor;
  14660. switch (tag) {
  14661. case arrayBufferTag:
  14662. return cloneArrayBuffer(object);
  14663. case boolTag:
  14664. case dateTag:
  14665. return new Ctor(+object);
  14666. case dataViewTag:
  14667. return cloneDataView(object, isDeep);
  14668. case float32Tag: case float64Tag:
  14669. case int8Tag: case int16Tag: case int32Tag:
  14670. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  14671. return cloneTypedArray(object, isDeep);
  14672. case mapTag:
  14673. return cloneMap(object, isDeep, cloneFunc);
  14674. case numberTag:
  14675. case stringTag:
  14676. return new Ctor(object);
  14677. case regexpTag:
  14678. return cloneRegExp(object);
  14679. case setTag:
  14680. return cloneSet(object, isDeep, cloneFunc);
  14681. case symbolTag:
  14682. return cloneSymbol(object);
  14683. }
  14684. }
  14685. /**
  14686. * Inserts wrapper `details` in a comment at the top of the `source` body.
  14687. *
  14688. * @private
  14689. * @param {string} source The source to modify.
  14690. * @returns {Array} details The details to insert.
  14691. * @returns {string} Returns the modified source.
  14692. */
  14693. function insertWrapDetails(source, details) {
  14694. var length = details.length;
  14695. if (!length) {
  14696. return source;
  14697. }
  14698. var lastIndex = length - 1;
  14699. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  14700. details = details.join(length > 2 ? ', ' : ' ');
  14701. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  14702. }
  14703. /**
  14704. * Checks if `value` is a flattenable `arguments` object or array.
  14705. *
  14706. * @private
  14707. * @param {*} value The value to check.
  14708. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  14709. */
  14710. function isFlattenable(value) {
  14711. return isArray(value) || isArguments(value) ||
  14712. !!(spreadableSymbol && value && value[spreadableSymbol]);
  14713. }
  14714. /**
  14715. * Checks if `value` is a valid array-like index.
  14716. *
  14717. * @private
  14718. * @param {*} value The value to check.
  14719. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  14720. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  14721. */
  14722. function isIndex(value, length) {
  14723. length = length == null ? MAX_SAFE_INTEGER : length;
  14724. return !!length &&
  14725. (typeof value == 'number' || reIsUint.test(value)) &&
  14726. (value > -1 && value % 1 == 0 && value < length);
  14727. }
  14728. /**
  14729. * Checks if the given arguments are from an iteratee call.
  14730. *
  14731. * @private
  14732. * @param {*} value The potential iteratee value argument.
  14733. * @param {*} index The potential iteratee index or key argument.
  14734. * @param {*} object The potential iteratee object argument.
  14735. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  14736. * else `false`.
  14737. */
  14738. function isIterateeCall(value, index, object) {
  14739. if (!isObject(object)) {
  14740. return false;
  14741. }
  14742. var type = typeof index;
  14743. if (type == 'number'
  14744. ? (isArrayLike(object) && isIndex(index, object.length))
  14745. : (type == 'string' && index in object)
  14746. ) {
  14747. return eq(object[index], value);
  14748. }
  14749. return false;
  14750. }
  14751. /**
  14752. * Checks if `value` is a property name and not a property path.
  14753. *
  14754. * @private
  14755. * @param {*} value The value to check.
  14756. * @param {Object} [object] The object to query keys on.
  14757. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  14758. */
  14759. function isKey(value, object) {
  14760. if (isArray(value)) {
  14761. return false;
  14762. }
  14763. var type = typeof value;
  14764. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  14765. value == null || isSymbol(value)) {
  14766. return true;
  14767. }
  14768. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  14769. (object != null && value in Object(object));
  14770. }
  14771. /**
  14772. * Checks if `value` is suitable for use as unique object key.
  14773. *
  14774. * @private
  14775. * @param {*} value The value to check.
  14776. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  14777. */
  14778. function isKeyable(value) {
  14779. var type = typeof value;
  14780. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  14781. ? (value !== '__proto__')
  14782. : (value === null);
  14783. }
  14784. /**
  14785. * Checks if `func` has a lazy counterpart.
  14786. *
  14787. * @private
  14788. * @param {Function} func The function to check.
  14789. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  14790. * else `false`.
  14791. */
  14792. function isLaziable(func) {
  14793. var funcName = getFuncName(func),
  14794. other = lodash[funcName];
  14795. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  14796. return false;
  14797. }
  14798. if (func === other) {
  14799. return true;
  14800. }
  14801. var data = getData(other);
  14802. return !!data && func === data[0];
  14803. }
  14804. /**
  14805. * Checks if `func` has its source masked.
  14806. *
  14807. * @private
  14808. * @param {Function} func The function to check.
  14809. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  14810. */
  14811. function isMasked(func) {
  14812. return !!maskSrcKey && (maskSrcKey in func);
  14813. }
  14814. /**
  14815. * Checks if `func` is capable of being masked.
  14816. *
  14817. * @private
  14818. * @param {*} value The value to check.
  14819. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  14820. */
  14821. var isMaskable = coreJsData ? isFunction : stubFalse;
  14822. /**
  14823. * Checks if `value` is likely a prototype object.
  14824. *
  14825. * @private
  14826. * @param {*} value The value to check.
  14827. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  14828. */
  14829. function isPrototype(value) {
  14830. var Ctor = value && value.constructor,
  14831. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  14832. return value === proto;
  14833. }
  14834. /**
  14835. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  14836. *
  14837. * @private
  14838. * @param {*} value The value to check.
  14839. * @returns {boolean} Returns `true` if `value` if suitable for strict
  14840. * equality comparisons, else `false`.
  14841. */
  14842. function isStrictComparable(value) {
  14843. return value === value && !isObject(value);
  14844. }
  14845. /**
  14846. * A specialized version of `matchesProperty` for source values suitable
  14847. * for strict equality comparisons, i.e. `===`.
  14848. *
  14849. * @private
  14850. * @param {string} key The key of the property to get.
  14851. * @param {*} srcValue The value to match.
  14852. * @returns {Function} Returns the new spec function.
  14853. */
  14854. function matchesStrictComparable(key, srcValue) {
  14855. return function(object) {
  14856. if (object == null) {
  14857. return false;
  14858. }
  14859. return object[key] === srcValue &&
  14860. (srcValue !== undefined || (key in Object(object)));
  14861. };
  14862. }
  14863. /**
  14864. * A specialized version of `_.memoize` which clears the memoized function's
  14865. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  14866. *
  14867. * @private
  14868. * @param {Function} func The function to have its output memoized.
  14869. * @returns {Function} Returns the new memoized function.
  14870. */
  14871. function memoizeCapped(func) {
  14872. var result = memoize(func, function(key) {
  14873. if (cache.size === MAX_MEMOIZE_SIZE) {
  14874. cache.clear();
  14875. }
  14876. return key;
  14877. });
  14878. var cache = result.cache;
  14879. return result;
  14880. }
  14881. /**
  14882. * Merges the function metadata of `source` into `data`.
  14883. *
  14884. * Merging metadata reduces the number of wrappers used to invoke a function.
  14885. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  14886. * may be applied regardless of execution order. Methods like `_.ary` and
  14887. * `_.rearg` modify function arguments, making the order in which they are
  14888. * executed important, preventing the merging of metadata. However, we make
  14889. * an exception for a safe combined case where curried functions have `_.ary`
  14890. * and or `_.rearg` applied.
  14891. *
  14892. * @private
  14893. * @param {Array} data The destination metadata.
  14894. * @param {Array} source The source metadata.
  14895. * @returns {Array} Returns `data`.
  14896. */
  14897. function mergeData(data, source) {
  14898. var bitmask = data[1],
  14899. srcBitmask = source[1],
  14900. newBitmask = bitmask | srcBitmask,
  14901. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  14902. var isCombo =
  14903. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  14904. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  14905. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  14906. // Exit early if metadata can't be merged.
  14907. if (!(isCommon || isCombo)) {
  14908. return data;
  14909. }
  14910. // Use source `thisArg` if available.
  14911. if (srcBitmask & WRAP_BIND_FLAG) {
  14912. data[2] = source[2];
  14913. // Set when currying a bound function.
  14914. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  14915. }
  14916. // Compose partial arguments.
  14917. var value = source[3];
  14918. if (value) {
  14919. var partials = data[3];
  14920. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  14921. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  14922. }
  14923. // Compose partial right arguments.
  14924. value = source[5];
  14925. if (value) {
  14926. partials = data[5];
  14927. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  14928. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  14929. }
  14930. // Use source `argPos` if available.
  14931. value = source[7];
  14932. if (value) {
  14933. data[7] = value;
  14934. }
  14935. // Use source `ary` if it's smaller.
  14936. if (srcBitmask & WRAP_ARY_FLAG) {
  14937. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  14938. }
  14939. // Use source `arity` if one is not provided.
  14940. if (data[9] == null) {
  14941. data[9] = source[9];
  14942. }
  14943. // Use source `func` and merge bitmasks.
  14944. data[0] = source[0];
  14945. data[1] = newBitmask;
  14946. return data;
  14947. }
  14948. /**
  14949. * This function is like
  14950. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  14951. * except that it includes inherited enumerable properties.
  14952. *
  14953. * @private
  14954. * @param {Object} object The object to query.
  14955. * @returns {Array} Returns the array of property names.
  14956. */
  14957. function nativeKeysIn(object) {
  14958. var result = [];
  14959. if (object != null) {
  14960. for (var key in Object(object)) {
  14961. result.push(key);
  14962. }
  14963. }
  14964. return result;
  14965. }
  14966. /**
  14967. * Converts `value` to a string using `Object.prototype.toString`.
  14968. *
  14969. * @private
  14970. * @param {*} value The value to convert.
  14971. * @returns {string} Returns the converted string.
  14972. */
  14973. function objectToString(value) {
  14974. return nativeObjectToString.call(value);
  14975. }
  14976. /**
  14977. * A specialized version of `baseRest` which transforms the rest array.
  14978. *
  14979. * @private
  14980. * @param {Function} func The function to apply a rest parameter to.
  14981. * @param {number} [start=func.length-1] The start position of the rest parameter.
  14982. * @param {Function} transform The rest array transform.
  14983. * @returns {Function} Returns the new function.
  14984. */
  14985. function overRest(func, start, transform) {
  14986. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  14987. return function() {
  14988. var args = arguments,
  14989. index = -1,
  14990. length = nativeMax(args.length - start, 0),
  14991. array = Array(length);
  14992. while (++index < length) {
  14993. array[index] = args[start + index];
  14994. }
  14995. index = -1;
  14996. var otherArgs = Array(start + 1);
  14997. while (++index < start) {
  14998. otherArgs[index] = args[index];
  14999. }
  15000. otherArgs[start] = transform(array);
  15001. return apply(func, this, otherArgs);
  15002. };
  15003. }
  15004. /**
  15005. * Gets the parent value at `path` of `object`.
  15006. *
  15007. * @private
  15008. * @param {Object} object The object to query.
  15009. * @param {Array} path The path to get the parent value of.
  15010. * @returns {*} Returns the parent value.
  15011. */
  15012. function parent(object, path) {
  15013. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  15014. }
  15015. /**
  15016. * Reorder `array` according to the specified indexes where the element at
  15017. * the first index is assigned as the first element, the element at
  15018. * the second index is assigned as the second element, and so on.
  15019. *
  15020. * @private
  15021. * @param {Array} array The array to reorder.
  15022. * @param {Array} indexes The arranged array indexes.
  15023. * @returns {Array} Returns `array`.
  15024. */
  15025. function reorder(array, indexes) {
  15026. var arrLength = array.length,
  15027. length = nativeMin(indexes.length, arrLength),
  15028. oldArray = copyArray(array);
  15029. while (length--) {
  15030. var index = indexes[length];
  15031. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  15032. }
  15033. return array;
  15034. }
  15035. /**
  15036. * Sets metadata for `func`.
  15037. *
  15038. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  15039. * period of time, it will trip its breaker and transition to an identity
  15040. * function to avoid garbage collection pauses in V8. See
  15041. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  15042. * for more details.
  15043. *
  15044. * @private
  15045. * @param {Function} func The function to associate metadata with.
  15046. * @param {*} data The metadata.
  15047. * @returns {Function} Returns `func`.
  15048. */
  15049. var setData = shortOut(baseSetData);
  15050. /**
  15051. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  15052. *
  15053. * @private
  15054. * @param {Function} func The function to delay.
  15055. * @param {number} wait The number of milliseconds to delay invocation.
  15056. * @returns {number|Object} Returns the timer id or timeout object.
  15057. */
  15058. var setTimeout = ctxSetTimeout || function(func, wait) {
  15059. return root.setTimeout(func, wait);
  15060. };
  15061. /**
  15062. * Sets the `toString` method of `func` to return `string`.
  15063. *
  15064. * @private
  15065. * @param {Function} func The function to modify.
  15066. * @param {Function} string The `toString` result.
  15067. * @returns {Function} Returns `func`.
  15068. */
  15069. var setToString = shortOut(baseSetToString);
  15070. /**
  15071. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  15072. * with wrapper details in a comment at the top of the source body.
  15073. *
  15074. * @private
  15075. * @param {Function} wrapper The function to modify.
  15076. * @param {Function} reference The reference function.
  15077. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  15078. * @returns {Function} Returns `wrapper`.
  15079. */
  15080. function setWrapToString(wrapper, reference, bitmask) {
  15081. var source = (reference + '');
  15082. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  15083. }
  15084. /**
  15085. * Creates a function that'll short out and invoke `identity` instead
  15086. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  15087. * milliseconds.
  15088. *
  15089. * @private
  15090. * @param {Function} func The function to restrict.
  15091. * @returns {Function} Returns the new shortable function.
  15092. */
  15093. function shortOut(func) {
  15094. var count = 0,
  15095. lastCalled = 0;
  15096. return function() {
  15097. var stamp = nativeNow(),
  15098. remaining = HOT_SPAN - (stamp - lastCalled);
  15099. lastCalled = stamp;
  15100. if (remaining > 0) {
  15101. if (++count >= HOT_COUNT) {
  15102. return arguments[0];
  15103. }
  15104. } else {
  15105. count = 0;
  15106. }
  15107. return func.apply(undefined, arguments);
  15108. };
  15109. }
  15110. /**
  15111. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  15112. *
  15113. * @private
  15114. * @param {Array} array The array to shuffle.
  15115. * @param {number} [size=array.length] The size of `array`.
  15116. * @returns {Array} Returns `array`.
  15117. */
  15118. function shuffleSelf(array, size) {
  15119. var index = -1,
  15120. length = array.length,
  15121. lastIndex = length - 1;
  15122. size = size === undefined ? length : size;
  15123. while (++index < size) {
  15124. var rand = baseRandom(index, lastIndex),
  15125. value = array[rand];
  15126. array[rand] = array[index];
  15127. array[index] = value;
  15128. }
  15129. array.length = size;
  15130. return array;
  15131. }
  15132. /**
  15133. * Converts `string` to a property path array.
  15134. *
  15135. * @private
  15136. * @param {string} string The string to convert.
  15137. * @returns {Array} Returns the property path array.
  15138. */
  15139. var stringToPath = memoizeCapped(function(string) {
  15140. var result = [];
  15141. if (reLeadingDot.test(string)) {
  15142. result.push('');
  15143. }
  15144. string.replace(rePropName, function(match, number, quote, string) {
  15145. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  15146. });
  15147. return result;
  15148. });
  15149. /**
  15150. * Converts `value` to a string key if it's not a string or symbol.
  15151. *
  15152. * @private
  15153. * @param {*} value The value to inspect.
  15154. * @returns {string|symbol} Returns the key.
  15155. */
  15156. function toKey(value) {
  15157. if (typeof value == 'string' || isSymbol(value)) {
  15158. return value;
  15159. }
  15160. var result = (value + '');
  15161. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  15162. }
  15163. /**
  15164. * Converts `func` to its source code.
  15165. *
  15166. * @private
  15167. * @param {Function} func The function to convert.
  15168. * @returns {string} Returns the source code.
  15169. */
  15170. function toSource(func) {
  15171. if (func != null) {
  15172. try {
  15173. return funcToString.call(func);
  15174. } catch (e) {}
  15175. try {
  15176. return (func + '');
  15177. } catch (e) {}
  15178. }
  15179. return '';
  15180. }
  15181. /**
  15182. * Updates wrapper `details` based on `bitmask` flags.
  15183. *
  15184. * @private
  15185. * @returns {Array} details The details to modify.
  15186. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  15187. * @returns {Array} Returns `details`.
  15188. */
  15189. function updateWrapDetails(details, bitmask) {
  15190. arrayEach(wrapFlags, function(pair) {
  15191. var value = '_.' + pair[0];
  15192. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  15193. details.push(value);
  15194. }
  15195. });
  15196. return details.sort();
  15197. }
  15198. /**
  15199. * Creates a clone of `wrapper`.
  15200. *
  15201. * @private
  15202. * @param {Object} wrapper The wrapper to clone.
  15203. * @returns {Object} Returns the cloned wrapper.
  15204. */
  15205. function wrapperClone(wrapper) {
  15206. if (wrapper instanceof LazyWrapper) {
  15207. return wrapper.clone();
  15208. }
  15209. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  15210. result.__actions__ = copyArray(wrapper.__actions__);
  15211. result.__index__ = wrapper.__index__;
  15212. result.__values__ = wrapper.__values__;
  15213. return result;
  15214. }
  15215. /*------------------------------------------------------------------------*/
  15216. /**
  15217. * Creates an array of elements split into groups the length of `size`.
  15218. * If `array` can't be split evenly, the final chunk will be the remaining
  15219. * elements.
  15220. *
  15221. * @static
  15222. * @memberOf _
  15223. * @since 3.0.0
  15224. * @category Array
  15225. * @param {Array} array The array to process.
  15226. * @param {number} [size=1] The length of each chunk
  15227. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15228. * @returns {Array} Returns the new array of chunks.
  15229. * @example
  15230. *
  15231. * _.chunk(['a', 'b', 'c', 'd'], 2);
  15232. * // => [['a', 'b'], ['c', 'd']]
  15233. *
  15234. * _.chunk(['a', 'b', 'c', 'd'], 3);
  15235. * // => [['a', 'b', 'c'], ['d']]
  15236. */
  15237. function chunk(array, size, guard) {
  15238. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  15239. size = 1;
  15240. } else {
  15241. size = nativeMax(toInteger(size), 0);
  15242. }
  15243. var length = array == null ? 0 : array.length;
  15244. if (!length || size < 1) {
  15245. return [];
  15246. }
  15247. var index = 0,
  15248. resIndex = 0,
  15249. result = Array(nativeCeil(length / size));
  15250. while (index < length) {
  15251. result[resIndex++] = baseSlice(array, index, (index += size));
  15252. }
  15253. return result;
  15254. }
  15255. /**
  15256. * Creates an array with all falsey values removed. The values `false`, `null`,
  15257. * `0`, `""`, `undefined`, and `NaN` are falsey.
  15258. *
  15259. * @static
  15260. * @memberOf _
  15261. * @since 0.1.0
  15262. * @category Array
  15263. * @param {Array} array The array to compact.
  15264. * @returns {Array} Returns the new array of filtered values.
  15265. * @example
  15266. *
  15267. * _.compact([0, 1, false, 2, '', 3]);
  15268. * // => [1, 2, 3]
  15269. */
  15270. function compact(array) {
  15271. var index = -1,
  15272. length = array == null ? 0 : array.length,
  15273. resIndex = 0,
  15274. result = [];
  15275. while (++index < length) {
  15276. var value = array[index];
  15277. if (value) {
  15278. result[resIndex++] = value;
  15279. }
  15280. }
  15281. return result;
  15282. }
  15283. /**
  15284. * Creates a new array concatenating `array` with any additional arrays
  15285. * and/or values.
  15286. *
  15287. * @static
  15288. * @memberOf _
  15289. * @since 4.0.0
  15290. * @category Array
  15291. * @param {Array} array The array to concatenate.
  15292. * @param {...*} [values] The values to concatenate.
  15293. * @returns {Array} Returns the new concatenated array.
  15294. * @example
  15295. *
  15296. * var array = [1];
  15297. * var other = _.concat(array, 2, [3], [[4]]);
  15298. *
  15299. * console.log(other);
  15300. * // => [1, 2, 3, [4]]
  15301. *
  15302. * console.log(array);
  15303. * // => [1]
  15304. */
  15305. function concat() {
  15306. var length = arguments.length;
  15307. if (!length) {
  15308. return [];
  15309. }
  15310. var args = Array(length - 1),
  15311. array = arguments[0],
  15312. index = length;
  15313. while (index--) {
  15314. args[index - 1] = arguments[index];
  15315. }
  15316. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  15317. }
  15318. /**
  15319. * Creates an array of `array` values not included in the other given arrays
  15320. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  15321. * for equality comparisons. The order and references of result values are
  15322. * determined by the first array.
  15323. *
  15324. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  15325. *
  15326. * @static
  15327. * @memberOf _
  15328. * @since 0.1.0
  15329. * @category Array
  15330. * @param {Array} array The array to inspect.
  15331. * @param {...Array} [values] The values to exclude.
  15332. * @returns {Array} Returns the new array of filtered values.
  15333. * @see _.without, _.xor
  15334. * @example
  15335. *
  15336. * _.difference([2, 1], [2, 3]);
  15337. * // => [1]
  15338. */
  15339. var difference = baseRest(function(array, values) {
  15340. return isArrayLikeObject(array)
  15341. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  15342. : [];
  15343. });
  15344. /**
  15345. * This method is like `_.difference` except that it accepts `iteratee` which
  15346. * is invoked for each element of `array` and `values` to generate the criterion
  15347. * by which they're compared. The order and references of result values are
  15348. * determined by the first array. The iteratee is invoked with one argument:
  15349. * (value).
  15350. *
  15351. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  15352. *
  15353. * @static
  15354. * @memberOf _
  15355. * @since 4.0.0
  15356. * @category Array
  15357. * @param {Array} array The array to inspect.
  15358. * @param {...Array} [values] The values to exclude.
  15359. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  15360. * @returns {Array} Returns the new array of filtered values.
  15361. * @example
  15362. *
  15363. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  15364. * // => [1.2]
  15365. *
  15366. * // The `_.property` iteratee shorthand.
  15367. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  15368. * // => [{ 'x': 2 }]
  15369. */
  15370. var differenceBy = baseRest(function(array, values) {
  15371. var iteratee = last(values);
  15372. if (isArrayLikeObject(iteratee)) {
  15373. iteratee = undefined;
  15374. }
  15375. return isArrayLikeObject(array)
  15376. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  15377. : [];
  15378. });
  15379. /**
  15380. * This method is like `_.difference` except that it accepts `comparator`
  15381. * which is invoked to compare elements of `array` to `values`. The order and
  15382. * references of result values are determined by the first array. The comparator
  15383. * is invoked with two arguments: (arrVal, othVal).
  15384. *
  15385. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  15386. *
  15387. * @static
  15388. * @memberOf _
  15389. * @since 4.0.0
  15390. * @category Array
  15391. * @param {Array} array The array to inspect.
  15392. * @param {...Array} [values] The values to exclude.
  15393. * @param {Function} [comparator] The comparator invoked per element.
  15394. * @returns {Array} Returns the new array of filtered values.
  15395. * @example
  15396. *
  15397. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  15398. *
  15399. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  15400. * // => [{ 'x': 2, 'y': 1 }]
  15401. */
  15402. var differenceWith = baseRest(function(array, values) {
  15403. var comparator = last(values);
  15404. if (isArrayLikeObject(comparator)) {
  15405. comparator = undefined;
  15406. }
  15407. return isArrayLikeObject(array)
  15408. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  15409. : [];
  15410. });
  15411. /**
  15412. * Creates a slice of `array` with `n` elements dropped from the beginning.
  15413. *
  15414. * @static
  15415. * @memberOf _
  15416. * @since 0.5.0
  15417. * @category Array
  15418. * @param {Array} array The array to query.
  15419. * @param {number} [n=1] The number of elements to drop.
  15420. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15421. * @returns {Array} Returns the slice of `array`.
  15422. * @example
  15423. *
  15424. * _.drop([1, 2, 3]);
  15425. * // => [2, 3]
  15426. *
  15427. * _.drop([1, 2, 3], 2);
  15428. * // => [3]
  15429. *
  15430. * _.drop([1, 2, 3], 5);
  15431. * // => []
  15432. *
  15433. * _.drop([1, 2, 3], 0);
  15434. * // => [1, 2, 3]
  15435. */
  15436. function drop(array, n, guard) {
  15437. var length = array == null ? 0 : array.length;
  15438. if (!length) {
  15439. return [];
  15440. }
  15441. n = (guard || n === undefined) ? 1 : toInteger(n);
  15442. return baseSlice(array, n < 0 ? 0 : n, length);
  15443. }
  15444. /**
  15445. * Creates a slice of `array` with `n` elements dropped from the end.
  15446. *
  15447. * @static
  15448. * @memberOf _
  15449. * @since 3.0.0
  15450. * @category Array
  15451. * @param {Array} array The array to query.
  15452. * @param {number} [n=1] The number of elements to drop.
  15453. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15454. * @returns {Array} Returns the slice of `array`.
  15455. * @example
  15456. *
  15457. * _.dropRight([1, 2, 3]);
  15458. * // => [1, 2]
  15459. *
  15460. * _.dropRight([1, 2, 3], 2);
  15461. * // => [1]
  15462. *
  15463. * _.dropRight([1, 2, 3], 5);
  15464. * // => []
  15465. *
  15466. * _.dropRight([1, 2, 3], 0);
  15467. * // => [1, 2, 3]
  15468. */
  15469. function dropRight(array, n, guard) {
  15470. var length = array == null ? 0 : array.length;
  15471. if (!length) {
  15472. return [];
  15473. }
  15474. n = (guard || n === undefined) ? 1 : toInteger(n);
  15475. n = length - n;
  15476. return baseSlice(array, 0, n < 0 ? 0 : n);
  15477. }
  15478. /**
  15479. * Creates a slice of `array` excluding elements dropped from the end.
  15480. * Elements are dropped until `predicate` returns falsey. The predicate is
  15481. * invoked with three arguments: (value, index, array).
  15482. *
  15483. * @static
  15484. * @memberOf _
  15485. * @since 3.0.0
  15486. * @category Array
  15487. * @param {Array} array The array to query.
  15488. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  15489. * @returns {Array} Returns the slice of `array`.
  15490. * @example
  15491. *
  15492. * var users = [
  15493. * { 'user': 'barney', 'active': true },
  15494. * { 'user': 'fred', 'active': false },
  15495. * { 'user': 'pebbles', 'active': false }
  15496. * ];
  15497. *
  15498. * _.dropRightWhile(users, function(o) { return !o.active; });
  15499. * // => objects for ['barney']
  15500. *
  15501. * // The `_.matches` iteratee shorthand.
  15502. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  15503. * // => objects for ['barney', 'fred']
  15504. *
  15505. * // The `_.matchesProperty` iteratee shorthand.
  15506. * _.dropRightWhile(users, ['active', false]);
  15507. * // => objects for ['barney']
  15508. *
  15509. * // The `_.property` iteratee shorthand.
  15510. * _.dropRightWhile(users, 'active');
  15511. * // => objects for ['barney', 'fred', 'pebbles']
  15512. */
  15513. function dropRightWhile(array, predicate) {
  15514. return (array && array.length)
  15515. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  15516. : [];
  15517. }
  15518. /**
  15519. * Creates a slice of `array` excluding elements dropped from the beginning.
  15520. * Elements are dropped until `predicate` returns falsey. The predicate is
  15521. * invoked with three arguments: (value, index, array).
  15522. *
  15523. * @static
  15524. * @memberOf _
  15525. * @since 3.0.0
  15526. * @category Array
  15527. * @param {Array} array The array to query.
  15528. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  15529. * @returns {Array} Returns the slice of `array`.
  15530. * @example
  15531. *
  15532. * var users = [
  15533. * { 'user': 'barney', 'active': false },
  15534. * { 'user': 'fred', 'active': false },
  15535. * { 'user': 'pebbles', 'active': true }
  15536. * ];
  15537. *
  15538. * _.dropWhile(users, function(o) { return !o.active; });
  15539. * // => objects for ['pebbles']
  15540. *
  15541. * // The `_.matches` iteratee shorthand.
  15542. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  15543. * // => objects for ['fred', 'pebbles']
  15544. *
  15545. * // The `_.matchesProperty` iteratee shorthand.
  15546. * _.dropWhile(users, ['active', false]);
  15547. * // => objects for ['pebbles']
  15548. *
  15549. * // The `_.property` iteratee shorthand.
  15550. * _.dropWhile(users, 'active');
  15551. * // => objects for ['barney', 'fred', 'pebbles']
  15552. */
  15553. function dropWhile(array, predicate) {
  15554. return (array && array.length)
  15555. ? baseWhile(array, getIteratee(predicate, 3), true)
  15556. : [];
  15557. }
  15558. /**
  15559. * Fills elements of `array` with `value` from `start` up to, but not
  15560. * including, `end`.
  15561. *
  15562. * **Note:** This method mutates `array`.
  15563. *
  15564. * @static
  15565. * @memberOf _
  15566. * @since 3.2.0
  15567. * @category Array
  15568. * @param {Array} array The array to fill.
  15569. * @param {*} value The value to fill `array` with.
  15570. * @param {number} [start=0] The start position.
  15571. * @param {number} [end=array.length] The end position.
  15572. * @returns {Array} Returns `array`.
  15573. * @example
  15574. *
  15575. * var array = [1, 2, 3];
  15576. *
  15577. * _.fill(array, 'a');
  15578. * console.log(array);
  15579. * // => ['a', 'a', 'a']
  15580. *
  15581. * _.fill(Array(3), 2);
  15582. * // => [2, 2, 2]
  15583. *
  15584. * _.fill([4, 6, 8, 10], '*', 1, 3);
  15585. * // => [4, '*', '*', 10]
  15586. */
  15587. function fill(array, value, start, end) {
  15588. var length = array == null ? 0 : array.length;
  15589. if (!length) {
  15590. return [];
  15591. }
  15592. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  15593. start = 0;
  15594. end = length;
  15595. }
  15596. return baseFill(array, value, start, end);
  15597. }
  15598. /**
  15599. * This method is like `_.find` except that it returns the index of the first
  15600. * element `predicate` returns truthy for instead of the element itself.
  15601. *
  15602. * @static
  15603. * @memberOf _
  15604. * @since 1.1.0
  15605. * @category Array
  15606. * @param {Array} array The array to inspect.
  15607. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  15608. * @param {number} [fromIndex=0] The index to search from.
  15609. * @returns {number} Returns the index of the found element, else `-1`.
  15610. * @example
  15611. *
  15612. * var users = [
  15613. * { 'user': 'barney', 'active': false },
  15614. * { 'user': 'fred', 'active': false },
  15615. * { 'user': 'pebbles', 'active': true }
  15616. * ];
  15617. *
  15618. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  15619. * // => 0
  15620. *
  15621. * // The `_.matches` iteratee shorthand.
  15622. * _.findIndex(users, { 'user': 'fred', 'active': false });
  15623. * // => 1
  15624. *
  15625. * // The `_.matchesProperty` iteratee shorthand.
  15626. * _.findIndex(users, ['active', false]);
  15627. * // => 0
  15628. *
  15629. * // The `_.property` iteratee shorthand.
  15630. * _.findIndex(users, 'active');
  15631. * // => 2
  15632. */
  15633. function findIndex(array, predicate, fromIndex) {
  15634. var length = array == null ? 0 : array.length;
  15635. if (!length) {
  15636. return -1;
  15637. }
  15638. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  15639. if (index < 0) {
  15640. index = nativeMax(length + index, 0);
  15641. }
  15642. return baseFindIndex(array, getIteratee(predicate, 3), index);
  15643. }
  15644. /**
  15645. * This method is like `_.findIndex` except that it iterates over elements
  15646. * of `collection` from right to left.
  15647. *
  15648. * @static
  15649. * @memberOf _
  15650. * @since 2.0.0
  15651. * @category Array
  15652. * @param {Array} array The array to inspect.
  15653. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  15654. * @param {number} [fromIndex=array.length-1] The index to search from.
  15655. * @returns {number} Returns the index of the found element, else `-1`.
  15656. * @example
  15657. *
  15658. * var users = [
  15659. * { 'user': 'barney', 'active': true },
  15660. * { 'user': 'fred', 'active': false },
  15661. * { 'user': 'pebbles', 'active': false }
  15662. * ];
  15663. *
  15664. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  15665. * // => 2
  15666. *
  15667. * // The `_.matches` iteratee shorthand.
  15668. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  15669. * // => 0
  15670. *
  15671. * // The `_.matchesProperty` iteratee shorthand.
  15672. * _.findLastIndex(users, ['active', false]);
  15673. * // => 2
  15674. *
  15675. * // The `_.property` iteratee shorthand.
  15676. * _.findLastIndex(users, 'active');
  15677. * // => 0
  15678. */
  15679. function findLastIndex(array, predicate, fromIndex) {
  15680. var length = array == null ? 0 : array.length;
  15681. if (!length) {
  15682. return -1;
  15683. }
  15684. var index = length - 1;
  15685. if (fromIndex !== undefined) {
  15686. index = toInteger(fromIndex);
  15687. index = fromIndex < 0
  15688. ? nativeMax(length + index, 0)
  15689. : nativeMin(index, length - 1);
  15690. }
  15691. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  15692. }
  15693. /**
  15694. * Flattens `array` a single level deep.
  15695. *
  15696. * @static
  15697. * @memberOf _
  15698. * @since 0.1.0
  15699. * @category Array
  15700. * @param {Array} array The array to flatten.
  15701. * @returns {Array} Returns the new flattened array.
  15702. * @example
  15703. *
  15704. * _.flatten([1, [2, [3, [4]], 5]]);
  15705. * // => [1, 2, [3, [4]], 5]
  15706. */
  15707. function flatten(array) {
  15708. var length = array == null ? 0 : array.length;
  15709. return length ? baseFlatten(array, 1) : [];
  15710. }
  15711. /**
  15712. * Recursively flattens `array`.
  15713. *
  15714. * @static
  15715. * @memberOf _
  15716. * @since 3.0.0
  15717. * @category Array
  15718. * @param {Array} array The array to flatten.
  15719. * @returns {Array} Returns the new flattened array.
  15720. * @example
  15721. *
  15722. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  15723. * // => [1, 2, 3, 4, 5]
  15724. */
  15725. function flattenDeep(array) {
  15726. var length = array == null ? 0 : array.length;
  15727. return length ? baseFlatten(array, INFINITY) : [];
  15728. }
  15729. /**
  15730. * Recursively flatten `array` up to `depth` times.
  15731. *
  15732. * @static
  15733. * @memberOf _
  15734. * @since 4.4.0
  15735. * @category Array
  15736. * @param {Array} array The array to flatten.
  15737. * @param {number} [depth=1] The maximum recursion depth.
  15738. * @returns {Array} Returns the new flattened array.
  15739. * @example
  15740. *
  15741. * var array = [1, [2, [3, [4]], 5]];
  15742. *
  15743. * _.flattenDepth(array, 1);
  15744. * // => [1, 2, [3, [4]], 5]
  15745. *
  15746. * _.flattenDepth(array, 2);
  15747. * // => [1, 2, 3, [4], 5]
  15748. */
  15749. function flattenDepth(array, depth) {
  15750. var length = array == null ? 0 : array.length;
  15751. if (!length) {
  15752. return [];
  15753. }
  15754. depth = depth === undefined ? 1 : toInteger(depth);
  15755. return baseFlatten(array, depth);
  15756. }
  15757. /**
  15758. * The inverse of `_.toPairs`; this method returns an object composed
  15759. * from key-value `pairs`.
  15760. *
  15761. * @static
  15762. * @memberOf _
  15763. * @since 4.0.0
  15764. * @category Array
  15765. * @param {Array} pairs The key-value pairs.
  15766. * @returns {Object} Returns the new object.
  15767. * @example
  15768. *
  15769. * _.fromPairs([['a', 1], ['b', 2]]);
  15770. * // => { 'a': 1, 'b': 2 }
  15771. */
  15772. function fromPairs(pairs) {
  15773. var index = -1,
  15774. length = pairs == null ? 0 : pairs.length,
  15775. result = {};
  15776. while (++index < length) {
  15777. var pair = pairs[index];
  15778. result[pair[0]] = pair[1];
  15779. }
  15780. return result;
  15781. }
  15782. /**
  15783. * Gets the first element of `array`.
  15784. *
  15785. * @static
  15786. * @memberOf _
  15787. * @since 0.1.0
  15788. * @alias first
  15789. * @category Array
  15790. * @param {Array} array The array to query.
  15791. * @returns {*} Returns the first element of `array`.
  15792. * @example
  15793. *
  15794. * _.head([1, 2, 3]);
  15795. * // => 1
  15796. *
  15797. * _.head([]);
  15798. * // => undefined
  15799. */
  15800. function head(array) {
  15801. return (array && array.length) ? array[0] : undefined;
  15802. }
  15803. /**
  15804. * Gets the index at which the first occurrence of `value` is found in `array`
  15805. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  15806. * for equality comparisons. If `fromIndex` is negative, it's used as the
  15807. * offset from the end of `array`.
  15808. *
  15809. * @static
  15810. * @memberOf _
  15811. * @since 0.1.0
  15812. * @category Array
  15813. * @param {Array} array The array to inspect.
  15814. * @param {*} value The value to search for.
  15815. * @param {number} [fromIndex=0] The index to search from.
  15816. * @returns {number} Returns the index of the matched value, else `-1`.
  15817. * @example
  15818. *
  15819. * _.indexOf([1, 2, 1, 2], 2);
  15820. * // => 1
  15821. *
  15822. * // Search from the `fromIndex`.
  15823. * _.indexOf([1, 2, 1, 2], 2, 2);
  15824. * // => 3
  15825. */
  15826. function indexOf(array, value, fromIndex) {
  15827. var length = array == null ? 0 : array.length;
  15828. if (!length) {
  15829. return -1;
  15830. }
  15831. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  15832. if (index < 0) {
  15833. index = nativeMax(length + index, 0);
  15834. }
  15835. return baseIndexOf(array, value, index);
  15836. }
  15837. /**
  15838. * Gets all but the last element of `array`.
  15839. *
  15840. * @static
  15841. * @memberOf _
  15842. * @since 0.1.0
  15843. * @category Array
  15844. * @param {Array} array The array to query.
  15845. * @returns {Array} Returns the slice of `array`.
  15846. * @example
  15847. *
  15848. * _.initial([1, 2, 3]);
  15849. * // => [1, 2]
  15850. */
  15851. function initial(array) {
  15852. var length = array == null ? 0 : array.length;
  15853. return length ? baseSlice(array, 0, -1) : [];
  15854. }
  15855. /**
  15856. * Creates an array of unique values that are included in all given arrays
  15857. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  15858. * for equality comparisons. The order and references of result values are
  15859. * determined by the first array.
  15860. *
  15861. * @static
  15862. * @memberOf _
  15863. * @since 0.1.0
  15864. * @category Array
  15865. * @param {...Array} [arrays] The arrays to inspect.
  15866. * @returns {Array} Returns the new array of intersecting values.
  15867. * @example
  15868. *
  15869. * _.intersection([2, 1], [2, 3]);
  15870. * // => [2]
  15871. */
  15872. var intersection = baseRest(function(arrays) {
  15873. var mapped = arrayMap(arrays, castArrayLikeObject);
  15874. return (mapped.length && mapped[0] === arrays[0])
  15875. ? baseIntersection(mapped)
  15876. : [];
  15877. });
  15878. /**
  15879. * This method is like `_.intersection` except that it accepts `iteratee`
  15880. * which is invoked for each element of each `arrays` to generate the criterion
  15881. * by which they're compared. The order and references of result values are
  15882. * determined by the first array. The iteratee is invoked with one argument:
  15883. * (value).
  15884. *
  15885. * @static
  15886. * @memberOf _
  15887. * @since 4.0.0
  15888. * @category Array
  15889. * @param {...Array} [arrays] The arrays to inspect.
  15890. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  15891. * @returns {Array} Returns the new array of intersecting values.
  15892. * @example
  15893. *
  15894. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  15895. * // => [2.1]
  15896. *
  15897. * // The `_.property` iteratee shorthand.
  15898. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  15899. * // => [{ 'x': 1 }]
  15900. */
  15901. var intersectionBy = baseRest(function(arrays) {
  15902. var iteratee = last(arrays),
  15903. mapped = arrayMap(arrays, castArrayLikeObject);
  15904. if (iteratee === last(mapped)) {
  15905. iteratee = undefined;
  15906. } else {
  15907. mapped.pop();
  15908. }
  15909. return (mapped.length && mapped[0] === arrays[0])
  15910. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  15911. : [];
  15912. });
  15913. /**
  15914. * This method is like `_.intersection` except that it accepts `comparator`
  15915. * which is invoked to compare elements of `arrays`. The order and references
  15916. * of result values are determined by the first array. The comparator is
  15917. * invoked with two arguments: (arrVal, othVal).
  15918. *
  15919. * @static
  15920. * @memberOf _
  15921. * @since 4.0.0
  15922. * @category Array
  15923. * @param {...Array} [arrays] The arrays to inspect.
  15924. * @param {Function} [comparator] The comparator invoked per element.
  15925. * @returns {Array} Returns the new array of intersecting values.
  15926. * @example
  15927. *
  15928. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  15929. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  15930. *
  15931. * _.intersectionWith(objects, others, _.isEqual);
  15932. * // => [{ 'x': 1, 'y': 2 }]
  15933. */
  15934. var intersectionWith = baseRest(function(arrays) {
  15935. var comparator = last(arrays),
  15936. mapped = arrayMap(arrays, castArrayLikeObject);
  15937. comparator = typeof comparator == 'function' ? comparator : undefined;
  15938. if (comparator) {
  15939. mapped.pop();
  15940. }
  15941. return (mapped.length && mapped[0] === arrays[0])
  15942. ? baseIntersection(mapped, undefined, comparator)
  15943. : [];
  15944. });
  15945. /**
  15946. * Converts all elements in `array` into a string separated by `separator`.
  15947. *
  15948. * @static
  15949. * @memberOf _
  15950. * @since 4.0.0
  15951. * @category Array
  15952. * @param {Array} array The array to convert.
  15953. * @param {string} [separator=','] The element separator.
  15954. * @returns {string} Returns the joined string.
  15955. * @example
  15956. *
  15957. * _.join(['a', 'b', 'c'], '~');
  15958. * // => 'a~b~c'
  15959. */
  15960. function join(array, separator) {
  15961. return array == null ? '' : nativeJoin.call(array, separator);
  15962. }
  15963. /**
  15964. * Gets the last element of `array`.
  15965. *
  15966. * @static
  15967. * @memberOf _
  15968. * @since 0.1.0
  15969. * @category Array
  15970. * @param {Array} array The array to query.
  15971. * @returns {*} Returns the last element of `array`.
  15972. * @example
  15973. *
  15974. * _.last([1, 2, 3]);
  15975. * // => 3
  15976. */
  15977. function last(array) {
  15978. var length = array == null ? 0 : array.length;
  15979. return length ? array[length - 1] : undefined;
  15980. }
  15981. /**
  15982. * This method is like `_.indexOf` except that it iterates over elements of
  15983. * `array` from right to left.
  15984. *
  15985. * @static
  15986. * @memberOf _
  15987. * @since 0.1.0
  15988. * @category Array
  15989. * @param {Array} array The array to inspect.
  15990. * @param {*} value The value to search for.
  15991. * @param {number} [fromIndex=array.length-1] The index to search from.
  15992. * @returns {number} Returns the index of the matched value, else `-1`.
  15993. * @example
  15994. *
  15995. * _.lastIndexOf([1, 2, 1, 2], 2);
  15996. * // => 3
  15997. *
  15998. * // Search from the `fromIndex`.
  15999. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  16000. * // => 1
  16001. */
  16002. function lastIndexOf(array, value, fromIndex) {
  16003. var length = array == null ? 0 : array.length;
  16004. if (!length) {
  16005. return -1;
  16006. }
  16007. var index = length;
  16008. if (fromIndex !== undefined) {
  16009. index = toInteger(fromIndex);
  16010. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  16011. }
  16012. return value === value
  16013. ? strictLastIndexOf(array, value, index)
  16014. : baseFindIndex(array, baseIsNaN, index, true);
  16015. }
  16016. /**
  16017. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  16018. * element from the end is returned.
  16019. *
  16020. * @static
  16021. * @memberOf _
  16022. * @since 4.11.0
  16023. * @category Array
  16024. * @param {Array} array The array to query.
  16025. * @param {number} [n=0] The index of the element to return.
  16026. * @returns {*} Returns the nth element of `array`.
  16027. * @example
  16028. *
  16029. * var array = ['a', 'b', 'c', 'd'];
  16030. *
  16031. * _.nth(array, 1);
  16032. * // => 'b'
  16033. *
  16034. * _.nth(array, -2);
  16035. * // => 'c';
  16036. */
  16037. function nth(array, n) {
  16038. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  16039. }
  16040. /**
  16041. * Removes all given values from `array` using
  16042. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16043. * for equality comparisons.
  16044. *
  16045. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  16046. * to remove elements from an array by predicate.
  16047. *
  16048. * @static
  16049. * @memberOf _
  16050. * @since 2.0.0
  16051. * @category Array
  16052. * @param {Array} array The array to modify.
  16053. * @param {...*} [values] The values to remove.
  16054. * @returns {Array} Returns `array`.
  16055. * @example
  16056. *
  16057. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  16058. *
  16059. * _.pull(array, 'a', 'c');
  16060. * console.log(array);
  16061. * // => ['b', 'b']
  16062. */
  16063. var pull = baseRest(pullAll);
  16064. /**
  16065. * This method is like `_.pull` except that it accepts an array of values to remove.
  16066. *
  16067. * **Note:** Unlike `_.difference`, this method mutates `array`.
  16068. *
  16069. * @static
  16070. * @memberOf _
  16071. * @since 4.0.0
  16072. * @category Array
  16073. * @param {Array} array The array to modify.
  16074. * @param {Array} values The values to remove.
  16075. * @returns {Array} Returns `array`.
  16076. * @example
  16077. *
  16078. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  16079. *
  16080. * _.pullAll(array, ['a', 'c']);
  16081. * console.log(array);
  16082. * // => ['b', 'b']
  16083. */
  16084. function pullAll(array, values) {
  16085. return (array && array.length && values && values.length)
  16086. ? basePullAll(array, values)
  16087. : array;
  16088. }
  16089. /**
  16090. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  16091. * invoked for each element of `array` and `values` to generate the criterion
  16092. * by which they're compared. The iteratee is invoked with one argument: (value).
  16093. *
  16094. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  16095. *
  16096. * @static
  16097. * @memberOf _
  16098. * @since 4.0.0
  16099. * @category Array
  16100. * @param {Array} array The array to modify.
  16101. * @param {Array} values The values to remove.
  16102. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16103. * @returns {Array} Returns `array`.
  16104. * @example
  16105. *
  16106. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  16107. *
  16108. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  16109. * console.log(array);
  16110. * // => [{ 'x': 2 }]
  16111. */
  16112. function pullAllBy(array, values, iteratee) {
  16113. return (array && array.length && values && values.length)
  16114. ? basePullAll(array, values, getIteratee(iteratee, 2))
  16115. : array;
  16116. }
  16117. /**
  16118. * This method is like `_.pullAll` except that it accepts `comparator` which
  16119. * is invoked to compare elements of `array` to `values`. The comparator is
  16120. * invoked with two arguments: (arrVal, othVal).
  16121. *
  16122. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  16123. *
  16124. * @static
  16125. * @memberOf _
  16126. * @since 4.6.0
  16127. * @category Array
  16128. * @param {Array} array The array to modify.
  16129. * @param {Array} values The values to remove.
  16130. * @param {Function} [comparator] The comparator invoked per element.
  16131. * @returns {Array} Returns `array`.
  16132. * @example
  16133. *
  16134. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  16135. *
  16136. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  16137. * console.log(array);
  16138. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  16139. */
  16140. function pullAllWith(array, values, comparator) {
  16141. return (array && array.length && values && values.length)
  16142. ? basePullAll(array, values, undefined, comparator)
  16143. : array;
  16144. }
  16145. /**
  16146. * Removes elements from `array` corresponding to `indexes` and returns an
  16147. * array of removed elements.
  16148. *
  16149. * **Note:** Unlike `_.at`, this method mutates `array`.
  16150. *
  16151. * @static
  16152. * @memberOf _
  16153. * @since 3.0.0
  16154. * @category Array
  16155. * @param {Array} array The array to modify.
  16156. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  16157. * @returns {Array} Returns the new array of removed elements.
  16158. * @example
  16159. *
  16160. * var array = ['a', 'b', 'c', 'd'];
  16161. * var pulled = _.pullAt(array, [1, 3]);
  16162. *
  16163. * console.log(array);
  16164. * // => ['a', 'c']
  16165. *
  16166. * console.log(pulled);
  16167. * // => ['b', 'd']
  16168. */
  16169. var pullAt = flatRest(function(array, indexes) {
  16170. var length = array == null ? 0 : array.length,
  16171. result = baseAt(array, indexes);
  16172. basePullAt(array, arrayMap(indexes, function(index) {
  16173. return isIndex(index, length) ? +index : index;
  16174. }).sort(compareAscending));
  16175. return result;
  16176. });
  16177. /**
  16178. * Removes all elements from `array` that `predicate` returns truthy for
  16179. * and returns an array of the removed elements. The predicate is invoked
  16180. * with three arguments: (value, index, array).
  16181. *
  16182. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  16183. * to pull elements from an array by value.
  16184. *
  16185. * @static
  16186. * @memberOf _
  16187. * @since 2.0.0
  16188. * @category Array
  16189. * @param {Array} array The array to modify.
  16190. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  16191. * @returns {Array} Returns the new array of removed elements.
  16192. * @example
  16193. *
  16194. * var array = [1, 2, 3, 4];
  16195. * var evens = _.remove(array, function(n) {
  16196. * return n % 2 == 0;
  16197. * });
  16198. *
  16199. * console.log(array);
  16200. * // => [1, 3]
  16201. *
  16202. * console.log(evens);
  16203. * // => [2, 4]
  16204. */
  16205. function remove(array, predicate) {
  16206. var result = [];
  16207. if (!(array && array.length)) {
  16208. return result;
  16209. }
  16210. var index = -1,
  16211. indexes = [],
  16212. length = array.length;
  16213. predicate = getIteratee(predicate, 3);
  16214. while (++index < length) {
  16215. var value = array[index];
  16216. if (predicate(value, index, array)) {
  16217. result.push(value);
  16218. indexes.push(index);
  16219. }
  16220. }
  16221. basePullAt(array, indexes);
  16222. return result;
  16223. }
  16224. /**
  16225. * Reverses `array` so that the first element becomes the last, the second
  16226. * element becomes the second to last, and so on.
  16227. *
  16228. * **Note:** This method mutates `array` and is based on
  16229. * [`Array#reverse`](https://mdn.io/Array/reverse).
  16230. *
  16231. * @static
  16232. * @memberOf _
  16233. * @since 4.0.0
  16234. * @category Array
  16235. * @param {Array} array The array to modify.
  16236. * @returns {Array} Returns `array`.
  16237. * @example
  16238. *
  16239. * var array = [1, 2, 3];
  16240. *
  16241. * _.reverse(array);
  16242. * // => [3, 2, 1]
  16243. *
  16244. * console.log(array);
  16245. * // => [3, 2, 1]
  16246. */
  16247. function reverse(array) {
  16248. return array == null ? array : nativeReverse.call(array);
  16249. }
  16250. /**
  16251. * Creates a slice of `array` from `start` up to, but not including, `end`.
  16252. *
  16253. * **Note:** This method is used instead of
  16254. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  16255. * returned.
  16256. *
  16257. * @static
  16258. * @memberOf _
  16259. * @since 3.0.0
  16260. * @category Array
  16261. * @param {Array} array The array to slice.
  16262. * @param {number} [start=0] The start position.
  16263. * @param {number} [end=array.length] The end position.
  16264. * @returns {Array} Returns the slice of `array`.
  16265. */
  16266. function slice(array, start, end) {
  16267. var length = array == null ? 0 : array.length;
  16268. if (!length) {
  16269. return [];
  16270. }
  16271. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  16272. start = 0;
  16273. end = length;
  16274. }
  16275. else {
  16276. start = start == null ? 0 : toInteger(start);
  16277. end = end === undefined ? length : toInteger(end);
  16278. }
  16279. return baseSlice(array, start, end);
  16280. }
  16281. /**
  16282. * Uses a binary search to determine the lowest index at which `value`
  16283. * should be inserted into `array` in order to maintain its sort order.
  16284. *
  16285. * @static
  16286. * @memberOf _
  16287. * @since 0.1.0
  16288. * @category Array
  16289. * @param {Array} array The sorted array to inspect.
  16290. * @param {*} value The value to evaluate.
  16291. * @returns {number} Returns the index at which `value` should be inserted
  16292. * into `array`.
  16293. * @example
  16294. *
  16295. * _.sortedIndex([30, 50], 40);
  16296. * // => 1
  16297. */
  16298. function sortedIndex(array, value) {
  16299. return baseSortedIndex(array, value);
  16300. }
  16301. /**
  16302. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  16303. * which is invoked for `value` and each element of `array` to compute their
  16304. * sort ranking. The iteratee is invoked with one argument: (value).
  16305. *
  16306. * @static
  16307. * @memberOf _
  16308. * @since 4.0.0
  16309. * @category Array
  16310. * @param {Array} array The sorted array to inspect.
  16311. * @param {*} value The value to evaluate.
  16312. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16313. * @returns {number} Returns the index at which `value` should be inserted
  16314. * into `array`.
  16315. * @example
  16316. *
  16317. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  16318. *
  16319. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  16320. * // => 0
  16321. *
  16322. * // The `_.property` iteratee shorthand.
  16323. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  16324. * // => 0
  16325. */
  16326. function sortedIndexBy(array, value, iteratee) {
  16327. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  16328. }
  16329. /**
  16330. * This method is like `_.indexOf` except that it performs a binary
  16331. * search on a sorted `array`.
  16332. *
  16333. * @static
  16334. * @memberOf _
  16335. * @since 4.0.0
  16336. * @category Array
  16337. * @param {Array} array The array to inspect.
  16338. * @param {*} value The value to search for.
  16339. * @returns {number} Returns the index of the matched value, else `-1`.
  16340. * @example
  16341. *
  16342. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  16343. * // => 1
  16344. */
  16345. function sortedIndexOf(array, value) {
  16346. var length = array == null ? 0 : array.length;
  16347. if (length) {
  16348. var index = baseSortedIndex(array, value);
  16349. if (index < length && eq(array[index], value)) {
  16350. return index;
  16351. }
  16352. }
  16353. return -1;
  16354. }
  16355. /**
  16356. * This method is like `_.sortedIndex` except that it returns the highest
  16357. * index at which `value` should be inserted into `array` in order to
  16358. * maintain its sort order.
  16359. *
  16360. * @static
  16361. * @memberOf _
  16362. * @since 3.0.0
  16363. * @category Array
  16364. * @param {Array} array The sorted array to inspect.
  16365. * @param {*} value The value to evaluate.
  16366. * @returns {number} Returns the index at which `value` should be inserted
  16367. * into `array`.
  16368. * @example
  16369. *
  16370. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  16371. * // => 4
  16372. */
  16373. function sortedLastIndex(array, value) {
  16374. return baseSortedIndex(array, value, true);
  16375. }
  16376. /**
  16377. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  16378. * which is invoked for `value` and each element of `array` to compute their
  16379. * sort ranking. The iteratee is invoked with one argument: (value).
  16380. *
  16381. * @static
  16382. * @memberOf _
  16383. * @since 4.0.0
  16384. * @category Array
  16385. * @param {Array} array The sorted array to inspect.
  16386. * @param {*} value The value to evaluate.
  16387. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16388. * @returns {number} Returns the index at which `value` should be inserted
  16389. * into `array`.
  16390. * @example
  16391. *
  16392. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  16393. *
  16394. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  16395. * // => 1
  16396. *
  16397. * // The `_.property` iteratee shorthand.
  16398. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  16399. * // => 1
  16400. */
  16401. function sortedLastIndexBy(array, value, iteratee) {
  16402. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  16403. }
  16404. /**
  16405. * This method is like `_.lastIndexOf` except that it performs a binary
  16406. * search on a sorted `array`.
  16407. *
  16408. * @static
  16409. * @memberOf _
  16410. * @since 4.0.0
  16411. * @category Array
  16412. * @param {Array} array The array to inspect.
  16413. * @param {*} value The value to search for.
  16414. * @returns {number} Returns the index of the matched value, else `-1`.
  16415. * @example
  16416. *
  16417. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  16418. * // => 3
  16419. */
  16420. function sortedLastIndexOf(array, value) {
  16421. var length = array == null ? 0 : array.length;
  16422. if (length) {
  16423. var index = baseSortedIndex(array, value, true) - 1;
  16424. if (eq(array[index], value)) {
  16425. return index;
  16426. }
  16427. }
  16428. return -1;
  16429. }
  16430. /**
  16431. * This method is like `_.uniq` except that it's designed and optimized
  16432. * for sorted arrays.
  16433. *
  16434. * @static
  16435. * @memberOf _
  16436. * @since 4.0.0
  16437. * @category Array
  16438. * @param {Array} array The array to inspect.
  16439. * @returns {Array} Returns the new duplicate free array.
  16440. * @example
  16441. *
  16442. * _.sortedUniq([1, 1, 2]);
  16443. * // => [1, 2]
  16444. */
  16445. function sortedUniq(array) {
  16446. return (array && array.length)
  16447. ? baseSortedUniq(array)
  16448. : [];
  16449. }
  16450. /**
  16451. * This method is like `_.uniqBy` except that it's designed and optimized
  16452. * for sorted arrays.
  16453. *
  16454. * @static
  16455. * @memberOf _
  16456. * @since 4.0.0
  16457. * @category Array
  16458. * @param {Array} array The array to inspect.
  16459. * @param {Function} [iteratee] The iteratee invoked per element.
  16460. * @returns {Array} Returns the new duplicate free array.
  16461. * @example
  16462. *
  16463. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  16464. * // => [1.1, 2.3]
  16465. */
  16466. function sortedUniqBy(array, iteratee) {
  16467. return (array && array.length)
  16468. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  16469. : [];
  16470. }
  16471. /**
  16472. * Gets all but the first element of `array`.
  16473. *
  16474. * @static
  16475. * @memberOf _
  16476. * @since 4.0.0
  16477. * @category Array
  16478. * @param {Array} array The array to query.
  16479. * @returns {Array} Returns the slice of `array`.
  16480. * @example
  16481. *
  16482. * _.tail([1, 2, 3]);
  16483. * // => [2, 3]
  16484. */
  16485. function tail(array) {
  16486. var length = array == null ? 0 : array.length;
  16487. return length ? baseSlice(array, 1, length) : [];
  16488. }
  16489. /**
  16490. * Creates a slice of `array` with `n` elements taken from the beginning.
  16491. *
  16492. * @static
  16493. * @memberOf _
  16494. * @since 0.1.0
  16495. * @category Array
  16496. * @param {Array} array The array to query.
  16497. * @param {number} [n=1] The number of elements to take.
  16498. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  16499. * @returns {Array} Returns the slice of `array`.
  16500. * @example
  16501. *
  16502. * _.take([1, 2, 3]);
  16503. * // => [1]
  16504. *
  16505. * _.take([1, 2, 3], 2);
  16506. * // => [1, 2]
  16507. *
  16508. * _.take([1, 2, 3], 5);
  16509. * // => [1, 2, 3]
  16510. *
  16511. * _.take([1, 2, 3], 0);
  16512. * // => []
  16513. */
  16514. function take(array, n, guard) {
  16515. if (!(array && array.length)) {
  16516. return [];
  16517. }
  16518. n = (guard || n === undefined) ? 1 : toInteger(n);
  16519. return baseSlice(array, 0, n < 0 ? 0 : n);
  16520. }
  16521. /**
  16522. * Creates a slice of `array` with `n` elements taken from the end.
  16523. *
  16524. * @static
  16525. * @memberOf _
  16526. * @since 3.0.0
  16527. * @category Array
  16528. * @param {Array} array The array to query.
  16529. * @param {number} [n=1] The number of elements to take.
  16530. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  16531. * @returns {Array} Returns the slice of `array`.
  16532. * @example
  16533. *
  16534. * _.takeRight([1, 2, 3]);
  16535. * // => [3]
  16536. *
  16537. * _.takeRight([1, 2, 3], 2);
  16538. * // => [2, 3]
  16539. *
  16540. * _.takeRight([1, 2, 3], 5);
  16541. * // => [1, 2, 3]
  16542. *
  16543. * _.takeRight([1, 2, 3], 0);
  16544. * // => []
  16545. */
  16546. function takeRight(array, n, guard) {
  16547. var length = array == null ? 0 : array.length;
  16548. if (!length) {
  16549. return [];
  16550. }
  16551. n = (guard || n === undefined) ? 1 : toInteger(n);
  16552. n = length - n;
  16553. return baseSlice(array, n < 0 ? 0 : n, length);
  16554. }
  16555. /**
  16556. * Creates a slice of `array` with elements taken from the end. Elements are
  16557. * taken until `predicate` returns falsey. The predicate is invoked with
  16558. * three arguments: (value, index, array).
  16559. *
  16560. * @static
  16561. * @memberOf _
  16562. * @since 3.0.0
  16563. * @category Array
  16564. * @param {Array} array The array to query.
  16565. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  16566. * @returns {Array} Returns the slice of `array`.
  16567. * @example
  16568. *
  16569. * var users = [
  16570. * { 'user': 'barney', 'active': true },
  16571. * { 'user': 'fred', 'active': false },
  16572. * { 'user': 'pebbles', 'active': false }
  16573. * ];
  16574. *
  16575. * _.takeRightWhile(users, function(o) { return !o.active; });
  16576. * // => objects for ['fred', 'pebbles']
  16577. *
  16578. * // The `_.matches` iteratee shorthand.
  16579. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  16580. * // => objects for ['pebbles']
  16581. *
  16582. * // The `_.matchesProperty` iteratee shorthand.
  16583. * _.takeRightWhile(users, ['active', false]);
  16584. * // => objects for ['fred', 'pebbles']
  16585. *
  16586. * // The `_.property` iteratee shorthand.
  16587. * _.takeRightWhile(users, 'active');
  16588. * // => []
  16589. */
  16590. function takeRightWhile(array, predicate) {
  16591. return (array && array.length)
  16592. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  16593. : [];
  16594. }
  16595. /**
  16596. * Creates a slice of `array` with elements taken from the beginning. Elements
  16597. * are taken until `predicate` returns falsey. The predicate is invoked with
  16598. * three arguments: (value, index, array).
  16599. *
  16600. * @static
  16601. * @memberOf _
  16602. * @since 3.0.0
  16603. * @category Array
  16604. * @param {Array} array The array to query.
  16605. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  16606. * @returns {Array} Returns the slice of `array`.
  16607. * @example
  16608. *
  16609. * var users = [
  16610. * { 'user': 'barney', 'active': false },
  16611. * { 'user': 'fred', 'active': false },
  16612. * { 'user': 'pebbles', 'active': true }
  16613. * ];
  16614. *
  16615. * _.takeWhile(users, function(o) { return !o.active; });
  16616. * // => objects for ['barney', 'fred']
  16617. *
  16618. * // The `_.matches` iteratee shorthand.
  16619. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  16620. * // => objects for ['barney']
  16621. *
  16622. * // The `_.matchesProperty` iteratee shorthand.
  16623. * _.takeWhile(users, ['active', false]);
  16624. * // => objects for ['barney', 'fred']
  16625. *
  16626. * // The `_.property` iteratee shorthand.
  16627. * _.takeWhile(users, 'active');
  16628. * // => []
  16629. */
  16630. function takeWhile(array, predicate) {
  16631. return (array && array.length)
  16632. ? baseWhile(array, getIteratee(predicate, 3))
  16633. : [];
  16634. }
  16635. /**
  16636. * Creates an array of unique values, in order, from all given arrays using
  16637. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16638. * for equality comparisons.
  16639. *
  16640. * @static
  16641. * @memberOf _
  16642. * @since 0.1.0
  16643. * @category Array
  16644. * @param {...Array} [arrays] The arrays to inspect.
  16645. * @returns {Array} Returns the new array of combined values.
  16646. * @example
  16647. *
  16648. * _.union([2], [1, 2]);
  16649. * // => [2, 1]
  16650. */
  16651. var union = baseRest(function(arrays) {
  16652. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  16653. });
  16654. /**
  16655. * This method is like `_.union` except that it accepts `iteratee` which is
  16656. * invoked for each element of each `arrays` to generate the criterion by
  16657. * which uniqueness is computed. Result values are chosen from the first
  16658. * array in which the value occurs. The iteratee is invoked with one argument:
  16659. * (value).
  16660. *
  16661. * @static
  16662. * @memberOf _
  16663. * @since 4.0.0
  16664. * @category Array
  16665. * @param {...Array} [arrays] The arrays to inspect.
  16666. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16667. * @returns {Array} Returns the new array of combined values.
  16668. * @example
  16669. *
  16670. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  16671. * // => [2.1, 1.2]
  16672. *
  16673. * // The `_.property` iteratee shorthand.
  16674. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  16675. * // => [{ 'x': 1 }, { 'x': 2 }]
  16676. */
  16677. var unionBy = baseRest(function(arrays) {
  16678. var iteratee = last(arrays);
  16679. if (isArrayLikeObject(iteratee)) {
  16680. iteratee = undefined;
  16681. }
  16682. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  16683. });
  16684. /**
  16685. * This method is like `_.union` except that it accepts `comparator` which
  16686. * is invoked to compare elements of `arrays`. Result values are chosen from
  16687. * the first array in which the value occurs. The comparator is invoked
  16688. * with two arguments: (arrVal, othVal).
  16689. *
  16690. * @static
  16691. * @memberOf _
  16692. * @since 4.0.0
  16693. * @category Array
  16694. * @param {...Array} [arrays] The arrays to inspect.
  16695. * @param {Function} [comparator] The comparator invoked per element.
  16696. * @returns {Array} Returns the new array of combined values.
  16697. * @example
  16698. *
  16699. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  16700. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  16701. *
  16702. * _.unionWith(objects, others, _.isEqual);
  16703. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  16704. */
  16705. var unionWith = baseRest(function(arrays) {
  16706. var comparator = last(arrays);
  16707. comparator = typeof comparator == 'function' ? comparator : undefined;
  16708. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  16709. });
  16710. /**
  16711. * Creates a duplicate-free version of an array, using
  16712. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16713. * for equality comparisons, in which only the first occurrence of each element
  16714. * is kept. The order of result values is determined by the order they occur
  16715. * in the array.
  16716. *
  16717. * @static
  16718. * @memberOf _
  16719. * @since 0.1.0
  16720. * @category Array
  16721. * @param {Array} array The array to inspect.
  16722. * @returns {Array} Returns the new duplicate free array.
  16723. * @example
  16724. *
  16725. * _.uniq([2, 1, 2]);
  16726. * // => [2, 1]
  16727. */
  16728. function uniq(array) {
  16729. return (array && array.length) ? baseUniq(array) : [];
  16730. }
  16731. /**
  16732. * This method is like `_.uniq` except that it accepts `iteratee` which is
  16733. * invoked for each element in `array` to generate the criterion by which
  16734. * uniqueness is computed. The order of result values is determined by the
  16735. * order they occur in the array. The iteratee is invoked with one argument:
  16736. * (value).
  16737. *
  16738. * @static
  16739. * @memberOf _
  16740. * @since 4.0.0
  16741. * @category Array
  16742. * @param {Array} array The array to inspect.
  16743. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16744. * @returns {Array} Returns the new duplicate free array.
  16745. * @example
  16746. *
  16747. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  16748. * // => [2.1, 1.2]
  16749. *
  16750. * // The `_.property` iteratee shorthand.
  16751. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  16752. * // => [{ 'x': 1 }, { 'x': 2 }]
  16753. */
  16754. function uniqBy(array, iteratee) {
  16755. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  16756. }
  16757. /**
  16758. * This method is like `_.uniq` except that it accepts `comparator` which
  16759. * is invoked to compare elements of `array`. The order of result values is
  16760. * determined by the order they occur in the array.The comparator is invoked
  16761. * with two arguments: (arrVal, othVal).
  16762. *
  16763. * @static
  16764. * @memberOf _
  16765. * @since 4.0.0
  16766. * @category Array
  16767. * @param {Array} array The array to inspect.
  16768. * @param {Function} [comparator] The comparator invoked per element.
  16769. * @returns {Array} Returns the new duplicate free array.
  16770. * @example
  16771. *
  16772. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  16773. *
  16774. * _.uniqWith(objects, _.isEqual);
  16775. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  16776. */
  16777. function uniqWith(array, comparator) {
  16778. comparator = typeof comparator == 'function' ? comparator : undefined;
  16779. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  16780. }
  16781. /**
  16782. * This method is like `_.zip` except that it accepts an array of grouped
  16783. * elements and creates an array regrouping the elements to their pre-zip
  16784. * configuration.
  16785. *
  16786. * @static
  16787. * @memberOf _
  16788. * @since 1.2.0
  16789. * @category Array
  16790. * @param {Array} array The array of grouped elements to process.
  16791. * @returns {Array} Returns the new array of regrouped elements.
  16792. * @example
  16793. *
  16794. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  16795. * // => [['a', 1, true], ['b', 2, false]]
  16796. *
  16797. * _.unzip(zipped);
  16798. * // => [['a', 'b'], [1, 2], [true, false]]
  16799. */
  16800. function unzip(array) {
  16801. if (!(array && array.length)) {
  16802. return [];
  16803. }
  16804. var length = 0;
  16805. array = arrayFilter(array, function(group) {
  16806. if (isArrayLikeObject(group)) {
  16807. length = nativeMax(group.length, length);
  16808. return true;
  16809. }
  16810. });
  16811. return baseTimes(length, function(index) {
  16812. return arrayMap(array, baseProperty(index));
  16813. });
  16814. }
  16815. /**
  16816. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  16817. * how regrouped values should be combined. The iteratee is invoked with the
  16818. * elements of each group: (...group).
  16819. *
  16820. * @static
  16821. * @memberOf _
  16822. * @since 3.8.0
  16823. * @category Array
  16824. * @param {Array} array The array of grouped elements to process.
  16825. * @param {Function} [iteratee=_.identity] The function to combine
  16826. * regrouped values.
  16827. * @returns {Array} Returns the new array of regrouped elements.
  16828. * @example
  16829. *
  16830. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  16831. * // => [[1, 10, 100], [2, 20, 200]]
  16832. *
  16833. * _.unzipWith(zipped, _.add);
  16834. * // => [3, 30, 300]
  16835. */
  16836. function unzipWith(array, iteratee) {
  16837. if (!(array && array.length)) {
  16838. return [];
  16839. }
  16840. var result = unzip(array);
  16841. if (iteratee == null) {
  16842. return result;
  16843. }
  16844. return arrayMap(result, function(group) {
  16845. return apply(iteratee, undefined, group);
  16846. });
  16847. }
  16848. /**
  16849. * Creates an array excluding all given values using
  16850. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16851. * for equality comparisons.
  16852. *
  16853. * **Note:** Unlike `_.pull`, this method returns a new array.
  16854. *
  16855. * @static
  16856. * @memberOf _
  16857. * @since 0.1.0
  16858. * @category Array
  16859. * @param {Array} array The array to inspect.
  16860. * @param {...*} [values] The values to exclude.
  16861. * @returns {Array} Returns the new array of filtered values.
  16862. * @see _.difference, _.xor
  16863. * @example
  16864. *
  16865. * _.without([2, 1, 2, 3], 1, 2);
  16866. * // => [3]
  16867. */
  16868. var without = baseRest(function(array, values) {
  16869. return isArrayLikeObject(array)
  16870. ? baseDifference(array, values)
  16871. : [];
  16872. });
  16873. /**
  16874. * Creates an array of unique values that is the
  16875. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  16876. * of the given arrays. The order of result values is determined by the order
  16877. * they occur in the arrays.
  16878. *
  16879. * @static
  16880. * @memberOf _
  16881. * @since 2.4.0
  16882. * @category Array
  16883. * @param {...Array} [arrays] The arrays to inspect.
  16884. * @returns {Array} Returns the new array of filtered values.
  16885. * @see _.difference, _.without
  16886. * @example
  16887. *
  16888. * _.xor([2, 1], [2, 3]);
  16889. * // => [1, 3]
  16890. */
  16891. var xor = baseRest(function(arrays) {
  16892. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  16893. });
  16894. /**
  16895. * This method is like `_.xor` except that it accepts `iteratee` which is
  16896. * invoked for each element of each `arrays` to generate the criterion by
  16897. * which by which they're compared. The order of result values is determined
  16898. * by the order they occur in the arrays. The iteratee is invoked with one
  16899. * argument: (value).
  16900. *
  16901. * @static
  16902. * @memberOf _
  16903. * @since 4.0.0
  16904. * @category Array
  16905. * @param {...Array} [arrays] The arrays to inspect.
  16906. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16907. * @returns {Array} Returns the new array of filtered values.
  16908. * @example
  16909. *
  16910. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  16911. * // => [1.2, 3.4]
  16912. *
  16913. * // The `_.property` iteratee shorthand.
  16914. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  16915. * // => [{ 'x': 2 }]
  16916. */
  16917. var xorBy = baseRest(function(arrays) {
  16918. var iteratee = last(arrays);
  16919. if (isArrayLikeObject(iteratee)) {
  16920. iteratee = undefined;
  16921. }
  16922. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  16923. });
  16924. /**
  16925. * This method is like `_.xor` except that it accepts `comparator` which is
  16926. * invoked to compare elements of `arrays`. The order of result values is
  16927. * determined by the order they occur in the arrays. The comparator is invoked
  16928. * with two arguments: (arrVal, othVal).
  16929. *
  16930. * @static
  16931. * @memberOf _
  16932. * @since 4.0.0
  16933. * @category Array
  16934. * @param {...Array} [arrays] The arrays to inspect.
  16935. * @param {Function} [comparator] The comparator invoked per element.
  16936. * @returns {Array} Returns the new array of filtered values.
  16937. * @example
  16938. *
  16939. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  16940. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  16941. *
  16942. * _.xorWith(objects, others, _.isEqual);
  16943. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  16944. */
  16945. var xorWith = baseRest(function(arrays) {
  16946. var comparator = last(arrays);
  16947. comparator = typeof comparator == 'function' ? comparator : undefined;
  16948. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  16949. });
  16950. /**
  16951. * Creates an array of grouped elements, the first of which contains the
  16952. * first elements of the given arrays, the second of which contains the
  16953. * second elements of the given arrays, and so on.
  16954. *
  16955. * @static
  16956. * @memberOf _
  16957. * @since 0.1.0
  16958. * @category Array
  16959. * @param {...Array} [arrays] The arrays to process.
  16960. * @returns {Array} Returns the new array of grouped elements.
  16961. * @example
  16962. *
  16963. * _.zip(['a', 'b'], [1, 2], [true, false]);
  16964. * // => [['a', 1, true], ['b', 2, false]]
  16965. */
  16966. var zip = baseRest(unzip);
  16967. /**
  16968. * This method is like `_.fromPairs` except that it accepts two arrays,
  16969. * one of property identifiers and one of corresponding values.
  16970. *
  16971. * @static
  16972. * @memberOf _
  16973. * @since 0.4.0
  16974. * @category Array
  16975. * @param {Array} [props=[]] The property identifiers.
  16976. * @param {Array} [values=[]] The property values.
  16977. * @returns {Object} Returns the new object.
  16978. * @example
  16979. *
  16980. * _.zipObject(['a', 'b'], [1, 2]);
  16981. * // => { 'a': 1, 'b': 2 }
  16982. */
  16983. function zipObject(props, values) {
  16984. return baseZipObject(props || [], values || [], assignValue);
  16985. }
  16986. /**
  16987. * This method is like `_.zipObject` except that it supports property paths.
  16988. *
  16989. * @static
  16990. * @memberOf _
  16991. * @since 4.1.0
  16992. * @category Array
  16993. * @param {Array} [props=[]] The property identifiers.
  16994. * @param {Array} [values=[]] The property values.
  16995. * @returns {Object} Returns the new object.
  16996. * @example
  16997. *
  16998. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  16999. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  17000. */
  17001. function zipObjectDeep(props, values) {
  17002. return baseZipObject(props || [], values || [], baseSet);
  17003. }
  17004. /**
  17005. * This method is like `_.zip` except that it accepts `iteratee` to specify
  17006. * how grouped values should be combined. The iteratee is invoked with the
  17007. * elements of each group: (...group).
  17008. *
  17009. * @static
  17010. * @memberOf _
  17011. * @since 3.8.0
  17012. * @category Array
  17013. * @param {...Array} [arrays] The arrays to process.
  17014. * @param {Function} [iteratee=_.identity] The function to combine
  17015. * grouped values.
  17016. * @returns {Array} Returns the new array of grouped elements.
  17017. * @example
  17018. *
  17019. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  17020. * return a + b + c;
  17021. * });
  17022. * // => [111, 222]
  17023. */
  17024. var zipWith = baseRest(function(arrays) {
  17025. var length = arrays.length,
  17026. iteratee = length > 1 ? arrays[length - 1] : undefined;
  17027. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  17028. return unzipWith(arrays, iteratee);
  17029. });
  17030. /*------------------------------------------------------------------------*/
  17031. /**
  17032. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  17033. * chain sequences enabled. The result of such sequences must be unwrapped
  17034. * with `_#value`.
  17035. *
  17036. * @static
  17037. * @memberOf _
  17038. * @since 1.3.0
  17039. * @category Seq
  17040. * @param {*} value The value to wrap.
  17041. * @returns {Object} Returns the new `lodash` wrapper instance.
  17042. * @example
  17043. *
  17044. * var users = [
  17045. * { 'user': 'barney', 'age': 36 },
  17046. * { 'user': 'fred', 'age': 40 },
  17047. * { 'user': 'pebbles', 'age': 1 }
  17048. * ];
  17049. *
  17050. * var youngest = _
  17051. * .chain(users)
  17052. * .sortBy('age')
  17053. * .map(function(o) {
  17054. * return o.user + ' is ' + o.age;
  17055. * })
  17056. * .head()
  17057. * .value();
  17058. * // => 'pebbles is 1'
  17059. */
  17060. function chain(value) {
  17061. var result = lodash(value);
  17062. result.__chain__ = true;
  17063. return result;
  17064. }
  17065. /**
  17066. * This method invokes `interceptor` and returns `value`. The interceptor
  17067. * is invoked with one argument; (value). The purpose of this method is to
  17068. * "tap into" a method chain sequence in order to modify intermediate results.
  17069. *
  17070. * @static
  17071. * @memberOf _
  17072. * @since 0.1.0
  17073. * @category Seq
  17074. * @param {*} value The value to provide to `interceptor`.
  17075. * @param {Function} interceptor The function to invoke.
  17076. * @returns {*} Returns `value`.
  17077. * @example
  17078. *
  17079. * _([1, 2, 3])
  17080. * .tap(function(array) {
  17081. * // Mutate input array.
  17082. * array.pop();
  17083. * })
  17084. * .reverse()
  17085. * .value();
  17086. * // => [2, 1]
  17087. */
  17088. function tap(value, interceptor) {
  17089. interceptor(value);
  17090. return value;
  17091. }
  17092. /**
  17093. * This method is like `_.tap` except that it returns the result of `interceptor`.
  17094. * The purpose of this method is to "pass thru" values replacing intermediate
  17095. * results in a method chain sequence.
  17096. *
  17097. * @static
  17098. * @memberOf _
  17099. * @since 3.0.0
  17100. * @category Seq
  17101. * @param {*} value The value to provide to `interceptor`.
  17102. * @param {Function} interceptor The function to invoke.
  17103. * @returns {*} Returns the result of `interceptor`.
  17104. * @example
  17105. *
  17106. * _(' abc ')
  17107. * .chain()
  17108. * .trim()
  17109. * .thru(function(value) {
  17110. * return [value];
  17111. * })
  17112. * .value();
  17113. * // => ['abc']
  17114. */
  17115. function thru(value, interceptor) {
  17116. return interceptor(value);
  17117. }
  17118. /**
  17119. * This method is the wrapper version of `_.at`.
  17120. *
  17121. * @name at
  17122. * @memberOf _
  17123. * @since 1.0.0
  17124. * @category Seq
  17125. * @param {...(string|string[])} [paths] The property paths to pick.
  17126. * @returns {Object} Returns the new `lodash` wrapper instance.
  17127. * @example
  17128. *
  17129. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  17130. *
  17131. * _(object).at(['a[0].b.c', 'a[1]']).value();
  17132. * // => [3, 4]
  17133. */
  17134. var wrapperAt = flatRest(function(paths) {
  17135. var length = paths.length,
  17136. start = length ? paths[0] : 0,
  17137. value = this.__wrapped__,
  17138. interceptor = function(object) { return baseAt(object, paths); };
  17139. if (length > 1 || this.__actions__.length ||
  17140. !(value instanceof LazyWrapper) || !isIndex(start)) {
  17141. return this.thru(interceptor);
  17142. }
  17143. value = value.slice(start, +start + (length ? 1 : 0));
  17144. value.__actions__.push({
  17145. 'func': thru,
  17146. 'args': [interceptor],
  17147. 'thisArg': undefined
  17148. });
  17149. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  17150. if (length && !array.length) {
  17151. array.push(undefined);
  17152. }
  17153. return array;
  17154. });
  17155. });
  17156. /**
  17157. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  17158. *
  17159. * @name chain
  17160. * @memberOf _
  17161. * @since 0.1.0
  17162. * @category Seq
  17163. * @returns {Object} Returns the new `lodash` wrapper instance.
  17164. * @example
  17165. *
  17166. * var users = [
  17167. * { 'user': 'barney', 'age': 36 },
  17168. * { 'user': 'fred', 'age': 40 }
  17169. * ];
  17170. *
  17171. * // A sequence without explicit chaining.
  17172. * _(users).head();
  17173. * // => { 'user': 'barney', 'age': 36 }
  17174. *
  17175. * // A sequence with explicit chaining.
  17176. * _(users)
  17177. * .chain()
  17178. * .head()
  17179. * .pick('user')
  17180. * .value();
  17181. * // => { 'user': 'barney' }
  17182. */
  17183. function wrapperChain() {
  17184. return chain(this);
  17185. }
  17186. /**
  17187. * Executes the chain sequence and returns the wrapped result.
  17188. *
  17189. * @name commit
  17190. * @memberOf _
  17191. * @since 3.2.0
  17192. * @category Seq
  17193. * @returns {Object} Returns the new `lodash` wrapper instance.
  17194. * @example
  17195. *
  17196. * var array = [1, 2];
  17197. * var wrapped = _(array).push(3);
  17198. *
  17199. * console.log(array);
  17200. * // => [1, 2]
  17201. *
  17202. * wrapped = wrapped.commit();
  17203. * console.log(array);
  17204. * // => [1, 2, 3]
  17205. *
  17206. * wrapped.last();
  17207. * // => 3
  17208. *
  17209. * console.log(array);
  17210. * // => [1, 2, 3]
  17211. */
  17212. function wrapperCommit() {
  17213. return new LodashWrapper(this.value(), this.__chain__);
  17214. }
  17215. /**
  17216. * Gets the next value on a wrapped object following the
  17217. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  17218. *
  17219. * @name next
  17220. * @memberOf _
  17221. * @since 4.0.0
  17222. * @category Seq
  17223. * @returns {Object} Returns the next iterator value.
  17224. * @example
  17225. *
  17226. * var wrapped = _([1, 2]);
  17227. *
  17228. * wrapped.next();
  17229. * // => { 'done': false, 'value': 1 }
  17230. *
  17231. * wrapped.next();
  17232. * // => { 'done': false, 'value': 2 }
  17233. *
  17234. * wrapped.next();
  17235. * // => { 'done': true, 'value': undefined }
  17236. */
  17237. function wrapperNext() {
  17238. if (this.__values__ === undefined) {
  17239. this.__values__ = toArray(this.value());
  17240. }
  17241. var done = this.__index__ >= this.__values__.length,
  17242. value = done ? undefined : this.__values__[this.__index__++];
  17243. return { 'done': done, 'value': value };
  17244. }
  17245. /**
  17246. * Enables the wrapper to be iterable.
  17247. *
  17248. * @name Symbol.iterator
  17249. * @memberOf _
  17250. * @since 4.0.0
  17251. * @category Seq
  17252. * @returns {Object} Returns the wrapper object.
  17253. * @example
  17254. *
  17255. * var wrapped = _([1, 2]);
  17256. *
  17257. * wrapped[Symbol.iterator]() === wrapped;
  17258. * // => true
  17259. *
  17260. * Array.from(wrapped);
  17261. * // => [1, 2]
  17262. */
  17263. function wrapperToIterator() {
  17264. return this;
  17265. }
  17266. /**
  17267. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  17268. *
  17269. * @name plant
  17270. * @memberOf _
  17271. * @since 3.2.0
  17272. * @category Seq
  17273. * @param {*} value The value to plant.
  17274. * @returns {Object} Returns the new `lodash` wrapper instance.
  17275. * @example
  17276. *
  17277. * function square(n) {
  17278. * return n * n;
  17279. * }
  17280. *
  17281. * var wrapped = _([1, 2]).map(square);
  17282. * var other = wrapped.plant([3, 4]);
  17283. *
  17284. * other.value();
  17285. * // => [9, 16]
  17286. *
  17287. * wrapped.value();
  17288. * // => [1, 4]
  17289. */
  17290. function wrapperPlant(value) {
  17291. var result,
  17292. parent = this;
  17293. while (parent instanceof baseLodash) {
  17294. var clone = wrapperClone(parent);
  17295. clone.__index__ = 0;
  17296. clone.__values__ = undefined;
  17297. if (result) {
  17298. previous.__wrapped__ = clone;
  17299. } else {
  17300. result = clone;
  17301. }
  17302. var previous = clone;
  17303. parent = parent.__wrapped__;
  17304. }
  17305. previous.__wrapped__ = value;
  17306. return result;
  17307. }
  17308. /**
  17309. * This method is the wrapper version of `_.reverse`.
  17310. *
  17311. * **Note:** This method mutates the wrapped array.
  17312. *
  17313. * @name reverse
  17314. * @memberOf _
  17315. * @since 0.1.0
  17316. * @category Seq
  17317. * @returns {Object} Returns the new `lodash` wrapper instance.
  17318. * @example
  17319. *
  17320. * var array = [1, 2, 3];
  17321. *
  17322. * _(array).reverse().value()
  17323. * // => [3, 2, 1]
  17324. *
  17325. * console.log(array);
  17326. * // => [3, 2, 1]
  17327. */
  17328. function wrapperReverse() {
  17329. var value = this.__wrapped__;
  17330. if (value instanceof LazyWrapper) {
  17331. var wrapped = value;
  17332. if (this.__actions__.length) {
  17333. wrapped = new LazyWrapper(this);
  17334. }
  17335. wrapped = wrapped.reverse();
  17336. wrapped.__actions__.push({
  17337. 'func': thru,
  17338. 'args': [reverse],
  17339. 'thisArg': undefined
  17340. });
  17341. return new LodashWrapper(wrapped, this.__chain__);
  17342. }
  17343. return this.thru(reverse);
  17344. }
  17345. /**
  17346. * Executes the chain sequence to resolve the unwrapped value.
  17347. *
  17348. * @name value
  17349. * @memberOf _
  17350. * @since 0.1.0
  17351. * @alias toJSON, valueOf
  17352. * @category Seq
  17353. * @returns {*} Returns the resolved unwrapped value.
  17354. * @example
  17355. *
  17356. * _([1, 2, 3]).value();
  17357. * // => [1, 2, 3]
  17358. */
  17359. function wrapperValue() {
  17360. return baseWrapperValue(this.__wrapped__, this.__actions__);
  17361. }
  17362. /*------------------------------------------------------------------------*/
  17363. /**
  17364. * Creates an object composed of keys generated from the results of running
  17365. * each element of `collection` thru `iteratee`. The corresponding value of
  17366. * each key is the number of times the key was returned by `iteratee`. The
  17367. * iteratee is invoked with one argument: (value).
  17368. *
  17369. * @static
  17370. * @memberOf _
  17371. * @since 0.5.0
  17372. * @category Collection
  17373. * @param {Array|Object} collection The collection to iterate over.
  17374. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  17375. * @returns {Object} Returns the composed aggregate object.
  17376. * @example
  17377. *
  17378. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  17379. * // => { '4': 1, '6': 2 }
  17380. *
  17381. * // The `_.property` iteratee shorthand.
  17382. * _.countBy(['one', 'two', 'three'], 'length');
  17383. * // => { '3': 2, '5': 1 }
  17384. */
  17385. var countBy = createAggregator(function(result, value, key) {
  17386. if (hasOwnProperty.call(result, key)) {
  17387. ++result[key];
  17388. } else {
  17389. baseAssignValue(result, key, 1);
  17390. }
  17391. });
  17392. /**
  17393. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  17394. * Iteration is stopped once `predicate` returns falsey. The predicate is
  17395. * invoked with three arguments: (value, index|key, collection).
  17396. *
  17397. * **Note:** This method returns `true` for
  17398. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  17399. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  17400. * elements of empty collections.
  17401. *
  17402. * @static
  17403. * @memberOf _
  17404. * @since 0.1.0
  17405. * @category Collection
  17406. * @param {Array|Object} collection The collection to iterate over.
  17407. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17408. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  17409. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  17410. * else `false`.
  17411. * @example
  17412. *
  17413. * _.every([true, 1, null, 'yes'], Boolean);
  17414. * // => false
  17415. *
  17416. * var users = [
  17417. * { 'user': 'barney', 'age': 36, 'active': false },
  17418. * { 'user': 'fred', 'age': 40, 'active': false }
  17419. * ];
  17420. *
  17421. * // The `_.matches` iteratee shorthand.
  17422. * _.every(users, { 'user': 'barney', 'active': false });
  17423. * // => false
  17424. *
  17425. * // The `_.matchesProperty` iteratee shorthand.
  17426. * _.every(users, ['active', false]);
  17427. * // => true
  17428. *
  17429. * // The `_.property` iteratee shorthand.
  17430. * _.every(users, 'active');
  17431. * // => false
  17432. */
  17433. function every(collection, predicate, guard) {
  17434. var func = isArray(collection) ? arrayEvery : baseEvery;
  17435. if (guard && isIterateeCall(collection, predicate, guard)) {
  17436. predicate = undefined;
  17437. }
  17438. return func(collection, getIteratee(predicate, 3));
  17439. }
  17440. /**
  17441. * Iterates over elements of `collection`, returning an array of all elements
  17442. * `predicate` returns truthy for. The predicate is invoked with three
  17443. * arguments: (value, index|key, collection).
  17444. *
  17445. * **Note:** Unlike `_.remove`, this method returns a new array.
  17446. *
  17447. * @static
  17448. * @memberOf _
  17449. * @since 0.1.0
  17450. * @category Collection
  17451. * @param {Array|Object} collection The collection to iterate over.
  17452. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17453. * @returns {Array} Returns the new filtered array.
  17454. * @see _.reject
  17455. * @example
  17456. *
  17457. * var users = [
  17458. * { 'user': 'barney', 'age': 36, 'active': true },
  17459. * { 'user': 'fred', 'age': 40, 'active': false }
  17460. * ];
  17461. *
  17462. * _.filter(users, function(o) { return !o.active; });
  17463. * // => objects for ['fred']
  17464. *
  17465. * // The `_.matches` iteratee shorthand.
  17466. * _.filter(users, { 'age': 36, 'active': true });
  17467. * // => objects for ['barney']
  17468. *
  17469. * // The `_.matchesProperty` iteratee shorthand.
  17470. * _.filter(users, ['active', false]);
  17471. * // => objects for ['fred']
  17472. *
  17473. * // The `_.property` iteratee shorthand.
  17474. * _.filter(users, 'active');
  17475. * // => objects for ['barney']
  17476. */
  17477. function filter(collection, predicate) {
  17478. var func = isArray(collection) ? arrayFilter : baseFilter;
  17479. return func(collection, getIteratee(predicate, 3));
  17480. }
  17481. /**
  17482. * Iterates over elements of `collection`, returning the first element
  17483. * `predicate` returns truthy for. The predicate is invoked with three
  17484. * arguments: (value, index|key, collection).
  17485. *
  17486. * @static
  17487. * @memberOf _
  17488. * @since 0.1.0
  17489. * @category Collection
  17490. * @param {Array|Object} collection The collection to inspect.
  17491. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17492. * @param {number} [fromIndex=0] The index to search from.
  17493. * @returns {*} Returns the matched element, else `undefined`.
  17494. * @example
  17495. *
  17496. * var users = [
  17497. * { 'user': 'barney', 'age': 36, 'active': true },
  17498. * { 'user': 'fred', 'age': 40, 'active': false },
  17499. * { 'user': 'pebbles', 'age': 1, 'active': true }
  17500. * ];
  17501. *
  17502. * _.find(users, function(o) { return o.age < 40; });
  17503. * // => object for 'barney'
  17504. *
  17505. * // The `_.matches` iteratee shorthand.
  17506. * _.find(users, { 'age': 1, 'active': true });
  17507. * // => object for 'pebbles'
  17508. *
  17509. * // The `_.matchesProperty` iteratee shorthand.
  17510. * _.find(users, ['active', false]);
  17511. * // => object for 'fred'
  17512. *
  17513. * // The `_.property` iteratee shorthand.
  17514. * _.find(users, 'active');
  17515. * // => object for 'barney'
  17516. */
  17517. var find = createFind(findIndex);
  17518. /**
  17519. * This method is like `_.find` except that it iterates over elements of
  17520. * `collection` from right to left.
  17521. *
  17522. * @static
  17523. * @memberOf _
  17524. * @since 2.0.0
  17525. * @category Collection
  17526. * @param {Array|Object} collection The collection to inspect.
  17527. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17528. * @param {number} [fromIndex=collection.length-1] The index to search from.
  17529. * @returns {*} Returns the matched element, else `undefined`.
  17530. * @example
  17531. *
  17532. * _.findLast([1, 2, 3, 4], function(n) {
  17533. * return n % 2 == 1;
  17534. * });
  17535. * // => 3
  17536. */
  17537. var findLast = createFind(findLastIndex);
  17538. /**
  17539. * Creates a flattened array of values by running each element in `collection`
  17540. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  17541. * with three arguments: (value, index|key, collection).
  17542. *
  17543. * @static
  17544. * @memberOf _
  17545. * @since 4.0.0
  17546. * @category Collection
  17547. * @param {Array|Object} collection The collection to iterate over.
  17548. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17549. * @returns {Array} Returns the new flattened array.
  17550. * @example
  17551. *
  17552. * function duplicate(n) {
  17553. * return [n, n];
  17554. * }
  17555. *
  17556. * _.flatMap([1, 2], duplicate);
  17557. * // => [1, 1, 2, 2]
  17558. */
  17559. function flatMap(collection, iteratee) {
  17560. return baseFlatten(map(collection, iteratee), 1);
  17561. }
  17562. /**
  17563. * This method is like `_.flatMap` except that it recursively flattens the
  17564. * mapped results.
  17565. *
  17566. * @static
  17567. * @memberOf _
  17568. * @since 4.7.0
  17569. * @category Collection
  17570. * @param {Array|Object} collection The collection to iterate over.
  17571. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17572. * @returns {Array} Returns the new flattened array.
  17573. * @example
  17574. *
  17575. * function duplicate(n) {
  17576. * return [[[n, n]]];
  17577. * }
  17578. *
  17579. * _.flatMapDeep([1, 2], duplicate);
  17580. * // => [1, 1, 2, 2]
  17581. */
  17582. function flatMapDeep(collection, iteratee) {
  17583. return baseFlatten(map(collection, iteratee), INFINITY);
  17584. }
  17585. /**
  17586. * This method is like `_.flatMap` except that it recursively flattens the
  17587. * mapped results up to `depth` times.
  17588. *
  17589. * @static
  17590. * @memberOf _
  17591. * @since 4.7.0
  17592. * @category Collection
  17593. * @param {Array|Object} collection The collection to iterate over.
  17594. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17595. * @param {number} [depth=1] The maximum recursion depth.
  17596. * @returns {Array} Returns the new flattened array.
  17597. * @example
  17598. *
  17599. * function duplicate(n) {
  17600. * return [[[n, n]]];
  17601. * }
  17602. *
  17603. * _.flatMapDepth([1, 2], duplicate, 2);
  17604. * // => [[1, 1], [2, 2]]
  17605. */
  17606. function flatMapDepth(collection, iteratee, depth) {
  17607. depth = depth === undefined ? 1 : toInteger(depth);
  17608. return baseFlatten(map(collection, iteratee), depth);
  17609. }
  17610. /**
  17611. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  17612. * The iteratee is invoked with three arguments: (value, index|key, collection).
  17613. * Iteratee functions may exit iteration early by explicitly returning `false`.
  17614. *
  17615. * **Note:** As with other "Collections" methods, objects with a "length"
  17616. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  17617. * or `_.forOwn` for object iteration.
  17618. *
  17619. * @static
  17620. * @memberOf _
  17621. * @since 0.1.0
  17622. * @alias each
  17623. * @category Collection
  17624. * @param {Array|Object} collection The collection to iterate over.
  17625. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17626. * @returns {Array|Object} Returns `collection`.
  17627. * @see _.forEachRight
  17628. * @example
  17629. *
  17630. * _.forEach([1, 2], function(value) {
  17631. * console.log(value);
  17632. * });
  17633. * // => Logs `1` then `2`.
  17634. *
  17635. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  17636. * console.log(key);
  17637. * });
  17638. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  17639. */
  17640. function forEach(collection, iteratee) {
  17641. var func = isArray(collection) ? arrayEach : baseEach;
  17642. return func(collection, getIteratee(iteratee, 3));
  17643. }
  17644. /**
  17645. * This method is like `_.forEach` except that it iterates over elements of
  17646. * `collection` from right to left.
  17647. *
  17648. * @static
  17649. * @memberOf _
  17650. * @since 2.0.0
  17651. * @alias eachRight
  17652. * @category Collection
  17653. * @param {Array|Object} collection The collection to iterate over.
  17654. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17655. * @returns {Array|Object} Returns `collection`.
  17656. * @see _.forEach
  17657. * @example
  17658. *
  17659. * _.forEachRight([1, 2], function(value) {
  17660. * console.log(value);
  17661. * });
  17662. * // => Logs `2` then `1`.
  17663. */
  17664. function forEachRight(collection, iteratee) {
  17665. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  17666. return func(collection, getIteratee(iteratee, 3));
  17667. }
  17668. /**
  17669. * Creates an object composed of keys generated from the results of running
  17670. * each element of `collection` thru `iteratee`. The order of grouped values
  17671. * is determined by the order they occur in `collection`. The corresponding
  17672. * value of each key is an array of elements responsible for generating the
  17673. * key. The iteratee is invoked with one argument: (value).
  17674. *
  17675. * @static
  17676. * @memberOf _
  17677. * @since 0.1.0
  17678. * @category Collection
  17679. * @param {Array|Object} collection The collection to iterate over.
  17680. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  17681. * @returns {Object} Returns the composed aggregate object.
  17682. * @example
  17683. *
  17684. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  17685. * // => { '4': [4.2], '6': [6.1, 6.3] }
  17686. *
  17687. * // The `_.property` iteratee shorthand.
  17688. * _.groupBy(['one', 'two', 'three'], 'length');
  17689. * // => { '3': ['one', 'two'], '5': ['three'] }
  17690. */
  17691. var groupBy = createAggregator(function(result, value, key) {
  17692. if (hasOwnProperty.call(result, key)) {
  17693. result[key].push(value);
  17694. } else {
  17695. baseAssignValue(result, key, [value]);
  17696. }
  17697. });
  17698. /**
  17699. * Checks if `value` is in `collection`. If `collection` is a string, it's
  17700. * checked for a substring of `value`, otherwise
  17701. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  17702. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  17703. * the offset from the end of `collection`.
  17704. *
  17705. * @static
  17706. * @memberOf _
  17707. * @since 0.1.0
  17708. * @category Collection
  17709. * @param {Array|Object|string} collection The collection to inspect.
  17710. * @param {*} value The value to search for.
  17711. * @param {number} [fromIndex=0] The index to search from.
  17712. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  17713. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  17714. * @example
  17715. *
  17716. * _.includes([1, 2, 3], 1);
  17717. * // => true
  17718. *
  17719. * _.includes([1, 2, 3], 1, 2);
  17720. * // => false
  17721. *
  17722. * _.includes({ 'a': 1, 'b': 2 }, 1);
  17723. * // => true
  17724. *
  17725. * _.includes('abcd', 'bc');
  17726. * // => true
  17727. */
  17728. function includes(collection, value, fromIndex, guard) {
  17729. collection = isArrayLike(collection) ? collection : values(collection);
  17730. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  17731. var length = collection.length;
  17732. if (fromIndex < 0) {
  17733. fromIndex = nativeMax(length + fromIndex, 0);
  17734. }
  17735. return isString(collection)
  17736. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  17737. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  17738. }
  17739. /**
  17740. * Invokes the method at `path` of each element in `collection`, returning
  17741. * an array of the results of each invoked method. Any additional arguments
  17742. * are provided to each invoked method. If `path` is a function, it's invoked
  17743. * for, and `this` bound to, each element in `collection`.
  17744. *
  17745. * @static
  17746. * @memberOf _
  17747. * @since 4.0.0
  17748. * @category Collection
  17749. * @param {Array|Object} collection The collection to iterate over.
  17750. * @param {Array|Function|string} path The path of the method to invoke or
  17751. * the function invoked per iteration.
  17752. * @param {...*} [args] The arguments to invoke each method with.
  17753. * @returns {Array} Returns the array of results.
  17754. * @example
  17755. *
  17756. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  17757. * // => [[1, 5, 7], [1, 2, 3]]
  17758. *
  17759. * _.invokeMap([123, 456], String.prototype.split, '');
  17760. * // => [['1', '2', '3'], ['4', '5', '6']]
  17761. */
  17762. var invokeMap = baseRest(function(collection, path, args) {
  17763. var index = -1,
  17764. isFunc = typeof path == 'function',
  17765. result = isArrayLike(collection) ? Array(collection.length) : [];
  17766. baseEach(collection, function(value) {
  17767. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  17768. });
  17769. return result;
  17770. });
  17771. /**
  17772. * Creates an object composed of keys generated from the results of running
  17773. * each element of `collection` thru `iteratee`. The corresponding value of
  17774. * each key is the last element responsible for generating the key. The
  17775. * iteratee is invoked with one argument: (value).
  17776. *
  17777. * @static
  17778. * @memberOf _
  17779. * @since 4.0.0
  17780. * @category Collection
  17781. * @param {Array|Object} collection The collection to iterate over.
  17782. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  17783. * @returns {Object} Returns the composed aggregate object.
  17784. * @example
  17785. *
  17786. * var array = [
  17787. * { 'dir': 'left', 'code': 97 },
  17788. * { 'dir': 'right', 'code': 100 }
  17789. * ];
  17790. *
  17791. * _.keyBy(array, function(o) {
  17792. * return String.fromCharCode(o.code);
  17793. * });
  17794. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  17795. *
  17796. * _.keyBy(array, 'dir');
  17797. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  17798. */
  17799. var keyBy = createAggregator(function(result, value, key) {
  17800. baseAssignValue(result, key, value);
  17801. });
  17802. /**
  17803. * Creates an array of values by running each element in `collection` thru
  17804. * `iteratee`. The iteratee is invoked with three arguments:
  17805. * (value, index|key, collection).
  17806. *
  17807. * Many lodash methods are guarded to work as iteratees for methods like
  17808. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  17809. *
  17810. * The guarded methods are:
  17811. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  17812. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  17813. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  17814. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  17815. *
  17816. * @static
  17817. * @memberOf _
  17818. * @since 0.1.0
  17819. * @category Collection
  17820. * @param {Array|Object} collection The collection to iterate over.
  17821. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17822. * @returns {Array} Returns the new mapped array.
  17823. * @example
  17824. *
  17825. * function square(n) {
  17826. * return n * n;
  17827. * }
  17828. *
  17829. * _.map([4, 8], square);
  17830. * // => [16, 64]
  17831. *
  17832. * _.map({ 'a': 4, 'b': 8 }, square);
  17833. * // => [16, 64] (iteration order is not guaranteed)
  17834. *
  17835. * var users = [
  17836. * { 'user': 'barney' },
  17837. * { 'user': 'fred' }
  17838. * ];
  17839. *
  17840. * // The `_.property` iteratee shorthand.
  17841. * _.map(users, 'user');
  17842. * // => ['barney', 'fred']
  17843. */
  17844. function map(collection, iteratee) {
  17845. var func = isArray(collection) ? arrayMap : baseMap;
  17846. return func(collection, getIteratee(iteratee, 3));
  17847. }
  17848. /**
  17849. * This method is like `_.sortBy` except that it allows specifying the sort
  17850. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  17851. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  17852. * descending or "asc" for ascending sort order of corresponding values.
  17853. *
  17854. * @static
  17855. * @memberOf _
  17856. * @since 4.0.0
  17857. * @category Collection
  17858. * @param {Array|Object} collection The collection to iterate over.
  17859. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  17860. * The iteratees to sort by.
  17861. * @param {string[]} [orders] The sort orders of `iteratees`.
  17862. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  17863. * @returns {Array} Returns the new sorted array.
  17864. * @example
  17865. *
  17866. * var users = [
  17867. * { 'user': 'fred', 'age': 48 },
  17868. * { 'user': 'barney', 'age': 34 },
  17869. * { 'user': 'fred', 'age': 40 },
  17870. * { 'user': 'barney', 'age': 36 }
  17871. * ];
  17872. *
  17873. * // Sort by `user` in ascending order and by `age` in descending order.
  17874. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  17875. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  17876. */
  17877. function orderBy(collection, iteratees, orders, guard) {
  17878. if (collection == null) {
  17879. return [];
  17880. }
  17881. if (!isArray(iteratees)) {
  17882. iteratees = iteratees == null ? [] : [iteratees];
  17883. }
  17884. orders = guard ? undefined : orders;
  17885. if (!isArray(orders)) {
  17886. orders = orders == null ? [] : [orders];
  17887. }
  17888. return baseOrderBy(collection, iteratees, orders);
  17889. }
  17890. /**
  17891. * Creates an array of elements split into two groups, the first of which
  17892. * contains elements `predicate` returns truthy for, the second of which
  17893. * contains elements `predicate` returns falsey for. The predicate is
  17894. * invoked with one argument: (value).
  17895. *
  17896. * @static
  17897. * @memberOf _
  17898. * @since 3.0.0
  17899. * @category Collection
  17900. * @param {Array|Object} collection The collection to iterate over.
  17901. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  17902. * @returns {Array} Returns the array of grouped elements.
  17903. * @example
  17904. *
  17905. * var users = [
  17906. * { 'user': 'barney', 'age': 36, 'active': false },
  17907. * { 'user': 'fred', 'age': 40, 'active': true },
  17908. * { 'user': 'pebbles', 'age': 1, 'active': false }
  17909. * ];
  17910. *
  17911. * _.partition(users, function(o) { return o.active; });
  17912. * // => objects for [['fred'], ['barney', 'pebbles']]
  17913. *
  17914. * // The `_.matches` iteratee shorthand.
  17915. * _.partition(users, { 'age': 1, 'active': false });
  17916. * // => objects for [['pebbles'], ['barney', 'fred']]
  17917. *
  17918. * // The `_.matchesProperty` iteratee shorthand.
  17919. * _.partition(users, ['active', false]);
  17920. * // => objects for [['barney', 'pebbles'], ['fred']]
  17921. *
  17922. * // The `_.property` iteratee shorthand.
  17923. * _.partition(users, 'active');
  17924. * // => objects for [['fred'], ['barney', 'pebbles']]
  17925. */
  17926. var partition = createAggregator(function(result, value, key) {
  17927. result[key ? 0 : 1].push(value);
  17928. }, function() { return [[], []]; });
  17929. /**
  17930. * Reduces `collection` to a value which is the accumulated result of running
  17931. * each element in `collection` thru `iteratee`, where each successive
  17932. * invocation is supplied the return value of the previous. If `accumulator`
  17933. * is not given, the first element of `collection` is used as the initial
  17934. * value. The iteratee is invoked with four arguments:
  17935. * (accumulator, value, index|key, collection).
  17936. *
  17937. * Many lodash methods are guarded to work as iteratees for methods like
  17938. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  17939. *
  17940. * The guarded methods are:
  17941. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  17942. * and `sortBy`
  17943. *
  17944. * @static
  17945. * @memberOf _
  17946. * @since 0.1.0
  17947. * @category Collection
  17948. * @param {Array|Object} collection The collection to iterate over.
  17949. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17950. * @param {*} [accumulator] The initial value.
  17951. * @returns {*} Returns the accumulated value.
  17952. * @see _.reduceRight
  17953. * @example
  17954. *
  17955. * _.reduce([1, 2], function(sum, n) {
  17956. * return sum + n;
  17957. * }, 0);
  17958. * // => 3
  17959. *
  17960. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  17961. * (result[value] || (result[value] = [])).push(key);
  17962. * return result;
  17963. * }, {});
  17964. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  17965. */
  17966. function reduce(collection, iteratee, accumulator) {
  17967. var func = isArray(collection) ? arrayReduce : baseReduce,
  17968. initAccum = arguments.length < 3;
  17969. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  17970. }
  17971. /**
  17972. * This method is like `_.reduce` except that it iterates over elements of
  17973. * `collection` from right to left.
  17974. *
  17975. * @static
  17976. * @memberOf _
  17977. * @since 0.1.0
  17978. * @category Collection
  17979. * @param {Array|Object} collection The collection to iterate over.
  17980. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  17981. * @param {*} [accumulator] The initial value.
  17982. * @returns {*} Returns the accumulated value.
  17983. * @see _.reduce
  17984. * @example
  17985. *
  17986. * var array = [[0, 1], [2, 3], [4, 5]];
  17987. *
  17988. * _.reduceRight(array, function(flattened, other) {
  17989. * return flattened.concat(other);
  17990. * }, []);
  17991. * // => [4, 5, 2, 3, 0, 1]
  17992. */
  17993. function reduceRight(collection, iteratee, accumulator) {
  17994. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  17995. initAccum = arguments.length < 3;
  17996. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  17997. }
  17998. /**
  17999. * The opposite of `_.filter`; this method returns the elements of `collection`
  18000. * that `predicate` does **not** return truthy for.
  18001. *
  18002. * @static
  18003. * @memberOf _
  18004. * @since 0.1.0
  18005. * @category Collection
  18006. * @param {Array|Object} collection The collection to iterate over.
  18007. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18008. * @returns {Array} Returns the new filtered array.
  18009. * @see _.filter
  18010. * @example
  18011. *
  18012. * var users = [
  18013. * { 'user': 'barney', 'age': 36, 'active': false },
  18014. * { 'user': 'fred', 'age': 40, 'active': true }
  18015. * ];
  18016. *
  18017. * _.reject(users, function(o) { return !o.active; });
  18018. * // => objects for ['fred']
  18019. *
  18020. * // The `_.matches` iteratee shorthand.
  18021. * _.reject(users, { 'age': 40, 'active': true });
  18022. * // => objects for ['barney']
  18023. *
  18024. * // The `_.matchesProperty` iteratee shorthand.
  18025. * _.reject(users, ['active', false]);
  18026. * // => objects for ['fred']
  18027. *
  18028. * // The `_.property` iteratee shorthand.
  18029. * _.reject(users, 'active');
  18030. * // => objects for ['barney']
  18031. */
  18032. function reject(collection, predicate) {
  18033. var func = isArray(collection) ? arrayFilter : baseFilter;
  18034. return func(collection, negate(getIteratee(predicate, 3)));
  18035. }
  18036. /**
  18037. * Gets a random element from `collection`.
  18038. *
  18039. * @static
  18040. * @memberOf _
  18041. * @since 2.0.0
  18042. * @category Collection
  18043. * @param {Array|Object} collection The collection to sample.
  18044. * @returns {*} Returns the random element.
  18045. * @example
  18046. *
  18047. * _.sample([1, 2, 3, 4]);
  18048. * // => 2
  18049. */
  18050. function sample(collection) {
  18051. var func = isArray(collection) ? arraySample : baseSample;
  18052. return func(collection);
  18053. }
  18054. /**
  18055. * Gets `n` random elements at unique keys from `collection` up to the
  18056. * size of `collection`.
  18057. *
  18058. * @static
  18059. * @memberOf _
  18060. * @since 4.0.0
  18061. * @category Collection
  18062. * @param {Array|Object} collection The collection to sample.
  18063. * @param {number} [n=1] The number of elements to sample.
  18064. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18065. * @returns {Array} Returns the random elements.
  18066. * @example
  18067. *
  18068. * _.sampleSize([1, 2, 3], 2);
  18069. * // => [3, 1]
  18070. *
  18071. * _.sampleSize([1, 2, 3], 4);
  18072. * // => [2, 3, 1]
  18073. */
  18074. function sampleSize(collection, n, guard) {
  18075. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  18076. n = 1;
  18077. } else {
  18078. n = toInteger(n);
  18079. }
  18080. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  18081. return func(collection, n);
  18082. }
  18083. /**
  18084. * Creates an array of shuffled values, using a version of the
  18085. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  18086. *
  18087. * @static
  18088. * @memberOf _
  18089. * @since 0.1.0
  18090. * @category Collection
  18091. * @param {Array|Object} collection The collection to shuffle.
  18092. * @returns {Array} Returns the new shuffled array.
  18093. * @example
  18094. *
  18095. * _.shuffle([1, 2, 3, 4]);
  18096. * // => [4, 1, 3, 2]
  18097. */
  18098. function shuffle(collection) {
  18099. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  18100. return func(collection);
  18101. }
  18102. /**
  18103. * Gets the size of `collection` by returning its length for array-like
  18104. * values or the number of own enumerable string keyed properties for objects.
  18105. *
  18106. * @static
  18107. * @memberOf _
  18108. * @since 0.1.0
  18109. * @category Collection
  18110. * @param {Array|Object|string} collection The collection to inspect.
  18111. * @returns {number} Returns the collection size.
  18112. * @example
  18113. *
  18114. * _.size([1, 2, 3]);
  18115. * // => 3
  18116. *
  18117. * _.size({ 'a': 1, 'b': 2 });
  18118. * // => 2
  18119. *
  18120. * _.size('pebbles');
  18121. * // => 7
  18122. */
  18123. function size(collection) {
  18124. if (collection == null) {
  18125. return 0;
  18126. }
  18127. if (isArrayLike(collection)) {
  18128. return isString(collection) ? stringSize(collection) : collection.length;
  18129. }
  18130. var tag = getTag(collection);
  18131. if (tag == mapTag || tag == setTag) {
  18132. return collection.size;
  18133. }
  18134. return baseKeys(collection).length;
  18135. }
  18136. /**
  18137. * Checks if `predicate` returns truthy for **any** element of `collection`.
  18138. * Iteration is stopped once `predicate` returns truthy. The predicate is
  18139. * invoked with three arguments: (value, index|key, collection).
  18140. *
  18141. * @static
  18142. * @memberOf _
  18143. * @since 0.1.0
  18144. * @category Collection
  18145. * @param {Array|Object} collection The collection to iterate over.
  18146. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18147. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18148. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18149. * else `false`.
  18150. * @example
  18151. *
  18152. * _.some([null, 0, 'yes', false], Boolean);
  18153. * // => true
  18154. *
  18155. * var users = [
  18156. * { 'user': 'barney', 'active': true },
  18157. * { 'user': 'fred', 'active': false }
  18158. * ];
  18159. *
  18160. * // The `_.matches` iteratee shorthand.
  18161. * _.some(users, { 'user': 'barney', 'active': false });
  18162. * // => false
  18163. *
  18164. * // The `_.matchesProperty` iteratee shorthand.
  18165. * _.some(users, ['active', false]);
  18166. * // => true
  18167. *
  18168. * // The `_.property` iteratee shorthand.
  18169. * _.some(users, 'active');
  18170. * // => true
  18171. */
  18172. function some(collection, predicate, guard) {
  18173. var func = isArray(collection) ? arraySome : baseSome;
  18174. if (guard && isIterateeCall(collection, predicate, guard)) {
  18175. predicate = undefined;
  18176. }
  18177. return func(collection, getIteratee(predicate, 3));
  18178. }
  18179. /**
  18180. * Creates an array of elements, sorted in ascending order by the results of
  18181. * running each element in a collection thru each iteratee. This method
  18182. * performs a stable sort, that is, it preserves the original sort order of
  18183. * equal elements. The iteratees are invoked with one argument: (value).
  18184. *
  18185. * @static
  18186. * @memberOf _
  18187. * @since 0.1.0
  18188. * @category Collection
  18189. * @param {Array|Object} collection The collection to iterate over.
  18190. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  18191. * The iteratees to sort by.
  18192. * @returns {Array} Returns the new sorted array.
  18193. * @example
  18194. *
  18195. * var users = [
  18196. * { 'user': 'fred', 'age': 48 },
  18197. * { 'user': 'barney', 'age': 36 },
  18198. * { 'user': 'fred', 'age': 40 },
  18199. * { 'user': 'barney', 'age': 34 }
  18200. * ];
  18201. *
  18202. * _.sortBy(users, [function(o) { return o.user; }]);
  18203. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  18204. *
  18205. * _.sortBy(users, ['user', 'age']);
  18206. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  18207. */
  18208. var sortBy = baseRest(function(collection, iteratees) {
  18209. if (collection == null) {
  18210. return [];
  18211. }
  18212. var length = iteratees.length;
  18213. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  18214. iteratees = [];
  18215. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  18216. iteratees = [iteratees[0]];
  18217. }
  18218. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  18219. });
  18220. /*------------------------------------------------------------------------*/
  18221. /**
  18222. * Gets the timestamp of the number of milliseconds that have elapsed since
  18223. * the Unix epoch (1 January 1970 00:00:00 UTC).
  18224. *
  18225. * @static
  18226. * @memberOf _
  18227. * @since 2.4.0
  18228. * @category Date
  18229. * @returns {number} Returns the timestamp.
  18230. * @example
  18231. *
  18232. * _.defer(function(stamp) {
  18233. * console.log(_.now() - stamp);
  18234. * }, _.now());
  18235. * // => Logs the number of milliseconds it took for the deferred invocation.
  18236. */
  18237. var now = ctxNow || function() {
  18238. return root.Date.now();
  18239. };
  18240. /*------------------------------------------------------------------------*/
  18241. /**
  18242. * The opposite of `_.before`; this method creates a function that invokes
  18243. * `func` once it's called `n` or more times.
  18244. *
  18245. * @static
  18246. * @memberOf _
  18247. * @since 0.1.0
  18248. * @category Function
  18249. * @param {number} n The number of calls before `func` is invoked.
  18250. * @param {Function} func The function to restrict.
  18251. * @returns {Function} Returns the new restricted function.
  18252. * @example
  18253. *
  18254. * var saves = ['profile', 'settings'];
  18255. *
  18256. * var done = _.after(saves.length, function() {
  18257. * console.log('done saving!');
  18258. * });
  18259. *
  18260. * _.forEach(saves, function(type) {
  18261. * asyncSave({ 'type': type, 'complete': done });
  18262. * });
  18263. * // => Logs 'done saving!' after the two async saves have completed.
  18264. */
  18265. function after(n, func) {
  18266. if (typeof func != 'function') {
  18267. throw new TypeError(FUNC_ERROR_TEXT);
  18268. }
  18269. n = toInteger(n);
  18270. return function() {
  18271. if (--n < 1) {
  18272. return func.apply(this, arguments);
  18273. }
  18274. };
  18275. }
  18276. /**
  18277. * Creates a function that invokes `func`, with up to `n` arguments,
  18278. * ignoring any additional arguments.
  18279. *
  18280. * @static
  18281. * @memberOf _
  18282. * @since 3.0.0
  18283. * @category Function
  18284. * @param {Function} func The function to cap arguments for.
  18285. * @param {number} [n=func.length] The arity cap.
  18286. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18287. * @returns {Function} Returns the new capped function.
  18288. * @example
  18289. *
  18290. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  18291. * // => [6, 8, 10]
  18292. */
  18293. function ary(func, n, guard) {
  18294. n = guard ? undefined : n;
  18295. n = (func && n == null) ? func.length : n;
  18296. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  18297. }
  18298. /**
  18299. * Creates a function that invokes `func`, with the `this` binding and arguments
  18300. * of the created function, while it's called less than `n` times. Subsequent
  18301. * calls to the created function return the result of the last `func` invocation.
  18302. *
  18303. * @static
  18304. * @memberOf _
  18305. * @since 3.0.0
  18306. * @category Function
  18307. * @param {number} n The number of calls at which `func` is no longer invoked.
  18308. * @param {Function} func The function to restrict.
  18309. * @returns {Function} Returns the new restricted function.
  18310. * @example
  18311. *
  18312. * jQuery(element).on('click', _.before(5, addContactToList));
  18313. * // => Allows adding up to 4 contacts to the list.
  18314. */
  18315. function before(n, func) {
  18316. var result;
  18317. if (typeof func != 'function') {
  18318. throw new TypeError(FUNC_ERROR_TEXT);
  18319. }
  18320. n = toInteger(n);
  18321. return function() {
  18322. if (--n > 0) {
  18323. result = func.apply(this, arguments);
  18324. }
  18325. if (n <= 1) {
  18326. func = undefined;
  18327. }
  18328. return result;
  18329. };
  18330. }
  18331. /**
  18332. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  18333. * and `partials` prepended to the arguments it receives.
  18334. *
  18335. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  18336. * may be used as a placeholder for partially applied arguments.
  18337. *
  18338. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  18339. * property of bound functions.
  18340. *
  18341. * @static
  18342. * @memberOf _
  18343. * @since 0.1.0
  18344. * @category Function
  18345. * @param {Function} func The function to bind.
  18346. * @param {*} thisArg The `this` binding of `func`.
  18347. * @param {...*} [partials] The arguments to be partially applied.
  18348. * @returns {Function} Returns the new bound function.
  18349. * @example
  18350. *
  18351. * function greet(greeting, punctuation) {
  18352. * return greeting + ' ' + this.user + punctuation;
  18353. * }
  18354. *
  18355. * var object = { 'user': 'fred' };
  18356. *
  18357. * var bound = _.bind(greet, object, 'hi');
  18358. * bound('!');
  18359. * // => 'hi fred!'
  18360. *
  18361. * // Bound with placeholders.
  18362. * var bound = _.bind(greet, object, _, '!');
  18363. * bound('hi');
  18364. * // => 'hi fred!'
  18365. */
  18366. var bind = baseRest(function(func, thisArg, partials) {
  18367. var bitmask = WRAP_BIND_FLAG;
  18368. if (partials.length) {
  18369. var holders = replaceHolders(partials, getHolder(bind));
  18370. bitmask |= WRAP_PARTIAL_FLAG;
  18371. }
  18372. return createWrap(func, bitmask, thisArg, partials, holders);
  18373. });
  18374. /**
  18375. * Creates a function that invokes the method at `object[key]` with `partials`
  18376. * prepended to the arguments it receives.
  18377. *
  18378. * This method differs from `_.bind` by allowing bound functions to reference
  18379. * methods that may be redefined or don't yet exist. See
  18380. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  18381. * for more details.
  18382. *
  18383. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  18384. * builds, may be used as a placeholder for partially applied arguments.
  18385. *
  18386. * @static
  18387. * @memberOf _
  18388. * @since 0.10.0
  18389. * @category Function
  18390. * @param {Object} object The object to invoke the method on.
  18391. * @param {string} key The key of the method.
  18392. * @param {...*} [partials] The arguments to be partially applied.
  18393. * @returns {Function} Returns the new bound function.
  18394. * @example
  18395. *
  18396. * var object = {
  18397. * 'user': 'fred',
  18398. * 'greet': function(greeting, punctuation) {
  18399. * return greeting + ' ' + this.user + punctuation;
  18400. * }
  18401. * };
  18402. *
  18403. * var bound = _.bindKey(object, 'greet', 'hi');
  18404. * bound('!');
  18405. * // => 'hi fred!'
  18406. *
  18407. * object.greet = function(greeting, punctuation) {
  18408. * return greeting + 'ya ' + this.user + punctuation;
  18409. * };
  18410. *
  18411. * bound('!');
  18412. * // => 'hiya fred!'
  18413. *
  18414. * // Bound with placeholders.
  18415. * var bound = _.bindKey(object, 'greet', _, '!');
  18416. * bound('hi');
  18417. * // => 'hiya fred!'
  18418. */
  18419. var bindKey = baseRest(function(object, key, partials) {
  18420. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  18421. if (partials.length) {
  18422. var holders = replaceHolders(partials, getHolder(bindKey));
  18423. bitmask |= WRAP_PARTIAL_FLAG;
  18424. }
  18425. return createWrap(key, bitmask, object, partials, holders);
  18426. });
  18427. /**
  18428. * Creates a function that accepts arguments of `func` and either invokes
  18429. * `func` returning its result, if at least `arity` number of arguments have
  18430. * been provided, or returns a function that accepts the remaining `func`
  18431. * arguments, and so on. The arity of `func` may be specified if `func.length`
  18432. * is not sufficient.
  18433. *
  18434. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  18435. * may be used as a placeholder for provided arguments.
  18436. *
  18437. * **Note:** This method doesn't set the "length" property of curried functions.
  18438. *
  18439. * @static
  18440. * @memberOf _
  18441. * @since 2.0.0
  18442. * @category Function
  18443. * @param {Function} func The function to curry.
  18444. * @param {number} [arity=func.length] The arity of `func`.
  18445. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18446. * @returns {Function} Returns the new curried function.
  18447. * @example
  18448. *
  18449. * var abc = function(a, b, c) {
  18450. * return [a, b, c];
  18451. * };
  18452. *
  18453. * var curried = _.curry(abc);
  18454. *
  18455. * curried(1)(2)(3);
  18456. * // => [1, 2, 3]
  18457. *
  18458. * curried(1, 2)(3);
  18459. * // => [1, 2, 3]
  18460. *
  18461. * curried(1, 2, 3);
  18462. * // => [1, 2, 3]
  18463. *
  18464. * // Curried with placeholders.
  18465. * curried(1)(_, 3)(2);
  18466. * // => [1, 2, 3]
  18467. */
  18468. function curry(func, arity, guard) {
  18469. arity = guard ? undefined : arity;
  18470. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  18471. result.placeholder = curry.placeholder;
  18472. return result;
  18473. }
  18474. /**
  18475. * This method is like `_.curry` except that arguments are applied to `func`
  18476. * in the manner of `_.partialRight` instead of `_.partial`.
  18477. *
  18478. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  18479. * builds, may be used as a placeholder for provided arguments.
  18480. *
  18481. * **Note:** This method doesn't set the "length" property of curried functions.
  18482. *
  18483. * @static
  18484. * @memberOf _
  18485. * @since 3.0.0
  18486. * @category Function
  18487. * @param {Function} func The function to curry.
  18488. * @param {number} [arity=func.length] The arity of `func`.
  18489. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18490. * @returns {Function} Returns the new curried function.
  18491. * @example
  18492. *
  18493. * var abc = function(a, b, c) {
  18494. * return [a, b, c];
  18495. * };
  18496. *
  18497. * var curried = _.curryRight(abc);
  18498. *
  18499. * curried(3)(2)(1);
  18500. * // => [1, 2, 3]
  18501. *
  18502. * curried(2, 3)(1);
  18503. * // => [1, 2, 3]
  18504. *
  18505. * curried(1, 2, 3);
  18506. * // => [1, 2, 3]
  18507. *
  18508. * // Curried with placeholders.
  18509. * curried(3)(1, _)(2);
  18510. * // => [1, 2, 3]
  18511. */
  18512. function curryRight(func, arity, guard) {
  18513. arity = guard ? undefined : arity;
  18514. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  18515. result.placeholder = curryRight.placeholder;
  18516. return result;
  18517. }
  18518. /**
  18519. * Creates a debounced function that delays invoking `func` until after `wait`
  18520. * milliseconds have elapsed since the last time the debounced function was
  18521. * invoked. The debounced function comes with a `cancel` method to cancel
  18522. * delayed `func` invocations and a `flush` method to immediately invoke them.
  18523. * Provide `options` to indicate whether `func` should be invoked on the
  18524. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  18525. * with the last arguments provided to the debounced function. Subsequent
  18526. * calls to the debounced function return the result of the last `func`
  18527. * invocation.
  18528. *
  18529. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  18530. * invoked on the trailing edge of the timeout only if the debounced function
  18531. * is invoked more than once during the `wait` timeout.
  18532. *
  18533. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  18534. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  18535. *
  18536. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  18537. * for details over the differences between `_.debounce` and `_.throttle`.
  18538. *
  18539. * @static
  18540. * @memberOf _
  18541. * @since 0.1.0
  18542. * @category Function
  18543. * @param {Function} func The function to debounce.
  18544. * @param {number} [wait=0] The number of milliseconds to delay.
  18545. * @param {Object} [options={}] The options object.
  18546. * @param {boolean} [options.leading=false]
  18547. * Specify invoking on the leading edge of the timeout.
  18548. * @param {number} [options.maxWait]
  18549. * The maximum time `func` is allowed to be delayed before it's invoked.
  18550. * @param {boolean} [options.trailing=true]
  18551. * Specify invoking on the trailing edge of the timeout.
  18552. * @returns {Function} Returns the new debounced function.
  18553. * @example
  18554. *
  18555. * // Avoid costly calculations while the window size is in flux.
  18556. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  18557. *
  18558. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  18559. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  18560. * 'leading': true,
  18561. * 'trailing': false
  18562. * }));
  18563. *
  18564. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  18565. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  18566. * var source = new EventSource('/stream');
  18567. * jQuery(source).on('message', debounced);
  18568. *
  18569. * // Cancel the trailing debounced invocation.
  18570. * jQuery(window).on('popstate', debounced.cancel);
  18571. */
  18572. function debounce(func, wait, options) {
  18573. var lastArgs,
  18574. lastThis,
  18575. maxWait,
  18576. result,
  18577. timerId,
  18578. lastCallTime,
  18579. lastInvokeTime = 0,
  18580. leading = false,
  18581. maxing = false,
  18582. trailing = true;
  18583. if (typeof func != 'function') {
  18584. throw new TypeError(FUNC_ERROR_TEXT);
  18585. }
  18586. wait = toNumber(wait) || 0;
  18587. if (isObject(options)) {
  18588. leading = !!options.leading;
  18589. maxing = 'maxWait' in options;
  18590. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  18591. trailing = 'trailing' in options ? !!options.trailing : trailing;
  18592. }
  18593. function invokeFunc(time) {
  18594. var args = lastArgs,
  18595. thisArg = lastThis;
  18596. lastArgs = lastThis = undefined;
  18597. lastInvokeTime = time;
  18598. result = func.apply(thisArg, args);
  18599. return result;
  18600. }
  18601. function leadingEdge(time) {
  18602. // Reset any `maxWait` timer.
  18603. lastInvokeTime = time;
  18604. // Start the timer for the trailing edge.
  18605. timerId = setTimeout(timerExpired, wait);
  18606. // Invoke the leading edge.
  18607. return leading ? invokeFunc(time) : result;
  18608. }
  18609. function remainingWait(time) {
  18610. var timeSinceLastCall = time - lastCallTime,
  18611. timeSinceLastInvoke = time - lastInvokeTime,
  18612. result = wait - timeSinceLastCall;
  18613. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  18614. }
  18615. function shouldInvoke(time) {
  18616. var timeSinceLastCall = time - lastCallTime,
  18617. timeSinceLastInvoke = time - lastInvokeTime;
  18618. // Either this is the first call, activity has stopped and we're at the
  18619. // trailing edge, the system time has gone backwards and we're treating
  18620. // it as the trailing edge, or we've hit the `maxWait` limit.
  18621. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  18622. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  18623. }
  18624. function timerExpired() {
  18625. var time = now();
  18626. if (shouldInvoke(time)) {
  18627. return trailingEdge(time);
  18628. }
  18629. // Restart the timer.
  18630. timerId = setTimeout(timerExpired, remainingWait(time));
  18631. }
  18632. function trailingEdge(time) {
  18633. timerId = undefined;
  18634. // Only invoke if we have `lastArgs` which means `func` has been
  18635. // debounced at least once.
  18636. if (trailing && lastArgs) {
  18637. return invokeFunc(time);
  18638. }
  18639. lastArgs = lastThis = undefined;
  18640. return result;
  18641. }
  18642. function cancel() {
  18643. if (timerId !== undefined) {
  18644. clearTimeout(timerId);
  18645. }
  18646. lastInvokeTime = 0;
  18647. lastArgs = lastCallTime = lastThis = timerId = undefined;
  18648. }
  18649. function flush() {
  18650. return timerId === undefined ? result : trailingEdge(now());
  18651. }
  18652. function debounced() {
  18653. var time = now(),
  18654. isInvoking = shouldInvoke(time);
  18655. lastArgs = arguments;
  18656. lastThis = this;
  18657. lastCallTime = time;
  18658. if (isInvoking) {
  18659. if (timerId === undefined) {
  18660. return leadingEdge(lastCallTime);
  18661. }
  18662. if (maxing) {
  18663. // Handle invocations in a tight loop.
  18664. timerId = setTimeout(timerExpired, wait);
  18665. return invokeFunc(lastCallTime);
  18666. }
  18667. }
  18668. if (timerId === undefined) {
  18669. timerId = setTimeout(timerExpired, wait);
  18670. }
  18671. return result;
  18672. }
  18673. debounced.cancel = cancel;
  18674. debounced.flush = flush;
  18675. return debounced;
  18676. }
  18677. /**
  18678. * Defers invoking the `func` until the current call stack has cleared. Any
  18679. * additional arguments are provided to `func` when it's invoked.
  18680. *
  18681. * @static
  18682. * @memberOf _
  18683. * @since 0.1.0
  18684. * @category Function
  18685. * @param {Function} func The function to defer.
  18686. * @param {...*} [args] The arguments to invoke `func` with.
  18687. * @returns {number} Returns the timer id.
  18688. * @example
  18689. *
  18690. * _.defer(function(text) {
  18691. * console.log(text);
  18692. * }, 'deferred');
  18693. * // => Logs 'deferred' after one millisecond.
  18694. */
  18695. var defer = baseRest(function(func, args) {
  18696. return baseDelay(func, 1, args);
  18697. });
  18698. /**
  18699. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  18700. * provided to `func` when it's invoked.
  18701. *
  18702. * @static
  18703. * @memberOf _
  18704. * @since 0.1.0
  18705. * @category Function
  18706. * @param {Function} func The function to delay.
  18707. * @param {number} wait The number of milliseconds to delay invocation.
  18708. * @param {...*} [args] The arguments to invoke `func` with.
  18709. * @returns {number} Returns the timer id.
  18710. * @example
  18711. *
  18712. * _.delay(function(text) {
  18713. * console.log(text);
  18714. * }, 1000, 'later');
  18715. * // => Logs 'later' after one second.
  18716. */
  18717. var delay = baseRest(function(func, wait, args) {
  18718. return baseDelay(func, toNumber(wait) || 0, args);
  18719. });
  18720. /**
  18721. * Creates a function that invokes `func` with arguments reversed.
  18722. *
  18723. * @static
  18724. * @memberOf _
  18725. * @since 4.0.0
  18726. * @category Function
  18727. * @param {Function} func The function to flip arguments for.
  18728. * @returns {Function} Returns the new flipped function.
  18729. * @example
  18730. *
  18731. * var flipped = _.flip(function() {
  18732. * return _.toArray(arguments);
  18733. * });
  18734. *
  18735. * flipped('a', 'b', 'c', 'd');
  18736. * // => ['d', 'c', 'b', 'a']
  18737. */
  18738. function flip(func) {
  18739. return createWrap(func, WRAP_FLIP_FLAG);
  18740. }
  18741. /**
  18742. * Creates a function that memoizes the result of `func`. If `resolver` is
  18743. * provided, it determines the cache key for storing the result based on the
  18744. * arguments provided to the memoized function. By default, the first argument
  18745. * provided to the memoized function is used as the map cache key. The `func`
  18746. * is invoked with the `this` binding of the memoized function.
  18747. *
  18748. * **Note:** The cache is exposed as the `cache` property on the memoized
  18749. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  18750. * constructor with one whose instances implement the
  18751. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  18752. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  18753. *
  18754. * @static
  18755. * @memberOf _
  18756. * @since 0.1.0
  18757. * @category Function
  18758. * @param {Function} func The function to have its output memoized.
  18759. * @param {Function} [resolver] The function to resolve the cache key.
  18760. * @returns {Function} Returns the new memoized function.
  18761. * @example
  18762. *
  18763. * var object = { 'a': 1, 'b': 2 };
  18764. * var other = { 'c': 3, 'd': 4 };
  18765. *
  18766. * var values = _.memoize(_.values);
  18767. * values(object);
  18768. * // => [1, 2]
  18769. *
  18770. * values(other);
  18771. * // => [3, 4]
  18772. *
  18773. * object.a = 2;
  18774. * values(object);
  18775. * // => [1, 2]
  18776. *
  18777. * // Modify the result cache.
  18778. * values.cache.set(object, ['a', 'b']);
  18779. * values(object);
  18780. * // => ['a', 'b']
  18781. *
  18782. * // Replace `_.memoize.Cache`.
  18783. * _.memoize.Cache = WeakMap;
  18784. */
  18785. function memoize(func, resolver) {
  18786. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  18787. throw new TypeError(FUNC_ERROR_TEXT);
  18788. }
  18789. var memoized = function() {
  18790. var args = arguments,
  18791. key = resolver ? resolver.apply(this, args) : args[0],
  18792. cache = memoized.cache;
  18793. if (cache.has(key)) {
  18794. return cache.get(key);
  18795. }
  18796. var result = func.apply(this, args);
  18797. memoized.cache = cache.set(key, result) || cache;
  18798. return result;
  18799. };
  18800. memoized.cache = new (memoize.Cache || MapCache);
  18801. return memoized;
  18802. }
  18803. // Expose `MapCache`.
  18804. memoize.Cache = MapCache;
  18805. /**
  18806. * Creates a function that negates the result of the predicate `func`. The
  18807. * `func` predicate is invoked with the `this` binding and arguments of the
  18808. * created function.
  18809. *
  18810. * @static
  18811. * @memberOf _
  18812. * @since 3.0.0
  18813. * @category Function
  18814. * @param {Function} predicate The predicate to negate.
  18815. * @returns {Function} Returns the new negated function.
  18816. * @example
  18817. *
  18818. * function isEven(n) {
  18819. * return n % 2 == 0;
  18820. * }
  18821. *
  18822. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  18823. * // => [1, 3, 5]
  18824. */
  18825. function negate(predicate) {
  18826. if (typeof predicate != 'function') {
  18827. throw new TypeError(FUNC_ERROR_TEXT);
  18828. }
  18829. return function() {
  18830. var args = arguments;
  18831. switch (args.length) {
  18832. case 0: return !predicate.call(this);
  18833. case 1: return !predicate.call(this, args[0]);
  18834. case 2: return !predicate.call(this, args[0], args[1]);
  18835. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  18836. }
  18837. return !predicate.apply(this, args);
  18838. };
  18839. }
  18840. /**
  18841. * Creates a function that is restricted to invoking `func` once. Repeat calls
  18842. * to the function return the value of the first invocation. The `func` is
  18843. * invoked with the `this` binding and arguments of the created function.
  18844. *
  18845. * @static
  18846. * @memberOf _
  18847. * @since 0.1.0
  18848. * @category Function
  18849. * @param {Function} func The function to restrict.
  18850. * @returns {Function} Returns the new restricted function.
  18851. * @example
  18852. *
  18853. * var initialize = _.once(createApplication);
  18854. * initialize();
  18855. * initialize();
  18856. * // => `createApplication` is invoked once
  18857. */
  18858. function once(func) {
  18859. return before(2, func);
  18860. }
  18861. /**
  18862. * Creates a function that invokes `func` with its arguments transformed.
  18863. *
  18864. * @static
  18865. * @since 4.0.0
  18866. * @memberOf _
  18867. * @category Function
  18868. * @param {Function} func The function to wrap.
  18869. * @param {...(Function|Function[])} [transforms=[_.identity]]
  18870. * The argument transforms.
  18871. * @returns {Function} Returns the new function.
  18872. * @example
  18873. *
  18874. * function doubled(n) {
  18875. * return n * 2;
  18876. * }
  18877. *
  18878. * function square(n) {
  18879. * return n * n;
  18880. * }
  18881. *
  18882. * var func = _.overArgs(function(x, y) {
  18883. * return [x, y];
  18884. * }, [square, doubled]);
  18885. *
  18886. * func(9, 3);
  18887. * // => [81, 6]
  18888. *
  18889. * func(10, 5);
  18890. * // => [100, 10]
  18891. */
  18892. var overArgs = castRest(function(func, transforms) {
  18893. transforms = (transforms.length == 1 && isArray(transforms[0]))
  18894. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  18895. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  18896. var funcsLength = transforms.length;
  18897. return baseRest(function(args) {
  18898. var index = -1,
  18899. length = nativeMin(args.length, funcsLength);
  18900. while (++index < length) {
  18901. args[index] = transforms[index].call(this, args[index]);
  18902. }
  18903. return apply(func, this, args);
  18904. });
  18905. });
  18906. /**
  18907. * Creates a function that invokes `func` with `partials` prepended to the
  18908. * arguments it receives. This method is like `_.bind` except it does **not**
  18909. * alter the `this` binding.
  18910. *
  18911. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  18912. * builds, may be used as a placeholder for partially applied arguments.
  18913. *
  18914. * **Note:** This method doesn't set the "length" property of partially
  18915. * applied functions.
  18916. *
  18917. * @static
  18918. * @memberOf _
  18919. * @since 0.2.0
  18920. * @category Function
  18921. * @param {Function} func The function to partially apply arguments to.
  18922. * @param {...*} [partials] The arguments to be partially applied.
  18923. * @returns {Function} Returns the new partially applied function.
  18924. * @example
  18925. *
  18926. * function greet(greeting, name) {
  18927. * return greeting + ' ' + name;
  18928. * }
  18929. *
  18930. * var sayHelloTo = _.partial(greet, 'hello');
  18931. * sayHelloTo('fred');
  18932. * // => 'hello fred'
  18933. *
  18934. * // Partially applied with placeholders.
  18935. * var greetFred = _.partial(greet, _, 'fred');
  18936. * greetFred('hi');
  18937. * // => 'hi fred'
  18938. */
  18939. var partial = baseRest(function(func, partials) {
  18940. var holders = replaceHolders(partials, getHolder(partial));
  18941. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  18942. });
  18943. /**
  18944. * This method is like `_.partial` except that partially applied arguments
  18945. * are appended to the arguments it receives.
  18946. *
  18947. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  18948. * builds, may be used as a placeholder for partially applied arguments.
  18949. *
  18950. * **Note:** This method doesn't set the "length" property of partially
  18951. * applied functions.
  18952. *
  18953. * @static
  18954. * @memberOf _
  18955. * @since 1.0.0
  18956. * @category Function
  18957. * @param {Function} func The function to partially apply arguments to.
  18958. * @param {...*} [partials] The arguments to be partially applied.
  18959. * @returns {Function} Returns the new partially applied function.
  18960. * @example
  18961. *
  18962. * function greet(greeting, name) {
  18963. * return greeting + ' ' + name;
  18964. * }
  18965. *
  18966. * var greetFred = _.partialRight(greet, 'fred');
  18967. * greetFred('hi');
  18968. * // => 'hi fred'
  18969. *
  18970. * // Partially applied with placeholders.
  18971. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  18972. * sayHelloTo('fred');
  18973. * // => 'hello fred'
  18974. */
  18975. var partialRight = baseRest(function(func, partials) {
  18976. var holders = replaceHolders(partials, getHolder(partialRight));
  18977. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  18978. });
  18979. /**
  18980. * Creates a function that invokes `func` with arguments arranged according
  18981. * to the specified `indexes` where the argument value at the first index is
  18982. * provided as the first argument, the argument value at the second index is
  18983. * provided as the second argument, and so on.
  18984. *
  18985. * @static
  18986. * @memberOf _
  18987. * @since 3.0.0
  18988. * @category Function
  18989. * @param {Function} func The function to rearrange arguments for.
  18990. * @param {...(number|number[])} indexes The arranged argument indexes.
  18991. * @returns {Function} Returns the new function.
  18992. * @example
  18993. *
  18994. * var rearged = _.rearg(function(a, b, c) {
  18995. * return [a, b, c];
  18996. * }, [2, 0, 1]);
  18997. *
  18998. * rearged('b', 'c', 'a')
  18999. * // => ['a', 'b', 'c']
  19000. */
  19001. var rearg = flatRest(function(func, indexes) {
  19002. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  19003. });
  19004. /**
  19005. * Creates a function that invokes `func` with the `this` binding of the
  19006. * created function and arguments from `start` and beyond provided as
  19007. * an array.
  19008. *
  19009. * **Note:** This method is based on the
  19010. * [rest parameter](https://mdn.io/rest_parameters).
  19011. *
  19012. * @static
  19013. * @memberOf _
  19014. * @since 4.0.0
  19015. * @category Function
  19016. * @param {Function} func The function to apply a rest parameter to.
  19017. * @param {number} [start=func.length-1] The start position of the rest parameter.
  19018. * @returns {Function} Returns the new function.
  19019. * @example
  19020. *
  19021. * var say = _.rest(function(what, names) {
  19022. * return what + ' ' + _.initial(names).join(', ') +
  19023. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  19024. * });
  19025. *
  19026. * say('hello', 'fred', 'barney', 'pebbles');
  19027. * // => 'hello fred, barney, & pebbles'
  19028. */
  19029. function rest(func, start) {
  19030. if (typeof func != 'function') {
  19031. throw new TypeError(FUNC_ERROR_TEXT);
  19032. }
  19033. start = start === undefined ? start : toInteger(start);
  19034. return baseRest(func, start);
  19035. }
  19036. /**
  19037. * Creates a function that invokes `func` with the `this` binding of the
  19038. * create function and an array of arguments much like
  19039. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  19040. *
  19041. * **Note:** This method is based on the
  19042. * [spread operator](https://mdn.io/spread_operator).
  19043. *
  19044. * @static
  19045. * @memberOf _
  19046. * @since 3.2.0
  19047. * @category Function
  19048. * @param {Function} func The function to spread arguments over.
  19049. * @param {number} [start=0] The start position of the spread.
  19050. * @returns {Function} Returns the new function.
  19051. * @example
  19052. *
  19053. * var say = _.spread(function(who, what) {
  19054. * return who + ' says ' + what;
  19055. * });
  19056. *
  19057. * say(['fred', 'hello']);
  19058. * // => 'fred says hello'
  19059. *
  19060. * var numbers = Promise.all([
  19061. * Promise.resolve(40),
  19062. * Promise.resolve(36)
  19063. * ]);
  19064. *
  19065. * numbers.then(_.spread(function(x, y) {
  19066. * return x + y;
  19067. * }));
  19068. * // => a Promise of 76
  19069. */
  19070. function spread(func, start) {
  19071. if (typeof func != 'function') {
  19072. throw new TypeError(FUNC_ERROR_TEXT);
  19073. }
  19074. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  19075. return baseRest(function(args) {
  19076. var array = args[start],
  19077. otherArgs = castSlice(args, 0, start);
  19078. if (array) {
  19079. arrayPush(otherArgs, array);
  19080. }
  19081. return apply(func, this, otherArgs);
  19082. });
  19083. }
  19084. /**
  19085. * Creates a throttled function that only invokes `func` at most once per
  19086. * every `wait` milliseconds. The throttled function comes with a `cancel`
  19087. * method to cancel delayed `func` invocations and a `flush` method to
  19088. * immediately invoke them. Provide `options` to indicate whether `func`
  19089. * should be invoked on the leading and/or trailing edge of the `wait`
  19090. * timeout. The `func` is invoked with the last arguments provided to the
  19091. * throttled function. Subsequent calls to the throttled function return the
  19092. * result of the last `func` invocation.
  19093. *
  19094. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  19095. * invoked on the trailing edge of the timeout only if the throttled function
  19096. * is invoked more than once during the `wait` timeout.
  19097. *
  19098. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  19099. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  19100. *
  19101. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  19102. * for details over the differences between `_.throttle` and `_.debounce`.
  19103. *
  19104. * @static
  19105. * @memberOf _
  19106. * @since 0.1.0
  19107. * @category Function
  19108. * @param {Function} func The function to throttle.
  19109. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  19110. * @param {Object} [options={}] The options object.
  19111. * @param {boolean} [options.leading=true]
  19112. * Specify invoking on the leading edge of the timeout.
  19113. * @param {boolean} [options.trailing=true]
  19114. * Specify invoking on the trailing edge of the timeout.
  19115. * @returns {Function} Returns the new throttled function.
  19116. * @example
  19117. *
  19118. * // Avoid excessively updating the position while scrolling.
  19119. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  19120. *
  19121. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  19122. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  19123. * jQuery(element).on('click', throttled);
  19124. *
  19125. * // Cancel the trailing throttled invocation.
  19126. * jQuery(window).on('popstate', throttled.cancel);
  19127. */
  19128. function throttle(func, wait, options) {
  19129. var leading = true,
  19130. trailing = true;
  19131. if (typeof func != 'function') {
  19132. throw new TypeError(FUNC_ERROR_TEXT);
  19133. }
  19134. if (isObject(options)) {
  19135. leading = 'leading' in options ? !!options.leading : leading;
  19136. trailing = 'trailing' in options ? !!options.trailing : trailing;
  19137. }
  19138. return debounce(func, wait, {
  19139. 'leading': leading,
  19140. 'maxWait': wait,
  19141. 'trailing': trailing
  19142. });
  19143. }
  19144. /**
  19145. * Creates a function that accepts up to one argument, ignoring any
  19146. * additional arguments.
  19147. *
  19148. * @static
  19149. * @memberOf _
  19150. * @since 4.0.0
  19151. * @category Function
  19152. * @param {Function} func The function to cap arguments for.
  19153. * @returns {Function} Returns the new capped function.
  19154. * @example
  19155. *
  19156. * _.map(['6', '8', '10'], _.unary(parseInt));
  19157. * // => [6, 8, 10]
  19158. */
  19159. function unary(func) {
  19160. return ary(func, 1);
  19161. }
  19162. /**
  19163. * Creates a function that provides `value` to `wrapper` as its first
  19164. * argument. Any additional arguments provided to the function are appended
  19165. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  19166. * binding of the created function.
  19167. *
  19168. * @static
  19169. * @memberOf _
  19170. * @since 0.1.0
  19171. * @category Function
  19172. * @param {*} value The value to wrap.
  19173. * @param {Function} [wrapper=identity] The wrapper function.
  19174. * @returns {Function} Returns the new function.
  19175. * @example
  19176. *
  19177. * var p = _.wrap(_.escape, function(func, text) {
  19178. * return '<p>' + func(text) + '</p>';
  19179. * });
  19180. *
  19181. * p('fred, barney, & pebbles');
  19182. * // => '<p>fred, barney, &amp; pebbles</p>'
  19183. */
  19184. function wrap(value, wrapper) {
  19185. return partial(castFunction(wrapper), value);
  19186. }
  19187. /*------------------------------------------------------------------------*/
  19188. /**
  19189. * Casts `value` as an array if it's not one.
  19190. *
  19191. * @static
  19192. * @memberOf _
  19193. * @since 4.4.0
  19194. * @category Lang
  19195. * @param {*} value The value to inspect.
  19196. * @returns {Array} Returns the cast array.
  19197. * @example
  19198. *
  19199. * _.castArray(1);
  19200. * // => [1]
  19201. *
  19202. * _.castArray({ 'a': 1 });
  19203. * // => [{ 'a': 1 }]
  19204. *
  19205. * _.castArray('abc');
  19206. * // => ['abc']
  19207. *
  19208. * _.castArray(null);
  19209. * // => [null]
  19210. *
  19211. * _.castArray(undefined);
  19212. * // => [undefined]
  19213. *
  19214. * _.castArray();
  19215. * // => []
  19216. *
  19217. * var array = [1, 2, 3];
  19218. * console.log(_.castArray(array) === array);
  19219. * // => true
  19220. */
  19221. function castArray() {
  19222. if (!arguments.length) {
  19223. return [];
  19224. }
  19225. var value = arguments[0];
  19226. return isArray(value) ? value : [value];
  19227. }
  19228. /**
  19229. * Creates a shallow clone of `value`.
  19230. *
  19231. * **Note:** This method is loosely based on the
  19232. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  19233. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  19234. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  19235. * arrays. The own enumerable properties of `arguments` objects are cloned
  19236. * as plain objects. An empty object is returned for uncloneable values such
  19237. * as error objects, functions, DOM nodes, and WeakMaps.
  19238. *
  19239. * @static
  19240. * @memberOf _
  19241. * @since 0.1.0
  19242. * @category Lang
  19243. * @param {*} value The value to clone.
  19244. * @returns {*} Returns the cloned value.
  19245. * @see _.cloneDeep
  19246. * @example
  19247. *
  19248. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  19249. *
  19250. * var shallow = _.clone(objects);
  19251. * console.log(shallow[0] === objects[0]);
  19252. * // => true
  19253. */
  19254. function clone(value) {
  19255. return baseClone(value, CLONE_SYMBOLS_FLAG);
  19256. }
  19257. /**
  19258. * This method is like `_.clone` except that it accepts `customizer` which
  19259. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  19260. * cloning is handled by the method instead. The `customizer` is invoked with
  19261. * up to four arguments; (value [, index|key, object, stack]).
  19262. *
  19263. * @static
  19264. * @memberOf _
  19265. * @since 4.0.0
  19266. * @category Lang
  19267. * @param {*} value The value to clone.
  19268. * @param {Function} [customizer] The function to customize cloning.
  19269. * @returns {*} Returns the cloned value.
  19270. * @see _.cloneDeepWith
  19271. * @example
  19272. *
  19273. * function customizer(value) {
  19274. * if (_.isElement(value)) {
  19275. * return value.cloneNode(false);
  19276. * }
  19277. * }
  19278. *
  19279. * var el = _.cloneWith(document.body, customizer);
  19280. *
  19281. * console.log(el === document.body);
  19282. * // => false
  19283. * console.log(el.nodeName);
  19284. * // => 'BODY'
  19285. * console.log(el.childNodes.length);
  19286. * // => 0
  19287. */
  19288. function cloneWith(value, customizer) {
  19289. customizer = typeof customizer == 'function' ? customizer : undefined;
  19290. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  19291. }
  19292. /**
  19293. * This method is like `_.clone` except that it recursively clones `value`.
  19294. *
  19295. * @static
  19296. * @memberOf _
  19297. * @since 1.0.0
  19298. * @category Lang
  19299. * @param {*} value The value to recursively clone.
  19300. * @returns {*} Returns the deep cloned value.
  19301. * @see _.clone
  19302. * @example
  19303. *
  19304. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  19305. *
  19306. * var deep = _.cloneDeep(objects);
  19307. * console.log(deep[0] === objects[0]);
  19308. * // => false
  19309. */
  19310. function cloneDeep(value) {
  19311. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  19312. }
  19313. /**
  19314. * This method is like `_.cloneWith` except that it recursively clones `value`.
  19315. *
  19316. * @static
  19317. * @memberOf _
  19318. * @since 4.0.0
  19319. * @category Lang
  19320. * @param {*} value The value to recursively clone.
  19321. * @param {Function} [customizer] The function to customize cloning.
  19322. * @returns {*} Returns the deep cloned value.
  19323. * @see _.cloneWith
  19324. * @example
  19325. *
  19326. * function customizer(value) {
  19327. * if (_.isElement(value)) {
  19328. * return value.cloneNode(true);
  19329. * }
  19330. * }
  19331. *
  19332. * var el = _.cloneDeepWith(document.body, customizer);
  19333. *
  19334. * console.log(el === document.body);
  19335. * // => false
  19336. * console.log(el.nodeName);
  19337. * // => 'BODY'
  19338. * console.log(el.childNodes.length);
  19339. * // => 20
  19340. */
  19341. function cloneDeepWith(value, customizer) {
  19342. customizer = typeof customizer == 'function' ? customizer : undefined;
  19343. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  19344. }
  19345. /**
  19346. * Checks if `object` conforms to `source` by invoking the predicate
  19347. * properties of `source` with the corresponding property values of `object`.
  19348. *
  19349. * **Note:** This method is equivalent to `_.conforms` when `source` is
  19350. * partially applied.
  19351. *
  19352. * @static
  19353. * @memberOf _
  19354. * @since 4.14.0
  19355. * @category Lang
  19356. * @param {Object} object The object to inspect.
  19357. * @param {Object} source The object of property predicates to conform to.
  19358. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  19359. * @example
  19360. *
  19361. * var object = { 'a': 1, 'b': 2 };
  19362. *
  19363. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  19364. * // => true
  19365. *
  19366. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  19367. * // => false
  19368. */
  19369. function conformsTo(object, source) {
  19370. return source == null || baseConformsTo(object, source, keys(source));
  19371. }
  19372. /**
  19373. * Performs a
  19374. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19375. * comparison between two values to determine if they are equivalent.
  19376. *
  19377. * @static
  19378. * @memberOf _
  19379. * @since 4.0.0
  19380. * @category Lang
  19381. * @param {*} value The value to compare.
  19382. * @param {*} other The other value to compare.
  19383. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  19384. * @example
  19385. *
  19386. * var object = { 'a': 1 };
  19387. * var other = { 'a': 1 };
  19388. *
  19389. * _.eq(object, object);
  19390. * // => true
  19391. *
  19392. * _.eq(object, other);
  19393. * // => false
  19394. *
  19395. * _.eq('a', 'a');
  19396. * // => true
  19397. *
  19398. * _.eq('a', Object('a'));
  19399. * // => false
  19400. *
  19401. * _.eq(NaN, NaN);
  19402. * // => true
  19403. */
  19404. function eq(value, other) {
  19405. return value === other || (value !== value && other !== other);
  19406. }
  19407. /**
  19408. * Checks if `value` is greater than `other`.
  19409. *
  19410. * @static
  19411. * @memberOf _
  19412. * @since 3.9.0
  19413. * @category Lang
  19414. * @param {*} value The value to compare.
  19415. * @param {*} other The other value to compare.
  19416. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  19417. * else `false`.
  19418. * @see _.lt
  19419. * @example
  19420. *
  19421. * _.gt(3, 1);
  19422. * // => true
  19423. *
  19424. * _.gt(3, 3);
  19425. * // => false
  19426. *
  19427. * _.gt(1, 3);
  19428. * // => false
  19429. */
  19430. var gt = createRelationalOperation(baseGt);
  19431. /**
  19432. * Checks if `value` is greater than or equal to `other`.
  19433. *
  19434. * @static
  19435. * @memberOf _
  19436. * @since 3.9.0
  19437. * @category Lang
  19438. * @param {*} value The value to compare.
  19439. * @param {*} other The other value to compare.
  19440. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  19441. * `other`, else `false`.
  19442. * @see _.lte
  19443. * @example
  19444. *
  19445. * _.gte(3, 1);
  19446. * // => true
  19447. *
  19448. * _.gte(3, 3);
  19449. * // => true
  19450. *
  19451. * _.gte(1, 3);
  19452. * // => false
  19453. */
  19454. var gte = createRelationalOperation(function(value, other) {
  19455. return value >= other;
  19456. });
  19457. /**
  19458. * Checks if `value` is likely an `arguments` object.
  19459. *
  19460. * @static
  19461. * @memberOf _
  19462. * @since 0.1.0
  19463. * @category Lang
  19464. * @param {*} value The value to check.
  19465. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  19466. * else `false`.
  19467. * @example
  19468. *
  19469. * _.isArguments(function() { return arguments; }());
  19470. * // => true
  19471. *
  19472. * _.isArguments([1, 2, 3]);
  19473. * // => false
  19474. */
  19475. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  19476. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  19477. !propertyIsEnumerable.call(value, 'callee');
  19478. };
  19479. /**
  19480. * Checks if `value` is classified as an `Array` object.
  19481. *
  19482. * @static
  19483. * @memberOf _
  19484. * @since 0.1.0
  19485. * @category Lang
  19486. * @param {*} value The value to check.
  19487. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  19488. * @example
  19489. *
  19490. * _.isArray([1, 2, 3]);
  19491. * // => true
  19492. *
  19493. * _.isArray(document.body.children);
  19494. * // => false
  19495. *
  19496. * _.isArray('abc');
  19497. * // => false
  19498. *
  19499. * _.isArray(_.noop);
  19500. * // => false
  19501. */
  19502. var isArray = Array.isArray;
  19503. /**
  19504. * Checks if `value` is classified as an `ArrayBuffer` object.
  19505. *
  19506. * @static
  19507. * @memberOf _
  19508. * @since 4.3.0
  19509. * @category Lang
  19510. * @param {*} value The value to check.
  19511. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  19512. * @example
  19513. *
  19514. * _.isArrayBuffer(new ArrayBuffer(2));
  19515. * // => true
  19516. *
  19517. * _.isArrayBuffer(new Array(2));
  19518. * // => false
  19519. */
  19520. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  19521. /**
  19522. * Checks if `value` is array-like. A value is considered array-like if it's
  19523. * not a function and has a `value.length` that's an integer greater than or
  19524. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  19525. *
  19526. * @static
  19527. * @memberOf _
  19528. * @since 4.0.0
  19529. * @category Lang
  19530. * @param {*} value The value to check.
  19531. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  19532. * @example
  19533. *
  19534. * _.isArrayLike([1, 2, 3]);
  19535. * // => true
  19536. *
  19537. * _.isArrayLike(document.body.children);
  19538. * // => true
  19539. *
  19540. * _.isArrayLike('abc');
  19541. * // => true
  19542. *
  19543. * _.isArrayLike(_.noop);
  19544. * // => false
  19545. */
  19546. function isArrayLike(value) {
  19547. return value != null && isLength(value.length) && !isFunction(value);
  19548. }
  19549. /**
  19550. * This method is like `_.isArrayLike` except that it also checks if `value`
  19551. * is an object.
  19552. *
  19553. * @static
  19554. * @memberOf _
  19555. * @since 4.0.0
  19556. * @category Lang
  19557. * @param {*} value The value to check.
  19558. * @returns {boolean} Returns `true` if `value` is an array-like object,
  19559. * else `false`.
  19560. * @example
  19561. *
  19562. * _.isArrayLikeObject([1, 2, 3]);
  19563. * // => true
  19564. *
  19565. * _.isArrayLikeObject(document.body.children);
  19566. * // => true
  19567. *
  19568. * _.isArrayLikeObject('abc');
  19569. * // => false
  19570. *
  19571. * _.isArrayLikeObject(_.noop);
  19572. * // => false
  19573. */
  19574. function isArrayLikeObject(value) {
  19575. return isObjectLike(value) && isArrayLike(value);
  19576. }
  19577. /**
  19578. * Checks if `value` is classified as a boolean primitive or object.
  19579. *
  19580. * @static
  19581. * @memberOf _
  19582. * @since 0.1.0
  19583. * @category Lang
  19584. * @param {*} value The value to check.
  19585. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  19586. * @example
  19587. *
  19588. * _.isBoolean(false);
  19589. * // => true
  19590. *
  19591. * _.isBoolean(null);
  19592. * // => false
  19593. */
  19594. function isBoolean(value) {
  19595. return value === true || value === false ||
  19596. (isObjectLike(value) && baseGetTag(value) == boolTag);
  19597. }
  19598. /**
  19599. * Checks if `value` is a buffer.
  19600. *
  19601. * @static
  19602. * @memberOf _
  19603. * @since 4.3.0
  19604. * @category Lang
  19605. * @param {*} value The value to check.
  19606. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  19607. * @example
  19608. *
  19609. * _.isBuffer(new Buffer(2));
  19610. * // => true
  19611. *
  19612. * _.isBuffer(new Uint8Array(2));
  19613. * // => false
  19614. */
  19615. var isBuffer = nativeIsBuffer || stubFalse;
  19616. /**
  19617. * Checks if `value` is classified as a `Date` object.
  19618. *
  19619. * @static
  19620. * @memberOf _
  19621. * @since 0.1.0
  19622. * @category Lang
  19623. * @param {*} value The value to check.
  19624. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  19625. * @example
  19626. *
  19627. * _.isDate(new Date);
  19628. * // => true
  19629. *
  19630. * _.isDate('Mon April 23 2012');
  19631. * // => false
  19632. */
  19633. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  19634. /**
  19635. * Checks if `value` is likely a DOM element.
  19636. *
  19637. * @static
  19638. * @memberOf _
  19639. * @since 0.1.0
  19640. * @category Lang
  19641. * @param {*} value The value to check.
  19642. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  19643. * @example
  19644. *
  19645. * _.isElement(document.body);
  19646. * // => true
  19647. *
  19648. * _.isElement('<body>');
  19649. * // => false
  19650. */
  19651. function isElement(value) {
  19652. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  19653. }
  19654. /**
  19655. * Checks if `value` is an empty object, collection, map, or set.
  19656. *
  19657. * Objects are considered empty if they have no own enumerable string keyed
  19658. * properties.
  19659. *
  19660. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  19661. * jQuery-like collections are considered empty if they have a `length` of `0`.
  19662. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  19663. *
  19664. * @static
  19665. * @memberOf _
  19666. * @since 0.1.0
  19667. * @category Lang
  19668. * @param {*} value The value to check.
  19669. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  19670. * @example
  19671. *
  19672. * _.isEmpty(null);
  19673. * // => true
  19674. *
  19675. * _.isEmpty(true);
  19676. * // => true
  19677. *
  19678. * _.isEmpty(1);
  19679. * // => true
  19680. *
  19681. * _.isEmpty([1, 2, 3]);
  19682. * // => false
  19683. *
  19684. * _.isEmpty({ 'a': 1 });
  19685. * // => false
  19686. */
  19687. function isEmpty(value) {
  19688. if (value == null) {
  19689. return true;
  19690. }
  19691. if (isArrayLike(value) &&
  19692. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  19693. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  19694. return !value.length;
  19695. }
  19696. var tag = getTag(value);
  19697. if (tag == mapTag || tag == setTag) {
  19698. return !value.size;
  19699. }
  19700. if (isPrototype(value)) {
  19701. return !baseKeys(value).length;
  19702. }
  19703. for (var key in value) {
  19704. if (hasOwnProperty.call(value, key)) {
  19705. return false;
  19706. }
  19707. }
  19708. return true;
  19709. }
  19710. /**
  19711. * Performs a deep comparison between two values to determine if they are
  19712. * equivalent.
  19713. *
  19714. * **Note:** This method supports comparing arrays, array buffers, booleans,
  19715. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  19716. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  19717. * by their own, not inherited, enumerable properties. Functions and DOM
  19718. * nodes are compared by strict equality, i.e. `===`.
  19719. *
  19720. * @static
  19721. * @memberOf _
  19722. * @since 0.1.0
  19723. * @category Lang
  19724. * @param {*} value The value to compare.
  19725. * @param {*} other The other value to compare.
  19726. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  19727. * @example
  19728. *
  19729. * var object = { 'a': 1 };
  19730. * var other = { 'a': 1 };
  19731. *
  19732. * _.isEqual(object, other);
  19733. * // => true
  19734. *
  19735. * object === other;
  19736. * // => false
  19737. */
  19738. function isEqual(value, other) {
  19739. return baseIsEqual(value, other);
  19740. }
  19741. /**
  19742. * This method is like `_.isEqual` except that it accepts `customizer` which
  19743. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  19744. * are handled by the method instead. The `customizer` is invoked with up to
  19745. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  19746. *
  19747. * @static
  19748. * @memberOf _
  19749. * @since 4.0.0
  19750. * @category Lang
  19751. * @param {*} value The value to compare.
  19752. * @param {*} other The other value to compare.
  19753. * @param {Function} [customizer] The function to customize comparisons.
  19754. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  19755. * @example
  19756. *
  19757. * function isGreeting(value) {
  19758. * return /^h(?:i|ello)$/.test(value);
  19759. * }
  19760. *
  19761. * function customizer(objValue, othValue) {
  19762. * if (isGreeting(objValue) && isGreeting(othValue)) {
  19763. * return true;
  19764. * }
  19765. * }
  19766. *
  19767. * var array = ['hello', 'goodbye'];
  19768. * var other = ['hi', 'goodbye'];
  19769. *
  19770. * _.isEqualWith(array, other, customizer);
  19771. * // => true
  19772. */
  19773. function isEqualWith(value, other, customizer) {
  19774. customizer = typeof customizer == 'function' ? customizer : undefined;
  19775. var result = customizer ? customizer(value, other) : undefined;
  19776. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  19777. }
  19778. /**
  19779. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  19780. * `SyntaxError`, `TypeError`, or `URIError` object.
  19781. *
  19782. * @static
  19783. * @memberOf _
  19784. * @since 3.0.0
  19785. * @category Lang
  19786. * @param {*} value The value to check.
  19787. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  19788. * @example
  19789. *
  19790. * _.isError(new Error);
  19791. * // => true
  19792. *
  19793. * _.isError(Error);
  19794. * // => false
  19795. */
  19796. function isError(value) {
  19797. if (!isObjectLike(value)) {
  19798. return false;
  19799. }
  19800. var tag = baseGetTag(value);
  19801. return tag == errorTag || tag == domExcTag ||
  19802. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  19803. }
  19804. /**
  19805. * Checks if `value` is a finite primitive number.
  19806. *
  19807. * **Note:** This method is based on
  19808. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  19809. *
  19810. * @static
  19811. * @memberOf _
  19812. * @since 0.1.0
  19813. * @category Lang
  19814. * @param {*} value The value to check.
  19815. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  19816. * @example
  19817. *
  19818. * _.isFinite(3);
  19819. * // => true
  19820. *
  19821. * _.isFinite(Number.MIN_VALUE);
  19822. * // => true
  19823. *
  19824. * _.isFinite(Infinity);
  19825. * // => false
  19826. *
  19827. * _.isFinite('3');
  19828. * // => false
  19829. */
  19830. function isFinite(value) {
  19831. return typeof value == 'number' && nativeIsFinite(value);
  19832. }
  19833. /**
  19834. * Checks if `value` is classified as a `Function` object.
  19835. *
  19836. * @static
  19837. * @memberOf _
  19838. * @since 0.1.0
  19839. * @category Lang
  19840. * @param {*} value The value to check.
  19841. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  19842. * @example
  19843. *
  19844. * _.isFunction(_);
  19845. * // => true
  19846. *
  19847. * _.isFunction(/abc/);
  19848. * // => false
  19849. */
  19850. function isFunction(value) {
  19851. if (!isObject(value)) {
  19852. return false;
  19853. }
  19854. // The use of `Object#toString` avoids issues with the `typeof` operator
  19855. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  19856. var tag = baseGetTag(value);
  19857. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  19858. }
  19859. /**
  19860. * Checks if `value` is an integer.
  19861. *
  19862. * **Note:** This method is based on
  19863. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  19864. *
  19865. * @static
  19866. * @memberOf _
  19867. * @since 4.0.0
  19868. * @category Lang
  19869. * @param {*} value The value to check.
  19870. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  19871. * @example
  19872. *
  19873. * _.isInteger(3);
  19874. * // => true
  19875. *
  19876. * _.isInteger(Number.MIN_VALUE);
  19877. * // => false
  19878. *
  19879. * _.isInteger(Infinity);
  19880. * // => false
  19881. *
  19882. * _.isInteger('3');
  19883. * // => false
  19884. */
  19885. function isInteger(value) {
  19886. return typeof value == 'number' && value == toInteger(value);
  19887. }
  19888. /**
  19889. * Checks if `value` is a valid array-like length.
  19890. *
  19891. * **Note:** This method is loosely based on
  19892. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  19893. *
  19894. * @static
  19895. * @memberOf _
  19896. * @since 4.0.0
  19897. * @category Lang
  19898. * @param {*} value The value to check.
  19899. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  19900. * @example
  19901. *
  19902. * _.isLength(3);
  19903. * // => true
  19904. *
  19905. * _.isLength(Number.MIN_VALUE);
  19906. * // => false
  19907. *
  19908. * _.isLength(Infinity);
  19909. * // => false
  19910. *
  19911. * _.isLength('3');
  19912. * // => false
  19913. */
  19914. function isLength(value) {
  19915. return typeof value == 'number' &&
  19916. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  19917. }
  19918. /**
  19919. * Checks if `value` is the
  19920. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  19921. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  19922. *
  19923. * @static
  19924. * @memberOf _
  19925. * @since 0.1.0
  19926. * @category Lang
  19927. * @param {*} value The value to check.
  19928. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  19929. * @example
  19930. *
  19931. * _.isObject({});
  19932. * // => true
  19933. *
  19934. * _.isObject([1, 2, 3]);
  19935. * // => true
  19936. *
  19937. * _.isObject(_.noop);
  19938. * // => true
  19939. *
  19940. * _.isObject(null);
  19941. * // => false
  19942. */
  19943. function isObject(value) {
  19944. var type = typeof value;
  19945. return value != null && (type == 'object' || type == 'function');
  19946. }
  19947. /**
  19948. * Checks if `value` is object-like. A value is object-like if it's not `null`
  19949. * and has a `typeof` result of "object".
  19950. *
  19951. * @static
  19952. * @memberOf _
  19953. * @since 4.0.0
  19954. * @category Lang
  19955. * @param {*} value The value to check.
  19956. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  19957. * @example
  19958. *
  19959. * _.isObjectLike({});
  19960. * // => true
  19961. *
  19962. * _.isObjectLike([1, 2, 3]);
  19963. * // => true
  19964. *
  19965. * _.isObjectLike(_.noop);
  19966. * // => false
  19967. *
  19968. * _.isObjectLike(null);
  19969. * // => false
  19970. */
  19971. function isObjectLike(value) {
  19972. return value != null && typeof value == 'object';
  19973. }
  19974. /**
  19975. * Checks if `value` is classified as a `Map` object.
  19976. *
  19977. * @static
  19978. * @memberOf _
  19979. * @since 4.3.0
  19980. * @category Lang
  19981. * @param {*} value The value to check.
  19982. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  19983. * @example
  19984. *
  19985. * _.isMap(new Map);
  19986. * // => true
  19987. *
  19988. * _.isMap(new WeakMap);
  19989. * // => false
  19990. */
  19991. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  19992. /**
  19993. * Performs a partial deep comparison between `object` and `source` to
  19994. * determine if `object` contains equivalent property values.
  19995. *
  19996. * **Note:** This method is equivalent to `_.matches` when `source` is
  19997. * partially applied.
  19998. *
  19999. * Partial comparisons will match empty array and empty object `source`
  20000. * values against any array or object value, respectively. See `_.isEqual`
  20001. * for a list of supported value comparisons.
  20002. *
  20003. * @static
  20004. * @memberOf _
  20005. * @since 3.0.0
  20006. * @category Lang
  20007. * @param {Object} object The object to inspect.
  20008. * @param {Object} source The object of property values to match.
  20009. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20010. * @example
  20011. *
  20012. * var object = { 'a': 1, 'b': 2 };
  20013. *
  20014. * _.isMatch(object, { 'b': 2 });
  20015. * // => true
  20016. *
  20017. * _.isMatch(object, { 'b': 1 });
  20018. * // => false
  20019. */
  20020. function isMatch(object, source) {
  20021. return object === source || baseIsMatch(object, source, getMatchData(source));
  20022. }
  20023. /**
  20024. * This method is like `_.isMatch` except that it accepts `customizer` which
  20025. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  20026. * are handled by the method instead. The `customizer` is invoked with five
  20027. * arguments: (objValue, srcValue, index|key, object, source).
  20028. *
  20029. * @static
  20030. * @memberOf _
  20031. * @since 4.0.0
  20032. * @category Lang
  20033. * @param {Object} object The object to inspect.
  20034. * @param {Object} source The object of property values to match.
  20035. * @param {Function} [customizer] The function to customize comparisons.
  20036. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20037. * @example
  20038. *
  20039. * function isGreeting(value) {
  20040. * return /^h(?:i|ello)$/.test(value);
  20041. * }
  20042. *
  20043. * function customizer(objValue, srcValue) {
  20044. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  20045. * return true;
  20046. * }
  20047. * }
  20048. *
  20049. * var object = { 'greeting': 'hello' };
  20050. * var source = { 'greeting': 'hi' };
  20051. *
  20052. * _.isMatchWith(object, source, customizer);
  20053. * // => true
  20054. */
  20055. function isMatchWith(object, source, customizer) {
  20056. customizer = typeof customizer == 'function' ? customizer : undefined;
  20057. return baseIsMatch(object, source, getMatchData(source), customizer);
  20058. }
  20059. /**
  20060. * Checks if `value` is `NaN`.
  20061. *
  20062. * **Note:** This method is based on
  20063. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  20064. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  20065. * `undefined` and other non-number values.
  20066. *
  20067. * @static
  20068. * @memberOf _
  20069. * @since 0.1.0
  20070. * @category Lang
  20071. * @param {*} value The value to check.
  20072. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  20073. * @example
  20074. *
  20075. * _.isNaN(NaN);
  20076. * // => true
  20077. *
  20078. * _.isNaN(new Number(NaN));
  20079. * // => true
  20080. *
  20081. * isNaN(undefined);
  20082. * // => true
  20083. *
  20084. * _.isNaN(undefined);
  20085. * // => false
  20086. */
  20087. function isNaN(value) {
  20088. // An `NaN` primitive is the only value that is not equal to itself.
  20089. // Perform the `toStringTag` check first to avoid errors with some
  20090. // ActiveX objects in IE.
  20091. return isNumber(value) && value != +value;
  20092. }
  20093. /**
  20094. * Checks if `value` is a pristine native function.
  20095. *
  20096. * **Note:** This method can't reliably detect native functions in the presence
  20097. * of the core-js package because core-js circumvents this kind of detection.
  20098. * Despite multiple requests, the core-js maintainer has made it clear: any
  20099. * attempt to fix the detection will be obstructed. As a result, we're left
  20100. * with little choice but to throw an error. Unfortunately, this also affects
  20101. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  20102. * which rely on core-js.
  20103. *
  20104. * @static
  20105. * @memberOf _
  20106. * @since 3.0.0
  20107. * @category Lang
  20108. * @param {*} value The value to check.
  20109. * @returns {boolean} Returns `true` if `value` is a native function,
  20110. * else `false`.
  20111. * @example
  20112. *
  20113. * _.isNative(Array.prototype.push);
  20114. * // => true
  20115. *
  20116. * _.isNative(_);
  20117. * // => false
  20118. */
  20119. function isNative(value) {
  20120. if (isMaskable(value)) {
  20121. throw new Error(CORE_ERROR_TEXT);
  20122. }
  20123. return baseIsNative(value);
  20124. }
  20125. /**
  20126. * Checks if `value` is `null`.
  20127. *
  20128. * @static
  20129. * @memberOf _
  20130. * @since 0.1.0
  20131. * @category Lang
  20132. * @param {*} value The value to check.
  20133. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  20134. * @example
  20135. *
  20136. * _.isNull(null);
  20137. * // => true
  20138. *
  20139. * _.isNull(void 0);
  20140. * // => false
  20141. */
  20142. function isNull(value) {
  20143. return value === null;
  20144. }
  20145. /**
  20146. * Checks if `value` is `null` or `undefined`.
  20147. *
  20148. * @static
  20149. * @memberOf _
  20150. * @since 4.0.0
  20151. * @category Lang
  20152. * @param {*} value The value to check.
  20153. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  20154. * @example
  20155. *
  20156. * _.isNil(null);
  20157. * // => true
  20158. *
  20159. * _.isNil(void 0);
  20160. * // => true
  20161. *
  20162. * _.isNil(NaN);
  20163. * // => false
  20164. */
  20165. function isNil(value) {
  20166. return value == null;
  20167. }
  20168. /**
  20169. * Checks if `value` is classified as a `Number` primitive or object.
  20170. *
  20171. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  20172. * classified as numbers, use the `_.isFinite` method.
  20173. *
  20174. * @static
  20175. * @memberOf _
  20176. * @since 0.1.0
  20177. * @category Lang
  20178. * @param {*} value The value to check.
  20179. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  20180. * @example
  20181. *
  20182. * _.isNumber(3);
  20183. * // => true
  20184. *
  20185. * _.isNumber(Number.MIN_VALUE);
  20186. * // => true
  20187. *
  20188. * _.isNumber(Infinity);
  20189. * // => true
  20190. *
  20191. * _.isNumber('3');
  20192. * // => false
  20193. */
  20194. function isNumber(value) {
  20195. return typeof value == 'number' ||
  20196. (isObjectLike(value) && baseGetTag(value) == numberTag);
  20197. }
  20198. /**
  20199. * Checks if `value` is a plain object, that is, an object created by the
  20200. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  20201. *
  20202. * @static
  20203. * @memberOf _
  20204. * @since 0.8.0
  20205. * @category Lang
  20206. * @param {*} value The value to check.
  20207. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  20208. * @example
  20209. *
  20210. * function Foo() {
  20211. * this.a = 1;
  20212. * }
  20213. *
  20214. * _.isPlainObject(new Foo);
  20215. * // => false
  20216. *
  20217. * _.isPlainObject([1, 2, 3]);
  20218. * // => false
  20219. *
  20220. * _.isPlainObject({ 'x': 0, 'y': 0 });
  20221. * // => true
  20222. *
  20223. * _.isPlainObject(Object.create(null));
  20224. * // => true
  20225. */
  20226. function isPlainObject(value) {
  20227. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  20228. return false;
  20229. }
  20230. var proto = getPrototype(value);
  20231. if (proto === null) {
  20232. return true;
  20233. }
  20234. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  20235. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  20236. funcToString.call(Ctor) == objectCtorString;
  20237. }
  20238. /**
  20239. * Checks if `value` is classified as a `RegExp` object.
  20240. *
  20241. * @static
  20242. * @memberOf _
  20243. * @since 0.1.0
  20244. * @category Lang
  20245. * @param {*} value The value to check.
  20246. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  20247. * @example
  20248. *
  20249. * _.isRegExp(/abc/);
  20250. * // => true
  20251. *
  20252. * _.isRegExp('/abc/');
  20253. * // => false
  20254. */
  20255. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  20256. /**
  20257. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  20258. * double precision number which isn't the result of a rounded unsafe integer.
  20259. *
  20260. * **Note:** This method is based on
  20261. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  20262. *
  20263. * @static
  20264. * @memberOf _
  20265. * @since 4.0.0
  20266. * @category Lang
  20267. * @param {*} value The value to check.
  20268. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  20269. * @example
  20270. *
  20271. * _.isSafeInteger(3);
  20272. * // => true
  20273. *
  20274. * _.isSafeInteger(Number.MIN_VALUE);
  20275. * // => false
  20276. *
  20277. * _.isSafeInteger(Infinity);
  20278. * // => false
  20279. *
  20280. * _.isSafeInteger('3');
  20281. * // => false
  20282. */
  20283. function isSafeInteger(value) {
  20284. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  20285. }
  20286. /**
  20287. * Checks if `value` is classified as a `Set` object.
  20288. *
  20289. * @static
  20290. * @memberOf _
  20291. * @since 4.3.0
  20292. * @category Lang
  20293. * @param {*} value The value to check.
  20294. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  20295. * @example
  20296. *
  20297. * _.isSet(new Set);
  20298. * // => true
  20299. *
  20300. * _.isSet(new WeakSet);
  20301. * // => false
  20302. */
  20303. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  20304. /**
  20305. * Checks if `value` is classified as a `String` primitive or object.
  20306. *
  20307. * @static
  20308. * @since 0.1.0
  20309. * @memberOf _
  20310. * @category Lang
  20311. * @param {*} value The value to check.
  20312. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  20313. * @example
  20314. *
  20315. * _.isString('abc');
  20316. * // => true
  20317. *
  20318. * _.isString(1);
  20319. * // => false
  20320. */
  20321. function isString(value) {
  20322. return typeof value == 'string' ||
  20323. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  20324. }
  20325. /**
  20326. * Checks if `value` is classified as a `Symbol` primitive or object.
  20327. *
  20328. * @static
  20329. * @memberOf _
  20330. * @since 4.0.0
  20331. * @category Lang
  20332. * @param {*} value The value to check.
  20333. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  20334. * @example
  20335. *
  20336. * _.isSymbol(Symbol.iterator);
  20337. * // => true
  20338. *
  20339. * _.isSymbol('abc');
  20340. * // => false
  20341. */
  20342. function isSymbol(value) {
  20343. return typeof value == 'symbol' ||
  20344. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  20345. }
  20346. /**
  20347. * Checks if `value` is classified as a typed array.
  20348. *
  20349. * @static
  20350. * @memberOf _
  20351. * @since 3.0.0
  20352. * @category Lang
  20353. * @param {*} value The value to check.
  20354. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  20355. * @example
  20356. *
  20357. * _.isTypedArray(new Uint8Array);
  20358. * // => true
  20359. *
  20360. * _.isTypedArray([]);
  20361. * // => false
  20362. */
  20363. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  20364. /**
  20365. * Checks if `value` is `undefined`.
  20366. *
  20367. * @static
  20368. * @since 0.1.0
  20369. * @memberOf _
  20370. * @category Lang
  20371. * @param {*} value The value to check.
  20372. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  20373. * @example
  20374. *
  20375. * _.isUndefined(void 0);
  20376. * // => true
  20377. *
  20378. * _.isUndefined(null);
  20379. * // => false
  20380. */
  20381. function isUndefined(value) {
  20382. return value === undefined;
  20383. }
  20384. /**
  20385. * Checks if `value` is classified as a `WeakMap` object.
  20386. *
  20387. * @static
  20388. * @memberOf _
  20389. * @since 4.3.0
  20390. * @category Lang
  20391. * @param {*} value The value to check.
  20392. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  20393. * @example
  20394. *
  20395. * _.isWeakMap(new WeakMap);
  20396. * // => true
  20397. *
  20398. * _.isWeakMap(new Map);
  20399. * // => false
  20400. */
  20401. function isWeakMap(value) {
  20402. return isObjectLike(value) && getTag(value) == weakMapTag;
  20403. }
  20404. /**
  20405. * Checks if `value` is classified as a `WeakSet` object.
  20406. *
  20407. * @static
  20408. * @memberOf _
  20409. * @since 4.3.0
  20410. * @category Lang
  20411. * @param {*} value The value to check.
  20412. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  20413. * @example
  20414. *
  20415. * _.isWeakSet(new WeakSet);
  20416. * // => true
  20417. *
  20418. * _.isWeakSet(new Set);
  20419. * // => false
  20420. */
  20421. function isWeakSet(value) {
  20422. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  20423. }
  20424. /**
  20425. * Checks if `value` is less than `other`.
  20426. *
  20427. * @static
  20428. * @memberOf _
  20429. * @since 3.9.0
  20430. * @category Lang
  20431. * @param {*} value The value to compare.
  20432. * @param {*} other The other value to compare.
  20433. * @returns {boolean} Returns `true` if `value` is less than `other`,
  20434. * else `false`.
  20435. * @see _.gt
  20436. * @example
  20437. *
  20438. * _.lt(1, 3);
  20439. * // => true
  20440. *
  20441. * _.lt(3, 3);
  20442. * // => false
  20443. *
  20444. * _.lt(3, 1);
  20445. * // => false
  20446. */
  20447. var lt = createRelationalOperation(baseLt);
  20448. /**
  20449. * Checks if `value` is less than or equal to `other`.
  20450. *
  20451. * @static
  20452. * @memberOf _
  20453. * @since 3.9.0
  20454. * @category Lang
  20455. * @param {*} value The value to compare.
  20456. * @param {*} other The other value to compare.
  20457. * @returns {boolean} Returns `true` if `value` is less than or equal to
  20458. * `other`, else `false`.
  20459. * @see _.gte
  20460. * @example
  20461. *
  20462. * _.lte(1, 3);
  20463. * // => true
  20464. *
  20465. * _.lte(3, 3);
  20466. * // => true
  20467. *
  20468. * _.lte(3, 1);
  20469. * // => false
  20470. */
  20471. var lte = createRelationalOperation(function(value, other) {
  20472. return value <= other;
  20473. });
  20474. /**
  20475. * Converts `value` to an array.
  20476. *
  20477. * @static
  20478. * @since 0.1.0
  20479. * @memberOf _
  20480. * @category Lang
  20481. * @param {*} value The value to convert.
  20482. * @returns {Array} Returns the converted array.
  20483. * @example
  20484. *
  20485. * _.toArray({ 'a': 1, 'b': 2 });
  20486. * // => [1, 2]
  20487. *
  20488. * _.toArray('abc');
  20489. * // => ['a', 'b', 'c']
  20490. *
  20491. * _.toArray(1);
  20492. * // => []
  20493. *
  20494. * _.toArray(null);
  20495. * // => []
  20496. */
  20497. function toArray(value) {
  20498. if (!value) {
  20499. return [];
  20500. }
  20501. if (isArrayLike(value)) {
  20502. return isString(value) ? stringToArray(value) : copyArray(value);
  20503. }
  20504. if (symIterator && value[symIterator]) {
  20505. return iteratorToArray(value[symIterator]());
  20506. }
  20507. var tag = getTag(value),
  20508. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  20509. return func(value);
  20510. }
  20511. /**
  20512. * Converts `value` to a finite number.
  20513. *
  20514. * @static
  20515. * @memberOf _
  20516. * @since 4.12.0
  20517. * @category Lang
  20518. * @param {*} value The value to convert.
  20519. * @returns {number} Returns the converted number.
  20520. * @example
  20521. *
  20522. * _.toFinite(3.2);
  20523. * // => 3.2
  20524. *
  20525. * _.toFinite(Number.MIN_VALUE);
  20526. * // => 5e-324
  20527. *
  20528. * _.toFinite(Infinity);
  20529. * // => 1.7976931348623157e+308
  20530. *
  20531. * _.toFinite('3.2');
  20532. * // => 3.2
  20533. */
  20534. function toFinite(value) {
  20535. if (!value) {
  20536. return value === 0 ? value : 0;
  20537. }
  20538. value = toNumber(value);
  20539. if (value === INFINITY || value === -INFINITY) {
  20540. var sign = (value < 0 ? -1 : 1);
  20541. return sign * MAX_INTEGER;
  20542. }
  20543. return value === value ? value : 0;
  20544. }
  20545. /**
  20546. * Converts `value` to an integer.
  20547. *
  20548. * **Note:** This method is loosely based on
  20549. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  20550. *
  20551. * @static
  20552. * @memberOf _
  20553. * @since 4.0.0
  20554. * @category Lang
  20555. * @param {*} value The value to convert.
  20556. * @returns {number} Returns the converted integer.
  20557. * @example
  20558. *
  20559. * _.toInteger(3.2);
  20560. * // => 3
  20561. *
  20562. * _.toInteger(Number.MIN_VALUE);
  20563. * // => 0
  20564. *
  20565. * _.toInteger(Infinity);
  20566. * // => 1.7976931348623157e+308
  20567. *
  20568. * _.toInteger('3.2');
  20569. * // => 3
  20570. */
  20571. function toInteger(value) {
  20572. var result = toFinite(value),
  20573. remainder = result % 1;
  20574. return result === result ? (remainder ? result - remainder : result) : 0;
  20575. }
  20576. /**
  20577. * Converts `value` to an integer suitable for use as the length of an
  20578. * array-like object.
  20579. *
  20580. * **Note:** This method is based on
  20581. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  20582. *
  20583. * @static
  20584. * @memberOf _
  20585. * @since 4.0.0
  20586. * @category Lang
  20587. * @param {*} value The value to convert.
  20588. * @returns {number} Returns the converted integer.
  20589. * @example
  20590. *
  20591. * _.toLength(3.2);
  20592. * // => 3
  20593. *
  20594. * _.toLength(Number.MIN_VALUE);
  20595. * // => 0
  20596. *
  20597. * _.toLength(Infinity);
  20598. * // => 4294967295
  20599. *
  20600. * _.toLength('3.2');
  20601. * // => 3
  20602. */
  20603. function toLength(value) {
  20604. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  20605. }
  20606. /**
  20607. * Converts `value` to a number.
  20608. *
  20609. * @static
  20610. * @memberOf _
  20611. * @since 4.0.0
  20612. * @category Lang
  20613. * @param {*} value The value to process.
  20614. * @returns {number} Returns the number.
  20615. * @example
  20616. *
  20617. * _.toNumber(3.2);
  20618. * // => 3.2
  20619. *
  20620. * _.toNumber(Number.MIN_VALUE);
  20621. * // => 5e-324
  20622. *
  20623. * _.toNumber(Infinity);
  20624. * // => Infinity
  20625. *
  20626. * _.toNumber('3.2');
  20627. * // => 3.2
  20628. */
  20629. function toNumber(value) {
  20630. if (typeof value == 'number') {
  20631. return value;
  20632. }
  20633. if (isSymbol(value)) {
  20634. return NAN;
  20635. }
  20636. if (isObject(value)) {
  20637. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  20638. value = isObject(other) ? (other + '') : other;
  20639. }
  20640. if (typeof value != 'string') {
  20641. return value === 0 ? value : +value;
  20642. }
  20643. value = value.replace(reTrim, '');
  20644. var isBinary = reIsBinary.test(value);
  20645. return (isBinary || reIsOctal.test(value))
  20646. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  20647. : (reIsBadHex.test(value) ? NAN : +value);
  20648. }
  20649. /**
  20650. * Converts `value` to a plain object flattening inherited enumerable string
  20651. * keyed properties of `value` to own properties of the plain object.
  20652. *
  20653. * @static
  20654. * @memberOf _
  20655. * @since 3.0.0
  20656. * @category Lang
  20657. * @param {*} value The value to convert.
  20658. * @returns {Object} Returns the converted plain object.
  20659. * @example
  20660. *
  20661. * function Foo() {
  20662. * this.b = 2;
  20663. * }
  20664. *
  20665. * Foo.prototype.c = 3;
  20666. *
  20667. * _.assign({ 'a': 1 }, new Foo);
  20668. * // => { 'a': 1, 'b': 2 }
  20669. *
  20670. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  20671. * // => { 'a': 1, 'b': 2, 'c': 3 }
  20672. */
  20673. function toPlainObject(value) {
  20674. return copyObject(value, keysIn(value));
  20675. }
  20676. /**
  20677. * Converts `value` to a safe integer. A safe integer can be compared and
  20678. * represented correctly.
  20679. *
  20680. * @static
  20681. * @memberOf _
  20682. * @since 4.0.0
  20683. * @category Lang
  20684. * @param {*} value The value to convert.
  20685. * @returns {number} Returns the converted integer.
  20686. * @example
  20687. *
  20688. * _.toSafeInteger(3.2);
  20689. * // => 3
  20690. *
  20691. * _.toSafeInteger(Number.MIN_VALUE);
  20692. * // => 0
  20693. *
  20694. * _.toSafeInteger(Infinity);
  20695. * // => 9007199254740991
  20696. *
  20697. * _.toSafeInteger('3.2');
  20698. * // => 3
  20699. */
  20700. function toSafeInteger(value) {
  20701. return value
  20702. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  20703. : (value === 0 ? value : 0);
  20704. }
  20705. /**
  20706. * Converts `value` to a string. An empty string is returned for `null`
  20707. * and `undefined` values. The sign of `-0` is preserved.
  20708. *
  20709. * @static
  20710. * @memberOf _
  20711. * @since 4.0.0
  20712. * @category Lang
  20713. * @param {*} value The value to convert.
  20714. * @returns {string} Returns the converted string.
  20715. * @example
  20716. *
  20717. * _.toString(null);
  20718. * // => ''
  20719. *
  20720. * _.toString(-0);
  20721. * // => '-0'
  20722. *
  20723. * _.toString([1, 2, 3]);
  20724. * // => '1,2,3'
  20725. */
  20726. function toString(value) {
  20727. return value == null ? '' : baseToString(value);
  20728. }
  20729. /*------------------------------------------------------------------------*/
  20730. /**
  20731. * Assigns own enumerable string keyed properties of source objects to the
  20732. * destination object. Source objects are applied from left to right.
  20733. * Subsequent sources overwrite property assignments of previous sources.
  20734. *
  20735. * **Note:** This method mutates `object` and is loosely based on
  20736. * [`Object.assign`](https://mdn.io/Object/assign).
  20737. *
  20738. * @static
  20739. * @memberOf _
  20740. * @since 0.10.0
  20741. * @category Object
  20742. * @param {Object} object The destination object.
  20743. * @param {...Object} [sources] The source objects.
  20744. * @returns {Object} Returns `object`.
  20745. * @see _.assignIn
  20746. * @example
  20747. *
  20748. * function Foo() {
  20749. * this.a = 1;
  20750. * }
  20751. *
  20752. * function Bar() {
  20753. * this.c = 3;
  20754. * }
  20755. *
  20756. * Foo.prototype.b = 2;
  20757. * Bar.prototype.d = 4;
  20758. *
  20759. * _.assign({ 'a': 0 }, new Foo, new Bar);
  20760. * // => { 'a': 1, 'c': 3 }
  20761. */
  20762. var assign = createAssigner(function(object, source) {
  20763. if (isPrototype(source) || isArrayLike(source)) {
  20764. copyObject(source, keys(source), object);
  20765. return;
  20766. }
  20767. for (var key in source) {
  20768. if (hasOwnProperty.call(source, key)) {
  20769. assignValue(object, key, source[key]);
  20770. }
  20771. }
  20772. });
  20773. /**
  20774. * This method is like `_.assign` except that it iterates over own and
  20775. * inherited source properties.
  20776. *
  20777. * **Note:** This method mutates `object`.
  20778. *
  20779. * @static
  20780. * @memberOf _
  20781. * @since 4.0.0
  20782. * @alias extend
  20783. * @category Object
  20784. * @param {Object} object The destination object.
  20785. * @param {...Object} [sources] The source objects.
  20786. * @returns {Object} Returns `object`.
  20787. * @see _.assign
  20788. * @example
  20789. *
  20790. * function Foo() {
  20791. * this.a = 1;
  20792. * }
  20793. *
  20794. * function Bar() {
  20795. * this.c = 3;
  20796. * }
  20797. *
  20798. * Foo.prototype.b = 2;
  20799. * Bar.prototype.d = 4;
  20800. *
  20801. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  20802. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  20803. */
  20804. var assignIn = createAssigner(function(object, source) {
  20805. copyObject(source, keysIn(source), object);
  20806. });
  20807. /**
  20808. * This method is like `_.assignIn` except that it accepts `customizer`
  20809. * which is invoked to produce the assigned values. If `customizer` returns
  20810. * `undefined`, assignment is handled by the method instead. The `customizer`
  20811. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  20812. *
  20813. * **Note:** This method mutates `object`.
  20814. *
  20815. * @static
  20816. * @memberOf _
  20817. * @since 4.0.0
  20818. * @alias extendWith
  20819. * @category Object
  20820. * @param {Object} object The destination object.
  20821. * @param {...Object} sources The source objects.
  20822. * @param {Function} [customizer] The function to customize assigned values.
  20823. * @returns {Object} Returns `object`.
  20824. * @see _.assignWith
  20825. * @example
  20826. *
  20827. * function customizer(objValue, srcValue) {
  20828. * return _.isUndefined(objValue) ? srcValue : objValue;
  20829. * }
  20830. *
  20831. * var defaults = _.partialRight(_.assignInWith, customizer);
  20832. *
  20833. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  20834. * // => { 'a': 1, 'b': 2 }
  20835. */
  20836. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  20837. copyObject(source, keysIn(source), object, customizer);
  20838. });
  20839. /**
  20840. * This method is like `_.assign` except that it accepts `customizer`
  20841. * which is invoked to produce the assigned values. If `customizer` returns
  20842. * `undefined`, assignment is handled by the method instead. The `customizer`
  20843. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  20844. *
  20845. * **Note:** This method mutates `object`.
  20846. *
  20847. * @static
  20848. * @memberOf _
  20849. * @since 4.0.0
  20850. * @category Object
  20851. * @param {Object} object The destination object.
  20852. * @param {...Object} sources The source objects.
  20853. * @param {Function} [customizer] The function to customize assigned values.
  20854. * @returns {Object} Returns `object`.
  20855. * @see _.assignInWith
  20856. * @example
  20857. *
  20858. * function customizer(objValue, srcValue) {
  20859. * return _.isUndefined(objValue) ? srcValue : objValue;
  20860. * }
  20861. *
  20862. * var defaults = _.partialRight(_.assignWith, customizer);
  20863. *
  20864. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  20865. * // => { 'a': 1, 'b': 2 }
  20866. */
  20867. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  20868. copyObject(source, keys(source), object, customizer);
  20869. });
  20870. /**
  20871. * Creates an array of values corresponding to `paths` of `object`.
  20872. *
  20873. * @static
  20874. * @memberOf _
  20875. * @since 1.0.0
  20876. * @category Object
  20877. * @param {Object} object The object to iterate over.
  20878. * @param {...(string|string[])} [paths] The property paths to pick.
  20879. * @returns {Array} Returns the picked values.
  20880. * @example
  20881. *
  20882. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  20883. *
  20884. * _.at(object, ['a[0].b.c', 'a[1]']);
  20885. * // => [3, 4]
  20886. */
  20887. var at = flatRest(baseAt);
  20888. /**
  20889. * Creates an object that inherits from the `prototype` object. If a
  20890. * `properties` object is given, its own enumerable string keyed properties
  20891. * are assigned to the created object.
  20892. *
  20893. * @static
  20894. * @memberOf _
  20895. * @since 2.3.0
  20896. * @category Object
  20897. * @param {Object} prototype The object to inherit from.
  20898. * @param {Object} [properties] The properties to assign to the object.
  20899. * @returns {Object} Returns the new object.
  20900. * @example
  20901. *
  20902. * function Shape() {
  20903. * this.x = 0;
  20904. * this.y = 0;
  20905. * }
  20906. *
  20907. * function Circle() {
  20908. * Shape.call(this);
  20909. * }
  20910. *
  20911. * Circle.prototype = _.create(Shape.prototype, {
  20912. * 'constructor': Circle
  20913. * });
  20914. *
  20915. * var circle = new Circle;
  20916. * circle instanceof Circle;
  20917. * // => true
  20918. *
  20919. * circle instanceof Shape;
  20920. * // => true
  20921. */
  20922. function create(prototype, properties) {
  20923. var result = baseCreate(prototype);
  20924. return properties == null ? result : baseAssign(result, properties);
  20925. }
  20926. /**
  20927. * Assigns own and inherited enumerable string keyed properties of source
  20928. * objects to the destination object for all destination properties that
  20929. * resolve to `undefined`. Source objects are applied from left to right.
  20930. * Once a property is set, additional values of the same property are ignored.
  20931. *
  20932. * **Note:** This method mutates `object`.
  20933. *
  20934. * @static
  20935. * @since 0.1.0
  20936. * @memberOf _
  20937. * @category Object
  20938. * @param {Object} object The destination object.
  20939. * @param {...Object} [sources] The source objects.
  20940. * @returns {Object} Returns `object`.
  20941. * @see _.defaultsDeep
  20942. * @example
  20943. *
  20944. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  20945. * // => { 'a': 1, 'b': 2 }
  20946. */
  20947. var defaults = baseRest(function(args) {
  20948. args.push(undefined, customDefaultsAssignIn);
  20949. return apply(assignInWith, undefined, args);
  20950. });
  20951. /**
  20952. * This method is like `_.defaults` except that it recursively assigns
  20953. * default properties.
  20954. *
  20955. * **Note:** This method mutates `object`.
  20956. *
  20957. * @static
  20958. * @memberOf _
  20959. * @since 3.10.0
  20960. * @category Object
  20961. * @param {Object} object The destination object.
  20962. * @param {...Object} [sources] The source objects.
  20963. * @returns {Object} Returns `object`.
  20964. * @see _.defaults
  20965. * @example
  20966. *
  20967. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  20968. * // => { 'a': { 'b': 2, 'c': 3 } }
  20969. */
  20970. var defaultsDeep = baseRest(function(args) {
  20971. args.push(undefined, customDefaultsMerge);
  20972. return apply(mergeWith, undefined, args);
  20973. });
  20974. /**
  20975. * This method is like `_.find` except that it returns the key of the first
  20976. * element `predicate` returns truthy for instead of the element itself.
  20977. *
  20978. * @static
  20979. * @memberOf _
  20980. * @since 1.1.0
  20981. * @category Object
  20982. * @param {Object} object The object to inspect.
  20983. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20984. * @returns {string|undefined} Returns the key of the matched element,
  20985. * else `undefined`.
  20986. * @example
  20987. *
  20988. * var users = {
  20989. * 'barney': { 'age': 36, 'active': true },
  20990. * 'fred': { 'age': 40, 'active': false },
  20991. * 'pebbles': { 'age': 1, 'active': true }
  20992. * };
  20993. *
  20994. * _.findKey(users, function(o) { return o.age < 40; });
  20995. * // => 'barney' (iteration order is not guaranteed)
  20996. *
  20997. * // The `_.matches` iteratee shorthand.
  20998. * _.findKey(users, { 'age': 1, 'active': true });
  20999. * // => 'pebbles'
  21000. *
  21001. * // The `_.matchesProperty` iteratee shorthand.
  21002. * _.findKey(users, ['active', false]);
  21003. * // => 'fred'
  21004. *
  21005. * // The `_.property` iteratee shorthand.
  21006. * _.findKey(users, 'active');
  21007. * // => 'barney'
  21008. */
  21009. function findKey(object, predicate) {
  21010. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  21011. }
  21012. /**
  21013. * This method is like `_.findKey` except that it iterates over elements of
  21014. * a collection in the opposite order.
  21015. *
  21016. * @static
  21017. * @memberOf _
  21018. * @since 2.0.0
  21019. * @category Object
  21020. * @param {Object} object The object to inspect.
  21021. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21022. * @returns {string|undefined} Returns the key of the matched element,
  21023. * else `undefined`.
  21024. * @example
  21025. *
  21026. * var users = {
  21027. * 'barney': { 'age': 36, 'active': true },
  21028. * 'fred': { 'age': 40, 'active': false },
  21029. * 'pebbles': { 'age': 1, 'active': true }
  21030. * };
  21031. *
  21032. * _.findLastKey(users, function(o) { return o.age < 40; });
  21033. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  21034. *
  21035. * // The `_.matches` iteratee shorthand.
  21036. * _.findLastKey(users, { 'age': 36, 'active': true });
  21037. * // => 'barney'
  21038. *
  21039. * // The `_.matchesProperty` iteratee shorthand.
  21040. * _.findLastKey(users, ['active', false]);
  21041. * // => 'fred'
  21042. *
  21043. * // The `_.property` iteratee shorthand.
  21044. * _.findLastKey(users, 'active');
  21045. * // => 'pebbles'
  21046. */
  21047. function findLastKey(object, predicate) {
  21048. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  21049. }
  21050. /**
  21051. * Iterates over own and inherited enumerable string keyed properties of an
  21052. * object and invokes `iteratee` for each property. The iteratee is invoked
  21053. * with three arguments: (value, key, object). Iteratee functions may exit
  21054. * iteration early by explicitly returning `false`.
  21055. *
  21056. * @static
  21057. * @memberOf _
  21058. * @since 0.3.0
  21059. * @category Object
  21060. * @param {Object} object The object to iterate over.
  21061. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21062. * @returns {Object} Returns `object`.
  21063. * @see _.forInRight
  21064. * @example
  21065. *
  21066. * function Foo() {
  21067. * this.a = 1;
  21068. * this.b = 2;
  21069. * }
  21070. *
  21071. * Foo.prototype.c = 3;
  21072. *
  21073. * _.forIn(new Foo, function(value, key) {
  21074. * console.log(key);
  21075. * });
  21076. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  21077. */
  21078. function forIn(object, iteratee) {
  21079. return object == null
  21080. ? object
  21081. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  21082. }
  21083. /**
  21084. * This method is like `_.forIn` except that it iterates over properties of
  21085. * `object` in the opposite order.
  21086. *
  21087. * @static
  21088. * @memberOf _
  21089. * @since 2.0.0
  21090. * @category Object
  21091. * @param {Object} object The object to iterate over.
  21092. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21093. * @returns {Object} Returns `object`.
  21094. * @see _.forIn
  21095. * @example
  21096. *
  21097. * function Foo() {
  21098. * this.a = 1;
  21099. * this.b = 2;
  21100. * }
  21101. *
  21102. * Foo.prototype.c = 3;
  21103. *
  21104. * _.forInRight(new Foo, function(value, key) {
  21105. * console.log(key);
  21106. * });
  21107. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  21108. */
  21109. function forInRight(object, iteratee) {
  21110. return object == null
  21111. ? object
  21112. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  21113. }
  21114. /**
  21115. * Iterates over own enumerable string keyed properties of an object and
  21116. * invokes `iteratee` for each property. The iteratee is invoked with three
  21117. * arguments: (value, key, object). Iteratee functions may exit iteration
  21118. * early by explicitly returning `false`.
  21119. *
  21120. * @static
  21121. * @memberOf _
  21122. * @since 0.3.0
  21123. * @category Object
  21124. * @param {Object} object The object to iterate over.
  21125. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21126. * @returns {Object} Returns `object`.
  21127. * @see _.forOwnRight
  21128. * @example
  21129. *
  21130. * function Foo() {
  21131. * this.a = 1;
  21132. * this.b = 2;
  21133. * }
  21134. *
  21135. * Foo.prototype.c = 3;
  21136. *
  21137. * _.forOwn(new Foo, function(value, key) {
  21138. * console.log(key);
  21139. * });
  21140. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  21141. */
  21142. function forOwn(object, iteratee) {
  21143. return object && baseForOwn(object, getIteratee(iteratee, 3));
  21144. }
  21145. /**
  21146. * This method is like `_.forOwn` except that it iterates over properties of
  21147. * `object` in the opposite order.
  21148. *
  21149. * @static
  21150. * @memberOf _
  21151. * @since 2.0.0
  21152. * @category Object
  21153. * @param {Object} object The object to iterate over.
  21154. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21155. * @returns {Object} Returns `object`.
  21156. * @see _.forOwn
  21157. * @example
  21158. *
  21159. * function Foo() {
  21160. * this.a = 1;
  21161. * this.b = 2;
  21162. * }
  21163. *
  21164. * Foo.prototype.c = 3;
  21165. *
  21166. * _.forOwnRight(new Foo, function(value, key) {
  21167. * console.log(key);
  21168. * });
  21169. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  21170. */
  21171. function forOwnRight(object, iteratee) {
  21172. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  21173. }
  21174. /**
  21175. * Creates an array of function property names from own enumerable properties
  21176. * of `object`.
  21177. *
  21178. * @static
  21179. * @since 0.1.0
  21180. * @memberOf _
  21181. * @category Object
  21182. * @param {Object} object The object to inspect.
  21183. * @returns {Array} Returns the function names.
  21184. * @see _.functionsIn
  21185. * @example
  21186. *
  21187. * function Foo() {
  21188. * this.a = _.constant('a');
  21189. * this.b = _.constant('b');
  21190. * }
  21191. *
  21192. * Foo.prototype.c = _.constant('c');
  21193. *
  21194. * _.functions(new Foo);
  21195. * // => ['a', 'b']
  21196. */
  21197. function functions(object) {
  21198. return object == null ? [] : baseFunctions(object, keys(object));
  21199. }
  21200. /**
  21201. * Creates an array of function property names from own and inherited
  21202. * enumerable properties of `object`.
  21203. *
  21204. * @static
  21205. * @memberOf _
  21206. * @since 4.0.0
  21207. * @category Object
  21208. * @param {Object} object The object to inspect.
  21209. * @returns {Array} Returns the function names.
  21210. * @see _.functions
  21211. * @example
  21212. *
  21213. * function Foo() {
  21214. * this.a = _.constant('a');
  21215. * this.b = _.constant('b');
  21216. * }
  21217. *
  21218. * Foo.prototype.c = _.constant('c');
  21219. *
  21220. * _.functionsIn(new Foo);
  21221. * // => ['a', 'b', 'c']
  21222. */
  21223. function functionsIn(object) {
  21224. return object == null ? [] : baseFunctions(object, keysIn(object));
  21225. }
  21226. /**
  21227. * Gets the value at `path` of `object`. If the resolved value is
  21228. * `undefined`, the `defaultValue` is returned in its place.
  21229. *
  21230. * @static
  21231. * @memberOf _
  21232. * @since 3.7.0
  21233. * @category Object
  21234. * @param {Object} object The object to query.
  21235. * @param {Array|string} path The path of the property to get.
  21236. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  21237. * @returns {*} Returns the resolved value.
  21238. * @example
  21239. *
  21240. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  21241. *
  21242. * _.get(object, 'a[0].b.c');
  21243. * // => 3
  21244. *
  21245. * _.get(object, ['a', '0', 'b', 'c']);
  21246. * // => 3
  21247. *
  21248. * _.get(object, 'a.b.c', 'default');
  21249. * // => 'default'
  21250. */
  21251. function get(object, path, defaultValue) {
  21252. var result = object == null ? undefined : baseGet(object, path);
  21253. return result === undefined ? defaultValue : result;
  21254. }
  21255. /**
  21256. * Checks if `path` is a direct property of `object`.
  21257. *
  21258. * @static
  21259. * @since 0.1.0
  21260. * @memberOf _
  21261. * @category Object
  21262. * @param {Object} object The object to query.
  21263. * @param {Array|string} path The path to check.
  21264. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  21265. * @example
  21266. *
  21267. * var object = { 'a': { 'b': 2 } };
  21268. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  21269. *
  21270. * _.has(object, 'a');
  21271. * // => true
  21272. *
  21273. * _.has(object, 'a.b');
  21274. * // => true
  21275. *
  21276. * _.has(object, ['a', 'b']);
  21277. * // => true
  21278. *
  21279. * _.has(other, 'a');
  21280. * // => false
  21281. */
  21282. function has(object, path) {
  21283. return object != null && hasPath(object, path, baseHas);
  21284. }
  21285. /**
  21286. * Checks if `path` is a direct or inherited property of `object`.
  21287. *
  21288. * @static
  21289. * @memberOf _
  21290. * @since 4.0.0
  21291. * @category Object
  21292. * @param {Object} object The object to query.
  21293. * @param {Array|string} path The path to check.
  21294. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  21295. * @example
  21296. *
  21297. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  21298. *
  21299. * _.hasIn(object, 'a');
  21300. * // => true
  21301. *
  21302. * _.hasIn(object, 'a.b');
  21303. * // => true
  21304. *
  21305. * _.hasIn(object, ['a', 'b']);
  21306. * // => true
  21307. *
  21308. * _.hasIn(object, 'b');
  21309. * // => false
  21310. */
  21311. function hasIn(object, path) {
  21312. return object != null && hasPath(object, path, baseHasIn);
  21313. }
  21314. /**
  21315. * Creates an object composed of the inverted keys and values of `object`.
  21316. * If `object` contains duplicate values, subsequent values overwrite
  21317. * property assignments of previous values.
  21318. *
  21319. * @static
  21320. * @memberOf _
  21321. * @since 0.7.0
  21322. * @category Object
  21323. * @param {Object} object The object to invert.
  21324. * @returns {Object} Returns the new inverted object.
  21325. * @example
  21326. *
  21327. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  21328. *
  21329. * _.invert(object);
  21330. * // => { '1': 'c', '2': 'b' }
  21331. */
  21332. var invert = createInverter(function(result, value, key) {
  21333. result[value] = key;
  21334. }, constant(identity));
  21335. /**
  21336. * This method is like `_.invert` except that the inverted object is generated
  21337. * from the results of running each element of `object` thru `iteratee`. The
  21338. * corresponding inverted value of each inverted key is an array of keys
  21339. * responsible for generating the inverted value. The iteratee is invoked
  21340. * with one argument: (value).
  21341. *
  21342. * @static
  21343. * @memberOf _
  21344. * @since 4.1.0
  21345. * @category Object
  21346. * @param {Object} object The object to invert.
  21347. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21348. * @returns {Object} Returns the new inverted object.
  21349. * @example
  21350. *
  21351. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  21352. *
  21353. * _.invertBy(object);
  21354. * // => { '1': ['a', 'c'], '2': ['b'] }
  21355. *
  21356. * _.invertBy(object, function(value) {
  21357. * return 'group' + value;
  21358. * });
  21359. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  21360. */
  21361. var invertBy = createInverter(function(result, value, key) {
  21362. if (hasOwnProperty.call(result, value)) {
  21363. result[value].push(key);
  21364. } else {
  21365. result[value] = [key];
  21366. }
  21367. }, getIteratee);
  21368. /**
  21369. * Invokes the method at `path` of `object`.
  21370. *
  21371. * @static
  21372. * @memberOf _
  21373. * @since 4.0.0
  21374. * @category Object
  21375. * @param {Object} object The object to query.
  21376. * @param {Array|string} path The path of the method to invoke.
  21377. * @param {...*} [args] The arguments to invoke the method with.
  21378. * @returns {*} Returns the result of the invoked method.
  21379. * @example
  21380. *
  21381. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  21382. *
  21383. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  21384. * // => [2, 3]
  21385. */
  21386. var invoke = baseRest(baseInvoke);
  21387. /**
  21388. * Creates an array of the own enumerable property names of `object`.
  21389. *
  21390. * **Note:** Non-object values are coerced to objects. See the
  21391. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  21392. * for more details.
  21393. *
  21394. * @static
  21395. * @since 0.1.0
  21396. * @memberOf _
  21397. * @category Object
  21398. * @param {Object} object The object to query.
  21399. * @returns {Array} Returns the array of property names.
  21400. * @example
  21401. *
  21402. * function Foo() {
  21403. * this.a = 1;
  21404. * this.b = 2;
  21405. * }
  21406. *
  21407. * Foo.prototype.c = 3;
  21408. *
  21409. * _.keys(new Foo);
  21410. * // => ['a', 'b'] (iteration order is not guaranteed)
  21411. *
  21412. * _.keys('hi');
  21413. * // => ['0', '1']
  21414. */
  21415. function keys(object) {
  21416. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  21417. }
  21418. /**
  21419. * Creates an array of the own and inherited enumerable property names of `object`.
  21420. *
  21421. * **Note:** Non-object values are coerced to objects.
  21422. *
  21423. * @static
  21424. * @memberOf _
  21425. * @since 3.0.0
  21426. * @category Object
  21427. * @param {Object} object The object to query.
  21428. * @returns {Array} Returns the array of property names.
  21429. * @example
  21430. *
  21431. * function Foo() {
  21432. * this.a = 1;
  21433. * this.b = 2;
  21434. * }
  21435. *
  21436. * Foo.prototype.c = 3;
  21437. *
  21438. * _.keysIn(new Foo);
  21439. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  21440. */
  21441. function keysIn(object) {
  21442. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  21443. }
  21444. /**
  21445. * The opposite of `_.mapValues`; this method creates an object with the
  21446. * same values as `object` and keys generated by running each own enumerable
  21447. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  21448. * with three arguments: (value, key, object).
  21449. *
  21450. * @static
  21451. * @memberOf _
  21452. * @since 3.8.0
  21453. * @category Object
  21454. * @param {Object} object The object to iterate over.
  21455. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21456. * @returns {Object} Returns the new mapped object.
  21457. * @see _.mapValues
  21458. * @example
  21459. *
  21460. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  21461. * return key + value;
  21462. * });
  21463. * // => { 'a1': 1, 'b2': 2 }
  21464. */
  21465. function mapKeys(object, iteratee) {
  21466. var result = {};
  21467. iteratee = getIteratee(iteratee, 3);
  21468. baseForOwn(object, function(value, key, object) {
  21469. baseAssignValue(result, iteratee(value, key, object), value);
  21470. });
  21471. return result;
  21472. }
  21473. /**
  21474. * Creates an object with the same keys as `object` and values generated
  21475. * by running each own enumerable string keyed property of `object` thru
  21476. * `iteratee`. The iteratee is invoked with three arguments:
  21477. * (value, key, object).
  21478. *
  21479. * @static
  21480. * @memberOf _
  21481. * @since 2.4.0
  21482. * @category Object
  21483. * @param {Object} object The object to iterate over.
  21484. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21485. * @returns {Object} Returns the new mapped object.
  21486. * @see _.mapKeys
  21487. * @example
  21488. *
  21489. * var users = {
  21490. * 'fred': { 'user': 'fred', 'age': 40 },
  21491. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  21492. * };
  21493. *
  21494. * _.mapValues(users, function(o) { return o.age; });
  21495. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  21496. *
  21497. * // The `_.property` iteratee shorthand.
  21498. * _.mapValues(users, 'age');
  21499. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  21500. */
  21501. function mapValues(object, iteratee) {
  21502. var result = {};
  21503. iteratee = getIteratee(iteratee, 3);
  21504. baseForOwn(object, function(value, key, object) {
  21505. baseAssignValue(result, key, iteratee(value, key, object));
  21506. });
  21507. return result;
  21508. }
  21509. /**
  21510. * This method is like `_.assign` except that it recursively merges own and
  21511. * inherited enumerable string keyed properties of source objects into the
  21512. * destination object. Source properties that resolve to `undefined` are
  21513. * skipped if a destination value exists. Array and plain object properties
  21514. * are merged recursively. Other objects and value types are overridden by
  21515. * assignment. Source objects are applied from left to right. Subsequent
  21516. * sources overwrite property assignments of previous sources.
  21517. *
  21518. * **Note:** This method mutates `object`.
  21519. *
  21520. * @static
  21521. * @memberOf _
  21522. * @since 0.5.0
  21523. * @category Object
  21524. * @param {Object} object The destination object.
  21525. * @param {...Object} [sources] The source objects.
  21526. * @returns {Object} Returns `object`.
  21527. * @example
  21528. *
  21529. * var object = {
  21530. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  21531. * };
  21532. *
  21533. * var other = {
  21534. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  21535. * };
  21536. *
  21537. * _.merge(object, other);
  21538. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  21539. */
  21540. var merge = createAssigner(function(object, source, srcIndex) {
  21541. baseMerge(object, source, srcIndex);
  21542. });
  21543. /**
  21544. * This method is like `_.merge` except that it accepts `customizer` which
  21545. * is invoked to produce the merged values of the destination and source
  21546. * properties. If `customizer` returns `undefined`, merging is handled by the
  21547. * method instead. The `customizer` is invoked with six arguments:
  21548. * (objValue, srcValue, key, object, source, stack).
  21549. *
  21550. * **Note:** This method mutates `object`.
  21551. *
  21552. * @static
  21553. * @memberOf _
  21554. * @since 4.0.0
  21555. * @category Object
  21556. * @param {Object} object The destination object.
  21557. * @param {...Object} sources The source objects.
  21558. * @param {Function} customizer The function to customize assigned values.
  21559. * @returns {Object} Returns `object`.
  21560. * @example
  21561. *
  21562. * function customizer(objValue, srcValue) {
  21563. * if (_.isArray(objValue)) {
  21564. * return objValue.concat(srcValue);
  21565. * }
  21566. * }
  21567. *
  21568. * var object = { 'a': [1], 'b': [2] };
  21569. * var other = { 'a': [3], 'b': [4] };
  21570. *
  21571. * _.mergeWith(object, other, customizer);
  21572. * // => { 'a': [1, 3], 'b': [2, 4] }
  21573. */
  21574. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  21575. baseMerge(object, source, srcIndex, customizer);
  21576. });
  21577. /**
  21578. * The opposite of `_.pick`; this method creates an object composed of the
  21579. * own and inherited enumerable property paths of `object` that are not omitted.
  21580. *
  21581. * **Note:** This method is considerably slower than `_.pick`.
  21582. *
  21583. * @static
  21584. * @since 0.1.0
  21585. * @memberOf _
  21586. * @category Object
  21587. * @param {Object} object The source object.
  21588. * @param {...(string|string[])} [paths] The property paths to omit.
  21589. * @returns {Object} Returns the new object.
  21590. * @example
  21591. *
  21592. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  21593. *
  21594. * _.omit(object, ['a', 'c']);
  21595. * // => { 'b': '2' }
  21596. */
  21597. var omit = flatRest(function(object, paths) {
  21598. var result = {};
  21599. if (object == null) {
  21600. return result;
  21601. }
  21602. var isDeep = false;
  21603. paths = arrayMap(paths, function(path) {
  21604. path = castPath(path, object);
  21605. isDeep || (isDeep = path.length > 1);
  21606. return path;
  21607. });
  21608. copyObject(object, getAllKeysIn(object), result);
  21609. if (isDeep) {
  21610. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  21611. }
  21612. var length = paths.length;
  21613. while (length--) {
  21614. baseUnset(result, paths[length]);
  21615. }
  21616. return result;
  21617. });
  21618. /**
  21619. * The opposite of `_.pickBy`; this method creates an object composed of
  21620. * the own and inherited enumerable string keyed properties of `object` that
  21621. * `predicate` doesn't return truthy for. The predicate is invoked with two
  21622. * arguments: (value, key).
  21623. *
  21624. * @static
  21625. * @memberOf _
  21626. * @since 4.0.0
  21627. * @category Object
  21628. * @param {Object} object The source object.
  21629. * @param {Function} [predicate=_.identity] The function invoked per property.
  21630. * @returns {Object} Returns the new object.
  21631. * @example
  21632. *
  21633. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  21634. *
  21635. * _.omitBy(object, _.isNumber);
  21636. * // => { 'b': '2' }
  21637. */
  21638. function omitBy(object, predicate) {
  21639. return pickBy(object, negate(getIteratee(predicate)));
  21640. }
  21641. /**
  21642. * Creates an object composed of the picked `object` properties.
  21643. *
  21644. * @static
  21645. * @since 0.1.0
  21646. * @memberOf _
  21647. * @category Object
  21648. * @param {Object} object The source object.
  21649. * @param {...(string|string[])} [paths] The property paths to pick.
  21650. * @returns {Object} Returns the new object.
  21651. * @example
  21652. *
  21653. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  21654. *
  21655. * _.pick(object, ['a', 'c']);
  21656. * // => { 'a': 1, 'c': 3 }
  21657. */
  21658. var pick = flatRest(function(object, paths) {
  21659. return object == null ? {} : basePick(object, paths);
  21660. });
  21661. /**
  21662. * Creates an object composed of the `object` properties `predicate` returns
  21663. * truthy for. The predicate is invoked with two arguments: (value, key).
  21664. *
  21665. * @static
  21666. * @memberOf _
  21667. * @since 4.0.0
  21668. * @category Object
  21669. * @param {Object} object The source object.
  21670. * @param {Function} [predicate=_.identity] The function invoked per property.
  21671. * @returns {Object} Returns the new object.
  21672. * @example
  21673. *
  21674. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  21675. *
  21676. * _.pickBy(object, _.isNumber);
  21677. * // => { 'a': 1, 'c': 3 }
  21678. */
  21679. function pickBy(object, predicate) {
  21680. if (object == null) {
  21681. return {};
  21682. }
  21683. var props = arrayMap(getAllKeysIn(object), function(prop) {
  21684. return [prop];
  21685. });
  21686. predicate = getIteratee(predicate);
  21687. return basePickBy(object, props, function(value, path) {
  21688. return predicate(value, path[0]);
  21689. });
  21690. }
  21691. /**
  21692. * This method is like `_.get` except that if the resolved value is a
  21693. * function it's invoked with the `this` binding of its parent object and
  21694. * its result is returned.
  21695. *
  21696. * @static
  21697. * @since 0.1.0
  21698. * @memberOf _
  21699. * @category Object
  21700. * @param {Object} object The object to query.
  21701. * @param {Array|string} path The path of the property to resolve.
  21702. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  21703. * @returns {*} Returns the resolved value.
  21704. * @example
  21705. *
  21706. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  21707. *
  21708. * _.result(object, 'a[0].b.c1');
  21709. * // => 3
  21710. *
  21711. * _.result(object, 'a[0].b.c2');
  21712. * // => 4
  21713. *
  21714. * _.result(object, 'a[0].b.c3', 'default');
  21715. * // => 'default'
  21716. *
  21717. * _.result(object, 'a[0].b.c3', _.constant('default'));
  21718. * // => 'default'
  21719. */
  21720. function result(object, path, defaultValue) {
  21721. path = castPath(path, object);
  21722. var index = -1,
  21723. length = path.length;
  21724. // Ensure the loop is entered when path is empty.
  21725. if (!length) {
  21726. length = 1;
  21727. object = undefined;
  21728. }
  21729. while (++index < length) {
  21730. var value = object == null ? undefined : object[toKey(path[index])];
  21731. if (value === undefined) {
  21732. index = length;
  21733. value = defaultValue;
  21734. }
  21735. object = isFunction(value) ? value.call(object) : value;
  21736. }
  21737. return object;
  21738. }
  21739. /**
  21740. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  21741. * it's created. Arrays are created for missing index properties while objects
  21742. * are created for all other missing properties. Use `_.setWith` to customize
  21743. * `path` creation.
  21744. *
  21745. * **Note:** This method mutates `object`.
  21746. *
  21747. * @static
  21748. * @memberOf _
  21749. * @since 3.7.0
  21750. * @category Object
  21751. * @param {Object} object The object to modify.
  21752. * @param {Array|string} path The path of the property to set.
  21753. * @param {*} value The value to set.
  21754. * @returns {Object} Returns `object`.
  21755. * @example
  21756. *
  21757. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  21758. *
  21759. * _.set(object, 'a[0].b.c', 4);
  21760. * console.log(object.a[0].b.c);
  21761. * // => 4
  21762. *
  21763. * _.set(object, ['x', '0', 'y', 'z'], 5);
  21764. * console.log(object.x[0].y.z);
  21765. * // => 5
  21766. */
  21767. function set(object, path, value) {
  21768. return object == null ? object : baseSet(object, path, value);
  21769. }
  21770. /**
  21771. * This method is like `_.set` except that it accepts `customizer` which is
  21772. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  21773. * path creation is handled by the method instead. The `customizer` is invoked
  21774. * with three arguments: (nsValue, key, nsObject).
  21775. *
  21776. * **Note:** This method mutates `object`.
  21777. *
  21778. * @static
  21779. * @memberOf _
  21780. * @since 4.0.0
  21781. * @category Object
  21782. * @param {Object} object The object to modify.
  21783. * @param {Array|string} path The path of the property to set.
  21784. * @param {*} value The value to set.
  21785. * @param {Function} [customizer] The function to customize assigned values.
  21786. * @returns {Object} Returns `object`.
  21787. * @example
  21788. *
  21789. * var object = {};
  21790. *
  21791. * _.setWith(object, '[0][1]', 'a', Object);
  21792. * // => { '0': { '1': 'a' } }
  21793. */
  21794. function setWith(object, path, value, customizer) {
  21795. customizer = typeof customizer == 'function' ? customizer : undefined;
  21796. return object == null ? object : baseSet(object, path, value, customizer);
  21797. }
  21798. /**
  21799. * Creates an array of own enumerable string keyed-value pairs for `object`
  21800. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  21801. * entries are returned.
  21802. *
  21803. * @static
  21804. * @memberOf _
  21805. * @since 4.0.0
  21806. * @alias entries
  21807. * @category Object
  21808. * @param {Object} object The object to query.
  21809. * @returns {Array} Returns the key-value pairs.
  21810. * @example
  21811. *
  21812. * function Foo() {
  21813. * this.a = 1;
  21814. * this.b = 2;
  21815. * }
  21816. *
  21817. * Foo.prototype.c = 3;
  21818. *
  21819. * _.toPairs(new Foo);
  21820. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  21821. */
  21822. var toPairs = createToPairs(keys);
  21823. /**
  21824. * Creates an array of own and inherited enumerable string keyed-value pairs
  21825. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  21826. * or set, its entries are returned.
  21827. *
  21828. * @static
  21829. * @memberOf _
  21830. * @since 4.0.0
  21831. * @alias entriesIn
  21832. * @category Object
  21833. * @param {Object} object The object to query.
  21834. * @returns {Array} Returns the key-value pairs.
  21835. * @example
  21836. *
  21837. * function Foo() {
  21838. * this.a = 1;
  21839. * this.b = 2;
  21840. * }
  21841. *
  21842. * Foo.prototype.c = 3;
  21843. *
  21844. * _.toPairsIn(new Foo);
  21845. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  21846. */
  21847. var toPairsIn = createToPairs(keysIn);
  21848. /**
  21849. * An alternative to `_.reduce`; this method transforms `object` to a new
  21850. * `accumulator` object which is the result of running each of its own
  21851. * enumerable string keyed properties thru `iteratee`, with each invocation
  21852. * potentially mutating the `accumulator` object. If `accumulator` is not
  21853. * provided, a new object with the same `[[Prototype]]` will be used. The
  21854. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  21855. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21856. *
  21857. * @static
  21858. * @memberOf _
  21859. * @since 1.3.0
  21860. * @category Object
  21861. * @param {Object} object The object to iterate over.
  21862. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21863. * @param {*} [accumulator] The custom accumulator value.
  21864. * @returns {*} Returns the accumulated value.
  21865. * @example
  21866. *
  21867. * _.transform([2, 3, 4], function(result, n) {
  21868. * result.push(n *= n);
  21869. * return n % 2 == 0;
  21870. * }, []);
  21871. * // => [4, 9]
  21872. *
  21873. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  21874. * (result[value] || (result[value] = [])).push(key);
  21875. * }, {});
  21876. * // => { '1': ['a', 'c'], '2': ['b'] }
  21877. */
  21878. function transform(object, iteratee, accumulator) {
  21879. var isArr = isArray(object),
  21880. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  21881. iteratee = getIteratee(iteratee, 4);
  21882. if (accumulator == null) {
  21883. var Ctor = object && object.constructor;
  21884. if (isArrLike) {
  21885. accumulator = isArr ? new Ctor : [];
  21886. }
  21887. else if (isObject(object)) {
  21888. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  21889. }
  21890. else {
  21891. accumulator = {};
  21892. }
  21893. }
  21894. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  21895. return iteratee(accumulator, value, index, object);
  21896. });
  21897. return accumulator;
  21898. }
  21899. /**
  21900. * Removes the property at `path` of `object`.
  21901. *
  21902. * **Note:** This method mutates `object`.
  21903. *
  21904. * @static
  21905. * @memberOf _
  21906. * @since 4.0.0
  21907. * @category Object
  21908. * @param {Object} object The object to modify.
  21909. * @param {Array|string} path The path of the property to unset.
  21910. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21911. * @example
  21912. *
  21913. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  21914. * _.unset(object, 'a[0].b.c');
  21915. * // => true
  21916. *
  21917. * console.log(object);
  21918. * // => { 'a': [{ 'b': {} }] };
  21919. *
  21920. * _.unset(object, ['a', '0', 'b', 'c']);
  21921. * // => true
  21922. *
  21923. * console.log(object);
  21924. * // => { 'a': [{ 'b': {} }] };
  21925. */
  21926. function unset(object, path) {
  21927. return object == null ? true : baseUnset(object, path);
  21928. }
  21929. /**
  21930. * This method is like `_.set` except that accepts `updater` to produce the
  21931. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  21932. * is invoked with one argument: (value).
  21933. *
  21934. * **Note:** This method mutates `object`.
  21935. *
  21936. * @static
  21937. * @memberOf _
  21938. * @since 4.6.0
  21939. * @category Object
  21940. * @param {Object} object The object to modify.
  21941. * @param {Array|string} path The path of the property to set.
  21942. * @param {Function} updater The function to produce the updated value.
  21943. * @returns {Object} Returns `object`.
  21944. * @example
  21945. *
  21946. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  21947. *
  21948. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  21949. * console.log(object.a[0].b.c);
  21950. * // => 9
  21951. *
  21952. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  21953. * console.log(object.x[0].y.z);
  21954. * // => 0
  21955. */
  21956. function update(object, path, updater) {
  21957. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  21958. }
  21959. /**
  21960. * This method is like `_.update` except that it accepts `customizer` which is
  21961. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  21962. * path creation is handled by the method instead. The `customizer` is invoked
  21963. * with three arguments: (nsValue, key, nsObject).
  21964. *
  21965. * **Note:** This method mutates `object`.
  21966. *
  21967. * @static
  21968. * @memberOf _
  21969. * @since 4.6.0
  21970. * @category Object
  21971. * @param {Object} object The object to modify.
  21972. * @param {Array|string} path The path of the property to set.
  21973. * @param {Function} updater The function to produce the updated value.
  21974. * @param {Function} [customizer] The function to customize assigned values.
  21975. * @returns {Object} Returns `object`.
  21976. * @example
  21977. *
  21978. * var object = {};
  21979. *
  21980. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  21981. * // => { '0': { '1': 'a' } }
  21982. */
  21983. function updateWith(object, path, updater, customizer) {
  21984. customizer = typeof customizer == 'function' ? customizer : undefined;
  21985. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  21986. }
  21987. /**
  21988. * Creates an array of the own enumerable string keyed property values of `object`.
  21989. *
  21990. * **Note:** Non-object values are coerced to objects.
  21991. *
  21992. * @static
  21993. * @since 0.1.0
  21994. * @memberOf _
  21995. * @category Object
  21996. * @param {Object} object The object to query.
  21997. * @returns {Array} Returns the array of property values.
  21998. * @example
  21999. *
  22000. * function Foo() {
  22001. * this.a = 1;
  22002. * this.b = 2;
  22003. * }
  22004. *
  22005. * Foo.prototype.c = 3;
  22006. *
  22007. * _.values(new Foo);
  22008. * // => [1, 2] (iteration order is not guaranteed)
  22009. *
  22010. * _.values('hi');
  22011. * // => ['h', 'i']
  22012. */
  22013. function values(object) {
  22014. return object == null ? [] : baseValues(object, keys(object));
  22015. }
  22016. /**
  22017. * Creates an array of the own and inherited enumerable string keyed property
  22018. * values of `object`.
  22019. *
  22020. * **Note:** Non-object values are coerced to objects.
  22021. *
  22022. * @static
  22023. * @memberOf _
  22024. * @since 3.0.0
  22025. * @category Object
  22026. * @param {Object} object The object to query.
  22027. * @returns {Array} Returns the array of property values.
  22028. * @example
  22029. *
  22030. * function Foo() {
  22031. * this.a = 1;
  22032. * this.b = 2;
  22033. * }
  22034. *
  22035. * Foo.prototype.c = 3;
  22036. *
  22037. * _.valuesIn(new Foo);
  22038. * // => [1, 2, 3] (iteration order is not guaranteed)
  22039. */
  22040. function valuesIn(object) {
  22041. return object == null ? [] : baseValues(object, keysIn(object));
  22042. }
  22043. /*------------------------------------------------------------------------*/
  22044. /**
  22045. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  22046. *
  22047. * @static
  22048. * @memberOf _
  22049. * @since 4.0.0
  22050. * @category Number
  22051. * @param {number} number The number to clamp.
  22052. * @param {number} [lower] The lower bound.
  22053. * @param {number} upper The upper bound.
  22054. * @returns {number} Returns the clamped number.
  22055. * @example
  22056. *
  22057. * _.clamp(-10, -5, 5);
  22058. * // => -5
  22059. *
  22060. * _.clamp(10, -5, 5);
  22061. * // => 5
  22062. */
  22063. function clamp(number, lower, upper) {
  22064. if (upper === undefined) {
  22065. upper = lower;
  22066. lower = undefined;
  22067. }
  22068. if (upper !== undefined) {
  22069. upper = toNumber(upper);
  22070. upper = upper === upper ? upper : 0;
  22071. }
  22072. if (lower !== undefined) {
  22073. lower = toNumber(lower);
  22074. lower = lower === lower ? lower : 0;
  22075. }
  22076. return baseClamp(toNumber(number), lower, upper);
  22077. }
  22078. /**
  22079. * Checks if `n` is between `start` and up to, but not including, `end`. If
  22080. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  22081. * If `start` is greater than `end` the params are swapped to support
  22082. * negative ranges.
  22083. *
  22084. * @static
  22085. * @memberOf _
  22086. * @since 3.3.0
  22087. * @category Number
  22088. * @param {number} number The number to check.
  22089. * @param {number} [start=0] The start of the range.
  22090. * @param {number} end The end of the range.
  22091. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  22092. * @see _.range, _.rangeRight
  22093. * @example
  22094. *
  22095. * _.inRange(3, 2, 4);
  22096. * // => true
  22097. *
  22098. * _.inRange(4, 8);
  22099. * // => true
  22100. *
  22101. * _.inRange(4, 2);
  22102. * // => false
  22103. *
  22104. * _.inRange(2, 2);
  22105. * // => false
  22106. *
  22107. * _.inRange(1.2, 2);
  22108. * // => true
  22109. *
  22110. * _.inRange(5.2, 4);
  22111. * // => false
  22112. *
  22113. * _.inRange(-3, -2, -6);
  22114. * // => true
  22115. */
  22116. function inRange(number, start, end) {
  22117. start = toFinite(start);
  22118. if (end === undefined) {
  22119. end = start;
  22120. start = 0;
  22121. } else {
  22122. end = toFinite(end);
  22123. }
  22124. number = toNumber(number);
  22125. return baseInRange(number, start, end);
  22126. }
  22127. /**
  22128. * Produces a random number between the inclusive `lower` and `upper` bounds.
  22129. * If only one argument is provided a number between `0` and the given number
  22130. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  22131. * floats, a floating-point number is returned instead of an integer.
  22132. *
  22133. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  22134. * floating-point values which can produce unexpected results.
  22135. *
  22136. * @static
  22137. * @memberOf _
  22138. * @since 0.7.0
  22139. * @category Number
  22140. * @param {number} [lower=0] The lower bound.
  22141. * @param {number} [upper=1] The upper bound.
  22142. * @param {boolean} [floating] Specify returning a floating-point number.
  22143. * @returns {number} Returns the random number.
  22144. * @example
  22145. *
  22146. * _.random(0, 5);
  22147. * // => an integer between 0 and 5
  22148. *
  22149. * _.random(5);
  22150. * // => also an integer between 0 and 5
  22151. *
  22152. * _.random(5, true);
  22153. * // => a floating-point number between 0 and 5
  22154. *
  22155. * _.random(1.2, 5.2);
  22156. * // => a floating-point number between 1.2 and 5.2
  22157. */
  22158. function random(lower, upper, floating) {
  22159. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  22160. upper = floating = undefined;
  22161. }
  22162. if (floating === undefined) {
  22163. if (typeof upper == 'boolean') {
  22164. floating = upper;
  22165. upper = undefined;
  22166. }
  22167. else if (typeof lower == 'boolean') {
  22168. floating = lower;
  22169. lower = undefined;
  22170. }
  22171. }
  22172. if (lower === undefined && upper === undefined) {
  22173. lower = 0;
  22174. upper = 1;
  22175. }
  22176. else {
  22177. lower = toFinite(lower);
  22178. if (upper === undefined) {
  22179. upper = lower;
  22180. lower = 0;
  22181. } else {
  22182. upper = toFinite(upper);
  22183. }
  22184. }
  22185. if (lower > upper) {
  22186. var temp = lower;
  22187. lower = upper;
  22188. upper = temp;
  22189. }
  22190. if (floating || lower % 1 || upper % 1) {
  22191. var rand = nativeRandom();
  22192. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  22193. }
  22194. return baseRandom(lower, upper);
  22195. }
  22196. /*------------------------------------------------------------------------*/
  22197. /**
  22198. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  22199. *
  22200. * @static
  22201. * @memberOf _
  22202. * @since 3.0.0
  22203. * @category String
  22204. * @param {string} [string=''] The string to convert.
  22205. * @returns {string} Returns the camel cased string.
  22206. * @example
  22207. *
  22208. * _.camelCase('Foo Bar');
  22209. * // => 'fooBar'
  22210. *
  22211. * _.camelCase('--foo-bar--');
  22212. * // => 'fooBar'
  22213. *
  22214. * _.camelCase('__FOO_BAR__');
  22215. * // => 'fooBar'
  22216. */
  22217. var camelCase = createCompounder(function(result, word, index) {
  22218. word = word.toLowerCase();
  22219. return result + (index ? capitalize(word) : word);
  22220. });
  22221. /**
  22222. * Converts the first character of `string` to upper case and the remaining
  22223. * to lower case.
  22224. *
  22225. * @static
  22226. * @memberOf _
  22227. * @since 3.0.0
  22228. * @category String
  22229. * @param {string} [string=''] The string to capitalize.
  22230. * @returns {string} Returns the capitalized string.
  22231. * @example
  22232. *
  22233. * _.capitalize('FRED');
  22234. * // => 'Fred'
  22235. */
  22236. function capitalize(string) {
  22237. return upperFirst(toString(string).toLowerCase());
  22238. }
  22239. /**
  22240. * Deburrs `string` by converting
  22241. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  22242. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  22243. * letters to basic Latin letters and removing
  22244. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  22245. *
  22246. * @static
  22247. * @memberOf _
  22248. * @since 3.0.0
  22249. * @category String
  22250. * @param {string} [string=''] The string to deburr.
  22251. * @returns {string} Returns the deburred string.
  22252. * @example
  22253. *
  22254. * _.deburr('déjà vu');
  22255. * // => 'deja vu'
  22256. */
  22257. function deburr(string) {
  22258. string = toString(string);
  22259. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  22260. }
  22261. /**
  22262. * Checks if `string` ends with the given target string.
  22263. *
  22264. * @static
  22265. * @memberOf _
  22266. * @since 3.0.0
  22267. * @category String
  22268. * @param {string} [string=''] The string to inspect.
  22269. * @param {string} [target] The string to search for.
  22270. * @param {number} [position=string.length] The position to search up to.
  22271. * @returns {boolean} Returns `true` if `string` ends with `target`,
  22272. * else `false`.
  22273. * @example
  22274. *
  22275. * _.endsWith('abc', 'c');
  22276. * // => true
  22277. *
  22278. * _.endsWith('abc', 'b');
  22279. * // => false
  22280. *
  22281. * _.endsWith('abc', 'b', 2);
  22282. * // => true
  22283. */
  22284. function endsWith(string, target, position) {
  22285. string = toString(string);
  22286. target = baseToString(target);
  22287. var length = string.length;
  22288. position = position === undefined
  22289. ? length
  22290. : baseClamp(toInteger(position), 0, length);
  22291. var end = position;
  22292. position -= target.length;
  22293. return position >= 0 && string.slice(position, end) == target;
  22294. }
  22295. /**
  22296. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  22297. * corresponding HTML entities.
  22298. *
  22299. * **Note:** No other characters are escaped. To escape additional
  22300. * characters use a third-party library like [_he_](https://mths.be/he).
  22301. *
  22302. * Though the ">" character is escaped for symmetry, characters like
  22303. * ">" and "/" don't need escaping in HTML and have no special meaning
  22304. * unless they're part of a tag or unquoted attribute value. See
  22305. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  22306. * (under "semi-related fun fact") for more details.
  22307. *
  22308. * When working with HTML you should always
  22309. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  22310. * XSS vectors.
  22311. *
  22312. * @static
  22313. * @since 0.1.0
  22314. * @memberOf _
  22315. * @category String
  22316. * @param {string} [string=''] The string to escape.
  22317. * @returns {string} Returns the escaped string.
  22318. * @example
  22319. *
  22320. * _.escape('fred, barney, & pebbles');
  22321. * // => 'fred, barney, &amp; pebbles'
  22322. */
  22323. function escape(string) {
  22324. string = toString(string);
  22325. return (string && reHasUnescapedHtml.test(string))
  22326. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  22327. : string;
  22328. }
  22329. /**
  22330. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  22331. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  22332. *
  22333. * @static
  22334. * @memberOf _
  22335. * @since 3.0.0
  22336. * @category String
  22337. * @param {string} [string=''] The string to escape.
  22338. * @returns {string} Returns the escaped string.
  22339. * @example
  22340. *
  22341. * _.escapeRegExp('[lodash](https://lodash.com/)');
  22342. * // => '\[lodash\]\(https://lodash\.com/\)'
  22343. */
  22344. function escapeRegExp(string) {
  22345. string = toString(string);
  22346. return (string && reHasRegExpChar.test(string))
  22347. ? string.replace(reRegExpChar, '\\$&')
  22348. : string;
  22349. }
  22350. /**
  22351. * Converts `string` to
  22352. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  22353. *
  22354. * @static
  22355. * @memberOf _
  22356. * @since 3.0.0
  22357. * @category String
  22358. * @param {string} [string=''] The string to convert.
  22359. * @returns {string} Returns the kebab cased string.
  22360. * @example
  22361. *
  22362. * _.kebabCase('Foo Bar');
  22363. * // => 'foo-bar'
  22364. *
  22365. * _.kebabCase('fooBar');
  22366. * // => 'foo-bar'
  22367. *
  22368. * _.kebabCase('__FOO_BAR__');
  22369. * // => 'foo-bar'
  22370. */
  22371. var kebabCase = createCompounder(function(result, word, index) {
  22372. return result + (index ? '-' : '') + word.toLowerCase();
  22373. });
  22374. /**
  22375. * Converts `string`, as space separated words, to lower case.
  22376. *
  22377. * @static
  22378. * @memberOf _
  22379. * @since 4.0.0
  22380. * @category String
  22381. * @param {string} [string=''] The string to convert.
  22382. * @returns {string} Returns the lower cased string.
  22383. * @example
  22384. *
  22385. * _.lowerCase('--Foo-Bar--');
  22386. * // => 'foo bar'
  22387. *
  22388. * _.lowerCase('fooBar');
  22389. * // => 'foo bar'
  22390. *
  22391. * _.lowerCase('__FOO_BAR__');
  22392. * // => 'foo bar'
  22393. */
  22394. var lowerCase = createCompounder(function(result, word, index) {
  22395. return result + (index ? ' ' : '') + word.toLowerCase();
  22396. });
  22397. /**
  22398. * Converts the first character of `string` to lower case.
  22399. *
  22400. * @static
  22401. * @memberOf _
  22402. * @since 4.0.0
  22403. * @category String
  22404. * @param {string} [string=''] The string to convert.
  22405. * @returns {string} Returns the converted string.
  22406. * @example
  22407. *
  22408. * _.lowerFirst('Fred');
  22409. * // => 'fred'
  22410. *
  22411. * _.lowerFirst('FRED');
  22412. * // => 'fRED'
  22413. */
  22414. var lowerFirst = createCaseFirst('toLowerCase');
  22415. /**
  22416. * Pads `string` on the left and right sides if it's shorter than `length`.
  22417. * Padding characters are truncated if they can't be evenly divided by `length`.
  22418. *
  22419. * @static
  22420. * @memberOf _
  22421. * @since 3.0.0
  22422. * @category String
  22423. * @param {string} [string=''] The string to pad.
  22424. * @param {number} [length=0] The padding length.
  22425. * @param {string} [chars=' '] The string used as padding.
  22426. * @returns {string} Returns the padded string.
  22427. * @example
  22428. *
  22429. * _.pad('abc', 8);
  22430. * // => ' abc '
  22431. *
  22432. * _.pad('abc', 8, '_-');
  22433. * // => '_-abc_-_'
  22434. *
  22435. * _.pad('abc', 3);
  22436. * // => 'abc'
  22437. */
  22438. function pad(string, length, chars) {
  22439. string = toString(string);
  22440. length = toInteger(length);
  22441. var strLength = length ? stringSize(string) : 0;
  22442. if (!length || strLength >= length) {
  22443. return string;
  22444. }
  22445. var mid = (length - strLength) / 2;
  22446. return (
  22447. createPadding(nativeFloor(mid), chars) +
  22448. string +
  22449. createPadding(nativeCeil(mid), chars)
  22450. );
  22451. }
  22452. /**
  22453. * Pads `string` on the right side if it's shorter than `length`. Padding
  22454. * characters are truncated if they exceed `length`.
  22455. *
  22456. * @static
  22457. * @memberOf _
  22458. * @since 4.0.0
  22459. * @category String
  22460. * @param {string} [string=''] The string to pad.
  22461. * @param {number} [length=0] The padding length.
  22462. * @param {string} [chars=' '] The string used as padding.
  22463. * @returns {string} Returns the padded string.
  22464. * @example
  22465. *
  22466. * _.padEnd('abc', 6);
  22467. * // => 'abc '
  22468. *
  22469. * _.padEnd('abc', 6, '_-');
  22470. * // => 'abc_-_'
  22471. *
  22472. * _.padEnd('abc', 3);
  22473. * // => 'abc'
  22474. */
  22475. function padEnd(string, length, chars) {
  22476. string = toString(string);
  22477. length = toInteger(length);
  22478. var strLength = length ? stringSize(string) : 0;
  22479. return (length && strLength < length)
  22480. ? (string + createPadding(length - strLength, chars))
  22481. : string;
  22482. }
  22483. /**
  22484. * Pads `string` on the left side if it's shorter than `length`. Padding
  22485. * characters are truncated if they exceed `length`.
  22486. *
  22487. * @static
  22488. * @memberOf _
  22489. * @since 4.0.0
  22490. * @category String
  22491. * @param {string} [string=''] The string to pad.
  22492. * @param {number} [length=0] The padding length.
  22493. * @param {string} [chars=' '] The string used as padding.
  22494. * @returns {string} Returns the padded string.
  22495. * @example
  22496. *
  22497. * _.padStart('abc', 6);
  22498. * // => ' abc'
  22499. *
  22500. * _.padStart('abc', 6, '_-');
  22501. * // => '_-_abc'
  22502. *
  22503. * _.padStart('abc', 3);
  22504. * // => 'abc'
  22505. */
  22506. function padStart(string, length, chars) {
  22507. string = toString(string);
  22508. length = toInteger(length);
  22509. var strLength = length ? stringSize(string) : 0;
  22510. return (length && strLength < length)
  22511. ? (createPadding(length - strLength, chars) + string)
  22512. : string;
  22513. }
  22514. /**
  22515. * Converts `string` to an integer of the specified radix. If `radix` is
  22516. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  22517. * hexadecimal, in which case a `radix` of `16` is used.
  22518. *
  22519. * **Note:** This method aligns with the
  22520. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  22521. *
  22522. * @static
  22523. * @memberOf _
  22524. * @since 1.1.0
  22525. * @category String
  22526. * @param {string} string The string to convert.
  22527. * @param {number} [radix=10] The radix to interpret `value` by.
  22528. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22529. * @returns {number} Returns the converted integer.
  22530. * @example
  22531. *
  22532. * _.parseInt('08');
  22533. * // => 8
  22534. *
  22535. * _.map(['6', '08', '10'], _.parseInt);
  22536. * // => [6, 8, 10]
  22537. */
  22538. function parseInt(string, radix, guard) {
  22539. if (guard || radix == null) {
  22540. radix = 0;
  22541. } else if (radix) {
  22542. radix = +radix;
  22543. }
  22544. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  22545. }
  22546. /**
  22547. * Repeats the given string `n` times.
  22548. *
  22549. * @static
  22550. * @memberOf _
  22551. * @since 3.0.0
  22552. * @category String
  22553. * @param {string} [string=''] The string to repeat.
  22554. * @param {number} [n=1] The number of times to repeat the string.
  22555. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22556. * @returns {string} Returns the repeated string.
  22557. * @example
  22558. *
  22559. * _.repeat('*', 3);
  22560. * // => '***'
  22561. *
  22562. * _.repeat('abc', 2);
  22563. * // => 'abcabc'
  22564. *
  22565. * _.repeat('abc', 0);
  22566. * // => ''
  22567. */
  22568. function repeat(string, n, guard) {
  22569. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  22570. n = 1;
  22571. } else {
  22572. n = toInteger(n);
  22573. }
  22574. return baseRepeat(toString(string), n);
  22575. }
  22576. /**
  22577. * Replaces matches for `pattern` in `string` with `replacement`.
  22578. *
  22579. * **Note:** This method is based on
  22580. * [`String#replace`](https://mdn.io/String/replace).
  22581. *
  22582. * @static
  22583. * @memberOf _
  22584. * @since 4.0.0
  22585. * @category String
  22586. * @param {string} [string=''] The string to modify.
  22587. * @param {RegExp|string} pattern The pattern to replace.
  22588. * @param {Function|string} replacement The match replacement.
  22589. * @returns {string} Returns the modified string.
  22590. * @example
  22591. *
  22592. * _.replace('Hi Fred', 'Fred', 'Barney');
  22593. * // => 'Hi Barney'
  22594. */
  22595. function replace() {
  22596. var args = arguments,
  22597. string = toString(args[0]);
  22598. return args.length < 3 ? string : string.replace(args[1], args[2]);
  22599. }
  22600. /**
  22601. * Converts `string` to
  22602. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  22603. *
  22604. * @static
  22605. * @memberOf _
  22606. * @since 3.0.0
  22607. * @category String
  22608. * @param {string} [string=''] The string to convert.
  22609. * @returns {string} Returns the snake cased string.
  22610. * @example
  22611. *
  22612. * _.snakeCase('Foo Bar');
  22613. * // => 'foo_bar'
  22614. *
  22615. * _.snakeCase('fooBar');
  22616. * // => 'foo_bar'
  22617. *
  22618. * _.snakeCase('--FOO-BAR--');
  22619. * // => 'foo_bar'
  22620. */
  22621. var snakeCase = createCompounder(function(result, word, index) {
  22622. return result + (index ? '_' : '') + word.toLowerCase();
  22623. });
  22624. /**
  22625. * Splits `string` by `separator`.
  22626. *
  22627. * **Note:** This method is based on
  22628. * [`String#split`](https://mdn.io/String/split).
  22629. *
  22630. * @static
  22631. * @memberOf _
  22632. * @since 4.0.0
  22633. * @category String
  22634. * @param {string} [string=''] The string to split.
  22635. * @param {RegExp|string} separator The separator pattern to split by.
  22636. * @param {number} [limit] The length to truncate results to.
  22637. * @returns {Array} Returns the string segments.
  22638. * @example
  22639. *
  22640. * _.split('a-b-c', '-', 2);
  22641. * // => ['a', 'b']
  22642. */
  22643. function split(string, separator, limit) {
  22644. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  22645. separator = limit = undefined;
  22646. }
  22647. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  22648. if (!limit) {
  22649. return [];
  22650. }
  22651. string = toString(string);
  22652. if (string && (
  22653. typeof separator == 'string' ||
  22654. (separator != null && !isRegExp(separator))
  22655. )) {
  22656. separator = baseToString(separator);
  22657. if (!separator && hasUnicode(string)) {
  22658. return castSlice(stringToArray(string), 0, limit);
  22659. }
  22660. }
  22661. return string.split(separator, limit);
  22662. }
  22663. /**
  22664. * Converts `string` to
  22665. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  22666. *
  22667. * @static
  22668. * @memberOf _
  22669. * @since 3.1.0
  22670. * @category String
  22671. * @param {string} [string=''] The string to convert.
  22672. * @returns {string} Returns the start cased string.
  22673. * @example
  22674. *
  22675. * _.startCase('--foo-bar--');
  22676. * // => 'Foo Bar'
  22677. *
  22678. * _.startCase('fooBar');
  22679. * // => 'Foo Bar'
  22680. *
  22681. * _.startCase('__FOO_BAR__');
  22682. * // => 'FOO BAR'
  22683. */
  22684. var startCase = createCompounder(function(result, word, index) {
  22685. return result + (index ? ' ' : '') + upperFirst(word);
  22686. });
  22687. /**
  22688. * Checks if `string` starts with the given target string.
  22689. *
  22690. * @static
  22691. * @memberOf _
  22692. * @since 3.0.0
  22693. * @category String
  22694. * @param {string} [string=''] The string to inspect.
  22695. * @param {string} [target] The string to search for.
  22696. * @param {number} [position=0] The position to search from.
  22697. * @returns {boolean} Returns `true` if `string` starts with `target`,
  22698. * else `false`.
  22699. * @example
  22700. *
  22701. * _.startsWith('abc', 'a');
  22702. * // => true
  22703. *
  22704. * _.startsWith('abc', 'b');
  22705. * // => false
  22706. *
  22707. * _.startsWith('abc', 'b', 1);
  22708. * // => true
  22709. */
  22710. function startsWith(string, target, position) {
  22711. string = toString(string);
  22712. position = position == null
  22713. ? 0
  22714. : baseClamp(toInteger(position), 0, string.length);
  22715. target = baseToString(target);
  22716. return string.slice(position, position + target.length) == target;
  22717. }
  22718. /**
  22719. * Creates a compiled template function that can interpolate data properties
  22720. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  22721. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  22722. * properties may be accessed as free variables in the template. If a setting
  22723. * object is given, it takes precedence over `_.templateSettings` values.
  22724. *
  22725. * **Note:** In the development build `_.template` utilizes
  22726. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  22727. * for easier debugging.
  22728. *
  22729. * For more information on precompiling templates see
  22730. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  22731. *
  22732. * For more information on Chrome extension sandboxes see
  22733. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  22734. *
  22735. * @static
  22736. * @since 0.1.0
  22737. * @memberOf _
  22738. * @category String
  22739. * @param {string} [string=''] The template string.
  22740. * @param {Object} [options={}] The options object.
  22741. * @param {RegExp} [options.escape=_.templateSettings.escape]
  22742. * The HTML "escape" delimiter.
  22743. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  22744. * The "evaluate" delimiter.
  22745. * @param {Object} [options.imports=_.templateSettings.imports]
  22746. * An object to import into the template as free variables.
  22747. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  22748. * The "interpolate" delimiter.
  22749. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  22750. * The sourceURL of the compiled template.
  22751. * @param {string} [options.variable='obj']
  22752. * The data object variable name.
  22753. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22754. * @returns {Function} Returns the compiled template function.
  22755. * @example
  22756. *
  22757. * // Use the "interpolate" delimiter to create a compiled template.
  22758. * var compiled = _.template('hello <%= user %>!');
  22759. * compiled({ 'user': 'fred' });
  22760. * // => 'hello fred!'
  22761. *
  22762. * // Use the HTML "escape" delimiter to escape data property values.
  22763. * var compiled = _.template('<b><%- value %></b>');
  22764. * compiled({ 'value': '<script>' });
  22765. * // => '<b>&lt;script&gt;</b>'
  22766. *
  22767. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  22768. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  22769. * compiled({ 'users': ['fred', 'barney'] });
  22770. * // => '<li>fred</li><li>barney</li>'
  22771. *
  22772. * // Use the internal `print` function in "evaluate" delimiters.
  22773. * var compiled = _.template('<% print("hello " + user); %>!');
  22774. * compiled({ 'user': 'barney' });
  22775. * // => 'hello barney!'
  22776. *
  22777. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  22778. * // Disable support by replacing the "interpolate" delimiter.
  22779. * var compiled = _.template('hello ${ user }!');
  22780. * compiled({ 'user': 'pebbles' });
  22781. * // => 'hello pebbles!'
  22782. *
  22783. * // Use backslashes to treat delimiters as plain text.
  22784. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  22785. * compiled({ 'value': 'ignored' });
  22786. * // => '<%- value %>'
  22787. *
  22788. * // Use the `imports` option to import `jQuery` as `jq`.
  22789. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  22790. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  22791. * compiled({ 'users': ['fred', 'barney'] });
  22792. * // => '<li>fred</li><li>barney</li>'
  22793. *
  22794. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  22795. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  22796. * compiled(data);
  22797. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  22798. *
  22799. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  22800. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  22801. * compiled.source;
  22802. * // => function(data) {
  22803. * // var __t, __p = '';
  22804. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  22805. * // return __p;
  22806. * // }
  22807. *
  22808. * // Use custom template delimiters.
  22809. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  22810. * var compiled = _.template('hello {{ user }}!');
  22811. * compiled({ 'user': 'mustache' });
  22812. * // => 'hello mustache!'
  22813. *
  22814. * // Use the `source` property to inline compiled templates for meaningful
  22815. * // line numbers in error messages and stack traces.
  22816. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  22817. * var JST = {\
  22818. * "main": ' + _.template(mainText).source + '\
  22819. * };\
  22820. * ');
  22821. */
  22822. function template(string, options, guard) {
  22823. // Based on John Resig's `tmpl` implementation
  22824. // (http://ejohn.org/blog/javascript-micro-templating/)
  22825. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  22826. var settings = lodash.templateSettings;
  22827. if (guard && isIterateeCall(string, options, guard)) {
  22828. options = undefined;
  22829. }
  22830. string = toString(string);
  22831. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  22832. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  22833. importsKeys = keys(imports),
  22834. importsValues = baseValues(imports, importsKeys);
  22835. var isEscaping,
  22836. isEvaluating,
  22837. index = 0,
  22838. interpolate = options.interpolate || reNoMatch,
  22839. source = "__p += '";
  22840. // Compile the regexp to match each delimiter.
  22841. var reDelimiters = RegExp(
  22842. (options.escape || reNoMatch).source + '|' +
  22843. interpolate.source + '|' +
  22844. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  22845. (options.evaluate || reNoMatch).source + '|$'
  22846. , 'g');
  22847. // Use a sourceURL for easier debugging.
  22848. var sourceURL = '//# sourceURL=' +
  22849. ('sourceURL' in options
  22850. ? options.sourceURL
  22851. : ('lodash.templateSources[' + (++templateCounter) + ']')
  22852. ) + '\n';
  22853. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  22854. interpolateValue || (interpolateValue = esTemplateValue);
  22855. // Escape characters that can't be included in string literals.
  22856. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  22857. // Replace delimiters with snippets.
  22858. if (escapeValue) {
  22859. isEscaping = true;
  22860. source += "' +\n__e(" + escapeValue + ") +\n'";
  22861. }
  22862. if (evaluateValue) {
  22863. isEvaluating = true;
  22864. source += "';\n" + evaluateValue + ";\n__p += '";
  22865. }
  22866. if (interpolateValue) {
  22867. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  22868. }
  22869. index = offset + match.length;
  22870. // The JS engine embedded in Adobe products needs `match` returned in
  22871. // order to produce the correct `offset` value.
  22872. return match;
  22873. });
  22874. source += "';\n";
  22875. // If `variable` is not specified wrap a with-statement around the generated
  22876. // code to add the data object to the top of the scope chain.
  22877. var variable = options.variable;
  22878. if (!variable) {
  22879. source = 'with (obj) {\n' + source + '\n}\n';
  22880. }
  22881. // Cleanup code by stripping empty strings.
  22882. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  22883. .replace(reEmptyStringMiddle, '$1')
  22884. .replace(reEmptyStringTrailing, '$1;');
  22885. // Frame code as the function body.
  22886. source = 'function(' + (variable || 'obj') + ') {\n' +
  22887. (variable
  22888. ? ''
  22889. : 'obj || (obj = {});\n'
  22890. ) +
  22891. "var __t, __p = ''" +
  22892. (isEscaping
  22893. ? ', __e = _.escape'
  22894. : ''
  22895. ) +
  22896. (isEvaluating
  22897. ? ', __j = Array.prototype.join;\n' +
  22898. "function print() { __p += __j.call(arguments, '') }\n"
  22899. : ';\n'
  22900. ) +
  22901. source +
  22902. 'return __p\n}';
  22903. var result = attempt(function() {
  22904. return Function(importsKeys, sourceURL + 'return ' + source)
  22905. .apply(undefined, importsValues);
  22906. });
  22907. // Provide the compiled function's source by its `toString` method or
  22908. // the `source` property as a convenience for inlining compiled templates.
  22909. result.source = source;
  22910. if (isError(result)) {
  22911. throw result;
  22912. }
  22913. return result;
  22914. }
  22915. /**
  22916. * Converts `string`, as a whole, to lower case just like
  22917. * [String#toLowerCase](https://mdn.io/toLowerCase).
  22918. *
  22919. * @static
  22920. * @memberOf _
  22921. * @since 4.0.0
  22922. * @category String
  22923. * @param {string} [string=''] The string to convert.
  22924. * @returns {string} Returns the lower cased string.
  22925. * @example
  22926. *
  22927. * _.toLower('--Foo-Bar--');
  22928. * // => '--foo-bar--'
  22929. *
  22930. * _.toLower('fooBar');
  22931. * // => 'foobar'
  22932. *
  22933. * _.toLower('__FOO_BAR__');
  22934. * // => '__foo_bar__'
  22935. */
  22936. function toLower(value) {
  22937. return toString(value).toLowerCase();
  22938. }
  22939. /**
  22940. * Converts `string`, as a whole, to upper case just like
  22941. * [String#toUpperCase](https://mdn.io/toUpperCase).
  22942. *
  22943. * @static
  22944. * @memberOf _
  22945. * @since 4.0.0
  22946. * @category String
  22947. * @param {string} [string=''] The string to convert.
  22948. * @returns {string} Returns the upper cased string.
  22949. * @example
  22950. *
  22951. * _.toUpper('--foo-bar--');
  22952. * // => '--FOO-BAR--'
  22953. *
  22954. * _.toUpper('fooBar');
  22955. * // => 'FOOBAR'
  22956. *
  22957. * _.toUpper('__foo_bar__');
  22958. * // => '__FOO_BAR__'
  22959. */
  22960. function toUpper(value) {
  22961. return toString(value).toUpperCase();
  22962. }
  22963. /**
  22964. * Removes leading and trailing whitespace or specified characters from `string`.
  22965. *
  22966. * @static
  22967. * @memberOf _
  22968. * @since 3.0.0
  22969. * @category String
  22970. * @param {string} [string=''] The string to trim.
  22971. * @param {string} [chars=whitespace] The characters to trim.
  22972. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22973. * @returns {string} Returns the trimmed string.
  22974. * @example
  22975. *
  22976. * _.trim(' abc ');
  22977. * // => 'abc'
  22978. *
  22979. * _.trim('-_-abc-_-', '_-');
  22980. * // => 'abc'
  22981. *
  22982. * _.map([' foo ', ' bar '], _.trim);
  22983. * // => ['foo', 'bar']
  22984. */
  22985. function trim(string, chars, guard) {
  22986. string = toString(string);
  22987. if (string && (guard || chars === undefined)) {
  22988. return string.replace(reTrim, '');
  22989. }
  22990. if (!string || !(chars = baseToString(chars))) {
  22991. return string;
  22992. }
  22993. var strSymbols = stringToArray(string),
  22994. chrSymbols = stringToArray(chars),
  22995. start = charsStartIndex(strSymbols, chrSymbols),
  22996. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  22997. return castSlice(strSymbols, start, end).join('');
  22998. }
  22999. /**
  23000. * Removes trailing whitespace or specified characters from `string`.
  23001. *
  23002. * @static
  23003. * @memberOf _
  23004. * @since 4.0.0
  23005. * @category String
  23006. * @param {string} [string=''] The string to trim.
  23007. * @param {string} [chars=whitespace] The characters to trim.
  23008. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23009. * @returns {string} Returns the trimmed string.
  23010. * @example
  23011. *
  23012. * _.trimEnd(' abc ');
  23013. * // => ' abc'
  23014. *
  23015. * _.trimEnd('-_-abc-_-', '_-');
  23016. * // => '-_-abc'
  23017. */
  23018. function trimEnd(string, chars, guard) {
  23019. string = toString(string);
  23020. if (string && (guard || chars === undefined)) {
  23021. return string.replace(reTrimEnd, '');
  23022. }
  23023. if (!string || !(chars = baseToString(chars))) {
  23024. return string;
  23025. }
  23026. var strSymbols = stringToArray(string),
  23027. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  23028. return castSlice(strSymbols, 0, end).join('');
  23029. }
  23030. /**
  23031. * Removes leading whitespace or specified characters from `string`.
  23032. *
  23033. * @static
  23034. * @memberOf _
  23035. * @since 4.0.0
  23036. * @category String
  23037. * @param {string} [string=''] The string to trim.
  23038. * @param {string} [chars=whitespace] The characters to trim.
  23039. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23040. * @returns {string} Returns the trimmed string.
  23041. * @example
  23042. *
  23043. * _.trimStart(' abc ');
  23044. * // => 'abc '
  23045. *
  23046. * _.trimStart('-_-abc-_-', '_-');
  23047. * // => 'abc-_-'
  23048. */
  23049. function trimStart(string, chars, guard) {
  23050. string = toString(string);
  23051. if (string && (guard || chars === undefined)) {
  23052. return string.replace(reTrimStart, '');
  23053. }
  23054. if (!string || !(chars = baseToString(chars))) {
  23055. return string;
  23056. }
  23057. var strSymbols = stringToArray(string),
  23058. start = charsStartIndex(strSymbols, stringToArray(chars));
  23059. return castSlice(strSymbols, start).join('');
  23060. }
  23061. /**
  23062. * Truncates `string` if it's longer than the given maximum string length.
  23063. * The last characters of the truncated string are replaced with the omission
  23064. * string which defaults to "...".
  23065. *
  23066. * @static
  23067. * @memberOf _
  23068. * @since 4.0.0
  23069. * @category String
  23070. * @param {string} [string=''] The string to truncate.
  23071. * @param {Object} [options={}] The options object.
  23072. * @param {number} [options.length=30] The maximum string length.
  23073. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  23074. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  23075. * @returns {string} Returns the truncated string.
  23076. * @example
  23077. *
  23078. * _.truncate('hi-diddly-ho there, neighborino');
  23079. * // => 'hi-diddly-ho there, neighbo...'
  23080. *
  23081. * _.truncate('hi-diddly-ho there, neighborino', {
  23082. * 'length': 24,
  23083. * 'separator': ' '
  23084. * });
  23085. * // => 'hi-diddly-ho there,...'
  23086. *
  23087. * _.truncate('hi-diddly-ho there, neighborino', {
  23088. * 'length': 24,
  23089. * 'separator': /,? +/
  23090. * });
  23091. * // => 'hi-diddly-ho there...'
  23092. *
  23093. * _.truncate('hi-diddly-ho there, neighborino', {
  23094. * 'omission': ' [...]'
  23095. * });
  23096. * // => 'hi-diddly-ho there, neig [...]'
  23097. */
  23098. function truncate(string, options) {
  23099. var length = DEFAULT_TRUNC_LENGTH,
  23100. omission = DEFAULT_TRUNC_OMISSION;
  23101. if (isObject(options)) {
  23102. var separator = 'separator' in options ? options.separator : separator;
  23103. length = 'length' in options ? toInteger(options.length) : length;
  23104. omission = 'omission' in options ? baseToString(options.omission) : omission;
  23105. }
  23106. string = toString(string);
  23107. var strLength = string.length;
  23108. if (hasUnicode(string)) {
  23109. var strSymbols = stringToArray(string);
  23110. strLength = strSymbols.length;
  23111. }
  23112. if (length >= strLength) {
  23113. return string;
  23114. }
  23115. var end = length - stringSize(omission);
  23116. if (end < 1) {
  23117. return omission;
  23118. }
  23119. var result = strSymbols
  23120. ? castSlice(strSymbols, 0, end).join('')
  23121. : string.slice(0, end);
  23122. if (separator === undefined) {
  23123. return result + omission;
  23124. }
  23125. if (strSymbols) {
  23126. end += (result.length - end);
  23127. }
  23128. if (isRegExp(separator)) {
  23129. if (string.slice(end).search(separator)) {
  23130. var match,
  23131. substring = result;
  23132. if (!separator.global) {
  23133. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  23134. }
  23135. separator.lastIndex = 0;
  23136. while ((match = separator.exec(substring))) {
  23137. var newEnd = match.index;
  23138. }
  23139. result = result.slice(0, newEnd === undefined ? end : newEnd);
  23140. }
  23141. } else if (string.indexOf(baseToString(separator), end) != end) {
  23142. var index = result.lastIndexOf(separator);
  23143. if (index > -1) {
  23144. result = result.slice(0, index);
  23145. }
  23146. }
  23147. return result + omission;
  23148. }
  23149. /**
  23150. * The inverse of `_.escape`; this method converts the HTML entities
  23151. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  23152. * their corresponding characters.
  23153. *
  23154. * **Note:** No other HTML entities are unescaped. To unescape additional
  23155. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  23156. *
  23157. * @static
  23158. * @memberOf _
  23159. * @since 0.6.0
  23160. * @category String
  23161. * @param {string} [string=''] The string to unescape.
  23162. * @returns {string} Returns the unescaped string.
  23163. * @example
  23164. *
  23165. * _.unescape('fred, barney, &amp; pebbles');
  23166. * // => 'fred, barney, & pebbles'
  23167. */
  23168. function unescape(string) {
  23169. string = toString(string);
  23170. return (string && reHasEscapedHtml.test(string))
  23171. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  23172. : string;
  23173. }
  23174. /**
  23175. * Converts `string`, as space separated words, to upper case.
  23176. *
  23177. * @static
  23178. * @memberOf _
  23179. * @since 4.0.0
  23180. * @category String
  23181. * @param {string} [string=''] The string to convert.
  23182. * @returns {string} Returns the upper cased string.
  23183. * @example
  23184. *
  23185. * _.upperCase('--foo-bar');
  23186. * // => 'FOO BAR'
  23187. *
  23188. * _.upperCase('fooBar');
  23189. * // => 'FOO BAR'
  23190. *
  23191. * _.upperCase('__foo_bar__');
  23192. * // => 'FOO BAR'
  23193. */
  23194. var upperCase = createCompounder(function(result, word, index) {
  23195. return result + (index ? ' ' : '') + word.toUpperCase();
  23196. });
  23197. /**
  23198. * Converts the first character of `string` to upper case.
  23199. *
  23200. * @static
  23201. * @memberOf _
  23202. * @since 4.0.0
  23203. * @category String
  23204. * @param {string} [string=''] The string to convert.
  23205. * @returns {string} Returns the converted string.
  23206. * @example
  23207. *
  23208. * _.upperFirst('fred');
  23209. * // => 'Fred'
  23210. *
  23211. * _.upperFirst('FRED');
  23212. * // => 'FRED'
  23213. */
  23214. var upperFirst = createCaseFirst('toUpperCase');
  23215. /**
  23216. * Splits `string` into an array of its words.
  23217. *
  23218. * @static
  23219. * @memberOf _
  23220. * @since 3.0.0
  23221. * @category String
  23222. * @param {string} [string=''] The string to inspect.
  23223. * @param {RegExp|string} [pattern] The pattern to match words.
  23224. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23225. * @returns {Array} Returns the words of `string`.
  23226. * @example
  23227. *
  23228. * _.words('fred, barney, & pebbles');
  23229. * // => ['fred', 'barney', 'pebbles']
  23230. *
  23231. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  23232. * // => ['fred', 'barney', '&', 'pebbles']
  23233. */
  23234. function words(string, pattern, guard) {
  23235. string = toString(string);
  23236. pattern = guard ? undefined : pattern;
  23237. if (pattern === undefined) {
  23238. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  23239. }
  23240. return string.match(pattern) || [];
  23241. }
  23242. /*------------------------------------------------------------------------*/
  23243. /**
  23244. * Attempts to invoke `func`, returning either the result or the caught error
  23245. * object. Any additional arguments are provided to `func` when it's invoked.
  23246. *
  23247. * @static
  23248. * @memberOf _
  23249. * @since 3.0.0
  23250. * @category Util
  23251. * @param {Function} func The function to attempt.
  23252. * @param {...*} [args] The arguments to invoke `func` with.
  23253. * @returns {*} Returns the `func` result or error object.
  23254. * @example
  23255. *
  23256. * // Avoid throwing errors for invalid selectors.
  23257. * var elements = _.attempt(function(selector) {
  23258. * return document.querySelectorAll(selector);
  23259. * }, '>_>');
  23260. *
  23261. * if (_.isError(elements)) {
  23262. * elements = [];
  23263. * }
  23264. */
  23265. var attempt = baseRest(function(func, args) {
  23266. try {
  23267. return apply(func, undefined, args);
  23268. } catch (e) {
  23269. return isError(e) ? e : new Error(e);
  23270. }
  23271. });
  23272. /**
  23273. * Binds methods of an object to the object itself, overwriting the existing
  23274. * method.
  23275. *
  23276. * **Note:** This method doesn't set the "length" property of bound functions.
  23277. *
  23278. * @static
  23279. * @since 0.1.0
  23280. * @memberOf _
  23281. * @category Util
  23282. * @param {Object} object The object to bind and assign the bound methods to.
  23283. * @param {...(string|string[])} methodNames The object method names to bind.
  23284. * @returns {Object} Returns `object`.
  23285. * @example
  23286. *
  23287. * var view = {
  23288. * 'label': 'docs',
  23289. * 'click': function() {
  23290. * console.log('clicked ' + this.label);
  23291. * }
  23292. * };
  23293. *
  23294. * _.bindAll(view, ['click']);
  23295. * jQuery(element).on('click', view.click);
  23296. * // => Logs 'clicked docs' when clicked.
  23297. */
  23298. var bindAll = flatRest(function(object, methodNames) {
  23299. arrayEach(methodNames, function(key) {
  23300. key = toKey(key);
  23301. baseAssignValue(object, key, bind(object[key], object));
  23302. });
  23303. return object;
  23304. });
  23305. /**
  23306. * Creates a function that iterates over `pairs` and invokes the corresponding
  23307. * function of the first predicate to return truthy. The predicate-function
  23308. * pairs are invoked with the `this` binding and arguments of the created
  23309. * function.
  23310. *
  23311. * @static
  23312. * @memberOf _
  23313. * @since 4.0.0
  23314. * @category Util
  23315. * @param {Array} pairs The predicate-function pairs.
  23316. * @returns {Function} Returns the new composite function.
  23317. * @example
  23318. *
  23319. * var func = _.cond([
  23320. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  23321. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  23322. * [_.stubTrue, _.constant('no match')]
  23323. * ]);
  23324. *
  23325. * func({ 'a': 1, 'b': 2 });
  23326. * // => 'matches A'
  23327. *
  23328. * func({ 'a': 0, 'b': 1 });
  23329. * // => 'matches B'
  23330. *
  23331. * func({ 'a': '1', 'b': '2' });
  23332. * // => 'no match'
  23333. */
  23334. function cond(pairs) {
  23335. var length = pairs == null ? 0 : pairs.length,
  23336. toIteratee = getIteratee();
  23337. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  23338. if (typeof pair[1] != 'function') {
  23339. throw new TypeError(FUNC_ERROR_TEXT);
  23340. }
  23341. return [toIteratee(pair[0]), pair[1]];
  23342. });
  23343. return baseRest(function(args) {
  23344. var index = -1;
  23345. while (++index < length) {
  23346. var pair = pairs[index];
  23347. if (apply(pair[0], this, args)) {
  23348. return apply(pair[1], this, args);
  23349. }
  23350. }
  23351. });
  23352. }
  23353. /**
  23354. * Creates a function that invokes the predicate properties of `source` with
  23355. * the corresponding property values of a given object, returning `true` if
  23356. * all predicates return truthy, else `false`.
  23357. *
  23358. * **Note:** The created function is equivalent to `_.conformsTo` with
  23359. * `source` partially applied.
  23360. *
  23361. * @static
  23362. * @memberOf _
  23363. * @since 4.0.0
  23364. * @category Util
  23365. * @param {Object} source The object of property predicates to conform to.
  23366. * @returns {Function} Returns the new spec function.
  23367. * @example
  23368. *
  23369. * var objects = [
  23370. * { 'a': 2, 'b': 1 },
  23371. * { 'a': 1, 'b': 2 }
  23372. * ];
  23373. *
  23374. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  23375. * // => [{ 'a': 1, 'b': 2 }]
  23376. */
  23377. function conforms(source) {
  23378. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  23379. }
  23380. /**
  23381. * Creates a function that returns `value`.
  23382. *
  23383. * @static
  23384. * @memberOf _
  23385. * @since 2.4.0
  23386. * @category Util
  23387. * @param {*} value The value to return from the new function.
  23388. * @returns {Function} Returns the new constant function.
  23389. * @example
  23390. *
  23391. * var objects = _.times(2, _.constant({ 'a': 1 }));
  23392. *
  23393. * console.log(objects);
  23394. * // => [{ 'a': 1 }, { 'a': 1 }]
  23395. *
  23396. * console.log(objects[0] === objects[1]);
  23397. * // => true
  23398. */
  23399. function constant(value) {
  23400. return function() {
  23401. return value;
  23402. };
  23403. }
  23404. /**
  23405. * Checks `value` to determine whether a default value should be returned in
  23406. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  23407. * or `undefined`.
  23408. *
  23409. * @static
  23410. * @memberOf _
  23411. * @since 4.14.0
  23412. * @category Util
  23413. * @param {*} value The value to check.
  23414. * @param {*} defaultValue The default value.
  23415. * @returns {*} Returns the resolved value.
  23416. * @example
  23417. *
  23418. * _.defaultTo(1, 10);
  23419. * // => 1
  23420. *
  23421. * _.defaultTo(undefined, 10);
  23422. * // => 10
  23423. */
  23424. function defaultTo(value, defaultValue) {
  23425. return (value == null || value !== value) ? defaultValue : value;
  23426. }
  23427. /**
  23428. * Creates a function that returns the result of invoking the given functions
  23429. * with the `this` binding of the created function, where each successive
  23430. * invocation is supplied the return value of the previous.
  23431. *
  23432. * @static
  23433. * @memberOf _
  23434. * @since 3.0.0
  23435. * @category Util
  23436. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  23437. * @returns {Function} Returns the new composite function.
  23438. * @see _.flowRight
  23439. * @example
  23440. *
  23441. * function square(n) {
  23442. * return n * n;
  23443. * }
  23444. *
  23445. * var addSquare = _.flow([_.add, square]);
  23446. * addSquare(1, 2);
  23447. * // => 9
  23448. */
  23449. var flow = createFlow();
  23450. /**
  23451. * This method is like `_.flow` except that it creates a function that
  23452. * invokes the given functions from right to left.
  23453. *
  23454. * @static
  23455. * @since 3.0.0
  23456. * @memberOf _
  23457. * @category Util
  23458. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  23459. * @returns {Function} Returns the new composite function.
  23460. * @see _.flow
  23461. * @example
  23462. *
  23463. * function square(n) {
  23464. * return n * n;
  23465. * }
  23466. *
  23467. * var addSquare = _.flowRight([square, _.add]);
  23468. * addSquare(1, 2);
  23469. * // => 9
  23470. */
  23471. var flowRight = createFlow(true);
  23472. /**
  23473. * This method returns the first argument it receives.
  23474. *
  23475. * @static
  23476. * @since 0.1.0
  23477. * @memberOf _
  23478. * @category Util
  23479. * @param {*} value Any value.
  23480. * @returns {*} Returns `value`.
  23481. * @example
  23482. *
  23483. * var object = { 'a': 1 };
  23484. *
  23485. * console.log(_.identity(object) === object);
  23486. * // => true
  23487. */
  23488. function identity(value) {
  23489. return value;
  23490. }
  23491. /**
  23492. * Creates a function that invokes `func` with the arguments of the created
  23493. * function. If `func` is a property name, the created function returns the
  23494. * property value for a given element. If `func` is an array or object, the
  23495. * created function returns `true` for elements that contain the equivalent
  23496. * source properties, otherwise it returns `false`.
  23497. *
  23498. * @static
  23499. * @since 4.0.0
  23500. * @memberOf _
  23501. * @category Util
  23502. * @param {*} [func=_.identity] The value to convert to a callback.
  23503. * @returns {Function} Returns the callback.
  23504. * @example
  23505. *
  23506. * var users = [
  23507. * { 'user': 'barney', 'age': 36, 'active': true },
  23508. * { 'user': 'fred', 'age': 40, 'active': false }
  23509. * ];
  23510. *
  23511. * // The `_.matches` iteratee shorthand.
  23512. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  23513. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  23514. *
  23515. * // The `_.matchesProperty` iteratee shorthand.
  23516. * _.filter(users, _.iteratee(['user', 'fred']));
  23517. * // => [{ 'user': 'fred', 'age': 40 }]
  23518. *
  23519. * // The `_.property` iteratee shorthand.
  23520. * _.map(users, _.iteratee('user'));
  23521. * // => ['barney', 'fred']
  23522. *
  23523. * // Create custom iteratee shorthands.
  23524. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  23525. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  23526. * return func.test(string);
  23527. * };
  23528. * });
  23529. *
  23530. * _.filter(['abc', 'def'], /ef/);
  23531. * // => ['def']
  23532. */
  23533. function iteratee(func) {
  23534. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  23535. }
  23536. /**
  23537. * Creates a function that performs a partial deep comparison between a given
  23538. * object and `source`, returning `true` if the given object has equivalent
  23539. * property values, else `false`.
  23540. *
  23541. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  23542. * partially applied.
  23543. *
  23544. * Partial comparisons will match empty array and empty object `source`
  23545. * values against any array or object value, respectively. See `_.isEqual`
  23546. * for a list of supported value comparisons.
  23547. *
  23548. * @static
  23549. * @memberOf _
  23550. * @since 3.0.0
  23551. * @category Util
  23552. * @param {Object} source The object of property values to match.
  23553. * @returns {Function} Returns the new spec function.
  23554. * @example
  23555. *
  23556. * var objects = [
  23557. * { 'a': 1, 'b': 2, 'c': 3 },
  23558. * { 'a': 4, 'b': 5, 'c': 6 }
  23559. * ];
  23560. *
  23561. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  23562. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  23563. */
  23564. function matches(source) {
  23565. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  23566. }
  23567. /**
  23568. * Creates a function that performs a partial deep comparison between the
  23569. * value at `path` of a given object to `srcValue`, returning `true` if the
  23570. * object value is equivalent, else `false`.
  23571. *
  23572. * **Note:** Partial comparisons will match empty array and empty object
  23573. * `srcValue` values against any array or object value, respectively. See
  23574. * `_.isEqual` for a list of supported value comparisons.
  23575. *
  23576. * @static
  23577. * @memberOf _
  23578. * @since 3.2.0
  23579. * @category Util
  23580. * @param {Array|string} path The path of the property to get.
  23581. * @param {*} srcValue The value to match.
  23582. * @returns {Function} Returns the new spec function.
  23583. * @example
  23584. *
  23585. * var objects = [
  23586. * { 'a': 1, 'b': 2, 'c': 3 },
  23587. * { 'a': 4, 'b': 5, 'c': 6 }
  23588. * ];
  23589. *
  23590. * _.find(objects, _.matchesProperty('a', 4));
  23591. * // => { 'a': 4, 'b': 5, 'c': 6 }
  23592. */
  23593. function matchesProperty(path, srcValue) {
  23594. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  23595. }
  23596. /**
  23597. * Creates a function that invokes the method at `path` of a given object.
  23598. * Any additional arguments are provided to the invoked method.
  23599. *
  23600. * @static
  23601. * @memberOf _
  23602. * @since 3.7.0
  23603. * @category Util
  23604. * @param {Array|string} path The path of the method to invoke.
  23605. * @param {...*} [args] The arguments to invoke the method with.
  23606. * @returns {Function} Returns the new invoker function.
  23607. * @example
  23608. *
  23609. * var objects = [
  23610. * { 'a': { 'b': _.constant(2) } },
  23611. * { 'a': { 'b': _.constant(1) } }
  23612. * ];
  23613. *
  23614. * _.map(objects, _.method('a.b'));
  23615. * // => [2, 1]
  23616. *
  23617. * _.map(objects, _.method(['a', 'b']));
  23618. * // => [2, 1]
  23619. */
  23620. var method = baseRest(function(path, args) {
  23621. return function(object) {
  23622. return baseInvoke(object, path, args);
  23623. };
  23624. });
  23625. /**
  23626. * The opposite of `_.method`; this method creates a function that invokes
  23627. * the method at a given path of `object`. Any additional arguments are
  23628. * provided to the invoked method.
  23629. *
  23630. * @static
  23631. * @memberOf _
  23632. * @since 3.7.0
  23633. * @category Util
  23634. * @param {Object} object The object to query.
  23635. * @param {...*} [args] The arguments to invoke the method with.
  23636. * @returns {Function} Returns the new invoker function.
  23637. * @example
  23638. *
  23639. * var array = _.times(3, _.constant),
  23640. * object = { 'a': array, 'b': array, 'c': array };
  23641. *
  23642. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  23643. * // => [2, 0]
  23644. *
  23645. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  23646. * // => [2, 0]
  23647. */
  23648. var methodOf = baseRest(function(object, args) {
  23649. return function(path) {
  23650. return baseInvoke(object, path, args);
  23651. };
  23652. });
  23653. /**
  23654. * Adds all own enumerable string keyed function properties of a source
  23655. * object to the destination object. If `object` is a function, then methods
  23656. * are added to its prototype as well.
  23657. *
  23658. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  23659. * avoid conflicts caused by modifying the original.
  23660. *
  23661. * @static
  23662. * @since 0.1.0
  23663. * @memberOf _
  23664. * @category Util
  23665. * @param {Function|Object} [object=lodash] The destination object.
  23666. * @param {Object} source The object of functions to add.
  23667. * @param {Object} [options={}] The options object.
  23668. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  23669. * @returns {Function|Object} Returns `object`.
  23670. * @example
  23671. *
  23672. * function vowels(string) {
  23673. * return _.filter(string, function(v) {
  23674. * return /[aeiou]/i.test(v);
  23675. * });
  23676. * }
  23677. *
  23678. * _.mixin({ 'vowels': vowels });
  23679. * _.vowels('fred');
  23680. * // => ['e']
  23681. *
  23682. * _('fred').vowels().value();
  23683. * // => ['e']
  23684. *
  23685. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  23686. * _('fred').vowels();
  23687. * // => ['e']
  23688. */
  23689. function mixin(object, source, options) {
  23690. var props = keys(source),
  23691. methodNames = baseFunctions(source, props);
  23692. if (options == null &&
  23693. !(isObject(source) && (methodNames.length || !props.length))) {
  23694. options = source;
  23695. source = object;
  23696. object = this;
  23697. methodNames = baseFunctions(source, keys(source));
  23698. }
  23699. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  23700. isFunc = isFunction(object);
  23701. arrayEach(methodNames, function(methodName) {
  23702. var func = source[methodName];
  23703. object[methodName] = func;
  23704. if (isFunc) {
  23705. object.prototype[methodName] = function() {
  23706. var chainAll = this.__chain__;
  23707. if (chain || chainAll) {
  23708. var result = object(this.__wrapped__),
  23709. actions = result.__actions__ = copyArray(this.__actions__);
  23710. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  23711. result.__chain__ = chainAll;
  23712. return result;
  23713. }
  23714. return func.apply(object, arrayPush([this.value()], arguments));
  23715. };
  23716. }
  23717. });
  23718. return object;
  23719. }
  23720. /**
  23721. * Reverts the `_` variable to its previous value and returns a reference to
  23722. * the `lodash` function.
  23723. *
  23724. * @static
  23725. * @since 0.1.0
  23726. * @memberOf _
  23727. * @category Util
  23728. * @returns {Function} Returns the `lodash` function.
  23729. * @example
  23730. *
  23731. * var lodash = _.noConflict();
  23732. */
  23733. function noConflict() {
  23734. if (root._ === this) {
  23735. root._ = oldDash;
  23736. }
  23737. return this;
  23738. }
  23739. /**
  23740. * This method returns `undefined`.
  23741. *
  23742. * @static
  23743. * @memberOf _
  23744. * @since 2.3.0
  23745. * @category Util
  23746. * @example
  23747. *
  23748. * _.times(2, _.noop);
  23749. * // => [undefined, undefined]
  23750. */
  23751. function noop() {
  23752. // No operation performed.
  23753. }
  23754. /**
  23755. * Creates a function that gets the argument at index `n`. If `n` is negative,
  23756. * the nth argument from the end is returned.
  23757. *
  23758. * @static
  23759. * @memberOf _
  23760. * @since 4.0.0
  23761. * @category Util
  23762. * @param {number} [n=0] The index of the argument to return.
  23763. * @returns {Function} Returns the new pass-thru function.
  23764. * @example
  23765. *
  23766. * var func = _.nthArg(1);
  23767. * func('a', 'b', 'c', 'd');
  23768. * // => 'b'
  23769. *
  23770. * var func = _.nthArg(-2);
  23771. * func('a', 'b', 'c', 'd');
  23772. * // => 'c'
  23773. */
  23774. function nthArg(n) {
  23775. n = toInteger(n);
  23776. return baseRest(function(args) {
  23777. return baseNth(args, n);
  23778. });
  23779. }
  23780. /**
  23781. * Creates a function that invokes `iteratees` with the arguments it receives
  23782. * and returns their results.
  23783. *
  23784. * @static
  23785. * @memberOf _
  23786. * @since 4.0.0
  23787. * @category Util
  23788. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  23789. * The iteratees to invoke.
  23790. * @returns {Function} Returns the new function.
  23791. * @example
  23792. *
  23793. * var func = _.over([Math.max, Math.min]);
  23794. *
  23795. * func(1, 2, 3, 4);
  23796. * // => [4, 1]
  23797. */
  23798. var over = createOver(arrayMap);
  23799. /**
  23800. * Creates a function that checks if **all** of the `predicates` return
  23801. * truthy when invoked with the arguments it receives.
  23802. *
  23803. * @static
  23804. * @memberOf _
  23805. * @since 4.0.0
  23806. * @category Util
  23807. * @param {...(Function|Function[])} [predicates=[_.identity]]
  23808. * The predicates to check.
  23809. * @returns {Function} Returns the new function.
  23810. * @example
  23811. *
  23812. * var func = _.overEvery([Boolean, isFinite]);
  23813. *
  23814. * func('1');
  23815. * // => true
  23816. *
  23817. * func(null);
  23818. * // => false
  23819. *
  23820. * func(NaN);
  23821. * // => false
  23822. */
  23823. var overEvery = createOver(arrayEvery);
  23824. /**
  23825. * Creates a function that checks if **any** of the `predicates` return
  23826. * truthy when invoked with the arguments it receives.
  23827. *
  23828. * @static
  23829. * @memberOf _
  23830. * @since 4.0.0
  23831. * @category Util
  23832. * @param {...(Function|Function[])} [predicates=[_.identity]]
  23833. * The predicates to check.
  23834. * @returns {Function} Returns the new function.
  23835. * @example
  23836. *
  23837. * var func = _.overSome([Boolean, isFinite]);
  23838. *
  23839. * func('1');
  23840. * // => true
  23841. *
  23842. * func(null);
  23843. * // => true
  23844. *
  23845. * func(NaN);
  23846. * // => false
  23847. */
  23848. var overSome = createOver(arraySome);
  23849. /**
  23850. * Creates a function that returns the value at `path` of a given object.
  23851. *
  23852. * @static
  23853. * @memberOf _
  23854. * @since 2.4.0
  23855. * @category Util
  23856. * @param {Array|string} path The path of the property to get.
  23857. * @returns {Function} Returns the new accessor function.
  23858. * @example
  23859. *
  23860. * var objects = [
  23861. * { 'a': { 'b': 2 } },
  23862. * { 'a': { 'b': 1 } }
  23863. * ];
  23864. *
  23865. * _.map(objects, _.property('a.b'));
  23866. * // => [2, 1]
  23867. *
  23868. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  23869. * // => [1, 2]
  23870. */
  23871. function property(path) {
  23872. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  23873. }
  23874. /**
  23875. * The opposite of `_.property`; this method creates a function that returns
  23876. * the value at a given path of `object`.
  23877. *
  23878. * @static
  23879. * @memberOf _
  23880. * @since 3.0.0
  23881. * @category Util
  23882. * @param {Object} object The object to query.
  23883. * @returns {Function} Returns the new accessor function.
  23884. * @example
  23885. *
  23886. * var array = [0, 1, 2],
  23887. * object = { 'a': array, 'b': array, 'c': array };
  23888. *
  23889. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  23890. * // => [2, 0]
  23891. *
  23892. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  23893. * // => [2, 0]
  23894. */
  23895. function propertyOf(object) {
  23896. return function(path) {
  23897. return object == null ? undefined : baseGet(object, path);
  23898. };
  23899. }
  23900. /**
  23901. * Creates an array of numbers (positive and/or negative) progressing from
  23902. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  23903. * `start` is specified without an `end` or `step`. If `end` is not specified,
  23904. * it's set to `start` with `start` then set to `0`.
  23905. *
  23906. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  23907. * floating-point values which can produce unexpected results.
  23908. *
  23909. * @static
  23910. * @since 0.1.0
  23911. * @memberOf _
  23912. * @category Util
  23913. * @param {number} [start=0] The start of the range.
  23914. * @param {number} end The end of the range.
  23915. * @param {number} [step=1] The value to increment or decrement by.
  23916. * @returns {Array} Returns the range of numbers.
  23917. * @see _.inRange, _.rangeRight
  23918. * @example
  23919. *
  23920. * _.range(4);
  23921. * // => [0, 1, 2, 3]
  23922. *
  23923. * _.range(-4);
  23924. * // => [0, -1, -2, -3]
  23925. *
  23926. * _.range(1, 5);
  23927. * // => [1, 2, 3, 4]
  23928. *
  23929. * _.range(0, 20, 5);
  23930. * // => [0, 5, 10, 15]
  23931. *
  23932. * _.range(0, -4, -1);
  23933. * // => [0, -1, -2, -3]
  23934. *
  23935. * _.range(1, 4, 0);
  23936. * // => [1, 1, 1]
  23937. *
  23938. * _.range(0);
  23939. * // => []
  23940. */
  23941. var range = createRange();
  23942. /**
  23943. * This method is like `_.range` except that it populates values in
  23944. * descending order.
  23945. *
  23946. * @static
  23947. * @memberOf _
  23948. * @since 4.0.0
  23949. * @category Util
  23950. * @param {number} [start=0] The start of the range.
  23951. * @param {number} end The end of the range.
  23952. * @param {number} [step=1] The value to increment or decrement by.
  23953. * @returns {Array} Returns the range of numbers.
  23954. * @see _.inRange, _.range
  23955. * @example
  23956. *
  23957. * _.rangeRight(4);
  23958. * // => [3, 2, 1, 0]
  23959. *
  23960. * _.rangeRight(-4);
  23961. * // => [-3, -2, -1, 0]
  23962. *
  23963. * _.rangeRight(1, 5);
  23964. * // => [4, 3, 2, 1]
  23965. *
  23966. * _.rangeRight(0, 20, 5);
  23967. * // => [15, 10, 5, 0]
  23968. *
  23969. * _.rangeRight(0, -4, -1);
  23970. * // => [-3, -2, -1, 0]
  23971. *
  23972. * _.rangeRight(1, 4, 0);
  23973. * // => [1, 1, 1]
  23974. *
  23975. * _.rangeRight(0);
  23976. * // => []
  23977. */
  23978. var rangeRight = createRange(true);
  23979. /**
  23980. * This method returns a new empty array.
  23981. *
  23982. * @static
  23983. * @memberOf _
  23984. * @since 4.13.0
  23985. * @category Util
  23986. * @returns {Array} Returns the new empty array.
  23987. * @example
  23988. *
  23989. * var arrays = _.times(2, _.stubArray);
  23990. *
  23991. * console.log(arrays);
  23992. * // => [[], []]
  23993. *
  23994. * console.log(arrays[0] === arrays[1]);
  23995. * // => false
  23996. */
  23997. function stubArray() {
  23998. return [];
  23999. }
  24000. /**
  24001. * This method returns `false`.
  24002. *
  24003. * @static
  24004. * @memberOf _
  24005. * @since 4.13.0
  24006. * @category Util
  24007. * @returns {boolean} Returns `false`.
  24008. * @example
  24009. *
  24010. * _.times(2, _.stubFalse);
  24011. * // => [false, false]
  24012. */
  24013. function stubFalse() {
  24014. return false;
  24015. }
  24016. /**
  24017. * This method returns a new empty object.
  24018. *
  24019. * @static
  24020. * @memberOf _
  24021. * @since 4.13.0
  24022. * @category Util
  24023. * @returns {Object} Returns the new empty object.
  24024. * @example
  24025. *
  24026. * var objects = _.times(2, _.stubObject);
  24027. *
  24028. * console.log(objects);
  24029. * // => [{}, {}]
  24030. *
  24031. * console.log(objects[0] === objects[1]);
  24032. * // => false
  24033. */
  24034. function stubObject() {
  24035. return {};
  24036. }
  24037. /**
  24038. * This method returns an empty string.
  24039. *
  24040. * @static
  24041. * @memberOf _
  24042. * @since 4.13.0
  24043. * @category Util
  24044. * @returns {string} Returns the empty string.
  24045. * @example
  24046. *
  24047. * _.times(2, _.stubString);
  24048. * // => ['', '']
  24049. */
  24050. function stubString() {
  24051. return '';
  24052. }
  24053. /**
  24054. * This method returns `true`.
  24055. *
  24056. * @static
  24057. * @memberOf _
  24058. * @since 4.13.0
  24059. * @category Util
  24060. * @returns {boolean} Returns `true`.
  24061. * @example
  24062. *
  24063. * _.times(2, _.stubTrue);
  24064. * // => [true, true]
  24065. */
  24066. function stubTrue() {
  24067. return true;
  24068. }
  24069. /**
  24070. * Invokes the iteratee `n` times, returning an array of the results of
  24071. * each invocation. The iteratee is invoked with one argument; (index).
  24072. *
  24073. * @static
  24074. * @since 0.1.0
  24075. * @memberOf _
  24076. * @category Util
  24077. * @param {number} n The number of times to invoke `iteratee`.
  24078. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24079. * @returns {Array} Returns the array of results.
  24080. * @example
  24081. *
  24082. * _.times(3, String);
  24083. * // => ['0', '1', '2']
  24084. *
  24085. * _.times(4, _.constant(0));
  24086. * // => [0, 0, 0, 0]
  24087. */
  24088. function times(n, iteratee) {
  24089. n = toInteger(n);
  24090. if (n < 1 || n > MAX_SAFE_INTEGER) {
  24091. return [];
  24092. }
  24093. var index = MAX_ARRAY_LENGTH,
  24094. length = nativeMin(n, MAX_ARRAY_LENGTH);
  24095. iteratee = getIteratee(iteratee);
  24096. n -= MAX_ARRAY_LENGTH;
  24097. var result = baseTimes(length, iteratee);
  24098. while (++index < n) {
  24099. iteratee(index);
  24100. }
  24101. return result;
  24102. }
  24103. /**
  24104. * Converts `value` to a property path array.
  24105. *
  24106. * @static
  24107. * @memberOf _
  24108. * @since 4.0.0
  24109. * @category Util
  24110. * @param {*} value The value to convert.
  24111. * @returns {Array} Returns the new property path array.
  24112. * @example
  24113. *
  24114. * _.toPath('a.b.c');
  24115. * // => ['a', 'b', 'c']
  24116. *
  24117. * _.toPath('a[0].b.c');
  24118. * // => ['a', '0', 'b', 'c']
  24119. */
  24120. function toPath(value) {
  24121. if (isArray(value)) {
  24122. return arrayMap(value, toKey);
  24123. }
  24124. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  24125. }
  24126. /**
  24127. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  24128. *
  24129. * @static
  24130. * @since 0.1.0
  24131. * @memberOf _
  24132. * @category Util
  24133. * @param {string} [prefix=''] The value to prefix the ID with.
  24134. * @returns {string} Returns the unique ID.
  24135. * @example
  24136. *
  24137. * _.uniqueId('contact_');
  24138. * // => 'contact_104'
  24139. *
  24140. * _.uniqueId();
  24141. * // => '105'
  24142. */
  24143. function uniqueId(prefix) {
  24144. var id = ++idCounter;
  24145. return toString(prefix) + id;
  24146. }
  24147. /*------------------------------------------------------------------------*/
  24148. /**
  24149. * Adds two numbers.
  24150. *
  24151. * @static
  24152. * @memberOf _
  24153. * @since 3.4.0
  24154. * @category Math
  24155. * @param {number} augend The first number in an addition.
  24156. * @param {number} addend The second number in an addition.
  24157. * @returns {number} Returns the total.
  24158. * @example
  24159. *
  24160. * _.add(6, 4);
  24161. * // => 10
  24162. */
  24163. var add = createMathOperation(function(augend, addend) {
  24164. return augend + addend;
  24165. }, 0);
  24166. /**
  24167. * Computes `number` rounded up to `precision`.
  24168. *
  24169. * @static
  24170. * @memberOf _
  24171. * @since 3.10.0
  24172. * @category Math
  24173. * @param {number} number The number to round up.
  24174. * @param {number} [precision=0] The precision to round up to.
  24175. * @returns {number} Returns the rounded up number.
  24176. * @example
  24177. *
  24178. * _.ceil(4.006);
  24179. * // => 5
  24180. *
  24181. * _.ceil(6.004, 2);
  24182. * // => 6.01
  24183. *
  24184. * _.ceil(6040, -2);
  24185. * // => 6100
  24186. */
  24187. var ceil = createRound('ceil');
  24188. /**
  24189. * Divide two numbers.
  24190. *
  24191. * @static
  24192. * @memberOf _
  24193. * @since 4.7.0
  24194. * @category Math
  24195. * @param {number} dividend The first number in a division.
  24196. * @param {number} divisor The second number in a division.
  24197. * @returns {number} Returns the quotient.
  24198. * @example
  24199. *
  24200. * _.divide(6, 4);
  24201. * // => 1.5
  24202. */
  24203. var divide = createMathOperation(function(dividend, divisor) {
  24204. return dividend / divisor;
  24205. }, 1);
  24206. /**
  24207. * Computes `number` rounded down to `precision`.
  24208. *
  24209. * @static
  24210. * @memberOf _
  24211. * @since 3.10.0
  24212. * @category Math
  24213. * @param {number} number The number to round down.
  24214. * @param {number} [precision=0] The precision to round down to.
  24215. * @returns {number} Returns the rounded down number.
  24216. * @example
  24217. *
  24218. * _.floor(4.006);
  24219. * // => 4
  24220. *
  24221. * _.floor(0.046, 2);
  24222. * // => 0.04
  24223. *
  24224. * _.floor(4060, -2);
  24225. * // => 4000
  24226. */
  24227. var floor = createRound('floor');
  24228. /**
  24229. * Computes the maximum value of `array`. If `array` is empty or falsey,
  24230. * `undefined` is returned.
  24231. *
  24232. * @static
  24233. * @since 0.1.0
  24234. * @memberOf _
  24235. * @category Math
  24236. * @param {Array} array The array to iterate over.
  24237. * @returns {*} Returns the maximum value.
  24238. * @example
  24239. *
  24240. * _.max([4, 2, 8, 6]);
  24241. * // => 8
  24242. *
  24243. * _.max([]);
  24244. * // => undefined
  24245. */
  24246. function max(array) {
  24247. return (array && array.length)
  24248. ? baseExtremum(array, identity, baseGt)
  24249. : undefined;
  24250. }
  24251. /**
  24252. * This method is like `_.max` except that it accepts `iteratee` which is
  24253. * invoked for each element in `array` to generate the criterion by which
  24254. * the value is ranked. The iteratee is invoked with one argument: (value).
  24255. *
  24256. * @static
  24257. * @memberOf _
  24258. * @since 4.0.0
  24259. * @category Math
  24260. * @param {Array} array The array to iterate over.
  24261. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24262. * @returns {*} Returns the maximum value.
  24263. * @example
  24264. *
  24265. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  24266. *
  24267. * _.maxBy(objects, function(o) { return o.n; });
  24268. * // => { 'n': 2 }
  24269. *
  24270. * // The `_.property` iteratee shorthand.
  24271. * _.maxBy(objects, 'n');
  24272. * // => { 'n': 2 }
  24273. */
  24274. function maxBy(array, iteratee) {
  24275. return (array && array.length)
  24276. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  24277. : undefined;
  24278. }
  24279. /**
  24280. * Computes the mean of the values in `array`.
  24281. *
  24282. * @static
  24283. * @memberOf _
  24284. * @since 4.0.0
  24285. * @category Math
  24286. * @param {Array} array The array to iterate over.
  24287. * @returns {number} Returns the mean.
  24288. * @example
  24289. *
  24290. * _.mean([4, 2, 8, 6]);
  24291. * // => 5
  24292. */
  24293. function mean(array) {
  24294. return baseMean(array, identity);
  24295. }
  24296. /**
  24297. * This method is like `_.mean` except that it accepts `iteratee` which is
  24298. * invoked for each element in `array` to generate the value to be averaged.
  24299. * The iteratee is invoked with one argument: (value).
  24300. *
  24301. * @static
  24302. * @memberOf _
  24303. * @since 4.7.0
  24304. * @category Math
  24305. * @param {Array} array The array to iterate over.
  24306. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24307. * @returns {number} Returns the mean.
  24308. * @example
  24309. *
  24310. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  24311. *
  24312. * _.meanBy(objects, function(o) { return o.n; });
  24313. * // => 5
  24314. *
  24315. * // The `_.property` iteratee shorthand.
  24316. * _.meanBy(objects, 'n');
  24317. * // => 5
  24318. */
  24319. function meanBy(array, iteratee) {
  24320. return baseMean(array, getIteratee(iteratee, 2));
  24321. }
  24322. /**
  24323. * Computes the minimum value of `array`. If `array` is empty or falsey,
  24324. * `undefined` is returned.
  24325. *
  24326. * @static
  24327. * @since 0.1.0
  24328. * @memberOf _
  24329. * @category Math
  24330. * @param {Array} array The array to iterate over.
  24331. * @returns {*} Returns the minimum value.
  24332. * @example
  24333. *
  24334. * _.min([4, 2, 8, 6]);
  24335. * // => 2
  24336. *
  24337. * _.min([]);
  24338. * // => undefined
  24339. */
  24340. function min(array) {
  24341. return (array && array.length)
  24342. ? baseExtremum(array, identity, baseLt)
  24343. : undefined;
  24344. }
  24345. /**
  24346. * This method is like `_.min` except that it accepts `iteratee` which is
  24347. * invoked for each element in `array` to generate the criterion by which
  24348. * the value is ranked. The iteratee is invoked with one argument: (value).
  24349. *
  24350. * @static
  24351. * @memberOf _
  24352. * @since 4.0.0
  24353. * @category Math
  24354. * @param {Array} array The array to iterate over.
  24355. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24356. * @returns {*} Returns the minimum value.
  24357. * @example
  24358. *
  24359. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  24360. *
  24361. * _.minBy(objects, function(o) { return o.n; });
  24362. * // => { 'n': 1 }
  24363. *
  24364. * // The `_.property` iteratee shorthand.
  24365. * _.minBy(objects, 'n');
  24366. * // => { 'n': 1 }
  24367. */
  24368. function minBy(array, iteratee) {
  24369. return (array && array.length)
  24370. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  24371. : undefined;
  24372. }
  24373. /**
  24374. * Multiply two numbers.
  24375. *
  24376. * @static
  24377. * @memberOf _
  24378. * @since 4.7.0
  24379. * @category Math
  24380. * @param {number} multiplier The first number in a multiplication.
  24381. * @param {number} multiplicand The second number in a multiplication.
  24382. * @returns {number} Returns the product.
  24383. * @example
  24384. *
  24385. * _.multiply(6, 4);
  24386. * // => 24
  24387. */
  24388. var multiply = createMathOperation(function(multiplier, multiplicand) {
  24389. return multiplier * multiplicand;
  24390. }, 1);
  24391. /**
  24392. * Computes `number` rounded to `precision`.
  24393. *
  24394. * @static
  24395. * @memberOf _
  24396. * @since 3.10.0
  24397. * @category Math
  24398. * @param {number} number The number to round.
  24399. * @param {number} [precision=0] The precision to round to.
  24400. * @returns {number} Returns the rounded number.
  24401. * @example
  24402. *
  24403. * _.round(4.006);
  24404. * // => 4
  24405. *
  24406. * _.round(4.006, 2);
  24407. * // => 4.01
  24408. *
  24409. * _.round(4060, -2);
  24410. * // => 4100
  24411. */
  24412. var round = createRound('round');
  24413. /**
  24414. * Subtract two numbers.
  24415. *
  24416. * @static
  24417. * @memberOf _
  24418. * @since 4.0.0
  24419. * @category Math
  24420. * @param {number} minuend The first number in a subtraction.
  24421. * @param {number} subtrahend The second number in a subtraction.
  24422. * @returns {number} Returns the difference.
  24423. * @example
  24424. *
  24425. * _.subtract(6, 4);
  24426. * // => 2
  24427. */
  24428. var subtract = createMathOperation(function(minuend, subtrahend) {
  24429. return minuend - subtrahend;
  24430. }, 0);
  24431. /**
  24432. * Computes the sum of the values in `array`.
  24433. *
  24434. * @static
  24435. * @memberOf _
  24436. * @since 3.4.0
  24437. * @category Math
  24438. * @param {Array} array The array to iterate over.
  24439. * @returns {number} Returns the sum.
  24440. * @example
  24441. *
  24442. * _.sum([4, 2, 8, 6]);
  24443. * // => 20
  24444. */
  24445. function sum(array) {
  24446. return (array && array.length)
  24447. ? baseSum(array, identity)
  24448. : 0;
  24449. }
  24450. /**
  24451. * This method is like `_.sum` except that it accepts `iteratee` which is
  24452. * invoked for each element in `array` to generate the value to be summed.
  24453. * The iteratee is invoked with one argument: (value).
  24454. *
  24455. * @static
  24456. * @memberOf _
  24457. * @since 4.0.0
  24458. * @category Math
  24459. * @param {Array} array The array to iterate over.
  24460. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24461. * @returns {number} Returns the sum.
  24462. * @example
  24463. *
  24464. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  24465. *
  24466. * _.sumBy(objects, function(o) { return o.n; });
  24467. * // => 20
  24468. *
  24469. * // The `_.property` iteratee shorthand.
  24470. * _.sumBy(objects, 'n');
  24471. * // => 20
  24472. */
  24473. function sumBy(array, iteratee) {
  24474. return (array && array.length)
  24475. ? baseSum(array, getIteratee(iteratee, 2))
  24476. : 0;
  24477. }
  24478. /*------------------------------------------------------------------------*/
  24479. // Add methods that return wrapped values in chain sequences.
  24480. lodash.after = after;
  24481. lodash.ary = ary;
  24482. lodash.assign = assign;
  24483. lodash.assignIn = assignIn;
  24484. lodash.assignInWith = assignInWith;
  24485. lodash.assignWith = assignWith;
  24486. lodash.at = at;
  24487. lodash.before = before;
  24488. lodash.bind = bind;
  24489. lodash.bindAll = bindAll;
  24490. lodash.bindKey = bindKey;
  24491. lodash.castArray = castArray;
  24492. lodash.chain = chain;
  24493. lodash.chunk = chunk;
  24494. lodash.compact = compact;
  24495. lodash.concat = concat;
  24496. lodash.cond = cond;
  24497. lodash.conforms = conforms;
  24498. lodash.constant = constant;
  24499. lodash.countBy = countBy;
  24500. lodash.create = create;
  24501. lodash.curry = curry;
  24502. lodash.curryRight = curryRight;
  24503. lodash.debounce = debounce;
  24504. lodash.defaults = defaults;
  24505. lodash.defaultsDeep = defaultsDeep;
  24506. lodash.defer = defer;
  24507. lodash.delay = delay;
  24508. lodash.difference = difference;
  24509. lodash.differenceBy = differenceBy;
  24510. lodash.differenceWith = differenceWith;
  24511. lodash.drop = drop;
  24512. lodash.dropRight = dropRight;
  24513. lodash.dropRightWhile = dropRightWhile;
  24514. lodash.dropWhile = dropWhile;
  24515. lodash.fill = fill;
  24516. lodash.filter = filter;
  24517. lodash.flatMap = flatMap;
  24518. lodash.flatMapDeep = flatMapDeep;
  24519. lodash.flatMapDepth = flatMapDepth;
  24520. lodash.flatten = flatten;
  24521. lodash.flattenDeep = flattenDeep;
  24522. lodash.flattenDepth = flattenDepth;
  24523. lodash.flip = flip;
  24524. lodash.flow = flow;
  24525. lodash.flowRight = flowRight;
  24526. lodash.fromPairs = fromPairs;
  24527. lodash.functions = functions;
  24528. lodash.functionsIn = functionsIn;
  24529. lodash.groupBy = groupBy;
  24530. lodash.initial = initial;
  24531. lodash.intersection = intersection;
  24532. lodash.intersectionBy = intersectionBy;
  24533. lodash.intersectionWith = intersectionWith;
  24534. lodash.invert = invert;
  24535. lodash.invertBy = invertBy;
  24536. lodash.invokeMap = invokeMap;
  24537. lodash.iteratee = iteratee;
  24538. lodash.keyBy = keyBy;
  24539. lodash.keys = keys;
  24540. lodash.keysIn = keysIn;
  24541. lodash.map = map;
  24542. lodash.mapKeys = mapKeys;
  24543. lodash.mapValues = mapValues;
  24544. lodash.matches = matches;
  24545. lodash.matchesProperty = matchesProperty;
  24546. lodash.memoize = memoize;
  24547. lodash.merge = merge;
  24548. lodash.mergeWith = mergeWith;
  24549. lodash.method = method;
  24550. lodash.methodOf = methodOf;
  24551. lodash.mixin = mixin;
  24552. lodash.negate = negate;
  24553. lodash.nthArg = nthArg;
  24554. lodash.omit = omit;
  24555. lodash.omitBy = omitBy;
  24556. lodash.once = once;
  24557. lodash.orderBy = orderBy;
  24558. lodash.over = over;
  24559. lodash.overArgs = overArgs;
  24560. lodash.overEvery = overEvery;
  24561. lodash.overSome = overSome;
  24562. lodash.partial = partial;
  24563. lodash.partialRight = partialRight;
  24564. lodash.partition = partition;
  24565. lodash.pick = pick;
  24566. lodash.pickBy = pickBy;
  24567. lodash.property = property;
  24568. lodash.propertyOf = propertyOf;
  24569. lodash.pull = pull;
  24570. lodash.pullAll = pullAll;
  24571. lodash.pullAllBy = pullAllBy;
  24572. lodash.pullAllWith = pullAllWith;
  24573. lodash.pullAt = pullAt;
  24574. lodash.range = range;
  24575. lodash.rangeRight = rangeRight;
  24576. lodash.rearg = rearg;
  24577. lodash.reject = reject;
  24578. lodash.remove = remove;
  24579. lodash.rest = rest;
  24580. lodash.reverse = reverse;
  24581. lodash.sampleSize = sampleSize;
  24582. lodash.set = set;
  24583. lodash.setWith = setWith;
  24584. lodash.shuffle = shuffle;
  24585. lodash.slice = slice;
  24586. lodash.sortBy = sortBy;
  24587. lodash.sortedUniq = sortedUniq;
  24588. lodash.sortedUniqBy = sortedUniqBy;
  24589. lodash.split = split;
  24590. lodash.spread = spread;
  24591. lodash.tail = tail;
  24592. lodash.take = take;
  24593. lodash.takeRight = takeRight;
  24594. lodash.takeRightWhile = takeRightWhile;
  24595. lodash.takeWhile = takeWhile;
  24596. lodash.tap = tap;
  24597. lodash.throttle = throttle;
  24598. lodash.thru = thru;
  24599. lodash.toArray = toArray;
  24600. lodash.toPairs = toPairs;
  24601. lodash.toPairsIn = toPairsIn;
  24602. lodash.toPath = toPath;
  24603. lodash.toPlainObject = toPlainObject;
  24604. lodash.transform = transform;
  24605. lodash.unary = unary;
  24606. lodash.union = union;
  24607. lodash.unionBy = unionBy;
  24608. lodash.unionWith = unionWith;
  24609. lodash.uniq = uniq;
  24610. lodash.uniqBy = uniqBy;
  24611. lodash.uniqWith = uniqWith;
  24612. lodash.unset = unset;
  24613. lodash.unzip = unzip;
  24614. lodash.unzipWith = unzipWith;
  24615. lodash.update = update;
  24616. lodash.updateWith = updateWith;
  24617. lodash.values = values;
  24618. lodash.valuesIn = valuesIn;
  24619. lodash.without = without;
  24620. lodash.words = words;
  24621. lodash.wrap = wrap;
  24622. lodash.xor = xor;
  24623. lodash.xorBy = xorBy;
  24624. lodash.xorWith = xorWith;
  24625. lodash.zip = zip;
  24626. lodash.zipObject = zipObject;
  24627. lodash.zipObjectDeep = zipObjectDeep;
  24628. lodash.zipWith = zipWith;
  24629. // Add aliases.
  24630. lodash.entries = toPairs;
  24631. lodash.entriesIn = toPairsIn;
  24632. lodash.extend = assignIn;
  24633. lodash.extendWith = assignInWith;
  24634. // Add methods to `lodash.prototype`.
  24635. mixin(lodash, lodash);
  24636. /*------------------------------------------------------------------------*/
  24637. // Add methods that return unwrapped values in chain sequences.
  24638. lodash.add = add;
  24639. lodash.attempt = attempt;
  24640. lodash.camelCase = camelCase;
  24641. lodash.capitalize = capitalize;
  24642. lodash.ceil = ceil;
  24643. lodash.clamp = clamp;
  24644. lodash.clone = clone;
  24645. lodash.cloneDeep = cloneDeep;
  24646. lodash.cloneDeepWith = cloneDeepWith;
  24647. lodash.cloneWith = cloneWith;
  24648. lodash.conformsTo = conformsTo;
  24649. lodash.deburr = deburr;
  24650. lodash.defaultTo = defaultTo;
  24651. lodash.divide = divide;
  24652. lodash.endsWith = endsWith;
  24653. lodash.eq = eq;
  24654. lodash.escape = escape;
  24655. lodash.escapeRegExp = escapeRegExp;
  24656. lodash.every = every;
  24657. lodash.find = find;
  24658. lodash.findIndex = findIndex;
  24659. lodash.findKey = findKey;
  24660. lodash.findLast = findLast;
  24661. lodash.findLastIndex = findLastIndex;
  24662. lodash.findLastKey = findLastKey;
  24663. lodash.floor = floor;
  24664. lodash.forEach = forEach;
  24665. lodash.forEachRight = forEachRight;
  24666. lodash.forIn = forIn;
  24667. lodash.forInRight = forInRight;
  24668. lodash.forOwn = forOwn;
  24669. lodash.forOwnRight = forOwnRight;
  24670. lodash.get = get;
  24671. lodash.gt = gt;
  24672. lodash.gte = gte;
  24673. lodash.has = has;
  24674. lodash.hasIn = hasIn;
  24675. lodash.head = head;
  24676. lodash.identity = identity;
  24677. lodash.includes = includes;
  24678. lodash.indexOf = indexOf;
  24679. lodash.inRange = inRange;
  24680. lodash.invoke = invoke;
  24681. lodash.isArguments = isArguments;
  24682. lodash.isArray = isArray;
  24683. lodash.isArrayBuffer = isArrayBuffer;
  24684. lodash.isArrayLike = isArrayLike;
  24685. lodash.isArrayLikeObject = isArrayLikeObject;
  24686. lodash.isBoolean = isBoolean;
  24687. lodash.isBuffer = isBuffer;
  24688. lodash.isDate = isDate;
  24689. lodash.isElement = isElement;
  24690. lodash.isEmpty = isEmpty;
  24691. lodash.isEqual = isEqual;
  24692. lodash.isEqualWith = isEqualWith;
  24693. lodash.isError = isError;
  24694. lodash.isFinite = isFinite;
  24695. lodash.isFunction = isFunction;
  24696. lodash.isInteger = isInteger;
  24697. lodash.isLength = isLength;
  24698. lodash.isMap = isMap;
  24699. lodash.isMatch = isMatch;
  24700. lodash.isMatchWith = isMatchWith;
  24701. lodash.isNaN = isNaN;
  24702. lodash.isNative = isNative;
  24703. lodash.isNil = isNil;
  24704. lodash.isNull = isNull;
  24705. lodash.isNumber = isNumber;
  24706. lodash.isObject = isObject;
  24707. lodash.isObjectLike = isObjectLike;
  24708. lodash.isPlainObject = isPlainObject;
  24709. lodash.isRegExp = isRegExp;
  24710. lodash.isSafeInteger = isSafeInteger;
  24711. lodash.isSet = isSet;
  24712. lodash.isString = isString;
  24713. lodash.isSymbol = isSymbol;
  24714. lodash.isTypedArray = isTypedArray;
  24715. lodash.isUndefined = isUndefined;
  24716. lodash.isWeakMap = isWeakMap;
  24717. lodash.isWeakSet = isWeakSet;
  24718. lodash.join = join;
  24719. lodash.kebabCase = kebabCase;
  24720. lodash.last = last;
  24721. lodash.lastIndexOf = lastIndexOf;
  24722. lodash.lowerCase = lowerCase;
  24723. lodash.lowerFirst = lowerFirst;
  24724. lodash.lt = lt;
  24725. lodash.lte = lte;
  24726. lodash.max = max;
  24727. lodash.maxBy = maxBy;
  24728. lodash.mean = mean;
  24729. lodash.meanBy = meanBy;
  24730. lodash.min = min;
  24731. lodash.minBy = minBy;
  24732. lodash.stubArray = stubArray;
  24733. lodash.stubFalse = stubFalse;
  24734. lodash.stubObject = stubObject;
  24735. lodash.stubString = stubString;
  24736. lodash.stubTrue = stubTrue;
  24737. lodash.multiply = multiply;
  24738. lodash.nth = nth;
  24739. lodash.noConflict = noConflict;
  24740. lodash.noop = noop;
  24741. lodash.now = now;
  24742. lodash.pad = pad;
  24743. lodash.padEnd = padEnd;
  24744. lodash.padStart = padStart;
  24745. lodash.parseInt = parseInt;
  24746. lodash.random = random;
  24747. lodash.reduce = reduce;
  24748. lodash.reduceRight = reduceRight;
  24749. lodash.repeat = repeat;
  24750. lodash.replace = replace;
  24751. lodash.result = result;
  24752. lodash.round = round;
  24753. lodash.runInContext = runInContext;
  24754. lodash.sample = sample;
  24755. lodash.size = size;
  24756. lodash.snakeCase = snakeCase;
  24757. lodash.some = some;
  24758. lodash.sortedIndex = sortedIndex;
  24759. lodash.sortedIndexBy = sortedIndexBy;
  24760. lodash.sortedIndexOf = sortedIndexOf;
  24761. lodash.sortedLastIndex = sortedLastIndex;
  24762. lodash.sortedLastIndexBy = sortedLastIndexBy;
  24763. lodash.sortedLastIndexOf = sortedLastIndexOf;
  24764. lodash.startCase = startCase;
  24765. lodash.startsWith = startsWith;
  24766. lodash.subtract = subtract;
  24767. lodash.sum = sum;
  24768. lodash.sumBy = sumBy;
  24769. lodash.template = template;
  24770. lodash.times = times;
  24771. lodash.toFinite = toFinite;
  24772. lodash.toInteger = toInteger;
  24773. lodash.toLength = toLength;
  24774. lodash.toLower = toLower;
  24775. lodash.toNumber = toNumber;
  24776. lodash.toSafeInteger = toSafeInteger;
  24777. lodash.toString = toString;
  24778. lodash.toUpper = toUpper;
  24779. lodash.trim = trim;
  24780. lodash.trimEnd = trimEnd;
  24781. lodash.trimStart = trimStart;
  24782. lodash.truncate = truncate;
  24783. lodash.unescape = unescape;
  24784. lodash.uniqueId = uniqueId;
  24785. lodash.upperCase = upperCase;
  24786. lodash.upperFirst = upperFirst;
  24787. // Add aliases.
  24788. lodash.each = forEach;
  24789. lodash.eachRight = forEachRight;
  24790. lodash.first = head;
  24791. mixin(lodash, (function() {
  24792. var source = {};
  24793. baseForOwn(lodash, function(func, methodName) {
  24794. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  24795. source[methodName] = func;
  24796. }
  24797. });
  24798. return source;
  24799. }()), { 'chain': false });
  24800. /*------------------------------------------------------------------------*/
  24801. /**
  24802. * The semantic version number.
  24803. *
  24804. * @static
  24805. * @memberOf _
  24806. * @type {string}
  24807. */
  24808. lodash.VERSION = VERSION;
  24809. // Assign default placeholders.
  24810. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  24811. lodash[methodName].placeholder = lodash;
  24812. });
  24813. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  24814. arrayEach(['drop', 'take'], function(methodName, index) {
  24815. LazyWrapper.prototype[methodName] = function(n) {
  24816. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  24817. var result = (this.__filtered__ && !index)
  24818. ? new LazyWrapper(this)
  24819. : this.clone();
  24820. if (result.__filtered__) {
  24821. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  24822. } else {
  24823. result.__views__.push({
  24824. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  24825. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  24826. });
  24827. }
  24828. return result;
  24829. };
  24830. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  24831. return this.reverse()[methodName](n).reverse();
  24832. };
  24833. });
  24834. // Add `LazyWrapper` methods that accept an `iteratee` value.
  24835. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  24836. var type = index + 1,
  24837. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  24838. LazyWrapper.prototype[methodName] = function(iteratee) {
  24839. var result = this.clone();
  24840. result.__iteratees__.push({
  24841. 'iteratee': getIteratee(iteratee, 3),
  24842. 'type': type
  24843. });
  24844. result.__filtered__ = result.__filtered__ || isFilter;
  24845. return result;
  24846. };
  24847. });
  24848. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  24849. arrayEach(['head', 'last'], function(methodName, index) {
  24850. var takeName = 'take' + (index ? 'Right' : '');
  24851. LazyWrapper.prototype[methodName] = function() {
  24852. return this[takeName](1).value()[0];
  24853. };
  24854. });
  24855. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  24856. arrayEach(['initial', 'tail'], function(methodName, index) {
  24857. var dropName = 'drop' + (index ? '' : 'Right');
  24858. LazyWrapper.prototype[methodName] = function() {
  24859. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  24860. };
  24861. });
  24862. LazyWrapper.prototype.compact = function() {
  24863. return this.filter(identity);
  24864. };
  24865. LazyWrapper.prototype.find = function(predicate) {
  24866. return this.filter(predicate).head();
  24867. };
  24868. LazyWrapper.prototype.findLast = function(predicate) {
  24869. return this.reverse().find(predicate);
  24870. };
  24871. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  24872. if (typeof path == 'function') {
  24873. return new LazyWrapper(this);
  24874. }
  24875. return this.map(function(value) {
  24876. return baseInvoke(value, path, args);
  24877. });
  24878. });
  24879. LazyWrapper.prototype.reject = function(predicate) {
  24880. return this.filter(negate(getIteratee(predicate)));
  24881. };
  24882. LazyWrapper.prototype.slice = function(start, end) {
  24883. start = toInteger(start);
  24884. var result = this;
  24885. if (result.__filtered__ && (start > 0 || end < 0)) {
  24886. return new LazyWrapper(result);
  24887. }
  24888. if (start < 0) {
  24889. result = result.takeRight(-start);
  24890. } else if (start) {
  24891. result = result.drop(start);
  24892. }
  24893. if (end !== undefined) {
  24894. end = toInteger(end);
  24895. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  24896. }
  24897. return result;
  24898. };
  24899. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  24900. return this.reverse().takeWhile(predicate).reverse();
  24901. };
  24902. LazyWrapper.prototype.toArray = function() {
  24903. return this.take(MAX_ARRAY_LENGTH);
  24904. };
  24905. // Add `LazyWrapper` methods to `lodash.prototype`.
  24906. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  24907. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  24908. isTaker = /^(?:head|last)$/.test(methodName),
  24909. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  24910. retUnwrapped = isTaker || /^find/.test(methodName);
  24911. if (!lodashFunc) {
  24912. return;
  24913. }
  24914. lodash.prototype[methodName] = function() {
  24915. var value = this.__wrapped__,
  24916. args = isTaker ? [1] : arguments,
  24917. isLazy = value instanceof LazyWrapper,
  24918. iteratee = args[0],
  24919. useLazy = isLazy || isArray(value);
  24920. var interceptor = function(value) {
  24921. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  24922. return (isTaker && chainAll) ? result[0] : result;
  24923. };
  24924. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  24925. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  24926. isLazy = useLazy = false;
  24927. }
  24928. var chainAll = this.__chain__,
  24929. isHybrid = !!this.__actions__.length,
  24930. isUnwrapped = retUnwrapped && !chainAll,
  24931. onlyLazy = isLazy && !isHybrid;
  24932. if (!retUnwrapped && useLazy) {
  24933. value = onlyLazy ? value : new LazyWrapper(this);
  24934. var result = func.apply(value, args);
  24935. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  24936. return new LodashWrapper(result, chainAll);
  24937. }
  24938. if (isUnwrapped && onlyLazy) {
  24939. return func.apply(this, args);
  24940. }
  24941. result = this.thru(interceptor);
  24942. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  24943. };
  24944. });
  24945. // Add `Array` methods to `lodash.prototype`.
  24946. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  24947. var func = arrayProto[methodName],
  24948. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  24949. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  24950. lodash.prototype[methodName] = function() {
  24951. var args = arguments;
  24952. if (retUnwrapped && !this.__chain__) {
  24953. var value = this.value();
  24954. return func.apply(isArray(value) ? value : [], args);
  24955. }
  24956. return this[chainName](function(value) {
  24957. return func.apply(isArray(value) ? value : [], args);
  24958. });
  24959. };
  24960. });
  24961. // Map minified method names to their real names.
  24962. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  24963. var lodashFunc = lodash[methodName];
  24964. if (lodashFunc) {
  24965. var key = (lodashFunc.name + ''),
  24966. names = realNames[key] || (realNames[key] = []);
  24967. names.push({ 'name': methodName, 'func': lodashFunc });
  24968. }
  24969. });
  24970. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  24971. 'name': 'wrapper',
  24972. 'func': undefined
  24973. }];
  24974. // Add methods to `LazyWrapper`.
  24975. LazyWrapper.prototype.clone = lazyClone;
  24976. LazyWrapper.prototype.reverse = lazyReverse;
  24977. LazyWrapper.prototype.value = lazyValue;
  24978. // Add chain sequence methods to the `lodash` wrapper.
  24979. lodash.prototype.at = wrapperAt;
  24980. lodash.prototype.chain = wrapperChain;
  24981. lodash.prototype.commit = wrapperCommit;
  24982. lodash.prototype.next = wrapperNext;
  24983. lodash.prototype.plant = wrapperPlant;
  24984. lodash.prototype.reverse = wrapperReverse;
  24985. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  24986. // Add lazy aliases.
  24987. lodash.prototype.first = lodash.prototype.head;
  24988. if (symIterator) {
  24989. lodash.prototype[symIterator] = wrapperToIterator;
  24990. }
  24991. return lodash;
  24992. });
  24993. /*--------------------------------------------------------------------------*/
  24994. // Export lodash.
  24995. var _ = runInContext();
  24996. // Some AMD build optimizers, like r.js, check for condition patterns like:
  24997. if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
  24998. // Expose Lodash on the global object to prevent errors when Lodash is
  24999. // loaded by a script tag in the presence of an AMD loader.
  25000. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  25001. // Use `_.noConflict` to remove Lodash from the global object.
  25002. root._ = _;
  25003. // Define as an anonymous module so, through path mapping, it can be
  25004. // referenced as the "underscore" module.
  25005. define(function() {
  25006. return _;
  25007. });
  25008. }
  25009. // Check for `exports` after `define` in case a build optimizer adds it.
  25010. else if (freeModule) {
  25011. // Export for Node.js.
  25012. (freeModule.exports = _)._ = _;
  25013. // Export for CommonJS support.
  25014. freeExports._ = _;
  25015. }
  25016. else {
  25017. // Export to the global object.
  25018. root._ = _;
  25019. }
  25020. }.call(this));
  25021. });
  25022. return ___scope___.entry = "lodash.js";
  25023. });
  25024. FuseBox.pkg("sticky-js", {}, function(___scope___){
  25025. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  25026. var Sticky = require('./dist/sticky.compile.js');
  25027. module.exports = Sticky;
  25028. });
  25029. ___scope___.file("dist/sticky.compile.js", function(exports, require, module, __filename, __dirname){
  25030. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  25031. /**
  25032. * Sticky.js
  25033. * Library for sticky elements written in vanilla javascript. With this library you can easily set sticky elements on your website. It's also responsive.
  25034. *
  25035. * @version 1.1.9
  25036. * @author Rafal Galus <biuro@rafalgalus.pl>
  25037. * @website https://rgalus.github.io/sticky-js/
  25038. * @repo https://github.com/rgalus/sticky-js
  25039. * @license https://github.com/rgalus/sticky-js/blob/master/LICENSE
  25040. */
  25041. var Sticky = function () {
  25042. /**
  25043. * Sticky instance constructor
  25044. * @constructor
  25045. * @param {string} selector - Selector which we can find elements
  25046. * @param {string} options - Global options for sticky elements (could be overwritten by data-{option}="" attributes)
  25047. */
  25048. function Sticky() {
  25049. var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  25050. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  25051. _classCallCheck(this, Sticky);
  25052. this.selector = selector;
  25053. this.elements = [];
  25054. this.version = '1.1.9';
  25055. this.vp = this.getViewportSize();
  25056. this.scrollTop = this.getScrollTopPosition();
  25057. this.body = document.querySelector('body');
  25058. this.options = {
  25059. wrap: options.wrap || false,
  25060. marginTop: options.marginTop || 0,
  25061. stickyFor: options.stickyFor || 0,
  25062. stickyClass: options.stickyClass || null,
  25063. stickyContainer: options.stickyContainer || 'body'
  25064. };
  25065. this.run();
  25066. }
  25067. /**
  25068. * Function that waits for page to be fully loaded and then renders & activates every sticky element found with specified selector
  25069. * @function
  25070. */
  25071. Sticky.prototype.run = function run() {
  25072. var _this = this;
  25073. // wait for page to be fully loaded
  25074. var pageLoaded = setInterval(function () {
  25075. if (document.readyState === 'complete') {
  25076. clearInterval(pageLoaded);
  25077. var elements = document.querySelectorAll(_this.selector);
  25078. _this.forEach(elements, function (element) {
  25079. return _this.renderElement(element);
  25080. });
  25081. }
  25082. }, 10);
  25083. };
  25084. /**
  25085. * Function that assign needed variables for sticky element, that are used in future for calculations and other
  25086. * @function
  25087. * @param {node} element - Element to be rendered
  25088. */
  25089. Sticky.prototype.renderElement = function renderElement(element) {
  25090. var _this2 = this;
  25091. // create container for variables needed in future
  25092. element.sticky = {};
  25093. // set default variables
  25094. element.sticky.active = false;
  25095. element.sticky.marginTop = parseInt(element.getAttribute('data-margin-top')) || this.options.marginTop;
  25096. element.sticky.stickyFor = parseInt(element.getAttribute('data-sticky-for')) || this.options.stickyFor;
  25097. element.sticky.stickyClass = element.getAttribute('data-sticky-class') || this.options.stickyClass;
  25098. element.sticky.wrap = element.hasAttribute('data-sticky-wrap') ? true : this.options.wrap;
  25099. // @todo attribute for stickyContainer
  25100. // element.sticky.stickyContainer = element.getAttribute('data-sticky-container') || this.options.stickyContainer;
  25101. element.sticky.stickyContainer = this.options.stickyContainer;
  25102. element.sticky.container = this.getStickyContainer(element);
  25103. element.sticky.container.rect = this.getRectangle(element.sticky.container);
  25104. element.sticky.rect = this.getRectangle(element);
  25105. // fix when element is image that has not yet loaded and width, height = 0
  25106. if (element.tagName.toLowerCase() === 'img') {
  25107. element.onload = function () {
  25108. return element.sticky.rect = _this2.getRectangle(element);
  25109. };
  25110. }
  25111. if (element.sticky.wrap) {
  25112. this.wrapElement(element);
  25113. }
  25114. // activate rendered element
  25115. this.activate(element);
  25116. };
  25117. /**
  25118. * Wraps element into placeholder element
  25119. * @function
  25120. * @param {node} element - Element to be wrapped
  25121. */
  25122. Sticky.prototype.wrapElement = function wrapElement(element) {
  25123. element.insertAdjacentHTML('beforebegin', '<span></span>');
  25124. element.previousSibling.appendChild(element);
  25125. };
  25126. /**
  25127. * Function that activates element when specified conditions are met and then initalise events
  25128. * @function
  25129. * @param {node} element - Element to be activated
  25130. */
  25131. Sticky.prototype.activate = function activate(element) {
  25132. if (element.sticky.rect.top + element.sticky.rect.height < element.sticky.container.rect.top + element.sticky.container.rect.height && element.sticky.stickyFor < this.vp.width && !element.sticky.active) {
  25133. element.sticky.active = true;
  25134. }
  25135. if (this.elements.indexOf(element) < 0) {
  25136. this.elements.push(element);
  25137. }
  25138. if (!element.sticky.resizeEvent) {
  25139. this.initResizeEvents(element);
  25140. element.sticky.resizeEvent = true;
  25141. }
  25142. if (!element.sticky.scrollEvent) {
  25143. this.initScrollEvents(element);
  25144. element.sticky.scrollEvent = true;
  25145. }
  25146. this.setPosition(element);
  25147. };
  25148. /**
  25149. * Function which is adding onResizeEvents to window listener and assigns function to element as resizeListener
  25150. * @function
  25151. * @param {node} element - Element for which resize events are initialised
  25152. */
  25153. Sticky.prototype.initResizeEvents = function initResizeEvents(element) {
  25154. var _this3 = this;
  25155. element.sticky.resizeListener = function () {
  25156. return _this3.onResizeEvents(element);
  25157. };
  25158. window.addEventListener('resize', element.sticky.resizeListener);
  25159. };
  25160. /**
  25161. * Removes element listener from resize event
  25162. * @function
  25163. * @param {node} element - Element from which listener is deleted
  25164. */
  25165. Sticky.prototype.destroyResizeEvents = function destroyResizeEvents(element) {
  25166. window.removeEventListener('resize', element.sticky.resizeListener);
  25167. };
  25168. /**
  25169. * Function which is fired when user resize window. It checks if element should be activated or deactivated and then run setPosition function
  25170. * @function
  25171. * @param {node} element - Element for which event function is fired
  25172. */
  25173. Sticky.prototype.onResizeEvents = function onResizeEvents(element) {
  25174. this.vp = this.getViewportSize();
  25175. element.sticky.rect = this.getRectangle(element);
  25176. element.sticky.container.rect = this.getRectangle(element.sticky.container);
  25177. if (element.sticky.rect.top + element.sticky.rect.height < element.sticky.container.rect.top + element.sticky.container.rect.height && element.sticky.stickyFor < this.vp.width && !element.sticky.active) {
  25178. element.sticky.active = true;
  25179. } else if (element.sticky.rect.top + element.sticky.rect.height >= element.sticky.container.rect.top + element.sticky.container.rect.height || element.sticky.stickyFor >= this.vp.width && element.sticky.active) {
  25180. element.sticky.active = false;
  25181. }
  25182. this.setPosition(element);
  25183. };
  25184. /**
  25185. * Function which is adding onScrollEvents to window listener and assigns function to element as scrollListener
  25186. * @function
  25187. * @param {node} element - Element for which scroll events are initialised
  25188. */
  25189. Sticky.prototype.initScrollEvents = function initScrollEvents(element) {
  25190. var _this4 = this;
  25191. element.sticky.scrollListener = function () {
  25192. return _this4.onScrollEvents(element);
  25193. };
  25194. window.addEventListener('scroll', element.sticky.scrollListener);
  25195. };
  25196. /**
  25197. * Removes element listener from scroll event
  25198. * @function
  25199. * @param {node} element - Element from which listener is deleted
  25200. */
  25201. Sticky.prototype.destroyScrollEvents = function destroyScrollEvents(element) {
  25202. window.removeEventListener('scroll', element.sticky.scrollListener);
  25203. };
  25204. /**
  25205. * Function which is fired when user scroll window. If element is active, function is invoking setPosition function
  25206. * @function
  25207. * @param {node} element - Element for which event function is fired
  25208. */
  25209. Sticky.prototype.onScrollEvents = function onScrollEvents(element) {
  25210. this.scrollTop = this.getScrollTopPosition();
  25211. if (element.sticky.active) {
  25212. this.setPosition(element);
  25213. }
  25214. };
  25215. /**
  25216. * Main function for the library. Here are some condition calculations and css appending for sticky element when user scroll window
  25217. * @function
  25218. * @param {node} element - Element that will be positioned if it's active
  25219. */
  25220. Sticky.prototype.setPosition = function setPosition(element) {
  25221. this.css(element, { position: '', width: '', top: '', left: '' });
  25222. if (this.vp.height < element.sticky.rect.height || !element.sticky.active) {
  25223. return;
  25224. }
  25225. if (!element.sticky.rect.width) {
  25226. element.sticky.rect = this.getRectangle(element);
  25227. }
  25228. if (element.sticky.wrap) {
  25229. this.css(element.parentNode, {
  25230. display: 'block',
  25231. width: element.sticky.rect.width + 'px',
  25232. height: element.sticky.rect.height + 'px'
  25233. });
  25234. }
  25235. if (element.sticky.rect.top === 0 && element.sticky.container === this.body) {
  25236. this.css(element, {
  25237. position: 'fixed',
  25238. top: element.sticky.rect.top + 'px',
  25239. left: element.sticky.rect.left + 'px',
  25240. width: element.sticky.rect.width + 'px'
  25241. });
  25242. } else if (this.scrollTop > element.sticky.rect.top - element.sticky.marginTop) {
  25243. this.css(element, {
  25244. position: 'fixed',
  25245. width: element.sticky.rect.width + 'px',
  25246. left: element.sticky.rect.left + 'px'
  25247. });
  25248. if (this.scrollTop + element.sticky.rect.height + element.sticky.marginTop > element.sticky.container.rect.top + element.sticky.container.offsetHeight) {
  25249. if (element.sticky.stickyClass) {
  25250. element.classList.remove(element.sticky.stickyClass);
  25251. }
  25252. this.css(element, {
  25253. top: element.sticky.container.rect.top + element.sticky.container.offsetHeight - (this.scrollTop + element.sticky.rect.height) + 'px' });
  25254. } else {
  25255. if (element.sticky.stickyClass) {
  25256. element.classList.add(element.sticky.stickyClass);
  25257. }
  25258. this.css(element, { top: element.sticky.marginTop + 'px' });
  25259. }
  25260. } else {
  25261. if (element.sticky.stickyClass) {
  25262. element.classList.remove(element.sticky.stickyClass);
  25263. }
  25264. this.css(element, { position: '', width: '', top: '', left: '' });
  25265. if (element.sticky.wrap) {
  25266. this.css(element.parentNode, { display: '', width: '', height: '' });
  25267. }
  25268. }
  25269. };
  25270. /**
  25271. * Function that updates element sticky rectangle (with sticky container), then activate or deactivate element, then update position if it's active
  25272. * @function
  25273. */
  25274. Sticky.prototype.update = function update() {
  25275. var _this5 = this;
  25276. this.forEach(this.elements, function (element) {
  25277. element.sticky.rect = _this5.getRectangle(element);
  25278. element.sticky.container.rect = _this5.getRectangle(element.sticky.container);
  25279. _this5.activate(element);
  25280. _this5.setPosition(element);
  25281. });
  25282. };
  25283. /**
  25284. * Destroys sticky element, remove listeners
  25285. * @function
  25286. */
  25287. Sticky.prototype.destroy = function destroy() {
  25288. var _this6 = this;
  25289. this.forEach(this.elements, function (element) {
  25290. _this6.destroyResizeEvents(element);
  25291. _this6.destroyScrollEvents(element);
  25292. delete element.sticky;
  25293. });
  25294. };
  25295. /**
  25296. * Function that returns container element in which sticky element is stuck (if is not specified, then it's stuck to body)
  25297. * @function
  25298. * @param {node} element - Element which sticky container are looked for
  25299. * @return {node} element - Sticky container
  25300. */
  25301. Sticky.prototype.getStickyContainer = function getStickyContainer(element) {
  25302. var container = element.parentNode;
  25303. while (!container.hasAttribute('data-sticky-container') && !container.parentNode.querySelector(element.sticky.stickyContainer) && container !== this.body) {
  25304. container = container.parentNode;
  25305. }
  25306. return container;
  25307. };
  25308. /**
  25309. * Function that returns element rectangle & position (width, height, top, left)
  25310. * @function
  25311. * @param {node} element - Element which position & rectangle are returned
  25312. * @return {object}
  25313. */
  25314. Sticky.prototype.getRectangle = function getRectangle(element) {
  25315. this.css(element, { position: '', width: '', top: '', left: '' });
  25316. var width = Math.max(element.offsetWidth, element.clientWidth, element.scrollWidth);
  25317. var height = Math.max(element.offsetHeight, element.clientHeight, element.scrollHeight);
  25318. var top = 0;
  25319. var left = 0;
  25320. do {
  25321. top += element.offsetTop || 0;
  25322. left += element.offsetLeft || 0;
  25323. element = element.offsetParent;
  25324. } while (element);
  25325. return { top: top, left: left, width: width, height: height };
  25326. };
  25327. /**
  25328. * Function that returns viewport dimensions
  25329. * @function
  25330. * @return {object}
  25331. */
  25332. Sticky.prototype.getViewportSize = function getViewportSize() {
  25333. return {
  25334. width: Math.max(document.documentElement.clientWidth, window.innerWidth || 0),
  25335. height: Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
  25336. };
  25337. };
  25338. /**
  25339. * Function that returns scroll position offset from top
  25340. * @function
  25341. * @return {number}
  25342. */
  25343. Sticky.prototype.getScrollTopPosition = function getScrollTopPosition() {
  25344. return (window.pageYOffset || document.scrollTop) - (document.clientTop || 0) || 0;
  25345. };
  25346. /**
  25347. * Helper function for loops
  25348. * @helper
  25349. * @param {array}
  25350. * @param {function} callback - Callback function (no need for explanation)
  25351. */
  25352. Sticky.prototype.forEach = function forEach(array, callback) {
  25353. for (var i = 0, len = array.length; i < len; i++) {
  25354. callback(array[i]);
  25355. }
  25356. };
  25357. /**
  25358. * Helper function to add/remove css properties for specified element.
  25359. * @helper
  25360. * @param {node} element - DOM element
  25361. * @param {object} properties - CSS properties that will be added/removed from specified element
  25362. */
  25363. Sticky.prototype.css = function css(element, properties) {
  25364. for (var property in properties) {
  25365. if (properties.hasOwnProperty(property)) {
  25366. element.style[property] = properties[property];
  25367. }
  25368. }
  25369. };
  25370. return Sticky;
  25371. }();
  25372. /**
  25373. * Export function that supports AMD, CommonJS and Plain Browser.
  25374. */
  25375. (function (root, factory) {
  25376. if (typeof exports !== 'undefined') {
  25377. module.exports = factory;
  25378. } else if (typeof define === 'function' && define.amd) {
  25379. define([], factory);
  25380. } else {
  25381. root.Sticky = factory;
  25382. }
  25383. })(this, Sticky);
  25384. });
  25385. return ___scope___.entry = "index.js";
  25386. });
  25387. FuseBox.pkg("socket.io-client", {"debug":"2.3.3","component-emitter":"1.2.1"}, function(___scope___){
  25388. ___scope___.file("lib/index.js", function(exports, require, module, __filename, __dirname){
  25389. /**
  25390. * Module dependencies.
  25391. */
  25392. var url = require('./url');
  25393. var parser = require('socket.io-parser');
  25394. var Manager = require('./manager');
  25395. var debug = require('debug')('socket.io-client');
  25396. /**
  25397. * Module exports.
  25398. */
  25399. module.exports = exports = lookup;
  25400. /**
  25401. * Managers cache.
  25402. */
  25403. var cache = exports.managers = {};
  25404. /**
  25405. * Looks up an existing `Manager` for multiplexing.
  25406. * If the user summons:
  25407. *
  25408. * `io('http://localhost/a');`
  25409. * `io('http://localhost/b');`
  25410. *
  25411. * We reuse the existing instance based on same scheme/port/host,
  25412. * and we initialize sockets for each namespace.
  25413. *
  25414. * @api public
  25415. */
  25416. function lookup (uri, opts) {
  25417. if (typeof uri === 'object') {
  25418. opts = uri;
  25419. uri = undefined;
  25420. }
  25421. opts = opts || {};
  25422. var parsed = url(uri);
  25423. var source = parsed.source;
  25424. var id = parsed.id;
  25425. var path = parsed.path;
  25426. var sameNamespace = cache[id] && path in cache[id].nsps;
  25427. var newConnection = opts.forceNew || opts['force new connection'] ||
  25428. false === opts.multiplex || sameNamespace;
  25429. var io;
  25430. if (newConnection) {
  25431. debug('ignoring socket cache for %s', source);
  25432. io = Manager(source, opts);
  25433. } else {
  25434. if (!cache[id]) {
  25435. debug('new io instance for %s', source);
  25436. cache[id] = Manager(source, opts);
  25437. }
  25438. io = cache[id];
  25439. }
  25440. if (parsed.query && !opts.query) {
  25441. opts.query = parsed.query;
  25442. } else if (opts && 'object' === typeof opts.query) {
  25443. opts.query = encodeQueryString(opts.query);
  25444. }
  25445. return io.socket(parsed.path, opts);
  25446. }
  25447. /**
  25448. * Helper method to parse query objects to string.
  25449. * @param {object} query
  25450. * @returns {string}
  25451. */
  25452. function encodeQueryString (obj) {
  25453. var str = [];
  25454. for (var p in obj) {
  25455. if (obj.hasOwnProperty(p)) {
  25456. str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]));
  25457. }
  25458. }
  25459. return str.join('&');
  25460. }
  25461. /**
  25462. * Protocol version.
  25463. *
  25464. * @api public
  25465. */
  25466. exports.protocol = parser.protocol;
  25467. /**
  25468. * `connect`.
  25469. *
  25470. * @param {String} uri
  25471. * @api public
  25472. */
  25473. exports.connect = lookup;
  25474. /**
  25475. * Expose constructors for standalone build.
  25476. *
  25477. * @api public
  25478. */
  25479. exports.Manager = require('./manager');
  25480. exports.Socket = require('./socket');
  25481. });
  25482. ___scope___.file("lib/url.js", function(exports, require, module, __filename, __dirname){
  25483. /**
  25484. * Module dependencies.
  25485. */
  25486. var parseuri = require('parseuri');
  25487. var debug = require('debug')('socket.io-client:url');
  25488. /**
  25489. * Module exports.
  25490. */
  25491. module.exports = url;
  25492. /**
  25493. * URL parser.
  25494. *
  25495. * @param {String} url
  25496. * @param {Object} An object meant to mimic window.location.
  25497. * Defaults to window.location.
  25498. * @api public
  25499. */
  25500. function url (uri, loc) {
  25501. var obj = uri;
  25502. // default to window.location
  25503. loc = loc || global.location;
  25504. if (null == uri) uri = loc.protocol + '//' + loc.host;
  25505. // relative path support
  25506. if ('string' === typeof uri) {
  25507. if ('/' === uri.charAt(0)) {
  25508. if ('/' === uri.charAt(1)) {
  25509. uri = loc.protocol + uri;
  25510. } else {
  25511. uri = loc.host + uri;
  25512. }
  25513. }
  25514. if (!/^(https?|wss?):\/\//.test(uri)) {
  25515. debug('protocol-less url %s', uri);
  25516. if ('undefined' !== typeof loc) {
  25517. uri = loc.protocol + '//' + uri;
  25518. } else {
  25519. uri = 'https://' + uri;
  25520. }
  25521. }
  25522. // parse
  25523. debug('parse %s', uri);
  25524. obj = parseuri(uri);
  25525. }
  25526. // make sure we treat `localhost:80` and `localhost` equally
  25527. if (!obj.port) {
  25528. if (/^(http|ws)$/.test(obj.protocol)) {
  25529. obj.port = '80';
  25530. } else if (/^(http|ws)s$/.test(obj.protocol)) {
  25531. obj.port = '443';
  25532. }
  25533. }
  25534. obj.path = obj.path || '/';
  25535. var ipv6 = obj.host.indexOf(':') !== -1;
  25536. var host = ipv6 ? '[' + obj.host + ']' : obj.host;
  25537. // define unique id
  25538. obj.id = obj.protocol + '://' + host + ':' + obj.port;
  25539. // define href
  25540. obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));
  25541. return obj;
  25542. }
  25543. });
  25544. ___scope___.file("lib/manager.js", function(exports, require, module, __filename, __dirname){
  25545. /**
  25546. * Module dependencies.
  25547. */
  25548. var eio = require('engine.io-client');
  25549. var Socket = require('./socket');
  25550. var Emitter = require('component-emitter');
  25551. var parser = require('socket.io-parser');
  25552. var on = require('./on');
  25553. var bind = require('component-bind');
  25554. var debug = require('debug')('socket.io-client:manager');
  25555. var indexOf = require('indexof');
  25556. var Backoff = require('backo2');
  25557. /**
  25558. * IE6+ hasOwnProperty
  25559. */
  25560. var has = Object.prototype.hasOwnProperty;
  25561. /**
  25562. * Module exports
  25563. */
  25564. module.exports = Manager;
  25565. /**
  25566. * `Manager` constructor.
  25567. *
  25568. * @param {String} engine instance or engine uri/opts
  25569. * @param {Object} options
  25570. * @api public
  25571. */
  25572. function Manager (uri, opts) {
  25573. if (!(this instanceof Manager)) return new Manager(uri, opts);
  25574. if (uri && ('object' === typeof uri)) {
  25575. opts = uri;
  25576. uri = undefined;
  25577. }
  25578. opts = opts || {};
  25579. opts.path = opts.path || '/socket.io';
  25580. this.nsps = {};
  25581. this.subs = [];
  25582. this.opts = opts;
  25583. this.reconnection(opts.reconnection !== false);
  25584. this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
  25585. this.reconnectionDelay(opts.reconnectionDelay || 1000);
  25586. this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
  25587. this.randomizationFactor(opts.randomizationFactor || 0.5);
  25588. this.backoff = new Backoff({
  25589. min: this.reconnectionDelay(),
  25590. max: this.reconnectionDelayMax(),
  25591. jitter: this.randomizationFactor()
  25592. });
  25593. this.timeout(null == opts.timeout ? 20000 : opts.timeout);
  25594. this.readyState = 'closed';
  25595. this.uri = uri;
  25596. this.connecting = [];
  25597. this.lastPing = null;
  25598. this.encoding = false;
  25599. this.packetBuffer = [];
  25600. this.encoder = new parser.Encoder();
  25601. this.decoder = new parser.Decoder();
  25602. this.autoConnect = opts.autoConnect !== false;
  25603. if (this.autoConnect) this.open();
  25604. }
  25605. /**
  25606. * Propagate given event to sockets and emit on `this`
  25607. *
  25608. * @api private
  25609. */
  25610. Manager.prototype.emitAll = function () {
  25611. this.emit.apply(this, arguments);
  25612. for (var nsp in this.nsps) {
  25613. if (has.call(this.nsps, nsp)) {
  25614. this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
  25615. }
  25616. }
  25617. };
  25618. /**
  25619. * Update `socket.id` of all sockets
  25620. *
  25621. * @api private
  25622. */
  25623. Manager.prototype.updateSocketIds = function () {
  25624. for (var nsp in this.nsps) {
  25625. if (has.call(this.nsps, nsp)) {
  25626. this.nsps[nsp].id = this.engine.id;
  25627. }
  25628. }
  25629. };
  25630. /**
  25631. * Mix in `Emitter`.
  25632. */
  25633. Emitter(Manager.prototype);
  25634. /**
  25635. * Sets the `reconnection` config.
  25636. *
  25637. * @param {Boolean} true/false if it should automatically reconnect
  25638. * @return {Manager} self or value
  25639. * @api public
  25640. */
  25641. Manager.prototype.reconnection = function (v) {
  25642. if (!arguments.length) return this._reconnection;
  25643. this._reconnection = !!v;
  25644. return this;
  25645. };
  25646. /**
  25647. * Sets the reconnection attempts config.
  25648. *
  25649. * @param {Number} max reconnection attempts before giving up
  25650. * @return {Manager} self or value
  25651. * @api public
  25652. */
  25653. Manager.prototype.reconnectionAttempts = function (v) {
  25654. if (!arguments.length) return this._reconnectionAttempts;
  25655. this._reconnectionAttempts = v;
  25656. return this;
  25657. };
  25658. /**
  25659. * Sets the delay between reconnections.
  25660. *
  25661. * @param {Number} delay
  25662. * @return {Manager} self or value
  25663. * @api public
  25664. */
  25665. Manager.prototype.reconnectionDelay = function (v) {
  25666. if (!arguments.length) return this._reconnectionDelay;
  25667. this._reconnectionDelay = v;
  25668. this.backoff && this.backoff.setMin(v);
  25669. return this;
  25670. };
  25671. Manager.prototype.randomizationFactor = function (v) {
  25672. if (!arguments.length) return this._randomizationFactor;
  25673. this._randomizationFactor = v;
  25674. this.backoff && this.backoff.setJitter(v);
  25675. return this;
  25676. };
  25677. /**
  25678. * Sets the maximum delay between reconnections.
  25679. *
  25680. * @param {Number} delay
  25681. * @return {Manager} self or value
  25682. * @api public
  25683. */
  25684. Manager.prototype.reconnectionDelayMax = function (v) {
  25685. if (!arguments.length) return this._reconnectionDelayMax;
  25686. this._reconnectionDelayMax = v;
  25687. this.backoff && this.backoff.setMax(v);
  25688. return this;
  25689. };
  25690. /**
  25691. * Sets the connection timeout. `false` to disable
  25692. *
  25693. * @return {Manager} self or value
  25694. * @api public
  25695. */
  25696. Manager.prototype.timeout = function (v) {
  25697. if (!arguments.length) return this._timeout;
  25698. this._timeout = v;
  25699. return this;
  25700. };
  25701. /**
  25702. * Starts trying to reconnect if reconnection is enabled and we have not
  25703. * started reconnecting yet
  25704. *
  25705. * @api private
  25706. */
  25707. Manager.prototype.maybeReconnectOnOpen = function () {
  25708. // Only try to reconnect if it's the first time we're connecting
  25709. if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {
  25710. // keeps reconnection from firing twice for the same reconnection loop
  25711. this.reconnect();
  25712. }
  25713. };
  25714. /**
  25715. * Sets the current transport `socket`.
  25716. *
  25717. * @param {Function} optional, callback
  25718. * @return {Manager} self
  25719. * @api public
  25720. */
  25721. Manager.prototype.open =
  25722. Manager.prototype.connect = function (fn, opts) {
  25723. debug('readyState %s', this.readyState);
  25724. if (~this.readyState.indexOf('open')) return this;
  25725. debug('opening %s', this.uri);
  25726. this.engine = eio(this.uri, this.opts);
  25727. var socket = this.engine;
  25728. var self = this;
  25729. this.readyState = 'opening';
  25730. this.skipReconnect = false;
  25731. // emit `open`
  25732. var openSub = on(socket, 'open', function () {
  25733. self.onopen();
  25734. fn && fn();
  25735. });
  25736. // emit `connect_error`
  25737. var errorSub = on(socket, 'error', function (data) {
  25738. debug('connect_error');
  25739. self.cleanup();
  25740. self.readyState = 'closed';
  25741. self.emitAll('connect_error', data);
  25742. if (fn) {
  25743. var err = new Error('Connection error');
  25744. err.data = data;
  25745. fn(err);
  25746. } else {
  25747. // Only do this if there is no fn to handle the error
  25748. self.maybeReconnectOnOpen();
  25749. }
  25750. });
  25751. // emit `connect_timeout`
  25752. if (false !== this._timeout) {
  25753. var timeout = this._timeout;
  25754. debug('connect attempt will timeout after %d', timeout);
  25755. // set timer
  25756. var timer = setTimeout(function () {
  25757. debug('connect attempt timed out after %d', timeout);
  25758. openSub.destroy();
  25759. socket.close();
  25760. socket.emit('error', 'timeout');
  25761. self.emitAll('connect_timeout', timeout);
  25762. }, timeout);
  25763. this.subs.push({
  25764. destroy: function () {
  25765. clearTimeout(timer);
  25766. }
  25767. });
  25768. }
  25769. this.subs.push(openSub);
  25770. this.subs.push(errorSub);
  25771. return this;
  25772. };
  25773. /**
  25774. * Called upon transport open.
  25775. *
  25776. * @api private
  25777. */
  25778. Manager.prototype.onopen = function () {
  25779. debug('open');
  25780. // clear old subs
  25781. this.cleanup();
  25782. // mark as open
  25783. this.readyState = 'open';
  25784. this.emit('open');
  25785. // add new subs
  25786. var socket = this.engine;
  25787. this.subs.push(on(socket, 'data', bind(this, 'ondata')));
  25788. this.subs.push(on(socket, 'ping', bind(this, 'onping')));
  25789. this.subs.push(on(socket, 'pong', bind(this, 'onpong')));
  25790. this.subs.push(on(socket, 'error', bind(this, 'onerror')));
  25791. this.subs.push(on(socket, 'close', bind(this, 'onclose')));
  25792. this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));
  25793. };
  25794. /**
  25795. * Called upon a ping.
  25796. *
  25797. * @api private
  25798. */
  25799. Manager.prototype.onping = function () {
  25800. this.lastPing = new Date();
  25801. this.emitAll('ping');
  25802. };
  25803. /**
  25804. * Called upon a packet.
  25805. *
  25806. * @api private
  25807. */
  25808. Manager.prototype.onpong = function () {
  25809. this.emitAll('pong', new Date() - this.lastPing);
  25810. };
  25811. /**
  25812. * Called with data.
  25813. *
  25814. * @api private
  25815. */
  25816. Manager.prototype.ondata = function (data) {
  25817. this.decoder.add(data);
  25818. };
  25819. /**
  25820. * Called when parser fully decodes a packet.
  25821. *
  25822. * @api private
  25823. */
  25824. Manager.prototype.ondecoded = function (packet) {
  25825. this.emit('packet', packet);
  25826. };
  25827. /**
  25828. * Called upon socket error.
  25829. *
  25830. * @api private
  25831. */
  25832. Manager.prototype.onerror = function (err) {
  25833. debug('error', err);
  25834. this.emitAll('error', err);
  25835. };
  25836. /**
  25837. * Creates a new socket for the given `nsp`.
  25838. *
  25839. * @return {Socket}
  25840. * @api public
  25841. */
  25842. Manager.prototype.socket = function (nsp, opts) {
  25843. var socket = this.nsps[nsp];
  25844. if (!socket) {
  25845. socket = new Socket(this, nsp, opts);
  25846. this.nsps[nsp] = socket;
  25847. var self = this;
  25848. socket.on('connecting', onConnecting);
  25849. socket.on('connect', function () {
  25850. socket.id = self.engine.id;
  25851. });
  25852. if (this.autoConnect) {
  25853. // manually call here since connecting evnet is fired before listening
  25854. onConnecting();
  25855. }
  25856. }
  25857. function onConnecting () {
  25858. if (!~indexOf(self.connecting, socket)) {
  25859. self.connecting.push(socket);
  25860. }
  25861. }
  25862. return socket;
  25863. };
  25864. /**
  25865. * Called upon a socket close.
  25866. *
  25867. * @param {Socket} socket
  25868. */
  25869. Manager.prototype.destroy = function (socket) {
  25870. var index = indexOf(this.connecting, socket);
  25871. if (~index) this.connecting.splice(index, 1);
  25872. if (this.connecting.length) return;
  25873. this.close();
  25874. };
  25875. /**
  25876. * Writes a packet.
  25877. *
  25878. * @param {Object} packet
  25879. * @api private
  25880. */
  25881. Manager.prototype.packet = function (packet) {
  25882. debug('writing packet %j', packet);
  25883. var self = this;
  25884. if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;
  25885. if (!self.encoding) {
  25886. // encode, then write to engine with result
  25887. self.encoding = true;
  25888. this.encoder.encode(packet, function (encodedPackets) {
  25889. for (var i = 0; i < encodedPackets.length; i++) {
  25890. self.engine.write(encodedPackets[i], packet.options);
  25891. }
  25892. self.encoding = false;
  25893. self.processPacketQueue();
  25894. });
  25895. } else { // add packet to the queue
  25896. self.packetBuffer.push(packet);
  25897. }
  25898. };
  25899. /**
  25900. * If packet buffer is non-empty, begins encoding the
  25901. * next packet in line.
  25902. *
  25903. * @api private
  25904. */
  25905. Manager.prototype.processPacketQueue = function () {
  25906. if (this.packetBuffer.length > 0 && !this.encoding) {
  25907. var pack = this.packetBuffer.shift();
  25908. this.packet(pack);
  25909. }
  25910. };
  25911. /**
  25912. * Clean up transport subscriptions and packet buffer.
  25913. *
  25914. * @api private
  25915. */
  25916. Manager.prototype.cleanup = function () {
  25917. debug('cleanup');
  25918. var subsLength = this.subs.length;
  25919. for (var i = 0; i < subsLength; i++) {
  25920. var sub = this.subs.shift();
  25921. sub.destroy();
  25922. }
  25923. this.packetBuffer = [];
  25924. this.encoding = false;
  25925. this.lastPing = null;
  25926. this.decoder.destroy();
  25927. };
  25928. /**
  25929. * Close the current socket.
  25930. *
  25931. * @api private
  25932. */
  25933. Manager.prototype.close =
  25934. Manager.prototype.disconnect = function () {
  25935. debug('disconnect');
  25936. this.skipReconnect = true;
  25937. this.reconnecting = false;
  25938. if ('opening' === this.readyState) {
  25939. // `onclose` will not fire because
  25940. // an open event never happened
  25941. this.cleanup();
  25942. }
  25943. this.backoff.reset();
  25944. this.readyState = 'closed';
  25945. if (this.engine) this.engine.close();
  25946. };
  25947. /**
  25948. * Called upon engine close.
  25949. *
  25950. * @api private
  25951. */
  25952. Manager.prototype.onclose = function (reason) {
  25953. debug('onclose');
  25954. this.cleanup();
  25955. this.backoff.reset();
  25956. this.readyState = 'closed';
  25957. this.emit('close', reason);
  25958. if (this._reconnection && !this.skipReconnect) {
  25959. this.reconnect();
  25960. }
  25961. };
  25962. /**
  25963. * Attempt a reconnection.
  25964. *
  25965. * @api private
  25966. */
  25967. Manager.prototype.reconnect = function () {
  25968. if (this.reconnecting || this.skipReconnect) return this;
  25969. var self = this;
  25970. if (this.backoff.attempts >= this._reconnectionAttempts) {
  25971. debug('reconnect failed');
  25972. this.backoff.reset();
  25973. this.emitAll('reconnect_failed');
  25974. this.reconnecting = false;
  25975. } else {
  25976. var delay = this.backoff.duration();
  25977. debug('will wait %dms before reconnect attempt', delay);
  25978. this.reconnecting = true;
  25979. var timer = setTimeout(function () {
  25980. if (self.skipReconnect) return;
  25981. debug('attempting reconnect');
  25982. self.emitAll('reconnect_attempt', self.backoff.attempts);
  25983. self.emitAll('reconnecting', self.backoff.attempts);
  25984. // check again for the case socket closed in above events
  25985. if (self.skipReconnect) return;
  25986. self.open(function (err) {
  25987. if (err) {
  25988. debug('reconnect attempt error');
  25989. self.reconnecting = false;
  25990. self.reconnect();
  25991. self.emitAll('reconnect_error', err.data);
  25992. } else {
  25993. debug('reconnect success');
  25994. self.onreconnect();
  25995. }
  25996. });
  25997. }, delay);
  25998. this.subs.push({
  25999. destroy: function () {
  26000. clearTimeout(timer);
  26001. }
  26002. });
  26003. }
  26004. };
  26005. /**
  26006. * Called upon successful reconnect.
  26007. *
  26008. * @api private
  26009. */
  26010. Manager.prototype.onreconnect = function () {
  26011. var attempt = this.backoff.attempts;
  26012. this.reconnecting = false;
  26013. this.backoff.reset();
  26014. this.updateSocketIds();
  26015. this.emitAll('reconnect', attempt);
  26016. };
  26017. });
  26018. ___scope___.file("lib/socket.js", function(exports, require, module, __filename, __dirname){
  26019. /**
  26020. * Module dependencies.
  26021. */
  26022. var parser = require('socket.io-parser');
  26023. var Emitter = require('component-emitter');
  26024. var toArray = require('to-array');
  26025. var on = require('./on');
  26026. var bind = require('component-bind');
  26027. var debug = require('debug')('socket.io-client:socket');
  26028. var hasBin = require('has-binary');
  26029. /**
  26030. * Module exports.
  26031. */
  26032. module.exports = exports = Socket;
  26033. /**
  26034. * Internal events (blacklisted).
  26035. * These events can't be emitted by the user.
  26036. *
  26037. * @api private
  26038. */
  26039. var events = {
  26040. connect: 1,
  26041. connect_error: 1,
  26042. connect_timeout: 1,
  26043. connecting: 1,
  26044. disconnect: 1,
  26045. error: 1,
  26046. reconnect: 1,
  26047. reconnect_attempt: 1,
  26048. reconnect_failed: 1,
  26049. reconnect_error: 1,
  26050. reconnecting: 1,
  26051. ping: 1,
  26052. pong: 1
  26053. };
  26054. /**
  26055. * Shortcut to `Emitter#emit`.
  26056. */
  26057. var emit = Emitter.prototype.emit;
  26058. /**
  26059. * `Socket` constructor.
  26060. *
  26061. * @api public
  26062. */
  26063. function Socket (io, nsp, opts) {
  26064. this.io = io;
  26065. this.nsp = nsp;
  26066. this.json = this; // compat
  26067. this.ids = 0;
  26068. this.acks = {};
  26069. this.receiveBuffer = [];
  26070. this.sendBuffer = [];
  26071. this.connected = false;
  26072. this.disconnected = true;
  26073. if (opts && opts.query) {
  26074. this.query = opts.query;
  26075. }
  26076. if (this.io.autoConnect) this.open();
  26077. }
  26078. /**
  26079. * Mix in `Emitter`.
  26080. */
  26081. Emitter(Socket.prototype);
  26082. /**
  26083. * Subscribe to open, close and packet events
  26084. *
  26085. * @api private
  26086. */
  26087. Socket.prototype.subEvents = function () {
  26088. if (this.subs) return;
  26089. var io = this.io;
  26090. this.subs = [
  26091. on(io, 'open', bind(this, 'onopen')),
  26092. on(io, 'packet', bind(this, 'onpacket')),
  26093. on(io, 'close', bind(this, 'onclose'))
  26094. ];
  26095. };
  26096. /**
  26097. * "Opens" the socket.
  26098. *
  26099. * @api public
  26100. */
  26101. Socket.prototype.open =
  26102. Socket.prototype.connect = function () {
  26103. if (this.connected) return this;
  26104. this.subEvents();
  26105. this.io.open(); // ensure open
  26106. if ('open' === this.io.readyState) this.onopen();
  26107. this.emit('connecting');
  26108. return this;
  26109. };
  26110. /**
  26111. * Sends a `message` event.
  26112. *
  26113. * @return {Socket} self
  26114. * @api public
  26115. */
  26116. Socket.prototype.send = function () {
  26117. var args = toArray(arguments);
  26118. args.unshift('message');
  26119. this.emit.apply(this, args);
  26120. return this;
  26121. };
  26122. /**
  26123. * Override `emit`.
  26124. * If the event is in `events`, it's emitted normally.
  26125. *
  26126. * @param {String} event name
  26127. * @return {Socket} self
  26128. * @api public
  26129. */
  26130. Socket.prototype.emit = function (ev) {
  26131. if (events.hasOwnProperty(ev)) {
  26132. emit.apply(this, arguments);
  26133. return this;
  26134. }
  26135. var args = toArray(arguments);
  26136. var parserType = parser.EVENT; // default
  26137. if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary
  26138. var packet = { type: parserType, data: args };
  26139. packet.options = {};
  26140. packet.options.compress = !this.flags || false !== this.flags.compress;
  26141. // event ack callback
  26142. if ('function' === typeof args[args.length - 1]) {
  26143. debug('emitting packet with ack id %d', this.ids);
  26144. this.acks[this.ids] = args.pop();
  26145. packet.id = this.ids++;
  26146. }
  26147. if (this.connected) {
  26148. this.packet(packet);
  26149. } else {
  26150. this.sendBuffer.push(packet);
  26151. }
  26152. delete this.flags;
  26153. return this;
  26154. };
  26155. /**
  26156. * Sends a packet.
  26157. *
  26158. * @param {Object} packet
  26159. * @api private
  26160. */
  26161. Socket.prototype.packet = function (packet) {
  26162. packet.nsp = this.nsp;
  26163. this.io.packet(packet);
  26164. };
  26165. /**
  26166. * Called upon engine `open`.
  26167. *
  26168. * @api private
  26169. */
  26170. Socket.prototype.onopen = function () {
  26171. debug('transport is open - connecting');
  26172. // write connect packet if necessary
  26173. if ('/' !== this.nsp) {
  26174. if (this.query) {
  26175. this.packet({type: parser.CONNECT, query: this.query});
  26176. } else {
  26177. this.packet({type: parser.CONNECT});
  26178. }
  26179. }
  26180. };
  26181. /**
  26182. * Called upon engine `close`.
  26183. *
  26184. * @param {String} reason
  26185. * @api private
  26186. */
  26187. Socket.prototype.onclose = function (reason) {
  26188. debug('close (%s)', reason);
  26189. this.connected = false;
  26190. this.disconnected = true;
  26191. delete this.id;
  26192. this.emit('disconnect', reason);
  26193. };
  26194. /**
  26195. * Called with socket packet.
  26196. *
  26197. * @param {Object} packet
  26198. * @api private
  26199. */
  26200. Socket.prototype.onpacket = function (packet) {
  26201. if (packet.nsp !== this.nsp) return;
  26202. switch (packet.type) {
  26203. case parser.CONNECT:
  26204. this.onconnect();
  26205. break;
  26206. case parser.EVENT:
  26207. this.onevent(packet);
  26208. break;
  26209. case parser.BINARY_EVENT:
  26210. this.onevent(packet);
  26211. break;
  26212. case parser.ACK:
  26213. this.onack(packet);
  26214. break;
  26215. case parser.BINARY_ACK:
  26216. this.onack(packet);
  26217. break;
  26218. case parser.DISCONNECT:
  26219. this.ondisconnect();
  26220. break;
  26221. case parser.ERROR:
  26222. this.emit('error', packet.data);
  26223. break;
  26224. }
  26225. };
  26226. /**
  26227. * Called upon a server event.
  26228. *
  26229. * @param {Object} packet
  26230. * @api private
  26231. */
  26232. Socket.prototype.onevent = function (packet) {
  26233. var args = packet.data || [];
  26234. debug('emitting event %j', args);
  26235. if (null != packet.id) {
  26236. debug('attaching ack callback to event');
  26237. args.push(this.ack(packet.id));
  26238. }
  26239. if (this.connected) {
  26240. emit.apply(this, args);
  26241. } else {
  26242. this.receiveBuffer.push(args);
  26243. }
  26244. };
  26245. /**
  26246. * Produces an ack callback to emit with an event.
  26247. *
  26248. * @api private
  26249. */
  26250. Socket.prototype.ack = function (id) {
  26251. var self = this;
  26252. var sent = false;
  26253. return function () {
  26254. // prevent double callbacks
  26255. if (sent) return;
  26256. sent = true;
  26257. var args = toArray(arguments);
  26258. debug('sending ack %j', args);
  26259. var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK;
  26260. self.packet({
  26261. type: type,
  26262. id: id,
  26263. data: args
  26264. });
  26265. };
  26266. };
  26267. /**
  26268. * Called upon a server acknowlegement.
  26269. *
  26270. * @param {Object} packet
  26271. * @api private
  26272. */
  26273. Socket.prototype.onack = function (packet) {
  26274. var ack = this.acks[packet.id];
  26275. if ('function' === typeof ack) {
  26276. debug('calling ack %s with %j', packet.id, packet.data);
  26277. ack.apply(this, packet.data);
  26278. delete this.acks[packet.id];
  26279. } else {
  26280. debug('bad ack %s', packet.id);
  26281. }
  26282. };
  26283. /**
  26284. * Called upon server connect.
  26285. *
  26286. * @api private
  26287. */
  26288. Socket.prototype.onconnect = function () {
  26289. this.connected = true;
  26290. this.disconnected = false;
  26291. this.emit('connect');
  26292. this.emitBuffered();
  26293. };
  26294. /**
  26295. * Emit buffered events (received and emitted).
  26296. *
  26297. * @api private
  26298. */
  26299. Socket.prototype.emitBuffered = function () {
  26300. var i;
  26301. for (i = 0; i < this.receiveBuffer.length; i++) {
  26302. emit.apply(this, this.receiveBuffer[i]);
  26303. }
  26304. this.receiveBuffer = [];
  26305. for (i = 0; i < this.sendBuffer.length; i++) {
  26306. this.packet(this.sendBuffer[i]);
  26307. }
  26308. this.sendBuffer = [];
  26309. };
  26310. /**
  26311. * Called upon server disconnect.
  26312. *
  26313. * @api private
  26314. */
  26315. Socket.prototype.ondisconnect = function () {
  26316. debug('server disconnect (%s)', this.nsp);
  26317. this.destroy();
  26318. this.onclose('io server disconnect');
  26319. };
  26320. /**
  26321. * Called upon forced client/server side disconnections,
  26322. * this method ensures the manager stops tracking us and
  26323. * that reconnections don't get triggered for this.
  26324. *
  26325. * @api private.
  26326. */
  26327. Socket.prototype.destroy = function () {
  26328. if (this.subs) {
  26329. // clean subscriptions to avoid reconnections
  26330. for (var i = 0; i < this.subs.length; i++) {
  26331. this.subs[i].destroy();
  26332. }
  26333. this.subs = null;
  26334. }
  26335. this.io.destroy(this);
  26336. };
  26337. /**
  26338. * Disconnects the socket manually.
  26339. *
  26340. * @return {Socket} self
  26341. * @api public
  26342. */
  26343. Socket.prototype.close =
  26344. Socket.prototype.disconnect = function () {
  26345. if (this.connected) {
  26346. debug('performing disconnect (%s)', this.nsp);
  26347. this.packet({ type: parser.DISCONNECT });
  26348. }
  26349. // remove socket from pool
  26350. this.destroy();
  26351. if (this.connected) {
  26352. // fire events
  26353. this.onclose('io client disconnect');
  26354. }
  26355. return this;
  26356. };
  26357. /**
  26358. * Sets the compress flag.
  26359. *
  26360. * @param {Boolean} if `true`, compresses the sending data
  26361. * @return {Socket} self
  26362. * @api public
  26363. */
  26364. Socket.prototype.compress = function (compress) {
  26365. this.flags = this.flags || {};
  26366. this.flags.compress = compress;
  26367. return this;
  26368. };
  26369. });
  26370. ___scope___.file("lib/on.js", function(exports, require, module, __filename, __dirname){
  26371. /**
  26372. * Module exports.
  26373. */
  26374. module.exports = on;
  26375. /**
  26376. * Helper for subscriptions.
  26377. *
  26378. * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
  26379. * @param {String} event name
  26380. * @param {Function} callback
  26381. * @api public
  26382. */
  26383. function on (obj, ev, fn) {
  26384. obj.on(ev, fn);
  26385. return {
  26386. destroy: function () {
  26387. obj.removeListener(ev, fn);
  26388. }
  26389. };
  26390. }
  26391. });
  26392. return ___scope___.entry = "lib/index.js";
  26393. });
  26394. FuseBox.pkg("parseuri", {}, function(___scope___){
  26395. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  26396. /**
  26397. * Parses an URI
  26398. *
  26399. * @author Steven Levithan <stevenlevithan.com> (MIT license)
  26400. * @api private
  26401. */
  26402. var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
  26403. var parts = [
  26404. 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'
  26405. ];
  26406. module.exports = function parseuri(str) {
  26407. var src = str,
  26408. b = str.indexOf('['),
  26409. e = str.indexOf(']');
  26410. if (b != -1 && e != -1) {
  26411. str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);
  26412. }
  26413. var m = re.exec(str || ''),
  26414. uri = {},
  26415. i = 14;
  26416. while (i--) {
  26417. uri[parts[i]] = m[i] || '';
  26418. }
  26419. if (b != -1 && e != -1) {
  26420. uri.source = src;
  26421. uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');
  26422. uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');
  26423. uri.ipv6uri = true;
  26424. }
  26425. return uri;
  26426. };
  26427. });
  26428. return ___scope___.entry = "index.js";
  26429. });
  26430. FuseBox.pkg("debug@2.3.3", {}, function(___scope___){
  26431. ___scope___.file("browser.js", function(exports, require, module, __filename, __dirname){
  26432. /* fuse:injection: */ var process = require("process");
  26433. /**
  26434. * This is the web browser implementation of `debug()`.
  26435. *
  26436. * Expose `debug()` as the module.
  26437. */
  26438. exports = module.exports = require('./debug');
  26439. exports.log = log;
  26440. exports.formatArgs = formatArgs;
  26441. exports.save = save;
  26442. exports.load = load;
  26443. exports.useColors = useColors;
  26444. exports.storage = 'undefined' != typeof chrome
  26445. && 'undefined' != typeof chrome.storage
  26446. ? chrome.storage.local
  26447. : localstorage();
  26448. /**
  26449. * Colors.
  26450. */
  26451. exports.colors = [
  26452. 'lightseagreen',
  26453. 'forestgreen',
  26454. 'goldenrod',
  26455. 'dodgerblue',
  26456. 'darkorchid',
  26457. 'crimson'
  26458. ];
  26459. /**
  26460. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  26461. * and the Firebug extension (any Firefox version) are known
  26462. * to support "%c" CSS customizations.
  26463. *
  26464. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  26465. */
  26466. function useColors() {
  26467. // is webkit? http://stackoverflow.com/a/16459606/376773
  26468. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  26469. return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) ||
  26470. // is firebug? http://stackoverflow.com/a/398120/376773
  26471. (window.console && (console.firebug || (console.exception && console.table))) ||
  26472. // is firefox >= v31?
  26473. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  26474. (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
  26475. }
  26476. /**
  26477. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  26478. */
  26479. exports.formatters.j = function(v) {
  26480. try {
  26481. return JSON.stringify(v);
  26482. } catch (err) {
  26483. return '[UnexpectedJSONParseError]: ' + err.message;
  26484. }
  26485. };
  26486. /**
  26487. * Colorize log arguments if enabled.
  26488. *
  26489. * @api public
  26490. */
  26491. function formatArgs() {
  26492. var args = arguments;
  26493. var useColors = this.useColors;
  26494. args[0] = (useColors ? '%c' : '')
  26495. + this.namespace
  26496. + (useColors ? ' %c' : ' ')
  26497. + args[0]
  26498. + (useColors ? '%c ' : ' ')
  26499. + '+' + exports.humanize(this.diff);
  26500. if (!useColors) return args;
  26501. var c = 'color: ' + this.color;
  26502. args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
  26503. // the final "%c" is somewhat tricky, because there could be other
  26504. // arguments passed either before or after the %c, so we need to
  26505. // figure out the correct index to insert the CSS into
  26506. var index = 0;
  26507. var lastC = 0;
  26508. args[0].replace(/%[a-z%]/g, function(match) {
  26509. if ('%%' === match) return;
  26510. index++;
  26511. if ('%c' === match) {
  26512. // we only are interested in the *last* %c
  26513. // (the user may have provided their own)
  26514. lastC = index;
  26515. }
  26516. });
  26517. args.splice(lastC, 0, c);
  26518. return args;
  26519. }
  26520. /**
  26521. * Invokes `console.log()` when available.
  26522. * No-op when `console.log` is not a "function".
  26523. *
  26524. * @api public
  26525. */
  26526. function log() {
  26527. // this hackery is required for IE8/9, where
  26528. // the `console.log` function doesn't have 'apply'
  26529. return 'object' === typeof console
  26530. && console.log
  26531. && Function.prototype.apply.call(console.log, console, arguments);
  26532. }
  26533. /**
  26534. * Save `namespaces`.
  26535. *
  26536. * @param {String} namespaces
  26537. * @api private
  26538. */
  26539. function save(namespaces) {
  26540. try {
  26541. if (null == namespaces) {
  26542. exports.storage.removeItem('debug');
  26543. } else {
  26544. exports.storage.debug = namespaces;
  26545. }
  26546. } catch(e) {}
  26547. }
  26548. /**
  26549. * Load `namespaces`.
  26550. *
  26551. * @return {String} returns the previously persisted debug modes
  26552. * @api private
  26553. */
  26554. function load() {
  26555. var r;
  26556. try {
  26557. return exports.storage.debug;
  26558. } catch(e) {}
  26559. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  26560. if (typeof process !== 'undefined' && 'env' in process) {
  26561. return process.env.DEBUG;
  26562. }
  26563. }
  26564. /**
  26565. * Enable namespaces listed in `localStorage.debug` initially.
  26566. */
  26567. exports.enable(load());
  26568. /**
  26569. * Localstorage attempts to return the localstorage.
  26570. *
  26571. * This is necessary because safari throws
  26572. * when a user disables cookies/localstorage
  26573. * and you attempt to access it.
  26574. *
  26575. * @return {LocalStorage}
  26576. * @api private
  26577. */
  26578. function localstorage(){
  26579. try {
  26580. return window.localStorage;
  26581. } catch (e) {}
  26582. }
  26583. });
  26584. ___scope___.file("debug.js", function(exports, require, module, __filename, __dirname){
  26585. /**
  26586. * This is the common logic for both the Node.js and web browser
  26587. * implementations of `debug()`.
  26588. *
  26589. * Expose `debug()` as the module.
  26590. */
  26591. exports = module.exports = debug.debug = debug;
  26592. exports.coerce = coerce;
  26593. exports.disable = disable;
  26594. exports.enable = enable;
  26595. exports.enabled = enabled;
  26596. exports.humanize = require('ms');
  26597. /**
  26598. * The currently active debug mode names, and names to skip.
  26599. */
  26600. exports.names = [];
  26601. exports.skips = [];
  26602. /**
  26603. * Map of special "%n" handling functions, for the debug "format" argument.
  26604. *
  26605. * Valid key names are a single, lowercased letter, i.e. "n".
  26606. */
  26607. exports.formatters = {};
  26608. /**
  26609. * Previously assigned color.
  26610. */
  26611. var prevColor = 0;
  26612. /**
  26613. * Previous log timestamp.
  26614. */
  26615. var prevTime;
  26616. /**
  26617. * Select a color.
  26618. *
  26619. * @return {Number}
  26620. * @api private
  26621. */
  26622. function selectColor() {
  26623. return exports.colors[prevColor++ % exports.colors.length];
  26624. }
  26625. /**
  26626. * Create a debugger with the given `namespace`.
  26627. *
  26628. * @param {String} namespace
  26629. * @return {Function}
  26630. * @api public
  26631. */
  26632. function debug(namespace) {
  26633. // define the `disabled` version
  26634. function disabled() {
  26635. }
  26636. disabled.enabled = false;
  26637. // define the `enabled` version
  26638. function enabled() {
  26639. var self = enabled;
  26640. // set `diff` timestamp
  26641. var curr = +new Date();
  26642. var ms = curr - (prevTime || curr);
  26643. self.diff = ms;
  26644. self.prev = prevTime;
  26645. self.curr = curr;
  26646. prevTime = curr;
  26647. // add the `color` if not set
  26648. if (null == self.useColors) self.useColors = exports.useColors();
  26649. if (null == self.color && self.useColors) self.color = selectColor();
  26650. var args = new Array(arguments.length);
  26651. for (var i = 0; i < args.length; i++) {
  26652. args[i] = arguments[i];
  26653. }
  26654. args[0] = exports.coerce(args[0]);
  26655. if ('string' !== typeof args[0]) {
  26656. // anything else let's inspect with %o
  26657. args = ['%o'].concat(args);
  26658. }
  26659. // apply any `formatters` transformations
  26660. var index = 0;
  26661. args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
  26662. // if we encounter an escaped % then don't increase the array index
  26663. if (match === '%%') return match;
  26664. index++;
  26665. var formatter = exports.formatters[format];
  26666. if ('function' === typeof formatter) {
  26667. var val = args[index];
  26668. match = formatter.call(self, val);
  26669. // now we need to remove `args[index]` since it's inlined in the `format`
  26670. args.splice(index, 1);
  26671. index--;
  26672. }
  26673. return match;
  26674. });
  26675. // apply env-specific formatting
  26676. args = exports.formatArgs.apply(self, args);
  26677. var logFn = enabled.log || exports.log || console.log.bind(console);
  26678. logFn.apply(self, args);
  26679. }
  26680. enabled.enabled = true;
  26681. var fn = exports.enabled(namespace) ? enabled : disabled;
  26682. fn.namespace = namespace;
  26683. return fn;
  26684. }
  26685. /**
  26686. * Enables a debug mode by namespaces. This can include modes
  26687. * separated by a colon and wildcards.
  26688. *
  26689. * @param {String} namespaces
  26690. * @api public
  26691. */
  26692. function enable(namespaces) {
  26693. exports.save(namespaces);
  26694. var split = (namespaces || '').split(/[\s,]+/);
  26695. var len = split.length;
  26696. for (var i = 0; i < len; i++) {
  26697. if (!split[i]) continue; // ignore empty strings
  26698. namespaces = split[i].replace(/[\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*?');
  26699. if (namespaces[0] === '-') {
  26700. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  26701. } else {
  26702. exports.names.push(new RegExp('^' + namespaces + '$'));
  26703. }
  26704. }
  26705. }
  26706. /**
  26707. * Disable debug output.
  26708. *
  26709. * @api public
  26710. */
  26711. function disable() {
  26712. exports.enable('');
  26713. }
  26714. /**
  26715. * Returns true if the given mode name is enabled, false otherwise.
  26716. *
  26717. * @param {String} name
  26718. * @return {Boolean}
  26719. * @api public
  26720. */
  26721. function enabled(name) {
  26722. var i, len;
  26723. for (i = 0, len = exports.skips.length; i < len; i++) {
  26724. if (exports.skips[i].test(name)) {
  26725. return false;
  26726. }
  26727. }
  26728. for (i = 0, len = exports.names.length; i < len; i++) {
  26729. if (exports.names[i].test(name)) {
  26730. return true;
  26731. }
  26732. }
  26733. return false;
  26734. }
  26735. /**
  26736. * Coerce `val`.
  26737. *
  26738. * @param {Mixed} val
  26739. * @return {Mixed}
  26740. * @api private
  26741. */
  26742. function coerce(val) {
  26743. if (val instanceof Error) return val.stack || val.message;
  26744. return val;
  26745. }
  26746. });
  26747. return ___scope___.entry = "browser.js";
  26748. });
  26749. FuseBox.pkg("ms", {}, function(___scope___){
  26750. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  26751. /**
  26752. * Helpers.
  26753. */
  26754. var s = 1000
  26755. var m = s * 60
  26756. var h = m * 60
  26757. var d = h * 24
  26758. var y = d * 365.25
  26759. /**
  26760. * Parse or format the given `val`.
  26761. *
  26762. * Options:
  26763. *
  26764. * - `long` verbose formatting [false]
  26765. *
  26766. * @param {String|Number} val
  26767. * @param {Object} options
  26768. * @throws {Error} throw an error if val is not a non-empty string or a number
  26769. * @return {String|Number}
  26770. * @api public
  26771. */
  26772. module.exports = function (val, options) {
  26773. options = options || {}
  26774. var type = typeof val
  26775. if (type === 'string' && val.length > 0) {
  26776. return parse(val)
  26777. } else if (type === 'number' && isNaN(val) === false) {
  26778. return options.long ?
  26779. fmtLong(val) :
  26780. fmtShort(val)
  26781. }
  26782. throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val))
  26783. }
  26784. /**
  26785. * Parse the given `str` and return milliseconds.
  26786. *
  26787. * @param {String} str
  26788. * @return {Number}
  26789. * @api private
  26790. */
  26791. function parse(str) {
  26792. str = String(str)
  26793. if (str.length > 10000) {
  26794. return
  26795. }
  26796. var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str)
  26797. if (!match) {
  26798. return
  26799. }
  26800. var n = parseFloat(match[1])
  26801. var type = (match[2] || 'ms').toLowerCase()
  26802. switch (type) {
  26803. case 'years':
  26804. case 'year':
  26805. case 'yrs':
  26806. case 'yr':
  26807. case 'y':
  26808. return n * y
  26809. case 'days':
  26810. case 'day':
  26811. case 'd':
  26812. return n * d
  26813. case 'hours':
  26814. case 'hour':
  26815. case 'hrs':
  26816. case 'hr':
  26817. case 'h':
  26818. return n * h
  26819. case 'minutes':
  26820. case 'minute':
  26821. case 'mins':
  26822. case 'min':
  26823. case 'm':
  26824. return n * m
  26825. case 'seconds':
  26826. case 'second':
  26827. case 'secs':
  26828. case 'sec':
  26829. case 's':
  26830. return n * s
  26831. case 'milliseconds':
  26832. case 'millisecond':
  26833. case 'msecs':
  26834. case 'msec':
  26835. case 'ms':
  26836. return n
  26837. default:
  26838. return undefined
  26839. }
  26840. }
  26841. /**
  26842. * Short format for `ms`.
  26843. *
  26844. * @param {Number} ms
  26845. * @return {String}
  26846. * @api private
  26847. */
  26848. function fmtShort(ms) {
  26849. if (ms >= d) {
  26850. return Math.round(ms / d) + 'd'
  26851. }
  26852. if (ms >= h) {
  26853. return Math.round(ms / h) + 'h'
  26854. }
  26855. if (ms >= m) {
  26856. return Math.round(ms / m) + 'm'
  26857. }
  26858. if (ms >= s) {
  26859. return Math.round(ms / s) + 's'
  26860. }
  26861. return ms + 'ms'
  26862. }
  26863. /**
  26864. * Long format for `ms`.
  26865. *
  26866. * @param {Number} ms
  26867. * @return {String}
  26868. * @api private
  26869. */
  26870. function fmtLong(ms) {
  26871. return plural(ms, d, 'day') ||
  26872. plural(ms, h, 'hour') ||
  26873. plural(ms, m, 'minute') ||
  26874. plural(ms, s, 'second') ||
  26875. ms + ' ms'
  26876. }
  26877. /**
  26878. * Pluralization helper.
  26879. */
  26880. function plural(ms, n, name) {
  26881. if (ms < n) {
  26882. return
  26883. }
  26884. if (ms < n * 1.5) {
  26885. return Math.floor(ms / n) + ' ' + name
  26886. }
  26887. return Math.ceil(ms / n) + ' ' + name + 's'
  26888. }
  26889. });
  26890. return ___scope___.entry = "index.js";
  26891. });
  26892. FuseBox.pkg("process", {}, function(___scope___){
  26893. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  26894. // From https://github.com/defunctzombie/node-process/blob/master/browser.js
  26895. // shim for using process in browser
  26896. if (FuseBox.isServer) {
  26897. if (typeof __process_env__ !== "undefined") {
  26898. Object.assign(global.process.env, __process_env__);
  26899. }
  26900. module.exports = global.process;
  26901. } else {
  26902. require("object-assign-polyfill");
  26903. var productionEnv = false; //require('@system-env').production;
  26904. var process = module.exports = {};
  26905. var queue = [];
  26906. var draining = false;
  26907. var currentQueue;
  26908. var queueIndex = -1;
  26909. function cleanUpNextTick() {
  26910. draining = false;
  26911. if (currentQueue.length) {
  26912. queue = currentQueue.concat(queue);
  26913. } else {
  26914. queueIndex = -1;
  26915. }
  26916. if (queue.length) {
  26917. drainQueue();
  26918. }
  26919. }
  26920. function drainQueue() {
  26921. if (draining) {
  26922. return;
  26923. }
  26924. var timeout = setTimeout(cleanUpNextTick);
  26925. draining = true;
  26926. var len = queue.length;
  26927. while (len) {
  26928. currentQueue = queue;
  26929. queue = [];
  26930. while (++queueIndex < len) {
  26931. if (currentQueue) {
  26932. currentQueue[queueIndex].run();
  26933. }
  26934. }
  26935. queueIndex = -1;
  26936. len = queue.length;
  26937. }
  26938. currentQueue = null;
  26939. draining = false;
  26940. clearTimeout(timeout);
  26941. }
  26942. process.nextTick = function(fun) {
  26943. var args = new Array(arguments.length - 1);
  26944. if (arguments.length > 1) {
  26945. for (var i = 1; i < arguments.length; i++) {
  26946. args[i - 1] = arguments[i];
  26947. }
  26948. }
  26949. queue.push(new Item(fun, args));
  26950. if (queue.length === 1 && !draining) {
  26951. setTimeout(drainQueue, 0);
  26952. }
  26953. };
  26954. // v8 likes predictible objects
  26955. function Item(fun, array) {
  26956. this.fun = fun;
  26957. this.array = array;
  26958. }
  26959. Item.prototype.run = function() {
  26960. this.fun.apply(null, this.array);
  26961. };
  26962. process.title = "browser";
  26963. process.browser = true;
  26964. process.env = {
  26965. NODE_ENV: productionEnv ? "production" : "development",
  26966. };
  26967. if (typeof __process_env__ !== "undefined") {
  26968. Object.assign(process.env, __process_env__);
  26969. }
  26970. process.argv = [];
  26971. process.version = ""; // empty string to avoid regexp issues
  26972. process.versions = {};
  26973. function noop() {}
  26974. process.on = noop;
  26975. process.addListener = noop;
  26976. process.once = noop;
  26977. process.off = noop;
  26978. process.removeListener = noop;
  26979. process.removeAllListeners = noop;
  26980. process.emit = noop;
  26981. process.binding = function(name) {
  26982. throw new Error("process.binding is not supported");
  26983. };
  26984. process.cwd = function() { return "/"; };
  26985. process.chdir = function(dir) {
  26986. throw new Error("process.chdir is not supported");
  26987. };
  26988. process.umask = function() { return 0; };
  26989. }
  26990. });
  26991. return ___scope___.entry = "index.js";
  26992. });
  26993. FuseBox.pkg("object-assign-polyfill", {}, function(___scope___){
  26994. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  26995. if (typeof Object.assign != "function") {
  26996. Object.assign = function(target, varArgs) { // .length of function is 2
  26997. "use strict";
  26998. if (target == null) { // TypeError if undefined or null
  26999. throw new TypeError("Cannot convert undefined or null to object");
  27000. }
  27001. var to = Object(target);
  27002. for (var index = 1; index < arguments.length; index++) {
  27003. var nextSource = arguments[index];
  27004. if (nextSource != null) { // Skip over if undefined or null
  27005. for (var nextKey in nextSource) {
  27006. // Avoid bugs when hasOwnProperty is shadowed
  27007. if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
  27008. to[nextKey] = nextSource[nextKey];
  27009. }
  27010. }
  27011. }
  27012. }
  27013. return to;
  27014. };
  27015. }
  27016. });
  27017. return ___scope___.entry = "index.js";
  27018. });
  27019. FuseBox.pkg("socket.io-parser", {"debug":"2.2.0","isarray":"0.0.1"}, function(___scope___){
  27020. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  27021. /**
  27022. * Module dependencies.
  27023. */
  27024. var debug = require('debug')('socket.io-parser');
  27025. var json = require('json3');
  27026. var Emitter = require('component-emitter');
  27027. var binary = require('./binary');
  27028. var isBuf = require('./is-buffer');
  27029. /**
  27030. * Protocol version.
  27031. *
  27032. * @api public
  27033. */
  27034. exports.protocol = 4;
  27035. /**
  27036. * Packet types.
  27037. *
  27038. * @api public
  27039. */
  27040. exports.types = [
  27041. 'CONNECT',
  27042. 'DISCONNECT',
  27043. 'EVENT',
  27044. 'ACK',
  27045. 'ERROR',
  27046. 'BINARY_EVENT',
  27047. 'BINARY_ACK'
  27048. ];
  27049. /**
  27050. * Packet type `connect`.
  27051. *
  27052. * @api public
  27053. */
  27054. exports.CONNECT = 0;
  27055. /**
  27056. * Packet type `disconnect`.
  27057. *
  27058. * @api public
  27059. */
  27060. exports.DISCONNECT = 1;
  27061. /**
  27062. * Packet type `event`.
  27063. *
  27064. * @api public
  27065. */
  27066. exports.EVENT = 2;
  27067. /**
  27068. * Packet type `ack`.
  27069. *
  27070. * @api public
  27071. */
  27072. exports.ACK = 3;
  27073. /**
  27074. * Packet type `error`.
  27075. *
  27076. * @api public
  27077. */
  27078. exports.ERROR = 4;
  27079. /**
  27080. * Packet type 'binary event'
  27081. *
  27082. * @api public
  27083. */
  27084. exports.BINARY_EVENT = 5;
  27085. /**
  27086. * Packet type `binary ack`. For acks with binary arguments.
  27087. *
  27088. * @api public
  27089. */
  27090. exports.BINARY_ACK = 6;
  27091. /**
  27092. * Encoder constructor.
  27093. *
  27094. * @api public
  27095. */
  27096. exports.Encoder = Encoder;
  27097. /**
  27098. * Decoder constructor.
  27099. *
  27100. * @api public
  27101. */
  27102. exports.Decoder = Decoder;
  27103. /**
  27104. * A socket.io Encoder instance
  27105. *
  27106. * @api public
  27107. */
  27108. function Encoder() {}
  27109. /**
  27110. * Encode a packet as a single string if non-binary, or as a
  27111. * buffer sequence, depending on packet type.
  27112. *
  27113. * @param {Object} obj - packet object
  27114. * @param {Function} callback - function to handle encodings (likely engine.write)
  27115. * @return Calls callback with Array of encodings
  27116. * @api public
  27117. */
  27118. Encoder.prototype.encode = function(obj, callback){
  27119. debug('encoding packet %j', obj);
  27120. if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) {
  27121. encodeAsBinary(obj, callback);
  27122. }
  27123. else {
  27124. var encoding = encodeAsString(obj);
  27125. callback([encoding]);
  27126. }
  27127. };
  27128. /**
  27129. * Encode packet as string.
  27130. *
  27131. * @param {Object} packet
  27132. * @return {String} encoded
  27133. * @api private
  27134. */
  27135. function encodeAsString(obj) {
  27136. var str = '';
  27137. var nsp = false;
  27138. // first is type
  27139. str += obj.type;
  27140. // attachments if we have them
  27141. if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) {
  27142. str += obj.attachments;
  27143. str += '-';
  27144. }
  27145. // if we have a namespace other than `/`
  27146. // we append it followed by a comma `,`
  27147. if (obj.nsp && '/' != obj.nsp) {
  27148. nsp = true;
  27149. str += obj.nsp;
  27150. }
  27151. // immediately followed by the id
  27152. if (null != obj.id) {
  27153. if (nsp) {
  27154. str += ',';
  27155. nsp = false;
  27156. }
  27157. str += obj.id;
  27158. }
  27159. // json data
  27160. if (null != obj.data) {
  27161. if (nsp) str += ',';
  27162. str += json.stringify(obj.data);
  27163. }
  27164. debug('encoded %j as %s', obj, str);
  27165. return str;
  27166. }
  27167. /**
  27168. * Encode packet as 'buffer sequence' by removing blobs, and
  27169. * deconstructing packet into object with placeholders and
  27170. * a list of buffers.
  27171. *
  27172. * @param {Object} packet
  27173. * @return {Buffer} encoded
  27174. * @api private
  27175. */
  27176. function encodeAsBinary(obj, callback) {
  27177. function writeEncoding(bloblessData) {
  27178. var deconstruction = binary.deconstructPacket(bloblessData);
  27179. var pack = encodeAsString(deconstruction.packet);
  27180. var buffers = deconstruction.buffers;
  27181. buffers.unshift(pack); // add packet info to beginning of data list
  27182. callback(buffers); // write all the buffers
  27183. }
  27184. binary.removeBlobs(obj, writeEncoding);
  27185. }
  27186. /**
  27187. * A socket.io Decoder instance
  27188. *
  27189. * @return {Object} decoder
  27190. * @api public
  27191. */
  27192. function Decoder() {
  27193. this.reconstructor = null;
  27194. }
  27195. /**
  27196. * Mix in `Emitter` with Decoder.
  27197. */
  27198. Emitter(Decoder.prototype);
  27199. /**
  27200. * Decodes an ecoded packet string into packet JSON.
  27201. *
  27202. * @param {String} obj - encoded packet
  27203. * @return {Object} packet
  27204. * @api public
  27205. */
  27206. Decoder.prototype.add = function(obj) {
  27207. var packet;
  27208. if ('string' == typeof obj) {
  27209. packet = decodeString(obj);
  27210. if (exports.BINARY_EVENT == packet.type || exports.BINARY_ACK == packet.type) { // binary packet's json
  27211. this.reconstructor = new BinaryReconstructor(packet);
  27212. // no attachments, labeled binary but no binary data to follow
  27213. if (this.reconstructor.reconPack.attachments === 0) {
  27214. this.emit('decoded', packet);
  27215. }
  27216. } else { // non-binary full packet
  27217. this.emit('decoded', packet);
  27218. }
  27219. }
  27220. else if (isBuf(obj) || obj.base64) { // raw binary data
  27221. if (!this.reconstructor) {
  27222. throw new Error('got binary data when not reconstructing a packet');
  27223. } else {
  27224. packet = this.reconstructor.takeBinaryData(obj);
  27225. if (packet) { // received final buffer
  27226. this.reconstructor = null;
  27227. this.emit('decoded', packet);
  27228. }
  27229. }
  27230. }
  27231. else {
  27232. throw new Error('Unknown type: ' + obj);
  27233. }
  27234. };
  27235. /**
  27236. * Decode a packet String (JSON data)
  27237. *
  27238. * @param {String} str
  27239. * @return {Object} packet
  27240. * @api private
  27241. */
  27242. function decodeString(str) {
  27243. var p = {};
  27244. var i = 0;
  27245. // look up type
  27246. p.type = Number(str.charAt(0));
  27247. if (null == exports.types[p.type]) return error();
  27248. // look up attachments if type binary
  27249. if (exports.BINARY_EVENT == p.type || exports.BINARY_ACK == p.type) {
  27250. var buf = '';
  27251. while (str.charAt(++i) != '-') {
  27252. buf += str.charAt(i);
  27253. if (i == str.length) break;
  27254. }
  27255. if (buf != Number(buf) || str.charAt(i) != '-') {
  27256. throw new Error('Illegal attachments');
  27257. }
  27258. p.attachments = Number(buf);
  27259. }
  27260. // look up namespace (if any)
  27261. if ('/' == str.charAt(i + 1)) {
  27262. p.nsp = '';
  27263. while (++i) {
  27264. var c = str.charAt(i);
  27265. if (',' == c) break;
  27266. p.nsp += c;
  27267. if (i == str.length) break;
  27268. }
  27269. } else {
  27270. p.nsp = '/';
  27271. }
  27272. // look up id
  27273. var next = str.charAt(i + 1);
  27274. if ('' !== next && Number(next) == next) {
  27275. p.id = '';
  27276. while (++i) {
  27277. var c = str.charAt(i);
  27278. if (null == c || Number(c) != c) {
  27279. --i;
  27280. break;
  27281. }
  27282. p.id += str.charAt(i);
  27283. if (i == str.length) break;
  27284. }
  27285. p.id = Number(p.id);
  27286. }
  27287. // look up json data
  27288. if (str.charAt(++i)) {
  27289. p = tryParse(p, str.substr(i));
  27290. }
  27291. debug('decoded %s as %j', str, p);
  27292. return p;
  27293. }
  27294. function tryParse(p, str) {
  27295. try {
  27296. p.data = json.parse(str);
  27297. } catch(e){
  27298. return error();
  27299. }
  27300. return p;
  27301. };
  27302. /**
  27303. * Deallocates a parser's resources
  27304. *
  27305. * @api public
  27306. */
  27307. Decoder.prototype.destroy = function() {
  27308. if (this.reconstructor) {
  27309. this.reconstructor.finishedReconstruction();
  27310. }
  27311. };
  27312. /**
  27313. * A manager of a binary event's 'buffer sequence'. Should
  27314. * be constructed whenever a packet of type BINARY_EVENT is
  27315. * decoded.
  27316. *
  27317. * @param {Object} packet
  27318. * @return {BinaryReconstructor} initialized reconstructor
  27319. * @api private
  27320. */
  27321. function BinaryReconstructor(packet) {
  27322. this.reconPack = packet;
  27323. this.buffers = [];
  27324. }
  27325. /**
  27326. * Method to be called when binary data received from connection
  27327. * after a BINARY_EVENT packet.
  27328. *
  27329. * @param {Buffer | ArrayBuffer} binData - the raw binary data received
  27330. * @return {null | Object} returns null if more binary data is expected or
  27331. * a reconstructed packet object if all buffers have been received.
  27332. * @api private
  27333. */
  27334. BinaryReconstructor.prototype.takeBinaryData = function(binData) {
  27335. this.buffers.push(binData);
  27336. if (this.buffers.length == this.reconPack.attachments) { // done with buffer list
  27337. var packet = binary.reconstructPacket(this.reconPack, this.buffers);
  27338. this.finishedReconstruction();
  27339. return packet;
  27340. }
  27341. return null;
  27342. };
  27343. /**
  27344. * Cleans up binary packet reconstruction variables.
  27345. *
  27346. * @api private
  27347. */
  27348. BinaryReconstructor.prototype.finishedReconstruction = function() {
  27349. this.reconPack = null;
  27350. this.buffers = [];
  27351. };
  27352. function error(data){
  27353. return {
  27354. type: exports.ERROR,
  27355. data: 'parser error'
  27356. };
  27357. }
  27358. });
  27359. ___scope___.file("binary.js", function(exports, require, module, __filename, __dirname){
  27360. /*global Blob,File*/
  27361. /**
  27362. * Module requirements
  27363. */
  27364. var isArray = require('isarray');
  27365. var isBuf = require('./is-buffer');
  27366. /**
  27367. * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.
  27368. * Anything with blobs or files should be fed through removeBlobs before coming
  27369. * here.
  27370. *
  27371. * @param {Object} packet - socket.io event packet
  27372. * @return {Object} with deconstructed packet and list of buffers
  27373. * @api public
  27374. */
  27375. exports.deconstructPacket = function(packet){
  27376. var buffers = [];
  27377. var packetData = packet.data;
  27378. function _deconstructPacket(data) {
  27379. if (!data) return data;
  27380. if (isBuf(data)) {
  27381. var placeholder = { _placeholder: true, num: buffers.length };
  27382. buffers.push(data);
  27383. return placeholder;
  27384. } else if (isArray(data)) {
  27385. var newData = new Array(data.length);
  27386. for (var i = 0; i < data.length; i++) {
  27387. newData[i] = _deconstructPacket(data[i]);
  27388. }
  27389. return newData;
  27390. } else if ('object' == typeof data && !(data instanceof Date)) {
  27391. var newData = {};
  27392. for (var key in data) {
  27393. newData[key] = _deconstructPacket(data[key]);
  27394. }
  27395. return newData;
  27396. }
  27397. return data;
  27398. }
  27399. var pack = packet;
  27400. pack.data = _deconstructPacket(packetData);
  27401. pack.attachments = buffers.length; // number of binary 'attachments'
  27402. return {packet: pack, buffers: buffers};
  27403. };
  27404. /**
  27405. * Reconstructs a binary packet from its placeholder packet and buffers
  27406. *
  27407. * @param {Object} packet - event packet with placeholders
  27408. * @param {Array} buffers - binary buffers to put in placeholder positions
  27409. * @return {Object} reconstructed packet
  27410. * @api public
  27411. */
  27412. exports.reconstructPacket = function(packet, buffers) {
  27413. var curPlaceHolder = 0;
  27414. function _reconstructPacket(data) {
  27415. if (data && data._placeholder) {
  27416. var buf = buffers[data.num]; // appropriate buffer (should be natural order anyway)
  27417. return buf;
  27418. } else if (isArray(data)) {
  27419. for (var i = 0; i < data.length; i++) {
  27420. data[i] = _reconstructPacket(data[i]);
  27421. }
  27422. return data;
  27423. } else if (data && 'object' == typeof data) {
  27424. for (var key in data) {
  27425. data[key] = _reconstructPacket(data[key]);
  27426. }
  27427. return data;
  27428. }
  27429. return data;
  27430. }
  27431. packet.data = _reconstructPacket(packet.data);
  27432. packet.attachments = undefined; // no longer useful
  27433. return packet;
  27434. };
  27435. /**
  27436. * Asynchronously removes Blobs or Files from data via
  27437. * FileReader's readAsArrayBuffer method. Used before encoding
  27438. * data as msgpack. Calls callback with the blobless data.
  27439. *
  27440. * @param {Object} data
  27441. * @param {Function} callback
  27442. * @api private
  27443. */
  27444. exports.removeBlobs = function(data, callback) {
  27445. function _removeBlobs(obj, curKey, containingObject) {
  27446. if (!obj) return obj;
  27447. // convert any blob
  27448. if ((global.Blob && obj instanceof Blob) ||
  27449. (global.File && obj instanceof File)) {
  27450. pendingBlobs++;
  27451. // async filereader
  27452. var fileReader = new FileReader();
  27453. fileReader.onload = function() { // this.result == arraybuffer
  27454. if (containingObject) {
  27455. containingObject[curKey] = this.result;
  27456. }
  27457. else {
  27458. bloblessData = this.result;
  27459. }
  27460. // if nothing pending its callback time
  27461. if(! --pendingBlobs) {
  27462. callback(bloblessData);
  27463. }
  27464. };
  27465. fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer
  27466. } else if (isArray(obj)) { // handle array
  27467. for (var i = 0; i < obj.length; i++) {
  27468. _removeBlobs(obj[i], i, obj);
  27469. }
  27470. } else if (obj && 'object' == typeof obj && !isBuf(obj)) { // and object
  27471. for (var key in obj) {
  27472. _removeBlobs(obj[key], key, obj);
  27473. }
  27474. }
  27475. }
  27476. var pendingBlobs = 0;
  27477. var bloblessData = data;
  27478. _removeBlobs(bloblessData);
  27479. if (!pendingBlobs) {
  27480. callback(bloblessData);
  27481. }
  27482. };
  27483. });
  27484. ___scope___.file("is-buffer.js", function(exports, require, module, __filename, __dirname){
  27485. module.exports = isBuf;
  27486. /**
  27487. * Returns true if obj is a buffer or an arraybuffer.
  27488. *
  27489. * @api private
  27490. */
  27491. function isBuf(obj) {
  27492. return (global.Buffer && global.Buffer.isBuffer(obj)) ||
  27493. (global.ArrayBuffer && obj instanceof ArrayBuffer);
  27494. }
  27495. });
  27496. return ___scope___.entry = "index.js";
  27497. });
  27498. FuseBox.pkg("debug@2.2.0", {"ms":"0.7.1"}, function(___scope___){
  27499. ___scope___.file("browser.js", function(exports, require, module, __filename, __dirname){
  27500. /**
  27501. * This is the web browser implementation of `debug()`.
  27502. *
  27503. * Expose `debug()` as the module.
  27504. */
  27505. exports = module.exports = require('./debug');
  27506. exports.log = log;
  27507. exports.formatArgs = formatArgs;
  27508. exports.save = save;
  27509. exports.load = load;
  27510. exports.useColors = useColors;
  27511. exports.storage = 'undefined' != typeof chrome
  27512. && 'undefined' != typeof chrome.storage
  27513. ? chrome.storage.local
  27514. : localstorage();
  27515. /**
  27516. * Colors.
  27517. */
  27518. exports.colors = [
  27519. 'lightseagreen',
  27520. 'forestgreen',
  27521. 'goldenrod',
  27522. 'dodgerblue',
  27523. 'darkorchid',
  27524. 'crimson'
  27525. ];
  27526. /**
  27527. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  27528. * and the Firebug extension (any Firefox version) are known
  27529. * to support "%c" CSS customizations.
  27530. *
  27531. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  27532. */
  27533. function useColors() {
  27534. // is webkit? http://stackoverflow.com/a/16459606/376773
  27535. return ('WebkitAppearance' in document.documentElement.style) ||
  27536. // is firebug? http://stackoverflow.com/a/398120/376773
  27537. (window.console && (console.firebug || (console.exception && console.table))) ||
  27538. // is firefox >= v31?
  27539. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  27540. (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
  27541. }
  27542. /**
  27543. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  27544. */
  27545. exports.formatters.j = function(v) {
  27546. return JSON.stringify(v);
  27547. };
  27548. /**
  27549. * Colorize log arguments if enabled.
  27550. *
  27551. * @api public
  27552. */
  27553. function formatArgs() {
  27554. var args = arguments;
  27555. var useColors = this.useColors;
  27556. args[0] = (useColors ? '%c' : '')
  27557. + this.namespace
  27558. + (useColors ? ' %c' : ' ')
  27559. + args[0]
  27560. + (useColors ? '%c ' : ' ')
  27561. + '+' + exports.humanize(this.diff);
  27562. if (!useColors) return args;
  27563. var c = 'color: ' + this.color;
  27564. args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
  27565. // the final "%c" is somewhat tricky, because there could be other
  27566. // arguments passed either before or after the %c, so we need to
  27567. // figure out the correct index to insert the CSS into
  27568. var index = 0;
  27569. var lastC = 0;
  27570. args[0].replace(/%[a-z%]/g, function(match) {
  27571. if ('%%' === match) return;
  27572. index++;
  27573. if ('%c' === match) {
  27574. // we only are interested in the *last* %c
  27575. // (the user may have provided their own)
  27576. lastC = index;
  27577. }
  27578. });
  27579. args.splice(lastC, 0, c);
  27580. return args;
  27581. }
  27582. /**
  27583. * Invokes `console.log()` when available.
  27584. * No-op when `console.log` is not a "function".
  27585. *
  27586. * @api public
  27587. */
  27588. function log() {
  27589. // this hackery is required for IE8/9, where
  27590. // the `console.log` function doesn't have 'apply'
  27591. return 'object' === typeof console
  27592. && console.log
  27593. && Function.prototype.apply.call(console.log, console, arguments);
  27594. }
  27595. /**
  27596. * Save `namespaces`.
  27597. *
  27598. * @param {String} namespaces
  27599. * @api private
  27600. */
  27601. function save(namespaces) {
  27602. try {
  27603. if (null == namespaces) {
  27604. exports.storage.removeItem('debug');
  27605. } else {
  27606. exports.storage.debug = namespaces;
  27607. }
  27608. } catch(e) {}
  27609. }
  27610. /**
  27611. * Load `namespaces`.
  27612. *
  27613. * @return {String} returns the previously persisted debug modes
  27614. * @api private
  27615. */
  27616. function load() {
  27617. var r;
  27618. try {
  27619. r = exports.storage.debug;
  27620. } catch(e) {}
  27621. return r;
  27622. }
  27623. /**
  27624. * Enable namespaces listed in `localStorage.debug` initially.
  27625. */
  27626. exports.enable(load());
  27627. /**
  27628. * Localstorage attempts to return the localstorage.
  27629. *
  27630. * This is necessary because safari throws
  27631. * when a user disables cookies/localstorage
  27632. * and you attempt to access it.
  27633. *
  27634. * @return {LocalStorage}
  27635. * @api private
  27636. */
  27637. function localstorage(){
  27638. try {
  27639. return window.localStorage;
  27640. } catch (e) {}
  27641. }
  27642. });
  27643. ___scope___.file("debug.js", function(exports, require, module, __filename, __dirname){
  27644. /**
  27645. * This is the common logic for both the Node.js and web browser
  27646. * implementations of `debug()`.
  27647. *
  27648. * Expose `debug()` as the module.
  27649. */
  27650. exports = module.exports = debug;
  27651. exports.coerce = coerce;
  27652. exports.disable = disable;
  27653. exports.enable = enable;
  27654. exports.enabled = enabled;
  27655. exports.humanize = require('ms');
  27656. /**
  27657. * The currently active debug mode names, and names to skip.
  27658. */
  27659. exports.names = [];
  27660. exports.skips = [];
  27661. /**
  27662. * Map of special "%n" handling functions, for the debug "format" argument.
  27663. *
  27664. * Valid key names are a single, lowercased letter, i.e. "n".
  27665. */
  27666. exports.formatters = {};
  27667. /**
  27668. * Previously assigned color.
  27669. */
  27670. var prevColor = 0;
  27671. /**
  27672. * Previous log timestamp.
  27673. */
  27674. var prevTime;
  27675. /**
  27676. * Select a color.
  27677. *
  27678. * @return {Number}
  27679. * @api private
  27680. */
  27681. function selectColor() {
  27682. return exports.colors[prevColor++ % exports.colors.length];
  27683. }
  27684. /**
  27685. * Create a debugger with the given `namespace`.
  27686. *
  27687. * @param {String} namespace
  27688. * @return {Function}
  27689. * @api public
  27690. */
  27691. function debug(namespace) {
  27692. // define the `disabled` version
  27693. function disabled() {
  27694. }
  27695. disabled.enabled = false;
  27696. // define the `enabled` version
  27697. function enabled() {
  27698. var self = enabled;
  27699. // set `diff` timestamp
  27700. var curr = +new Date();
  27701. var ms = curr - (prevTime || curr);
  27702. self.diff = ms;
  27703. self.prev = prevTime;
  27704. self.curr = curr;
  27705. prevTime = curr;
  27706. // add the `color` if not set
  27707. if (null == self.useColors) self.useColors = exports.useColors();
  27708. if (null == self.color && self.useColors) self.color = selectColor();
  27709. var args = Array.prototype.slice.call(arguments);
  27710. args[0] = exports.coerce(args[0]);
  27711. if ('string' !== typeof args[0]) {
  27712. // anything else let's inspect with %o
  27713. args = ['%o'].concat(args);
  27714. }
  27715. // apply any `formatters` transformations
  27716. var index = 0;
  27717. args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
  27718. // if we encounter an escaped % then don't increase the array index
  27719. if (match === '%%') return match;
  27720. index++;
  27721. var formatter = exports.formatters[format];
  27722. if ('function' === typeof formatter) {
  27723. var val = args[index];
  27724. match = formatter.call(self, val);
  27725. // now we need to remove `args[index]` since it's inlined in the `format`
  27726. args.splice(index, 1);
  27727. index--;
  27728. }
  27729. return match;
  27730. });
  27731. if ('function' === typeof exports.formatArgs) {
  27732. args = exports.formatArgs.apply(self, args);
  27733. }
  27734. var logFn = enabled.log || exports.log || console.log.bind(console);
  27735. logFn.apply(self, args);
  27736. }
  27737. enabled.enabled = true;
  27738. var fn = exports.enabled(namespace) ? enabled : disabled;
  27739. fn.namespace = namespace;
  27740. return fn;
  27741. }
  27742. /**
  27743. * Enables a debug mode by namespaces. This can include modes
  27744. * separated by a colon and wildcards.
  27745. *
  27746. * @param {String} namespaces
  27747. * @api public
  27748. */
  27749. function enable(namespaces) {
  27750. exports.save(namespaces);
  27751. var split = (namespaces || '').split(/[\s,]+/);
  27752. var len = split.length;
  27753. for (var i = 0; i < len; i++) {
  27754. if (!split[i]) continue; // ignore empty strings
  27755. namespaces = split[i].replace(/\*/g, '.*?');
  27756. if (namespaces[0] === '-') {
  27757. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  27758. } else {
  27759. exports.names.push(new RegExp('^' + namespaces + '$'));
  27760. }
  27761. }
  27762. }
  27763. /**
  27764. * Disable debug output.
  27765. *
  27766. * @api public
  27767. */
  27768. function disable() {
  27769. exports.enable('');
  27770. }
  27771. /**
  27772. * Returns true if the given mode name is enabled, false otherwise.
  27773. *
  27774. * @param {String} name
  27775. * @return {Boolean}
  27776. * @api public
  27777. */
  27778. function enabled(name) {
  27779. var i, len;
  27780. for (i = 0, len = exports.skips.length; i < len; i++) {
  27781. if (exports.skips[i].test(name)) {
  27782. return false;
  27783. }
  27784. }
  27785. for (i = 0, len = exports.names.length; i < len; i++) {
  27786. if (exports.names[i].test(name)) {
  27787. return true;
  27788. }
  27789. }
  27790. return false;
  27791. }
  27792. /**
  27793. * Coerce `val`.
  27794. *
  27795. * @param {Mixed} val
  27796. * @return {Mixed}
  27797. * @api private
  27798. */
  27799. function coerce(val) {
  27800. if (val instanceof Error) return val.stack || val.message;
  27801. return val;
  27802. }
  27803. });
  27804. return ___scope___.entry = "browser.js";
  27805. });
  27806. FuseBox.pkg("ms@0.7.1", {}, function(___scope___){
  27807. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  27808. /**
  27809. * Helpers.
  27810. */
  27811. var s = 1000;
  27812. var m = s * 60;
  27813. var h = m * 60;
  27814. var d = h * 24;
  27815. var y = d * 365.25;
  27816. /**
  27817. * Parse or format the given `val`.
  27818. *
  27819. * Options:
  27820. *
  27821. * - `long` verbose formatting [false]
  27822. *
  27823. * @param {String|Number} val
  27824. * @param {Object} options
  27825. * @return {String|Number}
  27826. * @api public
  27827. */
  27828. module.exports = function(val, options){
  27829. options = options || {};
  27830. if ('string' == typeof val) return parse(val);
  27831. return options.long
  27832. ? long(val)
  27833. : short(val);
  27834. };
  27835. /**
  27836. * Parse the given `str` and return milliseconds.
  27837. *
  27838. * @param {String} str
  27839. * @return {Number}
  27840. * @api private
  27841. */
  27842. function parse(str) {
  27843. str = '' + str;
  27844. if (str.length > 10000) return;
  27845. var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
  27846. if (!match) return;
  27847. var n = parseFloat(match[1]);
  27848. var type = (match[2] || 'ms').toLowerCase();
  27849. switch (type) {
  27850. case 'years':
  27851. case 'year':
  27852. case 'yrs':
  27853. case 'yr':
  27854. case 'y':
  27855. return n * y;
  27856. case 'days':
  27857. case 'day':
  27858. case 'd':
  27859. return n * d;
  27860. case 'hours':
  27861. case 'hour':
  27862. case 'hrs':
  27863. case 'hr':
  27864. case 'h':
  27865. return n * h;
  27866. case 'minutes':
  27867. case 'minute':
  27868. case 'mins':
  27869. case 'min':
  27870. case 'm':
  27871. return n * m;
  27872. case 'seconds':
  27873. case 'second':
  27874. case 'secs':
  27875. case 'sec':
  27876. case 's':
  27877. return n * s;
  27878. case 'milliseconds':
  27879. case 'millisecond':
  27880. case 'msecs':
  27881. case 'msec':
  27882. case 'ms':
  27883. return n;
  27884. }
  27885. }
  27886. /**
  27887. * Short format for `ms`.
  27888. *
  27889. * @param {Number} ms
  27890. * @return {String}
  27891. * @api private
  27892. */
  27893. function short(ms) {
  27894. if (ms >= d) return Math.round(ms / d) + 'd';
  27895. if (ms >= h) return Math.round(ms / h) + 'h';
  27896. if (ms >= m) return Math.round(ms / m) + 'm';
  27897. if (ms >= s) return Math.round(ms / s) + 's';
  27898. return ms + 'ms';
  27899. }
  27900. /**
  27901. * Long format for `ms`.
  27902. *
  27903. * @param {Number} ms
  27904. * @return {String}
  27905. * @api private
  27906. */
  27907. function long(ms) {
  27908. return plural(ms, d, 'day')
  27909. || plural(ms, h, 'hour')
  27910. || plural(ms, m, 'minute')
  27911. || plural(ms, s, 'second')
  27912. || ms + ' ms';
  27913. }
  27914. /**
  27915. * Pluralization helper.
  27916. */
  27917. function plural(ms, n, name) {
  27918. if (ms < n) return;
  27919. if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
  27920. return Math.ceil(ms / n) + ' ' + name + 's';
  27921. }
  27922. });
  27923. return ___scope___.entry = "index.js";
  27924. });
  27925. FuseBox.pkg("json3", {}, function(___scope___){
  27926. ___scope___.file("lib/json3.js", function(exports, require, module, __filename, __dirname){
  27927. /*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
  27928. ;(function () {
  27929. // Detect the `define` function exposed by asynchronous module loaders. The
  27930. // strict `define` check is necessary for compatibility with `r.js`.
  27931. var isLoader = typeof define === "function" && define.amd;
  27932. // A set of types used to distinguish objects from primitives.
  27933. var objectTypes = {
  27934. "function": true,
  27935. "object": true
  27936. };
  27937. // Detect the `exports` object exposed by CommonJS implementations.
  27938. var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
  27939. // Use the `global` object exposed by Node (including Browserify via
  27940. // `insert-module-globals`), Narwhal, and Ringo as the default context,
  27941. // and the `window` object in browsers. Rhino exports a `global` function
  27942. // instead.
  27943. var root = objectTypes[typeof window] && window || this,
  27944. freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global;
  27945. if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) {
  27946. root = freeGlobal;
  27947. }
  27948. // Public: Initializes JSON 3 using the given `context` object, attaching the
  27949. // `stringify` and `parse` functions to the specified `exports` object.
  27950. function runInContext(context, exports) {
  27951. context || (context = root["Object"]());
  27952. exports || (exports = root["Object"]());
  27953. // Native constructor aliases.
  27954. var Number = context["Number"] || root["Number"],
  27955. String = context["String"] || root["String"],
  27956. Object = context["Object"] || root["Object"],
  27957. Date = context["Date"] || root["Date"],
  27958. SyntaxError = context["SyntaxError"] || root["SyntaxError"],
  27959. TypeError = context["TypeError"] || root["TypeError"],
  27960. Math = context["Math"] || root["Math"],
  27961. nativeJSON = context["JSON"] || root["JSON"];
  27962. // Delegate to the native `stringify` and `parse` implementations.
  27963. if (typeof nativeJSON == "object" && nativeJSON) {
  27964. exports.stringify = nativeJSON.stringify;
  27965. exports.parse = nativeJSON.parse;
  27966. }
  27967. // Convenience aliases.
  27968. var objectProto = Object.prototype,
  27969. getClass = objectProto.toString,
  27970. isProperty, forEach, undef;
  27971. // Test the `Date#getUTC*` methods. Based on work by @Yaffle.
  27972. var isExtended = new Date(-3509827334573292);
  27973. try {
  27974. // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
  27975. // results for certain dates in Opera >= 10.53.
  27976. isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
  27977. // Safari < 2.0.2 stores the internal millisecond time value correctly,
  27978. // but clips the values returned by the date methods to the range of
  27979. // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
  27980. isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
  27981. } catch (exception) {}
  27982. // Internal: Determines whether the native `JSON.stringify` and `parse`
  27983. // implementations are spec-compliant. Based on work by Ken Snyder.
  27984. function has(name) {
  27985. if (has[name] !== undef) {
  27986. // Return cached feature test result.
  27987. return has[name];
  27988. }
  27989. var isSupported;
  27990. if (name == "bug-string-char-index") {
  27991. // IE <= 7 doesn't support accessing string characters using square
  27992. // bracket notation. IE 8 only supports this for primitives.
  27993. isSupported = "a"[0] != "a";
  27994. } else if (name == "json") {
  27995. // Indicates whether both `JSON.stringify` and `JSON.parse` are
  27996. // supported.
  27997. isSupported = has("json-stringify") && has("json-parse");
  27998. } else {
  27999. var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
  28000. // Test `JSON.stringify`.
  28001. if (name == "json-stringify") {
  28002. var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended;
  28003. if (stringifySupported) {
  28004. // A test function object with a custom `toJSON` method.
  28005. (value = function () {
  28006. return 1;
  28007. }).toJSON = value;
  28008. try {
  28009. stringifySupported =
  28010. // Firefox 3.1b1 and b2 serialize string, number, and boolean
  28011. // primitives as object literals.
  28012. stringify(0) === "0" &&
  28013. // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
  28014. // literals.
  28015. stringify(new Number()) === "0" &&
  28016. stringify(new String()) == '""' &&
  28017. // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
  28018. // does not define a canonical JSON representation (this applies to
  28019. // objects with `toJSON` properties as well, *unless* they are nested
  28020. // within an object or array).
  28021. stringify(getClass) === undef &&
  28022. // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
  28023. // FF 3.1b3 pass this test.
  28024. stringify(undef) === undef &&
  28025. // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
  28026. // respectively, if the value is omitted entirely.
  28027. stringify() === undef &&
  28028. // FF 3.1b1, 2 throw an error if the given value is not a number,
  28029. // string, array, object, Boolean, or `null` literal. This applies to
  28030. // objects with custom `toJSON` methods as well, unless they are nested
  28031. // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
  28032. // methods entirely.
  28033. stringify(value) === "1" &&
  28034. stringify([value]) == "[1]" &&
  28035. // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
  28036. // `"[null]"`.
  28037. stringify([undef]) == "[null]" &&
  28038. // YUI 3.0.0b1 fails to serialize `null` literals.
  28039. stringify(null) == "null" &&
  28040. // FF 3.1b1, 2 halts serialization if an array contains a function:
  28041. // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
  28042. // elides non-JSON values from objects and arrays, unless they
  28043. // define custom `toJSON` methods.
  28044. stringify([undef, getClass, null]) == "[null,null,null]" &&
  28045. // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
  28046. // where character escape codes are expected (e.g., `\b` => `\u0008`).
  28047. stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized &&
  28048. // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
  28049. stringify(null, value) === "1" &&
  28050. stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
  28051. // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
  28052. // serialize extended years.
  28053. stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
  28054. // The milliseconds are optional in ES 5, but required in 5.1.
  28055. stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
  28056. // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
  28057. // four-digit years instead of six-digit years. Credits: @Yaffle.
  28058. stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
  28059. // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
  28060. // values less than 1000. Credits: @Yaffle.
  28061. stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
  28062. } catch (exception) {
  28063. stringifySupported = false;
  28064. }
  28065. }
  28066. isSupported = stringifySupported;
  28067. }
  28068. // Test `JSON.parse`.
  28069. if (name == "json-parse") {
  28070. var parse = exports.parse;
  28071. if (typeof parse == "function") {
  28072. try {
  28073. // FF 3.1b1, b2 will throw an exception if a bare literal is provided.
  28074. // Conforming implementations should also coerce the initial argument to
  28075. // a string prior to parsing.
  28076. if (parse("0") === 0 && !parse(false)) {
  28077. // Simple parsing test.
  28078. value = parse(serialized);
  28079. var parseSupported = value["a"].length == 5 && value["a"][0] === 1;
  28080. if (parseSupported) {
  28081. try {
  28082. // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
  28083. parseSupported = !parse('"\t"');
  28084. } catch (exception) {}
  28085. if (parseSupported) {
  28086. try {
  28087. // FF 4.0 and 4.0.1 allow leading `+` signs and leading
  28088. // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow
  28089. // certain octal literals.
  28090. parseSupported = parse("01") !== 1;
  28091. } catch (exception) {}
  28092. }
  28093. if (parseSupported) {
  28094. try {
  28095. // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal
  28096. // points. These environments, along with FF 3.1b1 and 2,
  28097. // also allow trailing commas in JSON objects and arrays.
  28098. parseSupported = parse("1.") !== 1;
  28099. } catch (exception) {}
  28100. }
  28101. }
  28102. }
  28103. } catch (exception) {
  28104. parseSupported = false;
  28105. }
  28106. }
  28107. isSupported = parseSupported;
  28108. }
  28109. }
  28110. return has[name] = !!isSupported;
  28111. }
  28112. if (!has("json")) {
  28113. // Common `[[Class]]` name aliases.
  28114. var functionClass = "[object Function]",
  28115. dateClass = "[object Date]",
  28116. numberClass = "[object Number]",
  28117. stringClass = "[object String]",
  28118. arrayClass = "[object Array]",
  28119. booleanClass = "[object Boolean]";
  28120. // Detect incomplete support for accessing string characters by index.
  28121. var charIndexBuggy = has("bug-string-char-index");
  28122. // Define additional utility methods if the `Date` methods are buggy.
  28123. if (!isExtended) {
  28124. var floor = Math.floor;
  28125. // A mapping between the months of the year and the number of days between
  28126. // January 1st and the first of the respective month.
  28127. var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
  28128. // Internal: Calculates the number of days between the Unix epoch and the
  28129. // first day of the given month.
  28130. var getDay = function (year, month) {
  28131. return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
  28132. };
  28133. }
  28134. // Internal: Determines if a property is a direct property of the given
  28135. // object. Delegates to the native `Object#hasOwnProperty` method.
  28136. if (!(isProperty = objectProto.hasOwnProperty)) {
  28137. isProperty = function (property) {
  28138. var members = {}, constructor;
  28139. if ((members.__proto__ = null, members.__proto__ = {
  28140. // The *proto* property cannot be set multiple times in recent
  28141. // versions of Firefox and SeaMonkey.
  28142. "toString": 1
  28143. }, members).toString != getClass) {
  28144. // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but
  28145. // supports the mutable *proto* property.
  28146. isProperty = function (property) {
  28147. // Capture and break the object's prototype chain (see section 8.6.2
  28148. // of the ES 5.1 spec). The parenthesized expression prevents an
  28149. // unsafe transformation by the Closure Compiler.
  28150. var original = this.__proto__, result = property in (this.__proto__ = null, this);
  28151. // Restore the original prototype chain.
  28152. this.__proto__ = original;
  28153. return result;
  28154. };
  28155. } else {
  28156. // Capture a reference to the top-level `Object` constructor.
  28157. constructor = members.constructor;
  28158. // Use the `constructor` property to simulate `Object#hasOwnProperty` in
  28159. // other environments.
  28160. isProperty = function (property) {
  28161. var parent = (this.constructor || constructor).prototype;
  28162. return property in this && !(property in parent && this[property] === parent[property]);
  28163. };
  28164. }
  28165. members = null;
  28166. return isProperty.call(this, property);
  28167. };
  28168. }
  28169. // Internal: Normalizes the `for...in` iteration algorithm across
  28170. // environments. Each enumerated key is yielded to a `callback` function.
  28171. forEach = function (object, callback) {
  28172. var size = 0, Properties, members, property;
  28173. // Tests for bugs in the current environment's `for...in` algorithm. The
  28174. // `valueOf` property inherits the non-enumerable flag from
  28175. // `Object.prototype` in older versions of IE, Netscape, and Mozilla.
  28176. (Properties = function () {
  28177. this.valueOf = 0;
  28178. }).prototype.valueOf = 0;
  28179. // Iterate over a new instance of the `Properties` class.
  28180. members = new Properties();
  28181. for (property in members) {
  28182. // Ignore all properties inherited from `Object.prototype`.
  28183. if (isProperty.call(members, property)) {
  28184. size++;
  28185. }
  28186. }
  28187. Properties = members = null;
  28188. // Normalize the iteration algorithm.
  28189. if (!size) {
  28190. // A list of non-enumerable properties inherited from `Object.prototype`.
  28191. members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"];
  28192. // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
  28193. // properties.
  28194. forEach = function (object, callback) {
  28195. var isFunction = getClass.call(object) == functionClass, property, length;
  28196. var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty;
  28197. for (property in object) {
  28198. // Gecko <= 1.0 enumerates the `prototype` property of functions under
  28199. // certain conditions; IE does not.
  28200. if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {
  28201. callback(property);
  28202. }
  28203. }
  28204. // Manually invoke the callback for each non-enumerable property.
  28205. for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property));
  28206. };
  28207. } else if (size == 2) {
  28208. // Safari <= 2.0.4 enumerates shadowed properties twice.
  28209. forEach = function (object, callback) {
  28210. // Create a set of iterated properties.
  28211. var members = {}, isFunction = getClass.call(object) == functionClass, property;
  28212. for (property in object) {
  28213. // Store each property name to prevent double enumeration. The
  28214. // `prototype` property of functions is not enumerated due to cross-
  28215. // environment inconsistencies.
  28216. if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) {
  28217. callback(property);
  28218. }
  28219. }
  28220. };
  28221. } else {
  28222. // No bugs detected; use the standard `for...in` algorithm.
  28223. forEach = function (object, callback) {
  28224. var isFunction = getClass.call(object) == functionClass, property, isConstructor;
  28225. for (property in object) {
  28226. if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
  28227. callback(property);
  28228. }
  28229. }
  28230. // Manually invoke the callback for the `constructor` property due to
  28231. // cross-environment inconsistencies.
  28232. if (isConstructor || isProperty.call(object, (property = "constructor"))) {
  28233. callback(property);
  28234. }
  28235. };
  28236. }
  28237. return forEach(object, callback);
  28238. };
  28239. // Public: Serializes a JavaScript `value` as a JSON string. The optional
  28240. // `filter` argument may specify either a function that alters how object and
  28241. // array members are serialized, or an array of strings and numbers that
  28242. // indicates which properties should be serialized. The optional `width`
  28243. // argument may be either a string or number that specifies the indentation
  28244. // level of the output.
  28245. if (!has("json-stringify")) {
  28246. // Internal: A map of control characters and their escaped equivalents.
  28247. var Escapes = {
  28248. 92: "\\\\",
  28249. 34: '\\"',
  28250. 8: "\\b",
  28251. 12: "\\f",
  28252. 10: "\\n",
  28253. 13: "\\r",
  28254. 9: "\\t"
  28255. };
  28256. // Internal: Converts `value` into a zero-padded string such that its
  28257. // length is at least equal to `width`. The `width` must be <= 6.
  28258. var leadingZeroes = "000000";
  28259. var toPaddedString = function (width, value) {
  28260. // The `|| 0` expression is necessary to work around a bug in
  28261. // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
  28262. return (leadingZeroes + (value || 0)).slice(-width);
  28263. };
  28264. // Internal: Double-quotes a string `value`, replacing all ASCII control
  28265. // characters (characters with code unit values between 0 and 31) with
  28266. // their escaped equivalents. This is an implementation of the
  28267. // `Quote(value)` operation defined in ES 5.1 section 15.12.3.
  28268. var unicodePrefix = "\\u00";
  28269. var quote = function (value) {
  28270. var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10;
  28271. var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value);
  28272. for (; index < length; index++) {
  28273. var charCode = value.charCodeAt(index);
  28274. // If the character is a control character, append its Unicode or
  28275. // shorthand escape sequence; otherwise, append the character as-is.
  28276. switch (charCode) {
  28277. case 8: case 9: case 10: case 12: case 13: case 34: case 92:
  28278. result += Escapes[charCode];
  28279. break;
  28280. default:
  28281. if (charCode < 32) {
  28282. result += unicodePrefix + toPaddedString(2, charCode.toString(16));
  28283. break;
  28284. }
  28285. result += useCharIndex ? symbols[index] : value.charAt(index);
  28286. }
  28287. }
  28288. return result + '"';
  28289. };
  28290. // Internal: Recursively serializes an object. Implements the
  28291. // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
  28292. var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
  28293. var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result;
  28294. try {
  28295. // Necessary for host object support.
  28296. value = object[property];
  28297. } catch (exception) {}
  28298. if (typeof value == "object" && value) {
  28299. className = getClass.call(value);
  28300. if (className == dateClass && !isProperty.call(value, "toJSON")) {
  28301. if (value > -1 / 0 && value < 1 / 0) {
  28302. // Dates are serialized according to the `Date#toJSON` method
  28303. // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
  28304. // for the ISO 8601 date time string format.
  28305. if (getDay) {
  28306. // Manually compute the year, month, date, hours, minutes,
  28307. // seconds, and milliseconds if the `getUTC*` methods are
  28308. // buggy. Adapted from @Yaffle's `date-shim` project.
  28309. date = floor(value / 864e5);
  28310. for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);
  28311. for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);
  28312. date = 1 + date - getDay(year, month);
  28313. // The `time` value specifies the time within the day (see ES
  28314. // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
  28315. // to compute `A modulo B`, as the `%` operator does not
  28316. // correspond to the `modulo` operation for negative numbers.
  28317. time = (value % 864e5 + 864e5) % 864e5;
  28318. // The hours, minutes, seconds, and milliseconds are obtained by
  28319. // decomposing the time within the day. See section 15.9.1.10.
  28320. hours = floor(time / 36e5) % 24;
  28321. minutes = floor(time / 6e4) % 60;
  28322. seconds = floor(time / 1e3) % 60;
  28323. milliseconds = time % 1e3;
  28324. } else {
  28325. year = value.getUTCFullYear();
  28326. month = value.getUTCMonth();
  28327. date = value.getUTCDate();
  28328. hours = value.getUTCHours();
  28329. minutes = value.getUTCMinutes();
  28330. seconds = value.getUTCSeconds();
  28331. milliseconds = value.getUTCMilliseconds();
  28332. }
  28333. // Serialize extended years correctly.
  28334. value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +
  28335. "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) +
  28336. // Months, dates, hours, minutes, and seconds should have two
  28337. // digits; milliseconds should have three.
  28338. "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) +
  28339. // Milliseconds are optional in ES 5.0, but required in 5.1.
  28340. "." + toPaddedString(3, milliseconds) + "Z";
  28341. } else {
  28342. value = null;
  28343. }
  28344. } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) {
  28345. // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
  28346. // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
  28347. // ignores all `toJSON` methods on these objects unless they are
  28348. // defined directly on an instance.
  28349. value = value.toJSON(property);
  28350. }
  28351. }
  28352. if (callback) {
  28353. // If a replacement function was provided, call it to obtain the value
  28354. // for serialization.
  28355. value = callback.call(object, property, value);
  28356. }
  28357. if (value === null) {
  28358. return "null";
  28359. }
  28360. className = getClass.call(value);
  28361. if (className == booleanClass) {
  28362. // Booleans are represented literally.
  28363. return "" + value;
  28364. } else if (className == numberClass) {
  28365. // JSON numbers must be finite. `Infinity` and `NaN` are serialized as
  28366. // `"null"`.
  28367. return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
  28368. } else if (className == stringClass) {
  28369. // Strings are double-quoted and escaped.
  28370. return quote("" + value);
  28371. }
  28372. // Recursively serialize objects and arrays.
  28373. if (typeof value == "object") {
  28374. // Check for cyclic structures. This is a linear search; performance
  28375. // is inversely proportional to the number of unique nested objects.
  28376. for (length = stack.length; length--;) {
  28377. if (stack[length] === value) {
  28378. // Cyclic structures cannot be serialized by `JSON.stringify`.
  28379. throw TypeError();
  28380. }
  28381. }
  28382. // Add the object to the stack of traversed objects.
  28383. stack.push(value);
  28384. results = [];
  28385. // Save the current indentation level and indent one additional level.
  28386. prefix = indentation;
  28387. indentation += whitespace;
  28388. if (className == arrayClass) {
  28389. // Recursively serialize array elements.
  28390. for (index = 0, length = value.length; index < length; index++) {
  28391. element = serialize(index, value, callback, properties, whitespace, indentation, stack);
  28392. results.push(element === undef ? "null" : element);
  28393. }
  28394. result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
  28395. } else {
  28396. // Recursively serialize object members. Members are selected from
  28397. // either a user-specified list of property names, or the object
  28398. // itself.
  28399. forEach(properties || value, function (property) {
  28400. var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
  28401. if (element !== undef) {
  28402. // According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
  28403. // is not the empty string, let `member` {quote(property) + ":"}
  28404. // be the concatenation of `member` and the `space` character."
  28405. // The "`space` character" refers to the literal space
  28406. // character, not the `space` {width} argument provided to
  28407. // `JSON.stringify`.
  28408. results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
  28409. }
  28410. });
  28411. result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
  28412. }
  28413. // Remove the object from the traversed object stack.
  28414. stack.pop();
  28415. return result;
  28416. }
  28417. };
  28418. // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
  28419. exports.stringify = function (source, filter, width) {
  28420. var whitespace, callback, properties, className;
  28421. if (objectTypes[typeof filter] && filter) {
  28422. if ((className = getClass.call(filter)) == functionClass) {
  28423. callback = filter;
  28424. } else if (className == arrayClass) {
  28425. // Convert the property names array into a makeshift set.
  28426. properties = {};
  28427. for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1));
  28428. }
  28429. }
  28430. if (width) {
  28431. if ((className = getClass.call(width)) == numberClass) {
  28432. // Convert the `width` to an integer and create a string containing
  28433. // `width` number of space characters.
  28434. if ((width -= width % 1) > 0) {
  28435. for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
  28436. }
  28437. } else if (className == stringClass) {
  28438. whitespace = width.length <= 10 ? width : width.slice(0, 10);
  28439. }
  28440. }
  28441. // Opera <= 7.54u2 discards the values associated with empty string keys
  28442. // (`""`) only if they are used directly within an object member list
  28443. // (e.g., `!("" in { "": 1})`).
  28444. return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
  28445. };
  28446. }
  28447. // Public: Parses a JSON source string.
  28448. if (!has("json-parse")) {
  28449. var fromCharCode = String.fromCharCode;
  28450. // Internal: A map of escaped control characters and their unescaped
  28451. // equivalents.
  28452. var Unescapes = {
  28453. 92: "\\",
  28454. 34: '"',
  28455. 47: "/",
  28456. 98: "\b",
  28457. 116: "\t",
  28458. 110: "\n",
  28459. 102: "\f",
  28460. 114: "\r"
  28461. };
  28462. // Internal: Stores the parser state.
  28463. var Index, Source;
  28464. // Internal: Resets the parser state and throws a `SyntaxError`.
  28465. var abort = function () {
  28466. Index = Source = null;
  28467. throw SyntaxError();
  28468. };
  28469. // Internal: Returns the next token, or `"$"` if the parser has reached
  28470. // the end of the source string. A token may be a string, number, `null`
  28471. // literal, or Boolean literal.
  28472. var lex = function () {
  28473. var source = Source, length = source.length, value, begin, position, isSigned, charCode;
  28474. while (Index < length) {
  28475. charCode = source.charCodeAt(Index);
  28476. switch (charCode) {
  28477. case 9: case 10: case 13: case 32:
  28478. // Skip whitespace tokens, including tabs, carriage returns, line
  28479. // feeds, and space characters.
  28480. Index++;
  28481. break;
  28482. case 123: case 125: case 91: case 93: case 58: case 44:
  28483. // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
  28484. // the current position.
  28485. value = charIndexBuggy ? source.charAt(Index) : source[Index];
  28486. Index++;
  28487. return value;
  28488. case 34:
  28489. // `"` delimits a JSON string; advance to the next character and
  28490. // begin parsing the string. String tokens are prefixed with the
  28491. // sentinel `@` character to distinguish them from punctuators and
  28492. // end-of-string tokens.
  28493. for (value = "@", Index++; Index < length;) {
  28494. charCode = source.charCodeAt(Index);
  28495. if (charCode < 32) {
  28496. // Unescaped ASCII control characters (those with a code unit
  28497. // less than the space character) are not permitted.
  28498. abort();
  28499. } else if (charCode == 92) {
  28500. // A reverse solidus (`\`) marks the beginning of an escaped
  28501. // control character (including `"`, `\`, and `/`) or Unicode
  28502. // escape sequence.
  28503. charCode = source.charCodeAt(++Index);
  28504. switch (charCode) {
  28505. case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:
  28506. // Revive escaped control characters.
  28507. value += Unescapes[charCode];
  28508. Index++;
  28509. break;
  28510. case 117:
  28511. // `\u` marks the beginning of a Unicode escape sequence.
  28512. // Advance to the first character and validate the
  28513. // four-digit code point.
  28514. begin = ++Index;
  28515. for (position = Index + 4; Index < position; Index++) {
  28516. charCode = source.charCodeAt(Index);
  28517. // A valid sequence comprises four hexdigits (case-
  28518. // insensitive) that form a single hexadecimal value.
  28519. if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
  28520. // Invalid Unicode escape sequence.
  28521. abort();
  28522. }
  28523. }
  28524. // Revive the escaped character.
  28525. value += fromCharCode("0x" + source.slice(begin, Index));
  28526. break;
  28527. default:
  28528. // Invalid escape sequence.
  28529. abort();
  28530. }
  28531. } else {
  28532. if (charCode == 34) {
  28533. // An unescaped double-quote character marks the end of the
  28534. // string.
  28535. break;
  28536. }
  28537. charCode = source.charCodeAt(Index);
  28538. begin = Index;
  28539. // Optimize for the common case where a string is valid.
  28540. while (charCode >= 32 && charCode != 92 && charCode != 34) {
  28541. charCode = source.charCodeAt(++Index);
  28542. }
  28543. // Append the string as-is.
  28544. value += source.slice(begin, Index);
  28545. }
  28546. }
  28547. if (source.charCodeAt(Index) == 34) {
  28548. // Advance to the next character and return the revived string.
  28549. Index++;
  28550. return value;
  28551. }
  28552. // Unterminated string.
  28553. abort();
  28554. default:
  28555. // Parse numbers and literals.
  28556. begin = Index;
  28557. // Advance past the negative sign, if one is specified.
  28558. if (charCode == 45) {
  28559. isSigned = true;
  28560. charCode = source.charCodeAt(++Index);
  28561. }
  28562. // Parse an integer or floating-point value.
  28563. if (charCode >= 48 && charCode <= 57) {
  28564. // Leading zeroes are interpreted as octal literals.
  28565. if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {
  28566. // Illegal octal literal.
  28567. abort();
  28568. }
  28569. isSigned = false;
  28570. // Parse the integer component.
  28571. for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);
  28572. // Floats cannot contain a leading decimal point; however, this
  28573. // case is already accounted for by the parser.
  28574. if (source.charCodeAt(Index) == 46) {
  28575. position = ++Index;
  28576. // Parse the decimal component.
  28577. for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
  28578. if (position == Index) {
  28579. // Illegal trailing decimal.
  28580. abort();
  28581. }
  28582. Index = position;
  28583. }
  28584. // Parse exponents. The `e` denoting the exponent is
  28585. // case-insensitive.
  28586. charCode = source.charCodeAt(Index);
  28587. if (charCode == 101 || charCode == 69) {
  28588. charCode = source.charCodeAt(++Index);
  28589. // Skip past the sign following the exponent, if one is
  28590. // specified.
  28591. if (charCode == 43 || charCode == 45) {
  28592. Index++;
  28593. }
  28594. // Parse the exponential component.
  28595. for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
  28596. if (position == Index) {
  28597. // Illegal empty exponent.
  28598. abort();
  28599. }
  28600. Index = position;
  28601. }
  28602. // Coerce the parsed value to a JavaScript number.
  28603. return +source.slice(begin, Index);
  28604. }
  28605. // A negative sign may only precede numbers.
  28606. if (isSigned) {
  28607. abort();
  28608. }
  28609. // `true`, `false`, and `null` literals.
  28610. if (source.slice(Index, Index + 4) == "true") {
  28611. Index += 4;
  28612. return true;
  28613. } else if (source.slice(Index, Index + 5) == "false") {
  28614. Index += 5;
  28615. return false;
  28616. } else if (source.slice(Index, Index + 4) == "null") {
  28617. Index += 4;
  28618. return null;
  28619. }
  28620. // Unrecognized token.
  28621. abort();
  28622. }
  28623. }
  28624. // Return the sentinel `$` character if the parser has reached the end
  28625. // of the source string.
  28626. return "$";
  28627. };
  28628. // Internal: Parses a JSON `value` token.
  28629. var get = function (value) {
  28630. var results, hasMembers;
  28631. if (value == "$") {
  28632. // Unexpected end of input.
  28633. abort();
  28634. }
  28635. if (typeof value == "string") {
  28636. if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") {
  28637. // Remove the sentinel `@` character.
  28638. return value.slice(1);
  28639. }
  28640. // Parse object and array literals.
  28641. if (value == "[") {
  28642. // Parses a JSON array, returning a new JavaScript array.
  28643. results = [];
  28644. for (;; hasMembers || (hasMembers = true)) {
  28645. value = lex();
  28646. // A closing square bracket marks the end of the array literal.
  28647. if (value == "]") {
  28648. break;
  28649. }
  28650. // If the array literal contains elements, the current token
  28651. // should be a comma separating the previous element from the
  28652. // next.
  28653. if (hasMembers) {
  28654. if (value == ",") {
  28655. value = lex();
  28656. if (value == "]") {
  28657. // Unexpected trailing `,` in array literal.
  28658. abort();
  28659. }
  28660. } else {
  28661. // A `,` must separate each array element.
  28662. abort();
  28663. }
  28664. }
  28665. // Elisions and leading commas are not permitted.
  28666. if (value == ",") {
  28667. abort();
  28668. }
  28669. results.push(get(value));
  28670. }
  28671. return results;
  28672. } else if (value == "{") {
  28673. // Parses a JSON object, returning a new JavaScript object.
  28674. results = {};
  28675. for (;; hasMembers || (hasMembers = true)) {
  28676. value = lex();
  28677. // A closing curly brace marks the end of the object literal.
  28678. if (value == "}") {
  28679. break;
  28680. }
  28681. // If the object literal contains members, the current token
  28682. // should be a comma separator.
  28683. if (hasMembers) {
  28684. if (value == ",") {
  28685. value = lex();
  28686. if (value == "}") {
  28687. // Unexpected trailing `,` in object literal.
  28688. abort();
  28689. }
  28690. } else {
  28691. // A `,` must separate each object member.
  28692. abort();
  28693. }
  28694. }
  28695. // Leading commas are not permitted, object property names must be
  28696. // double-quoted strings, and a `:` must separate each property
  28697. // name and value.
  28698. if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") {
  28699. abort();
  28700. }
  28701. results[value.slice(1)] = get(lex());
  28702. }
  28703. return results;
  28704. }
  28705. // Unexpected token encountered.
  28706. abort();
  28707. }
  28708. return value;
  28709. };
  28710. // Internal: Updates a traversed object member.
  28711. var update = function (source, property, callback) {
  28712. var element = walk(source, property, callback);
  28713. if (element === undef) {
  28714. delete source[property];
  28715. } else {
  28716. source[property] = element;
  28717. }
  28718. };
  28719. // Internal: Recursively traverses a parsed JSON object, invoking the
  28720. // `callback` function for each value. This is an implementation of the
  28721. // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
  28722. var walk = function (source, property, callback) {
  28723. var value = source[property], length;
  28724. if (typeof value == "object" && value) {
  28725. // `forEach` can't be used to traverse an array in Opera <= 8.54
  28726. // because its `Object#hasOwnProperty` implementation returns `false`
  28727. // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
  28728. if (getClass.call(value) == arrayClass) {
  28729. for (length = value.length; length--;) {
  28730. update(value, length, callback);
  28731. }
  28732. } else {
  28733. forEach(value, function (property) {
  28734. update(value, property, callback);
  28735. });
  28736. }
  28737. }
  28738. return callback.call(source, property, value);
  28739. };
  28740. // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
  28741. exports.parse = function (source, callback) {
  28742. var result, value;
  28743. Index = 0;
  28744. Source = "" + source;
  28745. result = get(lex());
  28746. // If a JSON string contains multiple tokens, it is invalid.
  28747. if (lex() != "$") {
  28748. abort();
  28749. }
  28750. // Reset the parser state.
  28751. Index = Source = null;
  28752. return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
  28753. };
  28754. }
  28755. }
  28756. exports["runInContext"] = runInContext;
  28757. return exports;
  28758. }
  28759. if (freeExports && !isLoader) {
  28760. // Export for CommonJS environments.
  28761. runInContext(root, freeExports);
  28762. } else {
  28763. // Export for web browsers and JavaScript engines.
  28764. var nativeJSON = root.JSON,
  28765. previousJSON = root["JSON3"],
  28766. isRestored = false;
  28767. var JSON3 = runInContext(root, (root["JSON3"] = {
  28768. // Public: Restores the original value of the global `JSON` object and
  28769. // returns a reference to the `JSON3` object.
  28770. "noConflict": function () {
  28771. if (!isRestored) {
  28772. isRestored = true;
  28773. root.JSON = nativeJSON;
  28774. root["JSON3"] = previousJSON;
  28775. nativeJSON = previousJSON = null;
  28776. }
  28777. return JSON3;
  28778. }
  28779. }));
  28780. root.JSON = {
  28781. "parse": JSON3.parse,
  28782. "stringify": JSON3.stringify
  28783. };
  28784. }
  28785. // Export for asynchronous module loaders.
  28786. if (isLoader) {
  28787. define(function () {
  28788. return JSON3;
  28789. });
  28790. }
  28791. }).call(this);
  28792. });
  28793. return ___scope___.entry = "lib/json3.js";
  28794. });
  28795. FuseBox.pkg("component-emitter", {}, function(___scope___){
  28796. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  28797. /**
  28798. * Expose `Emitter`.
  28799. */
  28800. module.exports = Emitter;
  28801. /**
  28802. * Initialize a new `Emitter`.
  28803. *
  28804. * @api public
  28805. */
  28806. function Emitter(obj) {
  28807. if (obj) return mixin(obj);
  28808. };
  28809. /**
  28810. * Mixin the emitter properties.
  28811. *
  28812. * @param {Object} obj
  28813. * @return {Object}
  28814. * @api private
  28815. */
  28816. function mixin(obj) {
  28817. for (var key in Emitter.prototype) {
  28818. obj[key] = Emitter.prototype[key];
  28819. }
  28820. return obj;
  28821. }
  28822. /**
  28823. * Listen on the given `event` with `fn`.
  28824. *
  28825. * @param {String} event
  28826. * @param {Function} fn
  28827. * @return {Emitter}
  28828. * @api public
  28829. */
  28830. Emitter.prototype.on =
  28831. Emitter.prototype.addEventListener = function(event, fn){
  28832. this._callbacks = this._callbacks || {};
  28833. (this._callbacks[event] = this._callbacks[event] || [])
  28834. .push(fn);
  28835. return this;
  28836. };
  28837. /**
  28838. * Adds an `event` listener that will be invoked a single
  28839. * time then automatically removed.
  28840. *
  28841. * @param {String} event
  28842. * @param {Function} fn
  28843. * @return {Emitter}
  28844. * @api public
  28845. */
  28846. Emitter.prototype.once = function(event, fn){
  28847. var self = this;
  28848. this._callbacks = this._callbacks || {};
  28849. function on() {
  28850. self.off(event, on);
  28851. fn.apply(this, arguments);
  28852. }
  28853. on.fn = fn;
  28854. this.on(event, on);
  28855. return this;
  28856. };
  28857. /**
  28858. * Remove the given callback for `event` or all
  28859. * registered callbacks.
  28860. *
  28861. * @param {String} event
  28862. * @param {Function} fn
  28863. * @return {Emitter}
  28864. * @api public
  28865. */
  28866. Emitter.prototype.off =
  28867. Emitter.prototype.removeListener =
  28868. Emitter.prototype.removeAllListeners =
  28869. Emitter.prototype.removeEventListener = function(event, fn){
  28870. this._callbacks = this._callbacks || {};
  28871. // all
  28872. if (0 == arguments.length) {
  28873. this._callbacks = {};
  28874. return this;
  28875. }
  28876. // specific event
  28877. var callbacks = this._callbacks[event];
  28878. if (!callbacks) return this;
  28879. // remove all handlers
  28880. if (1 == arguments.length) {
  28881. delete this._callbacks[event];
  28882. return this;
  28883. }
  28884. // remove specific handler
  28885. var cb;
  28886. for (var i = 0; i < callbacks.length; i++) {
  28887. cb = callbacks[i];
  28888. if (cb === fn || cb.fn === fn) {
  28889. callbacks.splice(i, 1);
  28890. break;
  28891. }
  28892. }
  28893. return this;
  28894. };
  28895. /**
  28896. * Emit `event` with the given args.
  28897. *
  28898. * @param {String} event
  28899. * @param {Mixed} ...
  28900. * @return {Emitter}
  28901. */
  28902. Emitter.prototype.emit = function(event){
  28903. this._callbacks = this._callbacks || {};
  28904. var args = [].slice.call(arguments, 1)
  28905. , callbacks = this._callbacks[event];
  28906. if (callbacks) {
  28907. callbacks = callbacks.slice(0);
  28908. for (var i = 0, len = callbacks.length; i < len; ++i) {
  28909. callbacks[i].apply(this, args);
  28910. }
  28911. }
  28912. return this;
  28913. };
  28914. /**
  28915. * Return array of callbacks for `event`.
  28916. *
  28917. * @param {String} event
  28918. * @return {Array}
  28919. * @api public
  28920. */
  28921. Emitter.prototype.listeners = function(event){
  28922. this._callbacks = this._callbacks || {};
  28923. return this._callbacks[event] || [];
  28924. };
  28925. /**
  28926. * Check if this emitter has `event` handlers.
  28927. *
  28928. * @param {String} event
  28929. * @return {Boolean}
  28930. * @api public
  28931. */
  28932. Emitter.prototype.hasListeners = function(event){
  28933. return !! this.listeners(event).length;
  28934. };
  28935. });
  28936. return ___scope___.entry = "index.js";
  28937. });
  28938. FuseBox.pkg("isarray@0.0.1", {}, function(___scope___){
  28939. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  28940. module.exports = Array.isArray || function (arr) {
  28941. return Object.prototype.toString.call(arr) == '[object Array]';
  28942. };
  28943. });
  28944. return ___scope___.entry = "index.js";
  28945. });
  28946. FuseBox.pkg("engine.io-client", {"component-emitter":"1.2.1","debug":"2.3.3"}, function(___scope___){
  28947. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  28948. module.exports = require('./lib/index');
  28949. });
  28950. ___scope___.file("lib/index.js", function(exports, require, module, __filename, __dirname){
  28951. module.exports = require('./socket');
  28952. /**
  28953. * Exports parser
  28954. *
  28955. * @api public
  28956. *
  28957. */
  28958. module.exports.parser = require('engine.io-parser');
  28959. });
  28960. ___scope___.file("lib/socket.js", function(exports, require, module, __filename, __dirname){
  28961. /**
  28962. * Module dependencies.
  28963. */
  28964. var transports = require('./transports/index');
  28965. var Emitter = require('component-emitter');
  28966. var debug = require('debug')('engine.io-client:socket');
  28967. var index = require('indexof');
  28968. var parser = require('engine.io-parser');
  28969. var parseuri = require('parseuri');
  28970. var parsejson = require('parsejson');
  28971. var parseqs = require('parseqs');
  28972. /**
  28973. * Module exports.
  28974. */
  28975. module.exports = Socket;
  28976. /**
  28977. * Socket constructor.
  28978. *
  28979. * @param {String|Object} uri or options
  28980. * @param {Object} options
  28981. * @api public
  28982. */
  28983. function Socket (uri, opts) {
  28984. if (!(this instanceof Socket)) return new Socket(uri, opts);
  28985. opts = opts || {};
  28986. if (uri && 'object' === typeof uri) {
  28987. opts = uri;
  28988. uri = null;
  28989. }
  28990. if (uri) {
  28991. uri = parseuri(uri);
  28992. opts.hostname = uri.host;
  28993. opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';
  28994. opts.port = uri.port;
  28995. if (uri.query) opts.query = uri.query;
  28996. } else if (opts.host) {
  28997. opts.hostname = parseuri(opts.host).host;
  28998. }
  28999. this.secure = null != opts.secure ? opts.secure
  29000. : (global.location && 'https:' === location.protocol);
  29001. if (opts.hostname && !opts.port) {
  29002. // if no port is specified manually, use the protocol default
  29003. opts.port = this.secure ? '443' : '80';
  29004. }
  29005. this.agent = opts.agent || false;
  29006. this.hostname = opts.hostname ||
  29007. (global.location ? location.hostname : 'localhost');
  29008. this.port = opts.port || (global.location && location.port
  29009. ? location.port
  29010. : (this.secure ? 443 : 80));
  29011. this.query = opts.query || {};
  29012. if ('string' === typeof this.query) this.query = parseqs.decode(this.query);
  29013. this.upgrade = false !== opts.upgrade;
  29014. this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/';
  29015. this.forceJSONP = !!opts.forceJSONP;
  29016. this.jsonp = false !== opts.jsonp;
  29017. this.forceBase64 = !!opts.forceBase64;
  29018. this.enablesXDR = !!opts.enablesXDR;
  29019. this.timestampParam = opts.timestampParam || 't';
  29020. this.timestampRequests = opts.timestampRequests;
  29021. this.transports = opts.transports || ['polling', 'websocket'];
  29022. this.readyState = '';
  29023. this.writeBuffer = [];
  29024. this.prevBufferLen = 0;
  29025. this.policyPort = opts.policyPort || 843;
  29026. this.rememberUpgrade = opts.rememberUpgrade || false;
  29027. this.binaryType = null;
  29028. this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;
  29029. this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;
  29030. if (true === this.perMessageDeflate) this.perMessageDeflate = {};
  29031. if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {
  29032. this.perMessageDeflate.threshold = 1024;
  29033. }
  29034. // SSL options for Node.js client
  29035. this.pfx = opts.pfx || null;
  29036. this.key = opts.key || null;
  29037. this.passphrase = opts.passphrase || null;
  29038. this.cert = opts.cert || null;
  29039. this.ca = opts.ca || null;
  29040. this.ciphers = opts.ciphers || null;
  29041. this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? null : opts.rejectUnauthorized;
  29042. this.forceNode = !!opts.forceNode;
  29043. // other options for Node.js client
  29044. var freeGlobal = typeof global === 'object' && global;
  29045. if (freeGlobal.global === freeGlobal) {
  29046. if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {
  29047. this.extraHeaders = opts.extraHeaders;
  29048. }
  29049. if (opts.localAddress) {
  29050. this.localAddress = opts.localAddress;
  29051. }
  29052. }
  29053. // set on handshake
  29054. this.id = null;
  29055. this.upgrades = null;
  29056. this.pingInterval = null;
  29057. this.pingTimeout = null;
  29058. // set on heartbeat
  29059. this.pingIntervalTimer = null;
  29060. this.pingTimeoutTimer = null;
  29061. this.open();
  29062. }
  29063. Socket.priorWebsocketSuccess = false;
  29064. /**
  29065. * Mix in `Emitter`.
  29066. */
  29067. Emitter(Socket.prototype);
  29068. /**
  29069. * Protocol version.
  29070. *
  29071. * @api public
  29072. */
  29073. Socket.protocol = parser.protocol; // this is an int
  29074. /**
  29075. * Expose deps for legacy compatibility
  29076. * and standalone browser access.
  29077. */
  29078. Socket.Socket = Socket;
  29079. Socket.Transport = require('./transport');
  29080. Socket.transports = require('./transports/index');
  29081. Socket.parser = require('engine.io-parser');
  29082. /**
  29083. * Creates transport of the given type.
  29084. *
  29085. * @param {String} transport name
  29086. * @return {Transport}
  29087. * @api private
  29088. */
  29089. Socket.prototype.createTransport = function (name) {
  29090. debug('creating transport "%s"', name);
  29091. var query = clone(this.query);
  29092. // append engine.io protocol identifier
  29093. query.EIO = parser.protocol;
  29094. // transport name
  29095. query.transport = name;
  29096. // session id if we already have one
  29097. if (this.id) query.sid = this.id;
  29098. var transport = new transports[name]({
  29099. agent: this.agent,
  29100. hostname: this.hostname,
  29101. port: this.port,
  29102. secure: this.secure,
  29103. path: this.path,
  29104. query: query,
  29105. forceJSONP: this.forceJSONP,
  29106. jsonp: this.jsonp,
  29107. forceBase64: this.forceBase64,
  29108. enablesXDR: this.enablesXDR,
  29109. timestampRequests: this.timestampRequests,
  29110. timestampParam: this.timestampParam,
  29111. policyPort: this.policyPort,
  29112. socket: this,
  29113. pfx: this.pfx,
  29114. key: this.key,
  29115. passphrase: this.passphrase,
  29116. cert: this.cert,
  29117. ca: this.ca,
  29118. ciphers: this.ciphers,
  29119. rejectUnauthorized: this.rejectUnauthorized,
  29120. perMessageDeflate: this.perMessageDeflate,
  29121. extraHeaders: this.extraHeaders,
  29122. forceNode: this.forceNode,
  29123. localAddress: this.localAddress
  29124. });
  29125. return transport;
  29126. };
  29127. function clone (obj) {
  29128. var o = {};
  29129. for (var i in obj) {
  29130. if (obj.hasOwnProperty(i)) {
  29131. o[i] = obj[i];
  29132. }
  29133. }
  29134. return o;
  29135. }
  29136. /**
  29137. * Initializes transport to use and starts probe.
  29138. *
  29139. * @api private
  29140. */
  29141. Socket.prototype.open = function () {
  29142. var transport;
  29143. if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {
  29144. transport = 'websocket';
  29145. } else if (0 === this.transports.length) {
  29146. // Emit error on next tick so it can be listened to
  29147. var self = this;
  29148. setTimeout(function () {
  29149. self.emit('error', 'No transports available');
  29150. }, 0);
  29151. return;
  29152. } else {
  29153. transport = this.transports[0];
  29154. }
  29155. this.readyState = 'opening';
  29156. // Retry with the next transport if the transport is disabled (jsonp: false)
  29157. try {
  29158. transport = this.createTransport(transport);
  29159. } catch (e) {
  29160. this.transports.shift();
  29161. this.open();
  29162. return;
  29163. }
  29164. transport.open();
  29165. this.setTransport(transport);
  29166. };
  29167. /**
  29168. * Sets the current transport. Disables the existing one (if any).
  29169. *
  29170. * @api private
  29171. */
  29172. Socket.prototype.setTransport = function (transport) {
  29173. debug('setting transport %s', transport.name);
  29174. var self = this;
  29175. if (this.transport) {
  29176. debug('clearing existing transport %s', this.transport.name);
  29177. this.transport.removeAllListeners();
  29178. }
  29179. // set up transport
  29180. this.transport = transport;
  29181. // set up transport listeners
  29182. transport
  29183. .on('drain', function () {
  29184. self.onDrain();
  29185. })
  29186. .on('packet', function (packet) {
  29187. self.onPacket(packet);
  29188. })
  29189. .on('error', function (e) {
  29190. self.onError(e);
  29191. })
  29192. .on('close', function () {
  29193. self.onClose('transport close');
  29194. });
  29195. };
  29196. /**
  29197. * Probes a transport.
  29198. *
  29199. * @param {String} transport name
  29200. * @api private
  29201. */
  29202. Socket.prototype.probe = function (name) {
  29203. debug('probing transport "%s"', name);
  29204. var transport = this.createTransport(name, { probe: 1 });
  29205. var failed = false;
  29206. var self = this;
  29207. Socket.priorWebsocketSuccess = false;
  29208. function onTransportOpen () {
  29209. if (self.onlyBinaryUpgrades) {
  29210. var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;
  29211. failed = failed || upgradeLosesBinary;
  29212. }
  29213. if (failed) return;
  29214. debug('probe transport "%s" opened', name);
  29215. transport.send([{ type: 'ping', data: 'probe' }]);
  29216. transport.once('packet', function (msg) {
  29217. if (failed) return;
  29218. if ('pong' === msg.type && 'probe' === msg.data) {
  29219. debug('probe transport "%s" pong', name);
  29220. self.upgrading = true;
  29221. self.emit('upgrading', transport);
  29222. if (!transport) return;
  29223. Socket.priorWebsocketSuccess = 'websocket' === transport.name;
  29224. debug('pausing current transport "%s"', self.transport.name);
  29225. self.transport.pause(function () {
  29226. if (failed) return;
  29227. if ('closed' === self.readyState) return;
  29228. debug('changing transport and sending upgrade packet');
  29229. cleanup();
  29230. self.setTransport(transport);
  29231. transport.send([{ type: 'upgrade' }]);
  29232. self.emit('upgrade', transport);
  29233. transport = null;
  29234. self.upgrading = false;
  29235. self.flush();
  29236. });
  29237. } else {
  29238. debug('probe transport "%s" failed', name);
  29239. var err = new Error('probe error');
  29240. err.transport = transport.name;
  29241. self.emit('upgradeError', err);
  29242. }
  29243. });
  29244. }
  29245. function freezeTransport () {
  29246. if (failed) return;
  29247. // Any callback called by transport should be ignored since now
  29248. failed = true;
  29249. cleanup();
  29250. transport.close();
  29251. transport = null;
  29252. }
  29253. // Handle any error that happens while probing
  29254. function onerror (err) {
  29255. var error = new Error('probe error: ' + err);
  29256. error.transport = transport.name;
  29257. freezeTransport();
  29258. debug('probe transport "%s" failed because of error: %s', name, err);
  29259. self.emit('upgradeError', error);
  29260. }
  29261. function onTransportClose () {
  29262. onerror('transport closed');
  29263. }
  29264. // When the socket is closed while we're probing
  29265. function onclose () {
  29266. onerror('socket closed');
  29267. }
  29268. // When the socket is upgraded while we're probing
  29269. function onupgrade (to) {
  29270. if (transport && to.name !== transport.name) {
  29271. debug('"%s" works - aborting "%s"', to.name, transport.name);
  29272. freezeTransport();
  29273. }
  29274. }
  29275. // Remove all listeners on the transport and on self
  29276. function cleanup () {
  29277. transport.removeListener('open', onTransportOpen);
  29278. transport.removeListener('error', onerror);
  29279. transport.removeListener('close', onTransportClose);
  29280. self.removeListener('close', onclose);
  29281. self.removeListener('upgrading', onupgrade);
  29282. }
  29283. transport.once('open', onTransportOpen);
  29284. transport.once('error', onerror);
  29285. transport.once('close', onTransportClose);
  29286. this.once('close', onclose);
  29287. this.once('upgrading', onupgrade);
  29288. transport.open();
  29289. };
  29290. /**
  29291. * Called when connection is deemed open.
  29292. *
  29293. * @api public
  29294. */
  29295. Socket.prototype.onOpen = function () {
  29296. debug('socket open');
  29297. this.readyState = 'open';
  29298. Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;
  29299. this.emit('open');
  29300. this.flush();
  29301. // we check for `readyState` in case an `open`
  29302. // listener already closed the socket
  29303. if ('open' === this.readyState && this.upgrade && this.transport.pause) {
  29304. debug('starting upgrade probes');
  29305. for (var i = 0, l = this.upgrades.length; i < l; i++) {
  29306. this.probe(this.upgrades[i]);
  29307. }
  29308. }
  29309. };
  29310. /**
  29311. * Handles a packet.
  29312. *
  29313. * @api private
  29314. */
  29315. Socket.prototype.onPacket = function (packet) {
  29316. if ('opening' === this.readyState || 'open' === this.readyState ||
  29317. 'closing' === this.readyState) {
  29318. debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
  29319. this.emit('packet', packet);
  29320. // Socket is live - any packet counts
  29321. this.emit('heartbeat');
  29322. switch (packet.type) {
  29323. case 'open':
  29324. this.onHandshake(parsejson(packet.data));
  29325. break;
  29326. case 'pong':
  29327. this.setPing();
  29328. this.emit('pong');
  29329. break;
  29330. case 'error':
  29331. var err = new Error('server error');
  29332. err.code = packet.data;
  29333. this.onError(err);
  29334. break;
  29335. case 'message':
  29336. this.emit('data', packet.data);
  29337. this.emit('message', packet.data);
  29338. break;
  29339. }
  29340. } else {
  29341. debug('packet received with socket readyState "%s"', this.readyState);
  29342. }
  29343. };
  29344. /**
  29345. * Called upon handshake completion.
  29346. *
  29347. * @param {Object} handshake obj
  29348. * @api private
  29349. */
  29350. Socket.prototype.onHandshake = function (data) {
  29351. this.emit('handshake', data);
  29352. this.id = data.sid;
  29353. this.transport.query.sid = data.sid;
  29354. this.upgrades = this.filterUpgrades(data.upgrades);
  29355. this.pingInterval = data.pingInterval;
  29356. this.pingTimeout = data.pingTimeout;
  29357. this.onOpen();
  29358. // In case open handler closes socket
  29359. if ('closed' === this.readyState) return;
  29360. this.setPing();
  29361. // Prolong liveness of socket on heartbeat
  29362. this.removeListener('heartbeat', this.onHeartbeat);
  29363. this.on('heartbeat', this.onHeartbeat);
  29364. };
  29365. /**
  29366. * Resets ping timeout.
  29367. *
  29368. * @api private
  29369. */
  29370. Socket.prototype.onHeartbeat = function (timeout) {
  29371. clearTimeout(this.pingTimeoutTimer);
  29372. var self = this;
  29373. self.pingTimeoutTimer = setTimeout(function () {
  29374. if ('closed' === self.readyState) return;
  29375. self.onClose('ping timeout');
  29376. }, timeout || (self.pingInterval + self.pingTimeout));
  29377. };
  29378. /**
  29379. * Pings server every `this.pingInterval` and expects response
  29380. * within `this.pingTimeout` or closes connection.
  29381. *
  29382. * @api private
  29383. */
  29384. Socket.prototype.setPing = function () {
  29385. var self = this;
  29386. clearTimeout(self.pingIntervalTimer);
  29387. self.pingIntervalTimer = setTimeout(function () {
  29388. debug('writing ping packet - expecting pong within %sms', self.pingTimeout);
  29389. self.ping();
  29390. self.onHeartbeat(self.pingTimeout);
  29391. }, self.pingInterval);
  29392. };
  29393. /**
  29394. * Sends a ping packet.
  29395. *
  29396. * @api private
  29397. */
  29398. Socket.prototype.ping = function () {
  29399. var self = this;
  29400. this.sendPacket('ping', function () {
  29401. self.emit('ping');
  29402. });
  29403. };
  29404. /**
  29405. * Called on `drain` event
  29406. *
  29407. * @api private
  29408. */
  29409. Socket.prototype.onDrain = function () {
  29410. this.writeBuffer.splice(0, this.prevBufferLen);
  29411. // setting prevBufferLen = 0 is very important
  29412. // for example, when upgrading, upgrade packet is sent over,
  29413. // and a nonzero prevBufferLen could cause problems on `drain`
  29414. this.prevBufferLen = 0;
  29415. if (0 === this.writeBuffer.length) {
  29416. this.emit('drain');
  29417. } else {
  29418. this.flush();
  29419. }
  29420. };
  29421. /**
  29422. * Flush write buffers.
  29423. *
  29424. * @api private
  29425. */
  29426. Socket.prototype.flush = function () {
  29427. if ('closed' !== this.readyState && this.transport.writable &&
  29428. !this.upgrading && this.writeBuffer.length) {
  29429. debug('flushing %d packets in socket', this.writeBuffer.length);
  29430. this.transport.send(this.writeBuffer);
  29431. // keep track of current length of writeBuffer
  29432. // splice writeBuffer and callbackBuffer on `drain`
  29433. this.prevBufferLen = this.writeBuffer.length;
  29434. this.emit('flush');
  29435. }
  29436. };
  29437. /**
  29438. * Sends a message.
  29439. *
  29440. * @param {String} message.
  29441. * @param {Function} callback function.
  29442. * @param {Object} options.
  29443. * @return {Socket} for chaining.
  29444. * @api public
  29445. */
  29446. Socket.prototype.write =
  29447. Socket.prototype.send = function (msg, options, fn) {
  29448. this.sendPacket('message', msg, options, fn);
  29449. return this;
  29450. };
  29451. /**
  29452. * Sends a packet.
  29453. *
  29454. * @param {String} packet type.
  29455. * @param {String} data.
  29456. * @param {Object} options.
  29457. * @param {Function} callback function.
  29458. * @api private
  29459. */
  29460. Socket.prototype.sendPacket = function (type, data, options, fn) {
  29461. if ('function' === typeof data) {
  29462. fn = data;
  29463. data = undefined;
  29464. }
  29465. if ('function' === typeof options) {
  29466. fn = options;
  29467. options = null;
  29468. }
  29469. if ('closing' === this.readyState || 'closed' === this.readyState) {
  29470. return;
  29471. }
  29472. options = options || {};
  29473. options.compress = false !== options.compress;
  29474. var packet = {
  29475. type: type,
  29476. data: data,
  29477. options: options
  29478. };
  29479. this.emit('packetCreate', packet);
  29480. this.writeBuffer.push(packet);
  29481. if (fn) this.once('flush', fn);
  29482. this.flush();
  29483. };
  29484. /**
  29485. * Closes the connection.
  29486. *
  29487. * @api private
  29488. */
  29489. Socket.prototype.close = function () {
  29490. if ('opening' === this.readyState || 'open' === this.readyState) {
  29491. this.readyState = 'closing';
  29492. var self = this;
  29493. if (this.writeBuffer.length) {
  29494. this.once('drain', function () {
  29495. if (this.upgrading) {
  29496. waitForUpgrade();
  29497. } else {
  29498. close();
  29499. }
  29500. });
  29501. } else if (this.upgrading) {
  29502. waitForUpgrade();
  29503. } else {
  29504. close();
  29505. }
  29506. }
  29507. function close () {
  29508. self.onClose('forced close');
  29509. debug('socket closing - telling transport to close');
  29510. self.transport.close();
  29511. }
  29512. function cleanupAndClose () {
  29513. self.removeListener('upgrade', cleanupAndClose);
  29514. self.removeListener('upgradeError', cleanupAndClose);
  29515. close();
  29516. }
  29517. function waitForUpgrade () {
  29518. // wait for upgrade to finish since we can't send packets while pausing a transport
  29519. self.once('upgrade', cleanupAndClose);
  29520. self.once('upgradeError', cleanupAndClose);
  29521. }
  29522. return this;
  29523. };
  29524. /**
  29525. * Called upon transport error
  29526. *
  29527. * @api private
  29528. */
  29529. Socket.prototype.onError = function (err) {
  29530. debug('socket error %j', err);
  29531. Socket.priorWebsocketSuccess = false;
  29532. this.emit('error', err);
  29533. this.onClose('transport error', err);
  29534. };
  29535. /**
  29536. * Called upon transport close.
  29537. *
  29538. * @api private
  29539. */
  29540. Socket.prototype.onClose = function (reason, desc) {
  29541. if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {
  29542. debug('socket close with reason: "%s"', reason);
  29543. var self = this;
  29544. // clear timers
  29545. clearTimeout(this.pingIntervalTimer);
  29546. clearTimeout(this.pingTimeoutTimer);
  29547. // stop event from firing again for transport
  29548. this.transport.removeAllListeners('close');
  29549. // ensure transport won't stay open
  29550. this.transport.close();
  29551. // ignore further transport communication
  29552. this.transport.removeAllListeners();
  29553. // set ready state
  29554. this.readyState = 'closed';
  29555. // clear session id
  29556. this.id = null;
  29557. // emit close event
  29558. this.emit('close', reason, desc);
  29559. // clean buffers after, so users can still
  29560. // grab the buffers on `close` event
  29561. self.writeBuffer = [];
  29562. self.prevBufferLen = 0;
  29563. }
  29564. };
  29565. /**
  29566. * Filters upgrades, returning only those matching client transports.
  29567. *
  29568. * @param {Array} server upgrades
  29569. * @api private
  29570. *
  29571. */
  29572. Socket.prototype.filterUpgrades = function (upgrades) {
  29573. var filteredUpgrades = [];
  29574. for (var i = 0, j = upgrades.length; i < j; i++) {
  29575. if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);
  29576. }
  29577. return filteredUpgrades;
  29578. };
  29579. });
  29580. ___scope___.file("lib/transports/index.js", function(exports, require, module, __filename, __dirname){
  29581. /**
  29582. * Module dependencies
  29583. */
  29584. var XMLHttpRequest = require('xmlhttprequest-ssl');
  29585. var XHR = require('./polling-xhr');
  29586. var JSONP = require('./polling-jsonp');
  29587. var websocket = require('./websocket');
  29588. /**
  29589. * Export transports.
  29590. */
  29591. exports.polling = polling;
  29592. exports.websocket = websocket;
  29593. /**
  29594. * Polling transport polymorphic constructor.
  29595. * Decides on xhr vs jsonp based on feature detection.
  29596. *
  29597. * @api private
  29598. */
  29599. function polling (opts) {
  29600. var xhr;
  29601. var xd = false;
  29602. var xs = false;
  29603. var jsonp = false !== opts.jsonp;
  29604. if (global.location) {
  29605. var isSSL = 'https:' === location.protocol;
  29606. var port = location.port;
  29607. // some user agents have empty `location.port`
  29608. if (!port) {
  29609. port = isSSL ? 443 : 80;
  29610. }
  29611. xd = opts.hostname !== location.hostname || port !== opts.port;
  29612. xs = opts.secure !== isSSL;
  29613. }
  29614. opts.xdomain = xd;
  29615. opts.xscheme = xs;
  29616. xhr = new XMLHttpRequest(opts);
  29617. if ('open' in xhr && !opts.forceJSONP) {
  29618. return new XHR(opts);
  29619. } else {
  29620. if (!jsonp) throw new Error('JSONP disabled');
  29621. return new JSONP(opts);
  29622. }
  29623. }
  29624. });
  29625. ___scope___.file("lib/transports/polling-xhr.js", function(exports, require, module, __filename, __dirname){
  29626. /**
  29627. * Module requirements.
  29628. */
  29629. var XMLHttpRequest = require('xmlhttprequest-ssl');
  29630. var Polling = require('./polling');
  29631. var Emitter = require('component-emitter');
  29632. var inherit = require('component-inherit');
  29633. var debug = require('debug')('engine.io-client:polling-xhr');
  29634. /**
  29635. * Module exports.
  29636. */
  29637. module.exports = XHR;
  29638. module.exports.Request = Request;
  29639. /**
  29640. * Empty function
  29641. */
  29642. function empty () {}
  29643. /**
  29644. * XHR Polling constructor.
  29645. *
  29646. * @param {Object} opts
  29647. * @api public
  29648. */
  29649. function XHR (opts) {
  29650. Polling.call(this, opts);
  29651. this.requestTimeout = opts.requestTimeout;
  29652. if (global.location) {
  29653. var isSSL = 'https:' === location.protocol;
  29654. var port = location.port;
  29655. // some user agents have empty `location.port`
  29656. if (!port) {
  29657. port = isSSL ? 443 : 80;
  29658. }
  29659. this.xd = opts.hostname !== global.location.hostname ||
  29660. port !== opts.port;
  29661. this.xs = opts.secure !== isSSL;
  29662. } else {
  29663. this.extraHeaders = opts.extraHeaders;
  29664. }
  29665. }
  29666. /**
  29667. * Inherits from Polling.
  29668. */
  29669. inherit(XHR, Polling);
  29670. /**
  29671. * XHR supports binary
  29672. */
  29673. XHR.prototype.supportsBinary = true;
  29674. /**
  29675. * Creates a request.
  29676. *
  29677. * @param {String} method
  29678. * @api private
  29679. */
  29680. XHR.prototype.request = function (opts) {
  29681. opts = opts || {};
  29682. opts.uri = this.uri();
  29683. opts.xd = this.xd;
  29684. opts.xs = this.xs;
  29685. opts.agent = this.agent || false;
  29686. opts.supportsBinary = this.supportsBinary;
  29687. opts.enablesXDR = this.enablesXDR;
  29688. // SSL options for Node.js client
  29689. opts.pfx = this.pfx;
  29690. opts.key = this.key;
  29691. opts.passphrase = this.passphrase;
  29692. opts.cert = this.cert;
  29693. opts.ca = this.ca;
  29694. opts.ciphers = this.ciphers;
  29695. opts.rejectUnauthorized = this.rejectUnauthorized;
  29696. opts.requestTimeout = this.requestTimeout;
  29697. // other options for Node.js client
  29698. opts.extraHeaders = this.extraHeaders;
  29699. return new Request(opts);
  29700. };
  29701. /**
  29702. * Sends data.
  29703. *
  29704. * @param {String} data to send.
  29705. * @param {Function} called upon flush.
  29706. * @api private
  29707. */
  29708. XHR.prototype.doWrite = function (data, fn) {
  29709. var isBinary = typeof data !== 'string' && data !== undefined;
  29710. var req = this.request({ method: 'POST', data: data, isBinary: isBinary });
  29711. var self = this;
  29712. req.on('success', fn);
  29713. req.on('error', function (err) {
  29714. self.onError('xhr post error', err);
  29715. });
  29716. this.sendXhr = req;
  29717. };
  29718. /**
  29719. * Starts a poll cycle.
  29720. *
  29721. * @api private
  29722. */
  29723. XHR.prototype.doPoll = function () {
  29724. debug('xhr poll');
  29725. var req = this.request();
  29726. var self = this;
  29727. req.on('data', function (data) {
  29728. self.onData(data);
  29729. });
  29730. req.on('error', function (err) {
  29731. self.onError('xhr poll error', err);
  29732. });
  29733. this.pollXhr = req;
  29734. };
  29735. /**
  29736. * Request constructor
  29737. *
  29738. * @param {Object} options
  29739. * @api public
  29740. */
  29741. function Request (opts) {
  29742. this.method = opts.method || 'GET';
  29743. this.uri = opts.uri;
  29744. this.xd = !!opts.xd;
  29745. this.xs = !!opts.xs;
  29746. this.async = false !== opts.async;
  29747. this.data = undefined !== opts.data ? opts.data : null;
  29748. this.agent = opts.agent;
  29749. this.isBinary = opts.isBinary;
  29750. this.supportsBinary = opts.supportsBinary;
  29751. this.enablesXDR = opts.enablesXDR;
  29752. this.requestTimeout = opts.requestTimeout;
  29753. // SSL options for Node.js client
  29754. this.pfx = opts.pfx;
  29755. this.key = opts.key;
  29756. this.passphrase = opts.passphrase;
  29757. this.cert = opts.cert;
  29758. this.ca = opts.ca;
  29759. this.ciphers = opts.ciphers;
  29760. this.rejectUnauthorized = opts.rejectUnauthorized;
  29761. // other options for Node.js client
  29762. this.extraHeaders = opts.extraHeaders;
  29763. this.create();
  29764. }
  29765. /**
  29766. * Mix in `Emitter`.
  29767. */
  29768. Emitter(Request.prototype);
  29769. /**
  29770. * Creates the XHR object and sends the request.
  29771. *
  29772. * @api private
  29773. */
  29774. Request.prototype.create = function () {
  29775. var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
  29776. // SSL options for Node.js client
  29777. opts.pfx = this.pfx;
  29778. opts.key = this.key;
  29779. opts.passphrase = this.passphrase;
  29780. opts.cert = this.cert;
  29781. opts.ca = this.ca;
  29782. opts.ciphers = this.ciphers;
  29783. opts.rejectUnauthorized = this.rejectUnauthorized;
  29784. var xhr = this.xhr = new XMLHttpRequest(opts);
  29785. var self = this;
  29786. try {
  29787. debug('xhr open %s: %s', this.method, this.uri);
  29788. xhr.open(this.method, this.uri, this.async);
  29789. try {
  29790. if (this.extraHeaders) {
  29791. xhr.setDisableHeaderCheck(true);
  29792. for (var i in this.extraHeaders) {
  29793. if (this.extraHeaders.hasOwnProperty(i)) {
  29794. xhr.setRequestHeader(i, this.extraHeaders[i]);
  29795. }
  29796. }
  29797. }
  29798. } catch (e) {}
  29799. if (this.supportsBinary) {
  29800. // This has to be done after open because Firefox is stupid
  29801. // http://stackoverflow.com/questions/13216903/get-binary-data-with-xmlhttprequest-in-a-firefox-extension
  29802. xhr.responseType = 'arraybuffer';
  29803. }
  29804. if ('POST' === this.method) {
  29805. try {
  29806. if (this.isBinary) {
  29807. xhr.setRequestHeader('Content-type', 'application/octet-stream');
  29808. } else {
  29809. xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');
  29810. }
  29811. } catch (e) {}
  29812. }
  29813. try {
  29814. xhr.setRequestHeader('Accept', '*/*');
  29815. } catch (e) {}
  29816. // ie6 check
  29817. if ('withCredentials' in xhr) {
  29818. xhr.withCredentials = true;
  29819. }
  29820. if (this.requestTimeout) {
  29821. xhr.timeout = this.requestTimeout;
  29822. }
  29823. if (this.hasXDR()) {
  29824. xhr.onload = function () {
  29825. self.onLoad();
  29826. };
  29827. xhr.onerror = function () {
  29828. self.onError(xhr.responseText);
  29829. };
  29830. } else {
  29831. xhr.onreadystatechange = function () {
  29832. if (4 !== xhr.readyState) return;
  29833. if (200 === xhr.status || 1223 === xhr.status) {
  29834. self.onLoad();
  29835. } else {
  29836. // make sure the `error` event handler that's user-set
  29837. // does not throw in the same tick and gets caught here
  29838. setTimeout(function () {
  29839. self.onError(xhr.status);
  29840. }, 0);
  29841. }
  29842. };
  29843. }
  29844. debug('xhr data %s', this.data);
  29845. xhr.send(this.data);
  29846. } catch (e) {
  29847. // Need to defer since .create() is called directly fhrom the constructor
  29848. // and thus the 'error' event can only be only bound *after* this exception
  29849. // occurs. Therefore, also, we cannot throw here at all.
  29850. setTimeout(function () {
  29851. self.onError(e);
  29852. }, 0);
  29853. return;
  29854. }
  29855. if (global.document) {
  29856. this.index = Request.requestsCount++;
  29857. Request.requests[this.index] = this;
  29858. }
  29859. };
  29860. /**
  29861. * Called upon successful response.
  29862. *
  29863. * @api private
  29864. */
  29865. Request.prototype.onSuccess = function () {
  29866. this.emit('success');
  29867. this.cleanup();
  29868. };
  29869. /**
  29870. * Called if we have data.
  29871. *
  29872. * @api private
  29873. */
  29874. Request.prototype.onData = function (data) {
  29875. this.emit('data', data);
  29876. this.onSuccess();
  29877. };
  29878. /**
  29879. * Called upon error.
  29880. *
  29881. * @api private
  29882. */
  29883. Request.prototype.onError = function (err) {
  29884. this.emit('error', err);
  29885. this.cleanup(true);
  29886. };
  29887. /**
  29888. * Cleans up house.
  29889. *
  29890. * @api private
  29891. */
  29892. Request.prototype.cleanup = function (fromError) {
  29893. if ('undefined' === typeof this.xhr || null === this.xhr) {
  29894. return;
  29895. }
  29896. // xmlhttprequest
  29897. if (this.hasXDR()) {
  29898. this.xhr.onload = this.xhr.onerror = empty;
  29899. } else {
  29900. this.xhr.onreadystatechange = empty;
  29901. }
  29902. if (fromError) {
  29903. try {
  29904. this.xhr.abort();
  29905. } catch (e) {}
  29906. }
  29907. if (global.document) {
  29908. delete Request.requests[this.index];
  29909. }
  29910. this.xhr = null;
  29911. };
  29912. /**
  29913. * Called upon load.
  29914. *
  29915. * @api private
  29916. */
  29917. Request.prototype.onLoad = function () {
  29918. var data;
  29919. try {
  29920. var contentType;
  29921. try {
  29922. contentType = this.xhr.getResponseHeader('Content-Type').split(';')[0];
  29923. } catch (e) {}
  29924. if (contentType === 'application/octet-stream') {
  29925. data = this.xhr.response || this.xhr.responseText;
  29926. } else {
  29927. if (!this.supportsBinary) {
  29928. data = this.xhr.responseText;
  29929. } else {
  29930. try {
  29931. data = String.fromCharCode.apply(null, new Uint8Array(this.xhr.response));
  29932. } catch (e) {
  29933. var ui8Arr = new Uint8Array(this.xhr.response);
  29934. var dataArray = [];
  29935. for (var idx = 0, length = ui8Arr.length; idx < length; idx++) {
  29936. dataArray.push(ui8Arr[idx]);
  29937. }
  29938. data = String.fromCharCode.apply(null, dataArray);
  29939. }
  29940. }
  29941. }
  29942. } catch (e) {
  29943. this.onError(e);
  29944. }
  29945. if (null != data) {
  29946. this.onData(data);
  29947. }
  29948. };
  29949. /**
  29950. * Check if it has XDomainRequest.
  29951. *
  29952. * @api private
  29953. */
  29954. Request.prototype.hasXDR = function () {
  29955. return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR;
  29956. };
  29957. /**
  29958. * Aborts the request.
  29959. *
  29960. * @api public
  29961. */
  29962. Request.prototype.abort = function () {
  29963. this.cleanup();
  29964. };
  29965. /**
  29966. * Aborts pending requests when unloading the window. This is needed to prevent
  29967. * memory leaks (e.g. when using IE) and to ensure that no spurious error is
  29968. * emitted.
  29969. */
  29970. Request.requestsCount = 0;
  29971. Request.requests = {};
  29972. if (global.document) {
  29973. if (global.attachEvent) {
  29974. global.attachEvent('onunload', unloadHandler);
  29975. } else if (global.addEventListener) {
  29976. global.addEventListener('beforeunload', unloadHandler, false);
  29977. }
  29978. }
  29979. function unloadHandler () {
  29980. for (var i in Request.requests) {
  29981. if (Request.requests.hasOwnProperty(i)) {
  29982. Request.requests[i].abort();
  29983. }
  29984. }
  29985. }
  29986. });
  29987. ___scope___.file("lib/transports/polling.js", function(exports, require, module, __filename, __dirname){
  29988. /**
  29989. * Module dependencies.
  29990. */
  29991. var Transport = require('../transport');
  29992. var parseqs = require('parseqs');
  29993. var parser = require('engine.io-parser');
  29994. var inherit = require('component-inherit');
  29995. var yeast = require('yeast');
  29996. var debug = require('debug')('engine.io-client:polling');
  29997. /**
  29998. * Module exports.
  29999. */
  30000. module.exports = Polling;
  30001. /**
  30002. * Is XHR2 supported?
  30003. */
  30004. var hasXHR2 = (function () {
  30005. var XMLHttpRequest = require('xmlhttprequest-ssl');
  30006. var xhr = new XMLHttpRequest({ xdomain: false });
  30007. return null != xhr.responseType;
  30008. })();
  30009. /**
  30010. * Polling interface.
  30011. *
  30012. * @param {Object} opts
  30013. * @api private
  30014. */
  30015. function Polling (opts) {
  30016. var forceBase64 = (opts && opts.forceBase64);
  30017. if (!hasXHR2 || forceBase64) {
  30018. this.supportsBinary = false;
  30019. }
  30020. Transport.call(this, opts);
  30021. }
  30022. /**
  30023. * Inherits from Transport.
  30024. */
  30025. inherit(Polling, Transport);
  30026. /**
  30027. * Transport name.
  30028. */
  30029. Polling.prototype.name = 'polling';
  30030. /**
  30031. * Opens the socket (triggers polling). We write a PING message to determine
  30032. * when the transport is open.
  30033. *
  30034. * @api private
  30035. */
  30036. Polling.prototype.doOpen = function () {
  30037. this.poll();
  30038. };
  30039. /**
  30040. * Pauses polling.
  30041. *
  30042. * @param {Function} callback upon buffers are flushed and transport is paused
  30043. * @api private
  30044. */
  30045. Polling.prototype.pause = function (onPause) {
  30046. var self = this;
  30047. this.readyState = 'pausing';
  30048. function pause () {
  30049. debug('paused');
  30050. self.readyState = 'paused';
  30051. onPause();
  30052. }
  30053. if (this.polling || !this.writable) {
  30054. var total = 0;
  30055. if (this.polling) {
  30056. debug('we are currently polling - waiting to pause');
  30057. total++;
  30058. this.once('pollComplete', function () {
  30059. debug('pre-pause polling complete');
  30060. --total || pause();
  30061. });
  30062. }
  30063. if (!this.writable) {
  30064. debug('we are currently writing - waiting to pause');
  30065. total++;
  30066. this.once('drain', function () {
  30067. debug('pre-pause writing complete');
  30068. --total || pause();
  30069. });
  30070. }
  30071. } else {
  30072. pause();
  30073. }
  30074. };
  30075. /**
  30076. * Starts polling cycle.
  30077. *
  30078. * @api public
  30079. */
  30080. Polling.prototype.poll = function () {
  30081. debug('polling');
  30082. this.polling = true;
  30083. this.doPoll();
  30084. this.emit('poll');
  30085. };
  30086. /**
  30087. * Overloads onData to detect payloads.
  30088. *
  30089. * @api private
  30090. */
  30091. Polling.prototype.onData = function (data) {
  30092. var self = this;
  30093. debug('polling got data %s', data);
  30094. var callback = function (packet, index, total) {
  30095. // if its the first message we consider the transport open
  30096. if ('opening' === self.readyState) {
  30097. self.onOpen();
  30098. }
  30099. // if its a close packet, we close the ongoing requests
  30100. if ('close' === packet.type) {
  30101. self.onClose();
  30102. return false;
  30103. }
  30104. // otherwise bypass onData and handle the message
  30105. self.onPacket(packet);
  30106. };
  30107. // decode payload
  30108. parser.decodePayload(data, this.socket.binaryType, callback);
  30109. // if an event did not trigger closing
  30110. if ('closed' !== this.readyState) {
  30111. // if we got data we're not polling
  30112. this.polling = false;
  30113. this.emit('pollComplete');
  30114. if ('open' === this.readyState) {
  30115. this.poll();
  30116. } else {
  30117. debug('ignoring poll - transport state "%s"', this.readyState);
  30118. }
  30119. }
  30120. };
  30121. /**
  30122. * For polling, send a close packet.
  30123. *
  30124. * @api private
  30125. */
  30126. Polling.prototype.doClose = function () {
  30127. var self = this;
  30128. function close () {
  30129. debug('writing close packet');
  30130. self.write([{ type: 'close' }]);
  30131. }
  30132. if ('open' === this.readyState) {
  30133. debug('transport open - closing');
  30134. close();
  30135. } else {
  30136. // in case we're trying to close while
  30137. // handshaking is in progress (GH-164)
  30138. debug('transport not open - deferring close');
  30139. this.once('open', close);
  30140. }
  30141. };
  30142. /**
  30143. * Writes a packets payload.
  30144. *
  30145. * @param {Array} data packets
  30146. * @param {Function} drain callback
  30147. * @api private
  30148. */
  30149. Polling.prototype.write = function (packets) {
  30150. var self = this;
  30151. this.writable = false;
  30152. var callbackfn = function () {
  30153. self.writable = true;
  30154. self.emit('drain');
  30155. };
  30156. parser.encodePayload(packets, this.supportsBinary, function (data) {
  30157. self.doWrite(data, callbackfn);
  30158. });
  30159. };
  30160. /**
  30161. * Generates uri for connection.
  30162. *
  30163. * @api private
  30164. */
  30165. Polling.prototype.uri = function () {
  30166. var query = this.query || {};
  30167. var schema = this.secure ? 'https' : 'http';
  30168. var port = '';
  30169. // cache busting is forced
  30170. if (false !== this.timestampRequests) {
  30171. query[this.timestampParam] = yeast();
  30172. }
  30173. if (!this.supportsBinary && !query.sid) {
  30174. query.b64 = 1;
  30175. }
  30176. query = parseqs.encode(query);
  30177. // avoid port if default for schema
  30178. if (this.port && (('https' === schema && Number(this.port) !== 443) ||
  30179. ('http' === schema && Number(this.port) !== 80))) {
  30180. port = ':' + this.port;
  30181. }
  30182. // prepend ? to query
  30183. if (query.length) {
  30184. query = '?' + query;
  30185. }
  30186. var ipv6 = this.hostname.indexOf(':') !== -1;
  30187. return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
  30188. };
  30189. });
  30190. ___scope___.file("lib/transport.js", function(exports, require, module, __filename, __dirname){
  30191. /**
  30192. * Module dependencies.
  30193. */
  30194. var parser = require('engine.io-parser');
  30195. var Emitter = require('component-emitter');
  30196. /**
  30197. * Module exports.
  30198. */
  30199. module.exports = Transport;
  30200. /**
  30201. * Transport abstract constructor.
  30202. *
  30203. * @param {Object} options.
  30204. * @api private
  30205. */
  30206. function Transport (opts) {
  30207. this.path = opts.path;
  30208. this.hostname = opts.hostname;
  30209. this.port = opts.port;
  30210. this.secure = opts.secure;
  30211. this.query = opts.query;
  30212. this.timestampParam = opts.timestampParam;
  30213. this.timestampRequests = opts.timestampRequests;
  30214. this.readyState = '';
  30215. this.agent = opts.agent || false;
  30216. this.socket = opts.socket;
  30217. this.enablesXDR = opts.enablesXDR;
  30218. // SSL options for Node.js client
  30219. this.pfx = opts.pfx;
  30220. this.key = opts.key;
  30221. this.passphrase = opts.passphrase;
  30222. this.cert = opts.cert;
  30223. this.ca = opts.ca;
  30224. this.ciphers = opts.ciphers;
  30225. this.rejectUnauthorized = opts.rejectUnauthorized;
  30226. this.forceNode = opts.forceNode;
  30227. // other options for Node.js client
  30228. this.extraHeaders = opts.extraHeaders;
  30229. this.localAddress = opts.localAddress;
  30230. }
  30231. /**
  30232. * Mix in `Emitter`.
  30233. */
  30234. Emitter(Transport.prototype);
  30235. /**
  30236. * Emits an error.
  30237. *
  30238. * @param {String} str
  30239. * @return {Transport} for chaining
  30240. * @api public
  30241. */
  30242. Transport.prototype.onError = function (msg, desc) {
  30243. var err = new Error(msg);
  30244. err.type = 'TransportError';
  30245. err.description = desc;
  30246. this.emit('error', err);
  30247. return this;
  30248. };
  30249. /**
  30250. * Opens the transport.
  30251. *
  30252. * @api public
  30253. */
  30254. Transport.prototype.open = function () {
  30255. if ('closed' === this.readyState || '' === this.readyState) {
  30256. this.readyState = 'opening';
  30257. this.doOpen();
  30258. }
  30259. return this;
  30260. };
  30261. /**
  30262. * Closes the transport.
  30263. *
  30264. * @api private
  30265. */
  30266. Transport.prototype.close = function () {
  30267. if ('opening' === this.readyState || 'open' === this.readyState) {
  30268. this.doClose();
  30269. this.onClose();
  30270. }
  30271. return this;
  30272. };
  30273. /**
  30274. * Sends multiple packets.
  30275. *
  30276. * @param {Array} packets
  30277. * @api private
  30278. */
  30279. Transport.prototype.send = function (packets) {
  30280. if ('open' === this.readyState) {
  30281. this.write(packets);
  30282. } else {
  30283. throw new Error('Transport not open');
  30284. }
  30285. };
  30286. /**
  30287. * Called upon open
  30288. *
  30289. * @api private
  30290. */
  30291. Transport.prototype.onOpen = function () {
  30292. this.readyState = 'open';
  30293. this.writable = true;
  30294. this.emit('open');
  30295. };
  30296. /**
  30297. * Called with data.
  30298. *
  30299. * @param {String} data
  30300. * @api private
  30301. */
  30302. Transport.prototype.onData = function (data) {
  30303. var packet = parser.decodePacket(data, this.socket.binaryType);
  30304. this.onPacket(packet);
  30305. };
  30306. /**
  30307. * Called with a decoded packet.
  30308. */
  30309. Transport.prototype.onPacket = function (packet) {
  30310. this.emit('packet', packet);
  30311. };
  30312. /**
  30313. * Called upon close.
  30314. *
  30315. * @api private
  30316. */
  30317. Transport.prototype.onClose = function () {
  30318. this.readyState = 'closed';
  30319. this.emit('close');
  30320. };
  30321. });
  30322. ___scope___.file("lib/transports/polling-jsonp.js", function(exports, require, module, __filename, __dirname){
  30323. /**
  30324. * Module requirements.
  30325. */
  30326. var Polling = require('./polling');
  30327. var inherit = require('component-inherit');
  30328. /**
  30329. * Module exports.
  30330. */
  30331. module.exports = JSONPPolling;
  30332. /**
  30333. * Cached regular expressions.
  30334. */
  30335. var rNewline = /\n/g;
  30336. var rEscapedNewline = /\\n/g;
  30337. /**
  30338. * Global JSONP callbacks.
  30339. */
  30340. var callbacks;
  30341. /**
  30342. * Noop.
  30343. */
  30344. function empty () { }
  30345. /**
  30346. * JSONP Polling constructor.
  30347. *
  30348. * @param {Object} opts.
  30349. * @api public
  30350. */
  30351. function JSONPPolling (opts) {
  30352. Polling.call(this, opts);
  30353. this.query = this.query || {};
  30354. // define global callbacks array if not present
  30355. // we do this here (lazily) to avoid unneeded global pollution
  30356. if (!callbacks) {
  30357. // we need to consider multiple engines in the same page
  30358. if (!global.___eio) global.___eio = [];
  30359. callbacks = global.___eio;
  30360. }
  30361. // callback identifier
  30362. this.index = callbacks.length;
  30363. // add callback to jsonp global
  30364. var self = this;
  30365. callbacks.push(function (msg) {
  30366. self.onData(msg);
  30367. });
  30368. // append to query string
  30369. this.query.j = this.index;
  30370. // prevent spurious errors from being emitted when the window is unloaded
  30371. if (global.document && global.addEventListener) {
  30372. global.addEventListener('beforeunload', function () {
  30373. if (self.script) self.script.onerror = empty;
  30374. }, false);
  30375. }
  30376. }
  30377. /**
  30378. * Inherits from Polling.
  30379. */
  30380. inherit(JSONPPolling, Polling);
  30381. /*
  30382. * JSONP only supports binary as base64 encoded strings
  30383. */
  30384. JSONPPolling.prototype.supportsBinary = false;
  30385. /**
  30386. * Closes the socket.
  30387. *
  30388. * @api private
  30389. */
  30390. JSONPPolling.prototype.doClose = function () {
  30391. if (this.script) {
  30392. this.script.parentNode.removeChild(this.script);
  30393. this.script = null;
  30394. }
  30395. if (this.form) {
  30396. this.form.parentNode.removeChild(this.form);
  30397. this.form = null;
  30398. this.iframe = null;
  30399. }
  30400. Polling.prototype.doClose.call(this);
  30401. };
  30402. /**
  30403. * Starts a poll cycle.
  30404. *
  30405. * @api private
  30406. */
  30407. JSONPPolling.prototype.doPoll = function () {
  30408. var self = this;
  30409. var script = document.createElement('script');
  30410. if (this.script) {
  30411. this.script.parentNode.removeChild(this.script);
  30412. this.script = null;
  30413. }
  30414. script.async = true;
  30415. script.src = this.uri();
  30416. script.onerror = function (e) {
  30417. self.onError('jsonp poll error', e);
  30418. };
  30419. var insertAt = document.getElementsByTagName('script')[0];
  30420. if (insertAt) {
  30421. insertAt.parentNode.insertBefore(script, insertAt);
  30422. } else {
  30423. (document.head || document.body).appendChild(script);
  30424. }
  30425. this.script = script;
  30426. var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);
  30427. if (isUAgecko) {
  30428. setTimeout(function () {
  30429. var iframe = document.createElement('iframe');
  30430. document.body.appendChild(iframe);
  30431. document.body.removeChild(iframe);
  30432. }, 100);
  30433. }
  30434. };
  30435. /**
  30436. * Writes with a hidden iframe.
  30437. *
  30438. * @param {String} data to send
  30439. * @param {Function} called upon flush.
  30440. * @api private
  30441. */
  30442. JSONPPolling.prototype.doWrite = function (data, fn) {
  30443. var self = this;
  30444. if (!this.form) {
  30445. var form = document.createElement('form');
  30446. var area = document.createElement('textarea');
  30447. var id = this.iframeId = 'eio_iframe_' + this.index;
  30448. var iframe;
  30449. form.className = 'socketio';
  30450. form.style.position = 'absolute';
  30451. form.style.top = '-1000px';
  30452. form.style.left = '-1000px';
  30453. form.target = id;
  30454. form.method = 'POST';
  30455. form.setAttribute('accept-charset', 'utf-8');
  30456. area.name = 'd';
  30457. form.appendChild(area);
  30458. document.body.appendChild(form);
  30459. this.form = form;
  30460. this.area = area;
  30461. }
  30462. this.form.action = this.uri();
  30463. function complete () {
  30464. initIframe();
  30465. fn();
  30466. }
  30467. function initIframe () {
  30468. if (self.iframe) {
  30469. try {
  30470. self.form.removeChild(self.iframe);
  30471. } catch (e) {
  30472. self.onError('jsonp polling iframe removal error', e);
  30473. }
  30474. }
  30475. try {
  30476. // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
  30477. var html = '<iframe src="javascript:0" name="' + self.iframeId + '">';
  30478. iframe = document.createElement(html);
  30479. } catch (e) {
  30480. iframe = document.createElement('iframe');
  30481. iframe.name = self.iframeId;
  30482. iframe.src = 'javascript:0';
  30483. }
  30484. iframe.id = self.iframeId;
  30485. self.form.appendChild(iframe);
  30486. self.iframe = iframe;
  30487. }
  30488. initIframe();
  30489. // escape \n to prevent it from being converted into \r\n by some UAs
  30490. // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side
  30491. data = data.replace(rEscapedNewline, '\\\n');
  30492. this.area.value = data.replace(rNewline, '\\n');
  30493. try {
  30494. this.form.submit();
  30495. } catch (e) {}
  30496. if (this.iframe.attachEvent) {
  30497. this.iframe.onreadystatechange = function () {
  30498. if (self.iframe.readyState === 'complete') {
  30499. complete();
  30500. }
  30501. };
  30502. } else {
  30503. this.iframe.onload = complete;
  30504. }
  30505. };
  30506. });
  30507. ___scope___.file("lib/transports/websocket.js", function(exports, require, module, __filename, __dirname){
  30508. /**
  30509. * Module dependencies.
  30510. */
  30511. var Transport = require('../transport');
  30512. var parser = require('engine.io-parser');
  30513. var parseqs = require('parseqs');
  30514. var inherit = require('component-inherit');
  30515. var yeast = require('yeast');
  30516. var debug = require('debug')('engine.io-client:websocket');
  30517. var BrowserWebSocket = global.WebSocket || global.MozWebSocket;
  30518. var NodeWebSocket;
  30519. if (typeof window === 'undefined') {
  30520. try {
  30521. NodeWebSocket = require('ws');
  30522. } catch (e) { }
  30523. }
  30524. /**
  30525. * Get either the `WebSocket` or `MozWebSocket` globals
  30526. * in the browser or try to resolve WebSocket-compatible
  30527. * interface exposed by `ws` for Node-like environment.
  30528. */
  30529. var WebSocket = BrowserWebSocket;
  30530. if (!WebSocket && typeof window === 'undefined') {
  30531. WebSocket = NodeWebSocket;
  30532. }
  30533. /**
  30534. * Module exports.
  30535. */
  30536. module.exports = WS;
  30537. /**
  30538. * WebSocket transport constructor.
  30539. *
  30540. * @api {Object} connection options
  30541. * @api public
  30542. */
  30543. function WS (opts) {
  30544. var forceBase64 = (opts && opts.forceBase64);
  30545. if (forceBase64) {
  30546. this.supportsBinary = false;
  30547. }
  30548. this.perMessageDeflate = opts.perMessageDeflate;
  30549. this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;
  30550. if (!this.usingBrowserWebSocket) {
  30551. WebSocket = NodeWebSocket;
  30552. }
  30553. Transport.call(this, opts);
  30554. }
  30555. /**
  30556. * Inherits from Transport.
  30557. */
  30558. inherit(WS, Transport);
  30559. /**
  30560. * Transport name.
  30561. *
  30562. * @api public
  30563. */
  30564. WS.prototype.name = 'websocket';
  30565. /*
  30566. * WebSockets support binary
  30567. */
  30568. WS.prototype.supportsBinary = true;
  30569. /**
  30570. * Opens socket.
  30571. *
  30572. * @api private
  30573. */
  30574. WS.prototype.doOpen = function () {
  30575. if (!this.check()) {
  30576. // let probe timeout
  30577. return;
  30578. }
  30579. var uri = this.uri();
  30580. var protocols = void (0);
  30581. var opts = {
  30582. agent: this.agent,
  30583. perMessageDeflate: this.perMessageDeflate
  30584. };
  30585. // SSL options for Node.js client
  30586. opts.pfx = this.pfx;
  30587. opts.key = this.key;
  30588. opts.passphrase = this.passphrase;
  30589. opts.cert = this.cert;
  30590. opts.ca = this.ca;
  30591. opts.ciphers = this.ciphers;
  30592. opts.rejectUnauthorized = this.rejectUnauthorized;
  30593. if (this.extraHeaders) {
  30594. opts.headers = this.extraHeaders;
  30595. }
  30596. if (this.localAddress) {
  30597. opts.localAddress = this.localAddress;
  30598. }
  30599. try {
  30600. this.ws = this.usingBrowserWebSocket ? new WebSocket(uri) : new WebSocket(uri, protocols, opts);
  30601. } catch (err) {
  30602. return this.emit('error', err);
  30603. }
  30604. if (this.ws.binaryType === undefined) {
  30605. this.supportsBinary = false;
  30606. }
  30607. if (this.ws.supports && this.ws.supports.binary) {
  30608. this.supportsBinary = true;
  30609. this.ws.binaryType = 'nodebuffer';
  30610. } else {
  30611. this.ws.binaryType = 'arraybuffer';
  30612. }
  30613. this.addEventListeners();
  30614. };
  30615. /**
  30616. * Adds event listeners to the socket
  30617. *
  30618. * @api private
  30619. */
  30620. WS.prototype.addEventListeners = function () {
  30621. var self = this;
  30622. this.ws.onopen = function () {
  30623. self.onOpen();
  30624. };
  30625. this.ws.onclose = function () {
  30626. self.onClose();
  30627. };
  30628. this.ws.onmessage = function (ev) {
  30629. self.onData(ev.data);
  30630. };
  30631. this.ws.onerror = function (e) {
  30632. self.onError('websocket error', e);
  30633. };
  30634. };
  30635. /**
  30636. * Writes data to socket.
  30637. *
  30638. * @param {Array} array of packets.
  30639. * @api private
  30640. */
  30641. WS.prototype.write = function (packets) {
  30642. var self = this;
  30643. this.writable = false;
  30644. // encodePacket efficient as it uses WS framing
  30645. // no need for encodePayload
  30646. var total = packets.length;
  30647. for (var i = 0, l = total; i < l; i++) {
  30648. (function (packet) {
  30649. parser.encodePacket(packet, self.supportsBinary, function (data) {
  30650. if (!self.usingBrowserWebSocket) {
  30651. // always create a new object (GH-437)
  30652. var opts = {};
  30653. if (packet.options) {
  30654. opts.compress = packet.options.compress;
  30655. }
  30656. if (self.perMessageDeflate) {
  30657. var len = 'string' === typeof data ? global.Buffer.byteLength(data) : data.length;
  30658. if (len < self.perMessageDeflate.threshold) {
  30659. opts.compress = false;
  30660. }
  30661. }
  30662. }
  30663. // Sometimes the websocket has already been closed but the browser didn't
  30664. // have a chance of informing us about it yet, in that case send will
  30665. // throw an error
  30666. try {
  30667. if (self.usingBrowserWebSocket) {
  30668. // TypeError is thrown when passing the second argument on Safari
  30669. self.ws.send(data);
  30670. } else {
  30671. self.ws.send(data, opts);
  30672. }
  30673. } catch (e) {
  30674. debug('websocket closed before onclose event');
  30675. }
  30676. --total || done();
  30677. });
  30678. })(packets[i]);
  30679. }
  30680. function done () {
  30681. self.emit('flush');
  30682. // fake drain
  30683. // defer to next tick to allow Socket to clear writeBuffer
  30684. setTimeout(function () {
  30685. self.writable = true;
  30686. self.emit('drain');
  30687. }, 0);
  30688. }
  30689. };
  30690. /**
  30691. * Called upon close
  30692. *
  30693. * @api private
  30694. */
  30695. WS.prototype.onClose = function () {
  30696. Transport.prototype.onClose.call(this);
  30697. };
  30698. /**
  30699. * Closes socket.
  30700. *
  30701. * @api private
  30702. */
  30703. WS.prototype.doClose = function () {
  30704. if (typeof this.ws !== 'undefined') {
  30705. this.ws.close();
  30706. }
  30707. };
  30708. /**
  30709. * Generates uri for connection.
  30710. *
  30711. * @api private
  30712. */
  30713. WS.prototype.uri = function () {
  30714. var query = this.query || {};
  30715. var schema = this.secure ? 'wss' : 'ws';
  30716. var port = '';
  30717. // avoid port if default for schema
  30718. if (this.port && (('wss' === schema && Number(this.port) !== 443) ||
  30719. ('ws' === schema && Number(this.port) !== 80))) {
  30720. port = ':' + this.port;
  30721. }
  30722. // append timestamp to URI
  30723. if (this.timestampRequests) {
  30724. query[this.timestampParam] = yeast();
  30725. }
  30726. // communicate binary support capabilities
  30727. if (!this.supportsBinary) {
  30728. query.b64 = 1;
  30729. }
  30730. query = parseqs.encode(query);
  30731. // prepend ? to query
  30732. if (query.length) {
  30733. query = '?' + query;
  30734. }
  30735. var ipv6 = this.hostname.indexOf(':') !== -1;
  30736. return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
  30737. };
  30738. /**
  30739. * Feature detection for WebSocket.
  30740. *
  30741. * @return {Boolean} whether this transport is available.
  30742. * @api public
  30743. */
  30744. WS.prototype.check = function () {
  30745. return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name);
  30746. };
  30747. });
  30748. return ___scope___.entry = "index.js";
  30749. });
  30750. FuseBox.pkg("xmlhttprequest-ssl", {}, function(___scope___){
  30751. ___scope___.file("lib/XMLHttpRequest.js", function(exports, require, module, __filename, __dirname){
  30752. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  30753. /* fuse:injection: */ var process = require("process");
  30754. /**
  30755. * Wrapper for built-in http.js to emulate the browser XMLHttpRequest object.
  30756. *
  30757. * This can be used with JS designed for browsers to improve reuse of code and
  30758. * allow the use of existing libraries.
  30759. *
  30760. * Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs.
  30761. *
  30762. * @author Dan DeFelippi <dan@driverdan.com>
  30763. * @contributor David Ellis <d.f.ellis@ieee.org>
  30764. * @license MIT
  30765. */
  30766. var fs = require('fs');
  30767. var Url = require('url');
  30768. var spawn = require('child_process').spawn;
  30769. /**
  30770. * Module exports.
  30771. */
  30772. module.exports = XMLHttpRequest;
  30773. // backwards-compat
  30774. XMLHttpRequest.XMLHttpRequest = XMLHttpRequest;
  30775. /**
  30776. * `XMLHttpRequest` constructor.
  30777. *
  30778. * Supported options for the `opts` object are:
  30779. *
  30780. * - `agent`: An http.Agent instance; http.globalAgent may be used; if 'undefined', agent usage is disabled
  30781. *
  30782. * @param {Object} opts optional "options" object
  30783. */
  30784. function XMLHttpRequest(opts) {
  30785. "use strict";
  30786. /**
  30787. * Private variables
  30788. */
  30789. var self = this;
  30790. var http = require('http');
  30791. var https = require('https');
  30792. // Holds http.js objects
  30793. var request;
  30794. var response;
  30795. // Request settings
  30796. var settings = {};
  30797. // Disable header blacklist.
  30798. // Not part of XHR specs.
  30799. var disableHeaderCheck = false;
  30800. // Set some default headers
  30801. var defaultHeaders = {
  30802. "User-Agent": "node-XMLHttpRequest",
  30803. "Accept": "*/*"
  30804. };
  30805. var headers = defaultHeaders;
  30806. // These headers are not user setable.
  30807. // The following are allowed but banned in the spec:
  30808. // * user-agent
  30809. var forbiddenRequestHeaders = [
  30810. "accept-charset",
  30811. "accept-encoding",
  30812. "access-control-request-headers",
  30813. "access-control-request-method",
  30814. "connection",
  30815. "content-length",
  30816. "content-transfer-encoding",
  30817. "cookie",
  30818. "cookie2",
  30819. "date",
  30820. "expect",
  30821. "host",
  30822. "keep-alive",
  30823. "origin",
  30824. "referer",
  30825. "te",
  30826. "trailer",
  30827. "transfer-encoding",
  30828. "upgrade",
  30829. "via"
  30830. ];
  30831. // These request methods are not allowed
  30832. var forbiddenRequestMethods = [
  30833. "TRACE",
  30834. "TRACK",
  30835. "CONNECT"
  30836. ];
  30837. // Send flag
  30838. var sendFlag = false;
  30839. // Error flag, used when errors occur or abort is called
  30840. var errorFlag = false;
  30841. // Event listeners
  30842. var listeners = {};
  30843. /**
  30844. * Constants
  30845. */
  30846. this.UNSENT = 0;
  30847. this.OPENED = 1;
  30848. this.HEADERS_RECEIVED = 2;
  30849. this.LOADING = 3;
  30850. this.DONE = 4;
  30851. /**
  30852. * Public vars
  30853. */
  30854. // Current state
  30855. this.readyState = this.UNSENT;
  30856. // default ready state change handler in case one is not set or is set late
  30857. this.onreadystatechange = null;
  30858. // Result & response
  30859. this.responseText = "";
  30860. this.responseXML = "";
  30861. this.status = null;
  30862. this.statusText = null;
  30863. /**
  30864. * Private methods
  30865. */
  30866. /**
  30867. * Check if the specified header is allowed.
  30868. *
  30869. * @param string header Header to validate
  30870. * @return boolean False if not allowed, otherwise true
  30871. */
  30872. var isAllowedHttpHeader = function(header) {
  30873. return disableHeaderCheck || (header && forbiddenRequestHeaders.indexOf(header.toLowerCase()) === -1);
  30874. };
  30875. /**
  30876. * Check if the specified method is allowed.
  30877. *
  30878. * @param string method Request method to validate
  30879. * @return boolean False if not allowed, otherwise true
  30880. */
  30881. var isAllowedHttpMethod = function(method) {
  30882. return (method && forbiddenRequestMethods.indexOf(method) === -1);
  30883. };
  30884. /**
  30885. * Public methods
  30886. */
  30887. /**
  30888. * Open the connection. Currently supports local server requests.
  30889. *
  30890. * @param string method Connection method (eg GET, POST)
  30891. * @param string url URL for the connection.
  30892. * @param boolean async Asynchronous connection. Default is true.
  30893. * @param string user Username for basic authentication (optional)
  30894. * @param string password Password for basic authentication (optional)
  30895. */
  30896. this.open = function(method, url, async, user, password) {
  30897. this.abort();
  30898. errorFlag = false;
  30899. // Check for valid request method
  30900. if (!isAllowedHttpMethod(method)) {
  30901. throw "SecurityError: Request method not allowed";
  30902. }
  30903. settings = {
  30904. "method": method,
  30905. "url": url.toString(),
  30906. "async": (typeof async !== "boolean" ? true : async),
  30907. "user": user || null,
  30908. "password": password || null
  30909. };
  30910. setState(this.OPENED);
  30911. };
  30912. /**
  30913. * Disables or enables isAllowedHttpHeader() check the request. Enabled by default.
  30914. * This does not conform to the W3C spec.
  30915. *
  30916. * @param boolean state Enable or disable header checking.
  30917. */
  30918. this.setDisableHeaderCheck = function(state) {
  30919. disableHeaderCheck = state;
  30920. };
  30921. /**
  30922. * Sets a header for the request.
  30923. *
  30924. * @param string header Header name
  30925. * @param string value Header value
  30926. * @return boolean Header added
  30927. */
  30928. this.setRequestHeader = function(header, value) {
  30929. if (this.readyState != this.OPENED) {
  30930. throw "INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN";
  30931. return false;
  30932. }
  30933. if (!isAllowedHttpHeader(header)) {
  30934. console.warn('Refused to set unsafe header "' + header + '"');
  30935. return false;
  30936. }
  30937. if (sendFlag) {
  30938. throw "INVALID_STATE_ERR: send flag is true";
  30939. return false;
  30940. }
  30941. headers[header] = value;
  30942. return true;
  30943. };
  30944. /**
  30945. * Gets a header from the server response.
  30946. *
  30947. * @param string header Name of header to get.
  30948. * @return string Text of the header or null if it doesn't exist.
  30949. */
  30950. this.getResponseHeader = function(header) {
  30951. if (typeof header === "string"
  30952. && this.readyState > this.OPENED
  30953. && response.headers[header.toLowerCase()]
  30954. && !errorFlag
  30955. ) {
  30956. return response.headers[header.toLowerCase()];
  30957. }
  30958. return null;
  30959. };
  30960. /**
  30961. * Gets all the response headers.
  30962. *
  30963. * @return string A string with all response headers separated by CR+LF
  30964. */
  30965. this.getAllResponseHeaders = function() {
  30966. if (this.readyState < this.HEADERS_RECEIVED || errorFlag) {
  30967. return "";
  30968. }
  30969. var result = "";
  30970. for (var i in response.headers) {
  30971. // Cookie headers are excluded
  30972. if (i !== "set-cookie" && i !== "set-cookie2") {
  30973. result += i + ": " + response.headers[i] + "\r\n";
  30974. }
  30975. }
  30976. return result.substr(0, result.length - 2);
  30977. };
  30978. /**
  30979. * Gets a request header
  30980. *
  30981. * @param string name Name of header to get
  30982. * @return string Returns the request header or empty string if not set
  30983. */
  30984. this.getRequestHeader = function(name) {
  30985. // @TODO Make this case insensitive
  30986. if (typeof name === "string" && headers[name]) {
  30987. return headers[name];
  30988. }
  30989. return "";
  30990. };
  30991. /**
  30992. * Sends the request to the server.
  30993. *
  30994. * @param string data Optional data to send as request body.
  30995. */
  30996. this.send = function(data) {
  30997. if (this.readyState != this.OPENED) {
  30998. throw "INVALID_STATE_ERR: connection must be opened before send() is called";
  30999. }
  31000. if (sendFlag) {
  31001. throw "INVALID_STATE_ERR: send has already been called";
  31002. }
  31003. var ssl = false, local = false;
  31004. var url = Url.parse(settings.url);
  31005. var host;
  31006. // Determine the server
  31007. switch (url.protocol) {
  31008. case 'https:':
  31009. ssl = true;
  31010. // SSL & non-SSL both need host, no break here.
  31011. case 'http:':
  31012. host = url.hostname;
  31013. break;
  31014. case 'file:':
  31015. local = true;
  31016. break;
  31017. case undefined:
  31018. case '':
  31019. host = "localhost";
  31020. break;
  31021. default:
  31022. throw "Protocol not supported.";
  31023. }
  31024. // Load files off the local filesystem (file://)
  31025. if (local) {
  31026. if (settings.method !== "GET") {
  31027. throw "XMLHttpRequest: Only GET method is supported";
  31028. }
  31029. if (settings.async) {
  31030. fs.readFile(url.pathname, 'utf8', function(error, data) {
  31031. if (error) {
  31032. self.handleError(error);
  31033. } else {
  31034. self.status = 200;
  31035. self.responseText = data;
  31036. setState(self.DONE);
  31037. }
  31038. });
  31039. } else {
  31040. try {
  31041. this.responseText = fs.readFileSync(url.pathname, 'utf8');
  31042. this.status = 200;
  31043. setState(self.DONE);
  31044. } catch(e) {
  31045. this.handleError(e);
  31046. }
  31047. }
  31048. return;
  31049. }
  31050. // Default to port 80. If accessing localhost on another port be sure
  31051. // to use http://localhost:port/path
  31052. var port = url.port || (ssl ? 443 : 80);
  31053. // Add query string if one is used
  31054. var uri = url.pathname + (url.search ? url.search : '');
  31055. // Set the Host header or the server may reject the request
  31056. headers["Host"] = host;
  31057. if (!((ssl && port === 443) || port === 80)) {
  31058. headers["Host"] += ':' + url.port;
  31059. }
  31060. // Set Basic Auth if necessary
  31061. if (settings.user) {
  31062. if (typeof settings.password == "undefined") {
  31063. settings.password = "";
  31064. }
  31065. var authBuf = new Buffer(settings.user + ":" + settings.password);
  31066. headers["Authorization"] = "Basic " + authBuf.toString("base64");
  31067. }
  31068. // Set content length header
  31069. if (settings.method === "GET" || settings.method === "HEAD") {
  31070. data = null;
  31071. } else if (data) {
  31072. headers["Content-Length"] = Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data);
  31073. if (!headers["Content-Type"]) {
  31074. headers["Content-Type"] = "text/plain;charset=UTF-8";
  31075. }
  31076. } else if (settings.method === "POST") {
  31077. // For a post with no data set Content-Length: 0.
  31078. // This is required by buggy servers that don't meet the specs.
  31079. headers["Content-Length"] = 0;
  31080. }
  31081. var agent = false;
  31082. if (opts && opts.agent) {
  31083. agent = opts.agent;
  31084. }
  31085. var options = {
  31086. host: host,
  31087. port: port,
  31088. path: uri,
  31089. method: settings.method,
  31090. headers: headers,
  31091. agent: agent
  31092. };
  31093. if (ssl) {
  31094. options.pfx = opts.pfx;
  31095. options.key = opts.key;
  31096. options.passphrase = opts.passphrase;
  31097. options.cert = opts.cert;
  31098. options.ca = opts.ca;
  31099. options.ciphers = opts.ciphers;
  31100. options.rejectUnauthorized = opts.rejectUnauthorized;
  31101. }
  31102. // Reset error flag
  31103. errorFlag = false;
  31104. // Handle async requests
  31105. if (settings.async) {
  31106. // Use the proper protocol
  31107. var doRequest = ssl ? https.request : http.request;
  31108. // Request is being sent, set send flag
  31109. sendFlag = true;
  31110. // As per spec, this is called here for historical reasons.
  31111. self.dispatchEvent("readystatechange");
  31112. // Handler for the response
  31113. var responseHandler = function(resp) {
  31114. // Set response var to the response we got back
  31115. // This is so it remains accessable outside this scope
  31116. response = resp;
  31117. // Check for redirect
  31118. // @TODO Prevent looped redirects
  31119. if (response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
  31120. // Change URL to the redirect location
  31121. settings.url = response.headers.location;
  31122. var url = Url.parse(settings.url);
  31123. // Set host var in case it's used later
  31124. host = url.hostname;
  31125. // Options for the new request
  31126. var newOptions = {
  31127. hostname: url.hostname,
  31128. port: url.port,
  31129. path: url.path,
  31130. method: response.statusCode === 303 ? 'GET' : settings.method,
  31131. headers: headers
  31132. };
  31133. if (ssl) {
  31134. newOptions.pfx = opts.pfx;
  31135. newOptions.key = opts.key;
  31136. newOptions.passphrase = opts.passphrase;
  31137. newOptions.cert = opts.cert;
  31138. newOptions.ca = opts.ca;
  31139. newOptions.ciphers = opts.ciphers;
  31140. newOptions.rejectUnauthorized = opts.rejectUnauthorized;
  31141. }
  31142. // Issue the new request
  31143. request = doRequest(newOptions, responseHandler).on('error', errorHandler);
  31144. request.end();
  31145. // @TODO Check if an XHR event needs to be fired here
  31146. return;
  31147. }
  31148. if (response && response.setEncoding) {
  31149. response.setEncoding("utf8");
  31150. }
  31151. setState(self.HEADERS_RECEIVED);
  31152. self.status = response.statusCode;
  31153. response.on('data', function(chunk) {
  31154. // Make sure there's some data
  31155. if (chunk) {
  31156. self.responseText += chunk;
  31157. }
  31158. // Don't emit state changes if the connection has been aborted.
  31159. if (sendFlag) {
  31160. setState(self.LOADING);
  31161. }
  31162. });
  31163. response.on('end', function() {
  31164. if (sendFlag) {
  31165. // Discard the 'end' event if the connection has been aborted
  31166. setState(self.DONE);
  31167. sendFlag = false;
  31168. }
  31169. });
  31170. response.on('error', function(error) {
  31171. self.handleError(error);
  31172. });
  31173. }
  31174. // Error handler for the request
  31175. var errorHandler = function(error) {
  31176. self.handleError(error);
  31177. }
  31178. // Create the request
  31179. request = doRequest(options, responseHandler).on('error', errorHandler);
  31180. // Node 0.4 and later won't accept empty data. Make sure it's needed.
  31181. if (data) {
  31182. request.write(data);
  31183. }
  31184. request.end();
  31185. self.dispatchEvent("loadstart");
  31186. } else { // Synchronous
  31187. // Create a temporary file for communication with the other Node process
  31188. var contentFile = ".node-xmlhttprequest-content-" + process.pid;
  31189. var syncFile = ".node-xmlhttprequest-sync-" + process.pid;
  31190. fs.writeFileSync(syncFile, "", "utf8");
  31191. // The async request the other Node process executes
  31192. var execString = "var http = require('http'), https = require('https'), fs = require('fs');"
  31193. + "var doRequest = http" + (ssl ? "s" : "") + ".request;"
  31194. + "var options = " + JSON.stringify(options) + ";"
  31195. + "var responseText = '';"
  31196. + "var req = doRequest(options, function(response) {"
  31197. + "response.setEncoding('utf8');"
  31198. + "response.on('data', function(chunk) {"
  31199. + " responseText += chunk;"
  31200. + "});"
  31201. + "response.on('end', function() {"
  31202. + "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');"
  31203. + "fs.unlinkSync('" + syncFile + "');"
  31204. + "});"
  31205. + "response.on('error', function(error) {"
  31206. + "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');"
  31207. + "fs.unlinkSync('" + syncFile + "');"
  31208. + "});"
  31209. + "}).on('error', function(error) {"
  31210. + "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');"
  31211. + "fs.unlinkSync('" + syncFile + "');"
  31212. + "});"
  31213. + (data ? "req.write('" + data.replace(/'/g, "\\'") + "');":"")
  31214. + "req.end();";
  31215. // Start the other Node Process, executing this string
  31216. var syncProc = spawn(process.argv[0], ["-e", execString]);
  31217. var statusText;
  31218. while(fs.existsSync(syncFile)) {
  31219. // Wait while the sync file is empty
  31220. }
  31221. self.responseText = fs.readFileSync(contentFile, 'utf8');
  31222. // Kill the child process once the file has data
  31223. syncProc.stdin.end();
  31224. // Remove the temporary file
  31225. fs.unlinkSync(contentFile);
  31226. if (self.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)) {
  31227. // If the file returned an error, handle it
  31228. var errorObj = self.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/, "");
  31229. self.handleError(errorObj);
  31230. } else {
  31231. // If the file returned okay, parse its data and move to the DONE state
  31232. self.status = self.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/, "$1");
  31233. self.responseText = self.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/, "$1");
  31234. setState(self.DONE);
  31235. }
  31236. }
  31237. };
  31238. /**
  31239. * Called when an error is encountered to deal with it.
  31240. */
  31241. this.handleError = function(error) {
  31242. this.status = 503;
  31243. this.statusText = error;
  31244. this.responseText = error.stack;
  31245. errorFlag = true;
  31246. setState(this.DONE);
  31247. };
  31248. /**
  31249. * Aborts a request.
  31250. */
  31251. this.abort = function() {
  31252. if (request) {
  31253. request.abort();
  31254. request = null;
  31255. }
  31256. headers = defaultHeaders;
  31257. this.responseText = "";
  31258. this.responseXML = "";
  31259. errorFlag = true;
  31260. if (this.readyState !== this.UNSENT
  31261. && (this.readyState !== this.OPENED || sendFlag)
  31262. && this.readyState !== this.DONE) {
  31263. sendFlag = false;
  31264. setState(this.DONE);
  31265. }
  31266. this.readyState = this.UNSENT;
  31267. };
  31268. /**
  31269. * Adds an event listener. Preferred method of binding to events.
  31270. */
  31271. this.addEventListener = function(event, callback) {
  31272. if (!(event in listeners)) {
  31273. listeners[event] = [];
  31274. }
  31275. // Currently allows duplicate callbacks. Should it?
  31276. listeners[event].push(callback);
  31277. };
  31278. /**
  31279. * Remove an event callback that has already been bound.
  31280. * Only works on the matching funciton, cannot be a copy.
  31281. */
  31282. this.removeEventListener = function(event, callback) {
  31283. if (event in listeners) {
  31284. // Filter will return a new array with the callback removed
  31285. listeners[event] = listeners[event].filter(function(ev) {
  31286. return ev !== callback;
  31287. });
  31288. }
  31289. };
  31290. /**
  31291. * Dispatch any events, including both "on" methods and events attached using addEventListener.
  31292. */
  31293. this.dispatchEvent = function(event) {
  31294. if (typeof self["on" + event] === "function") {
  31295. self["on" + event]();
  31296. }
  31297. if (event in listeners) {
  31298. for (var i = 0, len = listeners[event].length; i < len; i++) {
  31299. listeners[event][i].call(self);
  31300. }
  31301. }
  31302. };
  31303. /**
  31304. * Changes readyState and calls onreadystatechange.
  31305. *
  31306. * @param int state New state
  31307. */
  31308. var setState = function(state) {
  31309. if (self.readyState !== state) {
  31310. self.readyState = state;
  31311. if (settings.async || self.readyState < self.OPENED || self.readyState === self.DONE) {
  31312. self.dispatchEvent("readystatechange");
  31313. }
  31314. if (self.readyState === self.DONE && !errorFlag) {
  31315. self.dispatchEvent("load");
  31316. // @TODO figure out InspectorInstrumentation::didLoadXHR(cookie)
  31317. self.dispatchEvent("loadend");
  31318. }
  31319. }
  31320. };
  31321. };
  31322. });
  31323. return ___scope___.entry = "lib/XMLHttpRequest.js";
  31324. });
  31325. FuseBox.pkg("fs", {}, function(___scope___){
  31326. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  31327. if (FuseBox.isServer) {
  31328. module.exports = global.require("fs");
  31329. } else {
  31330. module.exports = {};
  31331. }
  31332. });
  31333. return ___scope___.entry = "index.js";
  31334. });
  31335. FuseBox.pkg("url", {}, function(___scope___){
  31336. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  31337. if (FuseBox.isServer) {
  31338. module.exports = global.require("url");
  31339. } else {
  31340. module.exports = {};
  31341. }
  31342. });
  31343. return ___scope___.entry = "index.js";
  31344. });
  31345. FuseBox.pkg("child_process", {}, function(___scope___){
  31346. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  31347. if (FuseBox.isServer) {
  31348. module.exports = global.require("child_process");
  31349. } else {
  31350. module.exports = {};
  31351. }
  31352. });
  31353. return ___scope___.entry = "index.js";
  31354. });
  31355. FuseBox.pkg("http", {}, function(___scope___){
  31356. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  31357. if (FuseBox.isServer) {
  31358. module.exports = global.require("http");
  31359. } else {
  31360. module.exports = {};
  31361. }
  31362. });
  31363. return ___scope___.entry = "index.js";
  31364. });
  31365. FuseBox.pkg("https", {}, function(___scope___){
  31366. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  31367. if (FuseBox.isServer) {
  31368. module.exports = global.require("https");
  31369. } else {
  31370. module.exports = {};
  31371. }
  31372. });
  31373. return ___scope___.entry = "index.js";
  31374. });
  31375. FuseBox.pkg("buffer", {}, function(___scope___){
  31376. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  31377. if (FuseBox.isServer) {
  31378. module.exports = global.require("buffer");
  31379. } else {
  31380. /*!
  31381. * The buffer module from node.js, for the browser.
  31382. *
  31383. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  31384. * @license MIT
  31385. */
  31386. /* eslint-disable no-proto */
  31387. "use strict";
  31388. var base64 = require("base64-js");
  31389. var ieee754 = require("ieee754");
  31390. exports.Buffer = Buffer;
  31391. exports.FuseShim = true;
  31392. exports.SlowBuffer = SlowBuffer;
  31393. exports.INSPECT_MAX_BYTES = 50;
  31394. var K_MAX_LENGTH = 0x7fffffff;
  31395. exports.kMaxLength = K_MAX_LENGTH;
  31396. /**
  31397. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  31398. * === true Use Uint8Array implementation (fastest)
  31399. * === false Print warning and recommend using `buffer` v4.x which has an Object
  31400. * implementation (most compatible, even IE6)
  31401. *
  31402. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  31403. * Opera 11.6+, iOS 4.2+.
  31404. *
  31405. * We report that the browser does not support typed arrays if the are not subclassable
  31406. * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
  31407. * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
  31408. * for __proto__ and has a buggy typed array implementation.
  31409. */
  31410. Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
  31411. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  31412. console.error(
  31413. "This browser lacks typed array (Uint8Array) support which is required by " +
  31414. "`buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
  31415. }
  31416. function typedArraySupport() {
  31417. // Can typed array instances can be augmented?
  31418. try {
  31419. var arr = new Uint8Array(1);
  31420. arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function() { return 42; } };
  31421. return arr.foo() === 42;
  31422. } catch (e) {
  31423. return false;
  31424. }
  31425. }
  31426. function createBuffer(length) {
  31427. if (length > K_MAX_LENGTH) {
  31428. throw new RangeError("Invalid typed array length");
  31429. }
  31430. // Return an augmented `Uint8Array` instance
  31431. var buf = new Uint8Array(length);
  31432. buf.__proto__ = Buffer.prototype;
  31433. return buf;
  31434. }
  31435. /**
  31436. * The Buffer constructor returns instances of `Uint8Array` that have their
  31437. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  31438. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  31439. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  31440. * returns a single octet.
  31441. *
  31442. * The `Uint8Array` prototype remains unmodified.
  31443. */
  31444. function Buffer(arg, encodingOrOffset, length) {
  31445. // Common case.
  31446. if (typeof arg === "number") {
  31447. if (typeof encodingOrOffset === "string") {
  31448. throw new Error(
  31449. "If encoding is specified then the first argument must be a string"
  31450. );
  31451. }
  31452. return allocUnsafe(arg);
  31453. }
  31454. return from(arg, encodingOrOffset, length);
  31455. }
  31456. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  31457. if (typeof Symbol !== "undefined" && Symbol.species &&
  31458. Buffer[Symbol.species] === Buffer) {
  31459. Object.defineProperty(Buffer, Symbol.species, {
  31460. value: null,
  31461. configurable: true,
  31462. enumerable: false,
  31463. writable: false,
  31464. });
  31465. }
  31466. Buffer.poolSize = 8192; // not used by this implementation
  31467. function from(value, encodingOrOffset, length) {
  31468. if (typeof value === "number") {
  31469. throw new TypeError("\"value\" argument must not be a number");
  31470. }
  31471. if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) {
  31472. return fromArrayBuffer(value, encodingOrOffset, length);
  31473. }
  31474. if (typeof value === "string") {
  31475. return fromString(value, encodingOrOffset);
  31476. }
  31477. return fromObject(value);
  31478. }
  31479. /**
  31480. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  31481. * if value is a number.
  31482. * Buffer.from(str[, encoding])
  31483. * Buffer.from(array)
  31484. * Buffer.from(buffer)
  31485. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  31486. **/
  31487. Buffer.from = function(value, encodingOrOffset, length) {
  31488. return from(value, encodingOrOffset, length);
  31489. };
  31490. // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
  31491. // https://github.com/feross/buffer/pull/148
  31492. Buffer.prototype.__proto__ = Uint8Array.prototype;
  31493. Buffer.__proto__ = Uint8Array;
  31494. function assertSize(size) {
  31495. if (typeof size !== "number") {
  31496. throw new TypeError("\"size\" argument must be a number");
  31497. } else if (size < 0) {
  31498. throw new RangeError("\"size\" argument must not be negative");
  31499. }
  31500. }
  31501. function alloc(size, fill, encoding) {
  31502. assertSize(size);
  31503. if (size <= 0) {
  31504. return createBuffer(size);
  31505. }
  31506. if (fill !== undefined) {
  31507. // Only pay attention to encoding if it's a string. This
  31508. // prevents accidentally sending in a number that would
  31509. // be interpretted as a start offset.
  31510. return typeof encoding === "string" ?
  31511. createBuffer(size).fill(fill, encoding) :
  31512. createBuffer(size).fill(fill);
  31513. }
  31514. return createBuffer(size);
  31515. }
  31516. /**
  31517. * Creates a new filled Buffer instance.
  31518. * alloc(size[, fill[, encoding]])
  31519. **/
  31520. Buffer.alloc = function(size, fill, encoding) {
  31521. return alloc(size, fill, encoding);
  31522. };
  31523. function allocUnsafe(size) {
  31524. assertSize(size);
  31525. return createBuffer(size < 0 ? 0 : checked(size) | 0);
  31526. }
  31527. /**
  31528. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  31529. * */
  31530. Buffer.allocUnsafe = function(size) {
  31531. return allocUnsafe(size);
  31532. };
  31533. /**
  31534. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  31535. */
  31536. Buffer.allocUnsafeSlow = function(size) {
  31537. return allocUnsafe(size);
  31538. };
  31539. function fromString(string, encoding) {
  31540. if (typeof encoding !== "string" || encoding === "") {
  31541. encoding = "utf8";
  31542. }
  31543. if (!Buffer.isEncoding(encoding)) {
  31544. throw new TypeError("\"encoding\" must be a valid string encoding");
  31545. }
  31546. var length = byteLength(string, encoding) | 0;
  31547. var buf = createBuffer(length);
  31548. var actual = buf.write(string, encoding);
  31549. if (actual !== length) {
  31550. // Writing a hex string, for example, that contains invalid characters will
  31551. // cause everything after the first invalid character to be ignored. (e.g.
  31552. // 'abxxcd' will be treated as 'ab')
  31553. buf = buf.slice(0, actual);
  31554. }
  31555. return buf;
  31556. }
  31557. function fromArrayLike(array) {
  31558. var length = array.length < 0 ? 0 : checked(array.length) | 0;
  31559. var buf = createBuffer(length);
  31560. for (var i = 0; i < length; i += 1) {
  31561. buf[i] = array[i] & 255;
  31562. }
  31563. return buf;
  31564. }
  31565. function fromArrayBuffer(array, byteOffset, length) {
  31566. array.byteLength; // this throws if `array` is not a valid ArrayBuffer
  31567. if (byteOffset < 0 || array.byteLength < byteOffset) {
  31568. throw new RangeError("'offset' is out of bounds");
  31569. }
  31570. if (array.byteLength < byteOffset + (length || 0)) {
  31571. throw new RangeError("'length' is out of bounds");
  31572. }
  31573. var buf;
  31574. if (byteOffset === undefined && length === undefined) {
  31575. buf = new Uint8Array(array);
  31576. } else if (length === undefined) {
  31577. buf = new Uint8Array(array, byteOffset);
  31578. } else {
  31579. buf = new Uint8Array(array, byteOffset, length);
  31580. }
  31581. // Return an augmented `Uint8Array` instance
  31582. buf.__proto__ = Buffer.prototype;
  31583. return buf;
  31584. }
  31585. function fromObject(obj) {
  31586. if (Buffer.isBuffer(obj)) {
  31587. var len = checked(obj.length) | 0;
  31588. var buf = createBuffer(len);
  31589. if (buf.length === 0) {
  31590. return buf;
  31591. }
  31592. obj.copy(buf, 0, 0, len);
  31593. return buf;
  31594. }
  31595. if (obj) {
  31596. if ((typeof ArrayBuffer !== "undefined" &&
  31597. obj.buffer instanceof ArrayBuffer) || "length" in obj) {
  31598. if (typeof obj.length !== "number" || isnan(obj.length)) {
  31599. return createBuffer(0);
  31600. }
  31601. return fromArrayLike(obj);
  31602. }
  31603. if (obj.type === "Buffer" && Array.isArray(obj.data)) {
  31604. return fromArrayLike(obj.data);
  31605. }
  31606. }
  31607. throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
  31608. }
  31609. function checked(length) {
  31610. // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
  31611. // length is NaN (which is otherwise coerced to zero.)
  31612. if (length >= K_MAX_LENGTH) {
  31613. throw new RangeError("Attempt to allocate Buffer larger than maximum " +
  31614. "size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
  31615. }
  31616. return length | 0;
  31617. }
  31618. function SlowBuffer(length) {
  31619. if (+length != length) { // eslint-disable-line eqeqeq
  31620. length = 0;
  31621. }
  31622. return Buffer.alloc(+length);
  31623. }
  31624. Buffer.isBuffer = function isBuffer(b) {
  31625. return !!(b != null && b._isBuffer);
  31626. };
  31627. Buffer.compare = function compare(a, b) {
  31628. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  31629. throw new TypeError("Arguments must be Buffers");
  31630. }
  31631. if (a === b) return 0;
  31632. var x = a.length;
  31633. var y = b.length;
  31634. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  31635. if (a[i] !== b[i]) {
  31636. x = a[i];
  31637. y = b[i];
  31638. break;
  31639. }
  31640. }
  31641. if (x < y) return -1;
  31642. if (y < x) return 1;
  31643. return 0;
  31644. };
  31645. Buffer.isEncoding = function isEncoding(encoding) {
  31646. switch (String(encoding).toLowerCase()) {
  31647. case "hex":
  31648. case "utf8":
  31649. case "utf-8":
  31650. case "ascii":
  31651. case "latin1":
  31652. case "binary":
  31653. case "base64":
  31654. case "ucs2":
  31655. case "ucs-2":
  31656. case "utf16le":
  31657. case "utf-16le":
  31658. return true;
  31659. default:
  31660. return false;
  31661. }
  31662. };
  31663. Buffer.concat = function concat(list, length) {
  31664. if (!Array.isArray(list)) {
  31665. throw new TypeError("\"list\" argument must be an Array of Buffers");
  31666. }
  31667. if (list.length === 0) {
  31668. return Buffer.alloc(0);
  31669. }
  31670. var i;
  31671. if (length === undefined) {
  31672. length = 0;
  31673. for (i = 0; i < list.length; ++i) {
  31674. length += list[i].length;
  31675. }
  31676. }
  31677. var buffer = Buffer.allocUnsafe(length);
  31678. var pos = 0;
  31679. for (i = 0; i < list.length; ++i) {
  31680. var buf = list[i];
  31681. if (!Buffer.isBuffer(buf)) {
  31682. throw new TypeError("\"list\" argument must be an Array of Buffers");
  31683. }
  31684. buf.copy(buffer, pos);
  31685. pos += buf.length;
  31686. }
  31687. return buffer;
  31688. };
  31689. function byteLength(string, encoding) {
  31690. if (Buffer.isBuffer(string)) {
  31691. return string.length;
  31692. }
  31693. if (typeof ArrayBuffer !== "undefined" && typeof ArrayBuffer.isView === "function" &&
  31694. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  31695. return string.byteLength;
  31696. }
  31697. if (typeof string !== "string") {
  31698. string = "" + string;
  31699. }
  31700. var len = string.length;
  31701. if (len === 0) return 0;
  31702. // Use a for loop to avoid recursion
  31703. var loweredCase = false;
  31704. for (;;) {
  31705. switch (encoding) {
  31706. case "ascii":
  31707. case "latin1":
  31708. case "binary":
  31709. return len;
  31710. case "utf8":
  31711. case "utf-8":
  31712. case undefined:
  31713. return utf8ToBytes(string).length;
  31714. case "ucs2":
  31715. case "ucs-2":
  31716. case "utf16le":
  31717. case "utf-16le":
  31718. return len * 2;
  31719. case "hex":
  31720. return len >>> 1;
  31721. case "base64":
  31722. return base64ToBytes(string).length;
  31723. default:
  31724. if (loweredCase) return utf8ToBytes(string).length; // assume utf8
  31725. encoding = ("" + encoding).toLowerCase();
  31726. loweredCase = true;
  31727. }
  31728. }
  31729. }
  31730. Buffer.byteLength = byteLength;
  31731. function slowToString(encoding, start, end) {
  31732. var loweredCase = false;
  31733. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  31734. // property of a typed array.
  31735. // This behaves neither like String nor Uint8Array in that we set start/end
  31736. // to their upper/lower bounds if the value passed is out of range.
  31737. // undefined is handled specially as per ECMA-262 6th Edition,
  31738. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  31739. if (start === undefined || start < 0) {
  31740. start = 0;
  31741. }
  31742. // Return early if start > this.length. Done here to prevent potential uint32
  31743. // coercion fail below.
  31744. if (start > this.length) {
  31745. return "";
  31746. }
  31747. if (end === undefined || end > this.length) {
  31748. end = this.length;
  31749. }
  31750. if (end <= 0) {
  31751. return "";
  31752. }
  31753. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  31754. end >>>= 0;
  31755. start >>>= 0;
  31756. if (end <= start) {
  31757. return "";
  31758. }
  31759. if (!encoding) encoding = "utf8";
  31760. while (true) {
  31761. switch (encoding) {
  31762. case "hex":
  31763. return hexSlice(this, start, end);
  31764. case "utf8":
  31765. case "utf-8":
  31766. return utf8Slice(this, start, end);
  31767. case "ascii":
  31768. return asciiSlice(this, start, end);
  31769. case "latin1":
  31770. case "binary":
  31771. return latin1Slice(this, start, end);
  31772. case "base64":
  31773. return base64Slice(this, start, end);
  31774. case "ucs2":
  31775. case "ucs-2":
  31776. case "utf16le":
  31777. case "utf-16le":
  31778. return utf16leSlice(this, start, end);
  31779. default:
  31780. if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
  31781. encoding = (encoding + "").toLowerCase();
  31782. loweredCase = true;
  31783. }
  31784. }
  31785. }
  31786. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  31787. // Buffer instances.
  31788. Buffer.prototype._isBuffer = true;
  31789. function swap(b, n, m) {
  31790. var i = b[n];
  31791. b[n] = b[m];
  31792. b[m] = i;
  31793. }
  31794. Buffer.prototype.swap16 = function swap16() {
  31795. var len = this.length;
  31796. if (len % 2 !== 0) {
  31797. throw new RangeError("Buffer size must be a multiple of 16-bits");
  31798. }
  31799. for (var i = 0; i < len; i += 2) {
  31800. swap(this, i, i + 1);
  31801. }
  31802. return this;
  31803. };
  31804. Buffer.prototype.swap32 = function swap32() {
  31805. var len = this.length;
  31806. if (len % 4 !== 0) {
  31807. throw new RangeError("Buffer size must be a multiple of 32-bits");
  31808. }
  31809. for (var i = 0; i < len; i += 4) {
  31810. swap(this, i, i + 3);
  31811. swap(this, i + 1, i + 2);
  31812. }
  31813. return this;
  31814. };
  31815. Buffer.prototype.swap64 = function swap64() {
  31816. var len = this.length;
  31817. if (len % 8 !== 0) {
  31818. throw new RangeError("Buffer size must be a multiple of 64-bits");
  31819. }
  31820. for (var i = 0; i < len; i += 8) {
  31821. swap(this, i, i + 7);
  31822. swap(this, i + 1, i + 6);
  31823. swap(this, i + 2, i + 5);
  31824. swap(this, i + 3, i + 4);
  31825. }
  31826. return this;
  31827. };
  31828. Buffer.prototype.toString = function toString() {
  31829. var length = this.length;
  31830. if (length === 0) return "";
  31831. if (arguments.length === 0) return utf8Slice(this, 0, length);
  31832. return slowToString.apply(this, arguments);
  31833. };
  31834. Buffer.prototype.equals = function equals(b) {
  31835. if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
  31836. if (this === b) return true;
  31837. return Buffer.compare(this, b) === 0;
  31838. };
  31839. Buffer.prototype.inspect = function inspect() {
  31840. var str = "";
  31841. var max = exports.INSPECT_MAX_BYTES;
  31842. if (this.length > 0) {
  31843. str = this.toString("hex", 0, max).match(/.{2}/g).join(" ");
  31844. if (this.length > max) str += " ... ";
  31845. }
  31846. return "<Buffer " + str + ">";
  31847. };
  31848. Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
  31849. if (!Buffer.isBuffer(target)) {
  31850. throw new TypeError("Argument must be a Buffer");
  31851. }
  31852. if (start === undefined) {
  31853. start = 0;
  31854. }
  31855. if (end === undefined) {
  31856. end = target ? target.length : 0;
  31857. }
  31858. if (thisStart === undefined) {
  31859. thisStart = 0;
  31860. }
  31861. if (thisEnd === undefined) {
  31862. thisEnd = this.length;
  31863. }
  31864. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  31865. throw new RangeError("out of range index");
  31866. }
  31867. if (thisStart >= thisEnd && start >= end) {
  31868. return 0;
  31869. }
  31870. if (thisStart >= thisEnd) {
  31871. return -1;
  31872. }
  31873. if (start >= end) {
  31874. return 1;
  31875. }
  31876. start >>>= 0;
  31877. end >>>= 0;
  31878. thisStart >>>= 0;
  31879. thisEnd >>>= 0;
  31880. if (this === target) return 0;
  31881. var x = thisEnd - thisStart;
  31882. var y = end - start;
  31883. var len = Math.min(x, y);
  31884. var thisCopy = this.slice(thisStart, thisEnd);
  31885. var targetCopy = target.slice(start, end);
  31886. for (var i = 0; i < len; ++i) {
  31887. if (thisCopy[i] !== targetCopy[i]) {
  31888. x = thisCopy[i];
  31889. y = targetCopy[i];
  31890. break;
  31891. }
  31892. }
  31893. if (x < y) return -1;
  31894. if (y < x) return 1;
  31895. return 0;
  31896. };
  31897. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  31898. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  31899. //
  31900. // Arguments:
  31901. // - buffer - a Buffer to search
  31902. // - val - a string, Buffer, or number
  31903. // - byteOffset - an index into `buffer`; will be clamped to an int32
  31904. // - encoding - an optional encoding, relevant is val is a string
  31905. // - dir - true for indexOf, false for lastIndexOf
  31906. function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
  31907. // Empty buffer means no match
  31908. if (buffer.length === 0) return -1;
  31909. // Normalize byteOffset
  31910. if (typeof byteOffset === "string") {
  31911. encoding = byteOffset;
  31912. byteOffset = 0;
  31913. } else if (byteOffset > 0x7fffffff) {
  31914. byteOffset = 0x7fffffff;
  31915. } else if (byteOffset < -0x80000000) {
  31916. byteOffset = -0x80000000;
  31917. }
  31918. byteOffset = +byteOffset; // Coerce to Number.
  31919. if (isNaN(byteOffset)) {
  31920. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  31921. byteOffset = dir ? 0 : (buffer.length - 1);
  31922. }
  31923. // Normalize byteOffset: negative offsets start from the end of the buffer
  31924. if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
  31925. if (byteOffset >= buffer.length) {
  31926. if (dir) return -1;
  31927. else byteOffset = buffer.length - 1;
  31928. } else if (byteOffset < 0) {
  31929. if (dir) byteOffset = 0;
  31930. else return -1;
  31931. }
  31932. // Normalize val
  31933. if (typeof val === "string") {
  31934. val = Buffer.from(val, encoding);
  31935. }
  31936. // Finally, search either indexOf (if dir is true) or lastIndexOf
  31937. if (Buffer.isBuffer(val)) {
  31938. // Special case: looking for empty string/buffer always fails
  31939. if (val.length === 0) {
  31940. return -1;
  31941. }
  31942. return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
  31943. } else if (typeof val === "number") {
  31944. val = val & 0xFF; // Search for a byte value [0-255]
  31945. if (typeof Uint8Array.prototype.indexOf === "function") {
  31946. if (dir) {
  31947. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
  31948. } else {
  31949. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
  31950. }
  31951. }
  31952. return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
  31953. }
  31954. throw new TypeError("val must be string, number or Buffer");
  31955. }
  31956. function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
  31957. var indexSize = 1;
  31958. var arrLength = arr.length;
  31959. var valLength = val.length;
  31960. if (encoding !== undefined) {
  31961. encoding = String(encoding).toLowerCase();
  31962. if (encoding === "ucs2" || encoding === "ucs-2" ||
  31963. encoding === "utf16le" || encoding === "utf-16le") {
  31964. if (arr.length < 2 || val.length < 2) {
  31965. return -1;
  31966. }
  31967. indexSize = 2;
  31968. arrLength /= 2;
  31969. valLength /= 2;
  31970. byteOffset /= 2;
  31971. }
  31972. }
  31973. function read(buf, i) {
  31974. if (indexSize === 1) {
  31975. return buf[i];
  31976. } else {
  31977. return buf.readUInt16BE(i * indexSize);
  31978. }
  31979. }
  31980. var i;
  31981. if (dir) {
  31982. var foundIndex = -1;
  31983. for (i = byteOffset; i < arrLength; i++) {
  31984. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  31985. if (foundIndex === -1) foundIndex = i;
  31986. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
  31987. } else {
  31988. if (foundIndex !== -1) i -= i - foundIndex;
  31989. foundIndex = -1;
  31990. }
  31991. }
  31992. } else {
  31993. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
  31994. for (i = byteOffset; i >= 0; i--) {
  31995. var found = true;
  31996. for (var j = 0; j < valLength; j++) {
  31997. if (read(arr, i + j) !== read(val, j)) {
  31998. found = false;
  31999. break;
  32000. }
  32001. }
  32002. if (found) return i;
  32003. }
  32004. }
  32005. return -1;
  32006. }
  32007. Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
  32008. return this.indexOf(val, byteOffset, encoding) !== -1;
  32009. };
  32010. Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
  32011. return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
  32012. };
  32013. Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
  32014. return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
  32015. };
  32016. function hexWrite(buf, string, offset, length) {
  32017. offset = Number(offset) || 0;
  32018. var remaining = buf.length - offset;
  32019. if (!length) {
  32020. length = remaining;
  32021. } else {
  32022. length = Number(length);
  32023. if (length > remaining) {
  32024. length = remaining;
  32025. }
  32026. }
  32027. // must be an even number of digits
  32028. var strLen = string.length;
  32029. if (strLen % 2 !== 0) throw new TypeError("Invalid hex string");
  32030. if (length > strLen / 2) {
  32031. length = strLen / 2;
  32032. }
  32033. for (var i = 0; i < length; ++i) {
  32034. var parsed = parseInt(string.substr(i * 2, 2), 16);
  32035. if (isNaN(parsed)) return i;
  32036. buf[offset + i] = parsed;
  32037. }
  32038. return i;
  32039. }
  32040. function utf8Write(buf, string, offset, length) {
  32041. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
  32042. }
  32043. function asciiWrite(buf, string, offset, length) {
  32044. return blitBuffer(asciiToBytes(string), buf, offset, length);
  32045. }
  32046. function latin1Write(buf, string, offset, length) {
  32047. return asciiWrite(buf, string, offset, length);
  32048. }
  32049. function base64Write(buf, string, offset, length) {
  32050. return blitBuffer(base64ToBytes(string), buf, offset, length);
  32051. }
  32052. function ucs2Write(buf, string, offset, length) {
  32053. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
  32054. }
  32055. Buffer.prototype.write = function write(string, offset, length, encoding) {
  32056. // Buffer#write(string)
  32057. if (offset === undefined) {
  32058. encoding = "utf8";
  32059. length = this.length;
  32060. offset = 0;
  32061. // Buffer#write(string, encoding)
  32062. } else if (length === undefined && typeof offset === "string") {
  32063. encoding = offset;
  32064. length = this.length;
  32065. offset = 0;
  32066. // Buffer#write(string, offset[, length][, encoding])
  32067. } else if (isFinite(offset)) {
  32068. offset = offset >>> 0;
  32069. if (isFinite(length)) {
  32070. length = length >>> 0;
  32071. if (encoding === undefined) encoding = "utf8";
  32072. } else {
  32073. encoding = length;
  32074. length = undefined;
  32075. }
  32076. // legacy write(string, encoding, offset, length) - remove in v0.13
  32077. } else {
  32078. throw new Error(
  32079. "Buffer.write(string, encoding, offset[, length]) is no longer supported"
  32080. );
  32081. }
  32082. var remaining = this.length - offset;
  32083. if (length === undefined || length > remaining) length = remaining;
  32084. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  32085. throw new RangeError("Attempt to write outside buffer bounds");
  32086. }
  32087. if (!encoding) encoding = "utf8";
  32088. var loweredCase = false;
  32089. for (;;) {
  32090. switch (encoding) {
  32091. case "hex":
  32092. return hexWrite(this, string, offset, length);
  32093. case "utf8":
  32094. case "utf-8":
  32095. return utf8Write(this, string, offset, length);
  32096. case "ascii":
  32097. return asciiWrite(this, string, offset, length);
  32098. case "latin1":
  32099. case "binary":
  32100. return latin1Write(this, string, offset, length);
  32101. case "base64":
  32102. // Warning: maxLength not taken into account in base64Write
  32103. return base64Write(this, string, offset, length);
  32104. case "ucs2":
  32105. case "ucs-2":
  32106. case "utf16le":
  32107. case "utf-16le":
  32108. return ucs2Write(this, string, offset, length);
  32109. default:
  32110. if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
  32111. encoding = ("" + encoding).toLowerCase();
  32112. loweredCase = true;
  32113. }
  32114. }
  32115. };
  32116. Buffer.prototype.toJSON = function toJSON() {
  32117. return {
  32118. type: "Buffer",
  32119. data: Array.prototype.slice.call(this._arr || this, 0),
  32120. };
  32121. };
  32122. function base64Slice(buf, start, end) {
  32123. if (start === 0 && end === buf.length) {
  32124. return base64.fromByteArray(buf);
  32125. } else {
  32126. return base64.fromByteArray(buf.slice(start, end));
  32127. }
  32128. }
  32129. function utf8Slice(buf, start, end) {
  32130. end = Math.min(buf.length, end);
  32131. var res = [];
  32132. var i = start;
  32133. while (i < end) {
  32134. var firstByte = buf[i];
  32135. var codePoint = null;
  32136. var bytesPerSequence = (firstByte > 0xEF) ? 4 :
  32137. (firstByte > 0xDF) ? 3 :
  32138. (firstByte > 0xBF) ? 2 :
  32139. 1;
  32140. if (i + bytesPerSequence <= end) {
  32141. var secondByte, thirdByte, fourthByte, tempCodePoint;
  32142. switch (bytesPerSequence) {
  32143. case 1:
  32144. if (firstByte < 0x80) {
  32145. codePoint = firstByte;
  32146. }
  32147. break;
  32148. case 2:
  32149. secondByte = buf[i + 1];
  32150. if ((secondByte & 0xC0) === 0x80) {
  32151. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
  32152. if (tempCodePoint > 0x7F) {
  32153. codePoint = tempCodePoint;
  32154. }
  32155. }
  32156. break;
  32157. case 3:
  32158. secondByte = buf[i + 1];
  32159. thirdByte = buf[i + 2];
  32160. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  32161. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
  32162. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  32163. codePoint = tempCodePoint;
  32164. }
  32165. }
  32166. break;
  32167. case 4:
  32168. secondByte = buf[i + 1];
  32169. thirdByte = buf[i + 2];
  32170. fourthByte = buf[i + 3];
  32171. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  32172. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
  32173. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  32174. codePoint = tempCodePoint;
  32175. }
  32176. }
  32177. }
  32178. }
  32179. if (codePoint === null) {
  32180. // we did not generate a valid codePoint so insert a
  32181. // replacement char (U+FFFD) and advance only 1 byte
  32182. codePoint = 0xFFFD;
  32183. bytesPerSequence = 1;
  32184. } else if (codePoint > 0xFFFF) {
  32185. // encode to utf16 (surrogate pair dance)
  32186. codePoint -= 0x10000;
  32187. res.push(codePoint >>> 10 & 0x3FF | 0xD800);
  32188. codePoint = 0xDC00 | codePoint & 0x3FF;
  32189. }
  32190. res.push(codePoint);
  32191. i += bytesPerSequence;
  32192. }
  32193. return decodeCodePointsArray(res);
  32194. }
  32195. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  32196. // the lowest limit is Chrome, with 0x10000 args.
  32197. // We go 1 magnitude less, for safety
  32198. var MAX_ARGUMENTS_LENGTH = 0x1000;
  32199. function decodeCodePointsArray(codePoints) {
  32200. var len = codePoints.length;
  32201. if (len <= MAX_ARGUMENTS_LENGTH) {
  32202. return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
  32203. }
  32204. // Decode in chunks to avoid "call stack size exceeded".
  32205. var res = "";
  32206. var i = 0;
  32207. while (i < len) {
  32208. res += String.fromCharCode.apply(
  32209. String,
  32210. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  32211. );
  32212. }
  32213. return res;
  32214. }
  32215. function asciiSlice(buf, start, end) {
  32216. var ret = "";
  32217. end = Math.min(buf.length, end);
  32218. for (var i = start; i < end; ++i) {
  32219. ret += String.fromCharCode(buf[i] & 0x7F);
  32220. }
  32221. return ret;
  32222. }
  32223. function latin1Slice(buf, start, end) {
  32224. var ret = "";
  32225. end = Math.min(buf.length, end);
  32226. for (var i = start; i < end; ++i) {
  32227. ret += String.fromCharCode(buf[i]);
  32228. }
  32229. return ret;
  32230. }
  32231. function hexSlice(buf, start, end) {
  32232. var len = buf.length;
  32233. if (!start || start < 0) start = 0;
  32234. if (!end || end < 0 || end > len) end = len;
  32235. var out = "";
  32236. for (var i = start; i < end; ++i) {
  32237. out += toHex(buf[i]);
  32238. }
  32239. return out;
  32240. }
  32241. function utf16leSlice(buf, start, end) {
  32242. var bytes = buf.slice(start, end);
  32243. var res = "";
  32244. for (var i = 0; i < bytes.length; i += 2) {
  32245. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
  32246. }
  32247. return res;
  32248. }
  32249. Buffer.prototype.slice = function slice(start, end) {
  32250. var len = this.length;
  32251. start = ~~start;
  32252. end = end === undefined ? len : ~~end;
  32253. if (start < 0) {
  32254. start += len;
  32255. if (start < 0) start = 0;
  32256. } else if (start > len) {
  32257. start = len;
  32258. }
  32259. if (end < 0) {
  32260. end += len;
  32261. if (end < 0) end = 0;
  32262. } else if (end > len) {
  32263. end = len;
  32264. }
  32265. if (end < start) end = start;
  32266. var newBuf = this.subarray(start, end);
  32267. // Return an augmented `Uint8Array` instance
  32268. newBuf.__proto__ = Buffer.prototype;
  32269. return newBuf;
  32270. };
  32271. /*
  32272. * Need to make sure that buffer isn't trying to write out of bounds.
  32273. */
  32274. function checkOffset(offset, ext, length) {
  32275. if ((offset % 1) !== 0 || offset < 0) throw new RangeError("offset is not uint");
  32276. if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
  32277. }
  32278. Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
  32279. offset = offset >>> 0;
  32280. byteLength = byteLength >>> 0;
  32281. if (!noAssert) checkOffset(offset, byteLength, this.length);
  32282. var val = this[offset];
  32283. var mul = 1;
  32284. var i = 0;
  32285. while (++i < byteLength && (mul *= 0x100)) {
  32286. val += this[offset + i] * mul;
  32287. }
  32288. return val;
  32289. };
  32290. Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
  32291. offset = offset >>> 0;
  32292. byteLength = byteLength >>> 0;
  32293. if (!noAssert) {
  32294. checkOffset(offset, byteLength, this.length);
  32295. }
  32296. var val = this[offset + --byteLength];
  32297. var mul = 1;
  32298. while (byteLength > 0 && (mul *= 0x100)) {
  32299. val += this[offset + --byteLength] * mul;
  32300. }
  32301. return val;
  32302. };
  32303. Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
  32304. offset = offset >>> 0;
  32305. if (!noAssert) checkOffset(offset, 1, this.length);
  32306. return this[offset];
  32307. };
  32308. Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
  32309. offset = offset >>> 0;
  32310. if (!noAssert) checkOffset(offset, 2, this.length);
  32311. return this[offset] | (this[offset + 1] << 8);
  32312. };
  32313. Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
  32314. offset = offset >>> 0;
  32315. if (!noAssert) checkOffset(offset, 2, this.length);
  32316. return (this[offset] << 8) | this[offset + 1];
  32317. };
  32318. Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
  32319. offset = offset >>> 0;
  32320. if (!noAssert) checkOffset(offset, 4, this.length);
  32321. return ((this[offset]) |
  32322. (this[offset + 1] << 8) |
  32323. (this[offset + 2] << 16)) +
  32324. (this[offset + 3] * 0x1000000);
  32325. };
  32326. Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
  32327. offset = offset >>> 0;
  32328. if (!noAssert) checkOffset(offset, 4, this.length);
  32329. return (this[offset] * 0x1000000) +
  32330. ((this[offset + 1] << 16) |
  32331. (this[offset + 2] << 8) |
  32332. this[offset + 3]);
  32333. };
  32334. Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
  32335. offset = offset >>> 0;
  32336. byteLength = byteLength >>> 0;
  32337. if (!noAssert) checkOffset(offset, byteLength, this.length);
  32338. var val = this[offset];
  32339. var mul = 1;
  32340. var i = 0;
  32341. while (++i < byteLength && (mul *= 0x100)) {
  32342. val += this[offset + i] * mul;
  32343. }
  32344. mul *= 0x80;
  32345. if (val >= mul) val -= Math.pow(2, 8 * byteLength);
  32346. return val;
  32347. };
  32348. Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
  32349. offset = offset >>> 0;
  32350. byteLength = byteLength >>> 0;
  32351. if (!noAssert) checkOffset(offset, byteLength, this.length);
  32352. var i = byteLength;
  32353. var mul = 1;
  32354. var val = this[offset + --i];
  32355. while (i > 0 && (mul *= 0x100)) {
  32356. val += this[offset + --i] * mul;
  32357. }
  32358. mul *= 0x80;
  32359. if (val >= mul) val -= Math.pow(2, 8 * byteLength);
  32360. return val;
  32361. };
  32362. Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
  32363. offset = offset >>> 0;
  32364. if (!noAssert) checkOffset(offset, 1, this.length);
  32365. if (!(this[offset] & 0x80)) return (this[offset]);
  32366. return ((0xff - this[offset] + 1) * -1);
  32367. };
  32368. Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
  32369. offset = offset >>> 0;
  32370. if (!noAssert) checkOffset(offset, 2, this.length);
  32371. var val = this[offset] | (this[offset + 1] << 8);
  32372. return (val & 0x8000) ? val | 0xFFFF0000 : val;
  32373. };
  32374. Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
  32375. offset = offset >>> 0;
  32376. if (!noAssert) checkOffset(offset, 2, this.length);
  32377. var val = this[offset + 1] | (this[offset] << 8);
  32378. return (val & 0x8000) ? val | 0xFFFF0000 : val;
  32379. };
  32380. Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
  32381. offset = offset >>> 0;
  32382. if (!noAssert) checkOffset(offset, 4, this.length);
  32383. return (this[offset]) |
  32384. (this[offset + 1] << 8) |
  32385. (this[offset + 2] << 16) |
  32386. (this[offset + 3] << 24);
  32387. };
  32388. Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
  32389. offset = offset >>> 0;
  32390. if (!noAssert) checkOffset(offset, 4, this.length);
  32391. return (this[offset] << 24) |
  32392. (this[offset + 1] << 16) |
  32393. (this[offset + 2] << 8) |
  32394. (this[offset + 3]);
  32395. };
  32396. Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
  32397. offset = offset >>> 0;
  32398. if (!noAssert) checkOffset(offset, 4, this.length);
  32399. return ieee754.read(this, offset, true, 23, 4);
  32400. };
  32401. Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
  32402. offset = offset >>> 0;
  32403. if (!noAssert) checkOffset(offset, 4, this.length);
  32404. return ieee754.read(this, offset, false, 23, 4);
  32405. };
  32406. Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
  32407. offset = offset >>> 0;
  32408. if (!noAssert) checkOffset(offset, 8, this.length);
  32409. return ieee754.read(this, offset, true, 52, 8);
  32410. };
  32411. Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
  32412. offset = offset >>> 0;
  32413. if (!noAssert) checkOffset(offset, 8, this.length);
  32414. return ieee754.read(this, offset, false, 52, 8);
  32415. };
  32416. function checkInt(buf, value, offset, ext, max, min) {
  32417. if (!Buffer.isBuffer(buf)) throw new TypeError("\"buffer\" argument must be a Buffer instance");
  32418. if (value > max || value < min) throw new RangeError("\"value\" argument is out of bounds");
  32419. if (offset + ext > buf.length) throw new RangeError("Index out of range");
  32420. }
  32421. Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
  32422. value = +value;
  32423. offset = offset >>> 0;
  32424. byteLength = byteLength >>> 0;
  32425. if (!noAssert) {
  32426. var maxBytes = Math.pow(2, 8 * byteLength) - 1;
  32427. checkInt(this, value, offset, byteLength, maxBytes, 0);
  32428. }
  32429. var mul = 1;
  32430. var i = 0;
  32431. this[offset] = value & 0xFF;
  32432. while (++i < byteLength && (mul *= 0x100)) {
  32433. this[offset + i] = (value / mul) & 0xFF;
  32434. }
  32435. return offset + byteLength;
  32436. };
  32437. Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
  32438. value = +value;
  32439. offset = offset >>> 0;
  32440. byteLength = byteLength >>> 0;
  32441. if (!noAssert) {
  32442. var maxBytes = Math.pow(2, 8 * byteLength) - 1;
  32443. checkInt(this, value, offset, byteLength, maxBytes, 0);
  32444. }
  32445. var i = byteLength - 1;
  32446. var mul = 1;
  32447. this[offset + i] = value & 0xFF;
  32448. while (--i >= 0 && (mul *= 0x100)) {
  32449. this[offset + i] = (value / mul) & 0xFF;
  32450. }
  32451. return offset + byteLength;
  32452. };
  32453. Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
  32454. value = +value;
  32455. offset = offset >>> 0;
  32456. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
  32457. this[offset] = (value & 0xff);
  32458. return offset + 1;
  32459. };
  32460. Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
  32461. value = +value;
  32462. offset = offset >>> 0;
  32463. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
  32464. this[offset] = (value & 0xff);
  32465. this[offset + 1] = (value >>> 8);
  32466. return offset + 2;
  32467. };
  32468. Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
  32469. value = +value;
  32470. offset = offset >>> 0;
  32471. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
  32472. this[offset] = (value >>> 8);
  32473. this[offset + 1] = (value & 0xff);
  32474. return offset + 2;
  32475. };
  32476. Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
  32477. value = +value;
  32478. offset = offset >>> 0;
  32479. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
  32480. this[offset + 3] = (value >>> 24);
  32481. this[offset + 2] = (value >>> 16);
  32482. this[offset + 1] = (value >>> 8);
  32483. this[offset] = (value & 0xff);
  32484. return offset + 4;
  32485. };
  32486. Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
  32487. value = +value;
  32488. offset = offset >>> 0;
  32489. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
  32490. this[offset] = (value >>> 24);
  32491. this[offset + 1] = (value >>> 16);
  32492. this[offset + 2] = (value >>> 8);
  32493. this[offset + 3] = (value & 0xff);
  32494. return offset + 4;
  32495. };
  32496. Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
  32497. value = +value;
  32498. offset = offset >>> 0;
  32499. if (!noAssert) {
  32500. var limit = Math.pow(2, 8 * byteLength - 1);
  32501. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  32502. }
  32503. var i = 0;
  32504. var mul = 1;
  32505. var sub = 0;
  32506. this[offset] = value & 0xFF;
  32507. while (++i < byteLength && (mul *= 0x100)) {
  32508. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  32509. sub = 1;
  32510. }
  32511. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
  32512. }
  32513. return offset + byteLength;
  32514. };
  32515. Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
  32516. value = +value;
  32517. offset = offset >>> 0;
  32518. if (!noAssert) {
  32519. var limit = Math.pow(2, 8 * byteLength - 1);
  32520. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  32521. }
  32522. var i = byteLength - 1;
  32523. var mul = 1;
  32524. var sub = 0;
  32525. this[offset + i] = value & 0xFF;
  32526. while (--i >= 0 && (mul *= 0x100)) {
  32527. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  32528. sub = 1;
  32529. }
  32530. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
  32531. }
  32532. return offset + byteLength;
  32533. };
  32534. Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
  32535. value = +value;
  32536. offset = offset >>> 0;
  32537. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
  32538. if (value < 0) value = 0xff + value + 1;
  32539. this[offset] = (value & 0xff);
  32540. return offset + 1;
  32541. };
  32542. Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
  32543. value = +value;
  32544. offset = offset >>> 0;
  32545. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
  32546. this[offset] = (value & 0xff);
  32547. this[offset + 1] = (value >>> 8);
  32548. return offset + 2;
  32549. };
  32550. Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
  32551. value = +value;
  32552. offset = offset >>> 0;
  32553. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
  32554. this[offset] = (value >>> 8);
  32555. this[offset + 1] = (value & 0xff);
  32556. return offset + 2;
  32557. };
  32558. Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
  32559. value = +value;
  32560. offset = offset >>> 0;
  32561. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
  32562. this[offset] = (value & 0xff);
  32563. this[offset + 1] = (value >>> 8);
  32564. this[offset + 2] = (value >>> 16);
  32565. this[offset + 3] = (value >>> 24);
  32566. return offset + 4;
  32567. };
  32568. Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
  32569. value = +value;
  32570. offset = offset >>> 0;
  32571. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
  32572. if (value < 0) value = 0xffffffff + value + 1;
  32573. this[offset] = (value >>> 24);
  32574. this[offset + 1] = (value >>> 16);
  32575. this[offset + 2] = (value >>> 8);
  32576. this[offset + 3] = (value & 0xff);
  32577. return offset + 4;
  32578. };
  32579. function checkIEEE754(buf, value, offset, ext, max, min) {
  32580. if (offset + ext > buf.length) throw new RangeError("Index out of range");
  32581. if (offset < 0) throw new RangeError("Index out of range");
  32582. }
  32583. function writeFloat(buf, value, offset, littleEndian, noAssert) {
  32584. value = +value;
  32585. offset = offset >>> 0;
  32586. if (!noAssert) {
  32587. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);
  32588. }
  32589. ieee754.write(buf, value, offset, littleEndian, 23, 4);
  32590. return offset + 4;
  32591. }
  32592. Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
  32593. return writeFloat(this, value, offset, true, noAssert);
  32594. };
  32595. Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
  32596. return writeFloat(this, value, offset, false, noAssert);
  32597. };
  32598. function writeDouble(buf, value, offset, littleEndian, noAssert) {
  32599. value = +value;
  32600. offset = offset >>> 0;
  32601. if (!noAssert) {
  32602. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);
  32603. }
  32604. ieee754.write(buf, value, offset, littleEndian, 52, 8);
  32605. return offset + 8;
  32606. }
  32607. Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
  32608. return writeDouble(this, value, offset, true, noAssert);
  32609. };
  32610. Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
  32611. return writeDouble(this, value, offset, false, noAssert);
  32612. };
  32613. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  32614. Buffer.prototype.copy = function copy(target, targetStart, start, end) {
  32615. if (!start) start = 0;
  32616. if (!end && end !== 0) end = this.length;
  32617. if (targetStart >= target.length) targetStart = target.length;
  32618. if (!targetStart) targetStart = 0;
  32619. if (end > 0 && end < start) end = start;
  32620. // Copy 0 bytes; we're done
  32621. if (end === start) return 0;
  32622. if (target.length === 0 || this.length === 0) return 0;
  32623. // Fatal error conditions
  32624. if (targetStart < 0) {
  32625. throw new RangeError("targetStart out of bounds");
  32626. }
  32627. if (start < 0 || start >= this.length) throw new RangeError("sourceStart out of bounds");
  32628. if (end < 0) throw new RangeError("sourceEnd out of bounds");
  32629. // Are we oob?
  32630. if (end > this.length) end = this.length;
  32631. if (target.length - targetStart < end - start) {
  32632. end = target.length - targetStart + start;
  32633. }
  32634. var len = end - start;
  32635. var i;
  32636. if (this === target && start < targetStart && targetStart < end) {
  32637. // descending copy from end
  32638. for (i = len - 1; i >= 0; --i) {
  32639. target[i + targetStart] = this[i + start];
  32640. }
  32641. } else if (len < 1000) {
  32642. // ascending copy from start
  32643. for (i = 0; i < len; ++i) {
  32644. target[i + targetStart] = this[i + start];
  32645. }
  32646. } else {
  32647. Uint8Array.prototype.set.call(
  32648. target,
  32649. this.subarray(start, start + len),
  32650. targetStart
  32651. );
  32652. }
  32653. return len;
  32654. };
  32655. // Usage:
  32656. // buffer.fill(number[, offset[, end]])
  32657. // buffer.fill(buffer[, offset[, end]])
  32658. // buffer.fill(string[, offset[, end]][, encoding])
  32659. Buffer.prototype.fill = function fill(val, start, end, encoding) {
  32660. // Handle string cases:
  32661. if (typeof val === "string") {
  32662. if (typeof start === "string") {
  32663. encoding = start;
  32664. start = 0;
  32665. end = this.length;
  32666. } else if (typeof end === "string") {
  32667. encoding = end;
  32668. end = this.length;
  32669. }
  32670. if (val.length === 1) {
  32671. var code = val.charCodeAt(0);
  32672. if (code < 256) {
  32673. val = code;
  32674. }
  32675. }
  32676. if (encoding !== undefined && typeof encoding !== "string") {
  32677. throw new TypeError("encoding must be a string");
  32678. }
  32679. if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
  32680. throw new TypeError("Unknown encoding: " + encoding);
  32681. }
  32682. } else if (typeof val === "number") {
  32683. val = val & 255;
  32684. }
  32685. // Invalid ranges are not set to a default, so can range check early.
  32686. if (start < 0 || this.length < start || this.length < end) {
  32687. throw new RangeError("Out of range index");
  32688. }
  32689. if (end <= start) {
  32690. return this;
  32691. }
  32692. start = start >>> 0;
  32693. end = end === undefined ? this.length : end >>> 0;
  32694. if (!val) val = 0;
  32695. var i;
  32696. if (typeof val === "number") {
  32697. for (i = start; i < end; ++i) {
  32698. this[i] = val;
  32699. }
  32700. } else {
  32701. var bytes = Buffer.isBuffer(val) ?
  32702. val :
  32703. new Buffer(val, encoding);
  32704. var len = bytes.length;
  32705. for (i = 0; i < end - start; ++i) {
  32706. this[i + start] = bytes[i % len];
  32707. }
  32708. }
  32709. return this;
  32710. };
  32711. // HELPER FUNCTIONS
  32712. // ================
  32713. var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
  32714. function base64clean(str) {
  32715. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  32716. str = stringtrim(str).replace(INVALID_BASE64_RE, "");
  32717. // Node converts strings with length < 2 to ''
  32718. if (str.length < 2) return "";
  32719. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  32720. while (str.length % 4 !== 0) {
  32721. str = str + "=";
  32722. }
  32723. return str;
  32724. }
  32725. function stringtrim(str) {
  32726. if (str.trim) return str.trim();
  32727. return str.replace(/^\s+|\s+$/g, "");
  32728. }
  32729. function toHex(n) {
  32730. if (n < 16) return "0" + n.toString(16);
  32731. return n.toString(16);
  32732. }
  32733. function utf8ToBytes(string, units) {
  32734. units = units || Infinity;
  32735. var codePoint;
  32736. var length = string.length;
  32737. var leadSurrogate = null;
  32738. var bytes = [];
  32739. for (var i = 0; i < length; ++i) {
  32740. codePoint = string.charCodeAt(i);
  32741. // is surrogate component
  32742. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  32743. // last char was a lead
  32744. if (!leadSurrogate) {
  32745. // no lead yet
  32746. if (codePoint > 0xDBFF) {
  32747. // unexpected trail
  32748. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  32749. continue;
  32750. } else if (i + 1 === length) {
  32751. // unpaired lead
  32752. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  32753. continue;
  32754. }
  32755. // valid lead
  32756. leadSurrogate = codePoint;
  32757. continue;
  32758. }
  32759. // 2 leads in a row
  32760. if (codePoint < 0xDC00) {
  32761. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  32762. leadSurrogate = codePoint;
  32763. continue;
  32764. }
  32765. // valid surrogate pair
  32766. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
  32767. } else if (leadSurrogate) {
  32768. // valid bmp char, but last char was a lead
  32769. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
  32770. }
  32771. leadSurrogate = null;
  32772. // encode utf8
  32773. if (codePoint < 0x80) {
  32774. if ((units -= 1) < 0) break;
  32775. bytes.push(codePoint);
  32776. } else if (codePoint < 0x800) {
  32777. if ((units -= 2) < 0) break;
  32778. bytes.push(
  32779. codePoint >> 0x6 | 0xC0,
  32780. codePoint & 0x3F | 0x80
  32781. );
  32782. } else if (codePoint < 0x10000) {
  32783. if ((units -= 3) < 0) break;
  32784. bytes.push(
  32785. codePoint >> 0xC | 0xE0,
  32786. codePoint >> 0x6 & 0x3F | 0x80,
  32787. codePoint & 0x3F | 0x80
  32788. );
  32789. } else if (codePoint < 0x110000) {
  32790. if ((units -= 4) < 0) break;
  32791. bytes.push(
  32792. codePoint >> 0x12 | 0xF0,
  32793. codePoint >> 0xC & 0x3F | 0x80,
  32794. codePoint >> 0x6 & 0x3F | 0x80,
  32795. codePoint & 0x3F | 0x80
  32796. );
  32797. } else {
  32798. throw new Error("Invalid code point");
  32799. }
  32800. }
  32801. return bytes;
  32802. }
  32803. function asciiToBytes(str) {
  32804. var byteArray = [];
  32805. for (var i = 0; i < str.length; ++i) {
  32806. // Node's code seems to be doing this and not & 0x7F..
  32807. byteArray.push(str.charCodeAt(i) & 0xFF);
  32808. }
  32809. return byteArray;
  32810. }
  32811. function utf16leToBytes(str, units) {
  32812. var c, hi, lo;
  32813. var byteArray = [];
  32814. for (var i = 0; i < str.length; ++i) {
  32815. if ((units -= 2) < 0) break;
  32816. c = str.charCodeAt(i);
  32817. hi = c >> 8;
  32818. lo = c % 256;
  32819. byteArray.push(lo);
  32820. byteArray.push(hi);
  32821. }
  32822. return byteArray;
  32823. }
  32824. function base64ToBytes(str) {
  32825. return base64.toByteArray(base64clean(str));
  32826. }
  32827. function blitBuffer(src, dst, offset, length) {
  32828. for (var i = 0; i < length; ++i) {
  32829. if ((i + offset >= dst.length) || (i >= src.length)) break;
  32830. dst[i + offset] = src[i];
  32831. }
  32832. return i;
  32833. }
  32834. function isnan(val) {
  32835. return val !== val; // eslint-disable-line no-self-compare
  32836. }
  32837. }
  32838. });
  32839. return ___scope___.entry = "index.js";
  32840. });
  32841. FuseBox.pkg("base64-js", {}, function(___scope___){
  32842. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  32843. 'use strict'
  32844. exports.byteLength = byteLength
  32845. exports.toByteArray = toByteArray
  32846. exports.fromByteArray = fromByteArray
  32847. var lookup = []
  32848. var revLookup = []
  32849. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  32850. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  32851. for (var i = 0, len = code.length; i < len; ++i) {
  32852. lookup[i] = code[i]
  32853. revLookup[code.charCodeAt(i)] = i
  32854. }
  32855. revLookup['-'.charCodeAt(0)] = 62
  32856. revLookup['_'.charCodeAt(0)] = 63
  32857. function placeHoldersCount (b64) {
  32858. var len = b64.length
  32859. if (len % 4 > 0) {
  32860. throw new Error('Invalid string. Length must be a multiple of 4')
  32861. }
  32862. // the number of equal signs (place holders)
  32863. // if there are two placeholders, than the two characters before it
  32864. // represent one byte
  32865. // if there is only one, then the three characters before it represent 2 bytes
  32866. // this is just a cheap hack to not do indexOf twice
  32867. return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
  32868. }
  32869. function byteLength (b64) {
  32870. // base64 is 4/3 + up to two characters of the original data
  32871. return b64.length * 3 / 4 - placeHoldersCount(b64)
  32872. }
  32873. function toByteArray (b64) {
  32874. var i, j, l, tmp, placeHolders, arr
  32875. var len = b64.length
  32876. placeHolders = placeHoldersCount(b64)
  32877. arr = new Arr(len * 3 / 4 - placeHolders)
  32878. // if there are placeholders, only get up to the last complete 4 chars
  32879. l = placeHolders > 0 ? len - 4 : len
  32880. var L = 0
  32881. for (i = 0, j = 0; i < l; i += 4, j += 3) {
  32882. tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
  32883. arr[L++] = (tmp >> 16) & 0xFF
  32884. arr[L++] = (tmp >> 8) & 0xFF
  32885. arr[L++] = tmp & 0xFF
  32886. }
  32887. if (placeHolders === 2) {
  32888. tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
  32889. arr[L++] = tmp & 0xFF
  32890. } else if (placeHolders === 1) {
  32891. tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
  32892. arr[L++] = (tmp >> 8) & 0xFF
  32893. arr[L++] = tmp & 0xFF
  32894. }
  32895. return arr
  32896. }
  32897. function tripletToBase64 (num) {
  32898. return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
  32899. }
  32900. function encodeChunk (uint8, start, end) {
  32901. var tmp
  32902. var output = []
  32903. for (var i = start; i < end; i += 3) {
  32904. tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  32905. output.push(tripletToBase64(tmp))
  32906. }
  32907. return output.join('')
  32908. }
  32909. function fromByteArray (uint8) {
  32910. var tmp
  32911. var len = uint8.length
  32912. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  32913. var output = ''
  32914. var parts = []
  32915. var maxChunkLength = 16383 // must be multiple of 3
  32916. // go through the array every three bytes, we'll deal with trailing stuff later
  32917. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  32918. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  32919. }
  32920. // pad the end with zeros, but make sure to not forget the extra bytes
  32921. if (extraBytes === 1) {
  32922. tmp = uint8[len - 1]
  32923. output += lookup[tmp >> 2]
  32924. output += lookup[(tmp << 4) & 0x3F]
  32925. output += '=='
  32926. } else if (extraBytes === 2) {
  32927. tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
  32928. output += lookup[tmp >> 10]
  32929. output += lookup[(tmp >> 4) & 0x3F]
  32930. output += lookup[(tmp << 2) & 0x3F]
  32931. output += '='
  32932. }
  32933. parts.push(output)
  32934. return parts.join('')
  32935. }
  32936. });
  32937. return ___scope___.entry = "index.js";
  32938. });
  32939. FuseBox.pkg("ieee754", {}, function(___scope___){
  32940. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  32941. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  32942. var e, m
  32943. var eLen = nBytes * 8 - mLen - 1
  32944. var eMax = (1 << eLen) - 1
  32945. var eBias = eMax >> 1
  32946. var nBits = -7
  32947. var i = isLE ? (nBytes - 1) : 0
  32948. var d = isLE ? -1 : 1
  32949. var s = buffer[offset + i]
  32950. i += d
  32951. e = s & ((1 << (-nBits)) - 1)
  32952. s >>= (-nBits)
  32953. nBits += eLen
  32954. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  32955. m = e & ((1 << (-nBits)) - 1)
  32956. e >>= (-nBits)
  32957. nBits += mLen
  32958. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  32959. if (e === 0) {
  32960. e = 1 - eBias
  32961. } else if (e === eMax) {
  32962. return m ? NaN : ((s ? -1 : 1) * Infinity)
  32963. } else {
  32964. m = m + Math.pow(2, mLen)
  32965. e = e - eBias
  32966. }
  32967. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  32968. }
  32969. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  32970. var e, m, c
  32971. var eLen = nBytes * 8 - mLen - 1
  32972. var eMax = (1 << eLen) - 1
  32973. var eBias = eMax >> 1
  32974. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  32975. var i = isLE ? 0 : (nBytes - 1)
  32976. var d = isLE ? 1 : -1
  32977. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  32978. value = Math.abs(value)
  32979. if (isNaN(value) || value === Infinity) {
  32980. m = isNaN(value) ? 1 : 0
  32981. e = eMax
  32982. } else {
  32983. e = Math.floor(Math.log(value) / Math.LN2)
  32984. if (value * (c = Math.pow(2, -e)) < 1) {
  32985. e--
  32986. c *= 2
  32987. }
  32988. if (e + eBias >= 1) {
  32989. value += rt / c
  32990. } else {
  32991. value += rt * Math.pow(2, 1 - eBias)
  32992. }
  32993. if (value * c >= 2) {
  32994. e++
  32995. c /= 2
  32996. }
  32997. if (e + eBias >= eMax) {
  32998. m = 0
  32999. e = eMax
  33000. } else if (e + eBias >= 1) {
  33001. m = (value * c - 1) * Math.pow(2, mLen)
  33002. e = e + eBias
  33003. } else {
  33004. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  33005. e = 0
  33006. }
  33007. }
  33008. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  33009. e = (e << mLen) | m
  33010. eLen += mLen
  33011. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  33012. buffer[offset + i - d] |= s * 128
  33013. }
  33014. });
  33015. return ___scope___.entry = "index.js";
  33016. });
  33017. FuseBox.pkg("engine.io-parser", {}, function(___scope___){
  33018. ___scope___.file("lib/browser.js", function(exports, require, module, __filename, __dirname){
  33019. /**
  33020. * Module dependencies.
  33021. */
  33022. var keys = require('./keys');
  33023. var hasBinary = require('has-binary');
  33024. var sliceBuffer = require('arraybuffer.slice');
  33025. var after = require('after');
  33026. var utf8 = require('wtf-8');
  33027. var base64encoder;
  33028. if (global && global.ArrayBuffer) {
  33029. base64encoder = require('base64-arraybuffer');
  33030. }
  33031. /**
  33032. * Check if we are running an android browser. That requires us to use
  33033. * ArrayBuffer with polling transports...
  33034. *
  33035. * http://ghinda.net/jpeg-blob-ajax-android/
  33036. */
  33037. var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);
  33038. /**
  33039. * Check if we are running in PhantomJS.
  33040. * Uploading a Blob with PhantomJS does not work correctly, as reported here:
  33041. * https://github.com/ariya/phantomjs/issues/11395
  33042. * @type boolean
  33043. */
  33044. var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);
  33045. /**
  33046. * When true, avoids using Blobs to encode payloads.
  33047. * @type boolean
  33048. */
  33049. var dontSendBlobs = isAndroid || isPhantomJS;
  33050. /**
  33051. * Current protocol version.
  33052. */
  33053. exports.protocol = 3;
  33054. /**
  33055. * Packet types.
  33056. */
  33057. var packets = exports.packets = {
  33058. open: 0 // non-ws
  33059. , close: 1 // non-ws
  33060. , ping: 2
  33061. , pong: 3
  33062. , message: 4
  33063. , upgrade: 5
  33064. , noop: 6
  33065. };
  33066. var packetslist = keys(packets);
  33067. /**
  33068. * Premade error packet.
  33069. */
  33070. var err = { type: 'error', data: 'parser error' };
  33071. /**
  33072. * Create a blob api even for blob builder when vendor prefixes exist
  33073. */
  33074. var Blob = require('blob');
  33075. /**
  33076. * Encodes a packet.
  33077. *
  33078. * <packet type id> [ <data> ]
  33079. *
  33080. * Example:
  33081. *
  33082. * 5hello world
  33083. * 3
  33084. * 4
  33085. *
  33086. * Binary is encoded in an identical principle
  33087. *
  33088. * @api private
  33089. */
  33090. exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
  33091. if ('function' == typeof supportsBinary) {
  33092. callback = supportsBinary;
  33093. supportsBinary = false;
  33094. }
  33095. if ('function' == typeof utf8encode) {
  33096. callback = utf8encode;
  33097. utf8encode = null;
  33098. }
  33099. var data = (packet.data === undefined)
  33100. ? undefined
  33101. : packet.data.buffer || packet.data;
  33102. if (global.ArrayBuffer && data instanceof ArrayBuffer) {
  33103. return encodeArrayBuffer(packet, supportsBinary, callback);
  33104. } else if (Blob && data instanceof global.Blob) {
  33105. return encodeBlob(packet, supportsBinary, callback);
  33106. }
  33107. // might be an object with { base64: true, data: dataAsBase64String }
  33108. if (data && data.base64) {
  33109. return encodeBase64Object(packet, callback);
  33110. }
  33111. // Sending data as a utf-8 string
  33112. var encoded = packets[packet.type];
  33113. // data fragment is optional
  33114. if (undefined !== packet.data) {
  33115. encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data);
  33116. }
  33117. return callback('' + encoded);
  33118. };
  33119. function encodeBase64Object(packet, callback) {
  33120. // packet data is an object { base64: true, data: dataAsBase64String }
  33121. var message = 'b' + exports.packets[packet.type] + packet.data.data;
  33122. return callback(message);
  33123. }
  33124. /**
  33125. * Encode packet helpers for binary types
  33126. */
  33127. function encodeArrayBuffer(packet, supportsBinary, callback) {
  33128. if (!supportsBinary) {
  33129. return exports.encodeBase64Packet(packet, callback);
  33130. }
  33131. var data = packet.data;
  33132. var contentArray = new Uint8Array(data);
  33133. var resultBuffer = new Uint8Array(1 + data.byteLength);
  33134. resultBuffer[0] = packets[packet.type];
  33135. for (var i = 0; i < contentArray.length; i++) {
  33136. resultBuffer[i+1] = contentArray[i];
  33137. }
  33138. return callback(resultBuffer.buffer);
  33139. }
  33140. function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {
  33141. if (!supportsBinary) {
  33142. return exports.encodeBase64Packet(packet, callback);
  33143. }
  33144. var fr = new FileReader();
  33145. fr.onload = function() {
  33146. packet.data = fr.result;
  33147. exports.encodePacket(packet, supportsBinary, true, callback);
  33148. };
  33149. return fr.readAsArrayBuffer(packet.data);
  33150. }
  33151. function encodeBlob(packet, supportsBinary, callback) {
  33152. if (!supportsBinary) {
  33153. return exports.encodeBase64Packet(packet, callback);
  33154. }
  33155. if (dontSendBlobs) {
  33156. return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);
  33157. }
  33158. var length = new Uint8Array(1);
  33159. length[0] = packets[packet.type];
  33160. var blob = new Blob([length.buffer, packet.data]);
  33161. return callback(blob);
  33162. }
  33163. /**
  33164. * Encodes a packet with binary data in a base64 string
  33165. *
  33166. * @param {Object} packet, has `type` and `data`
  33167. * @return {String} base64 encoded message
  33168. */
  33169. exports.encodeBase64Packet = function(packet, callback) {
  33170. var message = 'b' + exports.packets[packet.type];
  33171. if (Blob && packet.data instanceof global.Blob) {
  33172. var fr = new FileReader();
  33173. fr.onload = function() {
  33174. var b64 = fr.result.split(',')[1];
  33175. callback(message + b64);
  33176. };
  33177. return fr.readAsDataURL(packet.data);
  33178. }
  33179. var b64data;
  33180. try {
  33181. b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));
  33182. } catch (e) {
  33183. // iPhone Safari doesn't let you apply with typed arrays
  33184. var typed = new Uint8Array(packet.data);
  33185. var basic = new Array(typed.length);
  33186. for (var i = 0; i < typed.length; i++) {
  33187. basic[i] = typed[i];
  33188. }
  33189. b64data = String.fromCharCode.apply(null, basic);
  33190. }
  33191. message += global.btoa(b64data);
  33192. return callback(message);
  33193. };
  33194. /**
  33195. * Decodes a packet. Changes format to Blob if requested.
  33196. *
  33197. * @return {Object} with `type` and `data` (if any)
  33198. * @api private
  33199. */
  33200. exports.decodePacket = function (data, binaryType, utf8decode) {
  33201. if (data === undefined) {
  33202. return err;
  33203. }
  33204. // String data
  33205. if (typeof data == 'string') {
  33206. if (data.charAt(0) == 'b') {
  33207. return exports.decodeBase64Packet(data.substr(1), binaryType);
  33208. }
  33209. if (utf8decode) {
  33210. data = tryDecode(data);
  33211. if (data === false) {
  33212. return err;
  33213. }
  33214. }
  33215. var type = data.charAt(0);
  33216. if (Number(type) != type || !packetslist[type]) {
  33217. return err;
  33218. }
  33219. if (data.length > 1) {
  33220. return { type: packetslist[type], data: data.substring(1) };
  33221. } else {
  33222. return { type: packetslist[type] };
  33223. }
  33224. }
  33225. var asArray = new Uint8Array(data);
  33226. var type = asArray[0];
  33227. var rest = sliceBuffer(data, 1);
  33228. if (Blob && binaryType === 'blob') {
  33229. rest = new Blob([rest]);
  33230. }
  33231. return { type: packetslist[type], data: rest };
  33232. };
  33233. function tryDecode(data) {
  33234. try {
  33235. data = utf8.decode(data);
  33236. } catch (e) {
  33237. return false;
  33238. }
  33239. return data;
  33240. }
  33241. /**
  33242. * Decodes a packet encoded in a base64 string
  33243. *
  33244. * @param {String} base64 encoded message
  33245. * @return {Object} with `type` and `data` (if any)
  33246. */
  33247. exports.decodeBase64Packet = function(msg, binaryType) {
  33248. var type = packetslist[msg.charAt(0)];
  33249. if (!base64encoder) {
  33250. return { type: type, data: { base64: true, data: msg.substr(1) } };
  33251. }
  33252. var data = base64encoder.decode(msg.substr(1));
  33253. if (binaryType === 'blob' && Blob) {
  33254. data = new Blob([data]);
  33255. }
  33256. return { type: type, data: data };
  33257. };
  33258. /**
  33259. * Encodes multiple messages (payload).
  33260. *
  33261. * <length>:data
  33262. *
  33263. * Example:
  33264. *
  33265. * 11:hello world2:hi
  33266. *
  33267. * If any contents are binary, they will be encoded as base64 strings. Base64
  33268. * encoded strings are marked with a b before the length specifier
  33269. *
  33270. * @param {Array} packets
  33271. * @api private
  33272. */
  33273. exports.encodePayload = function (packets, supportsBinary, callback) {
  33274. if (typeof supportsBinary == 'function') {
  33275. callback = supportsBinary;
  33276. supportsBinary = null;
  33277. }
  33278. var isBinary = hasBinary(packets);
  33279. if (supportsBinary && isBinary) {
  33280. if (Blob && !dontSendBlobs) {
  33281. return exports.encodePayloadAsBlob(packets, callback);
  33282. }
  33283. return exports.encodePayloadAsArrayBuffer(packets, callback);
  33284. }
  33285. if (!packets.length) {
  33286. return callback('0:');
  33287. }
  33288. function setLengthHeader(message) {
  33289. return message.length + ':' + message;
  33290. }
  33291. function encodeOne(packet, doneCallback) {
  33292. exports.encodePacket(packet, !isBinary ? false : supportsBinary, true, function(message) {
  33293. doneCallback(null, setLengthHeader(message));
  33294. });
  33295. }
  33296. map(packets, encodeOne, function(err, results) {
  33297. return callback(results.join(''));
  33298. });
  33299. };
  33300. /**
  33301. * Async array map using after
  33302. */
  33303. function map(ary, each, done) {
  33304. var result = new Array(ary.length);
  33305. var next = after(ary.length, done);
  33306. var eachWithIndex = function(i, el, cb) {
  33307. each(el, function(error, msg) {
  33308. result[i] = msg;
  33309. cb(error, result);
  33310. });
  33311. };
  33312. for (var i = 0; i < ary.length; i++) {
  33313. eachWithIndex(i, ary[i], next);
  33314. }
  33315. }
  33316. /*
  33317. * Decodes data when a payload is maybe expected. Possible binary contents are
  33318. * decoded from their base64 representation
  33319. *
  33320. * @param {String} data, callback method
  33321. * @api public
  33322. */
  33323. exports.decodePayload = function (data, binaryType, callback) {
  33324. if (typeof data != 'string') {
  33325. return exports.decodePayloadAsBinary(data, binaryType, callback);
  33326. }
  33327. if (typeof binaryType === 'function') {
  33328. callback = binaryType;
  33329. binaryType = null;
  33330. }
  33331. var packet;
  33332. if (data == '') {
  33333. // parser error - ignoring payload
  33334. return callback(err, 0, 1);
  33335. }
  33336. var length = ''
  33337. , n, msg;
  33338. for (var i = 0, l = data.length; i < l; i++) {
  33339. var chr = data.charAt(i);
  33340. if (':' != chr) {
  33341. length += chr;
  33342. } else {
  33343. if ('' == length || (length != (n = Number(length)))) {
  33344. // parser error - ignoring payload
  33345. return callback(err, 0, 1);
  33346. }
  33347. msg = data.substr(i + 1, n);
  33348. if (length != msg.length) {
  33349. // parser error - ignoring payload
  33350. return callback(err, 0, 1);
  33351. }
  33352. if (msg.length) {
  33353. packet = exports.decodePacket(msg, binaryType, true);
  33354. if (err.type == packet.type && err.data == packet.data) {
  33355. // parser error in individual packet - ignoring payload
  33356. return callback(err, 0, 1);
  33357. }
  33358. var ret = callback(packet, i + n, l);
  33359. if (false === ret) return;
  33360. }
  33361. // advance cursor
  33362. i += n;
  33363. length = '';
  33364. }
  33365. }
  33366. if (length != '') {
  33367. // parser error - ignoring payload
  33368. return callback(err, 0, 1);
  33369. }
  33370. };
  33371. /**
  33372. * Encodes multiple messages (payload) as binary.
  33373. *
  33374. * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
  33375. * 255><data>
  33376. *
  33377. * Example:
  33378. * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
  33379. *
  33380. * @param {Array} packets
  33381. * @return {ArrayBuffer} encoded payload
  33382. * @api private
  33383. */
  33384. exports.encodePayloadAsArrayBuffer = function(packets, callback) {
  33385. if (!packets.length) {
  33386. return callback(new ArrayBuffer(0));
  33387. }
  33388. function encodeOne(packet, doneCallback) {
  33389. exports.encodePacket(packet, true, true, function(data) {
  33390. return doneCallback(null, data);
  33391. });
  33392. }
  33393. map(packets, encodeOne, function(err, encodedPackets) {
  33394. var totalLength = encodedPackets.reduce(function(acc, p) {
  33395. var len;
  33396. if (typeof p === 'string'){
  33397. len = p.length;
  33398. } else {
  33399. len = p.byteLength;
  33400. }
  33401. return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2
  33402. }, 0);
  33403. var resultArray = new Uint8Array(totalLength);
  33404. var bufferIndex = 0;
  33405. encodedPackets.forEach(function(p) {
  33406. var isString = typeof p === 'string';
  33407. var ab = p;
  33408. if (isString) {
  33409. var view = new Uint8Array(p.length);
  33410. for (var i = 0; i < p.length; i++) {
  33411. view[i] = p.charCodeAt(i);
  33412. }
  33413. ab = view.buffer;
  33414. }
  33415. if (isString) { // not true binary
  33416. resultArray[bufferIndex++] = 0;
  33417. } else { // true binary
  33418. resultArray[bufferIndex++] = 1;
  33419. }
  33420. var lenStr = ab.byteLength.toString();
  33421. for (var i = 0; i < lenStr.length; i++) {
  33422. resultArray[bufferIndex++] = parseInt(lenStr[i]);
  33423. }
  33424. resultArray[bufferIndex++] = 255;
  33425. var view = new Uint8Array(ab);
  33426. for (var i = 0; i < view.length; i++) {
  33427. resultArray[bufferIndex++] = view[i];
  33428. }
  33429. });
  33430. return callback(resultArray.buffer);
  33431. });
  33432. };
  33433. /**
  33434. * Encode as Blob
  33435. */
  33436. exports.encodePayloadAsBlob = function(packets, callback) {
  33437. function encodeOne(packet, doneCallback) {
  33438. exports.encodePacket(packet, true, true, function(encoded) {
  33439. var binaryIdentifier = new Uint8Array(1);
  33440. binaryIdentifier[0] = 1;
  33441. if (typeof encoded === 'string') {
  33442. var view = new Uint8Array(encoded.length);
  33443. for (var i = 0; i < encoded.length; i++) {
  33444. view[i] = encoded.charCodeAt(i);
  33445. }
  33446. encoded = view.buffer;
  33447. binaryIdentifier[0] = 0;
  33448. }
  33449. var len = (encoded instanceof ArrayBuffer)
  33450. ? encoded.byteLength
  33451. : encoded.size;
  33452. var lenStr = len.toString();
  33453. var lengthAry = new Uint8Array(lenStr.length + 1);
  33454. for (var i = 0; i < lenStr.length; i++) {
  33455. lengthAry[i] = parseInt(lenStr[i]);
  33456. }
  33457. lengthAry[lenStr.length] = 255;
  33458. if (Blob) {
  33459. var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);
  33460. doneCallback(null, blob);
  33461. }
  33462. });
  33463. }
  33464. map(packets, encodeOne, function(err, results) {
  33465. return callback(new Blob(results));
  33466. });
  33467. };
  33468. /*
  33469. * Decodes data when a payload is maybe expected. Strings are decoded by
  33470. * interpreting each byte as a key code for entries marked to start with 0. See
  33471. * description of encodePayloadAsBinary
  33472. *
  33473. * @param {ArrayBuffer} data, callback method
  33474. * @api public
  33475. */
  33476. exports.decodePayloadAsBinary = function (data, binaryType, callback) {
  33477. if (typeof binaryType === 'function') {
  33478. callback = binaryType;
  33479. binaryType = null;
  33480. }
  33481. var bufferTail = data;
  33482. var buffers = [];
  33483. var numberTooLong = false;
  33484. while (bufferTail.byteLength > 0) {
  33485. var tailArray = new Uint8Array(bufferTail);
  33486. var isString = tailArray[0] === 0;
  33487. var msgLength = '';
  33488. for (var i = 1; ; i++) {
  33489. if (tailArray[i] == 255) break;
  33490. if (msgLength.length > 310) {
  33491. numberTooLong = true;
  33492. break;
  33493. }
  33494. msgLength += tailArray[i];
  33495. }
  33496. if(numberTooLong) return callback(err, 0, 1);
  33497. bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);
  33498. msgLength = parseInt(msgLength);
  33499. var msg = sliceBuffer(bufferTail, 0, msgLength);
  33500. if (isString) {
  33501. try {
  33502. msg = String.fromCharCode.apply(null, new Uint8Array(msg));
  33503. } catch (e) {
  33504. // iPhone Safari doesn't let you apply to typed arrays
  33505. var typed = new Uint8Array(msg);
  33506. msg = '';
  33507. for (var i = 0; i < typed.length; i++) {
  33508. msg += String.fromCharCode(typed[i]);
  33509. }
  33510. }
  33511. }
  33512. buffers.push(msg);
  33513. bufferTail = sliceBuffer(bufferTail, msgLength);
  33514. }
  33515. var total = buffers.length;
  33516. buffers.forEach(function(buffer, i) {
  33517. callback(exports.decodePacket(buffer, binaryType, true), i, total);
  33518. });
  33519. };
  33520. });
  33521. ___scope___.file("lib/keys.js", function(exports, require, module, __filename, __dirname){
  33522. /**
  33523. * Gets the keys for an object.
  33524. *
  33525. * @return {Array} keys
  33526. * @api private
  33527. */
  33528. module.exports = Object.keys || function keys (obj){
  33529. var arr = [];
  33530. var has = Object.prototype.hasOwnProperty;
  33531. for (var i in obj) {
  33532. if (has.call(obj, i)) {
  33533. arr.push(i);
  33534. }
  33535. }
  33536. return arr;
  33537. };
  33538. });
  33539. return ___scope___.entry = "lib/browser.js";
  33540. });
  33541. FuseBox.pkg("has-binary", {"isarray":"0.0.1"}, function(___scope___){
  33542. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  33543. /*
  33544. * Module requirements.
  33545. */
  33546. var isArray = require('isarray');
  33547. /**
  33548. * Module exports.
  33549. */
  33550. module.exports = hasBinary;
  33551. /**
  33552. * Checks for binary data.
  33553. *
  33554. * Right now only Buffer and ArrayBuffer are supported..
  33555. *
  33556. * @param {Object} anything
  33557. * @api public
  33558. */
  33559. function hasBinary(data) {
  33560. function _hasBinary(obj) {
  33561. if (!obj) return false;
  33562. if ( (global.Buffer && global.Buffer.isBuffer && global.Buffer.isBuffer(obj)) ||
  33563. (global.ArrayBuffer && obj instanceof ArrayBuffer) ||
  33564. (global.Blob && obj instanceof Blob) ||
  33565. (global.File && obj instanceof File)
  33566. ) {
  33567. return true;
  33568. }
  33569. if (isArray(obj)) {
  33570. for (var i = 0; i < obj.length; i++) {
  33571. if (_hasBinary(obj[i])) {
  33572. return true;
  33573. }
  33574. }
  33575. } else if (obj && 'object' == typeof obj) {
  33576. // see: https://github.com/Automattic/has-binary/pull/4
  33577. if (obj.toJSON && 'function' == typeof obj.toJSON) {
  33578. obj = obj.toJSON();
  33579. }
  33580. for (var key in obj) {
  33581. if (Object.prototype.hasOwnProperty.call(obj, key) && _hasBinary(obj[key])) {
  33582. return true;
  33583. }
  33584. }
  33585. }
  33586. return false;
  33587. }
  33588. return _hasBinary(data);
  33589. }
  33590. });
  33591. return ___scope___.entry = "index.js";
  33592. });
  33593. FuseBox.pkg("arraybuffer.slice", {}, function(___scope___){
  33594. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  33595. /**
  33596. * An abstraction for slicing an arraybuffer even when
  33597. * ArrayBuffer.prototype.slice is not supported
  33598. *
  33599. * @api public
  33600. */
  33601. module.exports = function(arraybuffer, start, end) {
  33602. var bytes = arraybuffer.byteLength;
  33603. start = start || 0;
  33604. end = end || bytes;
  33605. if (arraybuffer.slice) { return arraybuffer.slice(start, end); }
  33606. if (start < 0) { start += bytes; }
  33607. if (end < 0) { end += bytes; }
  33608. if (end > bytes) { end = bytes; }
  33609. if (start >= bytes || start >= end || bytes === 0) {
  33610. return new ArrayBuffer(0);
  33611. }
  33612. var abv = new Uint8Array(arraybuffer);
  33613. var result = new Uint8Array(end - start);
  33614. for (var i = start, ii = 0; i < end; i++, ii++) {
  33615. result[ii] = abv[i];
  33616. }
  33617. return result.buffer;
  33618. };
  33619. });
  33620. return ___scope___.entry = "index.js";
  33621. });
  33622. FuseBox.pkg("after", {}, function(___scope___){
  33623. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  33624. module.exports = after
  33625. function after(count, callback, err_cb) {
  33626. var bail = false
  33627. err_cb = err_cb || noop
  33628. proxy.count = count
  33629. return (count === 0) ? callback() : proxy
  33630. function proxy(err, result) {
  33631. if (proxy.count <= 0) {
  33632. throw new Error('after called too many times')
  33633. }
  33634. --proxy.count
  33635. // after first error, rest are passed to err_cb
  33636. if (err) {
  33637. bail = true
  33638. callback(err)
  33639. // future error callbacks will go to error handler
  33640. callback = err_cb
  33641. } else if (proxy.count === 0 && !bail) {
  33642. callback(null, result)
  33643. }
  33644. }
  33645. }
  33646. function noop() {}
  33647. });
  33648. return ___scope___.entry = "index.js";
  33649. });
  33650. FuseBox.pkg("wtf-8", {}, function(___scope___){
  33651. ___scope___.file("wtf-8.js", function(exports, require, module, __filename, __dirname){
  33652. /*! https://mths.be/wtf8 v1.0.0 by @mathias */
  33653. ;(function(root) {
  33654. // Detect free variables `exports`
  33655. var freeExports = typeof exports == 'object' && exports;
  33656. // Detect free variable `module`
  33657. var freeModule = typeof module == 'object' && module &&
  33658. module.exports == freeExports && module;
  33659. // Detect free variable `global`, from Node.js or Browserified code,
  33660. // and use it as `root`
  33661. var freeGlobal = typeof global == 'object' && global;
  33662. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  33663. root = freeGlobal;
  33664. }
  33665. /*--------------------------------------------------------------------------*/
  33666. var stringFromCharCode = String.fromCharCode;
  33667. // Taken from https://mths.be/punycode
  33668. function ucs2decode(string) {
  33669. var output = [];
  33670. var counter = 0;
  33671. var length = string.length;
  33672. var value;
  33673. var extra;
  33674. while (counter < length) {
  33675. value = string.charCodeAt(counter++);
  33676. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  33677. // high surrogate, and there is a next character
  33678. extra = string.charCodeAt(counter++);
  33679. if ((extra & 0xFC00) == 0xDC00) { // low surrogate
  33680. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  33681. } else {
  33682. // unmatched surrogate; only append this code unit, in case the next
  33683. // code unit is the high surrogate of a surrogate pair
  33684. output.push(value);
  33685. counter--;
  33686. }
  33687. } else {
  33688. output.push(value);
  33689. }
  33690. }
  33691. return output;
  33692. }
  33693. // Taken from https://mths.be/punycode
  33694. function ucs2encode(array) {
  33695. var length = array.length;
  33696. var index = -1;
  33697. var value;
  33698. var output = '';
  33699. while (++index < length) {
  33700. value = array[index];
  33701. if (value > 0xFFFF) {
  33702. value -= 0x10000;
  33703. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  33704. value = 0xDC00 | value & 0x3FF;
  33705. }
  33706. output += stringFromCharCode(value);
  33707. }
  33708. return output;
  33709. }
  33710. /*--------------------------------------------------------------------------*/
  33711. function createByte(codePoint, shift) {
  33712. return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
  33713. }
  33714. function encodeCodePoint(codePoint) {
  33715. if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
  33716. return stringFromCharCode(codePoint);
  33717. }
  33718. var symbol = '';
  33719. if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
  33720. symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
  33721. }
  33722. else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
  33723. symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
  33724. symbol += createByte(codePoint, 6);
  33725. }
  33726. else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
  33727. symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
  33728. symbol += createByte(codePoint, 12);
  33729. symbol += createByte(codePoint, 6);
  33730. }
  33731. symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
  33732. return symbol;
  33733. }
  33734. function wtf8encode(string) {
  33735. var codePoints = ucs2decode(string);
  33736. var length = codePoints.length;
  33737. var index = -1;
  33738. var codePoint;
  33739. var byteString = '';
  33740. while (++index < length) {
  33741. codePoint = codePoints[index];
  33742. byteString += encodeCodePoint(codePoint);
  33743. }
  33744. return byteString;
  33745. }
  33746. /*--------------------------------------------------------------------------*/
  33747. function readContinuationByte() {
  33748. if (byteIndex >= byteCount) {
  33749. throw Error('Invalid byte index');
  33750. }
  33751. var continuationByte = byteArray[byteIndex] & 0xFF;
  33752. byteIndex++;
  33753. if ((continuationByte & 0xC0) == 0x80) {
  33754. return continuationByte & 0x3F;
  33755. }
  33756. // If we end up here, it’s not a continuation byte.
  33757. throw Error('Invalid continuation byte');
  33758. }
  33759. function decodeSymbol() {
  33760. var byte1;
  33761. var byte2;
  33762. var byte3;
  33763. var byte4;
  33764. var codePoint;
  33765. if (byteIndex > byteCount) {
  33766. throw Error('Invalid byte index');
  33767. }
  33768. if (byteIndex == byteCount) {
  33769. return false;
  33770. }
  33771. // Read the first byte.
  33772. byte1 = byteArray[byteIndex] & 0xFF;
  33773. byteIndex++;
  33774. // 1-byte sequence (no continuation bytes)
  33775. if ((byte1 & 0x80) == 0) {
  33776. return byte1;
  33777. }
  33778. // 2-byte sequence
  33779. if ((byte1 & 0xE0) == 0xC0) {
  33780. var byte2 = readContinuationByte();
  33781. codePoint = ((byte1 & 0x1F) << 6) | byte2;
  33782. if (codePoint >= 0x80) {
  33783. return codePoint;
  33784. } else {
  33785. throw Error('Invalid continuation byte');
  33786. }
  33787. }
  33788. // 3-byte sequence (may include unpaired surrogates)
  33789. if ((byte1 & 0xF0) == 0xE0) {
  33790. byte2 = readContinuationByte();
  33791. byte3 = readContinuationByte();
  33792. codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
  33793. if (codePoint >= 0x0800) {
  33794. return codePoint;
  33795. } else {
  33796. throw Error('Invalid continuation byte');
  33797. }
  33798. }
  33799. // 4-byte sequence
  33800. if ((byte1 & 0xF8) == 0xF0) {
  33801. byte2 = readContinuationByte();
  33802. byte3 = readContinuationByte();
  33803. byte4 = readContinuationByte();
  33804. codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |
  33805. (byte3 << 0x06) | byte4;
  33806. if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
  33807. return codePoint;
  33808. }
  33809. }
  33810. throw Error('Invalid WTF-8 detected');
  33811. }
  33812. var byteArray;
  33813. var byteCount;
  33814. var byteIndex;
  33815. function wtf8decode(byteString) {
  33816. byteArray = ucs2decode(byteString);
  33817. byteCount = byteArray.length;
  33818. byteIndex = 0;
  33819. var codePoints = [];
  33820. var tmp;
  33821. while ((tmp = decodeSymbol()) !== false) {
  33822. codePoints.push(tmp);
  33823. }
  33824. return ucs2encode(codePoints);
  33825. }
  33826. /*--------------------------------------------------------------------------*/
  33827. var wtf8 = {
  33828. 'version': '1.0.0',
  33829. 'encode': wtf8encode,
  33830. 'decode': wtf8decode
  33831. };
  33832. // Some AMD build optimizers, like r.js, check for specific condition patterns
  33833. // like the following:
  33834. if (
  33835. typeof define == 'function' &&
  33836. typeof define.amd == 'object' &&
  33837. define.amd
  33838. ) {
  33839. define(function() {
  33840. return wtf8;
  33841. });
  33842. } else if (freeExports && !freeExports.nodeType) {
  33843. if (freeModule) { // in Node.js or RingoJS v0.8.0+
  33844. freeModule.exports = wtf8;
  33845. } else { // in Narwhal or RingoJS v0.7.0-
  33846. var object = {};
  33847. var hasOwnProperty = object.hasOwnProperty;
  33848. for (var key in wtf8) {
  33849. hasOwnProperty.call(wtf8, key) && (freeExports[key] = wtf8[key]);
  33850. }
  33851. }
  33852. } else { // in Rhino or a web browser
  33853. root.wtf8 = wtf8;
  33854. }
  33855. }(this));
  33856. });
  33857. return ___scope___.entry = "wtf-8.js";
  33858. });
  33859. FuseBox.pkg("base64-arraybuffer", {}, function(___scope___){
  33860. ___scope___.file("lib/base64-arraybuffer.js", function(exports, require, module, __filename, __dirname){
  33861. /*
  33862. * base64-arraybuffer
  33863. * https://github.com/niklasvh/base64-arraybuffer
  33864. *
  33865. * Copyright (c) 2012 Niklas von Hertzen
  33866. * Licensed under the MIT license.
  33867. */
  33868. (function(){
  33869. "use strict";
  33870. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  33871. // Use a lookup table to find the index.
  33872. var lookup = new Uint8Array(256);
  33873. for (var i = 0; i < chars.length; i++) {
  33874. lookup[chars.charCodeAt(i)] = i;
  33875. }
  33876. exports.encode = function(arraybuffer) {
  33877. var bytes = new Uint8Array(arraybuffer),
  33878. i, len = bytes.length, base64 = "";
  33879. for (i = 0; i < len; i+=3) {
  33880. base64 += chars[bytes[i] >> 2];
  33881. base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
  33882. base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
  33883. base64 += chars[bytes[i + 2] & 63];
  33884. }
  33885. if ((len % 3) === 2) {
  33886. base64 = base64.substring(0, base64.length - 1) + "=";
  33887. } else if (len % 3 === 1) {
  33888. base64 = base64.substring(0, base64.length - 2) + "==";
  33889. }
  33890. return base64;
  33891. };
  33892. exports.decode = function(base64) {
  33893. var bufferLength = base64.length * 0.75,
  33894. len = base64.length, i, p = 0,
  33895. encoded1, encoded2, encoded3, encoded4;
  33896. if (base64[base64.length - 1] === "=") {
  33897. bufferLength--;
  33898. if (base64[base64.length - 2] === "=") {
  33899. bufferLength--;
  33900. }
  33901. }
  33902. var arraybuffer = new ArrayBuffer(bufferLength),
  33903. bytes = new Uint8Array(arraybuffer);
  33904. for (i = 0; i < len; i+=4) {
  33905. encoded1 = lookup[base64.charCodeAt(i)];
  33906. encoded2 = lookup[base64.charCodeAt(i+1)];
  33907. encoded3 = lookup[base64.charCodeAt(i+2)];
  33908. encoded4 = lookup[base64.charCodeAt(i+3)];
  33909. bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
  33910. bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
  33911. bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
  33912. }
  33913. return arraybuffer;
  33914. };
  33915. })();
  33916. });
  33917. return ___scope___.entry = "lib/base64-arraybuffer.js";
  33918. });
  33919. FuseBox.pkg("blob", {}, function(___scope___){
  33920. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  33921. /**
  33922. * Create a blob builder even when vendor prefixes exist
  33923. */
  33924. var BlobBuilder = global.BlobBuilder
  33925. || global.WebKitBlobBuilder
  33926. || global.MSBlobBuilder
  33927. || global.MozBlobBuilder;
  33928. /**
  33929. * Check if Blob constructor is supported
  33930. */
  33931. var blobSupported = (function() {
  33932. try {
  33933. var a = new Blob(['hi']);
  33934. return a.size === 2;
  33935. } catch(e) {
  33936. return false;
  33937. }
  33938. })();
  33939. /**
  33940. * Check if Blob constructor supports ArrayBufferViews
  33941. * Fails in Safari 6, so we need to map to ArrayBuffers there.
  33942. */
  33943. var blobSupportsArrayBufferView = blobSupported && (function() {
  33944. try {
  33945. var b = new Blob([new Uint8Array([1,2])]);
  33946. return b.size === 2;
  33947. } catch(e) {
  33948. return false;
  33949. }
  33950. })();
  33951. /**
  33952. * Check if BlobBuilder is supported
  33953. */
  33954. var blobBuilderSupported = BlobBuilder
  33955. && BlobBuilder.prototype.append
  33956. && BlobBuilder.prototype.getBlob;
  33957. /**
  33958. * Helper function that maps ArrayBufferViews to ArrayBuffers
  33959. * Used by BlobBuilder constructor and old browsers that didn't
  33960. * support it in the Blob constructor.
  33961. */
  33962. function mapArrayBufferViews(ary) {
  33963. for (var i = 0; i < ary.length; i++) {
  33964. var chunk = ary[i];
  33965. if (chunk.buffer instanceof ArrayBuffer) {
  33966. var buf = chunk.buffer;
  33967. // if this is a subarray, make a copy so we only
  33968. // include the subarray region from the underlying buffer
  33969. if (chunk.byteLength !== buf.byteLength) {
  33970. var copy = new Uint8Array(chunk.byteLength);
  33971. copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));
  33972. buf = copy.buffer;
  33973. }
  33974. ary[i] = buf;
  33975. }
  33976. }
  33977. }
  33978. function BlobBuilderConstructor(ary, options) {
  33979. options = options || {};
  33980. var bb = new BlobBuilder();
  33981. mapArrayBufferViews(ary);
  33982. for (var i = 0; i < ary.length; i++) {
  33983. bb.append(ary[i]);
  33984. }
  33985. return (options.type) ? bb.getBlob(options.type) : bb.getBlob();
  33986. };
  33987. function BlobConstructor(ary, options) {
  33988. mapArrayBufferViews(ary);
  33989. return new Blob(ary, options || {});
  33990. };
  33991. module.exports = (function() {
  33992. if (blobSupported) {
  33993. return blobSupportsArrayBufferView ? global.Blob : BlobConstructor;
  33994. } else if (blobBuilderSupported) {
  33995. return BlobBuilderConstructor;
  33996. } else {
  33997. return undefined;
  33998. }
  33999. })();
  34000. });
  34001. return ___scope___.entry = "index.js";
  34002. });
  34003. FuseBox.pkg("component-emitter@1.2.1", {}, function(___scope___){
  34004. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  34005. /**
  34006. * Expose `Emitter`.
  34007. */
  34008. if (typeof module !== 'undefined') {
  34009. module.exports = Emitter;
  34010. }
  34011. /**
  34012. * Initialize a new `Emitter`.
  34013. *
  34014. * @api public
  34015. */
  34016. function Emitter(obj) {
  34017. if (obj) return mixin(obj);
  34018. };
  34019. /**
  34020. * Mixin the emitter properties.
  34021. *
  34022. * @param {Object} obj
  34023. * @return {Object}
  34024. * @api private
  34025. */
  34026. function mixin(obj) {
  34027. for (var key in Emitter.prototype) {
  34028. obj[key] = Emitter.prototype[key];
  34029. }
  34030. return obj;
  34031. }
  34032. /**
  34033. * Listen on the given `event` with `fn`.
  34034. *
  34035. * @param {String} event
  34036. * @param {Function} fn
  34037. * @return {Emitter}
  34038. * @api public
  34039. */
  34040. Emitter.prototype.on =
  34041. Emitter.prototype.addEventListener = function(event, fn){
  34042. this._callbacks = this._callbacks || {};
  34043. (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
  34044. .push(fn);
  34045. return this;
  34046. };
  34047. /**
  34048. * Adds an `event` listener that will be invoked a single
  34049. * time then automatically removed.
  34050. *
  34051. * @param {String} event
  34052. * @param {Function} fn
  34053. * @return {Emitter}
  34054. * @api public
  34055. */
  34056. Emitter.prototype.once = function(event, fn){
  34057. function on() {
  34058. this.off(event, on);
  34059. fn.apply(this, arguments);
  34060. }
  34061. on.fn = fn;
  34062. this.on(event, on);
  34063. return this;
  34064. };
  34065. /**
  34066. * Remove the given callback for `event` or all
  34067. * registered callbacks.
  34068. *
  34069. * @param {String} event
  34070. * @param {Function} fn
  34071. * @return {Emitter}
  34072. * @api public
  34073. */
  34074. Emitter.prototype.off =
  34075. Emitter.prototype.removeListener =
  34076. Emitter.prototype.removeAllListeners =
  34077. Emitter.prototype.removeEventListener = function(event, fn){
  34078. this._callbacks = this._callbacks || {};
  34079. // all
  34080. if (0 == arguments.length) {
  34081. this._callbacks = {};
  34082. return this;
  34083. }
  34084. // specific event
  34085. var callbacks = this._callbacks['$' + event];
  34086. if (!callbacks) return this;
  34087. // remove all handlers
  34088. if (1 == arguments.length) {
  34089. delete this._callbacks['$' + event];
  34090. return this;
  34091. }
  34092. // remove specific handler
  34093. var cb;
  34094. for (var i = 0; i < callbacks.length; i++) {
  34095. cb = callbacks[i];
  34096. if (cb === fn || cb.fn === fn) {
  34097. callbacks.splice(i, 1);
  34098. break;
  34099. }
  34100. }
  34101. return this;
  34102. };
  34103. /**
  34104. * Emit `event` with the given args.
  34105. *
  34106. * @param {String} event
  34107. * @param {Mixed} ...
  34108. * @return {Emitter}
  34109. */
  34110. Emitter.prototype.emit = function(event){
  34111. this._callbacks = this._callbacks || {};
  34112. var args = [].slice.call(arguments, 1)
  34113. , callbacks = this._callbacks['$' + event];
  34114. if (callbacks) {
  34115. callbacks = callbacks.slice(0);
  34116. for (var i = 0, len = callbacks.length; i < len; ++i) {
  34117. callbacks[i].apply(this, args);
  34118. }
  34119. }
  34120. return this;
  34121. };
  34122. /**
  34123. * Return array of callbacks for `event`.
  34124. *
  34125. * @param {String} event
  34126. * @return {Array}
  34127. * @api public
  34128. */
  34129. Emitter.prototype.listeners = function(event){
  34130. this._callbacks = this._callbacks || {};
  34131. return this._callbacks['$' + event] || [];
  34132. };
  34133. /**
  34134. * Check if this emitter has `event` handlers.
  34135. *
  34136. * @param {String} event
  34137. * @return {Boolean}
  34138. * @api public
  34139. */
  34140. Emitter.prototype.hasListeners = function(event){
  34141. return !! this.listeners(event).length;
  34142. };
  34143. });
  34144. return ___scope___.entry = "index.js";
  34145. });
  34146. FuseBox.pkg("parseqs", {}, function(___scope___){
  34147. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  34148. /**
  34149. * Compiles a querystring
  34150. * Returns string representation of the object
  34151. *
  34152. * @param {Object}
  34153. * @api private
  34154. */
  34155. exports.encode = function (obj) {
  34156. var str = '';
  34157. for (var i in obj) {
  34158. if (obj.hasOwnProperty(i)) {
  34159. if (str.length) str += '&';
  34160. str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);
  34161. }
  34162. }
  34163. return str;
  34164. };
  34165. /**
  34166. * Parses a simple querystring into an object
  34167. *
  34168. * @param {String} qs
  34169. * @api private
  34170. */
  34171. exports.decode = function(qs){
  34172. var qry = {};
  34173. var pairs = qs.split('&');
  34174. for (var i = 0, l = pairs.length; i < l; i++) {
  34175. var pair = pairs[i].split('=');
  34176. qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
  34177. }
  34178. return qry;
  34179. };
  34180. });
  34181. return ___scope___.entry = "index.js";
  34182. });
  34183. FuseBox.pkg("component-inherit", {}, function(___scope___){
  34184. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  34185. module.exports = function(a, b){
  34186. var fn = function(){};
  34187. fn.prototype = b.prototype;
  34188. a.prototype = new fn;
  34189. a.prototype.constructor = a;
  34190. };
  34191. });
  34192. return ___scope___.entry = "index.js";
  34193. });
  34194. FuseBox.pkg("yeast", {}, function(___scope___){
  34195. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  34196. 'use strict';
  34197. var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')
  34198. , length = 64
  34199. , map = {}
  34200. , seed = 0
  34201. , i = 0
  34202. , prev;
  34203. /**
  34204. * Return a string representing the specified number.
  34205. *
  34206. * @param {Number} num The number to convert.
  34207. * @returns {String} The string representation of the number.
  34208. * @api public
  34209. */
  34210. function encode(num) {
  34211. var encoded = '';
  34212. do {
  34213. encoded = alphabet[num % length] + encoded;
  34214. num = Math.floor(num / length);
  34215. } while (num > 0);
  34216. return encoded;
  34217. }
  34218. /**
  34219. * Return the integer value specified by the given string.
  34220. *
  34221. * @param {String} str The string to convert.
  34222. * @returns {Number} The integer value represented by the string.
  34223. * @api public
  34224. */
  34225. function decode(str) {
  34226. var decoded = 0;
  34227. for (i = 0; i < str.length; i++) {
  34228. decoded = decoded * length + map[str.charAt(i)];
  34229. }
  34230. return decoded;
  34231. }
  34232. /**
  34233. * Yeast: A tiny growing id generator.
  34234. *
  34235. * @returns {String} A unique id.
  34236. * @api public
  34237. */
  34238. function yeast() {
  34239. var now = encode(+new Date());
  34240. if (now !== prev) return seed = 0, prev = now;
  34241. return now +'.'+ encode(seed++);
  34242. }
  34243. //
  34244. // Map each character to its index.
  34245. //
  34246. for (; i < length; i++) map[alphabet[i]] = i;
  34247. //
  34248. // Expose the `yeast`, `encode` and `decode` functions.
  34249. //
  34250. yeast.encode = encode;
  34251. yeast.decode = decode;
  34252. module.exports = yeast;
  34253. });
  34254. return ___scope___.entry = "index.js";
  34255. });
  34256. FuseBox.pkg("ws", {}, function(___scope___){
  34257. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  34258. 'use strict';
  34259. /*!
  34260. * ws: a node.js websocket client
  34261. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  34262. * MIT Licensed
  34263. */
  34264. var WS = module.exports = require('./lib/WebSocket');
  34265. WS.Server = require('./lib/WebSocketServer');
  34266. WS.Sender = require('./lib/Sender');
  34267. WS.Receiver = require('./lib/Receiver');
  34268. /**
  34269. * Create a new WebSocket server.
  34270. *
  34271. * @param {Object} options Server options
  34272. * @param {Function} fn Optional connection listener.
  34273. * @returns {WS.Server}
  34274. * @api public
  34275. */
  34276. WS.createServer = function createServer(options, fn) {
  34277. var server = new WS.Server(options);
  34278. if (typeof fn === 'function') {
  34279. server.on('connection', fn);
  34280. }
  34281. return server;
  34282. };
  34283. /**
  34284. * Create a new WebSocket connection.
  34285. *
  34286. * @param {String} address The URL/address we need to connect to.
  34287. * @param {Function} fn Open listener.
  34288. * @returns {WS}
  34289. * @api public
  34290. */
  34291. WS.connect = WS.createConnection = function connect(address, fn) {
  34292. var client = new WS(address);
  34293. if (typeof fn === 'function') {
  34294. client.on('open', fn);
  34295. }
  34296. return client;
  34297. };
  34298. });
  34299. ___scope___.file("lib/WebSocket.js", function(exports, require, module, __filename, __dirname){
  34300. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  34301. /* fuse:injection: */ var process = require("process");
  34302. 'use strict';
  34303. /*!
  34304. * ws: a node.js websocket client
  34305. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  34306. * MIT Licensed
  34307. */
  34308. var url = require('url')
  34309. , util = require('util')
  34310. , http = require('http')
  34311. , https = require('https')
  34312. , crypto = require('crypto')
  34313. , stream = require('stream')
  34314. , Ultron = require('ultron')
  34315. , Options = require('options')
  34316. , Sender = require('./Sender')
  34317. , Receiver = require('./Receiver')
  34318. , SenderHixie = require('./Sender.hixie')
  34319. , ReceiverHixie = require('./Receiver.hixie')
  34320. , Extensions = require('./Extensions')
  34321. , PerMessageDeflate = require('./PerMessageDeflate')
  34322. , EventEmitter = require('events').EventEmitter;
  34323. /**
  34324. * Constants
  34325. */
  34326. // Default protocol version
  34327. var protocolVersion = 13;
  34328. // Close timeout
  34329. var closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly
  34330. /**
  34331. * WebSocket implementation
  34332. *
  34333. * @constructor
  34334. * @param {String} address Connection address.
  34335. * @param {String|Array} protocols WebSocket protocols.
  34336. * @param {Object} options Additional connection options.
  34337. * @api public
  34338. */
  34339. function WebSocket(address, protocols, options) {
  34340. if (this instanceof WebSocket === false) {
  34341. return new WebSocket(address, protocols, options);
  34342. }
  34343. EventEmitter.call(this);
  34344. if (protocols && !Array.isArray(protocols) && 'object' === typeof protocols) {
  34345. // accept the "options" Object as the 2nd argument
  34346. options = protocols;
  34347. protocols = null;
  34348. }
  34349. if ('string' === typeof protocols) {
  34350. protocols = [ protocols ];
  34351. }
  34352. if (!Array.isArray(protocols)) {
  34353. protocols = [];
  34354. }
  34355. this._socket = null;
  34356. this._ultron = null;
  34357. this._closeReceived = false;
  34358. this.bytesReceived = 0;
  34359. this.readyState = null;
  34360. this.supports = {};
  34361. this.extensions = {};
  34362. this._binaryType = 'nodebuffer';
  34363. if (Array.isArray(address)) {
  34364. initAsServerClient.apply(this, address.concat(options));
  34365. } else {
  34366. initAsClient.apply(this, [address, protocols, options]);
  34367. }
  34368. }
  34369. /**
  34370. * Inherits from EventEmitter.
  34371. */
  34372. util.inherits(WebSocket, EventEmitter);
  34373. /**
  34374. * Ready States
  34375. */
  34376. ["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function each(state, index) {
  34377. WebSocket.prototype[state] = WebSocket[state] = index;
  34378. });
  34379. /**
  34380. * Gracefully closes the connection, after sending a description message to the server
  34381. *
  34382. * @param {Object} data to be sent to the server
  34383. * @api public
  34384. */
  34385. WebSocket.prototype.close = function close(code, data) {
  34386. if (this.readyState === WebSocket.CLOSED) return;
  34387. if (this.readyState === WebSocket.CONNECTING) {
  34388. this.readyState = WebSocket.CLOSED;
  34389. return;
  34390. }
  34391. if (this.readyState === WebSocket.CLOSING) {
  34392. if (this._closeReceived && this._isServer) {
  34393. this.terminate();
  34394. }
  34395. return;
  34396. }
  34397. var self = this;
  34398. try {
  34399. this.readyState = WebSocket.CLOSING;
  34400. this._closeCode = code;
  34401. this._closeMessage = data;
  34402. var mask = !this._isServer;
  34403. this._sender.close(code, data, mask, function(err) {
  34404. if (err) self.emit('error', err);
  34405. if (self._closeReceived && self._isServer) {
  34406. self.terminate();
  34407. } else {
  34408. // ensure that the connection is cleaned up even when no response of closing handshake.
  34409. clearTimeout(self._closeTimer);
  34410. self._closeTimer = setTimeout(cleanupWebsocketResources.bind(self, true), closeTimeout);
  34411. }
  34412. });
  34413. } catch (e) {
  34414. this.emit('error', e);
  34415. }
  34416. };
  34417. /**
  34418. * Pause the client stream
  34419. *
  34420. * @api public
  34421. */
  34422. WebSocket.prototype.pause = function pauser() {
  34423. if (this.readyState !== WebSocket.OPEN) throw new Error('not opened');
  34424. return this._socket.pause();
  34425. };
  34426. /**
  34427. * Sends a ping
  34428. *
  34429. * @param {Object} data to be sent to the server
  34430. * @param {Object} Members - mask: boolean, binary: boolean
  34431. * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open
  34432. * @api public
  34433. */
  34434. WebSocket.prototype.ping = function ping(data, options, dontFailWhenClosed) {
  34435. if (this.readyState !== WebSocket.OPEN) {
  34436. if (dontFailWhenClosed === true) return;
  34437. throw new Error('not opened');
  34438. }
  34439. options = options || {};
  34440. if (typeof options.mask === 'undefined') options.mask = !this._isServer;
  34441. this._sender.ping(data, options);
  34442. };
  34443. /**
  34444. * Sends a pong
  34445. *
  34446. * @param {Object} data to be sent to the server
  34447. * @param {Object} Members - mask: boolean, binary: boolean
  34448. * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open
  34449. * @api public
  34450. */
  34451. WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) {
  34452. if (this.readyState !== WebSocket.OPEN) {
  34453. if (dontFailWhenClosed === true) return;
  34454. throw new Error('not opened');
  34455. }
  34456. options = options || {};
  34457. if (typeof options.mask === 'undefined') options.mask = !this._isServer;
  34458. this._sender.pong(data, options);
  34459. };
  34460. /**
  34461. * Resume the client stream
  34462. *
  34463. * @api public
  34464. */
  34465. WebSocket.prototype.resume = function resume() {
  34466. if (this.readyState !== WebSocket.OPEN) throw new Error('not opened');
  34467. return this._socket.resume();
  34468. };
  34469. /**
  34470. * Sends a piece of data
  34471. *
  34472. * @param {Object} data to be sent to the server
  34473. * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean
  34474. * @param {function} Optional callback which is executed after the send completes
  34475. * @api public
  34476. */
  34477. WebSocket.prototype.send = function send(data, options, cb) {
  34478. if (typeof options === 'function') {
  34479. cb = options;
  34480. options = {};
  34481. }
  34482. if (this.readyState !== WebSocket.OPEN) {
  34483. if (typeof cb === 'function') cb(new Error('not opened'));
  34484. else throw new Error('not opened');
  34485. return;
  34486. }
  34487. if (!data) data = '';
  34488. if (this._queue) {
  34489. var self = this;
  34490. this._queue.push(function() { self.send(data, options, cb); });
  34491. return;
  34492. }
  34493. options = options || {};
  34494. options.fin = true;
  34495. if (typeof options.binary === 'undefined') {
  34496. options.binary = (data instanceof ArrayBuffer || data instanceof Buffer ||
  34497. data instanceof Uint8Array ||
  34498. data instanceof Uint16Array ||
  34499. data instanceof Uint32Array ||
  34500. data instanceof Int8Array ||
  34501. data instanceof Int16Array ||
  34502. data instanceof Int32Array ||
  34503. data instanceof Float32Array ||
  34504. data instanceof Float64Array);
  34505. }
  34506. if (typeof options.mask === 'undefined') options.mask = !this._isServer;
  34507. if (typeof options.compress === 'undefined') options.compress = true;
  34508. if (!this.extensions[PerMessageDeflate.extensionName]) {
  34509. options.compress = false;
  34510. }
  34511. var readable = typeof stream.Readable === 'function'
  34512. ? stream.Readable
  34513. : stream.Stream;
  34514. if (data instanceof readable) {
  34515. startQueue(this);
  34516. var self = this;
  34517. sendStream(this, data, options, function send(error) {
  34518. process.nextTick(function tock() {
  34519. executeQueueSends(self);
  34520. });
  34521. if (typeof cb === 'function') cb(error);
  34522. });
  34523. } else {
  34524. this._sender.send(data, options, cb);
  34525. }
  34526. };
  34527. /**
  34528. * Streams data through calls to a user supplied function
  34529. *
  34530. * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean
  34531. * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'.
  34532. * @api public
  34533. */
  34534. WebSocket.prototype.stream = function stream(options, cb) {
  34535. if (typeof options === 'function') {
  34536. cb = options;
  34537. options = {};
  34538. }
  34539. var self = this;
  34540. if (typeof cb !== 'function') throw new Error('callback must be provided');
  34541. if (this.readyState !== WebSocket.OPEN) {
  34542. if (typeof cb === 'function') cb(new Error('not opened'));
  34543. else throw new Error('not opened');
  34544. return;
  34545. }
  34546. if (this._queue) {
  34547. this._queue.push(function () { self.stream(options, cb); });
  34548. return;
  34549. }
  34550. options = options || {};
  34551. if (typeof options.mask === 'undefined') options.mask = !this._isServer;
  34552. if (typeof options.compress === 'undefined') options.compress = true;
  34553. if (!this.extensions[PerMessageDeflate.extensionName]) {
  34554. options.compress = false;
  34555. }
  34556. startQueue(this);
  34557. function send(data, final) {
  34558. try {
  34559. if (self.readyState !== WebSocket.OPEN) throw new Error('not opened');
  34560. options.fin = final === true;
  34561. self._sender.send(data, options);
  34562. if (!final) process.nextTick(cb.bind(null, null, send));
  34563. else executeQueueSends(self);
  34564. } catch (e) {
  34565. if (typeof cb === 'function') cb(e);
  34566. else {
  34567. delete self._queue;
  34568. self.emit('error', e);
  34569. }
  34570. }
  34571. }
  34572. process.nextTick(cb.bind(null, null, send));
  34573. };
  34574. /**
  34575. * Immediately shuts down the connection
  34576. *
  34577. * @api public
  34578. */
  34579. WebSocket.prototype.terminate = function terminate() {
  34580. if (this.readyState === WebSocket.CLOSED) return;
  34581. if (this._socket) {
  34582. this.readyState = WebSocket.CLOSING;
  34583. // End the connection
  34584. try { this._socket.end(); }
  34585. catch (e) {
  34586. // Socket error during end() call, so just destroy it right now
  34587. cleanupWebsocketResources.call(this, true);
  34588. return;
  34589. }
  34590. // Add a timeout to ensure that the connection is completely
  34591. // cleaned up within 30 seconds, even if the clean close procedure
  34592. // fails for whatever reason
  34593. // First cleanup any pre-existing timeout from an earlier "terminate" call,
  34594. // if one exists. Otherwise terminate calls in quick succession will leak timeouts
  34595. // and hold the program open for `closeTimout` time.
  34596. if (this._closeTimer) { clearTimeout(this._closeTimer); }
  34597. this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout);
  34598. } else if (this.readyState === WebSocket.CONNECTING) {
  34599. cleanupWebsocketResources.call(this, true);
  34600. }
  34601. };
  34602. /**
  34603. * Expose bufferedAmount
  34604. *
  34605. * @api public
  34606. */
  34607. Object.defineProperty(WebSocket.prototype, 'bufferedAmount', {
  34608. get: function get() {
  34609. var amount = 0;
  34610. if (this._socket) {
  34611. amount = this._socket.bufferSize || 0;
  34612. }
  34613. return amount;
  34614. }
  34615. });
  34616. /**
  34617. * Expose binaryType
  34618. *
  34619. * This deviates from the W3C interface since ws doesn't support the required
  34620. * default "blob" type (instead we define a custom "nodebuffer" type).
  34621. *
  34622. * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
  34623. * @api public
  34624. */
  34625. Object.defineProperty(WebSocket.prototype, 'binaryType', {
  34626. get: function get() {
  34627. return this._binaryType;
  34628. },
  34629. set: function set(type) {
  34630. if (type === 'arraybuffer' || type === 'nodebuffer')
  34631. this._binaryType = type;
  34632. else
  34633. throw new SyntaxError('unsupported binaryType: must be either "nodebuffer" or "arraybuffer"');
  34634. }
  34635. });
  34636. /**
  34637. * Emulates the W3C Browser based WebSocket interface using function members.
  34638. *
  34639. * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
  34640. * @api public
  34641. */
  34642. ['open', 'error', 'close', 'message'].forEach(function(method) {
  34643. Object.defineProperty(WebSocket.prototype, 'on' + method, {
  34644. /**
  34645. * Returns the current listener
  34646. *
  34647. * @returns {Mixed} the set function or undefined
  34648. * @api public
  34649. */
  34650. get: function get() {
  34651. var listener = this.listeners(method)[0];
  34652. return listener ? (listener._listener ? listener._listener : listener) : undefined;
  34653. },
  34654. /**
  34655. * Start listening for events
  34656. *
  34657. * @param {Function} listener the listener
  34658. * @returns {Mixed} the set function or undefined
  34659. * @api public
  34660. */
  34661. set: function set(listener) {
  34662. this.removeAllListeners(method);
  34663. this.addEventListener(method, listener);
  34664. }
  34665. });
  34666. });
  34667. /**
  34668. * Emulates the W3C Browser based WebSocket interface using addEventListener.
  34669. *
  34670. * @see https://developer.mozilla.org/en/DOM/element.addEventListener
  34671. * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
  34672. * @api public
  34673. */
  34674. WebSocket.prototype.addEventListener = function(method, listener) {
  34675. var target = this;
  34676. function onMessage (data, flags) {
  34677. if (flags.binary && this.binaryType === 'arraybuffer')
  34678. data = new Uint8Array(data).buffer;
  34679. listener.call(target, new MessageEvent(data, !!flags.binary, target));
  34680. }
  34681. function onClose (code, message) {
  34682. listener.call(target, new CloseEvent(code, message, target));
  34683. }
  34684. function onError (event) {
  34685. event.type = 'error';
  34686. event.target = target;
  34687. listener.call(target, event);
  34688. }
  34689. function onOpen () {
  34690. listener.call(target, new OpenEvent(target));
  34691. }
  34692. if (typeof listener === 'function') {
  34693. if (method === 'message') {
  34694. // store a reference so we can return the original function from the
  34695. // addEventListener hook
  34696. onMessage._listener = listener;
  34697. this.on(method, onMessage);
  34698. } else if (method === 'close') {
  34699. // store a reference so we can return the original function from the
  34700. // addEventListener hook
  34701. onClose._listener = listener;
  34702. this.on(method, onClose);
  34703. } else if (method === 'error') {
  34704. // store a reference so we can return the original function from the
  34705. // addEventListener hook
  34706. onError._listener = listener;
  34707. this.on(method, onError);
  34708. } else if (method === 'open') {
  34709. // store a reference so we can return the original function from the
  34710. // addEventListener hook
  34711. onOpen._listener = listener;
  34712. this.on(method, onOpen);
  34713. } else {
  34714. this.on(method, listener);
  34715. }
  34716. }
  34717. };
  34718. module.exports = WebSocket;
  34719. module.exports.buildHostHeader = buildHostHeader
  34720. /**
  34721. * W3C MessageEvent
  34722. *
  34723. * @see http://www.w3.org/TR/html5/comms.html
  34724. * @constructor
  34725. * @api private
  34726. */
  34727. function MessageEvent(dataArg, isBinary, target) {
  34728. this.type = 'message';
  34729. this.data = dataArg;
  34730. this.target = target;
  34731. this.binary = isBinary; // non-standard.
  34732. }
  34733. /**
  34734. * W3C CloseEvent
  34735. *
  34736. * @see http://www.w3.org/TR/html5/comms.html
  34737. * @constructor
  34738. * @api private
  34739. */
  34740. function CloseEvent(code, reason, target) {
  34741. this.type = 'close';
  34742. this.wasClean = (typeof code === 'undefined' || code === 1000);
  34743. this.code = code;
  34744. this.reason = reason;
  34745. this.target = target;
  34746. }
  34747. /**
  34748. * W3C OpenEvent
  34749. *
  34750. * @see http://www.w3.org/TR/html5/comms.html
  34751. * @constructor
  34752. * @api private
  34753. */
  34754. function OpenEvent(target) {
  34755. this.type = 'open';
  34756. this.target = target;
  34757. }
  34758. // Append port number to Host header, only if specified in the url
  34759. // and non-default
  34760. function buildHostHeader(isSecure, hostname, port) {
  34761. var headerHost = hostname;
  34762. if (hostname) {
  34763. if ((isSecure && (port != 443)) || (!isSecure && (port != 80))){
  34764. headerHost = headerHost + ':' + port;
  34765. }
  34766. }
  34767. return headerHost;
  34768. }
  34769. /**
  34770. * Entirely private apis,
  34771. * which may or may not be bound to a sepcific WebSocket instance.
  34772. */
  34773. function initAsServerClient(req, socket, upgradeHead, options) {
  34774. options = new Options({
  34775. protocolVersion: protocolVersion,
  34776. protocol: null,
  34777. extensions: {},
  34778. maxPayload: 0
  34779. }).merge(options);
  34780. // expose state properties
  34781. this.protocol = options.value.protocol;
  34782. this.protocolVersion = options.value.protocolVersion;
  34783. this.extensions = options.value.extensions;
  34784. this.supports.binary = (this.protocolVersion !== 'hixie-76');
  34785. this.upgradeReq = req;
  34786. this.readyState = WebSocket.CONNECTING;
  34787. this._isServer = true;
  34788. this.maxPayload = options.value.maxPayload;
  34789. // establish connection
  34790. if (options.value.protocolVersion === 'hixie-76') {
  34791. establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead);
  34792. } else {
  34793. establishConnection.call(this, Receiver, Sender, socket, upgradeHead);
  34794. }
  34795. }
  34796. function initAsClient(address, protocols, options) {
  34797. options = new Options({
  34798. origin: null,
  34799. protocolVersion: protocolVersion,
  34800. host: null,
  34801. headers: null,
  34802. protocol: protocols.join(','),
  34803. agent: null,
  34804. // ssl-related options
  34805. pfx: null,
  34806. key: null,
  34807. passphrase: null,
  34808. cert: null,
  34809. ca: null,
  34810. ciphers: null,
  34811. rejectUnauthorized: null,
  34812. perMessageDeflate: true,
  34813. localAddress: null
  34814. }).merge(options);
  34815. if (options.value.protocolVersion !== 8 && options.value.protocolVersion !== 13) {
  34816. throw new Error('unsupported protocol version');
  34817. }
  34818. // verify URL and establish http class
  34819. var serverUrl = url.parse(address);
  34820. var isUnixSocket = serverUrl.protocol === 'ws+unix:';
  34821. if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url');
  34822. var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:';
  34823. var httpObj = isSecure ? https : http;
  34824. var port = serverUrl.port || (isSecure ? 443 : 80);
  34825. var auth = serverUrl.auth;
  34826. // prepare extensions
  34827. var extensionsOffer = {};
  34828. var perMessageDeflate;
  34829. if (options.value.perMessageDeflate) {
  34830. perMessageDeflate = new PerMessageDeflate(typeof options.value.perMessageDeflate !== true ? options.value.perMessageDeflate : {}, false);
  34831. extensionsOffer[PerMessageDeflate.extensionName] = perMessageDeflate.offer();
  34832. }
  34833. // expose state properties
  34834. this._isServer = false;
  34835. this.url = address;
  34836. this.protocolVersion = options.value.protocolVersion;
  34837. this.supports.binary = (this.protocolVersion !== 'hixie-76');
  34838. // begin handshake
  34839. var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64');
  34840. var shasum = crypto.createHash('sha1');
  34841. shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11');
  34842. var expectedServerKey = shasum.digest('base64');
  34843. var agent = options.value.agent;
  34844. var headerHost = buildHostHeader(isSecure, serverUrl.hostname, port)
  34845. var requestOptions = {
  34846. port: port,
  34847. host: serverUrl.hostname,
  34848. headers: {
  34849. 'Connection': 'Upgrade',
  34850. 'Upgrade': 'websocket',
  34851. 'Host': headerHost,
  34852. 'Sec-WebSocket-Version': options.value.protocolVersion,
  34853. 'Sec-WebSocket-Key': key
  34854. }
  34855. };
  34856. // If we have basic auth.
  34857. if (auth) {
  34858. requestOptions.headers.Authorization = 'Basic ' + new Buffer(auth).toString('base64');
  34859. }
  34860. if (options.value.protocol) {
  34861. requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol;
  34862. }
  34863. if (options.value.host) {
  34864. requestOptions.headers.Host = options.value.host;
  34865. }
  34866. if (options.value.headers) {
  34867. for (var header in options.value.headers) {
  34868. if (options.value.headers.hasOwnProperty(header)) {
  34869. requestOptions.headers[header] = options.value.headers[header];
  34870. }
  34871. }
  34872. }
  34873. if (Object.keys(extensionsOffer).length) {
  34874. requestOptions.headers['Sec-WebSocket-Extensions'] = Extensions.format(extensionsOffer);
  34875. }
  34876. if (options.isDefinedAndNonNull('pfx')
  34877. || options.isDefinedAndNonNull('key')
  34878. || options.isDefinedAndNonNull('passphrase')
  34879. || options.isDefinedAndNonNull('cert')
  34880. || options.isDefinedAndNonNull('ca')
  34881. || options.isDefinedAndNonNull('ciphers')
  34882. || options.isDefinedAndNonNull('rejectUnauthorized')) {
  34883. if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx;
  34884. if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key;
  34885. if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase;
  34886. if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert;
  34887. if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca;
  34888. if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers;
  34889. if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized;
  34890. if (!agent) {
  34891. // global agent ignores client side certificates
  34892. agent = new httpObj.Agent(requestOptions);
  34893. }
  34894. }
  34895. requestOptions.path = serverUrl.path || '/';
  34896. if (agent) {
  34897. requestOptions.agent = agent;
  34898. }
  34899. if (isUnixSocket) {
  34900. requestOptions.socketPath = serverUrl.pathname;
  34901. }
  34902. if (options.value.localAddress) {
  34903. requestOptions.localAddress = options.value.localAddress;
  34904. }
  34905. if (options.value.origin) {
  34906. if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin;
  34907. else requestOptions.headers.Origin = options.value.origin;
  34908. }
  34909. var self = this;
  34910. var req = httpObj.request(requestOptions);
  34911. req.on('error', function onerror(error) {
  34912. self.emit('error', error);
  34913. cleanupWebsocketResources.call(self, error);
  34914. });
  34915. req.once('response', function response(res) {
  34916. var error;
  34917. if (!self.emit('unexpected-response', req, res)) {
  34918. error = new Error('unexpected server response (' + res.statusCode + ')');
  34919. req.abort();
  34920. self.emit('error', error);
  34921. }
  34922. cleanupWebsocketResources.call(self, error);
  34923. });
  34924. req.once('upgrade', function upgrade(res, socket, upgradeHead) {
  34925. if (self.readyState === WebSocket.CLOSED) {
  34926. // client closed before server accepted connection
  34927. self.emit('close');
  34928. self.removeAllListeners();
  34929. socket.end();
  34930. return;
  34931. }
  34932. var serverKey = res.headers['sec-websocket-accept'];
  34933. if (typeof serverKey === 'undefined' || serverKey !== expectedServerKey) {
  34934. self.emit('error', 'invalid server key');
  34935. self.removeAllListeners();
  34936. socket.end();
  34937. return;
  34938. }
  34939. var serverProt = res.headers['sec-websocket-protocol'];
  34940. var protList = (options.value.protocol || "").split(/, */);
  34941. var protError = null;
  34942. if (!options.value.protocol && serverProt) {
  34943. protError = 'server sent a subprotocol even though none requested';
  34944. } else if (options.value.protocol && !serverProt) {
  34945. protError = 'server sent no subprotocol even though requested';
  34946. } else if (serverProt && protList.indexOf(serverProt) === -1) {
  34947. protError = 'server responded with an invalid protocol';
  34948. }
  34949. if (protError) {
  34950. self.emit('error', protError);
  34951. self.removeAllListeners();
  34952. socket.end();
  34953. return;
  34954. } else if (serverProt) {
  34955. self.protocol = serverProt;
  34956. }
  34957. var serverExtensions = Extensions.parse(res.headers['sec-websocket-extensions']);
  34958. if (perMessageDeflate && serverExtensions[PerMessageDeflate.extensionName]) {
  34959. try {
  34960. perMessageDeflate.accept(serverExtensions[PerMessageDeflate.extensionName]);
  34961. } catch (err) {
  34962. self.emit('error', 'invalid extension parameter');
  34963. self.removeAllListeners();
  34964. socket.end();
  34965. return;
  34966. }
  34967. self.extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
  34968. }
  34969. establishConnection.call(self, Receiver, Sender, socket, upgradeHead);
  34970. // perform cleanup on http resources
  34971. req.removeAllListeners();
  34972. req = null;
  34973. agent = null;
  34974. });
  34975. req.end();
  34976. this.readyState = WebSocket.CONNECTING;
  34977. }
  34978. function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) {
  34979. var ultron = this._ultron = new Ultron(socket)
  34980. , called = false
  34981. , self = this;
  34982. socket.setTimeout(0);
  34983. socket.setNoDelay(true);
  34984. this._receiver = new ReceiverClass(this.extensions,this.maxPayload);
  34985. this._socket = socket;
  34986. // socket cleanup handlers
  34987. ultron.on('end', cleanupWebsocketResources.bind(this));
  34988. ultron.on('close', cleanupWebsocketResources.bind(this));
  34989. ultron.on('error', cleanupWebsocketResources.bind(this));
  34990. // ensure that the upgradeHead is added to the receiver
  34991. function firstHandler(data) {
  34992. if (called || self.readyState === WebSocket.CLOSED) return;
  34993. called = true;
  34994. socket.removeListener('data', firstHandler);
  34995. ultron.on('data', realHandler);
  34996. if (upgradeHead && upgradeHead.length > 0) {
  34997. realHandler(upgradeHead);
  34998. upgradeHead = null;
  34999. }
  35000. if (data) realHandler(data);
  35001. }
  35002. // subsequent packets are pushed straight to the receiver
  35003. function realHandler(data) {
  35004. self.bytesReceived += data.length;
  35005. self._receiver.add(data);
  35006. }
  35007. ultron.on('data', firstHandler);
  35008. // if data was passed along with the http upgrade,
  35009. // this will schedule a push of that on to the receiver.
  35010. // this has to be done on next tick, since the caller
  35011. // hasn't had a chance to set event handlers on this client
  35012. // object yet.
  35013. process.nextTick(firstHandler);
  35014. // receiver event handlers
  35015. self._receiver.ontext = function ontext(data, flags) {
  35016. flags = flags || {};
  35017. self.emit('message', data, flags);
  35018. };
  35019. self._receiver.onbinary = function onbinary(data, flags) {
  35020. flags = flags || {};
  35021. flags.binary = true;
  35022. self.emit('message', data, flags);
  35023. };
  35024. self._receiver.onping = function onping(data, flags) {
  35025. flags = flags || {};
  35026. self.pong(data, {
  35027. mask: !self._isServer,
  35028. binary: flags.binary === true
  35029. }, true);
  35030. self.emit('ping', data, flags);
  35031. };
  35032. self._receiver.onpong = function onpong(data, flags) {
  35033. self.emit('pong', data, flags || {});
  35034. };
  35035. self._receiver.onclose = function onclose(code, data, flags) {
  35036. flags = flags || {};
  35037. self._closeReceived = true;
  35038. self.close(code, data);
  35039. };
  35040. self._receiver.onerror = function onerror(reason, errorCode) {
  35041. // close the connection when the receiver reports a HyBi error code
  35042. self.close(typeof errorCode !== 'undefined' ? errorCode : 1002, '');
  35043. self.emit('error', (reason instanceof Error) ? reason : (new Error(reason)));
  35044. };
  35045. // finalize the client
  35046. this._sender = new SenderClass(socket, this.extensions);
  35047. this._sender.on('error', function onerror(error) {
  35048. self.close(1002, '');
  35049. self.emit('error', error);
  35050. });
  35051. this.readyState = WebSocket.OPEN;
  35052. this.emit('open');
  35053. }
  35054. function startQueue(instance) {
  35055. instance._queue = instance._queue || [];
  35056. }
  35057. function executeQueueSends(instance) {
  35058. var queue = instance._queue;
  35059. if (typeof queue === 'undefined') return;
  35060. delete instance._queue;
  35061. for (var i = 0, l = queue.length; i < l; ++i) {
  35062. queue[i]();
  35063. }
  35064. }
  35065. function sendStream(instance, stream, options, cb) {
  35066. stream.on('data', function incoming(data) {
  35067. if (instance.readyState !== WebSocket.OPEN) {
  35068. if (typeof cb === 'function') cb(new Error('not opened'));
  35069. else {
  35070. delete instance._queue;
  35071. instance.emit('error', new Error('not opened'));
  35072. }
  35073. return;
  35074. }
  35075. options.fin = false;
  35076. instance._sender.send(data, options);
  35077. });
  35078. stream.on('end', function end() {
  35079. if (instance.readyState !== WebSocket.OPEN) {
  35080. if (typeof cb === 'function') cb(new Error('not opened'));
  35081. else {
  35082. delete instance._queue;
  35083. instance.emit('error', new Error('not opened'));
  35084. }
  35085. return;
  35086. }
  35087. options.fin = true;
  35088. instance._sender.send(null, options);
  35089. if (typeof cb === 'function') cb(null);
  35090. });
  35091. }
  35092. function cleanupWebsocketResources(error) {
  35093. if (this.readyState === WebSocket.CLOSED) return;
  35094. this.readyState = WebSocket.CLOSED;
  35095. clearTimeout(this._closeTimer);
  35096. this._closeTimer = null;
  35097. // If the connection was closed abnormally (with an error), or if
  35098. // the close control frame was not received then the close code
  35099. // must default to 1006.
  35100. if (error || !this._closeReceived) {
  35101. this._closeCode = 1006;
  35102. }
  35103. this.emit('close', this._closeCode || 1000, this._closeMessage || '');
  35104. if (this._socket) {
  35105. if (this._ultron) this._ultron.destroy();
  35106. this._socket.on('error', function onerror() {
  35107. try { this.destroy(); }
  35108. catch (e) {}
  35109. });
  35110. try {
  35111. if (!error) this._socket.end();
  35112. else this._socket.destroy();
  35113. } catch (e) { /* Ignore termination errors */ }
  35114. this._socket = null;
  35115. this._ultron = null;
  35116. }
  35117. if (this._sender) {
  35118. this._sender.removeAllListeners();
  35119. this._sender = null;
  35120. }
  35121. if (this._receiver) {
  35122. this._receiver.cleanup();
  35123. this._receiver = null;
  35124. }
  35125. if (this.extensions[PerMessageDeflate.extensionName]) {
  35126. this.extensions[PerMessageDeflate.extensionName].cleanup();
  35127. }
  35128. this.extensions = null;
  35129. this.removeAllListeners();
  35130. this.on('error', function onerror() {}); // catch all errors after this
  35131. delete this._queue;
  35132. }
  35133. });
  35134. ___scope___.file("lib/Sender.js", function(exports, require, module, __filename, __dirname){
  35135. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  35136. /*!
  35137. * ws: a node.js websocket client
  35138. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  35139. * MIT Licensed
  35140. */
  35141. var events = require('events')
  35142. , util = require('util')
  35143. , crypto = require('crypto')
  35144. , EventEmitter = events.EventEmitter
  35145. , ErrorCodes = require('./ErrorCodes')
  35146. , bufferUtil = require('./BufferUtil').BufferUtil
  35147. , PerMessageDeflate = require('./PerMessageDeflate');
  35148. /**
  35149. * HyBi Sender implementation
  35150. */
  35151. function Sender(socket, extensions) {
  35152. if (this instanceof Sender === false) {
  35153. throw new TypeError("Classes can't be function-called");
  35154. }
  35155. events.EventEmitter.call(this);
  35156. this._socket = socket;
  35157. this.extensions = extensions || {};
  35158. this.firstFragment = true;
  35159. this.compress = false;
  35160. this.messageHandlers = [];
  35161. this.processing = false;
  35162. }
  35163. /**
  35164. * Inherits from EventEmitter.
  35165. */
  35166. util.inherits(Sender, events.EventEmitter);
  35167. /**
  35168. * Sends a close instruction to the remote party.
  35169. *
  35170. * @api public
  35171. */
  35172. Sender.prototype.close = function(code, data, mask, cb) {
  35173. if (typeof code !== 'undefined') {
  35174. if (typeof code !== 'number' ||
  35175. !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number');
  35176. }
  35177. code = code || 1000;
  35178. var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0));
  35179. writeUInt16BE.call(dataBuffer, code, 0);
  35180. if (dataBuffer.length > 2) dataBuffer.write(data, 2);
  35181. var self = this;
  35182. this.messageHandlers.push(function() {
  35183. self.frameAndSend(0x8, dataBuffer, true, mask);
  35184. if (typeof cb == 'function') cb();
  35185. });
  35186. this.flush();
  35187. };
  35188. /**
  35189. * Sends a ping message to the remote party.
  35190. *
  35191. * @api public
  35192. */
  35193. Sender.prototype.ping = function(data, options) {
  35194. var mask = options && options.mask;
  35195. var self = this;
  35196. this.messageHandlers.push(function() {
  35197. self.frameAndSend(0x9, data || '', true, mask);
  35198. });
  35199. this.flush();
  35200. };
  35201. /**
  35202. * Sends a pong message to the remote party.
  35203. *
  35204. * @api public
  35205. */
  35206. Sender.prototype.pong = function(data, options) {
  35207. var mask = options && options.mask;
  35208. var self = this;
  35209. this.messageHandlers.push(function() {
  35210. self.frameAndSend(0xa, data || '', true, mask);
  35211. });
  35212. this.flush();
  35213. };
  35214. /**
  35215. * Sends text or binary data to the remote party.
  35216. *
  35217. * @api public
  35218. */
  35219. Sender.prototype.send = function(data, options, cb) {
  35220. var finalFragment = options && options.fin === false ? false : true;
  35221. var mask = options && options.mask;
  35222. var compress = options && options.compress;
  35223. var opcode = options && options.binary ? 2 : 1;
  35224. if (this.firstFragment === false) {
  35225. opcode = 0;
  35226. compress = false;
  35227. } else {
  35228. this.firstFragment = false;
  35229. this.compress = compress;
  35230. }
  35231. if (finalFragment) this.firstFragment = true
  35232. var compressFragment = this.compress;
  35233. var self = this;
  35234. this.messageHandlers.push(function() {
  35235. if (!data || !compressFragment) {
  35236. self.frameAndSend(opcode, data, finalFragment, mask, compress, cb);
  35237. return;
  35238. }
  35239. self.processing = true;
  35240. self.applyExtensions(data, finalFragment, compressFragment, function(err, data) {
  35241. if (err) {
  35242. if (typeof cb == 'function') cb(err);
  35243. else self.emit('error', err);
  35244. return;
  35245. }
  35246. self.frameAndSend(opcode, data, finalFragment, mask, compress, cb);
  35247. self.processing = false;
  35248. self.flush();
  35249. });
  35250. });
  35251. this.flush();
  35252. };
  35253. /**
  35254. * Frames and sends a piece of data according to the HyBi WebSocket protocol.
  35255. *
  35256. * @api private
  35257. */
  35258. Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, compressed, cb) {
  35259. var canModifyData = false;
  35260. if (!data) {
  35261. try {
  35262. this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb);
  35263. }
  35264. catch (e) {
  35265. if (typeof cb == 'function') cb(e);
  35266. else this.emit('error', e);
  35267. }
  35268. return;
  35269. }
  35270. if (!Buffer.isBuffer(data)) {
  35271. canModifyData = true;
  35272. if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) {
  35273. data = getArrayBuffer(data);
  35274. } else {
  35275. //
  35276. // If people want to send a number, this would allocate the number in
  35277. // bytes as memory size instead of storing the number as buffer value. So
  35278. // we need to transform it to string in order to prevent possible
  35279. // vulnerabilities / memory attacks.
  35280. //
  35281. if (typeof data === 'number') data = data.toString();
  35282. data = new Buffer(data);
  35283. }
  35284. }
  35285. var dataLength = data.length
  35286. , dataOffset = maskData ? 6 : 2
  35287. , secondByte = dataLength;
  35288. if (dataLength >= 65536) {
  35289. dataOffset += 8;
  35290. secondByte = 127;
  35291. }
  35292. else if (dataLength > 125) {
  35293. dataOffset += 2;
  35294. secondByte = 126;
  35295. }
  35296. var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData);
  35297. var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset;
  35298. var outputBuffer = new Buffer(totalLength);
  35299. outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode;
  35300. if (compressed) outputBuffer[0] |= 0x40;
  35301. switch (secondByte) {
  35302. case 126:
  35303. writeUInt16BE.call(outputBuffer, dataLength, 2);
  35304. break;
  35305. case 127:
  35306. writeUInt32BE.call(outputBuffer, 0, 2);
  35307. writeUInt32BE.call(outputBuffer, dataLength, 6);
  35308. }
  35309. if (maskData) {
  35310. outputBuffer[1] = secondByte | 0x80;
  35311. var mask = getRandomMask();
  35312. outputBuffer[dataOffset - 4] = mask[0];
  35313. outputBuffer[dataOffset - 3] = mask[1];
  35314. outputBuffer[dataOffset - 2] = mask[2];
  35315. outputBuffer[dataOffset - 1] = mask[3];
  35316. if (mergeBuffers) {
  35317. bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength);
  35318. try {
  35319. this._socket.write(outputBuffer, 'binary', cb);
  35320. }
  35321. catch (e) {
  35322. if (typeof cb == 'function') cb(e);
  35323. else this.emit('error', e);
  35324. }
  35325. }
  35326. else {
  35327. bufferUtil.mask(data, mask, data, 0, dataLength);
  35328. try {
  35329. this._socket.write(outputBuffer, 'binary');
  35330. this._socket.write(data, 'binary', cb);
  35331. }
  35332. catch (e) {
  35333. if (typeof cb == 'function') cb(e);
  35334. else this.emit('error', e);
  35335. }
  35336. }
  35337. }
  35338. else {
  35339. outputBuffer[1] = secondByte;
  35340. if (mergeBuffers) {
  35341. data.copy(outputBuffer, dataOffset);
  35342. try {
  35343. this._socket.write(outputBuffer, 'binary', cb);
  35344. }
  35345. catch (e) {
  35346. if (typeof cb == 'function') cb(e);
  35347. else this.emit('error', e);
  35348. }
  35349. }
  35350. else {
  35351. try {
  35352. this._socket.write(outputBuffer, 'binary');
  35353. this._socket.write(data, 'binary', cb);
  35354. }
  35355. catch (e) {
  35356. if (typeof cb == 'function') cb(e);
  35357. else this.emit('error', e);
  35358. }
  35359. }
  35360. }
  35361. };
  35362. /**
  35363. * Execute message handler buffers
  35364. *
  35365. * @api private
  35366. */
  35367. Sender.prototype.flush = function() {
  35368. while (!this.processing && this.messageHandlers.length) {
  35369. this.messageHandlers.shift()();
  35370. }
  35371. };
  35372. /**
  35373. * Apply extensions to message
  35374. *
  35375. * @api private
  35376. */
  35377. Sender.prototype.applyExtensions = function(data, fin, compress, callback) {
  35378. if ((data.buffer || data) instanceof ArrayBuffer) {
  35379. data = getArrayBuffer(data);
  35380. }
  35381. this.extensions[PerMessageDeflate.extensionName].compress(data, fin, callback);
  35382. };
  35383. module.exports = Sender;
  35384. function writeUInt16BE(value, offset) {
  35385. this[offset] = (value & 0xff00)>>8;
  35386. this[offset+1] = value & 0xff;
  35387. }
  35388. function writeUInt32BE(value, offset) {
  35389. this[offset] = (value & 0xff000000)>>24;
  35390. this[offset+1] = (value & 0xff0000)>>16;
  35391. this[offset+2] = (value & 0xff00)>>8;
  35392. this[offset+3] = value & 0xff;
  35393. }
  35394. function getArrayBuffer(data) {
  35395. // data is either an ArrayBuffer or ArrayBufferView.
  35396. var array = new Uint8Array(data.buffer || data)
  35397. , l = data.byteLength || data.length
  35398. , o = data.byteOffset || 0
  35399. , buffer = new Buffer(l);
  35400. for (var i = 0; i < l; ++i) {
  35401. buffer[i] = array[o+i];
  35402. }
  35403. return buffer;
  35404. }
  35405. function getRandomMask() {
  35406. return crypto.randomBytes(4);
  35407. }
  35408. });
  35409. ___scope___.file("lib/ErrorCodes.js", function(exports, require, module, __filename, __dirname){
  35410. /*!
  35411. * ws: a node.js websocket client
  35412. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  35413. * MIT Licensed
  35414. */
  35415. module.exports = {
  35416. isValidErrorCode: function(code) {
  35417. return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) ||
  35418. (code >= 3000 && code <= 4999);
  35419. },
  35420. 1000: 'normal',
  35421. 1001: 'going away',
  35422. 1002: 'protocol error',
  35423. 1003: 'unsupported data',
  35424. 1004: 'reserved',
  35425. 1005: 'reserved for extensions',
  35426. 1006: 'reserved for extensions',
  35427. 1007: 'inconsistent or invalid data',
  35428. 1008: 'policy violation',
  35429. 1009: 'message too big',
  35430. 1010: 'extension handshake missing',
  35431. 1011: 'an unexpected condition prevented the request from being fulfilled',
  35432. };
  35433. });
  35434. ___scope___.file("lib/BufferUtil.js", function(exports, require, module, __filename, __dirname){
  35435. 'use strict';
  35436. /*!
  35437. * ws: a node.js websocket client
  35438. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  35439. * MIT Licensed
  35440. */
  35441. try {
  35442. module.exports = require('bufferutil');
  35443. } catch (e) {
  35444. module.exports = require('./BufferUtil.fallback');
  35445. }
  35446. });
  35447. ___scope___.file("lib/BufferUtil.fallback.js", function(exports, require, module, __filename, __dirname){
  35448. /*!
  35449. * ws: a node.js websocket client
  35450. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  35451. * MIT Licensed
  35452. */
  35453. exports.BufferUtil = {
  35454. merge: function(mergedBuffer, buffers) {
  35455. var offset = 0;
  35456. for (var i = 0, l = buffers.length; i < l; ++i) {
  35457. var buf = buffers[i];
  35458. buf.copy(mergedBuffer, offset);
  35459. offset += buf.length;
  35460. }
  35461. },
  35462. mask: function(source, mask, output, offset, length) {
  35463. var maskNum = mask.readUInt32LE(0, true);
  35464. var i = 0;
  35465. for (; i < length - 3; i += 4) {
  35466. var num = maskNum ^ source.readUInt32LE(i, true);
  35467. if (num < 0) num = 4294967296 + num;
  35468. output.writeUInt32LE(num, offset + i, true);
  35469. }
  35470. switch (length % 4) {
  35471. case 3: output[offset + i + 2] = source[i + 2] ^ mask[2];
  35472. case 2: output[offset + i + 1] = source[i + 1] ^ mask[1];
  35473. case 1: output[offset + i] = source[i] ^ mask[0];
  35474. case 0:;
  35475. }
  35476. },
  35477. unmask: function(data, mask) {
  35478. var maskNum = mask.readUInt32LE(0, true);
  35479. var length = data.length;
  35480. var i = 0;
  35481. for (; i < length - 3; i += 4) {
  35482. var num = maskNum ^ data.readUInt32LE(i, true);
  35483. if (num < 0) num = 4294967296 + num;
  35484. data.writeUInt32LE(num, i, true);
  35485. }
  35486. switch (length % 4) {
  35487. case 3: data[i + 2] = data[i + 2] ^ mask[2];
  35488. case 2: data[i + 1] = data[i + 1] ^ mask[1];
  35489. case 1: data[i] = data[i] ^ mask[0];
  35490. case 0:;
  35491. }
  35492. }
  35493. }
  35494. });
  35495. ___scope___.file("lib/PerMessageDeflate.js", function(exports, require, module, __filename, __dirname){
  35496. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  35497. var zlib = require('zlib');
  35498. var AVAILABLE_WINDOW_BITS = [8, 9, 10, 11, 12, 13, 14, 15];
  35499. var DEFAULT_WINDOW_BITS = 15;
  35500. var DEFAULT_MEM_LEVEL = 8;
  35501. PerMessageDeflate.extensionName = 'permessage-deflate';
  35502. /**
  35503. * Per-message Compression Extensions implementation
  35504. */
  35505. function PerMessageDeflate(options, isServer,maxPayload) {
  35506. if (this instanceof PerMessageDeflate === false) {
  35507. throw new TypeError("Classes can't be function-called");
  35508. }
  35509. this._options = options || {};
  35510. this._isServer = !!isServer;
  35511. this._inflate = null;
  35512. this._deflate = null;
  35513. this.params = null;
  35514. this._maxPayload = maxPayload || 0;
  35515. }
  35516. /**
  35517. * Create extension parameters offer
  35518. *
  35519. * @api public
  35520. */
  35521. PerMessageDeflate.prototype.offer = function() {
  35522. var params = {};
  35523. if (this._options.serverNoContextTakeover) {
  35524. params.server_no_context_takeover = true;
  35525. }
  35526. if (this._options.clientNoContextTakeover) {
  35527. params.client_no_context_takeover = true;
  35528. }
  35529. if (this._options.serverMaxWindowBits) {
  35530. params.server_max_window_bits = this._options.serverMaxWindowBits;
  35531. }
  35532. if (this._options.clientMaxWindowBits) {
  35533. params.client_max_window_bits = this._options.clientMaxWindowBits;
  35534. } else if (this._options.clientMaxWindowBits == null) {
  35535. params.client_max_window_bits = true;
  35536. }
  35537. return params;
  35538. };
  35539. /**
  35540. * Accept extension offer
  35541. *
  35542. * @api public
  35543. */
  35544. PerMessageDeflate.prototype.accept = function(paramsList) {
  35545. paramsList = this.normalizeParams(paramsList);
  35546. var params;
  35547. if (this._isServer) {
  35548. params = this.acceptAsServer(paramsList);
  35549. } else {
  35550. params = this.acceptAsClient(paramsList);
  35551. }
  35552. this.params = params;
  35553. return params;
  35554. };
  35555. /**
  35556. * Releases all resources used by the extension
  35557. *
  35558. * @api public
  35559. */
  35560. PerMessageDeflate.prototype.cleanup = function() {
  35561. if (this._inflate) {
  35562. if (this._inflate.writeInProgress) {
  35563. this._inflate.pendingClose = true;
  35564. } else {
  35565. if (this._inflate.close) this._inflate.close();
  35566. this._inflate = null;
  35567. }
  35568. }
  35569. if (this._deflate) {
  35570. if (this._deflate.writeInProgress) {
  35571. this._deflate.pendingClose = true;
  35572. } else {
  35573. if (this._deflate.close) this._deflate.close();
  35574. this._deflate = null;
  35575. }
  35576. }
  35577. };
  35578. /**
  35579. * Accept extension offer from client
  35580. *
  35581. * @api private
  35582. */
  35583. PerMessageDeflate.prototype.acceptAsServer = function(paramsList) {
  35584. var accepted = {};
  35585. var result = paramsList.some(function(params) {
  35586. accepted = {};
  35587. if (this._options.serverNoContextTakeover === false && params.server_no_context_takeover) {
  35588. return;
  35589. }
  35590. if (this._options.serverMaxWindowBits === false && params.server_max_window_bits) {
  35591. return;
  35592. }
  35593. if (typeof this._options.serverMaxWindowBits === 'number' &&
  35594. typeof params.server_max_window_bits === 'number' &&
  35595. this._options.serverMaxWindowBits > params.server_max_window_bits) {
  35596. return;
  35597. }
  35598. if (typeof this._options.clientMaxWindowBits === 'number' && !params.client_max_window_bits) {
  35599. return;
  35600. }
  35601. if (this._options.serverNoContextTakeover || params.server_no_context_takeover) {
  35602. accepted.server_no_context_takeover = true;
  35603. }
  35604. if (this._options.clientNoContextTakeover) {
  35605. accepted.client_no_context_takeover = true;
  35606. }
  35607. if (this._options.clientNoContextTakeover !== false && params.client_no_context_takeover) {
  35608. accepted.client_no_context_takeover = true;
  35609. }
  35610. if (typeof this._options.serverMaxWindowBits === 'number') {
  35611. accepted.server_max_window_bits = this._options.serverMaxWindowBits;
  35612. } else if (typeof params.server_max_window_bits === 'number') {
  35613. accepted.server_max_window_bits = params.server_max_window_bits;
  35614. }
  35615. if (typeof this._options.clientMaxWindowBits === 'number') {
  35616. accepted.client_max_window_bits = this._options.clientMaxWindowBits;
  35617. } else if (this._options.clientMaxWindowBits !== false && typeof params.client_max_window_bits === 'number') {
  35618. accepted.client_max_window_bits = params.client_max_window_bits;
  35619. }
  35620. return true;
  35621. }, this);
  35622. if (!result) {
  35623. throw new Error('Doesn\'t support the offered configuration');
  35624. }
  35625. return accepted;
  35626. };
  35627. /**
  35628. * Accept extension response from server
  35629. *
  35630. * @api privaye
  35631. */
  35632. PerMessageDeflate.prototype.acceptAsClient = function(paramsList) {
  35633. var params = paramsList[0];
  35634. if (this._options.clientNoContextTakeover != null) {
  35635. if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) {
  35636. throw new Error('Invalid value for "client_no_context_takeover"');
  35637. }
  35638. }
  35639. if (this._options.clientMaxWindowBits != null) {
  35640. if (this._options.clientMaxWindowBits === false && params.client_max_window_bits) {
  35641. throw new Error('Invalid value for "client_max_window_bits"');
  35642. }
  35643. if (typeof this._options.clientMaxWindowBits === 'number' &&
  35644. (!params.client_max_window_bits || params.client_max_window_bits > this._options.clientMaxWindowBits)) {
  35645. throw new Error('Invalid value for "client_max_window_bits"');
  35646. }
  35647. }
  35648. return params;
  35649. };
  35650. /**
  35651. * Normalize extensions parameters
  35652. *
  35653. * @api private
  35654. */
  35655. PerMessageDeflate.prototype.normalizeParams = function(paramsList) {
  35656. return paramsList.map(function(params) {
  35657. Object.keys(params).forEach(function(key) {
  35658. var value = params[key];
  35659. if (value.length > 1) {
  35660. throw new Error('Multiple extension parameters for ' + key);
  35661. }
  35662. value = value[0];
  35663. switch (key) {
  35664. case 'server_no_context_takeover':
  35665. case 'client_no_context_takeover':
  35666. if (value !== true) {
  35667. throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')');
  35668. }
  35669. params[key] = true;
  35670. break;
  35671. case 'server_max_window_bits':
  35672. case 'client_max_window_bits':
  35673. if (typeof value === 'string') {
  35674. value = parseInt(value, 10);
  35675. if (!~AVAILABLE_WINDOW_BITS.indexOf(value)) {
  35676. throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')');
  35677. }
  35678. }
  35679. if (!this._isServer && value === true) {
  35680. throw new Error('Missing extension parameter value for ' + key);
  35681. }
  35682. params[key] = value;
  35683. break;
  35684. default:
  35685. throw new Error('Not defined extension parameter (' + key + ')');
  35686. }
  35687. }, this);
  35688. return params;
  35689. }, this);
  35690. };
  35691. /**
  35692. * Decompress message
  35693. *
  35694. * @api public
  35695. */
  35696. PerMessageDeflate.prototype.decompress = function (data, fin, callback) {
  35697. var endpoint = this._isServer ? 'client' : 'server';
  35698. if (!this._inflate) {
  35699. var maxWindowBits = this.params[endpoint + '_max_window_bits'];
  35700. this._inflate = zlib.createInflateRaw({
  35701. windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS
  35702. });
  35703. }
  35704. this._inflate.writeInProgress = true;
  35705. var self = this;
  35706. var buffers = [];
  35707. var cumulativeBufferLength=0;
  35708. this._inflate.on('error', onError).on('data', onData);
  35709. this._inflate.write(data);
  35710. if (fin) {
  35711. this._inflate.write(new Buffer([0x00, 0x00, 0xff, 0xff]));
  35712. }
  35713. this._inflate.flush(function() {
  35714. cleanup();
  35715. callback(null, Buffer.concat(buffers));
  35716. });
  35717. function onError(err) {
  35718. cleanup();
  35719. callback(err);
  35720. }
  35721. function onData(data) {
  35722. if(self._maxPayload!==undefined && self._maxPayload!==null && self._maxPayload>0){
  35723. cumulativeBufferLength+=data.length;
  35724. if(cumulativeBufferLength>self._maxPayload){
  35725. buffers=[];
  35726. cleanup();
  35727. var err={type:1009};
  35728. callback(err);
  35729. return;
  35730. }
  35731. }
  35732. buffers.push(data);
  35733. }
  35734. function cleanup() {
  35735. if (!self._inflate) return;
  35736. self._inflate.removeListener('error', onError);
  35737. self._inflate.removeListener('data', onData);
  35738. self._inflate.writeInProgress = false;
  35739. if ((fin && self.params[endpoint + '_no_context_takeover']) || self._inflate.pendingClose) {
  35740. if (self._inflate.close) self._inflate.close();
  35741. self._inflate = null;
  35742. }
  35743. }
  35744. };
  35745. /**
  35746. * Compress message
  35747. *
  35748. * @api public
  35749. */
  35750. PerMessageDeflate.prototype.compress = function (data, fin, callback) {
  35751. var endpoint = this._isServer ? 'server' : 'client';
  35752. if (!this._deflate) {
  35753. var maxWindowBits = this.params[endpoint + '_max_window_bits'];
  35754. this._deflate = zlib.createDeflateRaw({
  35755. flush: zlib.Z_SYNC_FLUSH,
  35756. windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS,
  35757. memLevel: this._options.memLevel || DEFAULT_MEM_LEVEL
  35758. });
  35759. }
  35760. this._deflate.writeInProgress = true;
  35761. var self = this;
  35762. var buffers = [];
  35763. this._deflate.on('error', onError).on('data', onData);
  35764. this._deflate.write(data);
  35765. this._deflate.flush(function() {
  35766. cleanup();
  35767. var data = Buffer.concat(buffers);
  35768. if (fin) {
  35769. data = data.slice(0, data.length - 4);
  35770. }
  35771. callback(null, data);
  35772. });
  35773. function onError(err) {
  35774. cleanup();
  35775. callback(err);
  35776. }
  35777. function onData(data) {
  35778. buffers.push(data);
  35779. }
  35780. function cleanup() {
  35781. if (!self._deflate) return;
  35782. self._deflate.removeListener('error', onError);
  35783. self._deflate.removeListener('data', onData);
  35784. self._deflate.writeInProgress = false;
  35785. if ((fin && self.params[endpoint + '_no_context_takeover']) || self._deflate.pendingClose) {
  35786. if (self._deflate.close) self._deflate.close();
  35787. self._deflate = null;
  35788. }
  35789. }
  35790. };
  35791. module.exports = PerMessageDeflate;
  35792. });
  35793. ___scope___.file("lib/Receiver.js", function(exports, require, module, __filename, __dirname){
  35794. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  35795. /*!
  35796. * ws: a node.js websocket client
  35797. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  35798. * MIT Licensed
  35799. */
  35800. var util = require('util')
  35801. , Validation = require('./Validation').Validation
  35802. , ErrorCodes = require('./ErrorCodes')
  35803. , BufferPool = require('./BufferPool')
  35804. , bufferUtil = require('./BufferUtil').BufferUtil
  35805. , PerMessageDeflate = require('./PerMessageDeflate');
  35806. /**
  35807. * HyBi Receiver implementation
  35808. */
  35809. function Receiver (extensions,maxPayload) {
  35810. if (this instanceof Receiver === false) {
  35811. throw new TypeError("Classes can't be function-called");
  35812. }
  35813. if(typeof extensions==='number'){
  35814. maxPayload=extensions;
  35815. extensions={};
  35816. }
  35817. // memory pool for fragmented messages
  35818. var fragmentedPoolPrevUsed = -1;
  35819. this.fragmentedBufferPool = new BufferPool(1024, function(db, length) {
  35820. return db.used + length;
  35821. }, function(db) {
  35822. return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ?
  35823. Math.ceil((fragmentedPoolPrevUsed + db.used) / 2) :
  35824. db.used;
  35825. });
  35826. // memory pool for unfragmented messages
  35827. var unfragmentedPoolPrevUsed = -1;
  35828. this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) {
  35829. return db.used + length;
  35830. }, function(db) {
  35831. return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ?
  35832. Math.ceil((unfragmentedPoolPrevUsed + db.used) / 2) :
  35833. db.used;
  35834. });
  35835. this.extensions = extensions || {};
  35836. this.maxPayload = maxPayload || 0;
  35837. this.currentPayloadLength = 0;
  35838. this.state = {
  35839. activeFragmentedOperation: null,
  35840. lastFragment: false,
  35841. masked: false,
  35842. opcode: 0,
  35843. fragmentedOperation: false
  35844. };
  35845. this.overflow = [];
  35846. this.headerBuffer = new Buffer(10);
  35847. this.expectOffset = 0;
  35848. this.expectBuffer = null;
  35849. this.expectHandler = null;
  35850. this.currentMessage = [];
  35851. this.currentMessageLength = 0;
  35852. this.messageHandlers = [];
  35853. this.expectHeader(2, this.processPacket);
  35854. this.dead = false;
  35855. this.processing = false;
  35856. this.onerror = function() {};
  35857. this.ontext = function() {};
  35858. this.onbinary = function() {};
  35859. this.onclose = function() {};
  35860. this.onping = function() {};
  35861. this.onpong = function() {};
  35862. }
  35863. module.exports = Receiver;
  35864. /**
  35865. * Add new data to the parser.
  35866. *
  35867. * @api public
  35868. */
  35869. Receiver.prototype.add = function(data) {
  35870. if (this.dead) return;
  35871. var dataLength = data.length;
  35872. if (dataLength == 0) return;
  35873. if (this.expectBuffer == null) {
  35874. this.overflow.push(data);
  35875. return;
  35876. }
  35877. var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset);
  35878. fastCopy(toRead, data, this.expectBuffer, this.expectOffset);
  35879. this.expectOffset += toRead;
  35880. if (toRead < dataLength) {
  35881. this.overflow.push(data.slice(toRead));
  35882. }
  35883. while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) {
  35884. var bufferForHandler = this.expectBuffer;
  35885. this.expectBuffer = null;
  35886. this.expectOffset = 0;
  35887. this.expectHandler.call(this, bufferForHandler);
  35888. }
  35889. };
  35890. /**
  35891. * Releases all resources used by the receiver.
  35892. *
  35893. * @api public
  35894. */
  35895. Receiver.prototype.cleanup = function() {
  35896. this.dead = true;
  35897. this.overflow = null;
  35898. this.headerBuffer = null;
  35899. this.expectBuffer = null;
  35900. this.expectHandler = null;
  35901. this.unfragmentedBufferPool = null;
  35902. this.fragmentedBufferPool = null;
  35903. this.state = null;
  35904. this.currentMessage = null;
  35905. this.onerror = null;
  35906. this.ontext = null;
  35907. this.onbinary = null;
  35908. this.onclose = null;
  35909. this.onping = null;
  35910. this.onpong = null;
  35911. };
  35912. /**
  35913. * Waits for a certain amount of header bytes to be available, then fires a callback.
  35914. *
  35915. * @api private
  35916. */
  35917. Receiver.prototype.expectHeader = function(length, handler) {
  35918. if (length == 0) {
  35919. handler(null);
  35920. return;
  35921. }
  35922. this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length);
  35923. this.expectHandler = handler;
  35924. var toRead = length;
  35925. while (toRead > 0 && this.overflow.length > 0) {
  35926. var fromOverflow = this.overflow.pop();
  35927. if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead));
  35928. var read = Math.min(fromOverflow.length, toRead);
  35929. fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset);
  35930. this.expectOffset += read;
  35931. toRead -= read;
  35932. }
  35933. };
  35934. /**
  35935. * Waits for a certain amount of data bytes to be available, then fires a callback.
  35936. *
  35937. * @api private
  35938. */
  35939. Receiver.prototype.expectData = function(length, handler) {
  35940. if (length == 0) {
  35941. handler(null);
  35942. return;
  35943. }
  35944. this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation);
  35945. this.expectHandler = handler;
  35946. var toRead = length;
  35947. while (toRead > 0 && this.overflow.length > 0) {
  35948. var fromOverflow = this.overflow.pop();
  35949. if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead));
  35950. var read = Math.min(fromOverflow.length, toRead);
  35951. fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset);
  35952. this.expectOffset += read;
  35953. toRead -= read;
  35954. }
  35955. };
  35956. /**
  35957. * Allocates memory from the buffer pool.
  35958. *
  35959. * @api private
  35960. */
  35961. Receiver.prototype.allocateFromPool = function(length, isFragmented) {
  35962. return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length);
  35963. };
  35964. /**
  35965. * Start processing a new packet.
  35966. *
  35967. * @api private
  35968. */
  35969. Receiver.prototype.processPacket = function (data) {
  35970. if (this.extensions[PerMessageDeflate.extensionName]) {
  35971. if ((data[0] & 0x30) != 0) {
  35972. this.error('reserved fields (2, 3) must be empty', 1002);
  35973. return;
  35974. }
  35975. } else {
  35976. if ((data[0] & 0x70) != 0) {
  35977. this.error('reserved fields must be empty', 1002);
  35978. return;
  35979. }
  35980. }
  35981. this.state.lastFragment = (data[0] & 0x80) == 0x80;
  35982. this.state.masked = (data[1] & 0x80) == 0x80;
  35983. var compressed = (data[0] & 0x40) == 0x40;
  35984. var opcode = data[0] & 0xf;
  35985. if (opcode === 0) {
  35986. if (compressed) {
  35987. this.error('continuation frame cannot have the Per-message Compressed bits', 1002);
  35988. return;
  35989. }
  35990. // continuation frame
  35991. this.state.fragmentedOperation = true;
  35992. this.state.opcode = this.state.activeFragmentedOperation;
  35993. if (!(this.state.opcode == 1 || this.state.opcode == 2)) {
  35994. this.error('continuation frame cannot follow current opcode', 1002);
  35995. return;
  35996. }
  35997. }
  35998. else {
  35999. if (opcode < 3 && this.state.activeFragmentedOperation != null) {
  36000. this.error('data frames after the initial data frame must have opcode 0', 1002);
  36001. return;
  36002. }
  36003. if (opcode >= 8 && compressed) {
  36004. this.error('control frames cannot have the Per-message Compressed bits', 1002);
  36005. return;
  36006. }
  36007. this.state.compressed = compressed;
  36008. this.state.opcode = opcode;
  36009. if (this.state.lastFragment === false) {
  36010. this.state.fragmentedOperation = true;
  36011. this.state.activeFragmentedOperation = opcode;
  36012. }
  36013. else this.state.fragmentedOperation = false;
  36014. }
  36015. var handler = opcodes[this.state.opcode];
  36016. if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002);
  36017. else {
  36018. handler.start.call(this, data);
  36019. }
  36020. };
  36021. /**
  36022. * Endprocessing a packet.
  36023. *
  36024. * @api private
  36025. */
  36026. Receiver.prototype.endPacket = function() {
  36027. if (this.dead) return;
  36028. if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true);
  36029. else if (this.state.lastFragment) this.fragmentedBufferPool.reset(true);
  36030. this.expectOffset = 0;
  36031. this.expectBuffer = null;
  36032. this.expectHandler = null;
  36033. if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) {
  36034. // end current fragmented operation
  36035. this.state.activeFragmentedOperation = null;
  36036. }
  36037. this.currentPayloadLength = 0;
  36038. this.state.lastFragment = false;
  36039. this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0;
  36040. this.state.masked = false;
  36041. this.expectHeader(2, this.processPacket);
  36042. };
  36043. /**
  36044. * Reset the parser state.
  36045. *
  36046. * @api private
  36047. */
  36048. Receiver.prototype.reset = function() {
  36049. if (this.dead) return;
  36050. this.state = {
  36051. activeFragmentedOperation: null,
  36052. lastFragment: false,
  36053. masked: false,
  36054. opcode: 0,
  36055. fragmentedOperation: false
  36056. };
  36057. this.fragmentedBufferPool.reset(true);
  36058. this.unfragmentedBufferPool.reset(true);
  36059. this.expectOffset = 0;
  36060. this.expectBuffer = null;
  36061. this.expectHandler = null;
  36062. this.overflow = [];
  36063. this.currentMessage = [];
  36064. this.currentMessageLength = 0;
  36065. this.messageHandlers = [];
  36066. this.currentPayloadLength = 0;
  36067. };
  36068. /**
  36069. * Unmask received data.
  36070. *
  36071. * @api private
  36072. */
  36073. Receiver.prototype.unmask = function (mask, buf, binary) {
  36074. if (mask != null && buf != null) bufferUtil.unmask(buf, mask);
  36075. if (binary) return buf;
  36076. return buf != null ? buf.toString('utf8') : '';
  36077. };
  36078. /**
  36079. * Handles an error
  36080. *
  36081. * @api private
  36082. */
  36083. Receiver.prototype.error = function (reason, protocolErrorCode) {
  36084. if (this.dead) return;
  36085. this.reset();
  36086. if(typeof reason == 'string'){
  36087. this.onerror(new Error(reason), protocolErrorCode);
  36088. }
  36089. else if(reason.constructor == Error){
  36090. this.onerror(reason, protocolErrorCode);
  36091. }
  36092. else{
  36093. this.onerror(new Error("An error occured"),protocolErrorCode);
  36094. }
  36095. return this;
  36096. };
  36097. /**
  36098. * Execute message handler buffers
  36099. *
  36100. * @api private
  36101. */
  36102. Receiver.prototype.flush = function() {
  36103. if (this.processing || this.dead) return;
  36104. var handler = this.messageHandlers.shift();
  36105. if (!handler) return;
  36106. this.processing = true;
  36107. var self = this;
  36108. handler(function() {
  36109. self.processing = false;
  36110. self.flush();
  36111. });
  36112. };
  36113. /**
  36114. * Apply extensions to message
  36115. *
  36116. * @api private
  36117. */
  36118. Receiver.prototype.applyExtensions = function(messageBuffer, fin, compressed, callback) {
  36119. var self = this;
  36120. if (compressed) {
  36121. this.extensions[PerMessageDeflate.extensionName].decompress(messageBuffer, fin, function(err, buffer) {
  36122. if (self.dead) return;
  36123. if (err) {
  36124. callback(new Error('invalid compressed data'));
  36125. return;
  36126. }
  36127. callback(null, buffer);
  36128. });
  36129. } else {
  36130. callback(null, messageBuffer);
  36131. }
  36132. };
  36133. /**
  36134. * Checks payload size, disconnects socket when it exceeds maxPayload
  36135. *
  36136. * @api private
  36137. */
  36138. Receiver.prototype.maxPayloadExceeded = function(length) {
  36139. if (this.maxPayload=== undefined || this.maxPayload === null || this.maxPayload < 1) {
  36140. return false;
  36141. }
  36142. var fullLength = this.currentPayloadLength + length;
  36143. if (fullLength < this.maxPayload) {
  36144. this.currentPayloadLength = fullLength;
  36145. return false;
  36146. }
  36147. this.error('payload cannot exceed ' + this.maxPayload + ' bytes', 1009);
  36148. this.messageBuffer=[];
  36149. this.cleanup();
  36150. return true;
  36151. };
  36152. /**
  36153. * Buffer utilities
  36154. */
  36155. function readUInt16BE(start) {
  36156. return (this[start]<<8) +
  36157. this[start+1];
  36158. }
  36159. function readUInt32BE(start) {
  36160. return (this[start]<<24) +
  36161. (this[start+1]<<16) +
  36162. (this[start+2]<<8) +
  36163. this[start+3];
  36164. }
  36165. function fastCopy(length, srcBuffer, dstBuffer, dstOffset) {
  36166. switch (length) {
  36167. default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break;
  36168. case 16: dstBuffer[dstOffset+15] = srcBuffer[15];
  36169. case 15: dstBuffer[dstOffset+14] = srcBuffer[14];
  36170. case 14: dstBuffer[dstOffset+13] = srcBuffer[13];
  36171. case 13: dstBuffer[dstOffset+12] = srcBuffer[12];
  36172. case 12: dstBuffer[dstOffset+11] = srcBuffer[11];
  36173. case 11: dstBuffer[dstOffset+10] = srcBuffer[10];
  36174. case 10: dstBuffer[dstOffset+9] = srcBuffer[9];
  36175. case 9: dstBuffer[dstOffset+8] = srcBuffer[8];
  36176. case 8: dstBuffer[dstOffset+7] = srcBuffer[7];
  36177. case 7: dstBuffer[dstOffset+6] = srcBuffer[6];
  36178. case 6: dstBuffer[dstOffset+5] = srcBuffer[5];
  36179. case 5: dstBuffer[dstOffset+4] = srcBuffer[4];
  36180. case 4: dstBuffer[dstOffset+3] = srcBuffer[3];
  36181. case 3: dstBuffer[dstOffset+2] = srcBuffer[2];
  36182. case 2: dstBuffer[dstOffset+1] = srcBuffer[1];
  36183. case 1: dstBuffer[dstOffset] = srcBuffer[0];
  36184. }
  36185. }
  36186. function clone(obj) {
  36187. var cloned = {};
  36188. for (var k in obj) {
  36189. if (obj.hasOwnProperty(k)) {
  36190. cloned[k] = obj[k];
  36191. }
  36192. }
  36193. return cloned;
  36194. }
  36195. /**
  36196. * Opcode handlers
  36197. */
  36198. var opcodes = {
  36199. // text
  36200. '1': {
  36201. start: function(data) {
  36202. var self = this;
  36203. // decode length
  36204. var firstLength = data[1] & 0x7f;
  36205. if (firstLength < 126) {
  36206. if (self.maxPayloadExceeded(firstLength)){
  36207. self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009);
  36208. return;
  36209. }
  36210. opcodes['1'].getData.call(self, firstLength);
  36211. }
  36212. else if (firstLength == 126) {
  36213. self.expectHeader(2, function(data) {
  36214. var length = readUInt16BE.call(data, 0);
  36215. if (self.maxPayloadExceeded(length)){
  36216. self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009);
  36217. return;
  36218. }
  36219. opcodes['1'].getData.call(self, length);
  36220. });
  36221. }
  36222. else if (firstLength == 127) {
  36223. self.expectHeader(8, function(data) {
  36224. if (readUInt32BE.call(data, 0) != 0) {
  36225. self.error('packets with length spanning more than 32 bit is currently not supported', 1008);
  36226. return;
  36227. }
  36228. var length = readUInt32BE.call(data, 4);
  36229. if (self.maxPayloadExceeded(length)){
  36230. self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009);
  36231. return;
  36232. }
  36233. opcodes['1'].getData.call(self, readUInt32BE.call(data, 4));
  36234. });
  36235. }
  36236. },
  36237. getData: function(length) {
  36238. var self = this;
  36239. if (self.state.masked) {
  36240. self.expectHeader(4, function(data) {
  36241. var mask = data;
  36242. self.expectData(length, function(data) {
  36243. opcodes['1'].finish.call(self, mask, data);
  36244. });
  36245. });
  36246. }
  36247. else {
  36248. self.expectData(length, function(data) {
  36249. opcodes['1'].finish.call(self, null, data);
  36250. });
  36251. }
  36252. },
  36253. finish: function(mask, data) {
  36254. var self = this;
  36255. var packet = this.unmask(mask, data, true) || new Buffer(0);
  36256. var state = clone(this.state);
  36257. this.messageHandlers.push(function(callback) {
  36258. self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) {
  36259. if (err) {
  36260. if(err.type===1009){
  36261. return self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009);
  36262. }
  36263. return self.error(err.message, 1007);
  36264. }
  36265. if (buffer != null) {
  36266. if( self.maxPayload==0 || (self.maxPayload > 0 && (self.currentMessageLength + buffer.length) < self.maxPayload) ){
  36267. self.currentMessage.push(buffer);
  36268. }
  36269. else{
  36270. self.currentMessage=null;
  36271. self.currentMessage = [];
  36272. self.currentMessageLength = 0;
  36273. self.error(new Error('Maximum payload exceeded. maxPayload: '+self.maxPayload), 1009);
  36274. return;
  36275. }
  36276. self.currentMessageLength += buffer.length;
  36277. }
  36278. if (state.lastFragment) {
  36279. var messageBuffer = Buffer.concat(self.currentMessage);
  36280. self.currentMessage = [];
  36281. self.currentMessageLength = 0;
  36282. if (!Validation.isValidUTF8(messageBuffer)) {
  36283. self.error('invalid utf8 sequence', 1007);
  36284. return;
  36285. }
  36286. self.ontext(messageBuffer.toString('utf8'), {masked: state.masked, buffer: messageBuffer});
  36287. }
  36288. callback();
  36289. });
  36290. });
  36291. this.flush();
  36292. this.endPacket();
  36293. }
  36294. },
  36295. // binary
  36296. '2': {
  36297. start: function(data) {
  36298. var self = this;
  36299. // decode length
  36300. var firstLength = data[1] & 0x7f;
  36301. if (firstLength < 126) {
  36302. if (self.maxPayloadExceeded(firstLength)){
  36303. self.error('Max payload exceeded in compressed text message. Aborting...', 1009);
  36304. return;
  36305. }
  36306. opcodes['2'].getData.call(self, firstLength);
  36307. }
  36308. else if (firstLength == 126) {
  36309. self.expectHeader(2, function(data) {
  36310. var length = readUInt16BE.call(data, 0);
  36311. if (self.maxPayloadExceeded(length)){
  36312. self.error('Max payload exceeded in compressed text message. Aborting...', 1009);
  36313. return;
  36314. }
  36315. opcodes['2'].getData.call(self, length);
  36316. });
  36317. }
  36318. else if (firstLength == 127) {
  36319. self.expectHeader(8, function(data) {
  36320. if (readUInt32BE.call(data, 0) != 0) {
  36321. self.error('packets with length spanning more than 32 bit is currently not supported', 1008);
  36322. return;
  36323. }
  36324. var length = readUInt32BE.call(data, 4, true);
  36325. if (self.maxPayloadExceeded(length)){
  36326. self.error('Max payload exceeded in compressed text message. Aborting...', 1009);
  36327. return;
  36328. }
  36329. opcodes['2'].getData.call(self, length);
  36330. });
  36331. }
  36332. },
  36333. getData: function(length) {
  36334. var self = this;
  36335. if (self.state.masked) {
  36336. self.expectHeader(4, function(data) {
  36337. var mask = data;
  36338. self.expectData(length, function(data) {
  36339. opcodes['2'].finish.call(self, mask, data);
  36340. });
  36341. });
  36342. }
  36343. else {
  36344. self.expectData(length, function(data) {
  36345. opcodes['2'].finish.call(self, null, data);
  36346. });
  36347. }
  36348. },
  36349. finish: function(mask, data) {
  36350. var self = this;
  36351. var packet = this.unmask(mask, data, true) || new Buffer(0);
  36352. var state = clone(this.state);
  36353. this.messageHandlers.push(function(callback) {
  36354. self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) {
  36355. if (err) {
  36356. if(err.type===1009){
  36357. return self.error('Max payload exceeded in compressed binary message. Aborting...', 1009);
  36358. }
  36359. return self.error(err.message, 1007);
  36360. }
  36361. if (buffer != null) {
  36362. if( self.maxPayload==0 || (self.maxPayload > 0 && (self.currentMessageLength + buffer.length) < self.maxPayload) ){
  36363. self.currentMessage.push(buffer);
  36364. }
  36365. else{
  36366. self.currentMessage=null;
  36367. self.currentMessage = [];
  36368. self.currentMessageLength = 0;
  36369. self.error(new Error('Maximum payload exceeded'), 1009);
  36370. return;
  36371. }
  36372. self.currentMessageLength += buffer.length;
  36373. }
  36374. if (state.lastFragment) {
  36375. var messageBuffer = Buffer.concat(self.currentMessage);
  36376. self.currentMessage = [];
  36377. self.currentMessageLength = 0;
  36378. self.onbinary(messageBuffer, {masked: state.masked, buffer: messageBuffer});
  36379. }
  36380. callback();
  36381. });
  36382. });
  36383. this.flush();
  36384. this.endPacket();
  36385. }
  36386. },
  36387. // close
  36388. '8': {
  36389. start: function(data) {
  36390. var self = this;
  36391. if (self.state.lastFragment == false) {
  36392. self.error('fragmented close is not supported', 1002);
  36393. return;
  36394. }
  36395. // decode length
  36396. var firstLength = data[1] & 0x7f;
  36397. if (firstLength < 126) {
  36398. opcodes['8'].getData.call(self, firstLength);
  36399. }
  36400. else {
  36401. self.error('control frames cannot have more than 125 bytes of data', 1002);
  36402. }
  36403. },
  36404. getData: function(length) {
  36405. var self = this;
  36406. if (self.state.masked) {
  36407. self.expectHeader(4, function(data) {
  36408. var mask = data;
  36409. self.expectData(length, function(data) {
  36410. opcodes['8'].finish.call(self, mask, data);
  36411. });
  36412. });
  36413. }
  36414. else {
  36415. self.expectData(length, function(data) {
  36416. opcodes['8'].finish.call(self, null, data);
  36417. });
  36418. }
  36419. },
  36420. finish: function(mask, data) {
  36421. var self = this;
  36422. data = self.unmask(mask, data, true);
  36423. var state = clone(this.state);
  36424. this.messageHandlers.push(function() {
  36425. if (data && data.length == 1) {
  36426. self.error('close packets with data must be at least two bytes long', 1002);
  36427. return;
  36428. }
  36429. var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000;
  36430. if (!ErrorCodes.isValidErrorCode(code)) {
  36431. self.error('invalid error code', 1002);
  36432. return;
  36433. }
  36434. var message = '';
  36435. if (data && data.length > 2) {
  36436. var messageBuffer = data.slice(2);
  36437. if (!Validation.isValidUTF8(messageBuffer)) {
  36438. self.error('invalid utf8 sequence', 1007);
  36439. return;
  36440. }
  36441. message = messageBuffer.toString('utf8');
  36442. }
  36443. self.onclose(code, message, {masked: state.masked});
  36444. self.reset();
  36445. });
  36446. this.flush();
  36447. },
  36448. },
  36449. // ping
  36450. '9': {
  36451. start: function(data) {
  36452. var self = this;
  36453. if (self.state.lastFragment == false) {
  36454. self.error('fragmented ping is not supported', 1002);
  36455. return;
  36456. }
  36457. // decode length
  36458. var firstLength = data[1] & 0x7f;
  36459. if (firstLength < 126) {
  36460. opcodes['9'].getData.call(self, firstLength);
  36461. }
  36462. else {
  36463. self.error('control frames cannot have more than 125 bytes of data', 1002);
  36464. }
  36465. },
  36466. getData: function(length) {
  36467. var self = this;
  36468. if (self.state.masked) {
  36469. self.expectHeader(4, function(data) {
  36470. var mask = data;
  36471. self.expectData(length, function(data) {
  36472. opcodes['9'].finish.call(self, mask, data);
  36473. });
  36474. });
  36475. }
  36476. else {
  36477. self.expectData(length, function(data) {
  36478. opcodes['9'].finish.call(self, null, data);
  36479. });
  36480. }
  36481. },
  36482. finish: function(mask, data) {
  36483. var self = this;
  36484. data = this.unmask(mask, data, true);
  36485. var state = clone(this.state);
  36486. this.messageHandlers.push(function(callback) {
  36487. self.onping(data, {masked: state.masked, binary: true});
  36488. callback();
  36489. });
  36490. this.flush();
  36491. this.endPacket();
  36492. }
  36493. },
  36494. // pong
  36495. '10': {
  36496. start: function(data) {
  36497. var self = this;
  36498. if (self.state.lastFragment == false) {
  36499. self.error('fragmented pong is not supported', 1002);
  36500. return;
  36501. }
  36502. // decode length
  36503. var firstLength = data[1] & 0x7f;
  36504. if (firstLength < 126) {
  36505. opcodes['10'].getData.call(self, firstLength);
  36506. }
  36507. else {
  36508. self.error('control frames cannot have more than 125 bytes of data', 1002);
  36509. }
  36510. },
  36511. getData: function(length) {
  36512. var self = this;
  36513. if (this.state.masked) {
  36514. this.expectHeader(4, function(data) {
  36515. var mask = data;
  36516. self.expectData(length, function(data) {
  36517. opcodes['10'].finish.call(self, mask, data);
  36518. });
  36519. });
  36520. }
  36521. else {
  36522. this.expectData(length, function(data) {
  36523. opcodes['10'].finish.call(self, null, data);
  36524. });
  36525. }
  36526. },
  36527. finish: function(mask, data) {
  36528. var self = this;
  36529. data = self.unmask(mask, data, true);
  36530. var state = clone(this.state);
  36531. this.messageHandlers.push(function(callback) {
  36532. self.onpong(data, {masked: state.masked, binary: true});
  36533. callback();
  36534. });
  36535. this.flush();
  36536. this.endPacket();
  36537. }
  36538. }
  36539. }
  36540. });
  36541. ___scope___.file("lib/Validation.js", function(exports, require, module, __filename, __dirname){
  36542. 'use strict';
  36543. /*!
  36544. * ws: a node.js websocket client
  36545. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  36546. * MIT Licensed
  36547. */
  36548. try {
  36549. module.exports = require('utf-8-validate');
  36550. } catch (e) {
  36551. module.exports = require('./Validation.fallback');
  36552. }
  36553. });
  36554. ___scope___.file("lib/Validation.fallback.js", function(exports, require, module, __filename, __dirname){
  36555. /*!
  36556. * ws: a node.js websocket client
  36557. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  36558. * MIT Licensed
  36559. */
  36560. exports.Validation = {
  36561. isValidUTF8: function(buffer) {
  36562. return true;
  36563. }
  36564. };
  36565. });
  36566. ___scope___.file("lib/BufferPool.js", function(exports, require, module, __filename, __dirname){
  36567. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  36568. /*!
  36569. * ws: a node.js websocket client
  36570. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  36571. * MIT Licensed
  36572. */
  36573. var util = require('util');
  36574. function BufferPool(initialSize, growStrategy, shrinkStrategy) {
  36575. if (this instanceof BufferPool === false) {
  36576. throw new TypeError("Classes can't be function-called");
  36577. }
  36578. if (typeof initialSize === 'function') {
  36579. shrinkStrategy = growStrategy;
  36580. growStrategy = initialSize;
  36581. initialSize = 0;
  36582. }
  36583. else if (typeof initialSize === 'undefined') {
  36584. initialSize = 0;
  36585. }
  36586. this._growStrategy = (growStrategy || function(db, size) {
  36587. return db.used + size;
  36588. }).bind(null, this);
  36589. this._shrinkStrategy = (shrinkStrategy || function(db) {
  36590. return initialSize;
  36591. }).bind(null, this);
  36592. this._buffer = initialSize ? new Buffer(initialSize) : null;
  36593. this._offset = 0;
  36594. this._used = 0;
  36595. this._changeFactor = 0;
  36596. this.__defineGetter__('size', function(){
  36597. return this._buffer == null ? 0 : this._buffer.length;
  36598. });
  36599. this.__defineGetter__('used', function(){
  36600. return this._used;
  36601. });
  36602. }
  36603. BufferPool.prototype.get = function(length) {
  36604. if (this._buffer == null || this._offset + length > this._buffer.length) {
  36605. var newBuf = new Buffer(this._growStrategy(length));
  36606. this._buffer = newBuf;
  36607. this._offset = 0;
  36608. }
  36609. this._used += length;
  36610. var buf = this._buffer.slice(this._offset, this._offset + length);
  36611. this._offset += length;
  36612. return buf;
  36613. }
  36614. BufferPool.prototype.reset = function(forceNewBuffer) {
  36615. var len = this._shrinkStrategy();
  36616. if (len < this.size) this._changeFactor -= 1;
  36617. if (forceNewBuffer || this._changeFactor < -2) {
  36618. this._changeFactor = 0;
  36619. this._buffer = len ? new Buffer(len) : null;
  36620. }
  36621. this._offset = 0;
  36622. this._used = 0;
  36623. }
  36624. module.exports = BufferPool;
  36625. });
  36626. ___scope___.file("lib/Sender.hixie.js", function(exports, require, module, __filename, __dirname){
  36627. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  36628. /*!
  36629. * ws: a node.js websocket client
  36630. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  36631. * MIT Licensed
  36632. */
  36633. var events = require('events')
  36634. , util = require('util')
  36635. , EventEmitter = events.EventEmitter;
  36636. /**
  36637. * Hixie Sender implementation
  36638. */
  36639. function Sender(socket) {
  36640. if (this instanceof Sender === false) {
  36641. throw new TypeError("Classes can't be function-called");
  36642. }
  36643. events.EventEmitter.call(this);
  36644. this.socket = socket;
  36645. this.continuationFrame = false;
  36646. this.isClosed = false;
  36647. }
  36648. module.exports = Sender;
  36649. /**
  36650. * Inherits from EventEmitter.
  36651. */
  36652. util.inherits(Sender, events.EventEmitter);
  36653. /**
  36654. * Frames and writes data.
  36655. *
  36656. * @api public
  36657. */
  36658. Sender.prototype.send = function(data, options, cb) {
  36659. if (this.isClosed) return;
  36660. var isString = typeof data == 'string'
  36661. , length = isString ? Buffer.byteLength(data) : data.length
  36662. , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes
  36663. , writeStartMarker = this.continuationFrame == false
  36664. , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin)
  36665. , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0))
  36666. , offset = writeStartMarker ? 1 : 0;
  36667. if (writeStartMarker) {
  36668. if (options && options.binary) {
  36669. buffer.write('\x80', 'binary');
  36670. // assume length less than 2**14 bytes
  36671. if (lengthbytes > 1)
  36672. buffer.write(String.fromCharCode(128+length/128), offset++, 'binary');
  36673. buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary');
  36674. } else
  36675. buffer.write('\x00', 'binary');
  36676. }
  36677. if (isString) buffer.write(data, offset, 'utf8');
  36678. else data.copy(buffer, offset, 0);
  36679. if (writeEndMarker) {
  36680. if (options && options.binary) {
  36681. // sending binary, not writing end marker
  36682. } else
  36683. buffer.write('\xff', offset + length, 'binary');
  36684. this.continuationFrame = false;
  36685. }
  36686. else this.continuationFrame = true;
  36687. try {
  36688. this.socket.write(buffer, 'binary', cb);
  36689. } catch (e) {
  36690. this.error(e.toString());
  36691. }
  36692. };
  36693. /**
  36694. * Sends a close instruction to the remote party.
  36695. *
  36696. * @api public
  36697. */
  36698. Sender.prototype.close = function(code, data, mask, cb) {
  36699. if (this.isClosed) return;
  36700. this.isClosed = true;
  36701. try {
  36702. if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary'));
  36703. this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb);
  36704. } catch (e) {
  36705. this.error(e.toString());
  36706. }
  36707. };
  36708. /**
  36709. * Sends a ping message to the remote party. Not available for hixie.
  36710. *
  36711. * @api public
  36712. */
  36713. Sender.prototype.ping = function(data, options) {};
  36714. /**
  36715. * Sends a pong message to the remote party. Not available for hixie.
  36716. *
  36717. * @api public
  36718. */
  36719. Sender.prototype.pong = function(data, options) {};
  36720. /**
  36721. * Handles an error
  36722. *
  36723. * @api private
  36724. */
  36725. Sender.prototype.error = function (reason) {
  36726. this.emit('error', reason);
  36727. return this;
  36728. };
  36729. });
  36730. ___scope___.file("lib/Receiver.hixie.js", function(exports, require, module, __filename, __dirname){
  36731. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  36732. /*!
  36733. * ws: a node.js websocket client
  36734. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  36735. * MIT Licensed
  36736. */
  36737. var util = require('util');
  36738. /**
  36739. * State constants
  36740. */
  36741. var EMPTY = 0
  36742. , BODY = 1;
  36743. var BINARYLENGTH = 2
  36744. , BINARYBODY = 3;
  36745. /**
  36746. * Hixie Receiver implementation
  36747. */
  36748. function Receiver () {
  36749. if (this instanceof Receiver === false) {
  36750. throw new TypeError("Classes can't be function-called");
  36751. }
  36752. this.state = EMPTY;
  36753. this.buffers = [];
  36754. this.messageEnd = -1;
  36755. this.spanLength = 0;
  36756. this.dead = false;
  36757. this.onerror = function() {};
  36758. this.ontext = function() {};
  36759. this.onbinary = function() {};
  36760. this.onclose = function() {};
  36761. this.onping = function() {};
  36762. this.onpong = function() {};
  36763. }
  36764. module.exports = Receiver;
  36765. /**
  36766. * Add new data to the parser.
  36767. *
  36768. * @api public
  36769. */
  36770. Receiver.prototype.add = function(data) {
  36771. if (this.dead) return;
  36772. var self = this;
  36773. function doAdd() {
  36774. if (self.state === EMPTY) {
  36775. if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) {
  36776. self.reset();
  36777. self.onclose();
  36778. return;
  36779. }
  36780. if (data[0] === 0x80) {
  36781. self.messageEnd = 0;
  36782. self.state = BINARYLENGTH;
  36783. data = data.slice(1);
  36784. } else {
  36785. if (data[0] !== 0x00) {
  36786. self.error('payload must start with 0x00 byte', true);
  36787. return;
  36788. }
  36789. data = data.slice(1);
  36790. self.state = BODY;
  36791. }
  36792. }
  36793. if (self.state === BINARYLENGTH) {
  36794. var i = 0;
  36795. while ((i < data.length) && (data[i] & 0x80)) {
  36796. self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f);
  36797. ++i;
  36798. }
  36799. if (i < data.length) {
  36800. self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f);
  36801. self.state = BINARYBODY;
  36802. ++i;
  36803. }
  36804. if (i > 0)
  36805. data = data.slice(i);
  36806. }
  36807. if (self.state === BINARYBODY) {
  36808. var dataleft = self.messageEnd - self.spanLength;
  36809. if (data.length >= dataleft) {
  36810. // consume the whole buffer to finish the frame
  36811. self.buffers.push(data);
  36812. self.spanLength += dataleft;
  36813. self.messageEnd = dataleft;
  36814. return self.parse();
  36815. }
  36816. // frame's not done even if we consume it all
  36817. self.buffers.push(data);
  36818. self.spanLength += data.length;
  36819. return;
  36820. }
  36821. self.buffers.push(data);
  36822. if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) {
  36823. self.spanLength += self.messageEnd;
  36824. return self.parse();
  36825. }
  36826. else self.spanLength += data.length;
  36827. }
  36828. while(data) data = doAdd();
  36829. };
  36830. /**
  36831. * Releases all resources used by the receiver.
  36832. *
  36833. * @api public
  36834. */
  36835. Receiver.prototype.cleanup = function() {
  36836. this.dead = true;
  36837. this.state = EMPTY;
  36838. this.buffers = [];
  36839. };
  36840. /**
  36841. * Process buffered data.
  36842. *
  36843. * @api public
  36844. */
  36845. Receiver.prototype.parse = function() {
  36846. var output = new Buffer(this.spanLength);
  36847. var outputIndex = 0;
  36848. for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) {
  36849. var buffer = this.buffers[bi];
  36850. buffer.copy(output, outputIndex);
  36851. outputIndex += buffer.length;
  36852. }
  36853. var lastBuffer = this.buffers[this.buffers.length - 1];
  36854. if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd);
  36855. if (this.state !== BODY) --this.messageEnd;
  36856. var tail = null;
  36857. if (this.messageEnd < lastBuffer.length - 1) {
  36858. tail = lastBuffer.slice(this.messageEnd + 1);
  36859. }
  36860. this.reset();
  36861. this.ontext(output.toString('utf8'));
  36862. return tail;
  36863. };
  36864. /**
  36865. * Handles an error
  36866. *
  36867. * @api private
  36868. */
  36869. Receiver.prototype.error = function (reason, terminate) {
  36870. if (this.dead) return;
  36871. this.reset();
  36872. if(typeof reason == 'string'){
  36873. this.onerror(new Error(reason), terminate);
  36874. }
  36875. else if(reason.constructor == Error){
  36876. this.onerror(reason, terminate);
  36877. }
  36878. else{
  36879. this.onerror(new Error("An error occured"),terminate);
  36880. }
  36881. return this;
  36882. };
  36883. /**
  36884. * Reset parser state
  36885. *
  36886. * @api private
  36887. */
  36888. Receiver.prototype.reset = function (reason) {
  36889. if (this.dead) return;
  36890. this.state = EMPTY;
  36891. this.buffers = [];
  36892. this.messageEnd = -1;
  36893. this.spanLength = 0;
  36894. };
  36895. /**
  36896. * Internal api
  36897. */
  36898. function bufferIndex(buffer, byte) {
  36899. for (var i = 0, l = buffer.length; i < l; ++i) {
  36900. if (buffer[i] === byte) return i;
  36901. }
  36902. return -1;
  36903. }
  36904. });
  36905. ___scope___.file("lib/Extensions.js", function(exports, require, module, __filename, __dirname){
  36906. var util = require('util');
  36907. /**
  36908. * Module exports.
  36909. */
  36910. exports.parse = parse;
  36911. exports.format = format;
  36912. /**
  36913. * Parse extensions header value
  36914. */
  36915. function parse(value) {
  36916. value = value || '';
  36917. var extensions = {};
  36918. value.split(',').forEach(function(v) {
  36919. var params = v.split(';');
  36920. var token = params.shift().trim();
  36921. var paramsList = extensions[token] = extensions[token] || [];
  36922. var parsedParams = {};
  36923. params.forEach(function(param) {
  36924. var parts = param.trim().split('=');
  36925. var key = parts[0];
  36926. var value = parts[1];
  36927. if (typeof value === 'undefined') {
  36928. value = true;
  36929. } else {
  36930. // unquote value
  36931. if (value[0] === '"') {
  36932. value = value.slice(1);
  36933. }
  36934. if (value[value.length - 1] === '"') {
  36935. value = value.slice(0, value.length - 1);
  36936. }
  36937. }
  36938. (parsedParams[key] = parsedParams[key] || []).push(value);
  36939. });
  36940. paramsList.push(parsedParams);
  36941. });
  36942. return extensions;
  36943. }
  36944. /**
  36945. * Format extensions header value
  36946. */
  36947. function format(value) {
  36948. return Object.keys(value).map(function(token) {
  36949. var paramsList = value[token];
  36950. if (!util.isArray(paramsList)) {
  36951. paramsList = [paramsList];
  36952. }
  36953. return paramsList.map(function(params) {
  36954. return [token].concat(Object.keys(params).map(function(k) {
  36955. var p = params[k];
  36956. if (!util.isArray(p)) p = [p];
  36957. return p.map(function(v) {
  36958. return v === true ? k : k + '=' + v;
  36959. }).join('; ');
  36960. })).join('; ');
  36961. }).join(', ');
  36962. }).join(', ');
  36963. }
  36964. });
  36965. ___scope___.file("lib/WebSocketServer.js", function(exports, require, module, __filename, __dirname){
  36966. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  36967. /*!
  36968. * ws: a node.js websocket client
  36969. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  36970. * MIT Licensed
  36971. */
  36972. var util = require('util')
  36973. , events = require('events')
  36974. , http = require('http')
  36975. , crypto = require('crypto')
  36976. , Options = require('options')
  36977. , WebSocket = require('./WebSocket')
  36978. , Extensions = require('./Extensions')
  36979. , PerMessageDeflate = require('./PerMessageDeflate')
  36980. , tls = require('tls')
  36981. , url = require('url');
  36982. /**
  36983. * WebSocket Server implementation
  36984. */
  36985. function WebSocketServer(options, callback) {
  36986. if (this instanceof WebSocketServer === false) {
  36987. return new WebSocketServer(options, callback);
  36988. }
  36989. events.EventEmitter.call(this);
  36990. options = new Options({
  36991. host: '0.0.0.0',
  36992. port: null,
  36993. server: null,
  36994. verifyClient: null,
  36995. handleProtocols: null,
  36996. path: null,
  36997. noServer: false,
  36998. disableHixie: false,
  36999. clientTracking: true,
  37000. perMessageDeflate: true,
  37001. maxPayload: 100 * 1024 * 1024
  37002. }).merge(options);
  37003. if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) {
  37004. throw new TypeError('`port` or a `server` must be provided');
  37005. }
  37006. var self = this;
  37007. if (options.isDefinedAndNonNull('port')) {
  37008. this._server = http.createServer(function (req, res) {
  37009. var body = http.STATUS_CODES[426];
  37010. res.writeHead(426, {
  37011. 'Content-Length': body.length,
  37012. 'Content-Type': 'text/plain'
  37013. });
  37014. res.end(body);
  37015. });
  37016. this._server.allowHalfOpen = false;
  37017. this._server.listen(options.value.port, options.value.host, callback);
  37018. this._closeServer = function() { if (self._server) self._server.close(); };
  37019. }
  37020. else if (options.value.server) {
  37021. this._server = options.value.server;
  37022. if (options.value.path) {
  37023. // take note of the path, to avoid collisions when multiple websocket servers are
  37024. // listening on the same http server
  37025. if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) {
  37026. throw new Error('two instances of WebSocketServer cannot listen on the same http server path');
  37027. }
  37028. if (typeof this._server._webSocketPaths !== 'object') {
  37029. this._server._webSocketPaths = {};
  37030. }
  37031. this._server._webSocketPaths[options.value.path] = 1;
  37032. }
  37033. }
  37034. if (this._server) {
  37035. this._onceServerListening = function() { self.emit('listening'); };
  37036. this._server.once('listening', this._onceServerListening);
  37037. }
  37038. if (typeof this._server != 'undefined') {
  37039. this._onServerError = function(error) { self.emit('error', error) };
  37040. this._server.on('error', this._onServerError);
  37041. this._onServerUpgrade = function(req, socket, upgradeHead) {
  37042. //copy upgradeHead to avoid retention of large slab buffers used in node core
  37043. var head = new Buffer(upgradeHead.length);
  37044. upgradeHead.copy(head);
  37045. self.handleUpgrade(req, socket, head, function(client) {
  37046. self.emit('connection'+req.url, client);
  37047. self.emit('connection', client);
  37048. });
  37049. };
  37050. this._server.on('upgrade', this._onServerUpgrade);
  37051. }
  37052. this.options = options.value;
  37053. this.path = options.value.path;
  37054. this.clients = [];
  37055. }
  37056. /**
  37057. * Inherits from EventEmitter.
  37058. */
  37059. util.inherits(WebSocketServer, events.EventEmitter);
  37060. /**
  37061. * Immediately shuts down the connection.
  37062. *
  37063. * @api public
  37064. */
  37065. WebSocketServer.prototype.close = function(callback) {
  37066. // terminate all associated clients
  37067. var error = null;
  37068. try {
  37069. for (var i = 0, l = this.clients.length; i < l; ++i) {
  37070. this.clients[i].terminate();
  37071. }
  37072. }
  37073. catch (e) {
  37074. error = e;
  37075. }
  37076. // remove path descriptor, if any
  37077. if (this.path && this._server._webSocketPaths) {
  37078. delete this._server._webSocketPaths[this.path];
  37079. if (Object.keys(this._server._webSocketPaths).length == 0) {
  37080. delete this._server._webSocketPaths;
  37081. }
  37082. }
  37083. // close the http server if it was internally created
  37084. try {
  37085. if (typeof this._closeServer !== 'undefined') {
  37086. this._closeServer();
  37087. }
  37088. }
  37089. finally {
  37090. if (this._server) {
  37091. this._server.removeListener('listening', this._onceServerListening);
  37092. this._server.removeListener('error', this._onServerError);
  37093. this._server.removeListener('upgrade', this._onServerUpgrade);
  37094. }
  37095. delete this._server;
  37096. }
  37097. if(callback)
  37098. callback(error);
  37099. else if(error)
  37100. throw error;
  37101. }
  37102. /**
  37103. * Handle a HTTP Upgrade request.
  37104. *
  37105. * @api public
  37106. */
  37107. WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) {
  37108. // check for wrong path
  37109. if (this.options.path) {
  37110. var u = url.parse(req.url);
  37111. if (u && u.pathname !== this.options.path) return;
  37112. }
  37113. if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') {
  37114. abortConnection(socket, 400, 'Bad Request');
  37115. return;
  37116. }
  37117. if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments);
  37118. else handleHybiUpgrade.apply(this, arguments);
  37119. }
  37120. module.exports = WebSocketServer;
  37121. /**
  37122. * Entirely private apis,
  37123. * which may or may not be bound to a sepcific WebSocket instance.
  37124. */
  37125. function handleHybiUpgrade(req, socket, upgradeHead, cb) {
  37126. // handle premature socket errors
  37127. var errorHandler = function() {
  37128. try { socket.destroy(); } catch (e) {}
  37129. }
  37130. socket.on('error', errorHandler);
  37131. // verify key presence
  37132. if (!req.headers['sec-websocket-key']) {
  37133. abortConnection(socket, 400, 'Bad Request');
  37134. return;
  37135. }
  37136. // verify version
  37137. var version = parseInt(req.headers['sec-websocket-version']);
  37138. if ([8, 13].indexOf(version) === -1) {
  37139. abortConnection(socket, 400, 'Bad Request');
  37140. return;
  37141. }
  37142. // verify protocol
  37143. var protocols = req.headers['sec-websocket-protocol'];
  37144. // verify client
  37145. var origin = version < 13 ?
  37146. req.headers['sec-websocket-origin'] :
  37147. req.headers['origin'];
  37148. // handle extensions offer
  37149. var extensionsOffer = Extensions.parse(req.headers['sec-websocket-extensions']);
  37150. // handler to call when the connection sequence completes
  37151. var self = this;
  37152. var completeHybiUpgrade2 = function(protocol) {
  37153. // calc key
  37154. var key = req.headers['sec-websocket-key'];
  37155. var shasum = crypto.createHash('sha1');
  37156. shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
  37157. key = shasum.digest('base64');
  37158. var headers = [
  37159. 'HTTP/1.1 101 Switching Protocols'
  37160. , 'Upgrade: websocket'
  37161. , 'Connection: Upgrade'
  37162. , 'Sec-WebSocket-Accept: ' + key
  37163. ];
  37164. if (typeof protocol != 'undefined') {
  37165. headers.push('Sec-WebSocket-Protocol: ' + protocol);
  37166. }
  37167. var extensions = {};
  37168. try {
  37169. extensions = acceptExtensions.call(self, extensionsOffer);
  37170. } catch (err) {
  37171. abortConnection(socket, 400, 'Bad Request');
  37172. return;
  37173. }
  37174. if (Object.keys(extensions).length) {
  37175. var serverExtensions = {};
  37176. Object.keys(extensions).forEach(function(token) {
  37177. serverExtensions[token] = [extensions[token].params]
  37178. });
  37179. headers.push('Sec-WebSocket-Extensions: ' + Extensions.format(serverExtensions));
  37180. }
  37181. // allows external modification/inspection of handshake headers
  37182. self.emit('headers', headers);
  37183. socket.setTimeout(0);
  37184. socket.setNoDelay(true);
  37185. try {
  37186. socket.write(headers.concat('', '').join('\r\n'));
  37187. }
  37188. catch (e) {
  37189. // if the upgrade write fails, shut the connection down hard
  37190. try { socket.destroy(); } catch (e) {}
  37191. return;
  37192. }
  37193. var client = new WebSocket([req, socket, upgradeHead], {
  37194. protocolVersion: version,
  37195. protocol: protocol,
  37196. extensions: extensions,
  37197. maxPayload: self.options.maxPayload
  37198. });
  37199. if (self.options.clientTracking) {
  37200. self.clients.push(client);
  37201. client.on('close', function() {
  37202. var index = self.clients.indexOf(client);
  37203. if (index != -1) {
  37204. self.clients.splice(index, 1);
  37205. }
  37206. });
  37207. }
  37208. // signal upgrade complete
  37209. socket.removeListener('error', errorHandler);
  37210. cb(client);
  37211. }
  37212. // optionally call external protocol selection handler before
  37213. // calling completeHybiUpgrade2
  37214. var completeHybiUpgrade1 = function() {
  37215. // choose from the sub-protocols
  37216. if (typeof self.options.handleProtocols == 'function') {
  37217. var protList = (protocols || "").split(/, */);
  37218. var callbackCalled = false;
  37219. var res = self.options.handleProtocols(protList, function(result, protocol) {
  37220. callbackCalled = true;
  37221. if (!result) abortConnection(socket, 401, 'Unauthorized');
  37222. else completeHybiUpgrade2(protocol);
  37223. });
  37224. if (!callbackCalled) {
  37225. // the handleProtocols handler never called our callback
  37226. abortConnection(socket, 501, 'Could not process protocols');
  37227. }
  37228. return;
  37229. } else {
  37230. if (typeof protocols !== 'undefined') {
  37231. completeHybiUpgrade2(protocols.split(/, */)[0]);
  37232. }
  37233. else {
  37234. completeHybiUpgrade2();
  37235. }
  37236. }
  37237. }
  37238. // optionally call external client verification handler
  37239. if (typeof this.options.verifyClient == 'function') {
  37240. var info = {
  37241. origin: origin,
  37242. secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined',
  37243. req: req
  37244. };
  37245. if (this.options.verifyClient.length == 2) {
  37246. this.options.verifyClient(info, function(result, code, name) {
  37247. if (typeof code === 'undefined') code = 401;
  37248. if (typeof name === 'undefined') name = http.STATUS_CODES[code];
  37249. if (!result) abortConnection(socket, code, name);
  37250. else completeHybiUpgrade1();
  37251. });
  37252. return;
  37253. }
  37254. else if (!this.options.verifyClient(info)) {
  37255. abortConnection(socket, 401, 'Unauthorized');
  37256. return;
  37257. }
  37258. }
  37259. completeHybiUpgrade1();
  37260. }
  37261. function handleHixieUpgrade(req, socket, upgradeHead, cb) {
  37262. // handle premature socket errors
  37263. var errorHandler = function() {
  37264. try { socket.destroy(); } catch (e) {}
  37265. }
  37266. socket.on('error', errorHandler);
  37267. // bail if options prevent hixie
  37268. if (this.options.disableHixie) {
  37269. abortConnection(socket, 401, 'Hixie support disabled');
  37270. return;
  37271. }
  37272. // verify key presence
  37273. if (!req.headers['sec-websocket-key2']) {
  37274. abortConnection(socket, 400, 'Bad Request');
  37275. return;
  37276. }
  37277. var origin = req.headers['origin']
  37278. , self = this;
  37279. // setup handshake completion to run after client has been verified
  37280. var onClientVerified = function() {
  37281. var wshost;
  37282. if (!req.headers['x-forwarded-host'])
  37283. wshost = req.headers.host;
  37284. else
  37285. wshost = req.headers['x-forwarded-host'];
  37286. var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url
  37287. , protocol = req.headers['sec-websocket-protocol'];
  37288. // build the response header and return a Buffer
  37289. var buildResponseHeader = function() {
  37290. var headers = [
  37291. 'HTTP/1.1 101 Switching Protocols'
  37292. , 'Upgrade: WebSocket'
  37293. , 'Connection: Upgrade'
  37294. , 'Sec-WebSocket-Location: ' + location
  37295. ];
  37296. if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol);
  37297. if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin);
  37298. return new Buffer(headers.concat('', '').join('\r\n'));
  37299. };
  37300. // send handshake response before receiving the nonce
  37301. var handshakeResponse = function() {
  37302. socket.setTimeout(0);
  37303. socket.setNoDelay(true);
  37304. var headerBuffer = buildResponseHeader();
  37305. try {
  37306. socket.write(headerBuffer, 'binary', function(err) {
  37307. // remove listener if there was an error
  37308. if (err) socket.removeListener('data', handler);
  37309. return;
  37310. });
  37311. } catch (e) {
  37312. try { socket.destroy(); } catch (e) {}
  37313. return;
  37314. };
  37315. };
  37316. // handshake completion code to run once nonce has been successfully retrieved
  37317. var completeHandshake = function(nonce, rest, headerBuffer) {
  37318. // calculate key
  37319. var k1 = req.headers['sec-websocket-key1']
  37320. , k2 = req.headers['sec-websocket-key2']
  37321. , md5 = crypto.createHash('md5');
  37322. [k1, k2].forEach(function (k) {
  37323. var n = parseInt(k.replace(/[^\d]/g, ''))
  37324. , spaces = k.replace(/[^ ]/g, '').length;
  37325. if (spaces === 0 || n % spaces !== 0){
  37326. abortConnection(socket, 400, 'Bad Request');
  37327. return;
  37328. }
  37329. n /= spaces;
  37330. md5.update(String.fromCharCode(
  37331. n >> 24 & 0xFF,
  37332. n >> 16 & 0xFF,
  37333. n >> 8 & 0xFF,
  37334. n & 0xFF));
  37335. });
  37336. md5.update(nonce.toString('binary'));
  37337. socket.setTimeout(0);
  37338. socket.setNoDelay(true);
  37339. try {
  37340. var hashBuffer = new Buffer(md5.digest('binary'), 'binary');
  37341. var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length);
  37342. headerBuffer.copy(handshakeBuffer, 0);
  37343. hashBuffer.copy(handshakeBuffer, headerBuffer.length);
  37344. // do a single write, which - upon success - causes a new client websocket to be setup
  37345. socket.write(handshakeBuffer, 'binary', function(err) {
  37346. if (err) return; // do not create client if an error happens
  37347. var client = new WebSocket([req, socket, rest], {
  37348. protocolVersion: 'hixie-76',
  37349. protocol: protocol
  37350. });
  37351. if (self.options.clientTracking) {
  37352. self.clients.push(client);
  37353. client.on('close', function() {
  37354. var index = self.clients.indexOf(client);
  37355. if (index != -1) {
  37356. self.clients.splice(index, 1);
  37357. }
  37358. });
  37359. }
  37360. // signal upgrade complete
  37361. socket.removeListener('error', errorHandler);
  37362. cb(client);
  37363. });
  37364. }
  37365. catch (e) {
  37366. try { socket.destroy(); } catch (e) {}
  37367. return;
  37368. }
  37369. }
  37370. // retrieve nonce
  37371. var nonceLength = 8;
  37372. if (upgradeHead && upgradeHead.length >= nonceLength) {
  37373. var nonce = upgradeHead.slice(0, nonceLength);
  37374. var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null;
  37375. completeHandshake.call(self, nonce, rest, buildResponseHeader());
  37376. }
  37377. else {
  37378. // nonce not present in upgradeHead
  37379. var nonce = new Buffer(nonceLength);
  37380. upgradeHead.copy(nonce, 0);
  37381. var received = upgradeHead.length;
  37382. var rest = null;
  37383. var handler = function (data) {
  37384. var toRead = Math.min(data.length, nonceLength - received);
  37385. if (toRead === 0) return;
  37386. data.copy(nonce, received, 0, toRead);
  37387. received += toRead;
  37388. if (received == nonceLength) {
  37389. socket.removeListener('data', handler);
  37390. if (toRead < data.length) rest = data.slice(toRead);
  37391. // complete the handshake but send empty buffer for headers since they have already been sent
  37392. completeHandshake.call(self, nonce, rest, new Buffer(0));
  37393. }
  37394. }
  37395. // handle additional data as we receive it
  37396. socket.on('data', handler);
  37397. // send header response before we have the nonce to fix haproxy buffering
  37398. handshakeResponse();
  37399. }
  37400. }
  37401. // verify client
  37402. if (typeof this.options.verifyClient == 'function') {
  37403. var info = {
  37404. origin: origin,
  37405. secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined',
  37406. req: req
  37407. };
  37408. if (this.options.verifyClient.length == 2) {
  37409. var self = this;
  37410. this.options.verifyClient(info, function(result, code, name) {
  37411. if (typeof code === 'undefined') code = 401;
  37412. if (typeof name === 'undefined') name = http.STATUS_CODES[code];
  37413. if (!result) abortConnection(socket, code, name);
  37414. else onClientVerified.apply(self);
  37415. });
  37416. return;
  37417. }
  37418. else if (!this.options.verifyClient(info)) {
  37419. abortConnection(socket, 401, 'Unauthorized');
  37420. return;
  37421. }
  37422. }
  37423. // no client verification required
  37424. onClientVerified();
  37425. }
  37426. function acceptExtensions(offer) {
  37427. var extensions = {};
  37428. var options = this.options.perMessageDeflate;
  37429. var maxPayload = this.options.maxPayload;
  37430. if (options && offer[PerMessageDeflate.extensionName]) {
  37431. var perMessageDeflate = new PerMessageDeflate(options !== true ? options : {}, true, maxPayload);
  37432. perMessageDeflate.accept(offer[PerMessageDeflate.extensionName]);
  37433. extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
  37434. }
  37435. return extensions;
  37436. }
  37437. function abortConnection(socket, code, name) {
  37438. try {
  37439. var response = [
  37440. 'HTTP/1.1 ' + code + ' ' + name,
  37441. 'Content-type: text/html'
  37442. ];
  37443. socket.write(response.concat('', '').join('\r\n'));
  37444. }
  37445. catch (e) { /* ignore errors - we've aborted this connection */ }
  37446. finally {
  37447. // ensure that an early aborted connection is shut down completely
  37448. try { socket.destroy(); } catch (e) {}
  37449. }
  37450. }
  37451. });
  37452. return ___scope___.entry = "index.js";
  37453. });
  37454. FuseBox.pkg("util", {}, function(___scope___){
  37455. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  37456. /*
  37457. * Fork of https://raw.githubusercontent.com/defunctzombie/node-util
  37458. * inlining https://github.com/isaacs/inherits/blob/master/inherits_browser.js
  37459. */
  37460. // Copyright Joyent, Inc. and other Node contributors.
  37461. //
  37462. // Permission is hereby granted, free of charge, to any person obtaining a
  37463. // copy of this software and associated documentation files (the
  37464. // "Software"), to deal in the Software without restriction, including
  37465. // without limitation the rights to use, copy, modify, merge, publish,
  37466. // distribute, sublicense, and/or sell copies of the Software, and to permit
  37467. // persons to whom the Software is furnished to do so, subject to the
  37468. // following conditions:
  37469. //
  37470. // The above copyright notice and this permission notice shall be included
  37471. // in all copies or substantial portions of the Software.
  37472. //
  37473. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  37474. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  37475. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  37476. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  37477. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  37478. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  37479. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  37480. var process = require("process");
  37481. var formatRegExp = /%[sdj%]/g;
  37482. exports.format = function(f) {
  37483. if (!isString(f)) {
  37484. var objects = [];
  37485. for (var i = 0; i < arguments.length; i++) {
  37486. objects.push(inspect(arguments[i]));
  37487. }
  37488. return objects.join(" ");
  37489. }
  37490. var i = 1;
  37491. var args = arguments;
  37492. var len = args.length;
  37493. var str = String(f).replace(formatRegExp, function(x) {
  37494. if (x === "%%") return "%";
  37495. if (i >= len) return x;
  37496. switch (x) {
  37497. case "%s": return String(args[i++]);
  37498. case "%d": return Number(args[i++]);
  37499. case "%j":
  37500. try {
  37501. return JSON.stringify(args[i++]);
  37502. } catch (_) {
  37503. return "[Circular]";
  37504. }
  37505. default:
  37506. return x;
  37507. }
  37508. });
  37509. for (var x = args[i]; i < len; x = args[++i]) {
  37510. if (isNull(x) || !isObject(x)) {
  37511. str += " " + x;
  37512. } else {
  37513. str += " " + inspect(x);
  37514. }
  37515. }
  37516. return str;
  37517. };
  37518. // Mark that a method should not be used.
  37519. // Returns a modified function which warns once by default.
  37520. // If --no-deprecation is set, then it is a no-op.
  37521. exports.deprecate = function(fn, msg) {
  37522. // Allow for deprecating things in the process of starting up.
  37523. if (isUndefined(global.process)) {
  37524. return function() {
  37525. return exports.deprecate(fn, msg).apply(this, arguments);
  37526. };
  37527. }
  37528. if (process.noDeprecation === true) {
  37529. return fn;
  37530. }
  37531. var warned = false;
  37532. function deprecated() {
  37533. if (!warned) {
  37534. if (process.throwDeprecation) {
  37535. throw new Error(msg);
  37536. } else if (process.traceDeprecation) {
  37537. console.trace(msg);
  37538. } else {
  37539. console.error(msg);
  37540. }
  37541. warned = true;
  37542. }
  37543. return fn.apply(this, arguments);
  37544. }
  37545. return deprecated;
  37546. };
  37547. var debugs = {};
  37548. var debugEnviron;
  37549. exports.debuglog = function(set) {
  37550. if (isUndefined(debugEnviron))
  37551. debugEnviron = process.env.NODE_DEBUG || "";
  37552. set = set.toUpperCase();
  37553. if (!debugs[set]) {
  37554. if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) {
  37555. var pid = process.pid;
  37556. debugs[set] = function() {
  37557. var msg = exports.format.apply(exports, arguments);
  37558. console.error("%s %d: %s", set, pid, msg);
  37559. };
  37560. } else {
  37561. debugs[set] = function() {};
  37562. }
  37563. }
  37564. return debugs[set];
  37565. };
  37566. /**
  37567. * Echos the value of a value. Trys to print the value out
  37568. * in the best way possible given the different types.
  37569. *
  37570. * @param {Object} obj The object to print out.
  37571. * @param {Object} opts Optional options object that alters the output.
  37572. */
  37573. /* legacy: obj, showHidden, depth, colors*/
  37574. function inspect(obj, opts) {
  37575. // default options
  37576. var ctx = {
  37577. seen: [],
  37578. stylize: stylizeNoColor,
  37579. };
  37580. // legacy...
  37581. if (arguments.length >= 3) ctx.depth = arguments[2];
  37582. if (arguments.length >= 4) ctx.colors = arguments[3];
  37583. if (isBoolean(opts)) {
  37584. // legacy...
  37585. ctx.showHidden = opts;
  37586. } else if (opts) {
  37587. // got an "options" object
  37588. exports._extend(ctx, opts);
  37589. }
  37590. // set default options
  37591. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  37592. if (isUndefined(ctx.depth)) ctx.depth = 2;
  37593. if (isUndefined(ctx.colors)) ctx.colors = false;
  37594. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  37595. if (ctx.colors) ctx.stylize = stylizeWithColor;
  37596. return formatValue(ctx, obj, ctx.depth);
  37597. }
  37598. exports.inspect = inspect;
  37599. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  37600. inspect.colors = {
  37601. "bold" : [1, 22],
  37602. "italic" : [3, 23],
  37603. "underline" : [4, 24],
  37604. "inverse" : [7, 27],
  37605. "white" : [37, 39],
  37606. "grey" : [90, 39],
  37607. "black" : [30, 39],
  37608. "blue" : [34, 39],
  37609. "cyan" : [36, 39],
  37610. "green" : [32, 39],
  37611. "magenta" : [35, 39],
  37612. "red" : [31, 39],
  37613. "yellow" : [33, 39],
  37614. };
  37615. // Don't use 'blue' not visible on cmd.exe
  37616. inspect.styles = {
  37617. "special": "cyan",
  37618. "number": "yellow",
  37619. "boolean": "yellow",
  37620. "undefined": "grey",
  37621. "null": "bold",
  37622. "string": "green",
  37623. "date": "magenta",
  37624. // "name": intentionally not styling
  37625. "regexp": "red",
  37626. };
  37627. function stylizeWithColor(str, styleType) {
  37628. var style = inspect.styles[styleType];
  37629. if (style) {
  37630. return "\u001b[" + inspect.colors[style][0] + "m" + str +
  37631. "\u001b[" + inspect.colors[style][1] + "m";
  37632. } else {
  37633. return str;
  37634. }
  37635. }
  37636. function stylizeNoColor(str, styleType) {
  37637. return str;
  37638. }
  37639. function arrayToHash(array) {
  37640. var hash = {};
  37641. array.forEach(function(val, idx) {
  37642. hash[val] = true;
  37643. });
  37644. return hash;
  37645. }
  37646. function formatValue(ctx, value, recurseTimes) {
  37647. // Provide a hook for user-specified inspect functions.
  37648. // Check that value is an object with an inspect function on it
  37649. if (ctx.customInspect &&
  37650. value &&
  37651. isFunction(value.inspect) &&
  37652. // Filter out the util module, it's inspect function is special
  37653. value.inspect !== exports.inspect &&
  37654. // Also filter out any prototype objects using the circular check.
  37655. !(value.constructor && value.constructor.prototype === value)) {
  37656. var ret = value.inspect(recurseTimes, ctx);
  37657. if (!isString(ret)) {
  37658. ret = formatValue(ctx, ret, recurseTimes);
  37659. }
  37660. return ret;
  37661. }
  37662. // Primitive types cannot have properties
  37663. var primitive = formatPrimitive(ctx, value);
  37664. if (primitive) {
  37665. return primitive;
  37666. }
  37667. // Look up the keys of the object.
  37668. var keys = Object.keys(value);
  37669. var visibleKeys = arrayToHash(keys);
  37670. if (ctx.showHidden) {
  37671. keys = Object.getOwnPropertyNames(value);
  37672. }
  37673. // IE doesn't make error fields non-enumerable
  37674. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  37675. if (isError(value)
  37676. && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
  37677. return formatError(value);
  37678. }
  37679. // Some type of object without properties can be shortcutted.
  37680. if (keys.length === 0) {
  37681. if (isFunction(value)) {
  37682. var name = value.name ? ": " + value.name : "";
  37683. return ctx.stylize("[Function" + name + "]", "special");
  37684. }
  37685. if (isRegExp(value)) {
  37686. return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
  37687. }
  37688. if (isDate(value)) {
  37689. return ctx.stylize(Date.prototype.toString.call(value), "date");
  37690. }
  37691. if (isError(value)) {
  37692. return formatError(value);
  37693. }
  37694. }
  37695. var base = "", array = false, braces = ["{", "}"];
  37696. // Make Array say that they are Array
  37697. if (isArray(value)) {
  37698. array = true;
  37699. braces = ["[", "]"];
  37700. }
  37701. // Make functions say that they are functions
  37702. if (isFunction(value)) {
  37703. var n = value.name ? ": " + value.name : "";
  37704. base = " [Function" + n + "]";
  37705. }
  37706. // Make RegExps say that they are RegExps
  37707. if (isRegExp(value)) {
  37708. base = " " + RegExp.prototype.toString.call(value);
  37709. }
  37710. // Make dates with properties first say the date
  37711. if (isDate(value)) {
  37712. base = " " + Date.prototype.toUTCString.call(value);
  37713. }
  37714. // Make error with message first say the error
  37715. if (isError(value)) {
  37716. base = " " + formatError(value);
  37717. }
  37718. if (keys.length === 0 && (!array || value.length == 0)) {
  37719. return braces[0] + base + braces[1];
  37720. }
  37721. if (recurseTimes < 0) {
  37722. if (isRegExp(value)) {
  37723. return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
  37724. } else {
  37725. return ctx.stylize("[Object]", "special");
  37726. }
  37727. }
  37728. ctx.seen.push(value);
  37729. var output;
  37730. if (array) {
  37731. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  37732. } else {
  37733. output = keys.map(function(key) {
  37734. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  37735. });
  37736. }
  37737. ctx.seen.pop();
  37738. return reduceToSingleString(output, base, braces);
  37739. }
  37740. function formatPrimitive(ctx, value) {
  37741. if (isUndefined(value))
  37742. return ctx.stylize("undefined", "undefined");
  37743. if (isString(value)) {
  37744. var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "")
  37745. .replace(/'/g, "\\'")
  37746. .replace(/\\"/g, "\"") + "'";
  37747. return ctx.stylize(simple, "string");
  37748. }
  37749. if (isNumber(value))
  37750. return ctx.stylize("" + value, "number");
  37751. if (isBoolean(value))
  37752. return ctx.stylize("" + value, "boolean");
  37753. // For some reason typeof null is "object", so special case here.
  37754. if (isNull(value))
  37755. return ctx.stylize("null", "null");
  37756. }
  37757. function formatError(value) {
  37758. return "[" + Error.prototype.toString.call(value) + "]";
  37759. }
  37760. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  37761. var output = [];
  37762. for (var i = 0, l = value.length; i < l; ++i) {
  37763. if (hasOwnProperty(value, String(i))) {
  37764. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  37765. String(i), true));
  37766. } else {
  37767. output.push("");
  37768. }
  37769. }
  37770. keys.forEach(function(key) {
  37771. if (!key.match(/^\d+$/)) {
  37772. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  37773. key, true));
  37774. }
  37775. });
  37776. return output;
  37777. }
  37778. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  37779. var name, str, desc;
  37780. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  37781. if (desc.get) {
  37782. if (desc.set) {
  37783. str = ctx.stylize("[Getter/Setter]", "special");
  37784. } else {
  37785. str = ctx.stylize("[Getter]", "special");
  37786. }
  37787. } else {
  37788. if (desc.set) {
  37789. str = ctx.stylize("[Setter]", "special");
  37790. }
  37791. }
  37792. if (!hasOwnProperty(visibleKeys, key)) {
  37793. name = "[" + key + "]";
  37794. }
  37795. if (!str) {
  37796. if (ctx.seen.indexOf(desc.value) < 0) {
  37797. if (isNull(recurseTimes)) {
  37798. str = formatValue(ctx, desc.value, null);
  37799. } else {
  37800. str = formatValue(ctx, desc.value, recurseTimes - 1);
  37801. }
  37802. if (str.indexOf("\n") > -1) {
  37803. if (array) {
  37804. str = str.split("\n").map(function(line) {
  37805. return " " + line;
  37806. }).join("\n").substr(2);
  37807. } else {
  37808. str = "\n" + str.split("\n").map(function(line) {
  37809. return " " + line;
  37810. }).join("\n");
  37811. }
  37812. }
  37813. } else {
  37814. str = ctx.stylize("[Circular]", "special");
  37815. }
  37816. }
  37817. if (isUndefined(name)) {
  37818. if (array && key.match(/^\d+$/)) {
  37819. return str;
  37820. }
  37821. name = JSON.stringify("" + key);
  37822. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  37823. name = name.substr(1, name.length - 2);
  37824. name = ctx.stylize(name, "name");
  37825. } else {
  37826. name = name.replace(/'/g, "\\'")
  37827. .replace(/\\"/g, "\"")
  37828. .replace(/(^"|"$)/g, "'");
  37829. name = ctx.stylize(name, "string");
  37830. }
  37831. }
  37832. return name + ": " + str;
  37833. }
  37834. function reduceToSingleString(output, base, braces) {
  37835. var numLinesEst = 0;
  37836. var length = output.reduce(function(prev, cur) {
  37837. numLinesEst++;
  37838. if (cur.indexOf("\n") >= 0) numLinesEst++;
  37839. return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
  37840. }, 0);
  37841. if (length > 60) {
  37842. return braces[0] +
  37843. (base === "" ? "" : base + "\n ") +
  37844. " " +
  37845. output.join(",\n ") +
  37846. " " +
  37847. braces[1];
  37848. }
  37849. return braces[0] + base + " " + output.join(", ") + " " + braces[1];
  37850. }
  37851. // NOTE: These type checking functions intentionally don't use `instanceof`
  37852. // because it is fragile and can be easily faked with `Object.create()`.
  37853. function isArray(ar) {
  37854. return Array.isArray(ar);
  37855. }
  37856. exports.isArray = isArray;
  37857. function isBoolean(arg) {
  37858. return typeof arg === "boolean";
  37859. }
  37860. exports.isBoolean = isBoolean;
  37861. function isNull(arg) {
  37862. return arg === null;
  37863. }
  37864. exports.isNull = isNull;
  37865. function isNullOrUndefined(arg) {
  37866. return arg == null;
  37867. }
  37868. exports.isNullOrUndefined = isNullOrUndefined;
  37869. function isNumber(arg) {
  37870. return typeof arg === "number";
  37871. }
  37872. exports.isNumber = isNumber;
  37873. function isString(arg) {
  37874. return typeof arg === "string";
  37875. }
  37876. exports.isString = isString;
  37877. function isSymbol(arg) {
  37878. return typeof arg === "symbol";
  37879. }
  37880. exports.isSymbol = isSymbol;
  37881. function isUndefined(arg) {
  37882. return arg === void 0;
  37883. }
  37884. exports.isUndefined = isUndefined;
  37885. function isRegExp(re) {
  37886. return isObject(re) && objectToString(re) === "[object RegExp]";
  37887. }
  37888. exports.isRegExp = isRegExp;
  37889. function isObject(arg) {
  37890. return typeof arg === "object" && arg !== null;
  37891. }
  37892. exports.isObject = isObject;
  37893. function isDate(d) {
  37894. return isObject(d) && objectToString(d) === "[object Date]";
  37895. }
  37896. exports.isDate = isDate;
  37897. function isError(e) {
  37898. return isObject(e) &&
  37899. (objectToString(e) === "[object Error]" || e instanceof Error);
  37900. }
  37901. exports.isError = isError;
  37902. function isFunction(arg) {
  37903. return typeof arg === "function";
  37904. }
  37905. exports.isFunction = isFunction;
  37906. function isPrimitive(arg) {
  37907. return arg === null ||
  37908. typeof arg === "boolean" ||
  37909. typeof arg === "number" ||
  37910. typeof arg === "string" ||
  37911. typeof arg === "symbol" || // ES6 symbol
  37912. typeof arg === "undefined";
  37913. }
  37914. exports.isPrimitive = isPrimitive;
  37915. exports.isBuffer = require("./isBuffer.js");
  37916. function objectToString(o) {
  37917. return Object.prototype.toString.call(o);
  37918. }
  37919. function pad(n) {
  37920. return n < 10 ? "0" + n.toString(10) : n.toString(10);
  37921. }
  37922. var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
  37923. "Oct", "Nov", "Dec"];
  37924. // 26 Feb 16:19:34
  37925. function timestamp() {
  37926. var d = new Date();
  37927. var time = [pad(d.getHours()),
  37928. pad(d.getMinutes()),
  37929. pad(d.getSeconds())].join(":");
  37930. return [d.getDate(), months[d.getMonth()], time].join(" ");
  37931. }
  37932. // log is just a thin wrapper to console.log that prepends a timestamp
  37933. exports.log = function() {
  37934. console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments));
  37935. };
  37936. /**
  37937. * Inherit the prototype methods from one constructor into another.
  37938. *
  37939. * The Function.prototype.inherits from lang.js rewritten as a standalone
  37940. * function (not on Function.prototype). NOTE: If this file is to be loaded
  37941. * during bootstrapping this function needs to be rewritten using some native
  37942. * functions as prototype setup using normal JavaScript does not work as
  37943. * expected during bootstrapping (see mirror.js in r114903).
  37944. *
  37945. * @param {function} ctor Constructor function which needs to inherit the
  37946. * prototype.
  37947. * @param {function} superCtor Constructor function to inherit prototype from.
  37948. */
  37949. if (typeof Object.create === "function") {
  37950. // implementation from standard node.js 'util' module
  37951. exports.inherits = function inherits(ctor, superCtor) {
  37952. ctor.super_ = superCtor;
  37953. ctor.prototype = Object.create(superCtor.prototype, {
  37954. constructor: {
  37955. value: ctor,
  37956. enumerable: false,
  37957. writable: true,
  37958. configurable: true,
  37959. },
  37960. });
  37961. };
  37962. } else {
  37963. // old school shim for old browsers
  37964. exports.inherits = function inherits(ctor, superCtor) {
  37965. ctor.super_ = superCtor;
  37966. var TempCtor = function() {};
  37967. TempCtor.prototype = superCtor.prototype;
  37968. ctor.prototype = new TempCtor();
  37969. ctor.prototype.constructor = ctor;
  37970. };
  37971. }
  37972. exports._extend = function(origin, add) {
  37973. // Don't do anything if add isn't an object
  37974. if (!add || !isObject(add)) return origin;
  37975. var keys = Object.keys(add);
  37976. var i = keys.length;
  37977. while (i--) {
  37978. origin[keys[i]] = add[keys[i]];
  37979. }
  37980. return origin;
  37981. };
  37982. function hasOwnProperty(obj, prop) {
  37983. return Object.prototype.hasOwnProperty.call(obj, prop);
  37984. }
  37985. });
  37986. ___scope___.file("isBuffer.js", function(exports, require, module, __filename, __dirname){
  37987. /* fuse:injection: */ var Buffer = require("buffer").Buffer;
  37988. /*
  37989. * From https://github.com/defunctzombie/node-util/blob/master/support/isBuffer.js
  37990. */
  37991. module.exports = function isBuffer(arg) {
  37992. if (typeof Buffer !== "undefined") {
  37993. return arg instanceof Buffer;
  37994. } else {
  37995. return arg && typeof arg === "object"
  37996. && typeof arg.copy === "function"
  37997. && typeof arg.fill === "function"
  37998. && typeof arg.readUInt8 === "function";
  37999. }
  38000. };
  38001. });
  38002. return ___scope___.entry = "index.js";
  38003. });
  38004. FuseBox.pkg("crypto", {}, function(___scope___){
  38005. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38006. if (FuseBox.isServer) {
  38007. module.exports = global.require("crypto");
  38008. } else {
  38009. module.exports = {};
  38010. }
  38011. });
  38012. return ___scope___.entry = "index.js";
  38013. });
  38014. FuseBox.pkg("stream", {}, function(___scope___){
  38015. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38016. if (FuseBox.isServer) {
  38017. module.exports = global.require("stream");
  38018. } else {
  38019. module.exports = {};
  38020. }
  38021. });
  38022. return ___scope___.entry = "index.js";
  38023. });
  38024. FuseBox.pkg("ultron", {}, function(___scope___){
  38025. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38026. 'use strict';
  38027. var has = Object.prototype.hasOwnProperty;
  38028. /**
  38029. * An auto incrementing id which we can use to create "unique" Ultron instances
  38030. * so we can track the event emitters that are added through the Ultron
  38031. * interface.
  38032. *
  38033. * @type {Number}
  38034. * @private
  38035. */
  38036. var id = 0;
  38037. /**
  38038. * Ultron is high-intelligence robot. It gathers intelligence so it can start improving
  38039. * upon his rudimentary design. It will learn from your EventEmitting patterns
  38040. * and exterminate them.
  38041. *
  38042. * @constructor
  38043. * @param {EventEmitter} ee EventEmitter instance we need to wrap.
  38044. * @api public
  38045. */
  38046. function Ultron(ee) {
  38047. if (!(this instanceof Ultron)) return new Ultron(ee);
  38048. this.id = id++;
  38049. this.ee = ee;
  38050. }
  38051. /**
  38052. * Register a new EventListener for the given event.
  38053. *
  38054. * @param {String} event Name of the event.
  38055. * @param {Functon} fn Callback function.
  38056. * @param {Mixed} context The context of the function.
  38057. * @returns {Ultron}
  38058. * @api public
  38059. */
  38060. Ultron.prototype.on = function on(event, fn, context) {
  38061. fn.__ultron = this.id;
  38062. this.ee.on(event, fn, context);
  38063. return this;
  38064. };
  38065. /**
  38066. * Add an EventListener that's only called once.
  38067. *
  38068. * @param {String} event Name of the event.
  38069. * @param {Function} fn Callback function.
  38070. * @param {Mixed} context The context of the function.
  38071. * @returns {Ultron}
  38072. * @api public
  38073. */
  38074. Ultron.prototype.once = function once(event, fn, context) {
  38075. fn.__ultron = this.id;
  38076. this.ee.once(event, fn, context);
  38077. return this;
  38078. };
  38079. /**
  38080. * Remove the listeners we assigned for the given event.
  38081. *
  38082. * @returns {Ultron}
  38083. * @api public
  38084. */
  38085. Ultron.prototype.remove = function remove() {
  38086. var args = arguments
  38087. , event;
  38088. //
  38089. // When no event names are provided we assume that we need to clear all the
  38090. // events that were assigned through us.
  38091. //
  38092. if (args.length === 1 && 'string' === typeof args[0]) {
  38093. args = args[0].split(/[, ]+/);
  38094. } else if (!args.length) {
  38095. args = [];
  38096. for (event in this.ee._events) {
  38097. if (has.call(this.ee._events, event)) args.push(event);
  38098. }
  38099. }
  38100. for (var i = 0; i < args.length; i++) {
  38101. var listeners = this.ee.listeners(args[i]);
  38102. for (var j = 0; j < listeners.length; j++) {
  38103. event = listeners[j];
  38104. //
  38105. // Once listeners have a `listener` property that stores the real listener
  38106. // in the EventEmitter that ships with Node.js.
  38107. //
  38108. if (event.listener) {
  38109. if (event.listener.__ultron !== this.id) continue;
  38110. delete event.listener.__ultron;
  38111. } else {
  38112. if (event.__ultron !== this.id) continue;
  38113. delete event.__ultron;
  38114. }
  38115. this.ee.removeListener(args[i], event);
  38116. }
  38117. }
  38118. return this;
  38119. };
  38120. /**
  38121. * Destroy the Ultron instance, remove all listeners and release all references.
  38122. *
  38123. * @returns {Boolean}
  38124. * @api public
  38125. */
  38126. Ultron.prototype.destroy = function destroy() {
  38127. if (!this.ee) return false;
  38128. this.remove();
  38129. this.ee = null;
  38130. return true;
  38131. };
  38132. //
  38133. // Expose the module.
  38134. //
  38135. module.exports = Ultron;
  38136. });
  38137. return ___scope___.entry = "index.js";
  38138. });
  38139. FuseBox.pkg("options", {}, function(___scope___){
  38140. ___scope___.file("lib/options.js", function(exports, require, module, __filename, __dirname){
  38141. /*!
  38142. * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  38143. * MIT Licensed
  38144. */
  38145. var fs = require('fs');
  38146. function Options(defaults) {
  38147. var internalValues = {};
  38148. var values = this.value = {};
  38149. Object.keys(defaults).forEach(function(key) {
  38150. internalValues[key] = defaults[key];
  38151. Object.defineProperty(values, key, {
  38152. get: function() { return internalValues[key]; },
  38153. configurable: false,
  38154. enumerable: true
  38155. });
  38156. });
  38157. this.reset = function() {
  38158. Object.keys(defaults).forEach(function(key) {
  38159. internalValues[key] = defaults[key];
  38160. });
  38161. return this;
  38162. };
  38163. this.merge = function(options, required) {
  38164. options = options || {};
  38165. if (Object.prototype.toString.call(required) === '[object Array]') {
  38166. var missing = [];
  38167. for (var i = 0, l = required.length; i < l; ++i) {
  38168. var key = required[i];
  38169. if (!(key in options)) {
  38170. missing.push(key);
  38171. }
  38172. }
  38173. if (missing.length > 0) {
  38174. if (missing.length > 1) {
  38175. throw new Error('options ' +
  38176. missing.slice(0, missing.length - 1).join(', ') + ' and ' +
  38177. missing[missing.length - 1] + ' must be defined');
  38178. }
  38179. else throw new Error('option ' + missing[0] + ' must be defined');
  38180. }
  38181. }
  38182. Object.keys(options).forEach(function(key) {
  38183. if (key in internalValues) {
  38184. internalValues[key] = options[key];
  38185. }
  38186. });
  38187. return this;
  38188. };
  38189. this.copy = function(keys) {
  38190. var obj = {};
  38191. Object.keys(defaults).forEach(function(key) {
  38192. if (keys.indexOf(key) !== -1) {
  38193. obj[key] = values[key];
  38194. }
  38195. });
  38196. return obj;
  38197. };
  38198. this.read = function(filename, cb) {
  38199. if (typeof cb == 'function') {
  38200. var self = this;
  38201. fs.readFile(filename, function(error, data) {
  38202. if (error) return cb(error);
  38203. var conf = JSON.parse(data);
  38204. self.merge(conf);
  38205. cb();
  38206. });
  38207. }
  38208. else {
  38209. var conf = JSON.parse(fs.readFileSync(filename));
  38210. this.merge(conf);
  38211. }
  38212. return this;
  38213. };
  38214. this.isDefined = function(key) {
  38215. return typeof values[key] != 'undefined';
  38216. };
  38217. this.isDefinedAndNonNull = function(key) {
  38218. return typeof values[key] != 'undefined' && values[key] !== null;
  38219. };
  38220. Object.freeze(values);
  38221. Object.freeze(this);
  38222. }
  38223. module.exports = Options;
  38224. });
  38225. return ___scope___.entry = "lib/options.js";
  38226. });
  38227. FuseBox.pkg("zlib", {}, function(___scope___){
  38228. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38229. if (FuseBox.isServer) {
  38230. module.exports = global.require("zlib");
  38231. } else {
  38232. module.exports = {};
  38233. }
  38234. });
  38235. return ___scope___.entry = "index.js";
  38236. });
  38237. FuseBox.pkg("tls", {}, function(___scope___){
  38238. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38239. if (FuseBox.isServer) {
  38240. module.exports = global.require("tls");
  38241. } else {
  38242. module.exports = {};
  38243. }
  38244. });
  38245. return ___scope___.entry = "index.js";
  38246. });
  38247. FuseBox.pkg("indexof", {}, function(___scope___){
  38248. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38249. var indexOf = [].indexOf;
  38250. module.exports = function(arr, obj){
  38251. if (indexOf) return arr.indexOf(obj);
  38252. for (var i = 0; i < arr.length; ++i) {
  38253. if (arr[i] === obj) return i;
  38254. }
  38255. return -1;
  38256. };
  38257. });
  38258. return ___scope___.entry = "index.js";
  38259. });
  38260. FuseBox.pkg("parsejson", {}, function(___scope___){
  38261. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38262. /**
  38263. * JSON parse.
  38264. *
  38265. * @see Based on jQuery#parseJSON (MIT) and JSON2
  38266. * @api private
  38267. */
  38268. var rvalidchars = /^[\],:{}\s]*$/;
  38269. var rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
  38270. var rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
  38271. var rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g;
  38272. var rtrimLeft = /^\s+/;
  38273. var rtrimRight = /\s+$/;
  38274. module.exports = function parsejson(data) {
  38275. if ('string' != typeof data || !data) {
  38276. return null;
  38277. }
  38278. data = data.replace(rtrimLeft, '').replace(rtrimRight, '');
  38279. // Attempt to parse using the native JSON parser first
  38280. if (global.JSON && JSON.parse) {
  38281. return JSON.parse(data);
  38282. }
  38283. if (rvalidchars.test(data.replace(rvalidescape, '@')
  38284. .replace(rvalidtokens, ']')
  38285. .replace(rvalidbraces, ''))) {
  38286. return (new Function('return ' + data))();
  38287. }
  38288. };
  38289. });
  38290. return ___scope___.entry = "index.js";
  38291. });
  38292. FuseBox.pkg("to-array", {}, function(___scope___){
  38293. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38294. module.exports = toArray
  38295. function toArray(list, index) {
  38296. var array = []
  38297. index = index || 0
  38298. for (var i = index || 0; i < list.length; i++) {
  38299. array[i - index] = list[i]
  38300. }
  38301. return array
  38302. }
  38303. });
  38304. return ___scope___.entry = "index.js";
  38305. });
  38306. FuseBox.pkg("component-bind", {}, function(___scope___){
  38307. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38308. /**
  38309. * Slice reference.
  38310. */
  38311. var slice = [].slice;
  38312. /**
  38313. * Bind `obj` to `fn`.
  38314. *
  38315. * @param {Object} obj
  38316. * @param {Function|String} fn or string
  38317. * @return {Function}
  38318. * @api public
  38319. */
  38320. module.exports = function(obj, fn){
  38321. if ('string' == typeof fn) fn = obj[fn];
  38322. if ('function' != typeof fn) throw new Error('bind() requires a function');
  38323. var args = slice.call(arguments, 2);
  38324. return function(){
  38325. return fn.apply(obj, args.concat(slice.call(arguments)));
  38326. }
  38327. };
  38328. });
  38329. return ___scope___.entry = "index.js";
  38330. });
  38331. FuseBox.pkg("backo2", {}, function(___scope___){
  38332. ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
  38333. /**
  38334. * Expose `Backoff`.
  38335. */
  38336. module.exports = Backoff;
  38337. /**
  38338. * Initialize backoff timer with `opts`.
  38339. *
  38340. * - `min` initial timeout in milliseconds [100]
  38341. * - `max` max timeout [10000]
  38342. * - `jitter` [0]
  38343. * - `factor` [2]
  38344. *
  38345. * @param {Object} opts
  38346. * @api public
  38347. */
  38348. function Backoff(opts) {
  38349. opts = opts || {};
  38350. this.ms = opts.min || 100;
  38351. this.max = opts.max || 10000;
  38352. this.factor = opts.factor || 2;
  38353. this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
  38354. this.attempts = 0;
  38355. }
  38356. /**
  38357. * Return the backoff duration.
  38358. *
  38359. * @return {Number}
  38360. * @api public
  38361. */
  38362. Backoff.prototype.duration = function(){
  38363. var ms = this.ms * Math.pow(this.factor, this.attempts++);
  38364. if (this.jitter) {
  38365. var rand = Math.random();
  38366. var deviation = Math.floor(rand * this.jitter * ms);
  38367. ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
  38368. }
  38369. return Math.min(ms, this.max) | 0;
  38370. };
  38371. /**
  38372. * Reset the number of attempts.
  38373. *
  38374. * @api public
  38375. */
  38376. Backoff.prototype.reset = function(){
  38377. this.attempts = 0;
  38378. };
  38379. /**
  38380. * Set the minimum duration
  38381. *
  38382. * @api public
  38383. */
  38384. Backoff.prototype.setMin = function(min){
  38385. this.ms = min;
  38386. };
  38387. /**
  38388. * Set the maximum duration
  38389. *
  38390. * @api public
  38391. */
  38392. Backoff.prototype.setMax = function(max){
  38393. this.max = max;
  38394. };
  38395. /**
  38396. * Set the jitter
  38397. *
  38398. * @api public
  38399. */
  38400. Backoff.prototype.setJitter = function(jitter){
  38401. this.jitter = jitter;
  38402. };
  38403. });
  38404. return ___scope___.entry = "index.js";
  38405. });
  38406. FuseBox.pkg("vue", {}, function(___scope___){
  38407. ___scope___.file("dist/vue.js", function(exports, require, module, __filename, __dirname){
  38408. /*!
  38409. * Vue.js v2.2.5
  38410. * (c) 2014-2017 Evan You
  38411. * Released under the MIT License.
  38412. */
  38413. (function (global, factory) {
  38414. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  38415. typeof define === 'function' && define.amd ? define(factory) :
  38416. (global.Vue = factory());
  38417. }(this, (function () { 'use strict';
  38418. /* */
  38419. /**
  38420. * Convert a value to a string that is actually rendered.
  38421. */
  38422. function _toString (val) {
  38423. return val == null
  38424. ? ''
  38425. : typeof val === 'object'
  38426. ? JSON.stringify(val, null, 2)
  38427. : String(val)
  38428. }
  38429. /**
  38430. * Convert a input value to a number for persistence.
  38431. * If the conversion fails, return original string.
  38432. */
  38433. function toNumber (val) {
  38434. var n = parseFloat(val);
  38435. return isNaN(n) ? val : n
  38436. }
  38437. /**
  38438. * Make a map and return a function for checking if a key
  38439. * is in that map.
  38440. */
  38441. function makeMap (
  38442. str,
  38443. expectsLowerCase
  38444. ) {
  38445. var map = Object.create(null);
  38446. var list = str.split(',');
  38447. for (var i = 0; i < list.length; i++) {
  38448. map[list[i]] = true;
  38449. }
  38450. return expectsLowerCase
  38451. ? function (val) { return map[val.toLowerCase()]; }
  38452. : function (val) { return map[val]; }
  38453. }
  38454. /**
  38455. * Check if a tag is a built-in tag.
  38456. */
  38457. var isBuiltInTag = makeMap('slot,component', true);
  38458. /**
  38459. * Remove an item from an array
  38460. */
  38461. function remove (arr, item) {
  38462. if (arr.length) {
  38463. var index = arr.indexOf(item);
  38464. if (index > -1) {
  38465. return arr.splice(index, 1)
  38466. }
  38467. }
  38468. }
  38469. /**
  38470. * Check whether the object has the property.
  38471. */
  38472. var hasOwnProperty = Object.prototype.hasOwnProperty;
  38473. function hasOwn (obj, key) {
  38474. return hasOwnProperty.call(obj, key)
  38475. }
  38476. /**
  38477. * Check if value is primitive
  38478. */
  38479. function isPrimitive (value) {
  38480. return typeof value === 'string' || typeof value === 'number'
  38481. }
  38482. /**
  38483. * Create a cached version of a pure function.
  38484. */
  38485. function cached (fn) {
  38486. var cache = Object.create(null);
  38487. return (function cachedFn (str) {
  38488. var hit = cache[str];
  38489. return hit || (cache[str] = fn(str))
  38490. })
  38491. }
  38492. /**
  38493. * Camelize a hyphen-delimited string.
  38494. */
  38495. var camelizeRE = /-(\w)/g;
  38496. var camelize = cached(function (str) {
  38497. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  38498. });
  38499. /**
  38500. * Capitalize a string.
  38501. */
  38502. var capitalize = cached(function (str) {
  38503. return str.charAt(0).toUpperCase() + str.slice(1)
  38504. });
  38505. /**
  38506. * Hyphenate a camelCase string.
  38507. */
  38508. var hyphenateRE = /([^-])([A-Z])/g;
  38509. var hyphenate = cached(function (str) {
  38510. return str
  38511. .replace(hyphenateRE, '$1-$2')
  38512. .replace(hyphenateRE, '$1-$2')
  38513. .toLowerCase()
  38514. });
  38515. /**
  38516. * Simple bind, faster than native
  38517. */
  38518. function bind (fn, ctx) {
  38519. function boundFn (a) {
  38520. var l = arguments.length;
  38521. return l
  38522. ? l > 1
  38523. ? fn.apply(ctx, arguments)
  38524. : fn.call(ctx, a)
  38525. : fn.call(ctx)
  38526. }
  38527. // record original fn length
  38528. boundFn._length = fn.length;
  38529. return boundFn
  38530. }
  38531. /**
  38532. * Convert an Array-like object to a real Array.
  38533. */
  38534. function toArray (list, start) {
  38535. start = start || 0;
  38536. var i = list.length - start;
  38537. var ret = new Array(i);
  38538. while (i--) {
  38539. ret[i] = list[i + start];
  38540. }
  38541. return ret
  38542. }
  38543. /**
  38544. * Mix properties into target object.
  38545. */
  38546. function extend (to, _from) {
  38547. for (var key in _from) {
  38548. to[key] = _from[key];
  38549. }
  38550. return to
  38551. }
  38552. /**
  38553. * Quick object check - this is primarily used to tell
  38554. * Objects from primitive values when we know the value
  38555. * is a JSON-compliant type.
  38556. */
  38557. function isObject (obj) {
  38558. return obj !== null && typeof obj === 'object'
  38559. }
  38560. /**
  38561. * Strict object type check. Only returns true
  38562. * for plain JavaScript objects.
  38563. */
  38564. var toString = Object.prototype.toString;
  38565. var OBJECT_STRING = '[object Object]';
  38566. function isPlainObject (obj) {
  38567. return toString.call(obj) === OBJECT_STRING
  38568. }
  38569. /**
  38570. * Merge an Array of Objects into a single Object.
  38571. */
  38572. function toObject (arr) {
  38573. var res = {};
  38574. for (var i = 0; i < arr.length; i++) {
  38575. if (arr[i]) {
  38576. extend(res, arr[i]);
  38577. }
  38578. }
  38579. return res
  38580. }
  38581. /**
  38582. * Perform no operation.
  38583. */
  38584. function noop () {}
  38585. /**
  38586. * Always return false.
  38587. */
  38588. var no = function () { return false; };
  38589. /**
  38590. * Return same value
  38591. */
  38592. var identity = function (_) { return _; };
  38593. /**
  38594. * Generate a static keys string from compiler modules.
  38595. */
  38596. function genStaticKeys (modules) {
  38597. return modules.reduce(function (keys, m) {
  38598. return keys.concat(m.staticKeys || [])
  38599. }, []).join(',')
  38600. }
  38601. /**
  38602. * Check if two values are loosely equal - that is,
  38603. * if they are plain objects, do they have the same shape?
  38604. */
  38605. function looseEqual (a, b) {
  38606. var isObjectA = isObject(a);
  38607. var isObjectB = isObject(b);
  38608. if (isObjectA && isObjectB) {
  38609. try {
  38610. return JSON.stringify(a) === JSON.stringify(b)
  38611. } catch (e) {
  38612. // possible circular reference
  38613. return a === b
  38614. }
  38615. } else if (!isObjectA && !isObjectB) {
  38616. return String(a) === String(b)
  38617. } else {
  38618. return false
  38619. }
  38620. }
  38621. function looseIndexOf (arr, val) {
  38622. for (var i = 0; i < arr.length; i++) {
  38623. if (looseEqual(arr[i], val)) { return i }
  38624. }
  38625. return -1
  38626. }
  38627. /**
  38628. * Ensure a function is called only once.
  38629. */
  38630. function once (fn) {
  38631. var called = false;
  38632. return function () {
  38633. if (!called) {
  38634. called = true;
  38635. fn();
  38636. }
  38637. }
  38638. }
  38639. /* */
  38640. var config = {
  38641. /**
  38642. * Option merge strategies (used in core/util/options)
  38643. */
  38644. optionMergeStrategies: Object.create(null),
  38645. /**
  38646. * Whether to suppress warnings.
  38647. */
  38648. silent: false,
  38649. /**
  38650. * Show production mode tip message on boot?
  38651. */
  38652. productionTip: "development" !== 'production',
  38653. /**
  38654. * Whether to enable devtools
  38655. */
  38656. devtools: "development" !== 'production',
  38657. /**
  38658. * Whether to record perf
  38659. */
  38660. performance: false,
  38661. /**
  38662. * Error handler for watcher errors
  38663. */
  38664. errorHandler: null,
  38665. /**
  38666. * Ignore certain custom elements
  38667. */
  38668. ignoredElements: [],
  38669. /**
  38670. * Custom user key aliases for v-on
  38671. */
  38672. keyCodes: Object.create(null),
  38673. /**
  38674. * Check if a tag is reserved so that it cannot be registered as a
  38675. * component. This is platform-dependent and may be overwritten.
  38676. */
  38677. isReservedTag: no,
  38678. /**
  38679. * Check if a tag is an unknown element.
  38680. * Platform-dependent.
  38681. */
  38682. isUnknownElement: no,
  38683. /**
  38684. * Get the namespace of an element
  38685. */
  38686. getTagNamespace: noop,
  38687. /**
  38688. * Parse the real tag name for the specific platform.
  38689. */
  38690. parsePlatformTagName: identity,
  38691. /**
  38692. * Check if an attribute must be bound using property, e.g. value
  38693. * Platform-dependent.
  38694. */
  38695. mustUseProp: no,
  38696. /**
  38697. * List of asset types that a component can own.
  38698. */
  38699. _assetTypes: [
  38700. 'component',
  38701. 'directive',
  38702. 'filter'
  38703. ],
  38704. /**
  38705. * List of lifecycle hooks.
  38706. */
  38707. _lifecycleHooks: [
  38708. 'beforeCreate',
  38709. 'created',
  38710. 'beforeMount',
  38711. 'mounted',
  38712. 'beforeUpdate',
  38713. 'updated',
  38714. 'beforeDestroy',
  38715. 'destroyed',
  38716. 'activated',
  38717. 'deactivated'
  38718. ],
  38719. /**
  38720. * Max circular updates allowed in a scheduler flush cycle.
  38721. */
  38722. _maxUpdateCount: 100
  38723. };
  38724. /* */
  38725. var emptyObject = Object.freeze({});
  38726. /**
  38727. * Check if a string starts with $ or _
  38728. */
  38729. function isReserved (str) {
  38730. var c = (str + '').charCodeAt(0);
  38731. return c === 0x24 || c === 0x5F
  38732. }
  38733. /**
  38734. * Define a property.
  38735. */
  38736. function def (obj, key, val, enumerable) {
  38737. Object.defineProperty(obj, key, {
  38738. value: val,
  38739. enumerable: !!enumerable,
  38740. writable: true,
  38741. configurable: true
  38742. });
  38743. }
  38744. /**
  38745. * Parse simple path.
  38746. */
  38747. var bailRE = /[^\w.$]/;
  38748. function parsePath (path) {
  38749. if (bailRE.test(path)) {
  38750. return
  38751. }
  38752. var segments = path.split('.');
  38753. return function (obj) {
  38754. for (var i = 0; i < segments.length; i++) {
  38755. if (!obj) { return }
  38756. obj = obj[segments[i]];
  38757. }
  38758. return obj
  38759. }
  38760. }
  38761. /* */
  38762. /* globals MutationObserver */
  38763. // can we use __proto__?
  38764. var hasProto = '__proto__' in {};
  38765. // Browser environment sniffing
  38766. var inBrowser = typeof window !== 'undefined';
  38767. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  38768. var isIE = UA && /msie|trident/.test(UA);
  38769. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  38770. var isEdge = UA && UA.indexOf('edge/') > 0;
  38771. var isAndroid = UA && UA.indexOf('android') > 0;
  38772. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  38773. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  38774. // this needs to be lazy-evaled because vue may be required before
  38775. // vue-server-renderer can set VUE_ENV
  38776. var _isServer;
  38777. var isServerRendering = function () {
  38778. if (_isServer === undefined) {
  38779. /* istanbul ignore if */
  38780. if (!inBrowser && typeof global !== 'undefined') {
  38781. // detect presence of vue-server-renderer and avoid
  38782. // Webpack shimming the process
  38783. _isServer = global['process'].env.VUE_ENV === 'server';
  38784. } else {
  38785. _isServer = false;
  38786. }
  38787. }
  38788. return _isServer
  38789. };
  38790. // detect devtools
  38791. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  38792. /* istanbul ignore next */
  38793. function isNative (Ctor) {
  38794. return /native code/.test(Ctor.toString())
  38795. }
  38796. var hasSymbol =
  38797. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  38798. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  38799. /**
  38800. * Defer a task to execute it asynchronously.
  38801. */
  38802. var nextTick = (function () {
  38803. var callbacks = [];
  38804. var pending = false;
  38805. var timerFunc;
  38806. function nextTickHandler () {
  38807. pending = false;
  38808. var copies = callbacks.slice(0);
  38809. callbacks.length = 0;
  38810. for (var i = 0; i < copies.length; i++) {
  38811. copies[i]();
  38812. }
  38813. }
  38814. // the nextTick behavior leverages the microtask queue, which can be accessed
  38815. // via either native Promise.then or MutationObserver.
  38816. // MutationObserver has wider support, however it is seriously bugged in
  38817. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  38818. // completely stops working after triggering a few times... so, if native
  38819. // Promise is available, we will use it:
  38820. /* istanbul ignore if */
  38821. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  38822. var p = Promise.resolve();
  38823. var logError = function (err) { console.error(err); };
  38824. timerFunc = function () {
  38825. p.then(nextTickHandler).catch(logError);
  38826. // in problematic UIWebViews, Promise.then doesn't completely break, but
  38827. // it can get stuck in a weird state where callbacks are pushed into the
  38828. // microtask queue but the queue isn't being flushed, until the browser
  38829. // needs to do some other work, e.g. handle a timer. Therefore we can
  38830. // "force" the microtask queue to be flushed by adding an empty timer.
  38831. if (isIOS) { setTimeout(noop); }
  38832. };
  38833. } else if (typeof MutationObserver !== 'undefined' && (
  38834. isNative(MutationObserver) ||
  38835. // PhantomJS and iOS 7.x
  38836. MutationObserver.toString() === '[object MutationObserverConstructor]'
  38837. )) {
  38838. // use MutationObserver where native Promise is not available,
  38839. // e.g. PhantomJS IE11, iOS7, Android 4.4
  38840. var counter = 1;
  38841. var observer = new MutationObserver(nextTickHandler);
  38842. var textNode = document.createTextNode(String(counter));
  38843. observer.observe(textNode, {
  38844. characterData: true
  38845. });
  38846. timerFunc = function () {
  38847. counter = (counter + 1) % 2;
  38848. textNode.data = String(counter);
  38849. };
  38850. } else {
  38851. // fallback to setTimeout
  38852. /* istanbul ignore next */
  38853. timerFunc = function () {
  38854. setTimeout(nextTickHandler, 0);
  38855. };
  38856. }
  38857. return function queueNextTick (cb, ctx) {
  38858. var _resolve;
  38859. callbacks.push(function () {
  38860. if (cb) { cb.call(ctx); }
  38861. if (_resolve) { _resolve(ctx); }
  38862. });
  38863. if (!pending) {
  38864. pending = true;
  38865. timerFunc();
  38866. }
  38867. if (!cb && typeof Promise !== 'undefined') {
  38868. return new Promise(function (resolve) {
  38869. _resolve = resolve;
  38870. })
  38871. }
  38872. }
  38873. })();
  38874. var _Set;
  38875. /* istanbul ignore if */
  38876. if (typeof Set !== 'undefined' && isNative(Set)) {
  38877. // use native Set when available.
  38878. _Set = Set;
  38879. } else {
  38880. // a non-standard Set polyfill that only works with primitive keys.
  38881. _Set = (function () {
  38882. function Set () {
  38883. this.set = Object.create(null);
  38884. }
  38885. Set.prototype.has = function has (key) {
  38886. return this.set[key] === true
  38887. };
  38888. Set.prototype.add = function add (key) {
  38889. this.set[key] = true;
  38890. };
  38891. Set.prototype.clear = function clear () {
  38892. this.set = Object.create(null);
  38893. };
  38894. return Set;
  38895. }());
  38896. }
  38897. var warn = noop;
  38898. var tip = noop;
  38899. var formatComponentName;
  38900. {
  38901. var hasConsole = typeof console !== 'undefined';
  38902. var classifyRE = /(?:^|[-_])(\w)/g;
  38903. var classify = function (str) { return str
  38904. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  38905. .replace(/[-_]/g, ''); };
  38906. warn = function (msg, vm) {
  38907. if (hasConsole && (!config.silent)) {
  38908. console.error("[Vue warn]: " + msg + " " + (
  38909. vm ? formatLocation(formatComponentName(vm)) : ''
  38910. ));
  38911. }
  38912. };
  38913. tip = function (msg, vm) {
  38914. if (hasConsole && (!config.silent)) {
  38915. console.warn("[Vue tip]: " + msg + " " + (
  38916. vm ? formatLocation(formatComponentName(vm)) : ''
  38917. ));
  38918. }
  38919. };
  38920. formatComponentName = function (vm, includeFile) {
  38921. if (vm.$root === vm) {
  38922. return '<Root>'
  38923. }
  38924. var name = typeof vm === 'string'
  38925. ? vm
  38926. : typeof vm === 'function' && vm.options
  38927. ? vm.options.name
  38928. : vm._isVue
  38929. ? vm.$options.name || vm.$options._componentTag
  38930. : vm.name;
  38931. var file = vm._isVue && vm.$options.__file;
  38932. if (!name && file) {
  38933. var match = file.match(/([^/\\]+)\.vue$/);
  38934. name = match && match[1];
  38935. }
  38936. return (
  38937. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  38938. (file && includeFile !== false ? (" at " + file) : '')
  38939. )
  38940. };
  38941. var formatLocation = function (str) {
  38942. if (str === "<Anonymous>") {
  38943. str += " - use the \"name\" option for better debugging messages.";
  38944. }
  38945. return ("\n(found in " + str + ")")
  38946. };
  38947. }
  38948. /* */
  38949. var uid$1 = 0;
  38950. /**
  38951. * A dep is an observable that can have multiple
  38952. * directives subscribing to it.
  38953. */
  38954. var Dep = function Dep () {
  38955. this.id = uid$1++;
  38956. this.subs = [];
  38957. };
  38958. Dep.prototype.addSub = function addSub (sub) {
  38959. this.subs.push(sub);
  38960. };
  38961. Dep.prototype.removeSub = function removeSub (sub) {
  38962. remove(this.subs, sub);
  38963. };
  38964. Dep.prototype.depend = function depend () {
  38965. if (Dep.target) {
  38966. Dep.target.addDep(this);
  38967. }
  38968. };
  38969. Dep.prototype.notify = function notify () {
  38970. // stabilize the subscriber list first
  38971. var subs = this.subs.slice();
  38972. for (var i = 0, l = subs.length; i < l; i++) {
  38973. subs[i].update();
  38974. }
  38975. };
  38976. // the current target watcher being evaluated.
  38977. // this is globally unique because there could be only one
  38978. // watcher being evaluated at any time.
  38979. Dep.target = null;
  38980. var targetStack = [];
  38981. function pushTarget (_target) {
  38982. if (Dep.target) { targetStack.push(Dep.target); }
  38983. Dep.target = _target;
  38984. }
  38985. function popTarget () {
  38986. Dep.target = targetStack.pop();
  38987. }
  38988. /*
  38989. * not type checking this file because flow doesn't play well with
  38990. * dynamically accessing methods on Array prototype
  38991. */
  38992. var arrayProto = Array.prototype;
  38993. var arrayMethods = Object.create(arrayProto);[
  38994. 'push',
  38995. 'pop',
  38996. 'shift',
  38997. 'unshift',
  38998. 'splice',
  38999. 'sort',
  39000. 'reverse'
  39001. ]
  39002. .forEach(function (method) {
  39003. // cache original method
  39004. var original = arrayProto[method];
  39005. def(arrayMethods, method, function mutator () {
  39006. var arguments$1 = arguments;
  39007. // avoid leaking arguments:
  39008. // http://jsperf.com/closure-with-arguments
  39009. var i = arguments.length;
  39010. var args = new Array(i);
  39011. while (i--) {
  39012. args[i] = arguments$1[i];
  39013. }
  39014. var result = original.apply(this, args);
  39015. var ob = this.__ob__;
  39016. var inserted;
  39017. switch (method) {
  39018. case 'push':
  39019. inserted = args;
  39020. break
  39021. case 'unshift':
  39022. inserted = args;
  39023. break
  39024. case 'splice':
  39025. inserted = args.slice(2);
  39026. break
  39027. }
  39028. if (inserted) { ob.observeArray(inserted); }
  39029. // notify change
  39030. ob.dep.notify();
  39031. return result
  39032. });
  39033. });
  39034. /* */
  39035. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  39036. /**
  39037. * By default, when a reactive property is set, the new value is
  39038. * also converted to become reactive. However when passing down props,
  39039. * we don't want to force conversion because the value may be a nested value
  39040. * under a frozen data structure. Converting it would defeat the optimization.
  39041. */
  39042. var observerState = {
  39043. shouldConvert: true,
  39044. isSettingProps: false
  39045. };
  39046. /**
  39047. * Observer class that are attached to each observed
  39048. * object. Once attached, the observer converts target
  39049. * object's property keys into getter/setters that
  39050. * collect dependencies and dispatches updates.
  39051. */
  39052. var Observer = function Observer (value) {
  39053. this.value = value;
  39054. this.dep = new Dep();
  39055. this.vmCount = 0;
  39056. def(value, '__ob__', this);
  39057. if (Array.isArray(value)) {
  39058. var augment = hasProto
  39059. ? protoAugment
  39060. : copyAugment;
  39061. augment(value, arrayMethods, arrayKeys);
  39062. this.observeArray(value);
  39063. } else {
  39064. this.walk(value);
  39065. }
  39066. };
  39067. /**
  39068. * Walk through each property and convert them into
  39069. * getter/setters. This method should only be called when
  39070. * value type is Object.
  39071. */
  39072. Observer.prototype.walk = function walk (obj) {
  39073. var keys = Object.keys(obj);
  39074. for (var i = 0; i < keys.length; i++) {
  39075. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  39076. }
  39077. };
  39078. /**
  39079. * Observe a list of Array items.
  39080. */
  39081. Observer.prototype.observeArray = function observeArray (items) {
  39082. for (var i = 0, l = items.length; i < l; i++) {
  39083. observe(items[i]);
  39084. }
  39085. };
  39086. // helpers
  39087. /**
  39088. * Augment an target Object or Array by intercepting
  39089. * the prototype chain using __proto__
  39090. */
  39091. function protoAugment (target, src) {
  39092. /* eslint-disable no-proto */
  39093. target.__proto__ = src;
  39094. /* eslint-enable no-proto */
  39095. }
  39096. /**
  39097. * Augment an target Object or Array by defining
  39098. * hidden properties.
  39099. */
  39100. /* istanbul ignore next */
  39101. function copyAugment (target, src, keys) {
  39102. for (var i = 0, l = keys.length; i < l; i++) {
  39103. var key = keys[i];
  39104. def(target, key, src[key]);
  39105. }
  39106. }
  39107. /**
  39108. * Attempt to create an observer instance for a value,
  39109. * returns the new observer if successfully observed,
  39110. * or the existing observer if the value already has one.
  39111. */
  39112. function observe (value, asRootData) {
  39113. if (!isObject(value)) {
  39114. return
  39115. }
  39116. var ob;
  39117. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  39118. ob = value.__ob__;
  39119. } else if (
  39120. observerState.shouldConvert &&
  39121. !isServerRendering() &&
  39122. (Array.isArray(value) || isPlainObject(value)) &&
  39123. Object.isExtensible(value) &&
  39124. !value._isVue
  39125. ) {
  39126. ob = new Observer(value);
  39127. }
  39128. if (asRootData && ob) {
  39129. ob.vmCount++;
  39130. }
  39131. return ob
  39132. }
  39133. /**
  39134. * Define a reactive property on an Object.
  39135. */
  39136. function defineReactive$$1 (
  39137. obj,
  39138. key,
  39139. val,
  39140. customSetter
  39141. ) {
  39142. var dep = new Dep();
  39143. var property = Object.getOwnPropertyDescriptor(obj, key);
  39144. if (property && property.configurable === false) {
  39145. return
  39146. }
  39147. // cater for pre-defined getter/setters
  39148. var getter = property && property.get;
  39149. var setter = property && property.set;
  39150. var childOb = observe(val);
  39151. Object.defineProperty(obj, key, {
  39152. enumerable: true,
  39153. configurable: true,
  39154. get: function reactiveGetter () {
  39155. var value = getter ? getter.call(obj) : val;
  39156. if (Dep.target) {
  39157. dep.depend();
  39158. if (childOb) {
  39159. childOb.dep.depend();
  39160. }
  39161. if (Array.isArray(value)) {
  39162. dependArray(value);
  39163. }
  39164. }
  39165. return value
  39166. },
  39167. set: function reactiveSetter (newVal) {
  39168. var value = getter ? getter.call(obj) : val;
  39169. /* eslint-disable no-self-compare */
  39170. if (newVal === value || (newVal !== newVal && value !== value)) {
  39171. return
  39172. }
  39173. /* eslint-enable no-self-compare */
  39174. if ("development" !== 'production' && customSetter) {
  39175. customSetter();
  39176. }
  39177. if (setter) {
  39178. setter.call(obj, newVal);
  39179. } else {
  39180. val = newVal;
  39181. }
  39182. childOb = observe(newVal);
  39183. dep.notify();
  39184. }
  39185. });
  39186. }
  39187. /**
  39188. * Set a property on an object. Adds the new property and
  39189. * triggers change notification if the property doesn't
  39190. * already exist.
  39191. */
  39192. function set (target, key, val) {
  39193. if (Array.isArray(target) && typeof key === 'number') {
  39194. target.length = Math.max(target.length, key);
  39195. target.splice(key, 1, val);
  39196. return val
  39197. }
  39198. if (hasOwn(target, key)) {
  39199. target[key] = val;
  39200. return val
  39201. }
  39202. var ob = (target ).__ob__;
  39203. if (target._isVue || (ob && ob.vmCount)) {
  39204. "development" !== 'production' && warn(
  39205. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  39206. 'at runtime - declare it upfront in the data option.'
  39207. );
  39208. return val
  39209. }
  39210. if (!ob) {
  39211. target[key] = val;
  39212. return val
  39213. }
  39214. defineReactive$$1(ob.value, key, val);
  39215. ob.dep.notify();
  39216. return val
  39217. }
  39218. /**
  39219. * Delete a property and trigger change if necessary.
  39220. */
  39221. function del (target, key) {
  39222. if (Array.isArray(target) && typeof key === 'number') {
  39223. target.splice(key, 1);
  39224. return
  39225. }
  39226. var ob = (target ).__ob__;
  39227. if (target._isVue || (ob && ob.vmCount)) {
  39228. "development" !== 'production' && warn(
  39229. 'Avoid deleting properties on a Vue instance or its root $data ' +
  39230. '- just set it to null.'
  39231. );
  39232. return
  39233. }
  39234. if (!hasOwn(target, key)) {
  39235. return
  39236. }
  39237. delete target[key];
  39238. if (!ob) {
  39239. return
  39240. }
  39241. ob.dep.notify();
  39242. }
  39243. /**
  39244. * Collect dependencies on array elements when the array is touched, since
  39245. * we cannot intercept array element access like property getters.
  39246. */
  39247. function dependArray (value) {
  39248. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  39249. e = value[i];
  39250. e && e.__ob__ && e.__ob__.dep.depend();
  39251. if (Array.isArray(e)) {
  39252. dependArray(e);
  39253. }
  39254. }
  39255. }
  39256. /* */
  39257. /**
  39258. * Option overwriting strategies are functions that handle
  39259. * how to merge a parent option value and a child option
  39260. * value into the final value.
  39261. */
  39262. var strats = config.optionMergeStrategies;
  39263. /**
  39264. * Options with restrictions
  39265. */
  39266. {
  39267. strats.el = strats.propsData = function (parent, child, vm, key) {
  39268. if (!vm) {
  39269. warn(
  39270. "option \"" + key + "\" can only be used during instance " +
  39271. 'creation with the `new` keyword.'
  39272. );
  39273. }
  39274. return defaultStrat(parent, child)
  39275. };
  39276. }
  39277. /**
  39278. * Helper that recursively merges two data objects together.
  39279. */
  39280. function mergeData (to, from) {
  39281. if (!from) { return to }
  39282. var key, toVal, fromVal;
  39283. var keys = Object.keys(from);
  39284. for (var i = 0; i < keys.length; i++) {
  39285. key = keys[i];
  39286. toVal = to[key];
  39287. fromVal = from[key];
  39288. if (!hasOwn(to, key)) {
  39289. set(to, key, fromVal);
  39290. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  39291. mergeData(toVal, fromVal);
  39292. }
  39293. }
  39294. return to
  39295. }
  39296. /**
  39297. * Data
  39298. */
  39299. strats.data = function (
  39300. parentVal,
  39301. childVal,
  39302. vm
  39303. ) {
  39304. if (!vm) {
  39305. // in a Vue.extend merge, both should be functions
  39306. if (!childVal) {
  39307. return parentVal
  39308. }
  39309. if (typeof childVal !== 'function') {
  39310. "development" !== 'production' && warn(
  39311. 'The "data" option should be a function ' +
  39312. 'that returns a per-instance value in component ' +
  39313. 'definitions.',
  39314. vm
  39315. );
  39316. return parentVal
  39317. }
  39318. if (!parentVal) {
  39319. return childVal
  39320. }
  39321. // when parentVal & childVal are both present,
  39322. // we need to return a function that returns the
  39323. // merged result of both functions... no need to
  39324. // check if parentVal is a function here because
  39325. // it has to be a function to pass previous merges.
  39326. return function mergedDataFn () {
  39327. return mergeData(
  39328. childVal.call(this),
  39329. parentVal.call(this)
  39330. )
  39331. }
  39332. } else if (parentVal || childVal) {
  39333. return function mergedInstanceDataFn () {
  39334. // instance merge
  39335. var instanceData = typeof childVal === 'function'
  39336. ? childVal.call(vm)
  39337. : childVal;
  39338. var defaultData = typeof parentVal === 'function'
  39339. ? parentVal.call(vm)
  39340. : undefined;
  39341. if (instanceData) {
  39342. return mergeData(instanceData, defaultData)
  39343. } else {
  39344. return defaultData
  39345. }
  39346. }
  39347. }
  39348. };
  39349. /**
  39350. * Hooks and props are merged as arrays.
  39351. */
  39352. function mergeHook (
  39353. parentVal,
  39354. childVal
  39355. ) {
  39356. return childVal
  39357. ? parentVal
  39358. ? parentVal.concat(childVal)
  39359. : Array.isArray(childVal)
  39360. ? childVal
  39361. : [childVal]
  39362. : parentVal
  39363. }
  39364. config._lifecycleHooks.forEach(function (hook) {
  39365. strats[hook] = mergeHook;
  39366. });
  39367. /**
  39368. * Assets
  39369. *
  39370. * When a vm is present (instance creation), we need to do
  39371. * a three-way merge between constructor options, instance
  39372. * options and parent options.
  39373. */
  39374. function mergeAssets (parentVal, childVal) {
  39375. var res = Object.create(parentVal || null);
  39376. return childVal
  39377. ? extend(res, childVal)
  39378. : res
  39379. }
  39380. config._assetTypes.forEach(function (type) {
  39381. strats[type + 's'] = mergeAssets;
  39382. });
  39383. /**
  39384. * Watchers.
  39385. *
  39386. * Watchers hashes should not overwrite one
  39387. * another, so we merge them as arrays.
  39388. */
  39389. strats.watch = function (parentVal, childVal) {
  39390. /* istanbul ignore if */
  39391. if (!childVal) { return Object.create(parentVal || null) }
  39392. if (!parentVal) { return childVal }
  39393. var ret = {};
  39394. extend(ret, parentVal);
  39395. for (var key in childVal) {
  39396. var parent = ret[key];
  39397. var child = childVal[key];
  39398. if (parent && !Array.isArray(parent)) {
  39399. parent = [parent];
  39400. }
  39401. ret[key] = parent
  39402. ? parent.concat(child)
  39403. : [child];
  39404. }
  39405. return ret
  39406. };
  39407. /**
  39408. * Other object hashes.
  39409. */
  39410. strats.props =
  39411. strats.methods =
  39412. strats.computed = function (parentVal, childVal) {
  39413. if (!childVal) { return Object.create(parentVal || null) }
  39414. if (!parentVal) { return childVal }
  39415. var ret = Object.create(null);
  39416. extend(ret, parentVal);
  39417. extend(ret, childVal);
  39418. return ret
  39419. };
  39420. /**
  39421. * Default strategy.
  39422. */
  39423. var defaultStrat = function (parentVal, childVal) {
  39424. return childVal === undefined
  39425. ? parentVal
  39426. : childVal
  39427. };
  39428. /**
  39429. * Validate component names
  39430. */
  39431. function checkComponents (options) {
  39432. for (var key in options.components) {
  39433. var lower = key.toLowerCase();
  39434. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  39435. warn(
  39436. 'Do not use built-in or reserved HTML elements as component ' +
  39437. 'id: ' + key
  39438. );
  39439. }
  39440. }
  39441. }
  39442. /**
  39443. * Ensure all props option syntax are normalized into the
  39444. * Object-based format.
  39445. */
  39446. function normalizeProps (options) {
  39447. var props = options.props;
  39448. if (!props) { return }
  39449. var res = {};
  39450. var i, val, name;
  39451. if (Array.isArray(props)) {
  39452. i = props.length;
  39453. while (i--) {
  39454. val = props[i];
  39455. if (typeof val === 'string') {
  39456. name = camelize(val);
  39457. res[name] = { type: null };
  39458. } else {
  39459. warn('props must be strings when using array syntax.');
  39460. }
  39461. }
  39462. } else if (isPlainObject(props)) {
  39463. for (var key in props) {
  39464. val = props[key];
  39465. name = camelize(key);
  39466. res[name] = isPlainObject(val)
  39467. ? val
  39468. : { type: val };
  39469. }
  39470. }
  39471. options.props = res;
  39472. }
  39473. /**
  39474. * Normalize raw function directives into object format.
  39475. */
  39476. function normalizeDirectives (options) {
  39477. var dirs = options.directives;
  39478. if (dirs) {
  39479. for (var key in dirs) {
  39480. var def = dirs[key];
  39481. if (typeof def === 'function') {
  39482. dirs[key] = { bind: def, update: def };
  39483. }
  39484. }
  39485. }
  39486. }
  39487. /**
  39488. * Merge two option objects into a new one.
  39489. * Core utility used in both instantiation and inheritance.
  39490. */
  39491. function mergeOptions (
  39492. parent,
  39493. child,
  39494. vm
  39495. ) {
  39496. {
  39497. checkComponents(child);
  39498. }
  39499. normalizeProps(child);
  39500. normalizeDirectives(child);
  39501. var extendsFrom = child.extends;
  39502. if (extendsFrom) {
  39503. parent = typeof extendsFrom === 'function'
  39504. ? mergeOptions(parent, extendsFrom.options, vm)
  39505. : mergeOptions(parent, extendsFrom, vm);
  39506. }
  39507. if (child.mixins) {
  39508. for (var i = 0, l = child.mixins.length; i < l; i++) {
  39509. var mixin = child.mixins[i];
  39510. if (mixin.prototype instanceof Vue$3) {
  39511. mixin = mixin.options;
  39512. }
  39513. parent = mergeOptions(parent, mixin, vm);
  39514. }
  39515. }
  39516. var options = {};
  39517. var key;
  39518. for (key in parent) {
  39519. mergeField(key);
  39520. }
  39521. for (key in child) {
  39522. if (!hasOwn(parent, key)) {
  39523. mergeField(key);
  39524. }
  39525. }
  39526. function mergeField (key) {
  39527. var strat = strats[key] || defaultStrat;
  39528. options[key] = strat(parent[key], child[key], vm, key);
  39529. }
  39530. return options
  39531. }
  39532. /**
  39533. * Resolve an asset.
  39534. * This function is used because child instances need access
  39535. * to assets defined in its ancestor chain.
  39536. */
  39537. function resolveAsset (
  39538. options,
  39539. type,
  39540. id,
  39541. warnMissing
  39542. ) {
  39543. /* istanbul ignore if */
  39544. if (typeof id !== 'string') {
  39545. return
  39546. }
  39547. var assets = options[type];
  39548. // check local registration variations first
  39549. if (hasOwn(assets, id)) { return assets[id] }
  39550. var camelizedId = camelize(id);
  39551. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  39552. var PascalCaseId = capitalize(camelizedId);
  39553. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  39554. // fallback to prototype chain
  39555. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  39556. if ("development" !== 'production' && warnMissing && !res) {
  39557. warn(
  39558. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  39559. options
  39560. );
  39561. }
  39562. return res
  39563. }
  39564. /* */
  39565. function validateProp (
  39566. key,
  39567. propOptions,
  39568. propsData,
  39569. vm
  39570. ) {
  39571. var prop = propOptions[key];
  39572. var absent = !hasOwn(propsData, key);
  39573. var value = propsData[key];
  39574. // handle boolean props
  39575. if (isType(Boolean, prop.type)) {
  39576. if (absent && !hasOwn(prop, 'default')) {
  39577. value = false;
  39578. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  39579. value = true;
  39580. }
  39581. }
  39582. // check default value
  39583. if (value === undefined) {
  39584. value = getPropDefaultValue(vm, prop, key);
  39585. // since the default value is a fresh copy,
  39586. // make sure to observe it.
  39587. var prevShouldConvert = observerState.shouldConvert;
  39588. observerState.shouldConvert = true;
  39589. observe(value);
  39590. observerState.shouldConvert = prevShouldConvert;
  39591. }
  39592. {
  39593. assertProp(prop, key, value, vm, absent);
  39594. }
  39595. return value
  39596. }
  39597. /**
  39598. * Get the default value of a prop.
  39599. */
  39600. function getPropDefaultValue (vm, prop, key) {
  39601. // no default, return undefined
  39602. if (!hasOwn(prop, 'default')) {
  39603. return undefined
  39604. }
  39605. var def = prop.default;
  39606. // warn against non-factory defaults for Object & Array
  39607. if ("development" !== 'production' && isObject(def)) {
  39608. warn(
  39609. 'Invalid default value for prop "' + key + '": ' +
  39610. 'Props with type Object/Array must use a factory function ' +
  39611. 'to return the default value.',
  39612. vm
  39613. );
  39614. }
  39615. // the raw prop value was also undefined from previous render,
  39616. // return previous default value to avoid unnecessary watcher trigger
  39617. if (vm && vm.$options.propsData &&
  39618. vm.$options.propsData[key] === undefined &&
  39619. vm._props[key] !== undefined) {
  39620. return vm._props[key]
  39621. }
  39622. // call factory function for non-Function types
  39623. // a value is Function if its prototype is function even across different execution context
  39624. return typeof def === 'function' && getType(prop.type) !== 'Function'
  39625. ? def.call(vm)
  39626. : def
  39627. }
  39628. /**
  39629. * Assert whether a prop is valid.
  39630. */
  39631. function assertProp (
  39632. prop,
  39633. name,
  39634. value,
  39635. vm,
  39636. absent
  39637. ) {
  39638. if (prop.required && absent) {
  39639. warn(
  39640. 'Missing required prop: "' + name + '"',
  39641. vm
  39642. );
  39643. return
  39644. }
  39645. if (value == null && !prop.required) {
  39646. return
  39647. }
  39648. var type = prop.type;
  39649. var valid = !type || type === true;
  39650. var expectedTypes = [];
  39651. if (type) {
  39652. if (!Array.isArray(type)) {
  39653. type = [type];
  39654. }
  39655. for (var i = 0; i < type.length && !valid; i++) {
  39656. var assertedType = assertType(value, type[i]);
  39657. expectedTypes.push(assertedType.expectedType || '');
  39658. valid = assertedType.valid;
  39659. }
  39660. }
  39661. if (!valid) {
  39662. warn(
  39663. 'Invalid prop: type check failed for prop "' + name + '".' +
  39664. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  39665. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  39666. vm
  39667. );
  39668. return
  39669. }
  39670. var validator = prop.validator;
  39671. if (validator) {
  39672. if (!validator(value)) {
  39673. warn(
  39674. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  39675. vm
  39676. );
  39677. }
  39678. }
  39679. }
  39680. /**
  39681. * Assert the type of a value
  39682. */
  39683. function assertType (value, type) {
  39684. var valid;
  39685. var expectedType = getType(type);
  39686. if (expectedType === 'String') {
  39687. valid = typeof value === (expectedType = 'string');
  39688. } else if (expectedType === 'Number') {
  39689. valid = typeof value === (expectedType = 'number');
  39690. } else if (expectedType === 'Boolean') {
  39691. valid = typeof value === (expectedType = 'boolean');
  39692. } else if (expectedType === 'Function') {
  39693. valid = typeof value === (expectedType = 'function');
  39694. } else if (expectedType === 'Object') {
  39695. valid = isPlainObject(value);
  39696. } else if (expectedType === 'Array') {
  39697. valid = Array.isArray(value);
  39698. } else {
  39699. valid = value instanceof type;
  39700. }
  39701. return {
  39702. valid: valid,
  39703. expectedType: expectedType
  39704. }
  39705. }
  39706. /**
  39707. * Use function string name to check built-in types,
  39708. * because a simple equality check will fail when running
  39709. * across different vms / iframes.
  39710. */
  39711. function getType (fn) {
  39712. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  39713. return match && match[1]
  39714. }
  39715. function isType (type, fn) {
  39716. if (!Array.isArray(fn)) {
  39717. return getType(fn) === getType(type)
  39718. }
  39719. for (var i = 0, len = fn.length; i < len; i++) {
  39720. if (getType(fn[i]) === getType(type)) {
  39721. return true
  39722. }
  39723. }
  39724. /* istanbul ignore next */
  39725. return false
  39726. }
  39727. function handleError (err, vm, info) {
  39728. if (config.errorHandler) {
  39729. config.errorHandler.call(null, err, vm, info);
  39730. } else {
  39731. {
  39732. warn(("Error in " + info + ":"), vm);
  39733. }
  39734. /* istanbul ignore else */
  39735. if (inBrowser && typeof console !== 'undefined') {
  39736. console.error(err);
  39737. } else {
  39738. throw err
  39739. }
  39740. }
  39741. }
  39742. /* not type checking this file because flow doesn't play well with Proxy */
  39743. var initProxy;
  39744. {
  39745. var allowedGlobals = makeMap(
  39746. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  39747. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  39748. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  39749. 'require' // for Webpack/Browserify
  39750. );
  39751. var warnNonPresent = function (target, key) {
  39752. warn(
  39753. "Property or method \"" + key + "\" is not defined on the instance but " +
  39754. "referenced during render. Make sure to declare reactive data " +
  39755. "properties in the data option.",
  39756. target
  39757. );
  39758. };
  39759. var hasProxy =
  39760. typeof Proxy !== 'undefined' &&
  39761. Proxy.toString().match(/native code/);
  39762. if (hasProxy) {
  39763. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
  39764. config.keyCodes = new Proxy(config.keyCodes, {
  39765. set: function set (target, key, value) {
  39766. if (isBuiltInModifier(key)) {
  39767. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  39768. return false
  39769. } else {
  39770. target[key] = value;
  39771. return true
  39772. }
  39773. }
  39774. });
  39775. }
  39776. var hasHandler = {
  39777. has: function has (target, key) {
  39778. var has = key in target;
  39779. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  39780. if (!has && !isAllowed) {
  39781. warnNonPresent(target, key);
  39782. }
  39783. return has || !isAllowed
  39784. }
  39785. };
  39786. var getHandler = {
  39787. get: function get (target, key) {
  39788. if (typeof key === 'string' && !(key in target)) {
  39789. warnNonPresent(target, key);
  39790. }
  39791. return target[key]
  39792. }
  39793. };
  39794. initProxy = function initProxy (vm) {
  39795. if (hasProxy) {
  39796. // determine which proxy handler to use
  39797. var options = vm.$options;
  39798. var handlers = options.render && options.render._withStripped
  39799. ? getHandler
  39800. : hasHandler;
  39801. vm._renderProxy = new Proxy(vm, handlers);
  39802. } else {
  39803. vm._renderProxy = vm;
  39804. }
  39805. };
  39806. }
  39807. var mark;
  39808. var measure;
  39809. {
  39810. var perf = inBrowser && window.performance;
  39811. /* istanbul ignore if */
  39812. if (
  39813. perf &&
  39814. perf.mark &&
  39815. perf.measure &&
  39816. perf.clearMarks &&
  39817. perf.clearMeasures
  39818. ) {
  39819. mark = function (tag) { return perf.mark(tag); };
  39820. measure = function (name, startTag, endTag) {
  39821. perf.measure(name, startTag, endTag);
  39822. perf.clearMarks(startTag);
  39823. perf.clearMarks(endTag);
  39824. perf.clearMeasures(name);
  39825. };
  39826. }
  39827. }
  39828. /* */
  39829. var VNode = function VNode (
  39830. tag,
  39831. data,
  39832. children,
  39833. text,
  39834. elm,
  39835. context,
  39836. componentOptions
  39837. ) {
  39838. this.tag = tag;
  39839. this.data = data;
  39840. this.children = children;
  39841. this.text = text;
  39842. this.elm = elm;
  39843. this.ns = undefined;
  39844. this.context = context;
  39845. this.functionalContext = undefined;
  39846. this.key = data && data.key;
  39847. this.componentOptions = componentOptions;
  39848. this.componentInstance = undefined;
  39849. this.parent = undefined;
  39850. this.raw = false;
  39851. this.isStatic = false;
  39852. this.isRootInsert = true;
  39853. this.isComment = false;
  39854. this.isCloned = false;
  39855. this.isOnce = false;
  39856. };
  39857. var prototypeAccessors = { child: {} };
  39858. // DEPRECATED: alias for componentInstance for backwards compat.
  39859. /* istanbul ignore next */
  39860. prototypeAccessors.child.get = function () {
  39861. return this.componentInstance
  39862. };
  39863. Object.defineProperties( VNode.prototype, prototypeAccessors );
  39864. var createEmptyVNode = function () {
  39865. var node = new VNode();
  39866. node.text = '';
  39867. node.isComment = true;
  39868. return node
  39869. };
  39870. function createTextVNode (val) {
  39871. return new VNode(undefined, undefined, undefined, String(val))
  39872. }
  39873. // optimized shallow clone
  39874. // used for static nodes and slot nodes because they may be reused across
  39875. // multiple renders, cloning them avoids errors when DOM manipulations rely
  39876. // on their elm reference.
  39877. function cloneVNode (vnode) {
  39878. var cloned = new VNode(
  39879. vnode.tag,
  39880. vnode.data,
  39881. vnode.children,
  39882. vnode.text,
  39883. vnode.elm,
  39884. vnode.context,
  39885. vnode.componentOptions
  39886. );
  39887. cloned.ns = vnode.ns;
  39888. cloned.isStatic = vnode.isStatic;
  39889. cloned.key = vnode.key;
  39890. cloned.isCloned = true;
  39891. return cloned
  39892. }
  39893. function cloneVNodes (vnodes) {
  39894. var len = vnodes.length;
  39895. var res = new Array(len);
  39896. for (var i = 0; i < len; i++) {
  39897. res[i] = cloneVNode(vnodes[i]);
  39898. }
  39899. return res
  39900. }
  39901. /* */
  39902. var normalizeEvent = cached(function (name) {
  39903. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  39904. name = once$$1 ? name.slice(1) : name;
  39905. var capture = name.charAt(0) === '!';
  39906. name = capture ? name.slice(1) : name;
  39907. return {
  39908. name: name,
  39909. once: once$$1,
  39910. capture: capture
  39911. }
  39912. });
  39913. function createFnInvoker (fns) {
  39914. function invoker () {
  39915. var arguments$1 = arguments;
  39916. var fns = invoker.fns;
  39917. if (Array.isArray(fns)) {
  39918. for (var i = 0; i < fns.length; i++) {
  39919. fns[i].apply(null, arguments$1);
  39920. }
  39921. } else {
  39922. // return handler return value for single handlers
  39923. return fns.apply(null, arguments)
  39924. }
  39925. }
  39926. invoker.fns = fns;
  39927. return invoker
  39928. }
  39929. function updateListeners (
  39930. on,
  39931. oldOn,
  39932. add,
  39933. remove$$1,
  39934. vm
  39935. ) {
  39936. var name, cur, old, event;
  39937. for (name in on) {
  39938. cur = on[name];
  39939. old = oldOn[name];
  39940. event = normalizeEvent(name);
  39941. if (!cur) {
  39942. "development" !== 'production' && warn(
  39943. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  39944. vm
  39945. );
  39946. } else if (!old) {
  39947. if (!cur.fns) {
  39948. cur = on[name] = createFnInvoker(cur);
  39949. }
  39950. add(event.name, cur, event.once, event.capture);
  39951. } else if (cur !== old) {
  39952. old.fns = cur;
  39953. on[name] = old;
  39954. }
  39955. }
  39956. for (name in oldOn) {
  39957. if (!on[name]) {
  39958. event = normalizeEvent(name);
  39959. remove$$1(event.name, oldOn[name], event.capture);
  39960. }
  39961. }
  39962. }
  39963. /* */
  39964. function mergeVNodeHook (def, hookKey, hook) {
  39965. var invoker;
  39966. var oldHook = def[hookKey];
  39967. function wrappedHook () {
  39968. hook.apply(this, arguments);
  39969. // important: remove merged hook to ensure it's called only once
  39970. // and prevent memory leak
  39971. remove(invoker.fns, wrappedHook);
  39972. }
  39973. if (!oldHook) {
  39974. // no existing hook
  39975. invoker = createFnInvoker([wrappedHook]);
  39976. } else {
  39977. /* istanbul ignore if */
  39978. if (oldHook.fns && oldHook.merged) {
  39979. // already a merged invoker
  39980. invoker = oldHook;
  39981. invoker.fns.push(wrappedHook);
  39982. } else {
  39983. // existing plain hook
  39984. invoker = createFnInvoker([oldHook, wrappedHook]);
  39985. }
  39986. }
  39987. invoker.merged = true;
  39988. def[hookKey] = invoker;
  39989. }
  39990. /* */
  39991. // The template compiler attempts to minimize the need for normalization by
  39992. // statically analyzing the template at compile time.
  39993. //
  39994. // For plain HTML markup, normalization can be completely skipped because the
  39995. // generated render function is guaranteed to return Array<VNode>. There are
  39996. // two cases where extra normalization is needed:
  39997. // 1. When the children contains components - because a functional component
  39998. // may return an Array instead of a single root. In this case, just a simple
  39999. // normalization is needed - if any child is an Array, we flatten the whole
  40000. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  40001. // because functional components already normalize their own children.
  40002. function simpleNormalizeChildren (children) {
  40003. for (var i = 0; i < children.length; i++) {
  40004. if (Array.isArray(children[i])) {
  40005. return Array.prototype.concat.apply([], children)
  40006. }
  40007. }
  40008. return children
  40009. }
  40010. // 2. When the children contains constructs that always generated nested Arrays,
  40011. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  40012. // with hand-written render functions / JSX. In such cases a full normalization
  40013. // is needed to cater to all possible types of children values.
  40014. function normalizeChildren (children) {
  40015. return isPrimitive(children)
  40016. ? [createTextVNode(children)]
  40017. : Array.isArray(children)
  40018. ? normalizeArrayChildren(children)
  40019. : undefined
  40020. }
  40021. function normalizeArrayChildren (children, nestedIndex) {
  40022. var res = [];
  40023. var i, c, last;
  40024. for (i = 0; i < children.length; i++) {
  40025. c = children[i];
  40026. if (c == null || typeof c === 'boolean') { continue }
  40027. last = res[res.length - 1];
  40028. // nested
  40029. if (Array.isArray(c)) {
  40030. res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
  40031. } else if (isPrimitive(c)) {
  40032. if (last && last.text) {
  40033. last.text += String(c);
  40034. } else if (c !== '') {
  40035. // convert primitive to vnode
  40036. res.push(createTextVNode(c));
  40037. }
  40038. } else {
  40039. if (c.text && last && last.text) {
  40040. res[res.length - 1] = createTextVNode(last.text + c.text);
  40041. } else {
  40042. // default key for nested array children (likely generated by v-for)
  40043. if (c.tag && c.key == null && nestedIndex != null) {
  40044. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  40045. }
  40046. res.push(c);
  40047. }
  40048. }
  40049. }
  40050. return res
  40051. }
  40052. /* */
  40053. function getFirstComponentChild (children) {
  40054. return children && children.filter(function (c) { return c && c.componentOptions; })[0]
  40055. }
  40056. /* */
  40057. function initEvents (vm) {
  40058. vm._events = Object.create(null);
  40059. vm._hasHookEvent = false;
  40060. // init parent attached events
  40061. var listeners = vm.$options._parentListeners;
  40062. if (listeners) {
  40063. updateComponentListeners(vm, listeners);
  40064. }
  40065. }
  40066. var target;
  40067. function add (event, fn, once$$1) {
  40068. if (once$$1) {
  40069. target.$once(event, fn);
  40070. } else {
  40071. target.$on(event, fn);
  40072. }
  40073. }
  40074. function remove$1 (event, fn) {
  40075. target.$off(event, fn);
  40076. }
  40077. function updateComponentListeners (
  40078. vm,
  40079. listeners,
  40080. oldListeners
  40081. ) {
  40082. target = vm;
  40083. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  40084. }
  40085. function eventsMixin (Vue) {
  40086. var hookRE = /^hook:/;
  40087. Vue.prototype.$on = function (event, fn) {
  40088. var this$1 = this;
  40089. var vm = this;
  40090. if (Array.isArray(event)) {
  40091. for (var i = 0, l = event.length; i < l; i++) {
  40092. this$1.$on(event[i], fn);
  40093. }
  40094. } else {
  40095. (vm._events[event] || (vm._events[event] = [])).push(fn);
  40096. // optimize hook:event cost by using a boolean flag marked at registration
  40097. // instead of a hash lookup
  40098. if (hookRE.test(event)) {
  40099. vm._hasHookEvent = true;
  40100. }
  40101. }
  40102. return vm
  40103. };
  40104. Vue.prototype.$once = function (event, fn) {
  40105. var vm = this;
  40106. function on () {
  40107. vm.$off(event, on);
  40108. fn.apply(vm, arguments);
  40109. }
  40110. on.fn = fn;
  40111. vm.$on(event, on);
  40112. return vm
  40113. };
  40114. Vue.prototype.$off = function (event, fn) {
  40115. var this$1 = this;
  40116. var vm = this;
  40117. // all
  40118. if (!arguments.length) {
  40119. vm._events = Object.create(null);
  40120. return vm
  40121. }
  40122. // array of events
  40123. if (Array.isArray(event)) {
  40124. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  40125. this$1.$off(event[i$1], fn);
  40126. }
  40127. return vm
  40128. }
  40129. // specific event
  40130. var cbs = vm._events[event];
  40131. if (!cbs) {
  40132. return vm
  40133. }
  40134. if (arguments.length === 1) {
  40135. vm._events[event] = null;
  40136. return vm
  40137. }
  40138. // specific handler
  40139. var cb;
  40140. var i = cbs.length;
  40141. while (i--) {
  40142. cb = cbs[i];
  40143. if (cb === fn || cb.fn === fn) {
  40144. cbs.splice(i, 1);
  40145. break
  40146. }
  40147. }
  40148. return vm
  40149. };
  40150. Vue.prototype.$emit = function (event) {
  40151. var vm = this;
  40152. {
  40153. var lowerCaseEvent = event.toLowerCase();
  40154. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  40155. tip(
  40156. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  40157. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  40158. "Note that HTML attributes are case-insensitive and you cannot use " +
  40159. "v-on to listen to camelCase events when using in-DOM templates. " +
  40160. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  40161. );
  40162. }
  40163. }
  40164. var cbs = vm._events[event];
  40165. if (cbs) {
  40166. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  40167. var args = toArray(arguments, 1);
  40168. for (var i = 0, l = cbs.length; i < l; i++) {
  40169. cbs[i].apply(vm, args);
  40170. }
  40171. }
  40172. return vm
  40173. };
  40174. }
  40175. /* */
  40176. /**
  40177. * Runtime helper for resolving raw children VNodes into a slot object.
  40178. */
  40179. function resolveSlots (
  40180. children,
  40181. context
  40182. ) {
  40183. var slots = {};
  40184. if (!children) {
  40185. return slots
  40186. }
  40187. var defaultSlot = [];
  40188. var name, child;
  40189. for (var i = 0, l = children.length; i < l; i++) {
  40190. child = children[i];
  40191. // named slots should only be respected if the vnode was rendered in the
  40192. // same context.
  40193. if ((child.context === context || child.functionalContext === context) &&
  40194. child.data && (name = child.data.slot)) {
  40195. var slot = (slots[name] || (slots[name] = []));
  40196. if (child.tag === 'template') {
  40197. slot.push.apply(slot, child.children);
  40198. } else {
  40199. slot.push(child);
  40200. }
  40201. } else {
  40202. defaultSlot.push(child);
  40203. }
  40204. }
  40205. // ignore whitespace
  40206. if (!defaultSlot.every(isWhitespace)) {
  40207. slots.default = defaultSlot;
  40208. }
  40209. return slots
  40210. }
  40211. function isWhitespace (node) {
  40212. return node.isComment || node.text === ' '
  40213. }
  40214. function resolveScopedSlots (
  40215. fns
  40216. ) {
  40217. var res = {};
  40218. for (var i = 0; i < fns.length; i++) {
  40219. res[fns[i][0]] = fns[i][1];
  40220. }
  40221. return res
  40222. }
  40223. /* */
  40224. var activeInstance = null;
  40225. function initLifecycle (vm) {
  40226. var options = vm.$options;
  40227. // locate first non-abstract parent
  40228. var parent = options.parent;
  40229. if (parent && !options.abstract) {
  40230. while (parent.$options.abstract && parent.$parent) {
  40231. parent = parent.$parent;
  40232. }
  40233. parent.$children.push(vm);
  40234. }
  40235. vm.$parent = parent;
  40236. vm.$root = parent ? parent.$root : vm;
  40237. vm.$children = [];
  40238. vm.$refs = {};
  40239. vm._watcher = null;
  40240. vm._inactive = null;
  40241. vm._directInactive = false;
  40242. vm._isMounted = false;
  40243. vm._isDestroyed = false;
  40244. vm._isBeingDestroyed = false;
  40245. }
  40246. function lifecycleMixin (Vue) {
  40247. Vue.prototype._update = function (vnode, hydrating) {
  40248. var vm = this;
  40249. if (vm._isMounted) {
  40250. callHook(vm, 'beforeUpdate');
  40251. }
  40252. var prevEl = vm.$el;
  40253. var prevVnode = vm._vnode;
  40254. var prevActiveInstance = activeInstance;
  40255. activeInstance = vm;
  40256. vm._vnode = vnode;
  40257. // Vue.prototype.__patch__ is injected in entry points
  40258. // based on the rendering backend used.
  40259. if (!prevVnode) {
  40260. // initial render
  40261. vm.$el = vm.__patch__(
  40262. vm.$el, vnode, hydrating, false /* removeOnly */,
  40263. vm.$options._parentElm,
  40264. vm.$options._refElm
  40265. );
  40266. } else {
  40267. // updates
  40268. vm.$el = vm.__patch__(prevVnode, vnode);
  40269. }
  40270. activeInstance = prevActiveInstance;
  40271. // update __vue__ reference
  40272. if (prevEl) {
  40273. prevEl.__vue__ = null;
  40274. }
  40275. if (vm.$el) {
  40276. vm.$el.__vue__ = vm;
  40277. }
  40278. // if parent is an HOC, update its $el as well
  40279. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  40280. vm.$parent.$el = vm.$el;
  40281. }
  40282. // updated hook is called by the scheduler to ensure that children are
  40283. // updated in a parent's updated hook.
  40284. };
  40285. Vue.prototype.$forceUpdate = function () {
  40286. var vm = this;
  40287. if (vm._watcher) {
  40288. vm._watcher.update();
  40289. }
  40290. };
  40291. Vue.prototype.$destroy = function () {
  40292. var vm = this;
  40293. if (vm._isBeingDestroyed) {
  40294. return
  40295. }
  40296. callHook(vm, 'beforeDestroy');
  40297. vm._isBeingDestroyed = true;
  40298. // remove self from parent
  40299. var parent = vm.$parent;
  40300. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  40301. remove(parent.$children, vm);
  40302. }
  40303. // teardown watchers
  40304. if (vm._watcher) {
  40305. vm._watcher.teardown();
  40306. }
  40307. var i = vm._watchers.length;
  40308. while (i--) {
  40309. vm._watchers[i].teardown();
  40310. }
  40311. // remove reference from data ob
  40312. // frozen object may not have observer.
  40313. if (vm._data.__ob__) {
  40314. vm._data.__ob__.vmCount--;
  40315. }
  40316. // call the last hook...
  40317. vm._isDestroyed = true;
  40318. callHook(vm, 'destroyed');
  40319. // turn off all instance listeners.
  40320. vm.$off();
  40321. // remove __vue__ reference
  40322. if (vm.$el) {
  40323. vm.$el.__vue__ = null;
  40324. }
  40325. // invoke destroy hooks on current rendered tree
  40326. vm.__patch__(vm._vnode, null);
  40327. };
  40328. }
  40329. function mountComponent (
  40330. vm,
  40331. el,
  40332. hydrating
  40333. ) {
  40334. vm.$el = el;
  40335. if (!vm.$options.render) {
  40336. vm.$options.render = createEmptyVNode;
  40337. {
  40338. /* istanbul ignore if */
  40339. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  40340. vm.$options.el || el) {
  40341. warn(
  40342. 'You are using the runtime-only build of Vue where the template ' +
  40343. 'compiler is not available. Either pre-compile the templates into ' +
  40344. 'render functions, or use the compiler-included build.',
  40345. vm
  40346. );
  40347. } else {
  40348. warn(
  40349. 'Failed to mount component: template or render function not defined.',
  40350. vm
  40351. );
  40352. }
  40353. }
  40354. }
  40355. callHook(vm, 'beforeMount');
  40356. var updateComponent;
  40357. /* istanbul ignore if */
  40358. if ("development" !== 'production' && config.performance && mark) {
  40359. updateComponent = function () {
  40360. var name = vm._name;
  40361. var id = vm._uid;
  40362. var startTag = "vue-perf-start:" + id;
  40363. var endTag = "vue-perf-end:" + id;
  40364. mark(startTag);
  40365. var vnode = vm._render();
  40366. mark(endTag);
  40367. measure((name + " render"), startTag, endTag);
  40368. mark(startTag);
  40369. vm._update(vnode, hydrating);
  40370. mark(endTag);
  40371. measure((name + " patch"), startTag, endTag);
  40372. };
  40373. } else {
  40374. updateComponent = function () {
  40375. vm._update(vm._render(), hydrating);
  40376. };
  40377. }
  40378. vm._watcher = new Watcher(vm, updateComponent, noop);
  40379. hydrating = false;
  40380. // manually mounted instance, call mounted on self
  40381. // mounted is called for render-created child components in its inserted hook
  40382. if (vm.$vnode == null) {
  40383. vm._isMounted = true;
  40384. callHook(vm, 'mounted');
  40385. }
  40386. return vm
  40387. }
  40388. function updateChildComponent (
  40389. vm,
  40390. propsData,
  40391. listeners,
  40392. parentVnode,
  40393. renderChildren
  40394. ) {
  40395. // determine whether component has slot children
  40396. // we need to do this before overwriting $options._renderChildren
  40397. var hasChildren = !!(
  40398. renderChildren || // has new static slots
  40399. vm.$options._renderChildren || // has old static slots
  40400. parentVnode.data.scopedSlots || // has new scoped slots
  40401. vm.$scopedSlots !== emptyObject // has old scoped slots
  40402. );
  40403. vm.$options._parentVnode = parentVnode;
  40404. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  40405. if (vm._vnode) { // update child tree's parent
  40406. vm._vnode.parent = parentVnode;
  40407. }
  40408. vm.$options._renderChildren = renderChildren;
  40409. // update props
  40410. if (propsData && vm.$options.props) {
  40411. observerState.shouldConvert = false;
  40412. {
  40413. observerState.isSettingProps = true;
  40414. }
  40415. var props = vm._props;
  40416. var propKeys = vm.$options._propKeys || [];
  40417. for (var i = 0; i < propKeys.length; i++) {
  40418. var key = propKeys[i];
  40419. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  40420. }
  40421. observerState.shouldConvert = true;
  40422. {
  40423. observerState.isSettingProps = false;
  40424. }
  40425. // keep a copy of raw propsData
  40426. vm.$options.propsData = propsData;
  40427. }
  40428. // update listeners
  40429. if (listeners) {
  40430. var oldListeners = vm.$options._parentListeners;
  40431. vm.$options._parentListeners = listeners;
  40432. updateComponentListeners(vm, listeners, oldListeners);
  40433. }
  40434. // resolve slots + force update if has children
  40435. if (hasChildren) {
  40436. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  40437. vm.$forceUpdate();
  40438. }
  40439. }
  40440. function isInInactiveTree (vm) {
  40441. while (vm && (vm = vm.$parent)) {
  40442. if (vm._inactive) { return true }
  40443. }
  40444. return false
  40445. }
  40446. function activateChildComponent (vm, direct) {
  40447. if (direct) {
  40448. vm._directInactive = false;
  40449. if (isInInactiveTree(vm)) {
  40450. return
  40451. }
  40452. } else if (vm._directInactive) {
  40453. return
  40454. }
  40455. if (vm._inactive || vm._inactive == null) {
  40456. vm._inactive = false;
  40457. for (var i = 0; i < vm.$children.length; i++) {
  40458. activateChildComponent(vm.$children[i]);
  40459. }
  40460. callHook(vm, 'activated');
  40461. }
  40462. }
  40463. function deactivateChildComponent (vm, direct) {
  40464. if (direct) {
  40465. vm._directInactive = true;
  40466. if (isInInactiveTree(vm)) {
  40467. return
  40468. }
  40469. }
  40470. if (!vm._inactive) {
  40471. vm._inactive = true;
  40472. for (var i = 0; i < vm.$children.length; i++) {
  40473. deactivateChildComponent(vm.$children[i]);
  40474. }
  40475. callHook(vm, 'deactivated');
  40476. }
  40477. }
  40478. function callHook (vm, hook) {
  40479. var handlers = vm.$options[hook];
  40480. if (handlers) {
  40481. for (var i = 0, j = handlers.length; i < j; i++) {
  40482. try {
  40483. handlers[i].call(vm);
  40484. } catch (e) {
  40485. handleError(e, vm, (hook + " hook"));
  40486. }
  40487. }
  40488. }
  40489. if (vm._hasHookEvent) {
  40490. vm.$emit('hook:' + hook);
  40491. }
  40492. }
  40493. /* */
  40494. var queue = [];
  40495. var has = {};
  40496. var circular = {};
  40497. var waiting = false;
  40498. var flushing = false;
  40499. var index = 0;
  40500. /**
  40501. * Reset the scheduler's state.
  40502. */
  40503. function resetSchedulerState () {
  40504. queue.length = 0;
  40505. has = {};
  40506. {
  40507. circular = {};
  40508. }
  40509. waiting = flushing = false;
  40510. }
  40511. /**
  40512. * Flush both queues and run the watchers.
  40513. */
  40514. function flushSchedulerQueue () {
  40515. flushing = true;
  40516. var watcher, id, vm;
  40517. // Sort queue before flush.
  40518. // This ensures that:
  40519. // 1. Components are updated from parent to child. (because parent is always
  40520. // created before the child)
  40521. // 2. A component's user watchers are run before its render watcher (because
  40522. // user watchers are created before the render watcher)
  40523. // 3. If a component is destroyed during a parent component's watcher run,
  40524. // its watchers can be skipped.
  40525. queue.sort(function (a, b) { return a.id - b.id; });
  40526. // do not cache length because more watchers might be pushed
  40527. // as we run existing watchers
  40528. for (index = 0; index < queue.length; index++) {
  40529. watcher = queue[index];
  40530. id = watcher.id;
  40531. has[id] = null;
  40532. watcher.run();
  40533. // in dev build, check and stop circular updates.
  40534. if ("development" !== 'production' && has[id] != null) {
  40535. circular[id] = (circular[id] || 0) + 1;
  40536. if (circular[id] > config._maxUpdateCount) {
  40537. warn(
  40538. 'You may have an infinite update loop ' + (
  40539. watcher.user
  40540. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  40541. : "in a component render function."
  40542. ),
  40543. watcher.vm
  40544. );
  40545. break
  40546. }
  40547. }
  40548. }
  40549. // reset scheduler before updated hook called
  40550. var oldQueue = queue.slice();
  40551. resetSchedulerState();
  40552. // call updated hooks
  40553. index = oldQueue.length;
  40554. while (index--) {
  40555. watcher = oldQueue[index];
  40556. vm = watcher.vm;
  40557. if (vm._watcher === watcher && vm._isMounted) {
  40558. callHook(vm, 'updated');
  40559. }
  40560. }
  40561. // devtool hook
  40562. /* istanbul ignore if */
  40563. if (devtools && config.devtools) {
  40564. devtools.emit('flush');
  40565. }
  40566. }
  40567. /**
  40568. * Push a watcher into the watcher queue.
  40569. * Jobs with duplicate IDs will be skipped unless it's
  40570. * pushed when the queue is being flushed.
  40571. */
  40572. function queueWatcher (watcher) {
  40573. var id = watcher.id;
  40574. if (has[id] == null) {
  40575. has[id] = true;
  40576. if (!flushing) {
  40577. queue.push(watcher);
  40578. } else {
  40579. // if already flushing, splice the watcher based on its id
  40580. // if already past its id, it will be run next immediately.
  40581. var i = queue.length - 1;
  40582. while (i >= 0 && queue[i].id > watcher.id) {
  40583. i--;
  40584. }
  40585. queue.splice(Math.max(i, index) + 1, 0, watcher);
  40586. }
  40587. // queue the flush
  40588. if (!waiting) {
  40589. waiting = true;
  40590. nextTick(flushSchedulerQueue);
  40591. }
  40592. }
  40593. }
  40594. /* */
  40595. var uid$2 = 0;
  40596. /**
  40597. * A watcher parses an expression, collects dependencies,
  40598. * and fires callback when the expression value changes.
  40599. * This is used for both the $watch() api and directives.
  40600. */
  40601. var Watcher = function Watcher (
  40602. vm,
  40603. expOrFn,
  40604. cb,
  40605. options
  40606. ) {
  40607. this.vm = vm;
  40608. vm._watchers.push(this);
  40609. // options
  40610. if (options) {
  40611. this.deep = !!options.deep;
  40612. this.user = !!options.user;
  40613. this.lazy = !!options.lazy;
  40614. this.sync = !!options.sync;
  40615. } else {
  40616. this.deep = this.user = this.lazy = this.sync = false;
  40617. }
  40618. this.cb = cb;
  40619. this.id = ++uid$2; // uid for batching
  40620. this.active = true;
  40621. this.dirty = this.lazy; // for lazy watchers
  40622. this.deps = [];
  40623. this.newDeps = [];
  40624. this.depIds = new _Set();
  40625. this.newDepIds = new _Set();
  40626. this.expression = expOrFn.toString();
  40627. // parse expression for getter
  40628. if (typeof expOrFn === 'function') {
  40629. this.getter = expOrFn;
  40630. } else {
  40631. this.getter = parsePath(expOrFn);
  40632. if (!this.getter) {
  40633. this.getter = function () {};
  40634. "development" !== 'production' && warn(
  40635. "Failed watching path: \"" + expOrFn + "\" " +
  40636. 'Watcher only accepts simple dot-delimited paths. ' +
  40637. 'For full control, use a function instead.',
  40638. vm
  40639. );
  40640. }
  40641. }
  40642. this.value = this.lazy
  40643. ? undefined
  40644. : this.get();
  40645. };
  40646. /**
  40647. * Evaluate the getter, and re-collect dependencies.
  40648. */
  40649. Watcher.prototype.get = function get () {
  40650. pushTarget(this);
  40651. var value;
  40652. var vm = this.vm;
  40653. if (this.user) {
  40654. try {
  40655. value = this.getter.call(vm, vm);
  40656. } catch (e) {
  40657. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  40658. }
  40659. } else {
  40660. value = this.getter.call(vm, vm);
  40661. }
  40662. // "touch" every property so they are all tracked as
  40663. // dependencies for deep watching
  40664. if (this.deep) {
  40665. traverse(value);
  40666. }
  40667. popTarget();
  40668. this.cleanupDeps();
  40669. return value
  40670. };
  40671. /**
  40672. * Add a dependency to this directive.
  40673. */
  40674. Watcher.prototype.addDep = function addDep (dep) {
  40675. var id = dep.id;
  40676. if (!this.newDepIds.has(id)) {
  40677. this.newDepIds.add(id);
  40678. this.newDeps.push(dep);
  40679. if (!this.depIds.has(id)) {
  40680. dep.addSub(this);
  40681. }
  40682. }
  40683. };
  40684. /**
  40685. * Clean up for dependency collection.
  40686. */
  40687. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  40688. var this$1 = this;
  40689. var i = this.deps.length;
  40690. while (i--) {
  40691. var dep = this$1.deps[i];
  40692. if (!this$1.newDepIds.has(dep.id)) {
  40693. dep.removeSub(this$1);
  40694. }
  40695. }
  40696. var tmp = this.depIds;
  40697. this.depIds = this.newDepIds;
  40698. this.newDepIds = tmp;
  40699. this.newDepIds.clear();
  40700. tmp = this.deps;
  40701. this.deps = this.newDeps;
  40702. this.newDeps = tmp;
  40703. this.newDeps.length = 0;
  40704. };
  40705. /**
  40706. * Subscriber interface.
  40707. * Will be called when a dependency changes.
  40708. */
  40709. Watcher.prototype.update = function update () {
  40710. /* istanbul ignore else */
  40711. if (this.lazy) {
  40712. this.dirty = true;
  40713. } else if (this.sync) {
  40714. this.run();
  40715. } else {
  40716. queueWatcher(this);
  40717. }
  40718. };
  40719. /**
  40720. * Scheduler job interface.
  40721. * Will be called by the scheduler.
  40722. */
  40723. Watcher.prototype.run = function run () {
  40724. if (this.active) {
  40725. var value = this.get();
  40726. if (
  40727. value !== this.value ||
  40728. // Deep watchers and watchers on Object/Arrays should fire even
  40729. // when the value is the same, because the value may
  40730. // have mutated.
  40731. isObject(value) ||
  40732. this.deep
  40733. ) {
  40734. // set new value
  40735. var oldValue = this.value;
  40736. this.value = value;
  40737. if (this.user) {
  40738. try {
  40739. this.cb.call(this.vm, value, oldValue);
  40740. } catch (e) {
  40741. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  40742. }
  40743. } else {
  40744. this.cb.call(this.vm, value, oldValue);
  40745. }
  40746. }
  40747. }
  40748. };
  40749. /**
  40750. * Evaluate the value of the watcher.
  40751. * This only gets called for lazy watchers.
  40752. */
  40753. Watcher.prototype.evaluate = function evaluate () {
  40754. this.value = this.get();
  40755. this.dirty = false;
  40756. };
  40757. /**
  40758. * Depend on all deps collected by this watcher.
  40759. */
  40760. Watcher.prototype.depend = function depend () {
  40761. var this$1 = this;
  40762. var i = this.deps.length;
  40763. while (i--) {
  40764. this$1.deps[i].depend();
  40765. }
  40766. };
  40767. /**
  40768. * Remove self from all dependencies' subscriber list.
  40769. */
  40770. Watcher.prototype.teardown = function teardown () {
  40771. var this$1 = this;
  40772. if (this.active) {
  40773. // remove self from vm's watcher list
  40774. // this is a somewhat expensive operation so we skip it
  40775. // if the vm is being destroyed.
  40776. if (!this.vm._isBeingDestroyed) {
  40777. remove(this.vm._watchers, this);
  40778. }
  40779. var i = this.deps.length;
  40780. while (i--) {
  40781. this$1.deps[i].removeSub(this$1);
  40782. }
  40783. this.active = false;
  40784. }
  40785. };
  40786. /**
  40787. * Recursively traverse an object to evoke all converted
  40788. * getters, so that every nested property inside the object
  40789. * is collected as a "deep" dependency.
  40790. */
  40791. var seenObjects = new _Set();
  40792. function traverse (val) {
  40793. seenObjects.clear();
  40794. _traverse(val, seenObjects);
  40795. }
  40796. function _traverse (val, seen) {
  40797. var i, keys;
  40798. var isA = Array.isArray(val);
  40799. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  40800. return
  40801. }
  40802. if (val.__ob__) {
  40803. var depId = val.__ob__.dep.id;
  40804. if (seen.has(depId)) {
  40805. return
  40806. }
  40807. seen.add(depId);
  40808. }
  40809. if (isA) {
  40810. i = val.length;
  40811. while (i--) { _traverse(val[i], seen); }
  40812. } else {
  40813. keys = Object.keys(val);
  40814. i = keys.length;
  40815. while (i--) { _traverse(val[keys[i]], seen); }
  40816. }
  40817. }
  40818. /* */
  40819. var sharedPropertyDefinition = {
  40820. enumerable: true,
  40821. configurable: true,
  40822. get: noop,
  40823. set: noop
  40824. };
  40825. function proxy (target, sourceKey, key) {
  40826. sharedPropertyDefinition.get = function proxyGetter () {
  40827. return this[sourceKey][key]
  40828. };
  40829. sharedPropertyDefinition.set = function proxySetter (val) {
  40830. this[sourceKey][key] = val;
  40831. };
  40832. Object.defineProperty(target, key, sharedPropertyDefinition);
  40833. }
  40834. function initState (vm) {
  40835. vm._watchers = [];
  40836. var opts = vm.$options;
  40837. if (opts.props) { initProps(vm, opts.props); }
  40838. if (opts.methods) { initMethods(vm, opts.methods); }
  40839. if (opts.data) {
  40840. initData(vm);
  40841. } else {
  40842. observe(vm._data = {}, true /* asRootData */);
  40843. }
  40844. if (opts.computed) { initComputed(vm, opts.computed); }
  40845. if (opts.watch) { initWatch(vm, opts.watch); }
  40846. }
  40847. var isReservedProp = { key: 1, ref: 1, slot: 1 };
  40848. function initProps (vm, propsOptions) {
  40849. var propsData = vm.$options.propsData || {};
  40850. var props = vm._props = {};
  40851. // cache prop keys so that future props updates can iterate using Array
  40852. // instead of dynamic object key enumeration.
  40853. var keys = vm.$options._propKeys = [];
  40854. var isRoot = !vm.$parent;
  40855. // root instance props should be converted
  40856. observerState.shouldConvert = isRoot;
  40857. var loop = function ( key ) {
  40858. keys.push(key);
  40859. var value = validateProp(key, propsOptions, propsData, vm);
  40860. /* istanbul ignore else */
  40861. {
  40862. if (isReservedProp[key]) {
  40863. warn(
  40864. ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
  40865. vm
  40866. );
  40867. }
  40868. defineReactive$$1(props, key, value, function () {
  40869. if (vm.$parent && !observerState.isSettingProps) {
  40870. warn(
  40871. "Avoid mutating a prop directly since the value will be " +
  40872. "overwritten whenever the parent component re-renders. " +
  40873. "Instead, use a data or computed property based on the prop's " +
  40874. "value. Prop being mutated: \"" + key + "\"",
  40875. vm
  40876. );
  40877. }
  40878. });
  40879. }
  40880. // static props are already proxied on the component's prototype
  40881. // during Vue.extend(). We only need to proxy props defined at
  40882. // instantiation here.
  40883. if (!(key in vm)) {
  40884. proxy(vm, "_props", key);
  40885. }
  40886. };
  40887. for (var key in propsOptions) loop( key );
  40888. observerState.shouldConvert = true;
  40889. }
  40890. function initData (vm) {
  40891. var data = vm.$options.data;
  40892. data = vm._data = typeof data === 'function'
  40893. ? getData(data, vm)
  40894. : data || {};
  40895. if (!isPlainObject(data)) {
  40896. data = {};
  40897. "development" !== 'production' && warn(
  40898. 'data functions should return an object:\n' +
  40899. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  40900. vm
  40901. );
  40902. }
  40903. // proxy data on instance
  40904. var keys = Object.keys(data);
  40905. var props = vm.$options.props;
  40906. var i = keys.length;
  40907. while (i--) {
  40908. if (props && hasOwn(props, keys[i])) {
  40909. "development" !== 'production' && warn(
  40910. "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
  40911. "Use prop default value instead.",
  40912. vm
  40913. );
  40914. } else if (!isReserved(keys[i])) {
  40915. proxy(vm, "_data", keys[i]);
  40916. }
  40917. }
  40918. // observe data
  40919. observe(data, true /* asRootData */);
  40920. }
  40921. function getData (data, vm) {
  40922. try {
  40923. return data.call(vm)
  40924. } catch (e) {
  40925. handleError(e, vm, "data()");
  40926. return {}
  40927. }
  40928. }
  40929. var computedWatcherOptions = { lazy: true };
  40930. function initComputed (vm, computed) {
  40931. var watchers = vm._computedWatchers = Object.create(null);
  40932. for (var key in computed) {
  40933. var userDef = computed[key];
  40934. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  40935. // create internal watcher for the computed property.
  40936. watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
  40937. // component-defined computed properties are already defined on the
  40938. // component prototype. We only need to define computed properties defined
  40939. // at instantiation here.
  40940. if (!(key in vm)) {
  40941. defineComputed(vm, key, userDef);
  40942. }
  40943. }
  40944. }
  40945. function defineComputed (target, key, userDef) {
  40946. if (typeof userDef === 'function') {
  40947. sharedPropertyDefinition.get = createComputedGetter(key);
  40948. sharedPropertyDefinition.set = noop;
  40949. } else {
  40950. sharedPropertyDefinition.get = userDef.get
  40951. ? userDef.cache !== false
  40952. ? createComputedGetter(key)
  40953. : userDef.get
  40954. : noop;
  40955. sharedPropertyDefinition.set = userDef.set
  40956. ? userDef.set
  40957. : noop;
  40958. }
  40959. Object.defineProperty(target, key, sharedPropertyDefinition);
  40960. }
  40961. function createComputedGetter (key) {
  40962. return function computedGetter () {
  40963. var watcher = this._computedWatchers && this._computedWatchers[key];
  40964. if (watcher) {
  40965. if (watcher.dirty) {
  40966. watcher.evaluate();
  40967. }
  40968. if (Dep.target) {
  40969. watcher.depend();
  40970. }
  40971. return watcher.value
  40972. }
  40973. }
  40974. }
  40975. function initMethods (vm, methods) {
  40976. var props = vm.$options.props;
  40977. for (var key in methods) {
  40978. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  40979. {
  40980. if (methods[key] == null) {
  40981. warn(
  40982. "method \"" + key + "\" has an undefined value in the component definition. " +
  40983. "Did you reference the function correctly?",
  40984. vm
  40985. );
  40986. }
  40987. if (props && hasOwn(props, key)) {
  40988. warn(
  40989. ("method \"" + key + "\" has already been defined as a prop."),
  40990. vm
  40991. );
  40992. }
  40993. }
  40994. }
  40995. }
  40996. function initWatch (vm, watch) {
  40997. for (var key in watch) {
  40998. var handler = watch[key];
  40999. if (Array.isArray(handler)) {
  41000. for (var i = 0; i < handler.length; i++) {
  41001. createWatcher(vm, key, handler[i]);
  41002. }
  41003. } else {
  41004. createWatcher(vm, key, handler);
  41005. }
  41006. }
  41007. }
  41008. function createWatcher (vm, key, handler) {
  41009. var options;
  41010. if (isPlainObject(handler)) {
  41011. options = handler;
  41012. handler = handler.handler;
  41013. }
  41014. if (typeof handler === 'string') {
  41015. handler = vm[handler];
  41016. }
  41017. vm.$watch(key, handler, options);
  41018. }
  41019. function stateMixin (Vue) {
  41020. // flow somehow has problems with directly declared definition object
  41021. // when using Object.defineProperty, so we have to procedurally build up
  41022. // the object here.
  41023. var dataDef = {};
  41024. dataDef.get = function () { return this._data };
  41025. var propsDef = {};
  41026. propsDef.get = function () { return this._props };
  41027. {
  41028. dataDef.set = function (newData) {
  41029. warn(
  41030. 'Avoid replacing instance root $data. ' +
  41031. 'Use nested data properties instead.',
  41032. this
  41033. );
  41034. };
  41035. propsDef.set = function () {
  41036. warn("$props is readonly.", this);
  41037. };
  41038. }
  41039. Object.defineProperty(Vue.prototype, '$data', dataDef);
  41040. Object.defineProperty(Vue.prototype, '$props', propsDef);
  41041. Vue.prototype.$set = set;
  41042. Vue.prototype.$delete = del;
  41043. Vue.prototype.$watch = function (
  41044. expOrFn,
  41045. cb,
  41046. options
  41047. ) {
  41048. var vm = this;
  41049. options = options || {};
  41050. options.user = true;
  41051. var watcher = new Watcher(vm, expOrFn, cb, options);
  41052. if (options.immediate) {
  41053. cb.call(vm, watcher.value);
  41054. }
  41055. return function unwatchFn () {
  41056. watcher.teardown();
  41057. }
  41058. };
  41059. }
  41060. /* */
  41061. // hooks to be invoked on component VNodes during patch
  41062. var componentVNodeHooks = {
  41063. init: function init (
  41064. vnode,
  41065. hydrating,
  41066. parentElm,
  41067. refElm
  41068. ) {
  41069. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  41070. var child = vnode.componentInstance = createComponentInstanceForVnode(
  41071. vnode,
  41072. activeInstance,
  41073. parentElm,
  41074. refElm
  41075. );
  41076. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  41077. } else if (vnode.data.keepAlive) {
  41078. // kept-alive components, treat as a patch
  41079. var mountedNode = vnode; // work around flow
  41080. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  41081. }
  41082. },
  41083. prepatch: function prepatch (oldVnode, vnode) {
  41084. var options = vnode.componentOptions;
  41085. var child = vnode.componentInstance = oldVnode.componentInstance;
  41086. updateChildComponent(
  41087. child,
  41088. options.propsData, // updated props
  41089. options.listeners, // updated listeners
  41090. vnode, // new parent vnode
  41091. options.children // new children
  41092. );
  41093. },
  41094. insert: function insert (vnode) {
  41095. if (!vnode.componentInstance._isMounted) {
  41096. vnode.componentInstance._isMounted = true;
  41097. callHook(vnode.componentInstance, 'mounted');
  41098. }
  41099. if (vnode.data.keepAlive) {
  41100. activateChildComponent(vnode.componentInstance, true /* direct */);
  41101. }
  41102. },
  41103. destroy: function destroy (vnode) {
  41104. if (!vnode.componentInstance._isDestroyed) {
  41105. if (!vnode.data.keepAlive) {
  41106. vnode.componentInstance.$destroy();
  41107. } else {
  41108. deactivateChildComponent(vnode.componentInstance, true /* direct */);
  41109. }
  41110. }
  41111. }
  41112. };
  41113. var hooksToMerge = Object.keys(componentVNodeHooks);
  41114. function createComponent (
  41115. Ctor,
  41116. data,
  41117. context,
  41118. children,
  41119. tag
  41120. ) {
  41121. if (!Ctor) {
  41122. return
  41123. }
  41124. var baseCtor = context.$options._base;
  41125. if (isObject(Ctor)) {
  41126. Ctor = baseCtor.extend(Ctor);
  41127. }
  41128. if (typeof Ctor !== 'function') {
  41129. {
  41130. warn(("Invalid Component definition: " + (String(Ctor))), context);
  41131. }
  41132. return
  41133. }
  41134. // async component
  41135. if (!Ctor.cid) {
  41136. if (Ctor.resolved) {
  41137. Ctor = Ctor.resolved;
  41138. } else {
  41139. Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
  41140. // it's ok to queue this on every render because
  41141. // $forceUpdate is buffered by the scheduler.
  41142. context.$forceUpdate();
  41143. });
  41144. if (!Ctor) {
  41145. // return nothing if this is indeed an async component
  41146. // wait for the callback to trigger parent update.
  41147. return
  41148. }
  41149. }
  41150. }
  41151. // resolve constructor options in case global mixins are applied after
  41152. // component constructor creation
  41153. resolveConstructorOptions(Ctor);
  41154. data = data || {};
  41155. // transform component v-model data into props & events
  41156. if (data.model) {
  41157. transformModel(Ctor.options, data);
  41158. }
  41159. // extract props
  41160. var propsData = extractProps(data, Ctor, tag);
  41161. // functional component
  41162. if (Ctor.options.functional) {
  41163. return createFunctionalComponent(Ctor, propsData, data, context, children)
  41164. }
  41165. // extract listeners, since these needs to be treated as
  41166. // child component listeners instead of DOM listeners
  41167. var listeners = data.on;
  41168. // replace with listeners with .native modifier
  41169. data.on = data.nativeOn;
  41170. if (Ctor.options.abstract) {
  41171. // abstract components do not keep anything
  41172. // other than props & listeners
  41173. data = {};
  41174. }
  41175. // merge component management hooks onto the placeholder node
  41176. mergeHooks(data);
  41177. // return a placeholder vnode
  41178. var name = Ctor.options.name || tag;
  41179. var vnode = new VNode(
  41180. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  41181. data, undefined, undefined, undefined, context,
  41182. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  41183. );
  41184. return vnode
  41185. }
  41186. function createFunctionalComponent (
  41187. Ctor,
  41188. propsData,
  41189. data,
  41190. context,
  41191. children
  41192. ) {
  41193. var props = {};
  41194. var propOptions = Ctor.options.props;
  41195. if (propOptions) {
  41196. for (var key in propOptions) {
  41197. props[key] = validateProp(key, propOptions, propsData);
  41198. }
  41199. }
  41200. // ensure the createElement function in functional components
  41201. // gets a unique context - this is necessary for correct named slot check
  41202. var _context = Object.create(context);
  41203. var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
  41204. var vnode = Ctor.options.render.call(null, h, {
  41205. props: props,
  41206. data: data,
  41207. parent: context,
  41208. children: children,
  41209. slots: function () { return resolveSlots(children, context); }
  41210. });
  41211. if (vnode instanceof VNode) {
  41212. vnode.functionalContext = context;
  41213. if (data.slot) {
  41214. (vnode.data || (vnode.data = {})).slot = data.slot;
  41215. }
  41216. }
  41217. return vnode
  41218. }
  41219. function createComponentInstanceForVnode (
  41220. vnode, // we know it's MountedComponentVNode but flow doesn't
  41221. parent, // activeInstance in lifecycle state
  41222. parentElm,
  41223. refElm
  41224. ) {
  41225. var vnodeComponentOptions = vnode.componentOptions;
  41226. var options = {
  41227. _isComponent: true,
  41228. parent: parent,
  41229. propsData: vnodeComponentOptions.propsData,
  41230. _componentTag: vnodeComponentOptions.tag,
  41231. _parentVnode: vnode,
  41232. _parentListeners: vnodeComponentOptions.listeners,
  41233. _renderChildren: vnodeComponentOptions.children,
  41234. _parentElm: parentElm || null,
  41235. _refElm: refElm || null
  41236. };
  41237. // check inline-template render functions
  41238. var inlineTemplate = vnode.data.inlineTemplate;
  41239. if (inlineTemplate) {
  41240. options.render = inlineTemplate.render;
  41241. options.staticRenderFns = inlineTemplate.staticRenderFns;
  41242. }
  41243. return new vnodeComponentOptions.Ctor(options)
  41244. }
  41245. function resolveAsyncComponent (
  41246. factory,
  41247. baseCtor,
  41248. cb
  41249. ) {
  41250. if (factory.requested) {
  41251. // pool callbacks
  41252. factory.pendingCallbacks.push(cb);
  41253. } else {
  41254. factory.requested = true;
  41255. var cbs = factory.pendingCallbacks = [cb];
  41256. var sync = true;
  41257. var resolve = function (res) {
  41258. if (isObject(res)) {
  41259. res = baseCtor.extend(res);
  41260. }
  41261. // cache resolved
  41262. factory.resolved = res;
  41263. // invoke callbacks only if this is not a synchronous resolve
  41264. // (async resolves are shimmed as synchronous during SSR)
  41265. if (!sync) {
  41266. for (var i = 0, l = cbs.length; i < l; i++) {
  41267. cbs[i](res);
  41268. }
  41269. }
  41270. };
  41271. var reject = function (reason) {
  41272. "development" !== 'production' && warn(
  41273. "Failed to resolve async component: " + (String(factory)) +
  41274. (reason ? ("\nReason: " + reason) : '')
  41275. );
  41276. };
  41277. var res = factory(resolve, reject);
  41278. // handle promise
  41279. if (res && typeof res.then === 'function' && !factory.resolved) {
  41280. res.then(resolve, reject);
  41281. }
  41282. sync = false;
  41283. // return in case resolved synchronously
  41284. return factory.resolved
  41285. }
  41286. }
  41287. function extractProps (data, Ctor, tag) {
  41288. // we are only extracting raw values here.
  41289. // validation and default values are handled in the child
  41290. // component itself.
  41291. var propOptions = Ctor.options.props;
  41292. if (!propOptions) {
  41293. return
  41294. }
  41295. var res = {};
  41296. var attrs = data.attrs;
  41297. var props = data.props;
  41298. var domProps = data.domProps;
  41299. if (attrs || props || domProps) {
  41300. for (var key in propOptions) {
  41301. var altKey = hyphenate(key);
  41302. {
  41303. var keyInLowerCase = key.toLowerCase();
  41304. if (
  41305. key !== keyInLowerCase &&
  41306. attrs && attrs.hasOwnProperty(keyInLowerCase)
  41307. ) {
  41308. tip(
  41309. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  41310. (formatComponentName(tag || Ctor)) + ", but the delared prop name is" +
  41311. " \"" + key + "\". " +
  41312. "Note that HTML attributes are case-insensitive and camelCased " +
  41313. "props need to use their kebab-case equivalents when using in-DOM " +
  41314. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  41315. );
  41316. }
  41317. }
  41318. checkProp(res, props, key, altKey, true) ||
  41319. checkProp(res, attrs, key, altKey) ||
  41320. checkProp(res, domProps, key, altKey);
  41321. }
  41322. }
  41323. return res
  41324. }
  41325. function checkProp (
  41326. res,
  41327. hash,
  41328. key,
  41329. altKey,
  41330. preserve
  41331. ) {
  41332. if (hash) {
  41333. if (hasOwn(hash, key)) {
  41334. res[key] = hash[key];
  41335. if (!preserve) {
  41336. delete hash[key];
  41337. }
  41338. return true
  41339. } else if (hasOwn(hash, altKey)) {
  41340. res[key] = hash[altKey];
  41341. if (!preserve) {
  41342. delete hash[altKey];
  41343. }
  41344. return true
  41345. }
  41346. }
  41347. return false
  41348. }
  41349. function mergeHooks (data) {
  41350. if (!data.hook) {
  41351. data.hook = {};
  41352. }
  41353. for (var i = 0; i < hooksToMerge.length; i++) {
  41354. var key = hooksToMerge[i];
  41355. var fromParent = data.hook[key];
  41356. var ours = componentVNodeHooks[key];
  41357. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  41358. }
  41359. }
  41360. function mergeHook$1 (one, two) {
  41361. return function (a, b, c, d) {
  41362. one(a, b, c, d);
  41363. two(a, b, c, d);
  41364. }
  41365. }
  41366. // transform component v-model info (value and callback) into
  41367. // prop and event handler respectively.
  41368. function transformModel (options, data) {
  41369. var prop = (options.model && options.model.prop) || 'value';
  41370. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  41371. var on = data.on || (data.on = {});
  41372. if (on[event]) {
  41373. on[event] = [data.model.callback].concat(on[event]);
  41374. } else {
  41375. on[event] = data.model.callback;
  41376. }
  41377. }
  41378. /* */
  41379. var SIMPLE_NORMALIZE = 1;
  41380. var ALWAYS_NORMALIZE = 2;
  41381. // wrapper function for providing a more flexible interface
  41382. // without getting yelled at by flow
  41383. function createElement (
  41384. context,
  41385. tag,
  41386. data,
  41387. children,
  41388. normalizationType,
  41389. alwaysNormalize
  41390. ) {
  41391. if (Array.isArray(data) || isPrimitive(data)) {
  41392. normalizationType = children;
  41393. children = data;
  41394. data = undefined;
  41395. }
  41396. if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
  41397. return _createElement(context, tag, data, children, normalizationType)
  41398. }
  41399. function _createElement (
  41400. context,
  41401. tag,
  41402. data,
  41403. children,
  41404. normalizationType
  41405. ) {
  41406. if (data && data.__ob__) {
  41407. "development" !== 'production' && warn(
  41408. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  41409. 'Always create fresh vnode data objects in each render!',
  41410. context
  41411. );
  41412. return createEmptyVNode()
  41413. }
  41414. if (!tag) {
  41415. // in case of component :is set to falsy value
  41416. return createEmptyVNode()
  41417. }
  41418. // support single function children as default scoped slot
  41419. if (Array.isArray(children) &&
  41420. typeof children[0] === 'function') {
  41421. data = data || {};
  41422. data.scopedSlots = { default: children[0] };
  41423. children.length = 0;
  41424. }
  41425. if (normalizationType === ALWAYS_NORMALIZE) {
  41426. children = normalizeChildren(children);
  41427. } else if (normalizationType === SIMPLE_NORMALIZE) {
  41428. children = simpleNormalizeChildren(children);
  41429. }
  41430. var vnode, ns;
  41431. if (typeof tag === 'string') {
  41432. var Ctor;
  41433. ns = config.getTagNamespace(tag);
  41434. if (config.isReservedTag(tag)) {
  41435. // platform built-in elements
  41436. vnode = new VNode(
  41437. config.parsePlatformTagName(tag), data, children,
  41438. undefined, undefined, context
  41439. );
  41440. } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
  41441. // component
  41442. vnode = createComponent(Ctor, data, context, children, tag);
  41443. } else {
  41444. // unknown or unlisted namespaced elements
  41445. // check at runtime because it may get assigned a namespace when its
  41446. // parent normalizes children
  41447. vnode = new VNode(
  41448. tag, data, children,
  41449. undefined, undefined, context
  41450. );
  41451. }
  41452. } else {
  41453. // direct component options / constructor
  41454. vnode = createComponent(tag, data, context, children);
  41455. }
  41456. if (vnode) {
  41457. if (ns) { applyNS(vnode, ns); }
  41458. return vnode
  41459. } else {
  41460. return createEmptyVNode()
  41461. }
  41462. }
  41463. function applyNS (vnode, ns) {
  41464. vnode.ns = ns;
  41465. if (vnode.tag === 'foreignObject') {
  41466. // use default namespace inside foreignObject
  41467. return
  41468. }
  41469. if (vnode.children) {
  41470. for (var i = 0, l = vnode.children.length; i < l; i++) {
  41471. var child = vnode.children[i];
  41472. if (child.tag && !child.ns) {
  41473. applyNS(child, ns);
  41474. }
  41475. }
  41476. }
  41477. }
  41478. /* */
  41479. /**
  41480. * Runtime helper for rendering v-for lists.
  41481. */
  41482. function renderList (
  41483. val,
  41484. render
  41485. ) {
  41486. var ret, i, l, keys, key;
  41487. if (Array.isArray(val) || typeof val === 'string') {
  41488. ret = new Array(val.length);
  41489. for (i = 0, l = val.length; i < l; i++) {
  41490. ret[i] = render(val[i], i);
  41491. }
  41492. } else if (typeof val === 'number') {
  41493. ret = new Array(val);
  41494. for (i = 0; i < val; i++) {
  41495. ret[i] = render(i + 1, i);
  41496. }
  41497. } else if (isObject(val)) {
  41498. keys = Object.keys(val);
  41499. ret = new Array(keys.length);
  41500. for (i = 0, l = keys.length; i < l; i++) {
  41501. key = keys[i];
  41502. ret[i] = render(val[key], key, i);
  41503. }
  41504. }
  41505. return ret
  41506. }
  41507. /* */
  41508. /**
  41509. * Runtime helper for rendering <slot>
  41510. */
  41511. function renderSlot (
  41512. name,
  41513. fallback,
  41514. props,
  41515. bindObject
  41516. ) {
  41517. var scopedSlotFn = this.$scopedSlots[name];
  41518. if (scopedSlotFn) { // scoped slot
  41519. props = props || {};
  41520. if (bindObject) {
  41521. extend(props, bindObject);
  41522. }
  41523. return scopedSlotFn(props) || fallback
  41524. } else {
  41525. var slotNodes = this.$slots[name];
  41526. // warn duplicate slot usage
  41527. if (slotNodes && "development" !== 'production') {
  41528. slotNodes._rendered && warn(
  41529. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  41530. "- this will likely cause render errors.",
  41531. this
  41532. );
  41533. slotNodes._rendered = true;
  41534. }
  41535. return slotNodes || fallback
  41536. }
  41537. }
  41538. /* */
  41539. /**
  41540. * Runtime helper for resolving filters
  41541. */
  41542. function resolveFilter (id) {
  41543. return resolveAsset(this.$options, 'filters', id, true) || identity
  41544. }
  41545. /* */
  41546. /**
  41547. * Runtime helper for checking keyCodes from config.
  41548. */
  41549. function checkKeyCodes (
  41550. eventKeyCode,
  41551. key,
  41552. builtInAlias
  41553. ) {
  41554. var keyCodes = config.keyCodes[key] || builtInAlias;
  41555. if (Array.isArray(keyCodes)) {
  41556. return keyCodes.indexOf(eventKeyCode) === -1
  41557. } else {
  41558. return keyCodes !== eventKeyCode
  41559. }
  41560. }
  41561. /* */
  41562. /**
  41563. * Runtime helper for merging v-bind="object" into a VNode's data.
  41564. */
  41565. function bindObjectProps (
  41566. data,
  41567. tag,
  41568. value,
  41569. asProp
  41570. ) {
  41571. if (value) {
  41572. if (!isObject(value)) {
  41573. "development" !== 'production' && warn(
  41574. 'v-bind without argument expects an Object or Array value',
  41575. this
  41576. );
  41577. } else {
  41578. if (Array.isArray(value)) {
  41579. value = toObject(value);
  41580. }
  41581. var hash;
  41582. for (var key in value) {
  41583. if (key === 'class' || key === 'style') {
  41584. hash = data;
  41585. } else {
  41586. var type = data.attrs && data.attrs.type;
  41587. hash = asProp || config.mustUseProp(tag, type, key)
  41588. ? data.domProps || (data.domProps = {})
  41589. : data.attrs || (data.attrs = {});
  41590. }
  41591. if (!(key in hash)) {
  41592. hash[key] = value[key];
  41593. }
  41594. }
  41595. }
  41596. }
  41597. return data
  41598. }
  41599. /* */
  41600. /**
  41601. * Runtime helper for rendering static trees.
  41602. */
  41603. function renderStatic (
  41604. index,
  41605. isInFor
  41606. ) {
  41607. var tree = this._staticTrees[index];
  41608. // if has already-rendered static tree and not inside v-for,
  41609. // we can reuse the same tree by doing a shallow clone.
  41610. if (tree && !isInFor) {
  41611. return Array.isArray(tree)
  41612. ? cloneVNodes(tree)
  41613. : cloneVNode(tree)
  41614. }
  41615. // otherwise, render a fresh tree.
  41616. tree = this._staticTrees[index] =
  41617. this.$options.staticRenderFns[index].call(this._renderProxy);
  41618. markStatic(tree, ("__static__" + index), false);
  41619. return tree
  41620. }
  41621. /**
  41622. * Runtime helper for v-once.
  41623. * Effectively it means marking the node as static with a unique key.
  41624. */
  41625. function markOnce (
  41626. tree,
  41627. index,
  41628. key
  41629. ) {
  41630. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  41631. return tree
  41632. }
  41633. function markStatic (
  41634. tree,
  41635. key,
  41636. isOnce
  41637. ) {
  41638. if (Array.isArray(tree)) {
  41639. for (var i = 0; i < tree.length; i++) {
  41640. if (tree[i] && typeof tree[i] !== 'string') {
  41641. markStaticNode(tree[i], (key + "_" + i), isOnce);
  41642. }
  41643. }
  41644. } else {
  41645. markStaticNode(tree, key, isOnce);
  41646. }
  41647. }
  41648. function markStaticNode (node, key, isOnce) {
  41649. node.isStatic = true;
  41650. node.key = key;
  41651. node.isOnce = isOnce;
  41652. }
  41653. /* */
  41654. function initRender (vm) {
  41655. vm.$vnode = null; // the placeholder node in parent tree
  41656. vm._vnode = null; // the root of the child tree
  41657. vm._staticTrees = null;
  41658. var parentVnode = vm.$options._parentVnode;
  41659. var renderContext = parentVnode && parentVnode.context;
  41660. vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
  41661. vm.$scopedSlots = emptyObject;
  41662. // bind the createElement fn to this instance
  41663. // so that we get proper render context inside it.
  41664. // args order: tag, data, children, normalizationType, alwaysNormalize
  41665. // internal version is used by render functions compiled from templates
  41666. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  41667. // normalization is always applied for the public version, used in
  41668. // user-written render functions.
  41669. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  41670. }
  41671. function renderMixin (Vue) {
  41672. Vue.prototype.$nextTick = function (fn) {
  41673. return nextTick(fn, this)
  41674. };
  41675. Vue.prototype._render = function () {
  41676. var vm = this;
  41677. var ref = vm.$options;
  41678. var render = ref.render;
  41679. var staticRenderFns = ref.staticRenderFns;
  41680. var _parentVnode = ref._parentVnode;
  41681. if (vm._isMounted) {
  41682. // clone slot nodes on re-renders
  41683. for (var key in vm.$slots) {
  41684. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  41685. }
  41686. }
  41687. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  41688. if (staticRenderFns && !vm._staticTrees) {
  41689. vm._staticTrees = [];
  41690. }
  41691. // set parent vnode. this allows render functions to have access
  41692. // to the data on the placeholder node.
  41693. vm.$vnode = _parentVnode;
  41694. // render self
  41695. var vnode;
  41696. try {
  41697. vnode = render.call(vm._renderProxy, vm.$createElement);
  41698. } catch (e) {
  41699. handleError(e, vm, "render function");
  41700. // return error render result,
  41701. // or previous vnode to prevent render error causing blank component
  41702. /* istanbul ignore else */
  41703. {
  41704. vnode = vm.$options.renderError
  41705. ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
  41706. : vm._vnode;
  41707. }
  41708. }
  41709. // return empty vnode in case the render function errored out
  41710. if (!(vnode instanceof VNode)) {
  41711. if ("development" !== 'production' && Array.isArray(vnode)) {
  41712. warn(
  41713. 'Multiple root nodes returned from render function. Render function ' +
  41714. 'should return a single root node.',
  41715. vm
  41716. );
  41717. }
  41718. vnode = createEmptyVNode();
  41719. }
  41720. // set parent
  41721. vnode.parent = _parentVnode;
  41722. return vnode
  41723. };
  41724. // internal render helpers.
  41725. // these are exposed on the instance prototype to reduce generated render
  41726. // code size.
  41727. Vue.prototype._o = markOnce;
  41728. Vue.prototype._n = toNumber;
  41729. Vue.prototype._s = _toString;
  41730. Vue.prototype._l = renderList;
  41731. Vue.prototype._t = renderSlot;
  41732. Vue.prototype._q = looseEqual;
  41733. Vue.prototype._i = looseIndexOf;
  41734. Vue.prototype._m = renderStatic;
  41735. Vue.prototype._f = resolveFilter;
  41736. Vue.prototype._k = checkKeyCodes;
  41737. Vue.prototype._b = bindObjectProps;
  41738. Vue.prototype._v = createTextVNode;
  41739. Vue.prototype._e = createEmptyVNode;
  41740. Vue.prototype._u = resolveScopedSlots;
  41741. }
  41742. /* */
  41743. function initProvide (vm) {
  41744. var provide = vm.$options.provide;
  41745. if (provide) {
  41746. vm._provided = typeof provide === 'function'
  41747. ? provide.call(vm)
  41748. : provide;
  41749. }
  41750. }
  41751. function initInjections (vm) {
  41752. var inject = vm.$options.inject;
  41753. if (inject) {
  41754. // inject is :any because flow is not smart enough to figure out cached
  41755. // isArray here
  41756. var isArray = Array.isArray(inject);
  41757. var keys = isArray
  41758. ? inject
  41759. : hasSymbol
  41760. ? Reflect.ownKeys(inject)
  41761. : Object.keys(inject);
  41762. var loop = function ( i ) {
  41763. var key = keys[i];
  41764. var provideKey = isArray ? key : inject[key];
  41765. var source = vm;
  41766. while (source) {
  41767. if (source._provided && provideKey in source._provided) {
  41768. /* istanbul ignore else */
  41769. {
  41770. defineReactive$$1(vm, key, source._provided[provideKey], function () {
  41771. warn(
  41772. "Avoid mutating an injected value directly since the changes will be " +
  41773. "overwritten whenever the provided component re-renders. " +
  41774. "injection being mutated: \"" + key + "\"",
  41775. vm
  41776. );
  41777. });
  41778. }
  41779. break
  41780. }
  41781. source = source.$parent;
  41782. }
  41783. };
  41784. for (var i = 0; i < keys.length; i++) loop( i );
  41785. }
  41786. }
  41787. /* */
  41788. var uid = 0;
  41789. function initMixin (Vue) {
  41790. Vue.prototype._init = function (options) {
  41791. var vm = this;
  41792. // a uid
  41793. vm._uid = uid++;
  41794. var startTag, endTag;
  41795. /* istanbul ignore if */
  41796. if ("development" !== 'production' && config.performance && mark) {
  41797. startTag = "vue-perf-init:" + (vm._uid);
  41798. endTag = "vue-perf-end:" + (vm._uid);
  41799. mark(startTag);
  41800. }
  41801. // a flag to avoid this being observed
  41802. vm._isVue = true;
  41803. // merge options
  41804. if (options && options._isComponent) {
  41805. // optimize internal component instantiation
  41806. // since dynamic options merging is pretty slow, and none of the
  41807. // internal component options needs special treatment.
  41808. initInternalComponent(vm, options);
  41809. } else {
  41810. vm.$options = mergeOptions(
  41811. resolveConstructorOptions(vm.constructor),
  41812. options || {},
  41813. vm
  41814. );
  41815. }
  41816. /* istanbul ignore else */
  41817. {
  41818. initProxy(vm);
  41819. }
  41820. // expose real self
  41821. vm._self = vm;
  41822. initLifecycle(vm);
  41823. initEvents(vm);
  41824. initRender(vm);
  41825. callHook(vm, 'beforeCreate');
  41826. initInjections(vm); // resolve injections before data/props
  41827. initState(vm);
  41828. initProvide(vm); // resolve provide after data/props
  41829. callHook(vm, 'created');
  41830. /* istanbul ignore if */
  41831. if ("development" !== 'production' && config.performance && mark) {
  41832. vm._name = formatComponentName(vm, false);
  41833. mark(endTag);
  41834. measure(((vm._name) + " init"), startTag, endTag);
  41835. }
  41836. if (vm.$options.el) {
  41837. vm.$mount(vm.$options.el);
  41838. }
  41839. };
  41840. }
  41841. function initInternalComponent (vm, options) {
  41842. var opts = vm.$options = Object.create(vm.constructor.options);
  41843. // doing this because it's faster than dynamic enumeration.
  41844. opts.parent = options.parent;
  41845. opts.propsData = options.propsData;
  41846. opts._parentVnode = options._parentVnode;
  41847. opts._parentListeners = options._parentListeners;
  41848. opts._renderChildren = options._renderChildren;
  41849. opts._componentTag = options._componentTag;
  41850. opts._parentElm = options._parentElm;
  41851. opts._refElm = options._refElm;
  41852. if (options.render) {
  41853. opts.render = options.render;
  41854. opts.staticRenderFns = options.staticRenderFns;
  41855. }
  41856. }
  41857. function resolveConstructorOptions (Ctor) {
  41858. var options = Ctor.options;
  41859. if (Ctor.super) {
  41860. var superOptions = resolveConstructorOptions(Ctor.super);
  41861. var cachedSuperOptions = Ctor.superOptions;
  41862. if (superOptions !== cachedSuperOptions) {
  41863. // super option changed,
  41864. // need to resolve new options.
  41865. Ctor.superOptions = superOptions;
  41866. // check if there are any late-modified/attached options (#4976)
  41867. var modifiedOptions = resolveModifiedOptions(Ctor);
  41868. // update base extend options
  41869. if (modifiedOptions) {
  41870. extend(Ctor.extendOptions, modifiedOptions);
  41871. }
  41872. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  41873. if (options.name) {
  41874. options.components[options.name] = Ctor;
  41875. }
  41876. }
  41877. }
  41878. return options
  41879. }
  41880. function resolveModifiedOptions (Ctor) {
  41881. var modified;
  41882. var latest = Ctor.options;
  41883. var sealed = Ctor.sealedOptions;
  41884. for (var key in latest) {
  41885. if (latest[key] !== sealed[key]) {
  41886. if (!modified) { modified = {}; }
  41887. modified[key] = dedupe(latest[key], sealed[key]);
  41888. }
  41889. }
  41890. return modified
  41891. }
  41892. function dedupe (latest, sealed) {
  41893. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  41894. // between merges
  41895. if (Array.isArray(latest)) {
  41896. var res = [];
  41897. sealed = Array.isArray(sealed) ? sealed : [sealed];
  41898. for (var i = 0; i < latest.length; i++) {
  41899. if (sealed.indexOf(latest[i]) < 0) {
  41900. res.push(latest[i]);
  41901. }
  41902. }
  41903. return res
  41904. } else {
  41905. return latest
  41906. }
  41907. }
  41908. function Vue$3 (options) {
  41909. if ("development" !== 'production' &&
  41910. !(this instanceof Vue$3)) {
  41911. warn('Vue is a constructor and should be called with the `new` keyword');
  41912. }
  41913. this._init(options);
  41914. }
  41915. initMixin(Vue$3);
  41916. stateMixin(Vue$3);
  41917. eventsMixin(Vue$3);
  41918. lifecycleMixin(Vue$3);
  41919. renderMixin(Vue$3);
  41920. /* */
  41921. function initUse (Vue) {
  41922. Vue.use = function (plugin) {
  41923. /* istanbul ignore if */
  41924. if (plugin.installed) {
  41925. return
  41926. }
  41927. // additional parameters
  41928. var args = toArray(arguments, 1);
  41929. args.unshift(this);
  41930. if (typeof plugin.install === 'function') {
  41931. plugin.install.apply(plugin, args);
  41932. } else if (typeof plugin === 'function') {
  41933. plugin.apply(null, args);
  41934. }
  41935. plugin.installed = true;
  41936. return this
  41937. };
  41938. }
  41939. /* */
  41940. function initMixin$1 (Vue) {
  41941. Vue.mixin = function (mixin) {
  41942. this.options = mergeOptions(this.options, mixin);
  41943. };
  41944. }
  41945. /* */
  41946. function initExtend (Vue) {
  41947. /**
  41948. * Each instance constructor, including Vue, has a unique
  41949. * cid. This enables us to create wrapped "child
  41950. * constructors" for prototypal inheritance and cache them.
  41951. */
  41952. Vue.cid = 0;
  41953. var cid = 1;
  41954. /**
  41955. * Class inheritance
  41956. */
  41957. Vue.extend = function (extendOptions) {
  41958. extendOptions = extendOptions || {};
  41959. var Super = this;
  41960. var SuperId = Super.cid;
  41961. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  41962. if (cachedCtors[SuperId]) {
  41963. return cachedCtors[SuperId]
  41964. }
  41965. var name = extendOptions.name || Super.options.name;
  41966. {
  41967. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  41968. warn(
  41969. 'Invalid component name: "' + name + '". Component names ' +
  41970. 'can only contain alphanumeric characters and the hyphen, ' +
  41971. 'and must start with a letter.'
  41972. );
  41973. }
  41974. }
  41975. var Sub = function VueComponent (options) {
  41976. this._init(options);
  41977. };
  41978. Sub.prototype = Object.create(Super.prototype);
  41979. Sub.prototype.constructor = Sub;
  41980. Sub.cid = cid++;
  41981. Sub.options = mergeOptions(
  41982. Super.options,
  41983. extendOptions
  41984. );
  41985. Sub['super'] = Super;
  41986. // For props and computed properties, we define the proxy getters on
  41987. // the Vue instances at extension time, on the extended prototype. This
  41988. // avoids Object.defineProperty calls for each instance created.
  41989. if (Sub.options.props) {
  41990. initProps$1(Sub);
  41991. }
  41992. if (Sub.options.computed) {
  41993. initComputed$1(Sub);
  41994. }
  41995. // allow further extension/mixin/plugin usage
  41996. Sub.extend = Super.extend;
  41997. Sub.mixin = Super.mixin;
  41998. Sub.use = Super.use;
  41999. // create asset registers, so extended classes
  42000. // can have their private assets too.
  42001. config._assetTypes.forEach(function (type) {
  42002. Sub[type] = Super[type];
  42003. });
  42004. // enable recursive self-lookup
  42005. if (name) {
  42006. Sub.options.components[name] = Sub;
  42007. }
  42008. // keep a reference to the super options at extension time.
  42009. // later at instantiation we can check if Super's options have
  42010. // been updated.
  42011. Sub.superOptions = Super.options;
  42012. Sub.extendOptions = extendOptions;
  42013. Sub.sealedOptions = extend({}, Sub.options);
  42014. // cache constructor
  42015. cachedCtors[SuperId] = Sub;
  42016. return Sub
  42017. };
  42018. }
  42019. function initProps$1 (Comp) {
  42020. var props = Comp.options.props;
  42021. for (var key in props) {
  42022. proxy(Comp.prototype, "_props", key);
  42023. }
  42024. }
  42025. function initComputed$1 (Comp) {
  42026. var computed = Comp.options.computed;
  42027. for (var key in computed) {
  42028. defineComputed(Comp.prototype, key, computed[key]);
  42029. }
  42030. }
  42031. /* */
  42032. function initAssetRegisters (Vue) {
  42033. /**
  42034. * Create asset registration methods.
  42035. */
  42036. config._assetTypes.forEach(function (type) {
  42037. Vue[type] = function (
  42038. id,
  42039. definition
  42040. ) {
  42041. if (!definition) {
  42042. return this.options[type + 's'][id]
  42043. } else {
  42044. /* istanbul ignore if */
  42045. {
  42046. if (type === 'component' && config.isReservedTag(id)) {
  42047. warn(
  42048. 'Do not use built-in or reserved HTML elements as component ' +
  42049. 'id: ' + id
  42050. );
  42051. }
  42052. }
  42053. if (type === 'component' && isPlainObject(definition)) {
  42054. definition.name = definition.name || id;
  42055. definition = this.options._base.extend(definition);
  42056. }
  42057. if (type === 'directive' && typeof definition === 'function') {
  42058. definition = { bind: definition, update: definition };
  42059. }
  42060. this.options[type + 's'][id] = definition;
  42061. return definition
  42062. }
  42063. };
  42064. });
  42065. }
  42066. /* */
  42067. var patternTypes = [String, RegExp];
  42068. function getComponentName (opts) {
  42069. return opts && (opts.Ctor.options.name || opts.tag)
  42070. }
  42071. function matches (pattern, name) {
  42072. if (typeof pattern === 'string') {
  42073. return pattern.split(',').indexOf(name) > -1
  42074. } else if (pattern instanceof RegExp) {
  42075. return pattern.test(name)
  42076. }
  42077. /* istanbul ignore next */
  42078. return false
  42079. }
  42080. function pruneCache (cache, filter) {
  42081. for (var key in cache) {
  42082. var cachedNode = cache[key];
  42083. if (cachedNode) {
  42084. var name = getComponentName(cachedNode.componentOptions);
  42085. if (name && !filter(name)) {
  42086. pruneCacheEntry(cachedNode);
  42087. cache[key] = null;
  42088. }
  42089. }
  42090. }
  42091. }
  42092. function pruneCacheEntry (vnode) {
  42093. if (vnode) {
  42094. if (!vnode.componentInstance._inactive) {
  42095. callHook(vnode.componentInstance, 'deactivated');
  42096. }
  42097. vnode.componentInstance.$destroy();
  42098. }
  42099. }
  42100. var KeepAlive = {
  42101. name: 'keep-alive',
  42102. abstract: true,
  42103. props: {
  42104. include: patternTypes,
  42105. exclude: patternTypes
  42106. },
  42107. created: function created () {
  42108. this.cache = Object.create(null);
  42109. },
  42110. destroyed: function destroyed () {
  42111. var this$1 = this;
  42112. for (var key in this$1.cache) {
  42113. pruneCacheEntry(this$1.cache[key]);
  42114. }
  42115. },
  42116. watch: {
  42117. include: function include (val) {
  42118. pruneCache(this.cache, function (name) { return matches(val, name); });
  42119. },
  42120. exclude: function exclude (val) {
  42121. pruneCache(this.cache, function (name) { return !matches(val, name); });
  42122. }
  42123. },
  42124. render: function render () {
  42125. var vnode = getFirstComponentChild(this.$slots.default);
  42126. var componentOptions = vnode && vnode.componentOptions;
  42127. if (componentOptions) {
  42128. // check pattern
  42129. var name = getComponentName(componentOptions);
  42130. if (name && (
  42131. (this.include && !matches(this.include, name)) ||
  42132. (this.exclude && matches(this.exclude, name))
  42133. )) {
  42134. return vnode
  42135. }
  42136. var key = vnode.key == null
  42137. // same constructor may get registered as different local components
  42138. // so cid alone is not enough (#3269)
  42139. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  42140. : vnode.key;
  42141. if (this.cache[key]) {
  42142. vnode.componentInstance = this.cache[key].componentInstance;
  42143. } else {
  42144. this.cache[key] = vnode;
  42145. }
  42146. vnode.data.keepAlive = true;
  42147. }
  42148. return vnode
  42149. }
  42150. };
  42151. var builtInComponents = {
  42152. KeepAlive: KeepAlive
  42153. };
  42154. /* */
  42155. function initGlobalAPI (Vue) {
  42156. // config
  42157. var configDef = {};
  42158. configDef.get = function () { return config; };
  42159. {
  42160. configDef.set = function () {
  42161. warn(
  42162. 'Do not replace the Vue.config object, set individual fields instead.'
  42163. );
  42164. };
  42165. }
  42166. Object.defineProperty(Vue, 'config', configDef);
  42167. // exposed util methods.
  42168. // NOTE: these are not considered part of the public API - avoid relying on
  42169. // them unless you are aware of the risk.
  42170. Vue.util = {
  42171. warn: warn,
  42172. extend: extend,
  42173. mergeOptions: mergeOptions,
  42174. defineReactive: defineReactive$$1
  42175. };
  42176. Vue.set = set;
  42177. Vue.delete = del;
  42178. Vue.nextTick = nextTick;
  42179. Vue.options = Object.create(null);
  42180. config._assetTypes.forEach(function (type) {
  42181. Vue.options[type + 's'] = Object.create(null);
  42182. });
  42183. // this is used to identify the "base" constructor to extend all plain-object
  42184. // components with in Weex's multi-instance scenarios.
  42185. Vue.options._base = Vue;
  42186. extend(Vue.options.components, builtInComponents);
  42187. initUse(Vue);
  42188. initMixin$1(Vue);
  42189. initExtend(Vue);
  42190. initAssetRegisters(Vue);
  42191. }
  42192. initGlobalAPI(Vue$3);
  42193. Object.defineProperty(Vue$3.prototype, '$isServer', {
  42194. get: isServerRendering
  42195. });
  42196. Vue$3.version = '2.2.5';
  42197. /* */
  42198. // attributes that should be using props for binding
  42199. var acceptValue = makeMap('input,textarea,option,select');
  42200. var mustUseProp = function (tag, type, attr) {
  42201. return (
  42202. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  42203. (attr === 'selected' && tag === 'option') ||
  42204. (attr === 'checked' && tag === 'input') ||
  42205. (attr === 'muted' && tag === 'video')
  42206. )
  42207. };
  42208. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  42209. var isBooleanAttr = makeMap(
  42210. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  42211. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  42212. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  42213. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  42214. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  42215. 'truespeed,typemustmatch,visible'
  42216. );
  42217. var xlinkNS = 'http://www.w3.org/1999/xlink';
  42218. var isXlink = function (name) {
  42219. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  42220. };
  42221. var getXlinkProp = function (name) {
  42222. return isXlink(name) ? name.slice(6, name.length) : ''
  42223. };
  42224. var isFalsyAttrValue = function (val) {
  42225. return val == null || val === false
  42226. };
  42227. /* */
  42228. function genClassForVnode (vnode) {
  42229. var data = vnode.data;
  42230. var parentNode = vnode;
  42231. var childNode = vnode;
  42232. while (childNode.componentInstance) {
  42233. childNode = childNode.componentInstance._vnode;
  42234. if (childNode.data) {
  42235. data = mergeClassData(childNode.data, data);
  42236. }
  42237. }
  42238. while ((parentNode = parentNode.parent)) {
  42239. if (parentNode.data) {
  42240. data = mergeClassData(data, parentNode.data);
  42241. }
  42242. }
  42243. return genClassFromData(data)
  42244. }
  42245. function mergeClassData (child, parent) {
  42246. return {
  42247. staticClass: concat(child.staticClass, parent.staticClass),
  42248. class: child.class
  42249. ? [child.class, parent.class]
  42250. : parent.class
  42251. }
  42252. }
  42253. function genClassFromData (data) {
  42254. var dynamicClass = data.class;
  42255. var staticClass = data.staticClass;
  42256. if (staticClass || dynamicClass) {
  42257. return concat(staticClass, stringifyClass(dynamicClass))
  42258. }
  42259. /* istanbul ignore next */
  42260. return ''
  42261. }
  42262. function concat (a, b) {
  42263. return a ? b ? (a + ' ' + b) : a : (b || '')
  42264. }
  42265. function stringifyClass (value) {
  42266. var res = '';
  42267. if (!value) {
  42268. return res
  42269. }
  42270. if (typeof value === 'string') {
  42271. return value
  42272. }
  42273. if (Array.isArray(value)) {
  42274. var stringified;
  42275. for (var i = 0, l = value.length; i < l; i++) {
  42276. if (value[i]) {
  42277. if ((stringified = stringifyClass(value[i]))) {
  42278. res += stringified + ' ';
  42279. }
  42280. }
  42281. }
  42282. return res.slice(0, -1)
  42283. }
  42284. if (isObject(value)) {
  42285. for (var key in value) {
  42286. if (value[key]) { res += key + ' '; }
  42287. }
  42288. return res.slice(0, -1)
  42289. }
  42290. /* istanbul ignore next */
  42291. return res
  42292. }
  42293. /* */
  42294. var namespaceMap = {
  42295. svg: 'http://www.w3.org/2000/svg',
  42296. math: 'http://www.w3.org/1998/Math/MathML'
  42297. };
  42298. var isHTMLTag = makeMap(
  42299. 'html,body,base,head,link,meta,style,title,' +
  42300. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  42301. 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  42302. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  42303. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  42304. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  42305. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  42306. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  42307. 'output,progress,select,textarea,' +
  42308. 'details,dialog,menu,menuitem,summary,' +
  42309. 'content,element,shadow,template'
  42310. );
  42311. // this map is intentionally selective, only covering SVG elements that may
  42312. // contain child elements.
  42313. var isSVG = makeMap(
  42314. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  42315. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  42316. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  42317. true
  42318. );
  42319. var isPreTag = function (tag) { return tag === 'pre'; };
  42320. var isReservedTag = function (tag) {
  42321. return isHTMLTag(tag) || isSVG(tag)
  42322. };
  42323. function getTagNamespace (tag) {
  42324. if (isSVG(tag)) {
  42325. return 'svg'
  42326. }
  42327. // basic support for MathML
  42328. // note it doesn't support other MathML elements being component roots
  42329. if (tag === 'math') {
  42330. return 'math'
  42331. }
  42332. }
  42333. var unknownElementCache = Object.create(null);
  42334. function isUnknownElement (tag) {
  42335. /* istanbul ignore if */
  42336. if (!inBrowser) {
  42337. return true
  42338. }
  42339. if (isReservedTag(tag)) {
  42340. return false
  42341. }
  42342. tag = tag.toLowerCase();
  42343. /* istanbul ignore if */
  42344. if (unknownElementCache[tag] != null) {
  42345. return unknownElementCache[tag]
  42346. }
  42347. var el = document.createElement(tag);
  42348. if (tag.indexOf('-') > -1) {
  42349. // http://stackoverflow.com/a/28210364/1070244
  42350. return (unknownElementCache[tag] = (
  42351. el.constructor === window.HTMLUnknownElement ||
  42352. el.constructor === window.HTMLElement
  42353. ))
  42354. } else {
  42355. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  42356. }
  42357. }
  42358. /* */
  42359. /**
  42360. * Query an element selector if it's not an element already.
  42361. */
  42362. function query (el) {
  42363. if (typeof el === 'string') {
  42364. var selected = document.querySelector(el);
  42365. if (!selected) {
  42366. "development" !== 'production' && warn(
  42367. 'Cannot find element: ' + el
  42368. );
  42369. return document.createElement('div')
  42370. }
  42371. return selected
  42372. } else {
  42373. return el
  42374. }
  42375. }
  42376. /* */
  42377. function createElement$1 (tagName, vnode) {
  42378. var elm = document.createElement(tagName);
  42379. if (tagName !== 'select') {
  42380. return elm
  42381. }
  42382. // false or null will remove the attribute but undefined will not
  42383. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  42384. elm.setAttribute('multiple', 'multiple');
  42385. }
  42386. return elm
  42387. }
  42388. function createElementNS (namespace, tagName) {
  42389. return document.createElementNS(namespaceMap[namespace], tagName)
  42390. }
  42391. function createTextNode (text) {
  42392. return document.createTextNode(text)
  42393. }
  42394. function createComment (text) {
  42395. return document.createComment(text)
  42396. }
  42397. function insertBefore (parentNode, newNode, referenceNode) {
  42398. parentNode.insertBefore(newNode, referenceNode);
  42399. }
  42400. function removeChild (node, child) {
  42401. node.removeChild(child);
  42402. }
  42403. function appendChild (node, child) {
  42404. node.appendChild(child);
  42405. }
  42406. function parentNode (node) {
  42407. return node.parentNode
  42408. }
  42409. function nextSibling (node) {
  42410. return node.nextSibling
  42411. }
  42412. function tagName (node) {
  42413. return node.tagName
  42414. }
  42415. function setTextContent (node, text) {
  42416. node.textContent = text;
  42417. }
  42418. function setAttribute (node, key, val) {
  42419. node.setAttribute(key, val);
  42420. }
  42421. var nodeOps = Object.freeze({
  42422. createElement: createElement$1,
  42423. createElementNS: createElementNS,
  42424. createTextNode: createTextNode,
  42425. createComment: createComment,
  42426. insertBefore: insertBefore,
  42427. removeChild: removeChild,
  42428. appendChild: appendChild,
  42429. parentNode: parentNode,
  42430. nextSibling: nextSibling,
  42431. tagName: tagName,
  42432. setTextContent: setTextContent,
  42433. setAttribute: setAttribute
  42434. });
  42435. /* */
  42436. var ref = {
  42437. create: function create (_, vnode) {
  42438. registerRef(vnode);
  42439. },
  42440. update: function update (oldVnode, vnode) {
  42441. if (oldVnode.data.ref !== vnode.data.ref) {
  42442. registerRef(oldVnode, true);
  42443. registerRef(vnode);
  42444. }
  42445. },
  42446. destroy: function destroy (vnode) {
  42447. registerRef(vnode, true);
  42448. }
  42449. };
  42450. function registerRef (vnode, isRemoval) {
  42451. var key = vnode.data.ref;
  42452. if (!key) { return }
  42453. var vm = vnode.context;
  42454. var ref = vnode.componentInstance || vnode.elm;
  42455. var refs = vm.$refs;
  42456. if (isRemoval) {
  42457. if (Array.isArray(refs[key])) {
  42458. remove(refs[key], ref);
  42459. } else if (refs[key] === ref) {
  42460. refs[key] = undefined;
  42461. }
  42462. } else {
  42463. if (vnode.data.refInFor) {
  42464. if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) {
  42465. refs[key].push(ref);
  42466. } else {
  42467. refs[key] = [ref];
  42468. }
  42469. } else {
  42470. refs[key] = ref;
  42471. }
  42472. }
  42473. }
  42474. /**
  42475. * Virtual DOM patching algorithm based on Snabbdom by
  42476. * Simon Friis Vindum (@paldepind)
  42477. * Licensed under the MIT License
  42478. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  42479. *
  42480. * modified by Evan You (@yyx990803)
  42481. *
  42482. /*
  42483. * Not type-checking this because this file is perf-critical and the cost
  42484. * of making flow understand it is not worth it.
  42485. */
  42486. var emptyNode = new VNode('', {}, []);
  42487. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  42488. function isUndef (v) {
  42489. return v === undefined || v === null
  42490. }
  42491. function isDef (v) {
  42492. return v !== undefined && v !== null
  42493. }
  42494. function isTrue (v) {
  42495. return v === true
  42496. }
  42497. function sameVnode (a, b) {
  42498. return (
  42499. a.key === b.key &&
  42500. a.tag === b.tag &&
  42501. a.isComment === b.isComment &&
  42502. isDef(a.data) === isDef(b.data) &&
  42503. sameInputType(a, b)
  42504. )
  42505. }
  42506. // Some browsers do not support dynamically changing type for <input>
  42507. // so they need to be treated as different nodes
  42508. function sameInputType (a, b) {
  42509. if (a.tag !== 'input') { return true }
  42510. var i;
  42511. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  42512. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  42513. return typeA === typeB
  42514. }
  42515. function createKeyToOldIdx (children, beginIdx, endIdx) {
  42516. var i, key;
  42517. var map = {};
  42518. for (i = beginIdx; i <= endIdx; ++i) {
  42519. key = children[i].key;
  42520. if (isDef(key)) { map[key] = i; }
  42521. }
  42522. return map
  42523. }
  42524. function createPatchFunction (backend) {
  42525. var i, j;
  42526. var cbs = {};
  42527. var modules = backend.modules;
  42528. var nodeOps = backend.nodeOps;
  42529. for (i = 0; i < hooks.length; ++i) {
  42530. cbs[hooks[i]] = [];
  42531. for (j = 0; j < modules.length; ++j) {
  42532. if (isDef(modules[j][hooks[i]])) {
  42533. cbs[hooks[i]].push(modules[j][hooks[i]]);
  42534. }
  42535. }
  42536. }
  42537. function emptyNodeAt (elm) {
  42538. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  42539. }
  42540. function createRmCb (childElm, listeners) {
  42541. function remove$$1 () {
  42542. if (--remove$$1.listeners === 0) {
  42543. removeNode(childElm);
  42544. }
  42545. }
  42546. remove$$1.listeners = listeners;
  42547. return remove$$1
  42548. }
  42549. function removeNode (el) {
  42550. var parent = nodeOps.parentNode(el);
  42551. // element may have already been removed due to v-html / v-text
  42552. if (isDef(parent)) {
  42553. nodeOps.removeChild(parent, el);
  42554. }
  42555. }
  42556. var inPre = 0;
  42557. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  42558. vnode.isRootInsert = !nested; // for transition enter check
  42559. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  42560. return
  42561. }
  42562. var data = vnode.data;
  42563. var children = vnode.children;
  42564. var tag = vnode.tag;
  42565. if (isDef(tag)) {
  42566. {
  42567. if (data && data.pre) {
  42568. inPre++;
  42569. }
  42570. if (
  42571. !inPre &&
  42572. !vnode.ns &&
  42573. !(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
  42574. config.isUnknownElement(tag)
  42575. ) {
  42576. warn(
  42577. 'Unknown custom element: <' + tag + '> - did you ' +
  42578. 'register the component correctly? For recursive components, ' +
  42579. 'make sure to provide the "name" option.',
  42580. vnode.context
  42581. );
  42582. }
  42583. }
  42584. vnode.elm = vnode.ns
  42585. ? nodeOps.createElementNS(vnode.ns, tag)
  42586. : nodeOps.createElement(tag, vnode);
  42587. setScope(vnode);
  42588. /* istanbul ignore if */
  42589. {
  42590. createChildren(vnode, children, insertedVnodeQueue);
  42591. if (isDef(data)) {
  42592. invokeCreateHooks(vnode, insertedVnodeQueue);
  42593. }
  42594. insert(parentElm, vnode.elm, refElm);
  42595. }
  42596. if ("development" !== 'production' && data && data.pre) {
  42597. inPre--;
  42598. }
  42599. } else if (isTrue(vnode.isComment)) {
  42600. vnode.elm = nodeOps.createComment(vnode.text);
  42601. insert(parentElm, vnode.elm, refElm);
  42602. } else {
  42603. vnode.elm = nodeOps.createTextNode(vnode.text);
  42604. insert(parentElm, vnode.elm, refElm);
  42605. }
  42606. }
  42607. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  42608. var i = vnode.data;
  42609. if (isDef(i)) {
  42610. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  42611. if (isDef(i = i.hook) && isDef(i = i.init)) {
  42612. i(vnode, false /* hydrating */, parentElm, refElm);
  42613. }
  42614. // after calling the init hook, if the vnode is a child component
  42615. // it should've created a child instance and mounted it. the child
  42616. // component also has set the placeholder vnode's elm.
  42617. // in that case we can just return the element and be done.
  42618. if (isDef(vnode.componentInstance)) {
  42619. initComponent(vnode, insertedVnodeQueue);
  42620. if (isTrue(isReactivated)) {
  42621. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  42622. }
  42623. return true
  42624. }
  42625. }
  42626. }
  42627. function initComponent (vnode, insertedVnodeQueue) {
  42628. if (isDef(vnode.data.pendingInsert)) {
  42629. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  42630. }
  42631. vnode.elm = vnode.componentInstance.$el;
  42632. if (isPatchable(vnode)) {
  42633. invokeCreateHooks(vnode, insertedVnodeQueue);
  42634. setScope(vnode);
  42635. } else {
  42636. // empty component root.
  42637. // skip all element-related modules except for ref (#3455)
  42638. registerRef(vnode);
  42639. // make sure to invoke the insert hook
  42640. insertedVnodeQueue.push(vnode);
  42641. }
  42642. }
  42643. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  42644. var i;
  42645. // hack for #4339: a reactivated component with inner transition
  42646. // does not trigger because the inner node's created hooks are not called
  42647. // again. It's not ideal to involve module-specific logic in here but
  42648. // there doesn't seem to be a better way to do it.
  42649. var innerNode = vnode;
  42650. while (innerNode.componentInstance) {
  42651. innerNode = innerNode.componentInstance._vnode;
  42652. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  42653. for (i = 0; i < cbs.activate.length; ++i) {
  42654. cbs.activate[i](emptyNode, innerNode);
  42655. }
  42656. insertedVnodeQueue.push(innerNode);
  42657. break
  42658. }
  42659. }
  42660. // unlike a newly created component,
  42661. // a reactivated keep-alive component doesn't insert itself
  42662. insert(parentElm, vnode.elm, refElm);
  42663. }
  42664. function insert (parent, elm, ref) {
  42665. if (isDef(parent)) {
  42666. if (isDef(ref)) {
  42667. nodeOps.insertBefore(parent, elm, ref);
  42668. } else {
  42669. nodeOps.appendChild(parent, elm);
  42670. }
  42671. }
  42672. }
  42673. function createChildren (vnode, children, insertedVnodeQueue) {
  42674. if (Array.isArray(children)) {
  42675. for (var i = 0; i < children.length; ++i) {
  42676. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  42677. }
  42678. } else if (isPrimitive(vnode.text)) {
  42679. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  42680. }
  42681. }
  42682. function isPatchable (vnode) {
  42683. while (vnode.componentInstance) {
  42684. vnode = vnode.componentInstance._vnode;
  42685. }
  42686. return isDef(vnode.tag)
  42687. }
  42688. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  42689. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  42690. cbs.create[i$1](emptyNode, vnode);
  42691. }
  42692. i = vnode.data.hook; // Reuse variable
  42693. if (isDef(i)) {
  42694. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  42695. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  42696. }
  42697. }
  42698. // set scope id attribute for scoped CSS.
  42699. // this is implemented as a special case to avoid the overhead
  42700. // of going through the normal attribute patching process.
  42701. function setScope (vnode) {
  42702. var i;
  42703. var ancestor = vnode;
  42704. while (ancestor) {
  42705. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  42706. nodeOps.setAttribute(vnode.elm, i, '');
  42707. }
  42708. ancestor = ancestor.parent;
  42709. }
  42710. // for slot content they should also get the scopeId from the host instance.
  42711. if (isDef(i = activeInstance) &&
  42712. i !== vnode.context &&
  42713. isDef(i = i.$options._scopeId)) {
  42714. nodeOps.setAttribute(vnode.elm, i, '');
  42715. }
  42716. }
  42717. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  42718. for (; startIdx <= endIdx; ++startIdx) {
  42719. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  42720. }
  42721. }
  42722. function invokeDestroyHook (vnode) {
  42723. var i, j;
  42724. var data = vnode.data;
  42725. if (isDef(data)) {
  42726. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  42727. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  42728. }
  42729. if (isDef(i = vnode.children)) {
  42730. for (j = 0; j < vnode.children.length; ++j) {
  42731. invokeDestroyHook(vnode.children[j]);
  42732. }
  42733. }
  42734. }
  42735. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  42736. for (; startIdx <= endIdx; ++startIdx) {
  42737. var ch = vnodes[startIdx];
  42738. if (isDef(ch)) {
  42739. if (isDef(ch.tag)) {
  42740. removeAndInvokeRemoveHook(ch);
  42741. invokeDestroyHook(ch);
  42742. } else { // Text node
  42743. removeNode(ch.elm);
  42744. }
  42745. }
  42746. }
  42747. }
  42748. function removeAndInvokeRemoveHook (vnode, rm) {
  42749. if (isDef(rm) || isDef(vnode.data)) {
  42750. var listeners = cbs.remove.length + 1;
  42751. if (isDef(rm)) {
  42752. // we have a recursively passed down rm callback
  42753. // increase the listeners count
  42754. rm.listeners += listeners;
  42755. } else {
  42756. // directly removing
  42757. rm = createRmCb(vnode.elm, listeners);
  42758. }
  42759. // recursively invoke hooks on child component root node
  42760. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  42761. removeAndInvokeRemoveHook(i, rm);
  42762. }
  42763. for (i = 0; i < cbs.remove.length; ++i) {
  42764. cbs.remove[i](vnode, rm);
  42765. }
  42766. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  42767. i(vnode, rm);
  42768. } else {
  42769. rm();
  42770. }
  42771. } else {
  42772. removeNode(vnode.elm);
  42773. }
  42774. }
  42775. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  42776. var oldStartIdx = 0;
  42777. var newStartIdx = 0;
  42778. var oldEndIdx = oldCh.length - 1;
  42779. var oldStartVnode = oldCh[0];
  42780. var oldEndVnode = oldCh[oldEndIdx];
  42781. var newEndIdx = newCh.length - 1;
  42782. var newStartVnode = newCh[0];
  42783. var newEndVnode = newCh[newEndIdx];
  42784. var oldKeyToIdx, idxInOld, elmToMove, refElm;
  42785. // removeOnly is a special flag used only by <transition-group>
  42786. // to ensure removed elements stay in correct relative positions
  42787. // during leaving transitions
  42788. var canMove = !removeOnly;
  42789. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  42790. if (isUndef(oldStartVnode)) {
  42791. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  42792. } else if (isUndef(oldEndVnode)) {
  42793. oldEndVnode = oldCh[--oldEndIdx];
  42794. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  42795. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  42796. oldStartVnode = oldCh[++oldStartIdx];
  42797. newStartVnode = newCh[++newStartIdx];
  42798. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  42799. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  42800. oldEndVnode = oldCh[--oldEndIdx];
  42801. newEndVnode = newCh[--newEndIdx];
  42802. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  42803. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  42804. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  42805. oldStartVnode = oldCh[++oldStartIdx];
  42806. newEndVnode = newCh[--newEndIdx];
  42807. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  42808. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  42809. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  42810. oldEndVnode = oldCh[--oldEndIdx];
  42811. newStartVnode = newCh[++newStartIdx];
  42812. } else {
  42813. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  42814. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  42815. if (isUndef(idxInOld)) { // New element
  42816. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  42817. newStartVnode = newCh[++newStartIdx];
  42818. } else {
  42819. elmToMove = oldCh[idxInOld];
  42820. /* istanbul ignore if */
  42821. if ("development" !== 'production' && !elmToMove) {
  42822. warn(
  42823. 'It seems there are duplicate keys that is causing an update error. ' +
  42824. 'Make sure each v-for item has a unique key.'
  42825. );
  42826. }
  42827. if (sameVnode(elmToMove, newStartVnode)) {
  42828. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  42829. oldCh[idxInOld] = undefined;
  42830. canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
  42831. newStartVnode = newCh[++newStartIdx];
  42832. } else {
  42833. // same key but different element. treat as new element
  42834. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  42835. newStartVnode = newCh[++newStartIdx];
  42836. }
  42837. }
  42838. }
  42839. }
  42840. if (oldStartIdx > oldEndIdx) {
  42841. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  42842. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  42843. } else if (newStartIdx > newEndIdx) {
  42844. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  42845. }
  42846. }
  42847. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  42848. if (oldVnode === vnode) {
  42849. return
  42850. }
  42851. // reuse element for static trees.
  42852. // note we only do this if the vnode is cloned -
  42853. // if the new node is not cloned it means the render functions have been
  42854. // reset by the hot-reload-api and we need to do a proper re-render.
  42855. if (isTrue(vnode.isStatic) &&
  42856. isTrue(oldVnode.isStatic) &&
  42857. vnode.key === oldVnode.key &&
  42858. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
  42859. vnode.elm = oldVnode.elm;
  42860. vnode.componentInstance = oldVnode.componentInstance;
  42861. return
  42862. }
  42863. var i;
  42864. var data = vnode.data;
  42865. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  42866. i(oldVnode, vnode);
  42867. }
  42868. var elm = vnode.elm = oldVnode.elm;
  42869. var oldCh = oldVnode.children;
  42870. var ch = vnode.children;
  42871. if (isDef(data) && isPatchable(vnode)) {
  42872. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  42873. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  42874. }
  42875. if (isUndef(vnode.text)) {
  42876. if (isDef(oldCh) && isDef(ch)) {
  42877. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  42878. } else if (isDef(ch)) {
  42879. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  42880. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  42881. } else if (isDef(oldCh)) {
  42882. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  42883. } else if (isDef(oldVnode.text)) {
  42884. nodeOps.setTextContent(elm, '');
  42885. }
  42886. } else if (oldVnode.text !== vnode.text) {
  42887. nodeOps.setTextContent(elm, vnode.text);
  42888. }
  42889. if (isDef(data)) {
  42890. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  42891. }
  42892. }
  42893. function invokeInsertHook (vnode, queue, initial) {
  42894. // delay insert hooks for component root nodes, invoke them after the
  42895. // element is really inserted
  42896. if (isTrue(initial) && isDef(vnode.parent)) {
  42897. vnode.parent.data.pendingInsert = queue;
  42898. } else {
  42899. for (var i = 0; i < queue.length; ++i) {
  42900. queue[i].data.hook.insert(queue[i]);
  42901. }
  42902. }
  42903. }
  42904. var bailed = false;
  42905. // list of modules that can skip create hook during hydration because they
  42906. // are already rendered on the client or has no need for initialization
  42907. var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
  42908. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  42909. function hydrate (elm, vnode, insertedVnodeQueue) {
  42910. {
  42911. if (!assertNodeMatch(elm, vnode)) {
  42912. return false
  42913. }
  42914. }
  42915. vnode.elm = elm;
  42916. var tag = vnode.tag;
  42917. var data = vnode.data;
  42918. var children = vnode.children;
  42919. if (isDef(data)) {
  42920. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  42921. if (isDef(i = vnode.componentInstance)) {
  42922. // child component. it should have hydrated its own tree.
  42923. initComponent(vnode, insertedVnodeQueue);
  42924. return true
  42925. }
  42926. }
  42927. if (isDef(tag)) {
  42928. if (isDef(children)) {
  42929. // empty element, allow client to pick up and populate children
  42930. if (!elm.hasChildNodes()) {
  42931. createChildren(vnode, children, insertedVnodeQueue);
  42932. } else {
  42933. var childrenMatch = true;
  42934. var childNode = elm.firstChild;
  42935. for (var i$1 = 0; i$1 < children.length; i$1++) {
  42936. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
  42937. childrenMatch = false;
  42938. break
  42939. }
  42940. childNode = childNode.nextSibling;
  42941. }
  42942. // if childNode is not null, it means the actual childNodes list is
  42943. // longer than the virtual children list.
  42944. if (!childrenMatch || childNode) {
  42945. if ("development" !== 'production' &&
  42946. typeof console !== 'undefined' &&
  42947. !bailed) {
  42948. bailed = true;
  42949. console.warn('Parent: ', elm);
  42950. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  42951. }
  42952. return false
  42953. }
  42954. }
  42955. }
  42956. if (isDef(data)) {
  42957. for (var key in data) {
  42958. if (!isRenderedModule(key)) {
  42959. invokeCreateHooks(vnode, insertedVnodeQueue);
  42960. break
  42961. }
  42962. }
  42963. }
  42964. } else if (elm.data !== vnode.text) {
  42965. elm.data = vnode.text;
  42966. }
  42967. return true
  42968. }
  42969. function assertNodeMatch (node, vnode) {
  42970. if (isDef(vnode.tag)) {
  42971. return (
  42972. vnode.tag.indexOf('vue-component') === 0 ||
  42973. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  42974. )
  42975. } else {
  42976. return node.nodeType === (vnode.isComment ? 8 : 3)
  42977. }
  42978. }
  42979. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  42980. if (isUndef(vnode)) {
  42981. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  42982. return
  42983. }
  42984. var isInitialPatch = false;
  42985. var insertedVnodeQueue = [];
  42986. if (isUndef(oldVnode)) {
  42987. // empty mount (likely as component), create new root element
  42988. isInitialPatch = true;
  42989. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  42990. } else {
  42991. var isRealElement = isDef(oldVnode.nodeType);
  42992. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  42993. // patch existing root node
  42994. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  42995. } else {
  42996. if (isRealElement) {
  42997. // mounting to a real element
  42998. // check if this is server-rendered content and if we can perform
  42999. // a successful hydration.
  43000. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
  43001. oldVnode.removeAttribute('server-rendered');
  43002. hydrating = true;
  43003. }
  43004. if (isTrue(hydrating)) {
  43005. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  43006. invokeInsertHook(vnode, insertedVnodeQueue, true);
  43007. return oldVnode
  43008. } else {
  43009. warn(
  43010. 'The client-side rendered virtual DOM tree is not matching ' +
  43011. 'server-rendered content. This is likely caused by incorrect ' +
  43012. 'HTML markup, for example nesting block-level elements inside ' +
  43013. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  43014. 'full client-side render.'
  43015. );
  43016. }
  43017. }
  43018. // either not server-rendered, or hydration failed.
  43019. // create an empty node and replace it
  43020. oldVnode = emptyNodeAt(oldVnode);
  43021. }
  43022. // replacing existing element
  43023. var oldElm = oldVnode.elm;
  43024. var parentElm$1 = nodeOps.parentNode(oldElm);
  43025. createElm(
  43026. vnode,
  43027. insertedVnodeQueue,
  43028. // extremely rare edge case: do not insert if old element is in a
  43029. // leaving transition. Only happens when combining transition +
  43030. // keep-alive + HOCs. (#4590)
  43031. oldElm._leaveCb ? null : parentElm$1,
  43032. nodeOps.nextSibling(oldElm)
  43033. );
  43034. if (isDef(vnode.parent)) {
  43035. // component root element replaced.
  43036. // update parent placeholder node element, recursively
  43037. var ancestor = vnode.parent;
  43038. while (ancestor) {
  43039. ancestor.elm = vnode.elm;
  43040. ancestor = ancestor.parent;
  43041. }
  43042. if (isPatchable(vnode)) {
  43043. for (var i = 0; i < cbs.create.length; ++i) {
  43044. cbs.create[i](emptyNode, vnode.parent);
  43045. }
  43046. }
  43047. }
  43048. if (isDef(parentElm$1)) {
  43049. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  43050. } else if (isDef(oldVnode.tag)) {
  43051. invokeDestroyHook(oldVnode);
  43052. }
  43053. }
  43054. }
  43055. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  43056. return vnode.elm
  43057. }
  43058. }
  43059. /* */
  43060. var directives = {
  43061. create: updateDirectives,
  43062. update: updateDirectives,
  43063. destroy: function unbindDirectives (vnode) {
  43064. updateDirectives(vnode, emptyNode);
  43065. }
  43066. };
  43067. function updateDirectives (oldVnode, vnode) {
  43068. if (oldVnode.data.directives || vnode.data.directives) {
  43069. _update(oldVnode, vnode);
  43070. }
  43071. }
  43072. function _update (oldVnode, vnode) {
  43073. var isCreate = oldVnode === emptyNode;
  43074. var isDestroy = vnode === emptyNode;
  43075. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  43076. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  43077. var dirsWithInsert = [];
  43078. var dirsWithPostpatch = [];
  43079. var key, oldDir, dir;
  43080. for (key in newDirs) {
  43081. oldDir = oldDirs[key];
  43082. dir = newDirs[key];
  43083. if (!oldDir) {
  43084. // new directive, bind
  43085. callHook$1(dir, 'bind', vnode, oldVnode);
  43086. if (dir.def && dir.def.inserted) {
  43087. dirsWithInsert.push(dir);
  43088. }
  43089. } else {
  43090. // existing directive, update
  43091. dir.oldValue = oldDir.value;
  43092. callHook$1(dir, 'update', vnode, oldVnode);
  43093. if (dir.def && dir.def.componentUpdated) {
  43094. dirsWithPostpatch.push(dir);
  43095. }
  43096. }
  43097. }
  43098. if (dirsWithInsert.length) {
  43099. var callInsert = function () {
  43100. for (var i = 0; i < dirsWithInsert.length; i++) {
  43101. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  43102. }
  43103. };
  43104. if (isCreate) {
  43105. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
  43106. } else {
  43107. callInsert();
  43108. }
  43109. }
  43110. if (dirsWithPostpatch.length) {
  43111. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  43112. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  43113. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  43114. }
  43115. });
  43116. }
  43117. if (!isCreate) {
  43118. for (key in oldDirs) {
  43119. if (!newDirs[key]) {
  43120. // no longer present, unbind
  43121. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  43122. }
  43123. }
  43124. }
  43125. }
  43126. var emptyModifiers = Object.create(null);
  43127. function normalizeDirectives$1 (
  43128. dirs,
  43129. vm
  43130. ) {
  43131. var res = Object.create(null);
  43132. if (!dirs) {
  43133. return res
  43134. }
  43135. var i, dir;
  43136. for (i = 0; i < dirs.length; i++) {
  43137. dir = dirs[i];
  43138. if (!dir.modifiers) {
  43139. dir.modifiers = emptyModifiers;
  43140. }
  43141. res[getRawDirName(dir)] = dir;
  43142. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  43143. }
  43144. return res
  43145. }
  43146. function getRawDirName (dir) {
  43147. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  43148. }
  43149. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  43150. var fn = dir.def && dir.def[hook];
  43151. if (fn) {
  43152. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  43153. }
  43154. }
  43155. var baseModules = [
  43156. ref,
  43157. directives
  43158. ];
  43159. /* */
  43160. function updateAttrs (oldVnode, vnode) {
  43161. if (!oldVnode.data.attrs && !vnode.data.attrs) {
  43162. return
  43163. }
  43164. var key, cur, old;
  43165. var elm = vnode.elm;
  43166. var oldAttrs = oldVnode.data.attrs || {};
  43167. var attrs = vnode.data.attrs || {};
  43168. // clone observed objects, as the user probably wants to mutate it
  43169. if (attrs.__ob__) {
  43170. attrs = vnode.data.attrs = extend({}, attrs);
  43171. }
  43172. for (key in attrs) {
  43173. cur = attrs[key];
  43174. old = oldAttrs[key];
  43175. if (old !== cur) {
  43176. setAttr(elm, key, cur);
  43177. }
  43178. }
  43179. // #4391: in IE9, setting type can reset value for input[type=radio]
  43180. /* istanbul ignore if */
  43181. if (isIE9 && attrs.value !== oldAttrs.value) {
  43182. setAttr(elm, 'value', attrs.value);
  43183. }
  43184. for (key in oldAttrs) {
  43185. if (attrs[key] == null) {
  43186. if (isXlink(key)) {
  43187. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  43188. } else if (!isEnumeratedAttr(key)) {
  43189. elm.removeAttribute(key);
  43190. }
  43191. }
  43192. }
  43193. }
  43194. function setAttr (el, key, value) {
  43195. if (isBooleanAttr(key)) {
  43196. // set attribute for blank value
  43197. // e.g. <option disabled>Select one</option>
  43198. if (isFalsyAttrValue(value)) {
  43199. el.removeAttribute(key);
  43200. } else {
  43201. el.setAttribute(key, key);
  43202. }
  43203. } else if (isEnumeratedAttr(key)) {
  43204. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  43205. } else if (isXlink(key)) {
  43206. if (isFalsyAttrValue(value)) {
  43207. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  43208. } else {
  43209. el.setAttributeNS(xlinkNS, key, value);
  43210. }
  43211. } else {
  43212. if (isFalsyAttrValue(value)) {
  43213. el.removeAttribute(key);
  43214. } else {
  43215. el.setAttribute(key, value);
  43216. }
  43217. }
  43218. }
  43219. var attrs = {
  43220. create: updateAttrs,
  43221. update: updateAttrs
  43222. };
  43223. /* */
  43224. function updateClass (oldVnode, vnode) {
  43225. var el = vnode.elm;
  43226. var data = vnode.data;
  43227. var oldData = oldVnode.data;
  43228. if (!data.staticClass && !data.class &&
  43229. (!oldData || (!oldData.staticClass && !oldData.class))) {
  43230. return
  43231. }
  43232. var cls = genClassForVnode(vnode);
  43233. // handle transition classes
  43234. var transitionClass = el._transitionClasses;
  43235. if (transitionClass) {
  43236. cls = concat(cls, stringifyClass(transitionClass));
  43237. }
  43238. // set the class
  43239. if (cls !== el._prevClass) {
  43240. el.setAttribute('class', cls);
  43241. el._prevClass = cls;
  43242. }
  43243. }
  43244. var klass = {
  43245. create: updateClass,
  43246. update: updateClass
  43247. };
  43248. /* */
  43249. var validDivisionCharRE = /[\w).+\-_$\]]/;
  43250. function parseFilters (exp) {
  43251. var inSingle = false;
  43252. var inDouble = false;
  43253. var inTemplateString = false;
  43254. var inRegex = false;
  43255. var curly = 0;
  43256. var square = 0;
  43257. var paren = 0;
  43258. var lastFilterIndex = 0;
  43259. var c, prev, i, expression, filters;
  43260. for (i = 0; i < exp.length; i++) {
  43261. prev = c;
  43262. c = exp.charCodeAt(i);
  43263. if (inSingle) {
  43264. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  43265. } else if (inDouble) {
  43266. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  43267. } else if (inTemplateString) {
  43268. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  43269. } else if (inRegex) {
  43270. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  43271. } else if (
  43272. c === 0x7C && // pipe
  43273. exp.charCodeAt(i + 1) !== 0x7C &&
  43274. exp.charCodeAt(i - 1) !== 0x7C &&
  43275. !curly && !square && !paren
  43276. ) {
  43277. if (expression === undefined) {
  43278. // first filter, end of expression
  43279. lastFilterIndex = i + 1;
  43280. expression = exp.slice(0, i).trim();
  43281. } else {
  43282. pushFilter();
  43283. }
  43284. } else {
  43285. switch (c) {
  43286. case 0x22: inDouble = true; break // "
  43287. case 0x27: inSingle = true; break // '
  43288. case 0x60: inTemplateString = true; break // `
  43289. case 0x28: paren++; break // (
  43290. case 0x29: paren--; break // )
  43291. case 0x5B: square++; break // [
  43292. case 0x5D: square--; break // ]
  43293. case 0x7B: curly++; break // {
  43294. case 0x7D: curly--; break // }
  43295. }
  43296. if (c === 0x2f) { // /
  43297. var j = i - 1;
  43298. var p = (void 0);
  43299. // find first non-whitespace prev char
  43300. for (; j >= 0; j--) {
  43301. p = exp.charAt(j);
  43302. if (p !== ' ') { break }
  43303. }
  43304. if (!p || !validDivisionCharRE.test(p)) {
  43305. inRegex = true;
  43306. }
  43307. }
  43308. }
  43309. }
  43310. if (expression === undefined) {
  43311. expression = exp.slice(0, i).trim();
  43312. } else if (lastFilterIndex !== 0) {
  43313. pushFilter();
  43314. }
  43315. function pushFilter () {
  43316. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  43317. lastFilterIndex = i + 1;
  43318. }
  43319. if (filters) {
  43320. for (i = 0; i < filters.length; i++) {
  43321. expression = wrapFilter(expression, filters[i]);
  43322. }
  43323. }
  43324. return expression
  43325. }
  43326. function wrapFilter (exp, filter) {
  43327. var i = filter.indexOf('(');
  43328. if (i < 0) {
  43329. // _f: resolveFilter
  43330. return ("_f(\"" + filter + "\")(" + exp + ")")
  43331. } else {
  43332. var name = filter.slice(0, i);
  43333. var args = filter.slice(i + 1);
  43334. return ("_f(\"" + name + "\")(" + exp + "," + args)
  43335. }
  43336. }
  43337. /* */
  43338. function baseWarn (msg) {
  43339. console.error(("[Vue compiler]: " + msg));
  43340. }
  43341. function pluckModuleFunction (
  43342. modules,
  43343. key
  43344. ) {
  43345. return modules
  43346. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  43347. : []
  43348. }
  43349. function addProp (el, name, value) {
  43350. (el.props || (el.props = [])).push({ name: name, value: value });
  43351. }
  43352. function addAttr (el, name, value) {
  43353. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  43354. }
  43355. function addDirective (
  43356. el,
  43357. name,
  43358. rawName,
  43359. value,
  43360. arg,
  43361. modifiers
  43362. ) {
  43363. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  43364. }
  43365. function addHandler (
  43366. el,
  43367. name,
  43368. value,
  43369. modifiers,
  43370. important
  43371. ) {
  43372. // check capture modifier
  43373. if (modifiers && modifiers.capture) {
  43374. delete modifiers.capture;
  43375. name = '!' + name; // mark the event as captured
  43376. }
  43377. if (modifiers && modifiers.once) {
  43378. delete modifiers.once;
  43379. name = '~' + name; // mark the event as once
  43380. }
  43381. var events;
  43382. if (modifiers && modifiers.native) {
  43383. delete modifiers.native;
  43384. events = el.nativeEvents || (el.nativeEvents = {});
  43385. } else {
  43386. events = el.events || (el.events = {});
  43387. }
  43388. var newHandler = { value: value, modifiers: modifiers };
  43389. var handlers = events[name];
  43390. /* istanbul ignore if */
  43391. if (Array.isArray(handlers)) {
  43392. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  43393. } else if (handlers) {
  43394. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  43395. } else {
  43396. events[name] = newHandler;
  43397. }
  43398. }
  43399. function getBindingAttr (
  43400. el,
  43401. name,
  43402. getStatic
  43403. ) {
  43404. var dynamicValue =
  43405. getAndRemoveAttr(el, ':' + name) ||
  43406. getAndRemoveAttr(el, 'v-bind:' + name);
  43407. if (dynamicValue != null) {
  43408. return parseFilters(dynamicValue)
  43409. } else if (getStatic !== false) {
  43410. var staticValue = getAndRemoveAttr(el, name);
  43411. if (staticValue != null) {
  43412. return JSON.stringify(staticValue)
  43413. }
  43414. }
  43415. }
  43416. function getAndRemoveAttr (el, name) {
  43417. var val;
  43418. if ((val = el.attrsMap[name]) != null) {
  43419. var list = el.attrsList;
  43420. for (var i = 0, l = list.length; i < l; i++) {
  43421. if (list[i].name === name) {
  43422. list.splice(i, 1);
  43423. break
  43424. }
  43425. }
  43426. }
  43427. return val
  43428. }
  43429. /* */
  43430. /**
  43431. * Cross-platform code generation for component v-model
  43432. */
  43433. function genComponentModel (
  43434. el,
  43435. value,
  43436. modifiers
  43437. ) {
  43438. var ref = modifiers || {};
  43439. var number = ref.number;
  43440. var trim = ref.trim;
  43441. var baseValueExpression = '$$v';
  43442. var valueExpression = baseValueExpression;
  43443. if (trim) {
  43444. valueExpression =
  43445. "(typeof " + baseValueExpression + " === 'string'" +
  43446. "? " + baseValueExpression + ".trim()" +
  43447. ": " + baseValueExpression + ")";
  43448. }
  43449. if (number) {
  43450. valueExpression = "_n(" + valueExpression + ")";
  43451. }
  43452. var assignment = genAssignmentCode(value, valueExpression);
  43453. el.model = {
  43454. value: ("(" + value + ")"),
  43455. expression: ("\"" + value + "\""),
  43456. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  43457. };
  43458. }
  43459. /**
  43460. * Cross-platform codegen helper for generating v-model value assignment code.
  43461. */
  43462. function genAssignmentCode (
  43463. value,
  43464. assignment
  43465. ) {
  43466. var modelRs = parseModel(value);
  43467. if (modelRs.idx === null) {
  43468. return (value + "=" + assignment)
  43469. } else {
  43470. return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
  43471. "if (!Array.isArray($$exp)){" +
  43472. value + "=" + assignment + "}" +
  43473. "else{$$exp.splice($$idx, 1, " + assignment + ")}"
  43474. }
  43475. }
  43476. /**
  43477. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  43478. *
  43479. * for loop possible cases:
  43480. *
  43481. * - test
  43482. * - test[idx]
  43483. * - test[test1[idx]]
  43484. * - test["a"][idx]
  43485. * - xxx.test[a[a].test1[idx]]
  43486. * - test.xxx.a["asa"][test1[idx]]
  43487. *
  43488. */
  43489. var len;
  43490. var str;
  43491. var chr;
  43492. var index$1;
  43493. var expressionPos;
  43494. var expressionEndPos;
  43495. function parseModel (val) {
  43496. str = val;
  43497. len = str.length;
  43498. index$1 = expressionPos = expressionEndPos = 0;
  43499. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  43500. return {
  43501. exp: val,
  43502. idx: null
  43503. }
  43504. }
  43505. while (!eof()) {
  43506. chr = next();
  43507. /* istanbul ignore if */
  43508. if (isStringStart(chr)) {
  43509. parseString(chr);
  43510. } else if (chr === 0x5B) {
  43511. parseBracket(chr);
  43512. }
  43513. }
  43514. return {
  43515. exp: val.substring(0, expressionPos),
  43516. idx: val.substring(expressionPos + 1, expressionEndPos)
  43517. }
  43518. }
  43519. function next () {
  43520. return str.charCodeAt(++index$1)
  43521. }
  43522. function eof () {
  43523. return index$1 >= len
  43524. }
  43525. function isStringStart (chr) {
  43526. return chr === 0x22 || chr === 0x27
  43527. }
  43528. function parseBracket (chr) {
  43529. var inBracket = 1;
  43530. expressionPos = index$1;
  43531. while (!eof()) {
  43532. chr = next();
  43533. if (isStringStart(chr)) {
  43534. parseString(chr);
  43535. continue
  43536. }
  43537. if (chr === 0x5B) { inBracket++; }
  43538. if (chr === 0x5D) { inBracket--; }
  43539. if (inBracket === 0) {
  43540. expressionEndPos = index$1;
  43541. break
  43542. }
  43543. }
  43544. }
  43545. function parseString (chr) {
  43546. var stringQuote = chr;
  43547. while (!eof()) {
  43548. chr = next();
  43549. if (chr === stringQuote) {
  43550. break
  43551. }
  43552. }
  43553. }
  43554. /* */
  43555. var warn$1;
  43556. // in some cases, the event used has to be determined at runtime
  43557. // so we used some reserved tokens during compile.
  43558. var RANGE_TOKEN = '__r';
  43559. var CHECKBOX_RADIO_TOKEN = '__c';
  43560. function model (
  43561. el,
  43562. dir,
  43563. _warn
  43564. ) {
  43565. warn$1 = _warn;
  43566. var value = dir.value;
  43567. var modifiers = dir.modifiers;
  43568. var tag = el.tag;
  43569. var type = el.attrsMap.type;
  43570. {
  43571. var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  43572. if (tag === 'input' && dynamicType) {
  43573. warn$1(
  43574. "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
  43575. "v-model does not support dynamic input types. Use v-if branches instead."
  43576. );
  43577. }
  43578. // inputs with type="file" are read only and setting the input's
  43579. // value will throw an error.
  43580. if (tag === 'input' && type === 'file') {
  43581. warn$1(
  43582. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  43583. "File inputs are read only. Use a v-on:change listener instead."
  43584. );
  43585. }
  43586. }
  43587. if (tag === 'select') {
  43588. genSelect(el, value, modifiers);
  43589. } else if (tag === 'input' && type === 'checkbox') {
  43590. genCheckboxModel(el, value, modifiers);
  43591. } else if (tag === 'input' && type === 'radio') {
  43592. genRadioModel(el, value, modifiers);
  43593. } else if (tag === 'input' || tag === 'textarea') {
  43594. genDefaultModel(el, value, modifiers);
  43595. } else if (!config.isReservedTag(tag)) {
  43596. genComponentModel(el, value, modifiers);
  43597. // component v-model doesn't need extra runtime
  43598. return false
  43599. } else {
  43600. warn$1(
  43601. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  43602. "v-model is not supported on this element type. " +
  43603. 'If you are working with contenteditable, it\'s recommended to ' +
  43604. 'wrap a library dedicated for that purpose inside a custom component.'
  43605. );
  43606. }
  43607. // ensure runtime directive metadata
  43608. return true
  43609. }
  43610. function genCheckboxModel (
  43611. el,
  43612. value,
  43613. modifiers
  43614. ) {
  43615. var number = modifiers && modifiers.number;
  43616. var valueBinding = getBindingAttr(el, 'value') || 'null';
  43617. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  43618. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  43619. addProp(el, 'checked',
  43620. "Array.isArray(" + value + ")" +
  43621. "?_i(" + value + "," + valueBinding + ")>-1" + (
  43622. trueValueBinding === 'true'
  43623. ? (":(" + value + ")")
  43624. : (":_q(" + value + "," + trueValueBinding + ")")
  43625. )
  43626. );
  43627. addHandler(el, CHECKBOX_RADIO_TOKEN,
  43628. "var $$a=" + value + "," +
  43629. '$$el=$event.target,' +
  43630. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  43631. 'if(Array.isArray($$a)){' +
  43632. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  43633. '$$i=_i($$a,$$v);' +
  43634. "if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
  43635. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  43636. "}else{" + value + "=$$c}",
  43637. null, true
  43638. );
  43639. }
  43640. function genRadioModel (
  43641. el,
  43642. value,
  43643. modifiers
  43644. ) {
  43645. var number = modifiers && modifiers.number;
  43646. var valueBinding = getBindingAttr(el, 'value') || 'null';
  43647. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  43648. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  43649. addHandler(el, CHECKBOX_RADIO_TOKEN, genAssignmentCode(value, valueBinding), null, true);
  43650. }
  43651. function genSelect (
  43652. el,
  43653. value,
  43654. modifiers
  43655. ) {
  43656. var number = modifiers && modifiers.number;
  43657. var selectedVal = "Array.prototype.filter" +
  43658. ".call($event.target.options,function(o){return o.selected})" +
  43659. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  43660. "return " + (number ? '_n(val)' : 'val') + "})";
  43661. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  43662. var code = "var $$selectedVal = " + selectedVal + ";";
  43663. code = code + " " + (genAssignmentCode(value, assignment));
  43664. addHandler(el, 'change', code, null, true);
  43665. }
  43666. function genDefaultModel (
  43667. el,
  43668. value,
  43669. modifiers
  43670. ) {
  43671. var type = el.attrsMap.type;
  43672. var ref = modifiers || {};
  43673. var lazy = ref.lazy;
  43674. var number = ref.number;
  43675. var trim = ref.trim;
  43676. var needCompositionGuard = !lazy && type !== 'range';
  43677. var event = lazy
  43678. ? 'change'
  43679. : type === 'range'
  43680. ? RANGE_TOKEN
  43681. : 'input';
  43682. var valueExpression = '$event.target.value';
  43683. if (trim) {
  43684. valueExpression = "$event.target.value.trim()";
  43685. }
  43686. if (number) {
  43687. valueExpression = "_n(" + valueExpression + ")";
  43688. }
  43689. var code = genAssignmentCode(value, valueExpression);
  43690. if (needCompositionGuard) {
  43691. code = "if($event.target.composing)return;" + code;
  43692. }
  43693. addProp(el, 'value', ("(" + value + ")"));
  43694. addHandler(el, event, code, null, true);
  43695. if (trim || number || type === 'number') {
  43696. addHandler(el, 'blur', '$forceUpdate()');
  43697. }
  43698. }
  43699. /* */
  43700. // normalize v-model event tokens that can only be determined at runtime.
  43701. // it's important to place the event as the first in the array because
  43702. // the whole point is ensuring the v-model callback gets called before
  43703. // user-attached handlers.
  43704. function normalizeEvents (on) {
  43705. var event;
  43706. /* istanbul ignore if */
  43707. if (on[RANGE_TOKEN]) {
  43708. // IE input[type=range] only supports `change` event
  43709. event = isIE ? 'change' : 'input';
  43710. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  43711. delete on[RANGE_TOKEN];
  43712. }
  43713. if (on[CHECKBOX_RADIO_TOKEN]) {
  43714. // Chrome fires microtasks in between click/change, leads to #4521
  43715. event = isChrome ? 'click' : 'change';
  43716. on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
  43717. delete on[CHECKBOX_RADIO_TOKEN];
  43718. }
  43719. }
  43720. var target$1;
  43721. function add$1 (
  43722. event,
  43723. handler,
  43724. once,
  43725. capture
  43726. ) {
  43727. if (once) {
  43728. var oldHandler = handler;
  43729. var _target = target$1; // save current target element in closure
  43730. handler = function (ev) {
  43731. var res = arguments.length === 1
  43732. ? oldHandler(ev)
  43733. : oldHandler.apply(null, arguments);
  43734. if (res !== null) {
  43735. remove$2(event, handler, capture, _target);
  43736. }
  43737. };
  43738. }
  43739. target$1.addEventListener(event, handler, capture);
  43740. }
  43741. function remove$2 (
  43742. event,
  43743. handler,
  43744. capture,
  43745. _target
  43746. ) {
  43747. (_target || target$1).removeEventListener(event, handler, capture);
  43748. }
  43749. function updateDOMListeners (oldVnode, vnode) {
  43750. if (!oldVnode.data.on && !vnode.data.on) {
  43751. return
  43752. }
  43753. var on = vnode.data.on || {};
  43754. var oldOn = oldVnode.data.on || {};
  43755. target$1 = vnode.elm;
  43756. normalizeEvents(on);
  43757. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  43758. }
  43759. var events = {
  43760. create: updateDOMListeners,
  43761. update: updateDOMListeners
  43762. };
  43763. /* */
  43764. function updateDOMProps (oldVnode, vnode) {
  43765. if (!oldVnode.data.domProps && !vnode.data.domProps) {
  43766. return
  43767. }
  43768. var key, cur;
  43769. var elm = vnode.elm;
  43770. var oldProps = oldVnode.data.domProps || {};
  43771. var props = vnode.data.domProps || {};
  43772. // clone observed objects, as the user probably wants to mutate it
  43773. if (props.__ob__) {
  43774. props = vnode.data.domProps = extend({}, props);
  43775. }
  43776. for (key in oldProps) {
  43777. if (props[key] == null) {
  43778. elm[key] = '';
  43779. }
  43780. }
  43781. for (key in props) {
  43782. cur = props[key];
  43783. // ignore children if the node has textContent or innerHTML,
  43784. // as these will throw away existing DOM nodes and cause removal errors
  43785. // on subsequent patches (#3360)
  43786. if (key === 'textContent' || key === 'innerHTML') {
  43787. if (vnode.children) { vnode.children.length = 0; }
  43788. if (cur === oldProps[key]) { continue }
  43789. }
  43790. if (key === 'value') {
  43791. // store value as _value as well since
  43792. // non-string values will be stringified
  43793. elm._value = cur;
  43794. // avoid resetting cursor position when value is the same
  43795. var strCur = cur == null ? '' : String(cur);
  43796. if (shouldUpdateValue(elm, vnode, strCur)) {
  43797. elm.value = strCur;
  43798. }
  43799. } else {
  43800. elm[key] = cur;
  43801. }
  43802. }
  43803. }
  43804. // check platforms/web/util/attrs.js acceptValue
  43805. function shouldUpdateValue (
  43806. elm,
  43807. vnode,
  43808. checkVal
  43809. ) {
  43810. return (!elm.composing && (
  43811. vnode.tag === 'option' ||
  43812. isDirty(elm, checkVal) ||
  43813. isInputChanged(elm, checkVal)
  43814. ))
  43815. }
  43816. function isDirty (elm, checkVal) {
  43817. // return true when textbox (.number and .trim) loses focus and its value is not equal to the updated value
  43818. return document.activeElement !== elm && elm.value !== checkVal
  43819. }
  43820. function isInputChanged (elm, newVal) {
  43821. var value = elm.value;
  43822. var modifiers = elm._vModifiers; // injected by v-model runtime
  43823. if ((modifiers && modifiers.number) || elm.type === 'number') {
  43824. return toNumber(value) !== toNumber(newVal)
  43825. }
  43826. if (modifiers && modifiers.trim) {
  43827. return value.trim() !== newVal.trim()
  43828. }
  43829. return value !== newVal
  43830. }
  43831. var domProps = {
  43832. create: updateDOMProps,
  43833. update: updateDOMProps
  43834. };
  43835. /* */
  43836. var parseStyleText = cached(function (cssText) {
  43837. var res = {};
  43838. var listDelimiter = /;(?![^(]*\))/g;
  43839. var propertyDelimiter = /:(.+)/;
  43840. cssText.split(listDelimiter).forEach(function (item) {
  43841. if (item) {
  43842. var tmp = item.split(propertyDelimiter);
  43843. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  43844. }
  43845. });
  43846. return res
  43847. });
  43848. // merge static and dynamic style data on the same vnode
  43849. function normalizeStyleData (data) {
  43850. var style = normalizeStyleBinding(data.style);
  43851. // static style is pre-processed into an object during compilation
  43852. // and is always a fresh object, so it's safe to merge into it
  43853. return data.staticStyle
  43854. ? extend(data.staticStyle, style)
  43855. : style
  43856. }
  43857. // normalize possible array / string values into Object
  43858. function normalizeStyleBinding (bindingStyle) {
  43859. if (Array.isArray(bindingStyle)) {
  43860. return toObject(bindingStyle)
  43861. }
  43862. if (typeof bindingStyle === 'string') {
  43863. return parseStyleText(bindingStyle)
  43864. }
  43865. return bindingStyle
  43866. }
  43867. /**
  43868. * parent component style should be after child's
  43869. * so that parent component's style could override it
  43870. */
  43871. function getStyle (vnode, checkChild) {
  43872. var res = {};
  43873. var styleData;
  43874. if (checkChild) {
  43875. var childNode = vnode;
  43876. while (childNode.componentInstance) {
  43877. childNode = childNode.componentInstance._vnode;
  43878. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  43879. extend(res, styleData);
  43880. }
  43881. }
  43882. }
  43883. if ((styleData = normalizeStyleData(vnode.data))) {
  43884. extend(res, styleData);
  43885. }
  43886. var parentNode = vnode;
  43887. while ((parentNode = parentNode.parent)) {
  43888. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  43889. extend(res, styleData);
  43890. }
  43891. }
  43892. return res
  43893. }
  43894. /* */
  43895. var cssVarRE = /^--/;
  43896. var importantRE = /\s*!important$/;
  43897. var setProp = function (el, name, val) {
  43898. /* istanbul ignore if */
  43899. if (cssVarRE.test(name)) {
  43900. el.style.setProperty(name, val);
  43901. } else if (importantRE.test(val)) {
  43902. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  43903. } else {
  43904. el.style[normalize(name)] = val;
  43905. }
  43906. };
  43907. var prefixes = ['Webkit', 'Moz', 'ms'];
  43908. var testEl;
  43909. var normalize = cached(function (prop) {
  43910. testEl = testEl || document.createElement('div');
  43911. prop = camelize(prop);
  43912. if (prop !== 'filter' && (prop in testEl.style)) {
  43913. return prop
  43914. }
  43915. var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
  43916. for (var i = 0; i < prefixes.length; i++) {
  43917. var prefixed = prefixes[i] + upper;
  43918. if (prefixed in testEl.style) {
  43919. return prefixed
  43920. }
  43921. }
  43922. });
  43923. function updateStyle (oldVnode, vnode) {
  43924. var data = vnode.data;
  43925. var oldData = oldVnode.data;
  43926. if (!data.staticStyle && !data.style &&
  43927. !oldData.staticStyle && !oldData.style) {
  43928. return
  43929. }
  43930. var cur, name;
  43931. var el = vnode.elm;
  43932. var oldStaticStyle = oldVnode.data.staticStyle;
  43933. var oldStyleBinding = oldVnode.data.style || {};
  43934. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  43935. var oldStyle = oldStaticStyle || oldStyleBinding;
  43936. var style = normalizeStyleBinding(vnode.data.style) || {};
  43937. vnode.data.style = style.__ob__ ? extend({}, style) : style;
  43938. var newStyle = getStyle(vnode, true);
  43939. for (name in oldStyle) {
  43940. if (newStyle[name] == null) {
  43941. setProp(el, name, '');
  43942. }
  43943. }
  43944. for (name in newStyle) {
  43945. cur = newStyle[name];
  43946. if (cur !== oldStyle[name]) {
  43947. // ie9 setting to null has no effect, must use empty string
  43948. setProp(el, name, cur == null ? '' : cur);
  43949. }
  43950. }
  43951. }
  43952. var style = {
  43953. create: updateStyle,
  43954. update: updateStyle
  43955. };
  43956. /* */
  43957. /**
  43958. * Add class with compatibility for SVG since classList is not supported on
  43959. * SVG elements in IE
  43960. */
  43961. function addClass (el, cls) {
  43962. /* istanbul ignore if */
  43963. if (!cls || !(cls = cls.trim())) {
  43964. return
  43965. }
  43966. /* istanbul ignore else */
  43967. if (el.classList) {
  43968. if (cls.indexOf(' ') > -1) {
  43969. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  43970. } else {
  43971. el.classList.add(cls);
  43972. }
  43973. } else {
  43974. var cur = " " + (el.getAttribute('class') || '') + " ";
  43975. if (cur.indexOf(' ' + cls + ' ') < 0) {
  43976. el.setAttribute('class', (cur + cls).trim());
  43977. }
  43978. }
  43979. }
  43980. /**
  43981. * Remove class with compatibility for SVG since classList is not supported on
  43982. * SVG elements in IE
  43983. */
  43984. function removeClass (el, cls) {
  43985. /* istanbul ignore if */
  43986. if (!cls || !(cls = cls.trim())) {
  43987. return
  43988. }
  43989. /* istanbul ignore else */
  43990. if (el.classList) {
  43991. if (cls.indexOf(' ') > -1) {
  43992. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  43993. } else {
  43994. el.classList.remove(cls);
  43995. }
  43996. } else {
  43997. var cur = " " + (el.getAttribute('class') || '') + " ";
  43998. var tar = ' ' + cls + ' ';
  43999. while (cur.indexOf(tar) >= 0) {
  44000. cur = cur.replace(tar, ' ');
  44001. }
  44002. el.setAttribute('class', cur.trim());
  44003. }
  44004. }
  44005. /* */
  44006. function resolveTransition (def$$1) {
  44007. if (!def$$1) {
  44008. return
  44009. }
  44010. /* istanbul ignore else */
  44011. if (typeof def$$1 === 'object') {
  44012. var res = {};
  44013. if (def$$1.css !== false) {
  44014. extend(res, autoCssTransition(def$$1.name || 'v'));
  44015. }
  44016. extend(res, def$$1);
  44017. return res
  44018. } else if (typeof def$$1 === 'string') {
  44019. return autoCssTransition(def$$1)
  44020. }
  44021. }
  44022. var autoCssTransition = cached(function (name) {
  44023. return {
  44024. enterClass: (name + "-enter"),
  44025. enterToClass: (name + "-enter-to"),
  44026. enterActiveClass: (name + "-enter-active"),
  44027. leaveClass: (name + "-leave"),
  44028. leaveToClass: (name + "-leave-to"),
  44029. leaveActiveClass: (name + "-leave-active")
  44030. }
  44031. });
  44032. var hasTransition = inBrowser && !isIE9;
  44033. var TRANSITION = 'transition';
  44034. var ANIMATION = 'animation';
  44035. // Transition property/event sniffing
  44036. var transitionProp = 'transition';
  44037. var transitionEndEvent = 'transitionend';
  44038. var animationProp = 'animation';
  44039. var animationEndEvent = 'animationend';
  44040. if (hasTransition) {
  44041. /* istanbul ignore if */
  44042. if (window.ontransitionend === undefined &&
  44043. window.onwebkittransitionend !== undefined) {
  44044. transitionProp = 'WebkitTransition';
  44045. transitionEndEvent = 'webkitTransitionEnd';
  44046. }
  44047. if (window.onanimationend === undefined &&
  44048. window.onwebkitanimationend !== undefined) {
  44049. animationProp = 'WebkitAnimation';
  44050. animationEndEvent = 'webkitAnimationEnd';
  44051. }
  44052. }
  44053. // binding to window is necessary to make hot reload work in IE in strict mode
  44054. var raf = inBrowser && window.requestAnimationFrame
  44055. ? window.requestAnimationFrame.bind(window)
  44056. : setTimeout;
  44057. function nextFrame (fn) {
  44058. raf(function () {
  44059. raf(fn);
  44060. });
  44061. }
  44062. function addTransitionClass (el, cls) {
  44063. (el._transitionClasses || (el._transitionClasses = [])).push(cls);
  44064. addClass(el, cls);
  44065. }
  44066. function removeTransitionClass (el, cls) {
  44067. if (el._transitionClasses) {
  44068. remove(el._transitionClasses, cls);
  44069. }
  44070. removeClass(el, cls);
  44071. }
  44072. function whenTransitionEnds (
  44073. el,
  44074. expectedType,
  44075. cb
  44076. ) {
  44077. var ref = getTransitionInfo(el, expectedType);
  44078. var type = ref.type;
  44079. var timeout = ref.timeout;
  44080. var propCount = ref.propCount;
  44081. if (!type) { return cb() }
  44082. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  44083. var ended = 0;
  44084. var end = function () {
  44085. el.removeEventListener(event, onEnd);
  44086. cb();
  44087. };
  44088. var onEnd = function (e) {
  44089. if (e.target === el) {
  44090. if (++ended >= propCount) {
  44091. end();
  44092. }
  44093. }
  44094. };
  44095. setTimeout(function () {
  44096. if (ended < propCount) {
  44097. end();
  44098. }
  44099. }, timeout + 1);
  44100. el.addEventListener(event, onEnd);
  44101. }
  44102. var transformRE = /\b(transform|all)(,|$)/;
  44103. function getTransitionInfo (el, expectedType) {
  44104. var styles = window.getComputedStyle(el);
  44105. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  44106. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  44107. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  44108. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  44109. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  44110. var animationTimeout = getTimeout(animationDelays, animationDurations);
  44111. var type;
  44112. var timeout = 0;
  44113. var propCount = 0;
  44114. /* istanbul ignore if */
  44115. if (expectedType === TRANSITION) {
  44116. if (transitionTimeout > 0) {
  44117. type = TRANSITION;
  44118. timeout = transitionTimeout;
  44119. propCount = transitionDurations.length;
  44120. }
  44121. } else if (expectedType === ANIMATION) {
  44122. if (animationTimeout > 0) {
  44123. type = ANIMATION;
  44124. timeout = animationTimeout;
  44125. propCount = animationDurations.length;
  44126. }
  44127. } else {
  44128. timeout = Math.max(transitionTimeout, animationTimeout);
  44129. type = timeout > 0
  44130. ? transitionTimeout > animationTimeout
  44131. ? TRANSITION
  44132. : ANIMATION
  44133. : null;
  44134. propCount = type
  44135. ? type === TRANSITION
  44136. ? transitionDurations.length
  44137. : animationDurations.length
  44138. : 0;
  44139. }
  44140. var hasTransform =
  44141. type === TRANSITION &&
  44142. transformRE.test(styles[transitionProp + 'Property']);
  44143. return {
  44144. type: type,
  44145. timeout: timeout,
  44146. propCount: propCount,
  44147. hasTransform: hasTransform
  44148. }
  44149. }
  44150. function getTimeout (delays, durations) {
  44151. /* istanbul ignore next */
  44152. while (delays.length < durations.length) {
  44153. delays = delays.concat(delays);
  44154. }
  44155. return Math.max.apply(null, durations.map(function (d, i) {
  44156. return toMs(d) + toMs(delays[i])
  44157. }))
  44158. }
  44159. function toMs (s) {
  44160. return Number(s.slice(0, -1)) * 1000
  44161. }
  44162. /* */
  44163. function enter (vnode, toggleDisplay) {
  44164. var el = vnode.elm;
  44165. // call leave callback now
  44166. if (el._leaveCb) {
  44167. el._leaveCb.cancelled = true;
  44168. el._leaveCb();
  44169. }
  44170. var data = resolveTransition(vnode.data.transition);
  44171. if (!data) {
  44172. return
  44173. }
  44174. /* istanbul ignore if */
  44175. if (el._enterCb || el.nodeType !== 1) {
  44176. return
  44177. }
  44178. var css = data.css;
  44179. var type = data.type;
  44180. var enterClass = data.enterClass;
  44181. var enterToClass = data.enterToClass;
  44182. var enterActiveClass = data.enterActiveClass;
  44183. var appearClass = data.appearClass;
  44184. var appearToClass = data.appearToClass;
  44185. var appearActiveClass = data.appearActiveClass;
  44186. var beforeEnter = data.beforeEnter;
  44187. var enter = data.enter;
  44188. var afterEnter = data.afterEnter;
  44189. var enterCancelled = data.enterCancelled;
  44190. var beforeAppear = data.beforeAppear;
  44191. var appear = data.appear;
  44192. var afterAppear = data.afterAppear;
  44193. var appearCancelled = data.appearCancelled;
  44194. var duration = data.duration;
  44195. // activeInstance will always be the <transition> component managing this
  44196. // transition. One edge case to check is when the <transition> is placed
  44197. // as the root node of a child component. In that case we need to check
  44198. // <transition>'s parent for appear check.
  44199. var context = activeInstance;
  44200. var transitionNode = activeInstance.$vnode;
  44201. while (transitionNode && transitionNode.parent) {
  44202. transitionNode = transitionNode.parent;
  44203. context = transitionNode.context;
  44204. }
  44205. var isAppear = !context._isMounted || !vnode.isRootInsert;
  44206. if (isAppear && !appear && appear !== '') {
  44207. return
  44208. }
  44209. var startClass = isAppear && appearClass
  44210. ? appearClass
  44211. : enterClass;
  44212. var activeClass = isAppear && appearActiveClass
  44213. ? appearActiveClass
  44214. : enterActiveClass;
  44215. var toClass = isAppear && appearToClass
  44216. ? appearToClass
  44217. : enterToClass;
  44218. var beforeEnterHook = isAppear
  44219. ? (beforeAppear || beforeEnter)
  44220. : beforeEnter;
  44221. var enterHook = isAppear
  44222. ? (typeof appear === 'function' ? appear : enter)
  44223. : enter;
  44224. var afterEnterHook = isAppear
  44225. ? (afterAppear || afterEnter)
  44226. : afterEnter;
  44227. var enterCancelledHook = isAppear
  44228. ? (appearCancelled || enterCancelled)
  44229. : enterCancelled;
  44230. var explicitEnterDuration = toNumber(
  44231. isObject(duration)
  44232. ? duration.enter
  44233. : duration
  44234. );
  44235. if ("development" !== 'production' && explicitEnterDuration != null) {
  44236. checkDuration(explicitEnterDuration, 'enter', vnode);
  44237. }
  44238. var expectsCSS = css !== false && !isIE9;
  44239. var userWantsControl = getHookArgumentsLength(enterHook);
  44240. var cb = el._enterCb = once(function () {
  44241. if (expectsCSS) {
  44242. removeTransitionClass(el, toClass);
  44243. removeTransitionClass(el, activeClass);
  44244. }
  44245. if (cb.cancelled) {
  44246. if (expectsCSS) {
  44247. removeTransitionClass(el, startClass);
  44248. }
  44249. enterCancelledHook && enterCancelledHook(el);
  44250. } else {
  44251. afterEnterHook && afterEnterHook(el);
  44252. }
  44253. el._enterCb = null;
  44254. });
  44255. if (!vnode.data.show) {
  44256. // remove pending leave element on enter by injecting an insert hook
  44257. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  44258. var parent = el.parentNode;
  44259. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  44260. if (pendingNode &&
  44261. pendingNode.tag === vnode.tag &&
  44262. pendingNode.elm._leaveCb) {
  44263. pendingNode.elm._leaveCb();
  44264. }
  44265. enterHook && enterHook(el, cb);
  44266. });
  44267. }
  44268. // start enter transition
  44269. beforeEnterHook && beforeEnterHook(el);
  44270. if (expectsCSS) {
  44271. addTransitionClass(el, startClass);
  44272. addTransitionClass(el, activeClass);
  44273. nextFrame(function () {
  44274. addTransitionClass(el, toClass);
  44275. removeTransitionClass(el, startClass);
  44276. if (!cb.cancelled && !userWantsControl) {
  44277. if (isValidDuration(explicitEnterDuration)) {
  44278. setTimeout(cb, explicitEnterDuration);
  44279. } else {
  44280. whenTransitionEnds(el, type, cb);
  44281. }
  44282. }
  44283. });
  44284. }
  44285. if (vnode.data.show) {
  44286. toggleDisplay && toggleDisplay();
  44287. enterHook && enterHook(el, cb);
  44288. }
  44289. if (!expectsCSS && !userWantsControl) {
  44290. cb();
  44291. }
  44292. }
  44293. function leave (vnode, rm) {
  44294. var el = vnode.elm;
  44295. // call enter callback now
  44296. if (el._enterCb) {
  44297. el._enterCb.cancelled = true;
  44298. el._enterCb();
  44299. }
  44300. var data = resolveTransition(vnode.data.transition);
  44301. if (!data) {
  44302. return rm()
  44303. }
  44304. /* istanbul ignore if */
  44305. if (el._leaveCb || el.nodeType !== 1) {
  44306. return
  44307. }
  44308. var css = data.css;
  44309. var type = data.type;
  44310. var leaveClass = data.leaveClass;
  44311. var leaveToClass = data.leaveToClass;
  44312. var leaveActiveClass = data.leaveActiveClass;
  44313. var beforeLeave = data.beforeLeave;
  44314. var leave = data.leave;
  44315. var afterLeave = data.afterLeave;
  44316. var leaveCancelled = data.leaveCancelled;
  44317. var delayLeave = data.delayLeave;
  44318. var duration = data.duration;
  44319. var expectsCSS = css !== false && !isIE9;
  44320. var userWantsControl = getHookArgumentsLength(leave);
  44321. var explicitLeaveDuration = toNumber(
  44322. isObject(duration)
  44323. ? duration.leave
  44324. : duration
  44325. );
  44326. if ("development" !== 'production' && explicitLeaveDuration != null) {
  44327. checkDuration(explicitLeaveDuration, 'leave', vnode);
  44328. }
  44329. var cb = el._leaveCb = once(function () {
  44330. if (el.parentNode && el.parentNode._pending) {
  44331. el.parentNode._pending[vnode.key] = null;
  44332. }
  44333. if (expectsCSS) {
  44334. removeTransitionClass(el, leaveToClass);
  44335. removeTransitionClass(el, leaveActiveClass);
  44336. }
  44337. if (cb.cancelled) {
  44338. if (expectsCSS) {
  44339. removeTransitionClass(el, leaveClass);
  44340. }
  44341. leaveCancelled && leaveCancelled(el);
  44342. } else {
  44343. rm();
  44344. afterLeave && afterLeave(el);
  44345. }
  44346. el._leaveCb = null;
  44347. });
  44348. if (delayLeave) {
  44349. delayLeave(performLeave);
  44350. } else {
  44351. performLeave();
  44352. }
  44353. function performLeave () {
  44354. // the delayed leave may have already been cancelled
  44355. if (cb.cancelled) {
  44356. return
  44357. }
  44358. // record leaving element
  44359. if (!vnode.data.show) {
  44360. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
  44361. }
  44362. beforeLeave && beforeLeave(el);
  44363. if (expectsCSS) {
  44364. addTransitionClass(el, leaveClass);
  44365. addTransitionClass(el, leaveActiveClass);
  44366. nextFrame(function () {
  44367. addTransitionClass(el, leaveToClass);
  44368. removeTransitionClass(el, leaveClass);
  44369. if (!cb.cancelled && !userWantsControl) {
  44370. if (isValidDuration(explicitLeaveDuration)) {
  44371. setTimeout(cb, explicitLeaveDuration);
  44372. } else {
  44373. whenTransitionEnds(el, type, cb);
  44374. }
  44375. }
  44376. });
  44377. }
  44378. leave && leave(el, cb);
  44379. if (!expectsCSS && !userWantsControl) {
  44380. cb();
  44381. }
  44382. }
  44383. }
  44384. // only used in dev mode
  44385. function checkDuration (val, name, vnode) {
  44386. if (typeof val !== 'number') {
  44387. warn(
  44388. "<transition> explicit " + name + " duration is not a valid number - " +
  44389. "got " + (JSON.stringify(val)) + ".",
  44390. vnode.context
  44391. );
  44392. } else if (isNaN(val)) {
  44393. warn(
  44394. "<transition> explicit " + name + " duration is NaN - " +
  44395. 'the duration expression might be incorrect.',
  44396. vnode.context
  44397. );
  44398. }
  44399. }
  44400. function isValidDuration (val) {
  44401. return typeof val === 'number' && !isNaN(val)
  44402. }
  44403. /**
  44404. * Normalize a transition hook's argument length. The hook may be:
  44405. * - a merged hook (invoker) with the original in .fns
  44406. * - a wrapped component method (check ._length)
  44407. * - a plain function (.length)
  44408. */
  44409. function getHookArgumentsLength (fn) {
  44410. if (!fn) { return false }
  44411. var invokerFns = fn.fns;
  44412. if (invokerFns) {
  44413. // invoker
  44414. return getHookArgumentsLength(
  44415. Array.isArray(invokerFns)
  44416. ? invokerFns[0]
  44417. : invokerFns
  44418. )
  44419. } else {
  44420. return (fn._length || fn.length) > 1
  44421. }
  44422. }
  44423. function _enter (_, vnode) {
  44424. if (!vnode.data.show) {
  44425. enter(vnode);
  44426. }
  44427. }
  44428. var transition = inBrowser ? {
  44429. create: _enter,
  44430. activate: _enter,
  44431. remove: function remove$$1 (vnode, rm) {
  44432. /* istanbul ignore else */
  44433. if (!vnode.data.show) {
  44434. leave(vnode, rm);
  44435. } else {
  44436. rm();
  44437. }
  44438. }
  44439. } : {};
  44440. var platformModules = [
  44441. attrs,
  44442. klass,
  44443. events,
  44444. domProps,
  44445. style,
  44446. transition
  44447. ];
  44448. /* */
  44449. // the directive module should be applied last, after all
  44450. // built-in modules have been applied.
  44451. var modules = platformModules.concat(baseModules);
  44452. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  44453. /**
  44454. * Not type checking this file because flow doesn't like attaching
  44455. * properties to Elements.
  44456. */
  44457. /* istanbul ignore if */
  44458. if (isIE9) {
  44459. // http://www.matts411.com/post/internet-explorer-9-oninput/
  44460. document.addEventListener('selectionchange', function () {
  44461. var el = document.activeElement;
  44462. if (el && el.vmodel) {
  44463. trigger(el, 'input');
  44464. }
  44465. });
  44466. }
  44467. var model$1 = {
  44468. inserted: function inserted (el, binding, vnode) {
  44469. if (vnode.tag === 'select') {
  44470. var cb = function () {
  44471. setSelected(el, binding, vnode.context);
  44472. };
  44473. cb();
  44474. /* istanbul ignore if */
  44475. if (isIE || isEdge) {
  44476. setTimeout(cb, 0);
  44477. }
  44478. } else if (vnode.tag === 'textarea' || el.type === 'text' || el.type === 'password') {
  44479. el._vModifiers = binding.modifiers;
  44480. if (!binding.modifiers.lazy) {
  44481. if (!isAndroid) {
  44482. el.addEventListener('compositionstart', onCompositionStart);
  44483. el.addEventListener('compositionend', onCompositionEnd);
  44484. }
  44485. /* istanbul ignore if */
  44486. if (isIE9) {
  44487. el.vmodel = true;
  44488. }
  44489. }
  44490. }
  44491. },
  44492. componentUpdated: function componentUpdated (el, binding, vnode) {
  44493. if (vnode.tag === 'select') {
  44494. setSelected(el, binding, vnode.context);
  44495. // in case the options rendered by v-for have changed,
  44496. // it's possible that the value is out-of-sync with the rendered options.
  44497. // detect such cases and filter out values that no longer has a matching
  44498. // option in the DOM.
  44499. var needReset = el.multiple
  44500. ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
  44501. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
  44502. if (needReset) {
  44503. trigger(el, 'change');
  44504. }
  44505. }
  44506. }
  44507. };
  44508. function setSelected (el, binding, vm) {
  44509. var value = binding.value;
  44510. var isMultiple = el.multiple;
  44511. if (isMultiple && !Array.isArray(value)) {
  44512. "development" !== 'production' && warn(
  44513. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  44514. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  44515. vm
  44516. );
  44517. return
  44518. }
  44519. var selected, option;
  44520. for (var i = 0, l = el.options.length; i < l; i++) {
  44521. option = el.options[i];
  44522. if (isMultiple) {
  44523. selected = looseIndexOf(value, getValue(option)) > -1;
  44524. if (option.selected !== selected) {
  44525. option.selected = selected;
  44526. }
  44527. } else {
  44528. if (looseEqual(getValue(option), value)) {
  44529. if (el.selectedIndex !== i) {
  44530. el.selectedIndex = i;
  44531. }
  44532. return
  44533. }
  44534. }
  44535. }
  44536. if (!isMultiple) {
  44537. el.selectedIndex = -1;
  44538. }
  44539. }
  44540. function hasNoMatchingOption (value, options) {
  44541. for (var i = 0, l = options.length; i < l; i++) {
  44542. if (looseEqual(getValue(options[i]), value)) {
  44543. return false
  44544. }
  44545. }
  44546. return true
  44547. }
  44548. function getValue (option) {
  44549. return '_value' in option
  44550. ? option._value
  44551. : option.value
  44552. }
  44553. function onCompositionStart (e) {
  44554. e.target.composing = true;
  44555. }
  44556. function onCompositionEnd (e) {
  44557. e.target.composing = false;
  44558. trigger(e.target, 'input');
  44559. }
  44560. function trigger (el, type) {
  44561. var e = document.createEvent('HTMLEvents');
  44562. e.initEvent(type, true, true);
  44563. el.dispatchEvent(e);
  44564. }
  44565. /* */
  44566. // recursively search for possible transition defined inside the component root
  44567. function locateNode (vnode) {
  44568. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  44569. ? locateNode(vnode.componentInstance._vnode)
  44570. : vnode
  44571. }
  44572. var show = {
  44573. bind: function bind (el, ref, vnode) {
  44574. var value = ref.value;
  44575. vnode = locateNode(vnode);
  44576. var transition = vnode.data && vnode.data.transition;
  44577. var originalDisplay = el.__vOriginalDisplay =
  44578. el.style.display === 'none' ? '' : el.style.display;
  44579. if (value && transition && !isIE9) {
  44580. vnode.data.show = true;
  44581. enter(vnode, function () {
  44582. el.style.display = originalDisplay;
  44583. });
  44584. } else {
  44585. el.style.display = value ? originalDisplay : 'none';
  44586. }
  44587. },
  44588. update: function update (el, ref, vnode) {
  44589. var value = ref.value;
  44590. var oldValue = ref.oldValue;
  44591. /* istanbul ignore if */
  44592. if (value === oldValue) { return }
  44593. vnode = locateNode(vnode);
  44594. var transition = vnode.data && vnode.data.transition;
  44595. if (transition && !isIE9) {
  44596. vnode.data.show = true;
  44597. if (value) {
  44598. enter(vnode, function () {
  44599. el.style.display = el.__vOriginalDisplay;
  44600. });
  44601. } else {
  44602. leave(vnode, function () {
  44603. el.style.display = 'none';
  44604. });
  44605. }
  44606. } else {
  44607. el.style.display = value ? el.__vOriginalDisplay : 'none';
  44608. }
  44609. },
  44610. unbind: function unbind (
  44611. el,
  44612. binding,
  44613. vnode,
  44614. oldVnode,
  44615. isDestroy
  44616. ) {
  44617. if (!isDestroy) {
  44618. el.style.display = el.__vOriginalDisplay;
  44619. }
  44620. }
  44621. };
  44622. var platformDirectives = {
  44623. model: model$1,
  44624. show: show
  44625. };
  44626. /* */
  44627. // Provides transition support for a single element/component.
  44628. // supports transition mode (out-in / in-out)
  44629. var transitionProps = {
  44630. name: String,
  44631. appear: Boolean,
  44632. css: Boolean,
  44633. mode: String,
  44634. type: String,
  44635. enterClass: String,
  44636. leaveClass: String,
  44637. enterToClass: String,
  44638. leaveToClass: String,
  44639. enterActiveClass: String,
  44640. leaveActiveClass: String,
  44641. appearClass: String,
  44642. appearActiveClass: String,
  44643. appearToClass: String,
  44644. duration: [Number, String, Object]
  44645. };
  44646. // in case the child is also an abstract component, e.g. <keep-alive>
  44647. // we want to recursively retrieve the real component to be rendered
  44648. function getRealChild (vnode) {
  44649. var compOptions = vnode && vnode.componentOptions;
  44650. if (compOptions && compOptions.Ctor.options.abstract) {
  44651. return getRealChild(getFirstComponentChild(compOptions.children))
  44652. } else {
  44653. return vnode
  44654. }
  44655. }
  44656. function extractTransitionData (comp) {
  44657. var data = {};
  44658. var options = comp.$options;
  44659. // props
  44660. for (var key in options.propsData) {
  44661. data[key] = comp[key];
  44662. }
  44663. // events.
  44664. // extract listeners and pass them directly to the transition methods
  44665. var listeners = options._parentListeners;
  44666. for (var key$1 in listeners) {
  44667. data[camelize(key$1)] = listeners[key$1];
  44668. }
  44669. return data
  44670. }
  44671. function placeholder (h, rawChild) {
  44672. return /\d-keep-alive$/.test(rawChild.tag)
  44673. ? h('keep-alive')
  44674. : null
  44675. }
  44676. function hasParentTransition (vnode) {
  44677. while ((vnode = vnode.parent)) {
  44678. if (vnode.data.transition) {
  44679. return true
  44680. }
  44681. }
  44682. }
  44683. function isSameChild (child, oldChild) {
  44684. return oldChild.key === child.key && oldChild.tag === child.tag
  44685. }
  44686. var Transition = {
  44687. name: 'transition',
  44688. props: transitionProps,
  44689. abstract: true,
  44690. render: function render (h) {
  44691. var this$1 = this;
  44692. var children = this.$slots.default;
  44693. if (!children) {
  44694. return
  44695. }
  44696. // filter out text nodes (possible whitespaces)
  44697. children = children.filter(function (c) { return c.tag; });
  44698. /* istanbul ignore if */
  44699. if (!children.length) {
  44700. return
  44701. }
  44702. // warn multiple elements
  44703. if ("development" !== 'production' && children.length > 1) {
  44704. warn(
  44705. '<transition> can only be used on a single element. Use ' +
  44706. '<transition-group> for lists.',
  44707. this.$parent
  44708. );
  44709. }
  44710. var mode = this.mode;
  44711. // warn invalid mode
  44712. if ("development" !== 'production' &&
  44713. mode && mode !== 'in-out' && mode !== 'out-in') {
  44714. warn(
  44715. 'invalid <transition> mode: ' + mode,
  44716. this.$parent
  44717. );
  44718. }
  44719. var rawChild = children[0];
  44720. // if this is a component root node and the component's
  44721. // parent container node also has transition, skip.
  44722. if (hasParentTransition(this.$vnode)) {
  44723. return rawChild
  44724. }
  44725. // apply transition data to child
  44726. // use getRealChild() to ignore abstract components e.g. keep-alive
  44727. var child = getRealChild(rawChild);
  44728. /* istanbul ignore if */
  44729. if (!child) {
  44730. return rawChild
  44731. }
  44732. if (this._leaving) {
  44733. return placeholder(h, rawChild)
  44734. }
  44735. // ensure a key that is unique to the vnode type and to this transition
  44736. // component instance. This key will be used to remove pending leaving nodes
  44737. // during entering.
  44738. var id = "__transition-" + (this._uid) + "-";
  44739. child.key = child.key == null
  44740. ? id + child.tag
  44741. : isPrimitive(child.key)
  44742. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  44743. : child.key;
  44744. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  44745. var oldRawChild = this._vnode;
  44746. var oldChild = getRealChild(oldRawChild);
  44747. // mark v-show
  44748. // so that the transition module can hand over the control to the directive
  44749. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  44750. child.data.show = true;
  44751. }
  44752. if (oldChild && oldChild.data && !isSameChild(child, oldChild)) {
  44753. // replace old child transition data with fresh one
  44754. // important for dynamic transitions!
  44755. var oldData = oldChild && (oldChild.data.transition = extend({}, data));
  44756. // handle transition mode
  44757. if (mode === 'out-in') {
  44758. // return placeholder node and queue update when leave finishes
  44759. this._leaving = true;
  44760. mergeVNodeHook(oldData, 'afterLeave', function () {
  44761. this$1._leaving = false;
  44762. this$1.$forceUpdate();
  44763. });
  44764. return placeholder(h, rawChild)
  44765. } else if (mode === 'in-out') {
  44766. var delayedLeave;
  44767. var performLeave = function () { delayedLeave(); };
  44768. mergeVNodeHook(data, 'afterEnter', performLeave);
  44769. mergeVNodeHook(data, 'enterCancelled', performLeave);
  44770. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  44771. }
  44772. }
  44773. return rawChild
  44774. }
  44775. };
  44776. /* */
  44777. // Provides transition support for list items.
  44778. // supports move transitions using the FLIP technique.
  44779. // Because the vdom's children update algorithm is "unstable" - i.e.
  44780. // it doesn't guarantee the relative positioning of removed elements,
  44781. // we force transition-group to update its children into two passes:
  44782. // in the first pass, we remove all nodes that need to be removed,
  44783. // triggering their leaving transition; in the second pass, we insert/move
  44784. // into the final desired state. This way in the second pass removed
  44785. // nodes will remain where they should be.
  44786. var props = extend({
  44787. tag: String,
  44788. moveClass: String
  44789. }, transitionProps);
  44790. delete props.mode;
  44791. var TransitionGroup = {
  44792. props: props,
  44793. render: function render (h) {
  44794. var tag = this.tag || this.$vnode.data.tag || 'span';
  44795. var map = Object.create(null);
  44796. var prevChildren = this.prevChildren = this.children;
  44797. var rawChildren = this.$slots.default || [];
  44798. var children = this.children = [];
  44799. var transitionData = extractTransitionData(this);
  44800. for (var i = 0; i < rawChildren.length; i++) {
  44801. var c = rawChildren[i];
  44802. if (c.tag) {
  44803. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  44804. children.push(c);
  44805. map[c.key] = c
  44806. ;(c.data || (c.data = {})).transition = transitionData;
  44807. } else {
  44808. var opts = c.componentOptions;
  44809. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  44810. warn(("<transition-group> children must be keyed: <" + name + ">"));
  44811. }
  44812. }
  44813. }
  44814. if (prevChildren) {
  44815. var kept = [];
  44816. var removed = [];
  44817. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  44818. var c$1 = prevChildren[i$1];
  44819. c$1.data.transition = transitionData;
  44820. c$1.data.pos = c$1.elm.getBoundingClientRect();
  44821. if (map[c$1.key]) {
  44822. kept.push(c$1);
  44823. } else {
  44824. removed.push(c$1);
  44825. }
  44826. }
  44827. this.kept = h(tag, null, kept);
  44828. this.removed = removed;
  44829. }
  44830. return h(tag, null, children)
  44831. },
  44832. beforeUpdate: function beforeUpdate () {
  44833. // force removing pass
  44834. this.__patch__(
  44835. this._vnode,
  44836. this.kept,
  44837. false, // hydrating
  44838. true // removeOnly (!important, avoids unnecessary moves)
  44839. );
  44840. this._vnode = this.kept;
  44841. },
  44842. updated: function updated () {
  44843. var children = this.prevChildren;
  44844. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  44845. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  44846. return
  44847. }
  44848. // we divide the work into three loops to avoid mixing DOM reads and writes
  44849. // in each iteration - which helps prevent layout thrashing.
  44850. children.forEach(callPendingCbs);
  44851. children.forEach(recordPosition);
  44852. children.forEach(applyTranslation);
  44853. // force reflow to put everything in position
  44854. var body = document.body;
  44855. var f = body.offsetHeight; // eslint-disable-line
  44856. children.forEach(function (c) {
  44857. if (c.data.moved) {
  44858. var el = c.elm;
  44859. var s = el.style;
  44860. addTransitionClass(el, moveClass);
  44861. s.transform = s.WebkitTransform = s.transitionDuration = '';
  44862. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  44863. if (!e || /transform$/.test(e.propertyName)) {
  44864. el.removeEventListener(transitionEndEvent, cb);
  44865. el._moveCb = null;
  44866. removeTransitionClass(el, moveClass);
  44867. }
  44868. });
  44869. }
  44870. });
  44871. },
  44872. methods: {
  44873. hasMove: function hasMove (el, moveClass) {
  44874. /* istanbul ignore if */
  44875. if (!hasTransition) {
  44876. return false
  44877. }
  44878. if (this._hasMove != null) {
  44879. return this._hasMove
  44880. }
  44881. // Detect whether an element with the move class applied has
  44882. // CSS transitions. Since the element may be inside an entering
  44883. // transition at this very moment, we make a clone of it and remove
  44884. // all other transition classes applied to ensure only the move class
  44885. // is applied.
  44886. var clone = el.cloneNode();
  44887. if (el._transitionClasses) {
  44888. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  44889. }
  44890. addClass(clone, moveClass);
  44891. clone.style.display = 'none';
  44892. this.$el.appendChild(clone);
  44893. var info = getTransitionInfo(clone);
  44894. this.$el.removeChild(clone);
  44895. return (this._hasMove = info.hasTransform)
  44896. }
  44897. }
  44898. };
  44899. function callPendingCbs (c) {
  44900. /* istanbul ignore if */
  44901. if (c.elm._moveCb) {
  44902. c.elm._moveCb();
  44903. }
  44904. /* istanbul ignore if */
  44905. if (c.elm._enterCb) {
  44906. c.elm._enterCb();
  44907. }
  44908. }
  44909. function recordPosition (c) {
  44910. c.data.newPos = c.elm.getBoundingClientRect();
  44911. }
  44912. function applyTranslation (c) {
  44913. var oldPos = c.data.pos;
  44914. var newPos = c.data.newPos;
  44915. var dx = oldPos.left - newPos.left;
  44916. var dy = oldPos.top - newPos.top;
  44917. if (dx || dy) {
  44918. c.data.moved = true;
  44919. var s = c.elm.style;
  44920. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  44921. s.transitionDuration = '0s';
  44922. }
  44923. }
  44924. var platformComponents = {
  44925. Transition: Transition,
  44926. TransitionGroup: TransitionGroup
  44927. };
  44928. /* */
  44929. // install platform specific utils
  44930. Vue$3.config.mustUseProp = mustUseProp;
  44931. Vue$3.config.isReservedTag = isReservedTag;
  44932. Vue$3.config.getTagNamespace = getTagNamespace;
  44933. Vue$3.config.isUnknownElement = isUnknownElement;
  44934. // install platform runtime directives & components
  44935. extend(Vue$3.options.directives, platformDirectives);
  44936. extend(Vue$3.options.components, platformComponents);
  44937. // install platform patch function
  44938. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  44939. // public mount method
  44940. Vue$3.prototype.$mount = function (
  44941. el,
  44942. hydrating
  44943. ) {
  44944. el = el && inBrowser ? query(el) : undefined;
  44945. return mountComponent(this, el, hydrating)
  44946. };
  44947. // devtools global hook
  44948. /* istanbul ignore next */
  44949. setTimeout(function () {
  44950. if (config.devtools) {
  44951. if (devtools) {
  44952. devtools.emit('init', Vue$3);
  44953. } else if ("development" !== 'production' && isChrome) {
  44954. console[console.info ? 'info' : 'log'](
  44955. 'Download the Vue Devtools extension for a better development experience:\n' +
  44956. 'https://github.com/vuejs/vue-devtools'
  44957. );
  44958. }
  44959. }
  44960. if ("development" !== 'production' &&
  44961. config.productionTip !== false &&
  44962. inBrowser && typeof console !== 'undefined') {
  44963. console[console.info ? 'info' : 'log'](
  44964. "You are running Vue in development mode.\n" +
  44965. "Make sure to turn on production mode when deploying for production.\n" +
  44966. "See more tips at https://vuejs.org/guide/deployment.html"
  44967. );
  44968. }
  44969. }, 0);
  44970. /* */
  44971. // check whether current browser encodes a char inside attribute values
  44972. function shouldDecode (content, encoded) {
  44973. var div = document.createElement('div');
  44974. div.innerHTML = "<div a=\"" + content + "\">";
  44975. return div.innerHTML.indexOf(encoded) > 0
  44976. }
  44977. // #3663
  44978. // IE encodes newlines inside attribute values while other browsers don't
  44979. var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
  44980. /* */
  44981. var isUnaryTag = makeMap(
  44982. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  44983. 'link,meta,param,source,track,wbr'
  44984. );
  44985. // Elements that you can, intentionally, leave open
  44986. // (and which close themselves)
  44987. var canBeLeftOpenTag = makeMap(
  44988. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  44989. );
  44990. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  44991. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  44992. var isNonPhrasingTag = makeMap(
  44993. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  44994. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  44995. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  44996. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  44997. 'title,tr,track'
  44998. );
  44999. /* */
  45000. var decoder;
  45001. function decode (html) {
  45002. decoder = decoder || document.createElement('div');
  45003. decoder.innerHTML = html;
  45004. return decoder.textContent
  45005. }
  45006. /**
  45007. * Not type-checking this file because it's mostly vendor code.
  45008. */
  45009. /*!
  45010. * HTML Parser By John Resig (ejohn.org)
  45011. * Modified by Juriy "kangax" Zaytsev
  45012. * Original code by Erik Arvidsson, Mozilla Public License
  45013. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  45014. */
  45015. // Regular Expressions for parsing tags and attributes
  45016. var singleAttrIdentifier = /([^\s"'<>/=]+)/;
  45017. var singleAttrAssign = /(?:=)/;
  45018. var singleAttrValues = [
  45019. // attr value double quotes
  45020. /"([^"]*)"+/.source,
  45021. // attr value, single quotes
  45022. /'([^']*)'+/.source,
  45023. // attr value, no quotes
  45024. /([^\s"'=<>`]+)/.source
  45025. ];
  45026. var attribute = new RegExp(
  45027. '^\\s*' + singleAttrIdentifier.source +
  45028. '(?:\\s*(' + singleAttrAssign.source + ')' +
  45029. '\\s*(?:' + singleAttrValues.join('|') + '))?'
  45030. );
  45031. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  45032. // but for Vue templates we can enforce a simple charset
  45033. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  45034. var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
  45035. var startTagOpen = new RegExp('^<' + qnameCapture);
  45036. var startTagClose = /^\s*(\/?)>/;
  45037. var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
  45038. var doctype = /^<!DOCTYPE [^>]+>/i;
  45039. var comment = /^<!--/;
  45040. var conditionalComment = /^<!\[/;
  45041. var IS_REGEX_CAPTURING_BROKEN = false;
  45042. 'x'.replace(/x(.)?/g, function (m, g) {
  45043. IS_REGEX_CAPTURING_BROKEN = g === '';
  45044. });
  45045. // Special Elements (can contain anything)
  45046. var isPlainTextElement = makeMap('script,style,textarea', true);
  45047. var reCache = {};
  45048. var decodingMap = {
  45049. '&lt;': '<',
  45050. '&gt;': '>',
  45051. '&quot;': '"',
  45052. '&amp;': '&',
  45053. '&#10;': '\n'
  45054. };
  45055. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  45056. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;
  45057. function decodeAttr (value, shouldDecodeNewlines) {
  45058. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  45059. return value.replace(re, function (match) { return decodingMap[match]; })
  45060. }
  45061. function parseHTML (html, options) {
  45062. var stack = [];
  45063. var expectHTML = options.expectHTML;
  45064. var isUnaryTag$$1 = options.isUnaryTag || no;
  45065. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  45066. var index = 0;
  45067. var last, lastTag;
  45068. while (html) {
  45069. last = html;
  45070. // Make sure we're not in a plaintext content element like script/style
  45071. if (!lastTag || !isPlainTextElement(lastTag)) {
  45072. var textEnd = html.indexOf('<');
  45073. if (textEnd === 0) {
  45074. // Comment:
  45075. if (comment.test(html)) {
  45076. var commentEnd = html.indexOf('-->');
  45077. if (commentEnd >= 0) {
  45078. advance(commentEnd + 3);
  45079. continue
  45080. }
  45081. }
  45082. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  45083. if (conditionalComment.test(html)) {
  45084. var conditionalEnd = html.indexOf(']>');
  45085. if (conditionalEnd >= 0) {
  45086. advance(conditionalEnd + 2);
  45087. continue
  45088. }
  45089. }
  45090. // Doctype:
  45091. var doctypeMatch = html.match(doctype);
  45092. if (doctypeMatch) {
  45093. advance(doctypeMatch[0].length);
  45094. continue
  45095. }
  45096. // End tag:
  45097. var endTagMatch = html.match(endTag);
  45098. if (endTagMatch) {
  45099. var curIndex = index;
  45100. advance(endTagMatch[0].length);
  45101. parseEndTag(endTagMatch[1], curIndex, index);
  45102. continue
  45103. }
  45104. // Start tag:
  45105. var startTagMatch = parseStartTag();
  45106. if (startTagMatch) {
  45107. handleStartTag(startTagMatch);
  45108. continue
  45109. }
  45110. }
  45111. var text = (void 0), rest$1 = (void 0), next = (void 0);
  45112. if (textEnd >= 0) {
  45113. rest$1 = html.slice(textEnd);
  45114. while (
  45115. !endTag.test(rest$1) &&
  45116. !startTagOpen.test(rest$1) &&
  45117. !comment.test(rest$1) &&
  45118. !conditionalComment.test(rest$1)
  45119. ) {
  45120. // < in plain text, be forgiving and treat it as text
  45121. next = rest$1.indexOf('<', 1);
  45122. if (next < 0) { break }
  45123. textEnd += next;
  45124. rest$1 = html.slice(textEnd);
  45125. }
  45126. text = html.substring(0, textEnd);
  45127. advance(textEnd);
  45128. }
  45129. if (textEnd < 0) {
  45130. text = html;
  45131. html = '';
  45132. }
  45133. if (options.chars && text) {
  45134. options.chars(text);
  45135. }
  45136. } else {
  45137. var stackedTag = lastTag.toLowerCase();
  45138. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  45139. var endTagLength = 0;
  45140. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  45141. endTagLength = endTag.length;
  45142. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  45143. text = text
  45144. .replace(/<!--([\s\S]*?)-->/g, '$1')
  45145. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  45146. }
  45147. if (options.chars) {
  45148. options.chars(text);
  45149. }
  45150. return ''
  45151. });
  45152. index += html.length - rest.length;
  45153. html = rest;
  45154. parseEndTag(stackedTag, index - endTagLength, index);
  45155. }
  45156. if (html === last) {
  45157. options.chars && options.chars(html);
  45158. if ("development" !== 'production' && !stack.length && options.warn) {
  45159. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  45160. }
  45161. break
  45162. }
  45163. }
  45164. // Clean up any remaining tags
  45165. parseEndTag();
  45166. function advance (n) {
  45167. index += n;
  45168. html = html.substring(n);
  45169. }
  45170. function parseStartTag () {
  45171. var start = html.match(startTagOpen);
  45172. if (start) {
  45173. var match = {
  45174. tagName: start[1],
  45175. attrs: [],
  45176. start: index
  45177. };
  45178. advance(start[0].length);
  45179. var end, attr;
  45180. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  45181. advance(attr[0].length);
  45182. match.attrs.push(attr);
  45183. }
  45184. if (end) {
  45185. match.unarySlash = end[1];
  45186. advance(end[0].length);
  45187. match.end = index;
  45188. return match
  45189. }
  45190. }
  45191. }
  45192. function handleStartTag (match) {
  45193. var tagName = match.tagName;
  45194. var unarySlash = match.unarySlash;
  45195. if (expectHTML) {
  45196. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  45197. parseEndTag(lastTag);
  45198. }
  45199. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  45200. parseEndTag(tagName);
  45201. }
  45202. }
  45203. var unary = isUnaryTag$$1(tagName) || tagName === 'html' && lastTag === 'head' || !!unarySlash;
  45204. var l = match.attrs.length;
  45205. var attrs = new Array(l);
  45206. for (var i = 0; i < l; i++) {
  45207. var args = match.attrs[i];
  45208. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  45209. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  45210. if (args[3] === '') { delete args[3]; }
  45211. if (args[4] === '') { delete args[4]; }
  45212. if (args[5] === '') { delete args[5]; }
  45213. }
  45214. var value = args[3] || args[4] || args[5] || '';
  45215. attrs[i] = {
  45216. name: args[1],
  45217. value: decodeAttr(
  45218. value,
  45219. options.shouldDecodeNewlines
  45220. )
  45221. };
  45222. }
  45223. if (!unary) {
  45224. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  45225. lastTag = tagName;
  45226. }
  45227. if (options.start) {
  45228. options.start(tagName, attrs, unary, match.start, match.end);
  45229. }
  45230. }
  45231. function parseEndTag (tagName, start, end) {
  45232. var pos, lowerCasedTagName;
  45233. if (start == null) { start = index; }
  45234. if (end == null) { end = index; }
  45235. if (tagName) {
  45236. lowerCasedTagName = tagName.toLowerCase();
  45237. }
  45238. // Find the closest opened tag of the same type
  45239. if (tagName) {
  45240. for (pos = stack.length - 1; pos >= 0; pos--) {
  45241. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  45242. break
  45243. }
  45244. }
  45245. } else {
  45246. // If no tag name is provided, clean shop
  45247. pos = 0;
  45248. }
  45249. if (pos >= 0) {
  45250. // Close all the open elements, up the stack
  45251. for (var i = stack.length - 1; i >= pos; i--) {
  45252. if ("development" !== 'production' &&
  45253. (i > pos || !tagName) &&
  45254. options.warn) {
  45255. options.warn(
  45256. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  45257. );
  45258. }
  45259. if (options.end) {
  45260. options.end(stack[i].tag, start, end);
  45261. }
  45262. }
  45263. // Remove the open elements from the stack
  45264. stack.length = pos;
  45265. lastTag = pos && stack[pos - 1].tag;
  45266. } else if (lowerCasedTagName === 'br') {
  45267. if (options.start) {
  45268. options.start(tagName, [], true, start, end);
  45269. }
  45270. } else if (lowerCasedTagName === 'p') {
  45271. if (options.start) {
  45272. options.start(tagName, [], false, start, end);
  45273. }
  45274. if (options.end) {
  45275. options.end(tagName, start, end);
  45276. }
  45277. }
  45278. }
  45279. }
  45280. /* */
  45281. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  45282. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  45283. var buildRegex = cached(function (delimiters) {
  45284. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  45285. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  45286. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  45287. });
  45288. function parseText (
  45289. text,
  45290. delimiters
  45291. ) {
  45292. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  45293. if (!tagRE.test(text)) {
  45294. return
  45295. }
  45296. var tokens = [];
  45297. var lastIndex = tagRE.lastIndex = 0;
  45298. var match, index;
  45299. while ((match = tagRE.exec(text))) {
  45300. index = match.index;
  45301. // push text token
  45302. if (index > lastIndex) {
  45303. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  45304. }
  45305. // tag token
  45306. var exp = parseFilters(match[1].trim());
  45307. tokens.push(("_s(" + exp + ")"));
  45308. lastIndex = index + match[0].length;
  45309. }
  45310. if (lastIndex < text.length) {
  45311. tokens.push(JSON.stringify(text.slice(lastIndex)));
  45312. }
  45313. return tokens.join('+')
  45314. }
  45315. /* */
  45316. var onRE = /^@|^v-on:/;
  45317. var dirRE = /^v-|^@|^:/;
  45318. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  45319. var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
  45320. var argRE = /:(.*)$/;
  45321. var bindRE = /^:|^v-bind:/;
  45322. var modifierRE = /\.[^.]+/g;
  45323. var decodeHTMLCached = cached(decode);
  45324. // configurable state
  45325. var warn$2;
  45326. var delimiters;
  45327. var transforms;
  45328. var preTransforms;
  45329. var postTransforms;
  45330. var platformIsPreTag;
  45331. var platformMustUseProp;
  45332. var platformGetTagNamespace;
  45333. /**
  45334. * Convert HTML string to AST.
  45335. */
  45336. function parse (
  45337. template,
  45338. options
  45339. ) {
  45340. warn$2 = options.warn || baseWarn;
  45341. platformGetTagNamespace = options.getTagNamespace || no;
  45342. platformMustUseProp = options.mustUseProp || no;
  45343. platformIsPreTag = options.isPreTag || no;
  45344. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  45345. transforms = pluckModuleFunction(options.modules, 'transformNode');
  45346. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  45347. delimiters = options.delimiters;
  45348. var stack = [];
  45349. var preserveWhitespace = options.preserveWhitespace !== false;
  45350. var root;
  45351. var currentParent;
  45352. var inVPre = false;
  45353. var inPre = false;
  45354. var warned = false;
  45355. function warnOnce (msg) {
  45356. if (!warned) {
  45357. warned = true;
  45358. warn$2(msg);
  45359. }
  45360. }
  45361. function endPre (element) {
  45362. // check pre state
  45363. if (element.pre) {
  45364. inVPre = false;
  45365. }
  45366. if (platformIsPreTag(element.tag)) {
  45367. inPre = false;
  45368. }
  45369. }
  45370. parseHTML(template, {
  45371. warn: warn$2,
  45372. expectHTML: options.expectHTML,
  45373. isUnaryTag: options.isUnaryTag,
  45374. canBeLeftOpenTag: options.canBeLeftOpenTag,
  45375. shouldDecodeNewlines: options.shouldDecodeNewlines,
  45376. start: function start (tag, attrs, unary) {
  45377. // check namespace.
  45378. // inherit parent ns if there is one
  45379. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  45380. // handle IE svg bug
  45381. /* istanbul ignore if */
  45382. if (isIE && ns === 'svg') {
  45383. attrs = guardIESVGBug(attrs);
  45384. }
  45385. var element = {
  45386. type: 1,
  45387. tag: tag,
  45388. attrsList: attrs,
  45389. attrsMap: makeAttrsMap(attrs),
  45390. parent: currentParent,
  45391. children: []
  45392. };
  45393. if (ns) {
  45394. element.ns = ns;
  45395. }
  45396. if (isForbiddenTag(element) && !isServerRendering()) {
  45397. element.forbidden = true;
  45398. "development" !== 'production' && warn$2(
  45399. 'Templates should only be responsible for mapping the state to the ' +
  45400. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  45401. "<" + tag + ">" + ', as they will not be parsed.'
  45402. );
  45403. }
  45404. // apply pre-transforms
  45405. for (var i = 0; i < preTransforms.length; i++) {
  45406. preTransforms[i](element, options);
  45407. }
  45408. if (!inVPre) {
  45409. processPre(element);
  45410. if (element.pre) {
  45411. inVPre = true;
  45412. }
  45413. }
  45414. if (platformIsPreTag(element.tag)) {
  45415. inPre = true;
  45416. }
  45417. if (inVPre) {
  45418. processRawAttrs(element);
  45419. } else {
  45420. processFor(element);
  45421. processIf(element);
  45422. processOnce(element);
  45423. processKey(element);
  45424. // determine whether this is a plain element after
  45425. // removing structural attributes
  45426. element.plain = !element.key && !attrs.length;
  45427. processRef(element);
  45428. processSlot(element);
  45429. processComponent(element);
  45430. for (var i$1 = 0; i$1 < transforms.length; i$1++) {
  45431. transforms[i$1](element, options);
  45432. }
  45433. processAttrs(element);
  45434. }
  45435. function checkRootConstraints (el) {
  45436. {
  45437. if (el.tag === 'slot' || el.tag === 'template') {
  45438. warnOnce(
  45439. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  45440. 'contain multiple nodes.'
  45441. );
  45442. }
  45443. if (el.attrsMap.hasOwnProperty('v-for')) {
  45444. warnOnce(
  45445. 'Cannot use v-for on stateful component root element because ' +
  45446. 'it renders multiple elements.'
  45447. );
  45448. }
  45449. }
  45450. }
  45451. // tree management
  45452. if (!root) {
  45453. root = element;
  45454. checkRootConstraints(root);
  45455. } else if (!stack.length) {
  45456. // allow root elements with v-if, v-else-if and v-else
  45457. if (root.if && (element.elseif || element.else)) {
  45458. checkRootConstraints(element);
  45459. addIfCondition(root, {
  45460. exp: element.elseif,
  45461. block: element
  45462. });
  45463. } else {
  45464. warnOnce(
  45465. "Component template should contain exactly one root element. " +
  45466. "If you are using v-if on multiple elements, " +
  45467. "use v-else-if to chain them instead."
  45468. );
  45469. }
  45470. }
  45471. if (currentParent && !element.forbidden) {
  45472. if (element.elseif || element.else) {
  45473. processIfConditions(element, currentParent);
  45474. } else if (element.slotScope) { // scoped slot
  45475. currentParent.plain = false;
  45476. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  45477. } else {
  45478. currentParent.children.push(element);
  45479. element.parent = currentParent;
  45480. }
  45481. }
  45482. if (!unary) {
  45483. currentParent = element;
  45484. stack.push(element);
  45485. } else {
  45486. endPre(element);
  45487. }
  45488. // apply post-transforms
  45489. for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
  45490. postTransforms[i$2](element, options);
  45491. }
  45492. },
  45493. end: function end () {
  45494. // remove trailing whitespace
  45495. var element = stack[stack.length - 1];
  45496. var lastNode = element.children[element.children.length - 1];
  45497. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  45498. element.children.pop();
  45499. }
  45500. // pop stack
  45501. stack.length -= 1;
  45502. currentParent = stack[stack.length - 1];
  45503. endPre(element);
  45504. },
  45505. chars: function chars (text) {
  45506. if (!currentParent) {
  45507. {
  45508. if (text === template) {
  45509. warnOnce(
  45510. 'Component template requires a root element, rather than just text.'
  45511. );
  45512. } else if ((text = text.trim())) {
  45513. warnOnce(
  45514. ("text \"" + text + "\" outside root element will be ignored.")
  45515. );
  45516. }
  45517. }
  45518. return
  45519. }
  45520. // IE textarea placeholder bug
  45521. /* istanbul ignore if */
  45522. if (isIE &&
  45523. currentParent.tag === 'textarea' &&
  45524. currentParent.attrsMap.placeholder === text) {
  45525. return
  45526. }
  45527. var children = currentParent.children;
  45528. text = inPre || text.trim()
  45529. ? decodeHTMLCached(text)
  45530. // only preserve whitespace if its not right after a starting tag
  45531. : preserveWhitespace && children.length ? ' ' : '';
  45532. if (text) {
  45533. var expression;
  45534. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  45535. children.push({
  45536. type: 2,
  45537. expression: expression,
  45538. text: text
  45539. });
  45540. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  45541. children.push({
  45542. type: 3,
  45543. text: text
  45544. });
  45545. }
  45546. }
  45547. }
  45548. });
  45549. return root
  45550. }
  45551. function processPre (el) {
  45552. if (getAndRemoveAttr(el, 'v-pre') != null) {
  45553. el.pre = true;
  45554. }
  45555. }
  45556. function processRawAttrs (el) {
  45557. var l = el.attrsList.length;
  45558. if (l) {
  45559. var attrs = el.attrs = new Array(l);
  45560. for (var i = 0; i < l; i++) {
  45561. attrs[i] = {
  45562. name: el.attrsList[i].name,
  45563. value: JSON.stringify(el.attrsList[i].value)
  45564. };
  45565. }
  45566. } else if (!el.pre) {
  45567. // non root node in pre blocks with no attributes
  45568. el.plain = true;
  45569. }
  45570. }
  45571. function processKey (el) {
  45572. var exp = getBindingAttr(el, 'key');
  45573. if (exp) {
  45574. if ("development" !== 'production' && el.tag === 'template') {
  45575. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  45576. }
  45577. el.key = exp;
  45578. }
  45579. }
  45580. function processRef (el) {
  45581. var ref = getBindingAttr(el, 'ref');
  45582. if (ref) {
  45583. el.ref = ref;
  45584. el.refInFor = checkInFor(el);
  45585. }
  45586. }
  45587. function processFor (el) {
  45588. var exp;
  45589. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  45590. var inMatch = exp.match(forAliasRE);
  45591. if (!inMatch) {
  45592. "development" !== 'production' && warn$2(
  45593. ("Invalid v-for expression: " + exp)
  45594. );
  45595. return
  45596. }
  45597. el.for = inMatch[2].trim();
  45598. var alias = inMatch[1].trim();
  45599. var iteratorMatch = alias.match(forIteratorRE);
  45600. if (iteratorMatch) {
  45601. el.alias = iteratorMatch[1].trim();
  45602. el.iterator1 = iteratorMatch[2].trim();
  45603. if (iteratorMatch[3]) {
  45604. el.iterator2 = iteratorMatch[3].trim();
  45605. }
  45606. } else {
  45607. el.alias = alias;
  45608. }
  45609. }
  45610. }
  45611. function processIf (el) {
  45612. var exp = getAndRemoveAttr(el, 'v-if');
  45613. if (exp) {
  45614. el.if = exp;
  45615. addIfCondition(el, {
  45616. exp: exp,
  45617. block: el
  45618. });
  45619. } else {
  45620. if (getAndRemoveAttr(el, 'v-else') != null) {
  45621. el.else = true;
  45622. }
  45623. var elseif = getAndRemoveAttr(el, 'v-else-if');
  45624. if (elseif) {
  45625. el.elseif = elseif;
  45626. }
  45627. }
  45628. }
  45629. function processIfConditions (el, parent) {
  45630. var prev = findPrevElement(parent.children);
  45631. if (prev && prev.if) {
  45632. addIfCondition(prev, {
  45633. exp: el.elseif,
  45634. block: el
  45635. });
  45636. } else {
  45637. warn$2(
  45638. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  45639. "used on element <" + (el.tag) + "> without corresponding v-if."
  45640. );
  45641. }
  45642. }
  45643. function findPrevElement (children) {
  45644. var i = children.length;
  45645. while (i--) {
  45646. if (children[i].type === 1) {
  45647. return children[i]
  45648. } else {
  45649. if ("development" !== 'production' && children[i].text !== ' ') {
  45650. warn$2(
  45651. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  45652. "will be ignored."
  45653. );
  45654. }
  45655. children.pop();
  45656. }
  45657. }
  45658. }
  45659. function addIfCondition (el, condition) {
  45660. if (!el.ifConditions) {
  45661. el.ifConditions = [];
  45662. }
  45663. el.ifConditions.push(condition);
  45664. }
  45665. function processOnce (el) {
  45666. var once$$1 = getAndRemoveAttr(el, 'v-once');
  45667. if (once$$1 != null) {
  45668. el.once = true;
  45669. }
  45670. }
  45671. function processSlot (el) {
  45672. if (el.tag === 'slot') {
  45673. el.slotName = getBindingAttr(el, 'name');
  45674. if ("development" !== 'production' && el.key) {
  45675. warn$2(
  45676. "`key` does not work on <slot> because slots are abstract outlets " +
  45677. "and can possibly expand into multiple elements. " +
  45678. "Use the key on a wrapping element instead."
  45679. );
  45680. }
  45681. } else {
  45682. var slotTarget = getBindingAttr(el, 'slot');
  45683. if (slotTarget) {
  45684. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  45685. }
  45686. if (el.tag === 'template') {
  45687. el.slotScope = getAndRemoveAttr(el, 'scope');
  45688. }
  45689. }
  45690. }
  45691. function processComponent (el) {
  45692. var binding;
  45693. if ((binding = getBindingAttr(el, 'is'))) {
  45694. el.component = binding;
  45695. }
  45696. if (getAndRemoveAttr(el, 'inline-template') != null) {
  45697. el.inlineTemplate = true;
  45698. }
  45699. }
  45700. function processAttrs (el) {
  45701. var list = el.attrsList;
  45702. var i, l, name, rawName, value, modifiers, isProp;
  45703. for (i = 0, l = list.length; i < l; i++) {
  45704. name = rawName = list[i].name;
  45705. value = list[i].value;
  45706. if (dirRE.test(name)) {
  45707. // mark element as dynamic
  45708. el.hasBindings = true;
  45709. // modifiers
  45710. modifiers = parseModifiers(name);
  45711. if (modifiers) {
  45712. name = name.replace(modifierRE, '');
  45713. }
  45714. if (bindRE.test(name)) { // v-bind
  45715. name = name.replace(bindRE, '');
  45716. value = parseFilters(value);
  45717. isProp = false;
  45718. if (modifiers) {
  45719. if (modifiers.prop) {
  45720. isProp = true;
  45721. name = camelize(name);
  45722. if (name === 'innerHtml') { name = 'innerHTML'; }
  45723. }
  45724. if (modifiers.camel) {
  45725. name = camelize(name);
  45726. }
  45727. }
  45728. if (isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  45729. addProp(el, name, value);
  45730. } else {
  45731. addAttr(el, name, value);
  45732. }
  45733. } else if (onRE.test(name)) { // v-on
  45734. name = name.replace(onRE, '');
  45735. addHandler(el, name, value, modifiers);
  45736. } else { // normal directives
  45737. name = name.replace(dirRE, '');
  45738. // parse arg
  45739. var argMatch = name.match(argRE);
  45740. var arg = argMatch && argMatch[1];
  45741. if (arg) {
  45742. name = name.slice(0, -(arg.length + 1));
  45743. }
  45744. addDirective(el, name, rawName, value, arg, modifiers);
  45745. if ("development" !== 'production' && name === 'model') {
  45746. checkForAliasModel(el, value);
  45747. }
  45748. }
  45749. } else {
  45750. // literal attribute
  45751. {
  45752. var expression = parseText(value, delimiters);
  45753. if (expression) {
  45754. warn$2(
  45755. name + "=\"" + value + "\": " +
  45756. 'Interpolation inside attributes has been removed. ' +
  45757. 'Use v-bind or the colon shorthand instead. For example, ' +
  45758. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  45759. );
  45760. }
  45761. }
  45762. addAttr(el, name, JSON.stringify(value));
  45763. }
  45764. }
  45765. }
  45766. function checkInFor (el) {
  45767. var parent = el;
  45768. while (parent) {
  45769. if (parent.for !== undefined) {
  45770. return true
  45771. }
  45772. parent = parent.parent;
  45773. }
  45774. return false
  45775. }
  45776. function parseModifiers (name) {
  45777. var match = name.match(modifierRE);
  45778. if (match) {
  45779. var ret = {};
  45780. match.forEach(function (m) { ret[m.slice(1)] = true; });
  45781. return ret
  45782. }
  45783. }
  45784. function makeAttrsMap (attrs) {
  45785. var map = {};
  45786. for (var i = 0, l = attrs.length; i < l; i++) {
  45787. if ("development" !== 'production' && map[attrs[i].name] && !isIE) {
  45788. warn$2('duplicate attribute: ' + attrs[i].name);
  45789. }
  45790. map[attrs[i].name] = attrs[i].value;
  45791. }
  45792. return map
  45793. }
  45794. function isForbiddenTag (el) {
  45795. return (
  45796. el.tag === 'style' ||
  45797. (el.tag === 'script' && (
  45798. !el.attrsMap.type ||
  45799. el.attrsMap.type === 'text/javascript'
  45800. ))
  45801. )
  45802. }
  45803. var ieNSBug = /^xmlns:NS\d+/;
  45804. var ieNSPrefix = /^NS\d+:/;
  45805. /* istanbul ignore next */
  45806. function guardIESVGBug (attrs) {
  45807. var res = [];
  45808. for (var i = 0; i < attrs.length; i++) {
  45809. var attr = attrs[i];
  45810. if (!ieNSBug.test(attr.name)) {
  45811. attr.name = attr.name.replace(ieNSPrefix, '');
  45812. res.push(attr);
  45813. }
  45814. }
  45815. return res
  45816. }
  45817. function checkForAliasModel (el, value) {
  45818. var _el = el;
  45819. while (_el) {
  45820. if (_el.for && _el.alias === value) {
  45821. warn$2(
  45822. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  45823. "You are binding v-model directly to a v-for iteration alias. " +
  45824. "This will not be able to modify the v-for source array because " +
  45825. "writing to the alias is like modifying a function local variable. " +
  45826. "Consider using an array of objects and use v-model on an object property instead."
  45827. );
  45828. }
  45829. _el = _el.parent;
  45830. }
  45831. }
  45832. /* */
  45833. var isStaticKey;
  45834. var isPlatformReservedTag;
  45835. var genStaticKeysCached = cached(genStaticKeys$1);
  45836. /**
  45837. * Goal of the optimizer: walk the generated template AST tree
  45838. * and detect sub-trees that are purely static, i.e. parts of
  45839. * the DOM that never needs to change.
  45840. *
  45841. * Once we detect these sub-trees, we can:
  45842. *
  45843. * 1. Hoist them into constants, so that we no longer need to
  45844. * create fresh nodes for them on each re-render;
  45845. * 2. Completely skip them in the patching process.
  45846. */
  45847. function optimize (root, options) {
  45848. if (!root) { return }
  45849. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  45850. isPlatformReservedTag = options.isReservedTag || no;
  45851. // first pass: mark all non-static nodes.
  45852. markStatic$1(root);
  45853. // second pass: mark static roots.
  45854. markStaticRoots(root, false);
  45855. }
  45856. function genStaticKeys$1 (keys) {
  45857. return makeMap(
  45858. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  45859. (keys ? ',' + keys : '')
  45860. )
  45861. }
  45862. function markStatic$1 (node) {
  45863. node.static = isStatic(node);
  45864. if (node.type === 1) {
  45865. // do not make component slot content static. this avoids
  45866. // 1. components not able to mutate slot nodes
  45867. // 2. static slot content fails for hot-reloading
  45868. if (
  45869. !isPlatformReservedTag(node.tag) &&
  45870. node.tag !== 'slot' &&
  45871. node.attrsMap['inline-template'] == null
  45872. ) {
  45873. return
  45874. }
  45875. for (var i = 0, l = node.children.length; i < l; i++) {
  45876. var child = node.children[i];
  45877. markStatic$1(child);
  45878. if (!child.static) {
  45879. node.static = false;
  45880. }
  45881. }
  45882. }
  45883. }
  45884. function markStaticRoots (node, isInFor) {
  45885. if (node.type === 1) {
  45886. if (node.static || node.once) {
  45887. node.staticInFor = isInFor;
  45888. }
  45889. // For a node to qualify as a static root, it should have children that
  45890. // are not just static text. Otherwise the cost of hoisting out will
  45891. // outweigh the benefits and it's better off to just always render it fresh.
  45892. if (node.static && node.children.length && !(
  45893. node.children.length === 1 &&
  45894. node.children[0].type === 3
  45895. )) {
  45896. node.staticRoot = true;
  45897. return
  45898. } else {
  45899. node.staticRoot = false;
  45900. }
  45901. if (node.children) {
  45902. for (var i = 0, l = node.children.length; i < l; i++) {
  45903. markStaticRoots(node.children[i], isInFor || !!node.for);
  45904. }
  45905. }
  45906. if (node.ifConditions) {
  45907. walkThroughConditionsBlocks(node.ifConditions, isInFor);
  45908. }
  45909. }
  45910. }
  45911. function walkThroughConditionsBlocks (conditionBlocks, isInFor) {
  45912. for (var i = 1, len = conditionBlocks.length; i < len; i++) {
  45913. markStaticRoots(conditionBlocks[i].block, isInFor);
  45914. }
  45915. }
  45916. function isStatic (node) {
  45917. if (node.type === 2) { // expression
  45918. return false
  45919. }
  45920. if (node.type === 3) { // text
  45921. return true
  45922. }
  45923. return !!(node.pre || (
  45924. !node.hasBindings && // no dynamic bindings
  45925. !node.if && !node.for && // not v-if or v-for or v-else
  45926. !isBuiltInTag(node.tag) && // not a built-in
  45927. isPlatformReservedTag(node.tag) && // not a component
  45928. !isDirectChildOfTemplateFor(node) &&
  45929. Object.keys(node).every(isStaticKey)
  45930. ))
  45931. }
  45932. function isDirectChildOfTemplateFor (node) {
  45933. while (node.parent) {
  45934. node = node.parent;
  45935. if (node.tag !== 'template') {
  45936. return false
  45937. }
  45938. if (node.for) {
  45939. return true
  45940. }
  45941. }
  45942. return false
  45943. }
  45944. /* */
  45945. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  45946. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  45947. // keyCode aliases
  45948. var keyCodes = {
  45949. esc: 27,
  45950. tab: 9,
  45951. enter: 13,
  45952. space: 32,
  45953. up: 38,
  45954. left: 37,
  45955. right: 39,
  45956. down: 40,
  45957. 'delete': [8, 46]
  45958. };
  45959. // #4868: modifiers that prevent the execution of the listener
  45960. // need to explicitly return null so that we can determine whether to remove
  45961. // the listener for .once
  45962. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  45963. var modifierCode = {
  45964. stop: '$event.stopPropagation();',
  45965. prevent: '$event.preventDefault();',
  45966. self: genGuard("$event.target !== $event.currentTarget"),
  45967. ctrl: genGuard("!$event.ctrlKey"),
  45968. shift: genGuard("!$event.shiftKey"),
  45969. alt: genGuard("!$event.altKey"),
  45970. meta: genGuard("!$event.metaKey"),
  45971. left: genGuard("'button' in $event && $event.button !== 0"),
  45972. middle: genGuard("'button' in $event && $event.button !== 1"),
  45973. right: genGuard("'button' in $event && $event.button !== 2")
  45974. };
  45975. function genHandlers (events, native) {
  45976. var res = native ? 'nativeOn:{' : 'on:{';
  45977. for (var name in events) {
  45978. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  45979. }
  45980. return res.slice(0, -1) + '}'
  45981. }
  45982. function genHandler (
  45983. name,
  45984. handler
  45985. ) {
  45986. if (!handler) {
  45987. return 'function(){}'
  45988. }
  45989. if (Array.isArray(handler)) {
  45990. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  45991. }
  45992. var isMethodPath = simplePathRE.test(handler.value);
  45993. var isFunctionExpression = fnExpRE.test(handler.value);
  45994. if (!handler.modifiers) {
  45995. return isMethodPath || isFunctionExpression
  45996. ? handler.value
  45997. : ("function($event){" + (handler.value) + "}") // inline statement
  45998. } else {
  45999. var code = '';
  46000. var genModifierCode = '';
  46001. var keys = [];
  46002. for (var key in handler.modifiers) {
  46003. if (modifierCode[key]) {
  46004. genModifierCode += modifierCode[key];
  46005. // left/right
  46006. if (keyCodes[key]) {
  46007. keys.push(key);
  46008. }
  46009. } else {
  46010. keys.push(key);
  46011. }
  46012. }
  46013. if (keys.length) {
  46014. code += genKeyFilter(keys);
  46015. }
  46016. // Make sure modifiers like prevent and stop get executed after key filtering
  46017. if (genModifierCode) {
  46018. code += genModifierCode;
  46019. }
  46020. var handlerCode = isMethodPath
  46021. ? handler.value + '($event)'
  46022. : isFunctionExpression
  46023. ? ("(" + (handler.value) + ")($event)")
  46024. : handler.value;
  46025. return ("function($event){" + code + handlerCode + "}")
  46026. }
  46027. }
  46028. function genKeyFilter (keys) {
  46029. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  46030. }
  46031. function genFilterCode (key) {
  46032. var keyVal = parseInt(key, 10);
  46033. if (keyVal) {
  46034. return ("$event.keyCode!==" + keyVal)
  46035. }
  46036. var alias = keyCodes[key];
  46037. return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
  46038. }
  46039. /* */
  46040. function bind$1 (el, dir) {
  46041. el.wrapData = function (code) {
  46042. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
  46043. };
  46044. }
  46045. /* */
  46046. var baseDirectives = {
  46047. bind: bind$1,
  46048. cloak: noop
  46049. };
  46050. /* */
  46051. // configurable state
  46052. var warn$3;
  46053. var transforms$1;
  46054. var dataGenFns;
  46055. var platformDirectives$1;
  46056. var isPlatformReservedTag$1;
  46057. var staticRenderFns;
  46058. var onceCount;
  46059. var currentOptions;
  46060. function generate (
  46061. ast,
  46062. options
  46063. ) {
  46064. // save previous staticRenderFns so generate calls can be nested
  46065. var prevStaticRenderFns = staticRenderFns;
  46066. var currentStaticRenderFns = staticRenderFns = [];
  46067. var prevOnceCount = onceCount;
  46068. onceCount = 0;
  46069. currentOptions = options;
  46070. warn$3 = options.warn || baseWarn;
  46071. transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
  46072. dataGenFns = pluckModuleFunction(options.modules, 'genData');
  46073. platformDirectives$1 = options.directives || {};
  46074. isPlatformReservedTag$1 = options.isReservedTag || no;
  46075. var code = ast ? genElement(ast) : '_c("div")';
  46076. staticRenderFns = prevStaticRenderFns;
  46077. onceCount = prevOnceCount;
  46078. return {
  46079. render: ("with(this){return " + code + "}"),
  46080. staticRenderFns: currentStaticRenderFns
  46081. }
  46082. }
  46083. function genElement (el) {
  46084. if (el.staticRoot && !el.staticProcessed) {
  46085. return genStatic(el)
  46086. } else if (el.once && !el.onceProcessed) {
  46087. return genOnce(el)
  46088. } else if (el.for && !el.forProcessed) {
  46089. return genFor(el)
  46090. } else if (el.if && !el.ifProcessed) {
  46091. return genIf(el)
  46092. } else if (el.tag === 'template' && !el.slotTarget) {
  46093. return genChildren(el) || 'void 0'
  46094. } else if (el.tag === 'slot') {
  46095. return genSlot(el)
  46096. } else {
  46097. // component or element
  46098. var code;
  46099. if (el.component) {
  46100. code = genComponent(el.component, el);
  46101. } else {
  46102. var data = el.plain ? undefined : genData(el);
  46103. var children = el.inlineTemplate ? null : genChildren(el, true);
  46104. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  46105. }
  46106. // module transforms
  46107. for (var i = 0; i < transforms$1.length; i++) {
  46108. code = transforms$1[i](el, code);
  46109. }
  46110. return code
  46111. }
  46112. }
  46113. // hoist static sub-trees out
  46114. function genStatic (el) {
  46115. el.staticProcessed = true;
  46116. staticRenderFns.push(("with(this){return " + (genElement(el)) + "}"));
  46117. return ("_m(" + (staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  46118. }
  46119. // v-once
  46120. function genOnce (el) {
  46121. el.onceProcessed = true;
  46122. if (el.if && !el.ifProcessed) {
  46123. return genIf(el)
  46124. } else if (el.staticInFor) {
  46125. var key = '';
  46126. var parent = el.parent;
  46127. while (parent) {
  46128. if (parent.for) {
  46129. key = parent.key;
  46130. break
  46131. }
  46132. parent = parent.parent;
  46133. }
  46134. if (!key) {
  46135. "development" !== 'production' && warn$3(
  46136. "v-once can only be used inside v-for that is keyed. "
  46137. );
  46138. return genElement(el)
  46139. }
  46140. return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
  46141. } else {
  46142. return genStatic(el)
  46143. }
  46144. }
  46145. function genIf (el) {
  46146. el.ifProcessed = true; // avoid recursion
  46147. return genIfConditions(el.ifConditions.slice())
  46148. }
  46149. function genIfConditions (conditions) {
  46150. if (!conditions.length) {
  46151. return '_e()'
  46152. }
  46153. var condition = conditions.shift();
  46154. if (condition.exp) {
  46155. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions)))
  46156. } else {
  46157. return ("" + (genTernaryExp(condition.block)))
  46158. }
  46159. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  46160. function genTernaryExp (el) {
  46161. return el.once ? genOnce(el) : genElement(el)
  46162. }
  46163. }
  46164. function genFor (el) {
  46165. var exp = el.for;
  46166. var alias = el.alias;
  46167. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  46168. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  46169. if (
  46170. "development" !== 'production' &&
  46171. maybeComponent(el) && el.tag !== 'slot' && el.tag !== 'template' && !el.key
  46172. ) {
  46173. warn$3(
  46174. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  46175. "v-for should have explicit keys. " +
  46176. "See https://vuejs.org/guide/list.html#key for more info.",
  46177. true /* tip */
  46178. );
  46179. }
  46180. el.forProcessed = true; // avoid recursion
  46181. return "_l((" + exp + ")," +
  46182. "function(" + alias + iterator1 + iterator2 + "){" +
  46183. "return " + (genElement(el)) +
  46184. '})'
  46185. }
  46186. function genData (el) {
  46187. var data = '{';
  46188. // directives first.
  46189. // directives may mutate the el's other properties before they are generated.
  46190. var dirs = genDirectives(el);
  46191. if (dirs) { data += dirs + ','; }
  46192. // key
  46193. if (el.key) {
  46194. data += "key:" + (el.key) + ",";
  46195. }
  46196. // ref
  46197. if (el.ref) {
  46198. data += "ref:" + (el.ref) + ",";
  46199. }
  46200. if (el.refInFor) {
  46201. data += "refInFor:true,";
  46202. }
  46203. // pre
  46204. if (el.pre) {
  46205. data += "pre:true,";
  46206. }
  46207. // record original tag name for components using "is" attribute
  46208. if (el.component) {
  46209. data += "tag:\"" + (el.tag) + "\",";
  46210. }
  46211. // module data generation functions
  46212. for (var i = 0; i < dataGenFns.length; i++) {
  46213. data += dataGenFns[i](el);
  46214. }
  46215. // attributes
  46216. if (el.attrs) {
  46217. data += "attrs:{" + (genProps(el.attrs)) + "},";
  46218. }
  46219. // DOM props
  46220. if (el.props) {
  46221. data += "domProps:{" + (genProps(el.props)) + "},";
  46222. }
  46223. // event handlers
  46224. if (el.events) {
  46225. data += (genHandlers(el.events)) + ",";
  46226. }
  46227. if (el.nativeEvents) {
  46228. data += (genHandlers(el.nativeEvents, true)) + ",";
  46229. }
  46230. // slot target
  46231. if (el.slotTarget) {
  46232. data += "slot:" + (el.slotTarget) + ",";
  46233. }
  46234. // scoped slots
  46235. if (el.scopedSlots) {
  46236. data += (genScopedSlots(el.scopedSlots)) + ",";
  46237. }
  46238. // component v-model
  46239. if (el.model) {
  46240. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  46241. }
  46242. // inline-template
  46243. if (el.inlineTemplate) {
  46244. var inlineTemplate = genInlineTemplate(el);
  46245. if (inlineTemplate) {
  46246. data += inlineTemplate + ",";
  46247. }
  46248. }
  46249. data = data.replace(/,$/, '') + '}';
  46250. // v-bind data wrap
  46251. if (el.wrapData) {
  46252. data = el.wrapData(data);
  46253. }
  46254. return data
  46255. }
  46256. function genDirectives (el) {
  46257. var dirs = el.directives;
  46258. if (!dirs) { return }
  46259. var res = 'directives:[';
  46260. var hasRuntime = false;
  46261. var i, l, dir, needRuntime;
  46262. for (i = 0, l = dirs.length; i < l; i++) {
  46263. dir = dirs[i];
  46264. needRuntime = true;
  46265. var gen = platformDirectives$1[dir.name] || baseDirectives[dir.name];
  46266. if (gen) {
  46267. // compile-time directive that manipulates AST.
  46268. // returns true if it also needs a runtime counterpart.
  46269. needRuntime = !!gen(el, dir, warn$3);
  46270. }
  46271. if (needRuntime) {
  46272. hasRuntime = true;
  46273. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  46274. }
  46275. }
  46276. if (hasRuntime) {
  46277. return res.slice(0, -1) + ']'
  46278. }
  46279. }
  46280. function genInlineTemplate (el) {
  46281. var ast = el.children[0];
  46282. if ("development" !== 'production' && (
  46283. el.children.length > 1 || ast.type !== 1
  46284. )) {
  46285. warn$3('Inline-template components must have exactly one child element.');
  46286. }
  46287. if (ast.type === 1) {
  46288. var inlineRenderFns = generate(ast, currentOptions);
  46289. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  46290. }
  46291. }
  46292. function genScopedSlots (slots) {
  46293. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(key, slots[key]); }).join(',')) + "])")
  46294. }
  46295. function genScopedSlot (key, el) {
  46296. return "[" + key + ",function(" + (String(el.attrsMap.scope)) + "){" +
  46297. "return " + (el.tag === 'template'
  46298. ? genChildren(el) || 'void 0'
  46299. : genElement(el)) + "}]"
  46300. }
  46301. function genChildren (el, checkSkip) {
  46302. var children = el.children;
  46303. if (children.length) {
  46304. var el$1 = children[0];
  46305. // optimize single v-for
  46306. if (children.length === 1 &&
  46307. el$1.for &&
  46308. el$1.tag !== 'template' &&
  46309. el$1.tag !== 'slot') {
  46310. return genElement(el$1)
  46311. }
  46312. var normalizationType = checkSkip ? getNormalizationType(children) : 0;
  46313. return ("[" + (children.map(genNode).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  46314. }
  46315. }
  46316. // determine the normalization needed for the children array.
  46317. // 0: no normalization needed
  46318. // 1: simple normalization needed (possible 1-level deep nested array)
  46319. // 2: full normalization needed
  46320. function getNormalizationType (children) {
  46321. var res = 0;
  46322. for (var i = 0; i < children.length; i++) {
  46323. var el = children[i];
  46324. if (el.type !== 1) {
  46325. continue
  46326. }
  46327. if (needsNormalization(el) ||
  46328. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  46329. res = 2;
  46330. break
  46331. }
  46332. if (maybeComponent(el) ||
  46333. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  46334. res = 1;
  46335. }
  46336. }
  46337. return res
  46338. }
  46339. function needsNormalization (el) {
  46340. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  46341. }
  46342. function maybeComponent (el) {
  46343. return !isPlatformReservedTag$1(el.tag)
  46344. }
  46345. function genNode (node) {
  46346. if (node.type === 1) {
  46347. return genElement(node)
  46348. } else {
  46349. return genText(node)
  46350. }
  46351. }
  46352. function genText (text) {
  46353. return ("_v(" + (text.type === 2
  46354. ? text.expression // no need for () because already wrapped in _s()
  46355. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  46356. }
  46357. function genSlot (el) {
  46358. var slotName = el.slotName || '"default"';
  46359. var children = genChildren(el);
  46360. var res = "_t(" + slotName + (children ? ("," + children) : '');
  46361. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  46362. var bind$$1 = el.attrsMap['v-bind'];
  46363. if ((attrs || bind$$1) && !children) {
  46364. res += ",null";
  46365. }
  46366. if (attrs) {
  46367. res += "," + attrs;
  46368. }
  46369. if (bind$$1) {
  46370. res += (attrs ? '' : ',null') + "," + bind$$1;
  46371. }
  46372. return res + ')'
  46373. }
  46374. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  46375. function genComponent (componentName, el) {
  46376. var children = el.inlineTemplate ? null : genChildren(el, true);
  46377. return ("_c(" + componentName + "," + (genData(el)) + (children ? ("," + children) : '') + ")")
  46378. }
  46379. function genProps (props) {
  46380. var res = '';
  46381. for (var i = 0; i < props.length; i++) {
  46382. var prop = props[i];
  46383. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  46384. }
  46385. return res.slice(0, -1)
  46386. }
  46387. // #3895, #4268
  46388. function transformSpecialNewlines (text) {
  46389. return text
  46390. .replace(/\u2028/g, '\\u2028')
  46391. .replace(/\u2029/g, '\\u2029')
  46392. }
  46393. /* */
  46394. // these keywords should not appear inside expressions, but operators like
  46395. // typeof, instanceof and in are allowed
  46396. var prohibitedKeywordRE = new RegExp('\\b' + (
  46397. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  46398. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  46399. 'extends,finally,continue,debugger,function,arguments'
  46400. ).split(',').join('\\b|\\b') + '\\b');
  46401. // these unary operators should not be used as property/method names
  46402. var unaryOperatorsRE = new RegExp('\\b' + (
  46403. 'delete,typeof,void'
  46404. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  46405. // check valid identifier for v-for
  46406. var identRE = /[A-Za-z_$][\w$]*/;
  46407. // strip strings in expressions
  46408. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  46409. // detect problematic expressions in a template
  46410. function detectErrors (ast) {
  46411. var errors = [];
  46412. if (ast) {
  46413. checkNode(ast, errors);
  46414. }
  46415. return errors
  46416. }
  46417. function checkNode (node, errors) {
  46418. if (node.type === 1) {
  46419. for (var name in node.attrsMap) {
  46420. if (dirRE.test(name)) {
  46421. var value = node.attrsMap[name];
  46422. if (value) {
  46423. if (name === 'v-for') {
  46424. checkFor(node, ("v-for=\"" + value + "\""), errors);
  46425. } else if (onRE.test(name)) {
  46426. checkEvent(value, (name + "=\"" + value + "\""), errors);
  46427. } else {
  46428. checkExpression(value, (name + "=\"" + value + "\""), errors);
  46429. }
  46430. }
  46431. }
  46432. }
  46433. if (node.children) {
  46434. for (var i = 0; i < node.children.length; i++) {
  46435. checkNode(node.children[i], errors);
  46436. }
  46437. }
  46438. } else if (node.type === 2) {
  46439. checkExpression(node.expression, node.text, errors);
  46440. }
  46441. }
  46442. function checkEvent (exp, text, errors) {
  46443. var keywordMatch = exp.replace(stripStringRE, '').match(unaryOperatorsRE);
  46444. if (keywordMatch) {
  46445. errors.push(
  46446. "avoid using JavaScript unary operator as property name: " +
  46447. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  46448. );
  46449. }
  46450. checkExpression(exp, text, errors);
  46451. }
  46452. function checkFor (node, text, errors) {
  46453. checkExpression(node.for || '', text, errors);
  46454. checkIdentifier(node.alias, 'v-for alias', text, errors);
  46455. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  46456. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  46457. }
  46458. function checkIdentifier (ident, type, text, errors) {
  46459. if (typeof ident === 'string' && !identRE.test(ident)) {
  46460. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  46461. }
  46462. }
  46463. function checkExpression (exp, text, errors) {
  46464. try {
  46465. new Function(("return " + exp));
  46466. } catch (e) {
  46467. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  46468. if (keywordMatch) {
  46469. errors.push(
  46470. "avoid using JavaScript keyword as property name: " +
  46471. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  46472. );
  46473. } else {
  46474. errors.push(("invalid expression: " + (text.trim())));
  46475. }
  46476. }
  46477. }
  46478. /* */
  46479. function baseCompile (
  46480. template,
  46481. options
  46482. ) {
  46483. var ast = parse(template.trim(), options);
  46484. optimize(ast, options);
  46485. var code = generate(ast, options);
  46486. return {
  46487. ast: ast,
  46488. render: code.render,
  46489. staticRenderFns: code.staticRenderFns
  46490. }
  46491. }
  46492. function makeFunction (code, errors) {
  46493. try {
  46494. return new Function(code)
  46495. } catch (err) {
  46496. errors.push({ err: err, code: code });
  46497. return noop
  46498. }
  46499. }
  46500. function createCompiler (baseOptions) {
  46501. var functionCompileCache = Object.create(null);
  46502. function compile (
  46503. template,
  46504. options
  46505. ) {
  46506. var finalOptions = Object.create(baseOptions);
  46507. var errors = [];
  46508. var tips = [];
  46509. finalOptions.warn = function (msg, tip$$1) {
  46510. (tip$$1 ? tips : errors).push(msg);
  46511. };
  46512. if (options) {
  46513. // merge custom modules
  46514. if (options.modules) {
  46515. finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
  46516. }
  46517. // merge custom directives
  46518. if (options.directives) {
  46519. finalOptions.directives = extend(
  46520. Object.create(baseOptions.directives),
  46521. options.directives
  46522. );
  46523. }
  46524. // copy other options
  46525. for (var key in options) {
  46526. if (key !== 'modules' && key !== 'directives') {
  46527. finalOptions[key] = options[key];
  46528. }
  46529. }
  46530. }
  46531. var compiled = baseCompile(template, finalOptions);
  46532. {
  46533. errors.push.apply(errors, detectErrors(compiled.ast));
  46534. }
  46535. compiled.errors = errors;
  46536. compiled.tips = tips;
  46537. return compiled
  46538. }
  46539. function compileToFunctions (
  46540. template,
  46541. options,
  46542. vm
  46543. ) {
  46544. options = options || {};
  46545. /* istanbul ignore if */
  46546. {
  46547. // detect possible CSP restriction
  46548. try {
  46549. new Function('return 1');
  46550. } catch (e) {
  46551. if (e.toString().match(/unsafe-eval|CSP/)) {
  46552. warn(
  46553. 'It seems you are using the standalone build of Vue.js in an ' +
  46554. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  46555. 'The template compiler cannot work in this environment. Consider ' +
  46556. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  46557. 'templates into render functions.'
  46558. );
  46559. }
  46560. }
  46561. }
  46562. // check cache
  46563. var key = options.delimiters
  46564. ? String(options.delimiters) + template
  46565. : template;
  46566. if (functionCompileCache[key]) {
  46567. return functionCompileCache[key]
  46568. }
  46569. // compile
  46570. var compiled = compile(template, options);
  46571. // check compilation errors/tips
  46572. {
  46573. if (compiled.errors && compiled.errors.length) {
  46574. warn(
  46575. "Error compiling template:\n\n" + template + "\n\n" +
  46576. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  46577. vm
  46578. );
  46579. }
  46580. if (compiled.tips && compiled.tips.length) {
  46581. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  46582. }
  46583. }
  46584. // turn code into functions
  46585. var res = {};
  46586. var fnGenErrors = [];
  46587. res.render = makeFunction(compiled.render, fnGenErrors);
  46588. var l = compiled.staticRenderFns.length;
  46589. res.staticRenderFns = new Array(l);
  46590. for (var i = 0; i < l; i++) {
  46591. res.staticRenderFns[i] = makeFunction(compiled.staticRenderFns[i], fnGenErrors);
  46592. }
  46593. // check function generation errors.
  46594. // this should only happen if there is a bug in the compiler itself.
  46595. // mostly for codegen development use
  46596. /* istanbul ignore if */
  46597. {
  46598. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  46599. warn(
  46600. "Failed to generate render function:\n\n" +
  46601. fnGenErrors.map(function (ref) {
  46602. var err = ref.err;
  46603. var code = ref.code;
  46604. return ((err.toString()) + " in\n\n" + code + "\n");
  46605. }).join('\n'),
  46606. vm
  46607. );
  46608. }
  46609. }
  46610. return (functionCompileCache[key] = res)
  46611. }
  46612. return {
  46613. compile: compile,
  46614. compileToFunctions: compileToFunctions
  46615. }
  46616. }
  46617. /* */
  46618. function transformNode (el, options) {
  46619. var warn = options.warn || baseWarn;
  46620. var staticClass = getAndRemoveAttr(el, 'class');
  46621. if ("development" !== 'production' && staticClass) {
  46622. var expression = parseText(staticClass, options.delimiters);
  46623. if (expression) {
  46624. warn(
  46625. "class=\"" + staticClass + "\": " +
  46626. 'Interpolation inside attributes has been removed. ' +
  46627. 'Use v-bind or the colon shorthand instead. For example, ' +
  46628. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  46629. );
  46630. }
  46631. }
  46632. if (staticClass) {
  46633. el.staticClass = JSON.stringify(staticClass);
  46634. }
  46635. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  46636. if (classBinding) {
  46637. el.classBinding = classBinding;
  46638. }
  46639. }
  46640. function genData$1 (el) {
  46641. var data = '';
  46642. if (el.staticClass) {
  46643. data += "staticClass:" + (el.staticClass) + ",";
  46644. }
  46645. if (el.classBinding) {
  46646. data += "class:" + (el.classBinding) + ",";
  46647. }
  46648. return data
  46649. }
  46650. var klass$1 = {
  46651. staticKeys: ['staticClass'],
  46652. transformNode: transformNode,
  46653. genData: genData$1
  46654. };
  46655. /* */
  46656. function transformNode$1 (el, options) {
  46657. var warn = options.warn || baseWarn;
  46658. var staticStyle = getAndRemoveAttr(el, 'style');
  46659. if (staticStyle) {
  46660. /* istanbul ignore if */
  46661. {
  46662. var expression = parseText(staticStyle, options.delimiters);
  46663. if (expression) {
  46664. warn(
  46665. "style=\"" + staticStyle + "\": " +
  46666. 'Interpolation inside attributes has been removed. ' +
  46667. 'Use v-bind or the colon shorthand instead. For example, ' +
  46668. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  46669. );
  46670. }
  46671. }
  46672. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  46673. }
  46674. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  46675. if (styleBinding) {
  46676. el.styleBinding = styleBinding;
  46677. }
  46678. }
  46679. function genData$2 (el) {
  46680. var data = '';
  46681. if (el.staticStyle) {
  46682. data += "staticStyle:" + (el.staticStyle) + ",";
  46683. }
  46684. if (el.styleBinding) {
  46685. data += "style:(" + (el.styleBinding) + "),";
  46686. }
  46687. return data
  46688. }
  46689. var style$1 = {
  46690. staticKeys: ['staticStyle'],
  46691. transformNode: transformNode$1,
  46692. genData: genData$2
  46693. };
  46694. var modules$1 = [
  46695. klass$1,
  46696. style$1
  46697. ];
  46698. /* */
  46699. function text (el, dir) {
  46700. if (dir.value) {
  46701. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  46702. }
  46703. }
  46704. /* */
  46705. function html (el, dir) {
  46706. if (dir.value) {
  46707. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  46708. }
  46709. }
  46710. var directives$1 = {
  46711. model: model,
  46712. text: text,
  46713. html: html
  46714. };
  46715. /* */
  46716. var baseOptions = {
  46717. expectHTML: true,
  46718. modules: modules$1,
  46719. directives: directives$1,
  46720. isPreTag: isPreTag,
  46721. isUnaryTag: isUnaryTag,
  46722. mustUseProp: mustUseProp,
  46723. canBeLeftOpenTag: canBeLeftOpenTag,
  46724. isReservedTag: isReservedTag,
  46725. getTagNamespace: getTagNamespace,
  46726. staticKeys: genStaticKeys(modules$1)
  46727. };
  46728. var ref$1 = createCompiler(baseOptions);
  46729. var compileToFunctions = ref$1.compileToFunctions;
  46730. /* */
  46731. var idToTemplate = cached(function (id) {
  46732. var el = query(id);
  46733. return el && el.innerHTML
  46734. });
  46735. var mount = Vue$3.prototype.$mount;
  46736. Vue$3.prototype.$mount = function (
  46737. el,
  46738. hydrating
  46739. ) {
  46740. el = el && query(el);
  46741. /* istanbul ignore if */
  46742. if (el === document.body || el === document.documentElement) {
  46743. "development" !== 'production' && warn(
  46744. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  46745. );
  46746. return this
  46747. }
  46748. var options = this.$options;
  46749. // resolve template/el and convert to render function
  46750. if (!options.render) {
  46751. var template = options.template;
  46752. if (template) {
  46753. if (typeof template === 'string') {
  46754. if (template.charAt(0) === '#') {
  46755. template = idToTemplate(template);
  46756. /* istanbul ignore if */
  46757. if ("development" !== 'production' && !template) {
  46758. warn(
  46759. ("Template element not found or is empty: " + (options.template)),
  46760. this
  46761. );
  46762. }
  46763. }
  46764. } else if (template.nodeType) {
  46765. template = template.innerHTML;
  46766. } else {
  46767. {
  46768. warn('invalid template option:' + template, this);
  46769. }
  46770. return this
  46771. }
  46772. } else if (el) {
  46773. template = getOuterHTML(el);
  46774. }
  46775. if (template) {
  46776. /* istanbul ignore if */
  46777. if ("development" !== 'production' && config.performance && mark) {
  46778. mark('compile');
  46779. }
  46780. var ref = compileToFunctions(template, {
  46781. shouldDecodeNewlines: shouldDecodeNewlines,
  46782. delimiters: options.delimiters
  46783. }, this);
  46784. var render = ref.render;
  46785. var staticRenderFns = ref.staticRenderFns;
  46786. options.render = render;
  46787. options.staticRenderFns = staticRenderFns;
  46788. /* istanbul ignore if */
  46789. if ("development" !== 'production' && config.performance && mark) {
  46790. mark('compile end');
  46791. measure(((this._name) + " compile"), 'compile', 'compile end');
  46792. }
  46793. }
  46794. }
  46795. return mount.call(this, el, hydrating)
  46796. };
  46797. /**
  46798. * Get outerHTML of elements, taking care
  46799. * of SVG elements in IE as well.
  46800. */
  46801. function getOuterHTML (el) {
  46802. if (el.outerHTML) {
  46803. return el.outerHTML
  46804. } else {
  46805. var container = document.createElement('div');
  46806. container.appendChild(el.cloneNode(true));
  46807. return container.innerHTML
  46808. }
  46809. }
  46810. Vue$3.compile = compileToFunctions;
  46811. return Vue$3;
  46812. })));
  46813. });
  46814. return ___scope___.entry = "dist/vue.runtime.common.js";
  46815. });
  46816. FuseBox.import("fusebox-hot-reload").connect(4444, "")
  46817. FuseBox.import("default/index.js");
  46818. FuseBox.main("default/index.js");
  46819. })
  46820. (function(e){function r(e){var r=e.charCodeAt(0),n=e.charCodeAt(1);if((d||58!==n)&&(r>=97&&r<=122||64===r)){if(64===r){var t=e.split("/"),i=t.splice(2,t.length).join("/");return[t[0]+"/"+t[1],i||void 0]}var o=e.indexOf("/");if(o===-1)return[e];var a=e.substring(0,o),f=e.substring(o+1);return[a,f]}}function n(e){return e.substring(0,e.lastIndexOf("/"))||"./"}function t(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var n=[],t=0,i=arguments.length;t<i;t++)n=n.concat(arguments[t].split("/"));for(var o=[],t=0,i=n.length;t<i;t++){var a=n[t];a&&"."!==a&&(".."===a?o.pop():o.push(a))}return""===n[0]&&o.unshift(""),o.join("/")||(o.length?"/":".")}function i(e){var r=e.match(/\.(\w{1,})$/);return r&&r[1]?e:e+".js"}function o(e){if(d){var r,n=document,t=n.getElementsByTagName("head")[0];/\.css$/.test(e)?(r=n.createElement("link"),r.rel="stylesheet",r.type="text/css",r.href=e):(r=n.createElement("script"),r.type="text/javascript",r.src=e,r.async=!0),t.insertBefore(r,t.firstChild)}}function a(e,r){for(var n in e)e.hasOwnProperty(n)&&r(n,e[n])}function f(e){return{server:require(e)}}function u(e,n){var o=n.path||"./",a=n.pkg||"default",u=r(e);if(u&&(o="./",a=u[0],n.v&&n.v[a]&&(a=a+"@"+n.v[a]),e=u[1]),e)if(126===e.charCodeAt(0))e=e.slice(2,e.length),o="./";else if(!d&&(47===e.charCodeAt(0)||58===e.charCodeAt(1)))return f(e);var s=h[a];if(!s){if(d)throw"Package not found "+a;return f(a+(e?"/"+e:""))}e=e?e:"./"+s.s.entry;var l,c=t(o,e),v=i(c),p=s.f[v];return!p&&v.indexOf("*")>-1&&(l=v),p||l||(v=t(c,"/","index.js"),p=s.f[v],p||(v=c+".js",p=s.f[v]),p||(p=s.f[c+".jsx"]),p||(v=c+"/index.jsx",p=s.f[v])),{file:p,wildcard:l,pkgName:a,versions:s.v,filePath:c,validPath:v}}function s(e,r){if(!d)return r(/\.(js|json)$/.test(e)?v.require(e):"");var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4==n.readyState)if(200==n.status){var i=n.getResponseHeader("Content-Type"),o=n.responseText;/json/.test(i)?o="module.exports = "+o:/javascript/.test(i)||(o="module.exports = "+JSON.stringify(o));var a=t("./",e);g.dynamic(a,o),r(g.import(e,{}))}else console.error(e,"not found on request"),r(void 0)},n.open("GET",e,!0),n.send()}function l(e,r){var n=m[e];if(n)for(var t in n){var i=n[t].apply(null,r);if(i===!1)return!1}}function c(e,r){if(void 0===r&&(r={}),58===e.charCodeAt(4)||58===e.charCodeAt(5))return o(e);var t=u(e,r);if(t.server)return t.server;var i=t.file;if(t.wildcard){var a=new RegExp(t.wildcard.replace(/\*/g,"@").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&").replace(/@/g,"[a-z0-9$_-]+"),"i"),f=h[t.pkgName];if(f){var p={};for(var m in f.f)a.test(m)&&(p[m]=c(t.pkgName+"/"+m));return p}}if(!i){var g="function"==typeof r,x=l("async",[e,r]);if(x===!1)return;return s(e,function(e){return g?r(e):null})}var _=t.pkgName;if(i.locals&&i.locals.module)return i.locals.module.exports;var w=i.locals={},y=n(t.validPath);w.exports={},w.module={exports:w.exports},w.require=function(e,r){return c(e,{pkg:_,path:y,v:t.versions})},w.require.main={filename:d?"./":v.require.main.filename,paths:d?[]:v.require.main.paths};var b=[w.module.exports,w.require,w.module,t.validPath,y,_];return l("before-import",b),i.fn.apply(0,b),l("after-import",b),w.module.exports}if(e.FuseBox)return e.FuseBox;var d="undefined"!=typeof window&&window.navigator,v=d?window:global;d&&(v.global=window),e=d&&"undefined"==typeof __fbx__dnm__?e:module.exports;var p=d?window.__fsbx__=window.__fsbx__||{}:v.$fsbx=v.$fsbx||{};d||(v.require=require);var h=p.p=p.p||{},m=p.e=p.e||{},g=function(){function r(){}return r.global=function(e,r){return void 0===r?v[e]:void(v[e]=r)},r.import=function(e,r){return c(e,r)},r.on=function(e,r){m[e]=m[e]||[],m[e].push(r)},r.exists=function(e){try{var r=u(e,{});return void 0!==r.file}catch(e){return!1}},r.remove=function(e){var r=u(e,{}),n=h[r.pkgName];n&&n.f[r.validPath]&&delete n.f[r.validPath]},r.main=function(e){return this.mainFile=e,r.import(e,{})},r.expose=function(r){var n=function(n){var t=r[n].alias,i=c(r[n].pkg);"*"===t?a(i,function(r,n){return e[r]=n}):"object"==typeof t?a(t,function(r,n){return e[n]=i[r]}):e[t]=i};for(var t in r)n(t)},r.dynamic=function(r,n,t){this.pkg(t&&t.pkg||"default",{},function(t){t.file(r,function(r,t,i,o,a){var f=new Function("__fbx__dnm__","exports","require","module","__filename","__dirname","__root__",n);f(!0,r,t,i,o,a,e)})})},r.flush=function(e){var r=h.default;for(var n in r.f)e&&!e(n)||delete r.f[n].locals},r.pkg=function(e,r,n){if(h[e])return n(h[e].s);var t=h[e]={};return t.f={},t.v=r,t.s={file:function(e,r){return t.f[e]={fn:r}}},n(t.s)},r.addPlugin=function(e){this.plugins.push(e)},r}();return g.packages=h,g.isBrowser=void 0!==d,g.isServer=!d,g.plugins=[],e.FuseBox=g}(this))