app.js 1.4 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, {
  40. /******/ configurable: false,
  41. /******/ enumerable: true,
  42. /******/ get: getter
  43. /******/ });
  44. /******/ }
  45. /******/ };
  46. /******/
  47. /******/ // getDefaultExport function for compatibility with non-harmony modules
  48. /******/ __webpack_require__.n = function(module) {
  49. /******/ var getter = module && module.__esModule ?
  50. /******/ function getDefault() { return module['default']; } :
  51. /******/ function getModuleExports() { return module; };
  52. /******/ __webpack_require__.d(getter, 'a', getter);
  53. /******/ return getter;
  54. /******/ };
  55. /******/
  56. /******/ // Object.prototype.hasOwnProperty.call
  57. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/
  59. /******/ // __webpack_public_path__
  60. /******/ __webpack_require__.p = "";
  61. /******/
  62. /******/ // Load entry module and return exports
  63. /******/ return __webpack_require__(__webpack_require__.s = 13);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69. "use strict";
  70. var bind = __webpack_require__(7);
  71. var isBuffer = __webpack_require__(21);
  72. /*global toString:true*/
  73. // utils is a library of generic helper functions non-specific to axios
  74. var toString = Object.prototype.toString;
  75. /**
  76. * Determine if a value is an Array
  77. *
  78. * @param {Object} val The value to test
  79. * @returns {boolean} True if value is an Array, otherwise false
  80. */
  81. function isArray(val) {
  82. return toString.call(val) === '[object Array]';
  83. }
  84. /**
  85. * Determine if a value is an ArrayBuffer
  86. *
  87. * @param {Object} val The value to test
  88. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  89. */
  90. function isArrayBuffer(val) {
  91. return toString.call(val) === '[object ArrayBuffer]';
  92. }
  93. /**
  94. * Determine if a value is a FormData
  95. *
  96. * @param {Object} val The value to test
  97. * @returns {boolean} True if value is an FormData, otherwise false
  98. */
  99. function isFormData(val) {
  100. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  101. }
  102. /**
  103. * Determine if a value is a view on an ArrayBuffer
  104. *
  105. * @param {Object} val The value to test
  106. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  107. */
  108. function isArrayBufferView(val) {
  109. var result;
  110. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  111. result = ArrayBuffer.isView(val);
  112. } else {
  113. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  114. }
  115. return result;
  116. }
  117. /**
  118. * Determine if a value is a String
  119. *
  120. * @param {Object} val The value to test
  121. * @returns {boolean} True if value is a String, otherwise false
  122. */
  123. function isString(val) {
  124. return typeof val === 'string';
  125. }
  126. /**
  127. * Determine if a value is a Number
  128. *
  129. * @param {Object} val The value to test
  130. * @returns {boolean} True if value is a Number, otherwise false
  131. */
  132. function isNumber(val) {
  133. return typeof val === 'number';
  134. }
  135. /**
  136. * Determine if a value is undefined
  137. *
  138. * @param {Object} val The value to test
  139. * @returns {boolean} True if the value is undefined, otherwise false
  140. */
  141. function isUndefined(val) {
  142. return typeof val === 'undefined';
  143. }
  144. /**
  145. * Determine if a value is an Object
  146. *
  147. * @param {Object} val The value to test
  148. * @returns {boolean} True if value is an Object, otherwise false
  149. */
  150. function isObject(val) {
  151. return val !== null && typeof val === 'object';
  152. }
  153. /**
  154. * Determine if a value is a Date
  155. *
  156. * @param {Object} val The value to test
  157. * @returns {boolean} True if value is a Date, otherwise false
  158. */
  159. function isDate(val) {
  160. return toString.call(val) === '[object Date]';
  161. }
  162. /**
  163. * Determine if a value is a File
  164. *
  165. * @param {Object} val The value to test
  166. * @returns {boolean} True if value is a File, otherwise false
  167. */
  168. function isFile(val) {
  169. return toString.call(val) === '[object File]';
  170. }
  171. /**
  172. * Determine if a value is a Blob
  173. *
  174. * @param {Object} val The value to test
  175. * @returns {boolean} True if value is a Blob, otherwise false
  176. */
  177. function isBlob(val) {
  178. return toString.call(val) === '[object Blob]';
  179. }
  180. /**
  181. * Determine if a value is a Function
  182. *
  183. * @param {Object} val The value to test
  184. * @returns {boolean} True if value is a Function, otherwise false
  185. */
  186. function isFunction(val) {
  187. return toString.call(val) === '[object Function]';
  188. }
  189. /**
  190. * Determine if a value is a Stream
  191. *
  192. * @param {Object} val The value to test
  193. * @returns {boolean} True if value is a Stream, otherwise false
  194. */
  195. function isStream(val) {
  196. return isObject(val) && isFunction(val.pipe);
  197. }
  198. /**
  199. * Determine if a value is a URLSearchParams object
  200. *
  201. * @param {Object} val The value to test
  202. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  203. */
  204. function isURLSearchParams(val) {
  205. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  206. }
  207. /**
  208. * Trim excess whitespace off the beginning and end of a string
  209. *
  210. * @param {String} str The String to trim
  211. * @returns {String} The String freed of excess whitespace
  212. */
  213. function trim(str) {
  214. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  215. }
  216. /**
  217. * Determine if we're running in a standard browser environment
  218. *
  219. * This allows axios to run in a web worker, and react-native.
  220. * Both environments support XMLHttpRequest, but not fully standard globals.
  221. *
  222. * web workers:
  223. * typeof window -> undefined
  224. * typeof document -> undefined
  225. *
  226. * react-native:
  227. * navigator.product -> 'ReactNative'
  228. */
  229. function isStandardBrowserEnv() {
  230. if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
  231. return false;
  232. }
  233. return (
  234. typeof window !== 'undefined' &&
  235. typeof document !== 'undefined'
  236. );
  237. }
  238. /**
  239. * Iterate over an Array or an Object invoking a function for each item.
  240. *
  241. * If `obj` is an Array callback will be called passing
  242. * the value, index, and complete array for each item.
  243. *
  244. * If 'obj' is an Object callback will be called passing
  245. * the value, key, and complete object for each property.
  246. *
  247. * @param {Object|Array} obj The object to iterate
  248. * @param {Function} fn The callback to invoke for each item
  249. */
  250. function forEach(obj, fn) {
  251. // Don't bother if no value provided
  252. if (obj === null || typeof obj === 'undefined') {
  253. return;
  254. }
  255. // Force an array if not already something iterable
  256. if (typeof obj !== 'object') {
  257. /*eslint no-param-reassign:0*/
  258. obj = [obj];
  259. }
  260. if (isArray(obj)) {
  261. // Iterate over array values
  262. for (var i = 0, l = obj.length; i < l; i++) {
  263. fn.call(null, obj[i], i, obj);
  264. }
  265. } else {
  266. // Iterate over object keys
  267. for (var key in obj) {
  268. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  269. fn.call(null, obj[key], key, obj);
  270. }
  271. }
  272. }
  273. }
  274. /**
  275. * Accepts varargs expecting each argument to be an object, then
  276. * immutably merges the properties of each object and returns result.
  277. *
  278. * When multiple objects contain the same key the later object in
  279. * the arguments list will take precedence.
  280. *
  281. * Example:
  282. *
  283. * ```js
  284. * var result = merge({foo: 123}, {foo: 456});
  285. * console.log(result.foo); // outputs 456
  286. * ```
  287. *
  288. * @param {Object} obj1 Object to merge
  289. * @returns {Object} Result of all merge properties
  290. */
  291. function merge(/* obj1, obj2, obj3, ... */) {
  292. var result = {};
  293. function assignValue(val, key) {
  294. if (typeof result[key] === 'object' && typeof val === 'object') {
  295. result[key] = merge(result[key], val);
  296. } else {
  297. result[key] = val;
  298. }
  299. }
  300. for (var i = 0, l = arguments.length; i < l; i++) {
  301. forEach(arguments[i], assignValue);
  302. }
  303. return result;
  304. }
  305. /**
  306. * Extends object a by mutably adding to it the properties of object b.
  307. *
  308. * @param {Object} a The object to be extended
  309. * @param {Object} b The object to copy properties from
  310. * @param {Object} thisArg The object to bind function to
  311. * @return {Object} The resulting value of object a
  312. */
  313. function extend(a, b, thisArg) {
  314. forEach(b, function assignValue(val, key) {
  315. if (thisArg && typeof val === 'function') {
  316. a[key] = bind(val, thisArg);
  317. } else {
  318. a[key] = val;
  319. }
  320. });
  321. return a;
  322. }
  323. module.exports = {
  324. isArray: isArray,
  325. isArrayBuffer: isArrayBuffer,
  326. isBuffer: isBuffer,
  327. isFormData: isFormData,
  328. isArrayBufferView: isArrayBufferView,
  329. isString: isString,
  330. isNumber: isNumber,
  331. isObject: isObject,
  332. isUndefined: isUndefined,
  333. isDate: isDate,
  334. isFile: isFile,
  335. isBlob: isBlob,
  336. isFunction: isFunction,
  337. isStream: isStream,
  338. isURLSearchParams: isURLSearchParams,
  339. isStandardBrowserEnv: isStandardBrowserEnv,
  340. forEach: forEach,
  341. merge: merge,
  342. extend: extend,
  343. trim: trim
  344. };
  345. /***/ }),
  346. /* 1 */
  347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  348. "use strict";
  349. /* unused harmony export Store */
  350. /* unused harmony export install */
  351. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return mapState; });
  352. /* unused harmony export mapMutations */
  353. /* unused harmony export mapGetters */
  354. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapActions; });
  355. /* unused harmony export createNamespacedHelpers */
  356. /**
  357. * vuex v3.1.0
  358. * (c) 2019 Evan You
  359. * @license MIT
  360. */
  361. function applyMixin (Vue) {
  362. var version = Number(Vue.version.split('.')[0]);
  363. if (version >= 2) {
  364. Vue.mixin({ beforeCreate: vuexInit });
  365. } else {
  366. // override init and inject vuex init procedure
  367. // for 1.x backwards compatibility.
  368. var _init = Vue.prototype._init;
  369. Vue.prototype._init = function (options) {
  370. if ( options === void 0 ) options = {};
  371. options.init = options.init
  372. ? [vuexInit].concat(options.init)
  373. : vuexInit;
  374. _init.call(this, options);
  375. };
  376. }
  377. /**
  378. * Vuex init hook, injected into each instances init hooks list.
  379. */
  380. function vuexInit () {
  381. var options = this.$options;
  382. // store injection
  383. if (options.store) {
  384. this.$store = typeof options.store === 'function'
  385. ? options.store()
  386. : options.store;
  387. } else if (options.parent && options.parent.$store) {
  388. this.$store = options.parent.$store;
  389. }
  390. }
  391. }
  392. var devtoolHook =
  393. typeof window !== 'undefined' &&
  394. window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  395. function devtoolPlugin (store) {
  396. if (!devtoolHook) { return }
  397. store._devtoolHook = devtoolHook;
  398. devtoolHook.emit('vuex:init', store);
  399. devtoolHook.on('vuex:travel-to-state', function (targetState) {
  400. store.replaceState(targetState);
  401. });
  402. store.subscribe(function (mutation, state) {
  403. devtoolHook.emit('vuex:mutation', mutation, state);
  404. });
  405. }
  406. /**
  407. * Get the first item that pass the test
  408. * by second argument function
  409. *
  410. * @param {Array} list
  411. * @param {Function} f
  412. * @return {*}
  413. */
  414. /**
  415. * forEach for object
  416. */
  417. function forEachValue (obj, fn) {
  418. Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
  419. }
  420. function isObject (obj) {
  421. return obj !== null && typeof obj === 'object'
  422. }
  423. function isPromise (val) {
  424. return val && typeof val.then === 'function'
  425. }
  426. function assert (condition, msg) {
  427. if (!condition) { throw new Error(("[vuex] " + msg)) }
  428. }
  429. // Base data struct for store's module, package with some attribute and method
  430. var Module = function Module (rawModule, runtime) {
  431. this.runtime = runtime;
  432. // Store some children item
  433. this._children = Object.create(null);
  434. // Store the origin module object which passed by programmer
  435. this._rawModule = rawModule;
  436. var rawState = rawModule.state;
  437. // Store the origin module's state
  438. this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
  439. };
  440. var prototypeAccessors = { namespaced: { configurable: true } };
  441. prototypeAccessors.namespaced.get = function () {
  442. return !!this._rawModule.namespaced
  443. };
  444. Module.prototype.addChild = function addChild (key, module) {
  445. this._children[key] = module;
  446. };
  447. Module.prototype.removeChild = function removeChild (key) {
  448. delete this._children[key];
  449. };
  450. Module.prototype.getChild = function getChild (key) {
  451. return this._children[key]
  452. };
  453. Module.prototype.update = function update (rawModule) {
  454. this._rawModule.namespaced = rawModule.namespaced;
  455. if (rawModule.actions) {
  456. this._rawModule.actions = rawModule.actions;
  457. }
  458. if (rawModule.mutations) {
  459. this._rawModule.mutations = rawModule.mutations;
  460. }
  461. if (rawModule.getters) {
  462. this._rawModule.getters = rawModule.getters;
  463. }
  464. };
  465. Module.prototype.forEachChild = function forEachChild (fn) {
  466. forEachValue(this._children, fn);
  467. };
  468. Module.prototype.forEachGetter = function forEachGetter (fn) {
  469. if (this._rawModule.getters) {
  470. forEachValue(this._rawModule.getters, fn);
  471. }
  472. };
  473. Module.prototype.forEachAction = function forEachAction (fn) {
  474. if (this._rawModule.actions) {
  475. forEachValue(this._rawModule.actions, fn);
  476. }
  477. };
  478. Module.prototype.forEachMutation = function forEachMutation (fn) {
  479. if (this._rawModule.mutations) {
  480. forEachValue(this._rawModule.mutations, fn);
  481. }
  482. };
  483. Object.defineProperties( Module.prototype, prototypeAccessors );
  484. var ModuleCollection = function ModuleCollection (rawRootModule) {
  485. // register root module (Vuex.Store options)
  486. this.register([], rawRootModule, false);
  487. };
  488. ModuleCollection.prototype.get = function get (path) {
  489. return path.reduce(function (module, key) {
  490. return module.getChild(key)
  491. }, this.root)
  492. };
  493. ModuleCollection.prototype.getNamespace = function getNamespace (path) {
  494. var module = this.root;
  495. return path.reduce(function (namespace, key) {
  496. module = module.getChild(key);
  497. return namespace + (module.namespaced ? key + '/' : '')
  498. }, '')
  499. };
  500. ModuleCollection.prototype.update = function update$1 (rawRootModule) {
  501. update([], this.root, rawRootModule);
  502. };
  503. ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
  504. var this$1 = this;
  505. if ( runtime === void 0 ) runtime = true;
  506. if (true) {
  507. assertRawModule(path, rawModule);
  508. }
  509. var newModule = new Module(rawModule, runtime);
  510. if (path.length === 0) {
  511. this.root = newModule;
  512. } else {
  513. var parent = this.get(path.slice(0, -1));
  514. parent.addChild(path[path.length - 1], newModule);
  515. }
  516. // register nested modules
  517. if (rawModule.modules) {
  518. forEachValue(rawModule.modules, function (rawChildModule, key) {
  519. this$1.register(path.concat(key), rawChildModule, runtime);
  520. });
  521. }
  522. };
  523. ModuleCollection.prototype.unregister = function unregister (path) {
  524. var parent = this.get(path.slice(0, -1));
  525. var key = path[path.length - 1];
  526. if (!parent.getChild(key).runtime) { return }
  527. parent.removeChild(key);
  528. };
  529. function update (path, targetModule, newModule) {
  530. if (true) {
  531. assertRawModule(path, newModule);
  532. }
  533. // update target module
  534. targetModule.update(newModule);
  535. // update nested modules
  536. if (newModule.modules) {
  537. for (var key in newModule.modules) {
  538. if (!targetModule.getChild(key)) {
  539. if (true) {
  540. console.warn(
  541. "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
  542. 'manual reload is needed'
  543. );
  544. }
  545. return
  546. }
  547. update(
  548. path.concat(key),
  549. targetModule.getChild(key),
  550. newModule.modules[key]
  551. );
  552. }
  553. }
  554. }
  555. var functionAssert = {
  556. assert: function (value) { return typeof value === 'function'; },
  557. expected: 'function'
  558. };
  559. var objectAssert = {
  560. assert: function (value) { return typeof value === 'function' ||
  561. (typeof value === 'object' && typeof value.handler === 'function'); },
  562. expected: 'function or object with "handler" function'
  563. };
  564. var assertTypes = {
  565. getters: functionAssert,
  566. mutations: functionAssert,
  567. actions: objectAssert
  568. };
  569. function assertRawModule (path, rawModule) {
  570. Object.keys(assertTypes).forEach(function (key) {
  571. if (!rawModule[key]) { return }
  572. var assertOptions = assertTypes[key];
  573. forEachValue(rawModule[key], function (value, type) {
  574. assert(
  575. assertOptions.assert(value),
  576. makeAssertionMessage(path, key, type, value, assertOptions.expected)
  577. );
  578. });
  579. });
  580. }
  581. function makeAssertionMessage (path, key, type, value, expected) {
  582. var buf = key + " should be " + expected + " but \"" + key + "." + type + "\"";
  583. if (path.length > 0) {
  584. buf += " in module \"" + (path.join('.')) + "\"";
  585. }
  586. buf += " is " + (JSON.stringify(value)) + ".";
  587. return buf
  588. }
  589. var Vue; // bind on install
  590. var Store = function Store (options) {
  591. var this$1 = this;
  592. if ( options === void 0 ) options = {};
  593. // Auto install if it is not done yet and `window` has `Vue`.
  594. // To allow users to avoid auto-installation in some cases,
  595. // this code should be placed here. See #731
  596. if (!Vue && typeof window !== 'undefined' && window.Vue) {
  597. install(window.Vue);
  598. }
  599. if (true) {
  600. assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
  601. assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
  602. assert(this instanceof Store, "store must be called with the new operator.");
  603. }
  604. var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
  605. var strict = options.strict; if ( strict === void 0 ) strict = false;
  606. // store internal state
  607. this._committing = false;
  608. this._actions = Object.create(null);
  609. this._actionSubscribers = [];
  610. this._mutations = Object.create(null);
  611. this._wrappedGetters = Object.create(null);
  612. this._modules = new ModuleCollection(options);
  613. this._modulesNamespaceMap = Object.create(null);
  614. this._subscribers = [];
  615. this._watcherVM = new Vue();
  616. // bind commit and dispatch to self
  617. var store = this;
  618. var ref = this;
  619. var dispatch = ref.dispatch;
  620. var commit = ref.commit;
  621. this.dispatch = function boundDispatch (type, payload) {
  622. return dispatch.call(store, type, payload)
  623. };
  624. this.commit = function boundCommit (type, payload, options) {
  625. return commit.call(store, type, payload, options)
  626. };
  627. // strict mode
  628. this.strict = strict;
  629. var state = this._modules.root.state;
  630. // init root module.
  631. // this also recursively registers all sub-modules
  632. // and collects all module getters inside this._wrappedGetters
  633. installModule(this, state, [], this._modules.root);
  634. // initialize the store vm, which is responsible for the reactivity
  635. // (also registers _wrappedGetters as computed properties)
  636. resetStoreVM(this, state);
  637. // apply plugins
  638. plugins.forEach(function (plugin) { return plugin(this$1); });
  639. var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
  640. if (useDevtools) {
  641. devtoolPlugin(this);
  642. }
  643. };
  644. var prototypeAccessors$1 = { state: { configurable: true } };
  645. prototypeAccessors$1.state.get = function () {
  646. return this._vm._data.$$state
  647. };
  648. prototypeAccessors$1.state.set = function (v) {
  649. if (true) {
  650. assert(false, "use store.replaceState() to explicit replace store state.");
  651. }
  652. };
  653. Store.prototype.commit = function commit (_type, _payload, _options) {
  654. var this$1 = this;
  655. // check object-style commit
  656. var ref = unifyObjectStyle(_type, _payload, _options);
  657. var type = ref.type;
  658. var payload = ref.payload;
  659. var options = ref.options;
  660. var mutation = { type: type, payload: payload };
  661. var entry = this._mutations[type];
  662. if (!entry) {
  663. if (true) {
  664. console.error(("[vuex] unknown mutation type: " + type));
  665. }
  666. return
  667. }
  668. this._withCommit(function () {
  669. entry.forEach(function commitIterator (handler) {
  670. handler(payload);
  671. });
  672. });
  673. this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); });
  674. if (
  675. "development" !== 'production' &&
  676. options && options.silent
  677. ) {
  678. console.warn(
  679. "[vuex] mutation type: " + type + ". Silent option has been removed. " +
  680. 'Use the filter functionality in the vue-devtools'
  681. );
  682. }
  683. };
  684. Store.prototype.dispatch = function dispatch (_type, _payload) {
  685. var this$1 = this;
  686. // check object-style dispatch
  687. var ref = unifyObjectStyle(_type, _payload);
  688. var type = ref.type;
  689. var payload = ref.payload;
  690. var action = { type: type, payload: payload };
  691. var entry = this._actions[type];
  692. if (!entry) {
  693. if (true) {
  694. console.error(("[vuex] unknown action type: " + type));
  695. }
  696. return
  697. }
  698. try {
  699. this._actionSubscribers
  700. .filter(function (sub) { return sub.before; })
  701. .forEach(function (sub) { return sub.before(action, this$1.state); });
  702. } catch (e) {
  703. if (true) {
  704. console.warn("[vuex] error in before action subscribers: ");
  705. console.error(e);
  706. }
  707. }
  708. var result = entry.length > 1
  709. ? Promise.all(entry.map(function (handler) { return handler(payload); }))
  710. : entry[0](payload);
  711. return result.then(function (res) {
  712. try {
  713. this$1._actionSubscribers
  714. .filter(function (sub) { return sub.after; })
  715. .forEach(function (sub) { return sub.after(action, this$1.state); });
  716. } catch (e) {
  717. if (true) {
  718. console.warn("[vuex] error in after action subscribers: ");
  719. console.error(e);
  720. }
  721. }
  722. return res
  723. })
  724. };
  725. Store.prototype.subscribe = function subscribe (fn) {
  726. return genericSubscribe(fn, this._subscribers)
  727. };
  728. Store.prototype.subscribeAction = function subscribeAction (fn) {
  729. var subs = typeof fn === 'function' ? { before: fn } : fn;
  730. return genericSubscribe(subs, this._actionSubscribers)
  731. };
  732. Store.prototype.watch = function watch (getter, cb, options) {
  733. var this$1 = this;
  734. if (true) {
  735. assert(typeof getter === 'function', "store.watch only accepts a function.");
  736. }
  737. return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
  738. };
  739. Store.prototype.replaceState = function replaceState (state) {
  740. var this$1 = this;
  741. this._withCommit(function () {
  742. this$1._vm._data.$$state = state;
  743. });
  744. };
  745. Store.prototype.registerModule = function registerModule (path, rawModule, options) {
  746. if ( options === void 0 ) options = {};
  747. if (typeof path === 'string') { path = [path]; }
  748. if (true) {
  749. assert(Array.isArray(path), "module path must be a string or an Array.");
  750. assert(path.length > 0, 'cannot register the root module by using registerModule.');
  751. }
  752. this._modules.register(path, rawModule);
  753. installModule(this, this.state, path, this._modules.get(path), options.preserveState);
  754. // reset store to update getters...
  755. resetStoreVM(this, this.state);
  756. };
  757. Store.prototype.unregisterModule = function unregisterModule (path) {
  758. var this$1 = this;
  759. if (typeof path === 'string') { path = [path]; }
  760. if (true) {
  761. assert(Array.isArray(path), "module path must be a string or an Array.");
  762. }
  763. this._modules.unregister(path);
  764. this._withCommit(function () {
  765. var parentState = getNestedState(this$1.state, path.slice(0, -1));
  766. Vue.delete(parentState, path[path.length - 1]);
  767. });
  768. resetStore(this);
  769. };
  770. Store.prototype.hotUpdate = function hotUpdate (newOptions) {
  771. this._modules.update(newOptions);
  772. resetStore(this, true);
  773. };
  774. Store.prototype._withCommit = function _withCommit (fn) {
  775. var committing = this._committing;
  776. this._committing = true;
  777. fn();
  778. this._committing = committing;
  779. };
  780. Object.defineProperties( Store.prototype, prototypeAccessors$1 );
  781. function genericSubscribe (fn, subs) {
  782. if (subs.indexOf(fn) < 0) {
  783. subs.push(fn);
  784. }
  785. return function () {
  786. var i = subs.indexOf(fn);
  787. if (i > -1) {
  788. subs.splice(i, 1);
  789. }
  790. }
  791. }
  792. function resetStore (store, hot) {
  793. store._actions = Object.create(null);
  794. store._mutations = Object.create(null);
  795. store._wrappedGetters = Object.create(null);
  796. store._modulesNamespaceMap = Object.create(null);
  797. var state = store.state;
  798. // init all modules
  799. installModule(store, state, [], store._modules.root, true);
  800. // reset vm
  801. resetStoreVM(store, state, hot);
  802. }
  803. function resetStoreVM (store, state, hot) {
  804. var oldVm = store._vm;
  805. // bind store public getters
  806. store.getters = {};
  807. var wrappedGetters = store._wrappedGetters;
  808. var computed = {};
  809. forEachValue(wrappedGetters, function (fn, key) {
  810. // use computed to leverage its lazy-caching mechanism
  811. computed[key] = function () { return fn(store); };
  812. Object.defineProperty(store.getters, key, {
  813. get: function () { return store._vm[key]; },
  814. enumerable: true // for local getters
  815. });
  816. });
  817. // use a Vue instance to store the state tree
  818. // suppress warnings just in case the user has added
  819. // some funky global mixins
  820. var silent = Vue.config.silent;
  821. Vue.config.silent = true;
  822. store._vm = new Vue({
  823. data: {
  824. $$state: state
  825. },
  826. computed: computed
  827. });
  828. Vue.config.silent = silent;
  829. // enable strict mode for new vm
  830. if (store.strict) {
  831. enableStrictMode(store);
  832. }
  833. if (oldVm) {
  834. if (hot) {
  835. // dispatch changes in all subscribed watchers
  836. // to force getter re-evaluation for hot reloading.
  837. store._withCommit(function () {
  838. oldVm._data.$$state = null;
  839. });
  840. }
  841. Vue.nextTick(function () { return oldVm.$destroy(); });
  842. }
  843. }
  844. function installModule (store, rootState, path, module, hot) {
  845. var isRoot = !path.length;
  846. var namespace = store._modules.getNamespace(path);
  847. // register in namespace map
  848. if (module.namespaced) {
  849. store._modulesNamespaceMap[namespace] = module;
  850. }
  851. // set state
  852. if (!isRoot && !hot) {
  853. var parentState = getNestedState(rootState, path.slice(0, -1));
  854. var moduleName = path[path.length - 1];
  855. store._withCommit(function () {
  856. Vue.set(parentState, moduleName, module.state);
  857. });
  858. }
  859. var local = module.context = makeLocalContext(store, namespace, path);
  860. module.forEachMutation(function (mutation, key) {
  861. var namespacedType = namespace + key;
  862. registerMutation(store, namespacedType, mutation, local);
  863. });
  864. module.forEachAction(function (action, key) {
  865. var type = action.root ? key : namespace + key;
  866. var handler = action.handler || action;
  867. registerAction(store, type, handler, local);
  868. });
  869. module.forEachGetter(function (getter, key) {
  870. var namespacedType = namespace + key;
  871. registerGetter(store, namespacedType, getter, local);
  872. });
  873. module.forEachChild(function (child, key) {
  874. installModule(store, rootState, path.concat(key), child, hot);
  875. });
  876. }
  877. /**
  878. * make localized dispatch, commit, getters and state
  879. * if there is no namespace, just use root ones
  880. */
  881. function makeLocalContext (store, namespace, path) {
  882. var noNamespace = namespace === '';
  883. var local = {
  884. dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
  885. var args = unifyObjectStyle(_type, _payload, _options);
  886. var payload = args.payload;
  887. var options = args.options;
  888. var type = args.type;
  889. if (!options || !options.root) {
  890. type = namespace + type;
  891. if ("development" !== 'production' && !store._actions[type]) {
  892. console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
  893. return
  894. }
  895. }
  896. return store.dispatch(type, payload)
  897. },
  898. commit: noNamespace ? store.commit : function (_type, _payload, _options) {
  899. var args = unifyObjectStyle(_type, _payload, _options);
  900. var payload = args.payload;
  901. var options = args.options;
  902. var type = args.type;
  903. if (!options || !options.root) {
  904. type = namespace + type;
  905. if ("development" !== 'production' && !store._mutations[type]) {
  906. console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
  907. return
  908. }
  909. }
  910. store.commit(type, payload, options);
  911. }
  912. };
  913. // getters and state object must be gotten lazily
  914. // because they will be changed by vm update
  915. Object.defineProperties(local, {
  916. getters: {
  917. get: noNamespace
  918. ? function () { return store.getters; }
  919. : function () { return makeLocalGetters(store, namespace); }
  920. },
  921. state: {
  922. get: function () { return getNestedState(store.state, path); }
  923. }
  924. });
  925. return local
  926. }
  927. function makeLocalGetters (store, namespace) {
  928. var gettersProxy = {};
  929. var splitPos = namespace.length;
  930. Object.keys(store.getters).forEach(function (type) {
  931. // skip if the target getter is not match this namespace
  932. if (type.slice(0, splitPos) !== namespace) { return }
  933. // extract local getter type
  934. var localType = type.slice(splitPos);
  935. // Add a port to the getters proxy.
  936. // Define as getter property because
  937. // we do not want to evaluate the getters in this time.
  938. Object.defineProperty(gettersProxy, localType, {
  939. get: function () { return store.getters[type]; },
  940. enumerable: true
  941. });
  942. });
  943. return gettersProxy
  944. }
  945. function registerMutation (store, type, handler, local) {
  946. var entry = store._mutations[type] || (store._mutations[type] = []);
  947. entry.push(function wrappedMutationHandler (payload) {
  948. handler.call(store, local.state, payload);
  949. });
  950. }
  951. function registerAction (store, type, handler, local) {
  952. var entry = store._actions[type] || (store._actions[type] = []);
  953. entry.push(function wrappedActionHandler (payload, cb) {
  954. var res = handler.call(store, {
  955. dispatch: local.dispatch,
  956. commit: local.commit,
  957. getters: local.getters,
  958. state: local.state,
  959. rootGetters: store.getters,
  960. rootState: store.state
  961. }, payload, cb);
  962. if (!isPromise(res)) {
  963. res = Promise.resolve(res);
  964. }
  965. if (store._devtoolHook) {
  966. return res.catch(function (err) {
  967. store._devtoolHook.emit('vuex:error', err);
  968. throw err
  969. })
  970. } else {
  971. return res
  972. }
  973. });
  974. }
  975. function registerGetter (store, type, rawGetter, local) {
  976. if (store._wrappedGetters[type]) {
  977. if (true) {
  978. console.error(("[vuex] duplicate getter key: " + type));
  979. }
  980. return
  981. }
  982. store._wrappedGetters[type] = function wrappedGetter (store) {
  983. return rawGetter(
  984. local.state, // local state
  985. local.getters, // local getters
  986. store.state, // root state
  987. store.getters // root getters
  988. )
  989. };
  990. }
  991. function enableStrictMode (store) {
  992. store._vm.$watch(function () { return this._data.$$state }, function () {
  993. if (true) {
  994. assert(store._committing, "do not mutate vuex store state outside mutation handlers.");
  995. }
  996. }, { deep: true, sync: true });
  997. }
  998. function getNestedState (state, path) {
  999. return path.length
  1000. ? path.reduce(function (state, key) { return state[key]; }, state)
  1001. : state
  1002. }
  1003. function unifyObjectStyle (type, payload, options) {
  1004. if (isObject(type) && type.type) {
  1005. options = payload;
  1006. payload = type;
  1007. type = type.type;
  1008. }
  1009. if (true) {
  1010. assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + "."));
  1011. }
  1012. return { type: type, payload: payload, options: options }
  1013. }
  1014. function install (_Vue) {
  1015. if (Vue && _Vue === Vue) {
  1016. if (true) {
  1017. console.error(
  1018. '[vuex] already installed. Vue.use(Vuex) should be called only once.'
  1019. );
  1020. }
  1021. return
  1022. }
  1023. Vue = _Vue;
  1024. applyMixin(Vue);
  1025. }
  1026. /**
  1027. * Reduce the code which written in Vue.js for getting the state.
  1028. * @param {String} [namespace] - Module's namespace
  1029. * @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it.
  1030. * @param {Object}
  1031. */
  1032. var mapState = normalizeNamespace(function (namespace, states) {
  1033. var res = {};
  1034. normalizeMap(states).forEach(function (ref) {
  1035. var key = ref.key;
  1036. var val = ref.val;
  1037. res[key] = function mappedState () {
  1038. var state = this.$store.state;
  1039. var getters = this.$store.getters;
  1040. if (namespace) {
  1041. var module = getModuleByNamespace(this.$store, 'mapState', namespace);
  1042. if (!module) {
  1043. return
  1044. }
  1045. state = module.context.state;
  1046. getters = module.context.getters;
  1047. }
  1048. return typeof val === 'function'
  1049. ? val.call(this, state, getters)
  1050. : state[val]
  1051. };
  1052. // mark vuex getter for devtools
  1053. res[key].vuex = true;
  1054. });
  1055. return res
  1056. });
  1057. /**
  1058. * Reduce the code which written in Vue.js for committing the mutation
  1059. * @param {String} [namespace] - Module's namespace
  1060. * @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept anthor params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function.
  1061. * @return {Object}
  1062. */
  1063. var mapMutations = normalizeNamespace(function (namespace, mutations) {
  1064. var res = {};
  1065. normalizeMap(mutations).forEach(function (ref) {
  1066. var key = ref.key;
  1067. var val = ref.val;
  1068. res[key] = function mappedMutation () {
  1069. var args = [], len = arguments.length;
  1070. while ( len-- ) args[ len ] = arguments[ len ];
  1071. // Get the commit method from store
  1072. var commit = this.$store.commit;
  1073. if (namespace) {
  1074. var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);
  1075. if (!module) {
  1076. return
  1077. }
  1078. commit = module.context.commit;
  1079. }
  1080. return typeof val === 'function'
  1081. ? val.apply(this, [commit].concat(args))
  1082. : commit.apply(this.$store, [val].concat(args))
  1083. };
  1084. });
  1085. return res
  1086. });
  1087. /**
  1088. * Reduce the code which written in Vue.js for getting the getters
  1089. * @param {String} [namespace] - Module's namespace
  1090. * @param {Object|Array} getters
  1091. * @return {Object}
  1092. */
  1093. var mapGetters = normalizeNamespace(function (namespace, getters) {
  1094. var res = {};
  1095. normalizeMap(getters).forEach(function (ref) {
  1096. var key = ref.key;
  1097. var val = ref.val;
  1098. // The namespace has been mutated by normalizeNamespace
  1099. val = namespace + val;
  1100. res[key] = function mappedGetter () {
  1101. if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
  1102. return
  1103. }
  1104. if ("development" !== 'production' && !(val in this.$store.getters)) {
  1105. console.error(("[vuex] unknown getter: " + val));
  1106. return
  1107. }
  1108. return this.$store.getters[val]
  1109. };
  1110. // mark vuex getter for devtools
  1111. res[key].vuex = true;
  1112. });
  1113. return res
  1114. });
  1115. /**
  1116. * Reduce the code which written in Vue.js for dispatch the action
  1117. * @param {String} [namespace] - Module's namespace
  1118. * @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function.
  1119. * @return {Object}
  1120. */
  1121. var mapActions = normalizeNamespace(function (namespace, actions) {
  1122. var res = {};
  1123. normalizeMap(actions).forEach(function (ref) {
  1124. var key = ref.key;
  1125. var val = ref.val;
  1126. res[key] = function mappedAction () {
  1127. var args = [], len = arguments.length;
  1128. while ( len-- ) args[ len ] = arguments[ len ];
  1129. // get dispatch function from store
  1130. var dispatch = this.$store.dispatch;
  1131. if (namespace) {
  1132. var module = getModuleByNamespace(this.$store, 'mapActions', namespace);
  1133. if (!module) {
  1134. return
  1135. }
  1136. dispatch = module.context.dispatch;
  1137. }
  1138. return typeof val === 'function'
  1139. ? val.apply(this, [dispatch].concat(args))
  1140. : dispatch.apply(this.$store, [val].concat(args))
  1141. };
  1142. });
  1143. return res
  1144. });
  1145. /**
  1146. * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object
  1147. * @param {String} namespace
  1148. * @return {Object}
  1149. */
  1150. var createNamespacedHelpers = function (namespace) { return ({
  1151. mapState: mapState.bind(null, namespace),
  1152. mapGetters: mapGetters.bind(null, namespace),
  1153. mapMutations: mapMutations.bind(null, namespace),
  1154. mapActions: mapActions.bind(null, namespace)
  1155. }); };
  1156. /**
  1157. * Normalize the map
  1158. * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
  1159. * normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
  1160. * @param {Array|Object} map
  1161. * @return {Object}
  1162. */
  1163. function normalizeMap (map) {
  1164. return Array.isArray(map)
  1165. ? map.map(function (key) { return ({ key: key, val: key }); })
  1166. : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
  1167. }
  1168. /**
  1169. * Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map.
  1170. * @param {Function} fn
  1171. * @return {Function}
  1172. */
  1173. function normalizeNamespace (fn) {
  1174. return function (namespace, map) {
  1175. if (typeof namespace !== 'string') {
  1176. map = namespace;
  1177. namespace = '';
  1178. } else if (namespace.charAt(namespace.length - 1) !== '/') {
  1179. namespace += '/';
  1180. }
  1181. return fn(namespace, map)
  1182. }
  1183. }
  1184. /**
  1185. * Search a special module from store by namespace. if module not exist, print error message.
  1186. * @param {Object} store
  1187. * @param {String} helper
  1188. * @param {String} namespace
  1189. * @return {Object}
  1190. */
  1191. function getModuleByNamespace (store, helper, namespace) {
  1192. var module = store._modulesNamespaceMap[namespace];
  1193. if ("development" !== 'production' && !module) {
  1194. console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace));
  1195. }
  1196. return module
  1197. }
  1198. var index_esm = {
  1199. Store: Store,
  1200. install: install,
  1201. version: '3.1.0',
  1202. mapState: mapState,
  1203. mapMutations: mapMutations,
  1204. mapGetters: mapGetters,
  1205. mapActions: mapActions,
  1206. createNamespacedHelpers: createNamespacedHelpers
  1207. };
  1208. /* harmony default export */ __webpack_exports__["a"] = (index_esm);
  1209. /***/ }),
  1210. /* 2 */
  1211. /***/ (function(module, exports) {
  1212. var g;
  1213. // This works in non-strict mode
  1214. g = (function() {
  1215. return this;
  1216. })();
  1217. try {
  1218. // This works if eval is allowed (see CSP)
  1219. g = g || Function("return this")() || (1,eval)("this");
  1220. } catch(e) {
  1221. // This works if the window reference is available
  1222. if(typeof window === "object")
  1223. g = window;
  1224. }
  1225. // g can still be undefined, but nothing to do about it...
  1226. // We return undefined, instead of nothing here, so it's
  1227. // easier to handle this case. if(!global) { ...}
  1228. module.exports = g;
  1229. /***/ }),
  1230. /* 3 */
  1231. /***/ (function(module, exports) {
  1232. /* globals __VUE_SSR_CONTEXT__ */
  1233. // IMPORTANT: Do NOT use ES2015 features in this file.
  1234. // This module is a runtime utility for cleaner component module output and will
  1235. // be included in the final webpack user bundle.
  1236. module.exports = function normalizeComponent (
  1237. rawScriptExports,
  1238. compiledTemplate,
  1239. functionalTemplate,
  1240. injectStyles,
  1241. scopeId,
  1242. moduleIdentifier /* server only */
  1243. ) {
  1244. var esModule
  1245. var scriptExports = rawScriptExports = rawScriptExports || {}
  1246. // ES6 modules interop
  1247. var type = typeof rawScriptExports.default
  1248. if (type === 'object' || type === 'function') {
  1249. esModule = rawScriptExports
  1250. scriptExports = rawScriptExports.default
  1251. }
  1252. // Vue.extend constructor export interop
  1253. var options = typeof scriptExports === 'function'
  1254. ? scriptExports.options
  1255. : scriptExports
  1256. // render functions
  1257. if (compiledTemplate) {
  1258. options.render = compiledTemplate.render
  1259. options.staticRenderFns = compiledTemplate.staticRenderFns
  1260. options._compiled = true
  1261. }
  1262. // functional template
  1263. if (functionalTemplate) {
  1264. options.functional = true
  1265. }
  1266. // scopedId
  1267. if (scopeId) {
  1268. options._scopeId = scopeId
  1269. }
  1270. var hook
  1271. if (moduleIdentifier) { // server build
  1272. hook = function (context) {
  1273. // 2.3 injection
  1274. context =
  1275. context || // cached call
  1276. (this.$vnode && this.$vnode.ssrContext) || // stateful
  1277. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  1278. // 2.2 with runInNewContext: true
  1279. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  1280. context = __VUE_SSR_CONTEXT__
  1281. }
  1282. // inject component styles
  1283. if (injectStyles) {
  1284. injectStyles.call(this, context)
  1285. }
  1286. // register component module identifier for async chunk inferrence
  1287. if (context && context._registeredComponents) {
  1288. context._registeredComponents.add(moduleIdentifier)
  1289. }
  1290. }
  1291. // used by ssr in case component is cached and beforeCreate
  1292. // never gets called
  1293. options._ssrRegister = hook
  1294. } else if (injectStyles) {
  1295. hook = injectStyles
  1296. }
  1297. if (hook) {
  1298. var functional = options.functional
  1299. var existing = functional
  1300. ? options.render
  1301. : options.beforeCreate
  1302. if (!functional) {
  1303. // inject component registration as beforeCreate hook
  1304. options.beforeCreate = existing
  1305. ? [].concat(existing, hook)
  1306. : [hook]
  1307. } else {
  1308. // for template-only hot-reload because in that case the render fn doesn't
  1309. // go through the normalizer
  1310. options._injectStyles = hook
  1311. // register for functioal component in vue file
  1312. options.render = function renderWithStyleInjection (h, context) {
  1313. hook.call(context)
  1314. return existing(h, context)
  1315. }
  1316. }
  1317. }
  1318. return {
  1319. esModule: esModule,
  1320. exports: scriptExports,
  1321. options: options
  1322. }
  1323. }
  1324. /***/ }),
  1325. /* 4 */
  1326. /***/ (function(module, exports, __webpack_require__) {
  1327. "use strict";
  1328. /* WEBPACK VAR INJECTION */(function(process) {
  1329. var utils = __webpack_require__(0);
  1330. var normalizeHeaderName = __webpack_require__(23);
  1331. var DEFAULT_CONTENT_TYPE = {
  1332. 'Content-Type': 'application/x-www-form-urlencoded'
  1333. };
  1334. function setContentTypeIfUnset(headers, value) {
  1335. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  1336. headers['Content-Type'] = value;
  1337. }
  1338. }
  1339. function getDefaultAdapter() {
  1340. var adapter;
  1341. if (typeof XMLHttpRequest !== 'undefined') {
  1342. // For browsers use XHR adapter
  1343. adapter = __webpack_require__(9);
  1344. } else if (typeof process !== 'undefined') {
  1345. // For node use HTTP adapter
  1346. adapter = __webpack_require__(9);
  1347. }
  1348. return adapter;
  1349. }
  1350. var defaults = {
  1351. adapter: getDefaultAdapter(),
  1352. transformRequest: [function transformRequest(data, headers) {
  1353. normalizeHeaderName(headers, 'Content-Type');
  1354. if (utils.isFormData(data) ||
  1355. utils.isArrayBuffer(data) ||
  1356. utils.isBuffer(data) ||
  1357. utils.isStream(data) ||
  1358. utils.isFile(data) ||
  1359. utils.isBlob(data)
  1360. ) {
  1361. return data;
  1362. }
  1363. if (utils.isArrayBufferView(data)) {
  1364. return data.buffer;
  1365. }
  1366. if (utils.isURLSearchParams(data)) {
  1367. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  1368. return data.toString();
  1369. }
  1370. if (utils.isObject(data)) {
  1371. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  1372. return JSON.stringify(data);
  1373. }
  1374. return data;
  1375. }],
  1376. transformResponse: [function transformResponse(data) {
  1377. /*eslint no-param-reassign:0*/
  1378. if (typeof data === 'string') {
  1379. try {
  1380. data = JSON.parse(data);
  1381. } catch (e) { /* Ignore */ }
  1382. }
  1383. return data;
  1384. }],
  1385. timeout: 0,
  1386. xsrfCookieName: 'XSRF-TOKEN',
  1387. xsrfHeaderName: 'X-XSRF-TOKEN',
  1388. maxContentLength: -1,
  1389. validateStatus: function validateStatus(status) {
  1390. return status >= 200 && status < 300;
  1391. }
  1392. };
  1393. defaults.headers = {
  1394. common: {
  1395. 'Accept': 'application/json, text/plain, */*'
  1396. }
  1397. };
  1398. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  1399. defaults.headers[method] = {};
  1400. });
  1401. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  1402. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  1403. });
  1404. module.exports = defaults;
  1405. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8)))
  1406. /***/ }),
  1407. /* 5 */
  1408. /***/ (function(module, exports, __webpack_require__) {
  1409. "use strict";
  1410. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  1411. * Vue.js v2.5.22
  1412. * (c) 2014-2019 Evan You
  1413. * Released under the MIT License.
  1414. */
  1415. /* */
  1416. var emptyObject = Object.freeze({});
  1417. // These helpers produce better VM code in JS engines due to their
  1418. // explicitness and function inlining.
  1419. function isUndef (v) {
  1420. return v === undefined || v === null
  1421. }
  1422. function isDef (v) {
  1423. return v !== undefined && v !== null
  1424. }
  1425. function isTrue (v) {
  1426. return v === true
  1427. }
  1428. function isFalse (v) {
  1429. return v === false
  1430. }
  1431. /**
  1432. * Check if value is primitive.
  1433. */
  1434. function isPrimitive (value) {
  1435. return (
  1436. typeof value === 'string' ||
  1437. typeof value === 'number' ||
  1438. // $flow-disable-line
  1439. typeof value === 'symbol' ||
  1440. typeof value === 'boolean'
  1441. )
  1442. }
  1443. /**
  1444. * Quick object check - this is primarily used to tell
  1445. * Objects from primitive values when we know the value
  1446. * is a JSON-compliant type.
  1447. */
  1448. function isObject (obj) {
  1449. return obj !== null && typeof obj === 'object'
  1450. }
  1451. /**
  1452. * Get the raw type string of a value, e.g., [object Object].
  1453. */
  1454. var _toString = Object.prototype.toString;
  1455. function toRawType (value) {
  1456. return _toString.call(value).slice(8, -1)
  1457. }
  1458. /**
  1459. * Strict object type check. Only returns true
  1460. * for plain JavaScript objects.
  1461. */
  1462. function isPlainObject (obj) {
  1463. return _toString.call(obj) === '[object Object]'
  1464. }
  1465. function isRegExp (v) {
  1466. return _toString.call(v) === '[object RegExp]'
  1467. }
  1468. /**
  1469. * Check if val is a valid array index.
  1470. */
  1471. function isValidArrayIndex (val) {
  1472. var n = parseFloat(String(val));
  1473. return n >= 0 && Math.floor(n) === n && isFinite(val)
  1474. }
  1475. /**
  1476. * Convert a value to a string that is actually rendered.
  1477. */
  1478. function toString (val) {
  1479. return val == null
  1480. ? ''
  1481. : typeof val === 'object'
  1482. ? JSON.stringify(val, null, 2)
  1483. : String(val)
  1484. }
  1485. /**
  1486. * Convert an input value to a number for persistence.
  1487. * If the conversion fails, return original string.
  1488. */
  1489. function toNumber (val) {
  1490. var n = parseFloat(val);
  1491. return isNaN(n) ? val : n
  1492. }
  1493. /**
  1494. * Make a map and return a function for checking if a key
  1495. * is in that map.
  1496. */
  1497. function makeMap (
  1498. str,
  1499. expectsLowerCase
  1500. ) {
  1501. var map = Object.create(null);
  1502. var list = str.split(',');
  1503. for (var i = 0; i < list.length; i++) {
  1504. map[list[i]] = true;
  1505. }
  1506. return expectsLowerCase
  1507. ? function (val) { return map[val.toLowerCase()]; }
  1508. : function (val) { return map[val]; }
  1509. }
  1510. /**
  1511. * Check if a tag is a built-in tag.
  1512. */
  1513. var isBuiltInTag = makeMap('slot,component', true);
  1514. /**
  1515. * Check if an attribute is a reserved attribute.
  1516. */
  1517. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  1518. /**
  1519. * Remove an item from an array.
  1520. */
  1521. function remove (arr, item) {
  1522. if (arr.length) {
  1523. var index = arr.indexOf(item);
  1524. if (index > -1) {
  1525. return arr.splice(index, 1)
  1526. }
  1527. }
  1528. }
  1529. /**
  1530. * Check whether an object has the property.
  1531. */
  1532. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1533. function hasOwn (obj, key) {
  1534. return hasOwnProperty.call(obj, key)
  1535. }
  1536. /**
  1537. * Create a cached version of a pure function.
  1538. */
  1539. function cached (fn) {
  1540. var cache = Object.create(null);
  1541. return (function cachedFn (str) {
  1542. var hit = cache[str];
  1543. return hit || (cache[str] = fn(str))
  1544. })
  1545. }
  1546. /**
  1547. * Camelize a hyphen-delimited string.
  1548. */
  1549. var camelizeRE = /-(\w)/g;
  1550. var camelize = cached(function (str) {
  1551. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  1552. });
  1553. /**
  1554. * Capitalize a string.
  1555. */
  1556. var capitalize = cached(function (str) {
  1557. return str.charAt(0).toUpperCase() + str.slice(1)
  1558. });
  1559. /**
  1560. * Hyphenate a camelCase string.
  1561. */
  1562. var hyphenateRE = /\B([A-Z])/g;
  1563. var hyphenate = cached(function (str) {
  1564. return str.replace(hyphenateRE, '-$1').toLowerCase()
  1565. });
  1566. /**
  1567. * Simple bind polyfill for environments that do not support it,
  1568. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  1569. * since native bind is now performant enough in most browsers.
  1570. * But removing it would mean breaking code that was able to run in
  1571. * PhantomJS 1.x, so this must be kept for backward compatibility.
  1572. */
  1573. /* istanbul ignore next */
  1574. function polyfillBind (fn, ctx) {
  1575. function boundFn (a) {
  1576. var l = arguments.length;
  1577. return l
  1578. ? l > 1
  1579. ? fn.apply(ctx, arguments)
  1580. : fn.call(ctx, a)
  1581. : fn.call(ctx)
  1582. }
  1583. boundFn._length = fn.length;
  1584. return boundFn
  1585. }
  1586. function nativeBind (fn, ctx) {
  1587. return fn.bind(ctx)
  1588. }
  1589. var bind = Function.prototype.bind
  1590. ? nativeBind
  1591. : polyfillBind;
  1592. /**
  1593. * Convert an Array-like object to a real Array.
  1594. */
  1595. function toArray (list, start) {
  1596. start = start || 0;
  1597. var i = list.length - start;
  1598. var ret = new Array(i);
  1599. while (i--) {
  1600. ret[i] = list[i + start];
  1601. }
  1602. return ret
  1603. }
  1604. /**
  1605. * Mix properties into target object.
  1606. */
  1607. function extend (to, _from) {
  1608. for (var key in _from) {
  1609. to[key] = _from[key];
  1610. }
  1611. return to
  1612. }
  1613. /**
  1614. * Merge an Array of Objects into a single Object.
  1615. */
  1616. function toObject (arr) {
  1617. var res = {};
  1618. for (var i = 0; i < arr.length; i++) {
  1619. if (arr[i]) {
  1620. extend(res, arr[i]);
  1621. }
  1622. }
  1623. return res
  1624. }
  1625. /* eslint-disable no-unused-vars */
  1626. /**
  1627. * Perform no operation.
  1628. * Stubbing args to make Flow happy without leaving useless transpiled code
  1629. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  1630. */
  1631. function noop (a, b, c) {}
  1632. /**
  1633. * Always return false.
  1634. */
  1635. var no = function (a, b, c) { return false; };
  1636. /* eslint-enable no-unused-vars */
  1637. /**
  1638. * Return the same value.
  1639. */
  1640. var identity = function (_) { return _; };
  1641. /**
  1642. * Generate a string containing static keys from compiler modules.
  1643. */
  1644. function genStaticKeys (modules) {
  1645. return modules.reduce(function (keys, m) {
  1646. return keys.concat(m.staticKeys || [])
  1647. }, []).join(',')
  1648. }
  1649. /**
  1650. * Check if two values are loosely equal - that is,
  1651. * if they are plain objects, do they have the same shape?
  1652. */
  1653. function looseEqual (a, b) {
  1654. if (a === b) { return true }
  1655. var isObjectA = isObject(a);
  1656. var isObjectB = isObject(b);
  1657. if (isObjectA && isObjectB) {
  1658. try {
  1659. var isArrayA = Array.isArray(a);
  1660. var isArrayB = Array.isArray(b);
  1661. if (isArrayA && isArrayB) {
  1662. return a.length === b.length && a.every(function (e, i) {
  1663. return looseEqual(e, b[i])
  1664. })
  1665. } else if (a instanceof Date && b instanceof Date) {
  1666. return a.getTime() === b.getTime()
  1667. } else if (!isArrayA && !isArrayB) {
  1668. var keysA = Object.keys(a);
  1669. var keysB = Object.keys(b);
  1670. return keysA.length === keysB.length && keysA.every(function (key) {
  1671. return looseEqual(a[key], b[key])
  1672. })
  1673. } else {
  1674. /* istanbul ignore next */
  1675. return false
  1676. }
  1677. } catch (e) {
  1678. /* istanbul ignore next */
  1679. return false
  1680. }
  1681. } else if (!isObjectA && !isObjectB) {
  1682. return String(a) === String(b)
  1683. } else {
  1684. return false
  1685. }
  1686. }
  1687. /**
  1688. * Return the first index at which a loosely equal value can be
  1689. * found in the array (if value is a plain object, the array must
  1690. * contain an object of the same shape), or -1 if it is not present.
  1691. */
  1692. function looseIndexOf (arr, val) {
  1693. for (var i = 0; i < arr.length; i++) {
  1694. if (looseEqual(arr[i], val)) { return i }
  1695. }
  1696. return -1
  1697. }
  1698. /**
  1699. * Ensure a function is called only once.
  1700. */
  1701. function once (fn) {
  1702. var called = false;
  1703. return function () {
  1704. if (!called) {
  1705. called = true;
  1706. fn.apply(this, arguments);
  1707. }
  1708. }
  1709. }
  1710. var SSR_ATTR = 'data-server-rendered';
  1711. var ASSET_TYPES = [
  1712. 'component',
  1713. 'directive',
  1714. 'filter'
  1715. ];
  1716. var LIFECYCLE_HOOKS = [
  1717. 'beforeCreate',
  1718. 'created',
  1719. 'beforeMount',
  1720. 'mounted',
  1721. 'beforeUpdate',
  1722. 'updated',
  1723. 'beforeDestroy',
  1724. 'destroyed',
  1725. 'activated',
  1726. 'deactivated',
  1727. 'errorCaptured'
  1728. ];
  1729. /* */
  1730. var config = ({
  1731. /**
  1732. * Option merge strategies (used in core/util/options)
  1733. */
  1734. // $flow-disable-line
  1735. optionMergeStrategies: Object.create(null),
  1736. /**
  1737. * Whether to suppress warnings.
  1738. */
  1739. silent: false,
  1740. /**
  1741. * Show production mode tip message on boot?
  1742. */
  1743. productionTip: "development" !== 'production',
  1744. /**
  1745. * Whether to enable devtools
  1746. */
  1747. devtools: "development" !== 'production',
  1748. /**
  1749. * Whether to record perf
  1750. */
  1751. performance: false,
  1752. /**
  1753. * Error handler for watcher errors
  1754. */
  1755. errorHandler: null,
  1756. /**
  1757. * Warn handler for watcher warns
  1758. */
  1759. warnHandler: null,
  1760. /**
  1761. * Ignore certain custom elements
  1762. */
  1763. ignoredElements: [],
  1764. /**
  1765. * Custom user key aliases for v-on
  1766. */
  1767. // $flow-disable-line
  1768. keyCodes: Object.create(null),
  1769. /**
  1770. * Check if a tag is reserved so that it cannot be registered as a
  1771. * component. This is platform-dependent and may be overwritten.
  1772. */
  1773. isReservedTag: no,
  1774. /**
  1775. * Check if an attribute is reserved so that it cannot be used as a component
  1776. * prop. This is platform-dependent and may be overwritten.
  1777. */
  1778. isReservedAttr: no,
  1779. /**
  1780. * Check if a tag is an unknown element.
  1781. * Platform-dependent.
  1782. */
  1783. isUnknownElement: no,
  1784. /**
  1785. * Get the namespace of an element
  1786. */
  1787. getTagNamespace: noop,
  1788. /**
  1789. * Parse the real tag name for the specific platform.
  1790. */
  1791. parsePlatformTagName: identity,
  1792. /**
  1793. * Check if an attribute must be bound using property, e.g. value
  1794. * Platform-dependent.
  1795. */
  1796. mustUseProp: no,
  1797. /**
  1798. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  1799. * This will significantly reduce performance if set to false.
  1800. */
  1801. async: true,
  1802. /**
  1803. * Exposed for legacy reasons
  1804. */
  1805. _lifecycleHooks: LIFECYCLE_HOOKS
  1806. });
  1807. /* */
  1808. /**
  1809. * Check if a string starts with $ or _
  1810. */
  1811. function isReserved (str) {
  1812. var c = (str + '').charCodeAt(0);
  1813. return c === 0x24 || c === 0x5F
  1814. }
  1815. /**
  1816. * Define a property.
  1817. */
  1818. function def (obj, key, val, enumerable) {
  1819. Object.defineProperty(obj, key, {
  1820. value: val,
  1821. enumerable: !!enumerable,
  1822. writable: true,
  1823. configurable: true
  1824. });
  1825. }
  1826. /**
  1827. * Parse simple path.
  1828. */
  1829. var bailRE = /[^\w.$]/;
  1830. function parsePath (path) {
  1831. if (bailRE.test(path)) {
  1832. return
  1833. }
  1834. var segments = path.split('.');
  1835. return function (obj) {
  1836. for (var i = 0; i < segments.length; i++) {
  1837. if (!obj) { return }
  1838. obj = obj[segments[i]];
  1839. }
  1840. return obj
  1841. }
  1842. }
  1843. /* */
  1844. // can we use __proto__?
  1845. var hasProto = '__proto__' in {};
  1846. // Browser environment sniffing
  1847. var inBrowser = typeof window !== 'undefined';
  1848. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  1849. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  1850. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  1851. var isIE = UA && /msie|trident/.test(UA);
  1852. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  1853. var isEdge = UA && UA.indexOf('edge/') > 0;
  1854. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  1855. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  1856. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  1857. // Firefox has a "watch" function on Object.prototype...
  1858. var nativeWatch = ({}).watch;
  1859. var supportsPassive = false;
  1860. if (inBrowser) {
  1861. try {
  1862. var opts = {};
  1863. Object.defineProperty(opts, 'passive', ({
  1864. get: function get () {
  1865. /* istanbul ignore next */
  1866. supportsPassive = true;
  1867. }
  1868. })); // https://github.com/facebook/flow/issues/285
  1869. window.addEventListener('test-passive', null, opts);
  1870. } catch (e) {}
  1871. }
  1872. // this needs to be lazy-evaled because vue may be required before
  1873. // vue-server-renderer can set VUE_ENV
  1874. var _isServer;
  1875. var isServerRendering = function () {
  1876. if (_isServer === undefined) {
  1877. /* istanbul ignore if */
  1878. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  1879. // detect presence of vue-server-renderer and avoid
  1880. // Webpack shimming the process
  1881. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  1882. } else {
  1883. _isServer = false;
  1884. }
  1885. }
  1886. return _isServer
  1887. };
  1888. // detect devtools
  1889. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  1890. /* istanbul ignore next */
  1891. function isNative (Ctor) {
  1892. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  1893. }
  1894. var hasSymbol =
  1895. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  1896. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  1897. var _Set;
  1898. /* istanbul ignore if */ // $flow-disable-line
  1899. if (typeof Set !== 'undefined' && isNative(Set)) {
  1900. // use native Set when available.
  1901. _Set = Set;
  1902. } else {
  1903. // a non-standard Set polyfill that only works with primitive keys.
  1904. _Set = /*@__PURE__*/(function () {
  1905. function Set () {
  1906. this.set = Object.create(null);
  1907. }
  1908. Set.prototype.has = function has (key) {
  1909. return this.set[key] === true
  1910. };
  1911. Set.prototype.add = function add (key) {
  1912. this.set[key] = true;
  1913. };
  1914. Set.prototype.clear = function clear () {
  1915. this.set = Object.create(null);
  1916. };
  1917. return Set;
  1918. }());
  1919. }
  1920. /* */
  1921. var warn = noop;
  1922. var tip = noop;
  1923. var generateComponentTrace = (noop); // work around flow check
  1924. var formatComponentName = (noop);
  1925. if (true) {
  1926. var hasConsole = typeof console !== 'undefined';
  1927. var classifyRE = /(?:^|[-_])(\w)/g;
  1928. var classify = function (str) { return str
  1929. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  1930. .replace(/[-_]/g, ''); };
  1931. warn = function (msg, vm) {
  1932. var trace = vm ? generateComponentTrace(vm) : '';
  1933. if (config.warnHandler) {
  1934. config.warnHandler.call(null, msg, vm, trace);
  1935. } else if (hasConsole && (!config.silent)) {
  1936. console.error(("[Vue warn]: " + msg + trace));
  1937. }
  1938. };
  1939. tip = function (msg, vm) {
  1940. if (hasConsole && (!config.silent)) {
  1941. console.warn("[Vue tip]: " + msg + (
  1942. vm ? generateComponentTrace(vm) : ''
  1943. ));
  1944. }
  1945. };
  1946. formatComponentName = function (vm, includeFile) {
  1947. if (vm.$root === vm) {
  1948. return '<Root>'
  1949. }
  1950. var options = typeof vm === 'function' && vm.cid != null
  1951. ? vm.options
  1952. : vm._isVue
  1953. ? vm.$options || vm.constructor.options
  1954. : vm;
  1955. var name = options.name || options._componentTag;
  1956. var file = options.__file;
  1957. if (!name && file) {
  1958. var match = file.match(/([^/\\]+)\.vue$/);
  1959. name = match && match[1];
  1960. }
  1961. return (
  1962. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  1963. (file && includeFile !== false ? (" at " + file) : '')
  1964. )
  1965. };
  1966. var repeat = function (str, n) {
  1967. var res = '';
  1968. while (n) {
  1969. if (n % 2 === 1) { res += str; }
  1970. if (n > 1) { str += str; }
  1971. n >>= 1;
  1972. }
  1973. return res
  1974. };
  1975. generateComponentTrace = function (vm) {
  1976. if (vm._isVue && vm.$parent) {
  1977. var tree = [];
  1978. var currentRecursiveSequence = 0;
  1979. while (vm) {
  1980. if (tree.length > 0) {
  1981. var last = tree[tree.length - 1];
  1982. if (last.constructor === vm.constructor) {
  1983. currentRecursiveSequence++;
  1984. vm = vm.$parent;
  1985. continue
  1986. } else if (currentRecursiveSequence > 0) {
  1987. tree[tree.length - 1] = [last, currentRecursiveSequence];
  1988. currentRecursiveSequence = 0;
  1989. }
  1990. }
  1991. tree.push(vm);
  1992. vm = vm.$parent;
  1993. }
  1994. return '\n\nfound in\n\n' + tree
  1995. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  1996. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  1997. : formatComponentName(vm))); })
  1998. .join('\n')
  1999. } else {
  2000. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  2001. }
  2002. };
  2003. }
  2004. /* */
  2005. var uid = 0;
  2006. /**
  2007. * A dep is an observable that can have multiple
  2008. * directives subscribing to it.
  2009. */
  2010. var Dep = function Dep () {
  2011. this.id = uid++;
  2012. this.subs = [];
  2013. };
  2014. Dep.prototype.addSub = function addSub (sub) {
  2015. this.subs.push(sub);
  2016. };
  2017. Dep.prototype.removeSub = function removeSub (sub) {
  2018. remove(this.subs, sub);
  2019. };
  2020. Dep.prototype.depend = function depend () {
  2021. if (Dep.target) {
  2022. Dep.target.addDep(this);
  2023. }
  2024. };
  2025. Dep.prototype.notify = function notify () {
  2026. // stabilize the subscriber list first
  2027. var subs = this.subs.slice();
  2028. if ("development" !== 'production' && !config.async) {
  2029. // subs aren't sorted in scheduler if not running async
  2030. // we need to sort them now to make sure they fire in correct
  2031. // order
  2032. subs.sort(function (a, b) { return a.id - b.id; });
  2033. }
  2034. for (var i = 0, l = subs.length; i < l; i++) {
  2035. subs[i].update();
  2036. }
  2037. };
  2038. // The current target watcher being evaluated.
  2039. // This is globally unique because only one watcher
  2040. // can be evaluated at a time.
  2041. Dep.target = null;
  2042. var targetStack = [];
  2043. function pushTarget (target) {
  2044. targetStack.push(target);
  2045. Dep.target = target;
  2046. }
  2047. function popTarget () {
  2048. targetStack.pop();
  2049. Dep.target = targetStack[targetStack.length - 1];
  2050. }
  2051. /* */
  2052. var VNode = function VNode (
  2053. tag,
  2054. data,
  2055. children,
  2056. text,
  2057. elm,
  2058. context,
  2059. componentOptions,
  2060. asyncFactory
  2061. ) {
  2062. this.tag = tag;
  2063. this.data = data;
  2064. this.children = children;
  2065. this.text = text;
  2066. this.elm = elm;
  2067. this.ns = undefined;
  2068. this.context = context;
  2069. this.fnContext = undefined;
  2070. this.fnOptions = undefined;
  2071. this.fnScopeId = undefined;
  2072. this.key = data && data.key;
  2073. this.componentOptions = componentOptions;
  2074. this.componentInstance = undefined;
  2075. this.parent = undefined;
  2076. this.raw = false;
  2077. this.isStatic = false;
  2078. this.isRootInsert = true;
  2079. this.isComment = false;
  2080. this.isCloned = false;
  2081. this.isOnce = false;
  2082. this.asyncFactory = asyncFactory;
  2083. this.asyncMeta = undefined;
  2084. this.isAsyncPlaceholder = false;
  2085. };
  2086. var prototypeAccessors = { child: { configurable: true } };
  2087. // DEPRECATED: alias for componentInstance for backwards compat.
  2088. /* istanbul ignore next */
  2089. prototypeAccessors.child.get = function () {
  2090. return this.componentInstance
  2091. };
  2092. Object.defineProperties( VNode.prototype, prototypeAccessors );
  2093. var createEmptyVNode = function (text) {
  2094. if ( text === void 0 ) text = '';
  2095. var node = new VNode();
  2096. node.text = text;
  2097. node.isComment = true;
  2098. return node
  2099. };
  2100. function createTextVNode (val) {
  2101. return new VNode(undefined, undefined, undefined, String(val))
  2102. }
  2103. // optimized shallow clone
  2104. // used for static nodes and slot nodes because they may be reused across
  2105. // multiple renders, cloning them avoids errors when DOM manipulations rely
  2106. // on their elm reference.
  2107. function cloneVNode (vnode) {
  2108. var cloned = new VNode(
  2109. vnode.tag,
  2110. vnode.data,
  2111. // #7975
  2112. // clone children array to avoid mutating original in case of cloning
  2113. // a child.
  2114. vnode.children && vnode.children.slice(),
  2115. vnode.text,
  2116. vnode.elm,
  2117. vnode.context,
  2118. vnode.componentOptions,
  2119. vnode.asyncFactory
  2120. );
  2121. cloned.ns = vnode.ns;
  2122. cloned.isStatic = vnode.isStatic;
  2123. cloned.key = vnode.key;
  2124. cloned.isComment = vnode.isComment;
  2125. cloned.fnContext = vnode.fnContext;
  2126. cloned.fnOptions = vnode.fnOptions;
  2127. cloned.fnScopeId = vnode.fnScopeId;
  2128. cloned.asyncMeta = vnode.asyncMeta;
  2129. cloned.isCloned = true;
  2130. return cloned
  2131. }
  2132. /*
  2133. * not type checking this file because flow doesn't play well with
  2134. * dynamically accessing methods on Array prototype
  2135. */
  2136. var arrayProto = Array.prototype;
  2137. var arrayMethods = Object.create(arrayProto);
  2138. var methodsToPatch = [
  2139. 'push',
  2140. 'pop',
  2141. 'shift',
  2142. 'unshift',
  2143. 'splice',
  2144. 'sort',
  2145. 'reverse'
  2146. ];
  2147. /**
  2148. * Intercept mutating methods and emit events
  2149. */
  2150. methodsToPatch.forEach(function (method) {
  2151. // cache original method
  2152. var original = arrayProto[method];
  2153. def(arrayMethods, method, function mutator () {
  2154. var args = [], len = arguments.length;
  2155. while ( len-- ) args[ len ] = arguments[ len ];
  2156. var result = original.apply(this, args);
  2157. var ob = this.__ob__;
  2158. var inserted;
  2159. switch (method) {
  2160. case 'push':
  2161. case 'unshift':
  2162. inserted = args;
  2163. break
  2164. case 'splice':
  2165. inserted = args.slice(2);
  2166. break
  2167. }
  2168. if (inserted) { ob.observeArray(inserted); }
  2169. // notify change
  2170. ob.dep.notify();
  2171. return result
  2172. });
  2173. });
  2174. /* */
  2175. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  2176. /**
  2177. * In some cases we may want to disable observation inside a component's
  2178. * update computation.
  2179. */
  2180. var shouldObserve = true;
  2181. function toggleObserving (value) {
  2182. shouldObserve = value;
  2183. }
  2184. /**
  2185. * Observer class that is attached to each observed
  2186. * object. Once attached, the observer converts the target
  2187. * object's property keys into getter/setters that
  2188. * collect dependencies and dispatch updates.
  2189. */
  2190. var Observer = function Observer (value) {
  2191. this.value = value;
  2192. this.dep = new Dep();
  2193. this.vmCount = 0;
  2194. def(value, '__ob__', this);
  2195. if (Array.isArray(value)) {
  2196. if (hasProto) {
  2197. protoAugment(value, arrayMethods);
  2198. } else {
  2199. copyAugment(value, arrayMethods, arrayKeys);
  2200. }
  2201. this.observeArray(value);
  2202. } else {
  2203. this.walk(value);
  2204. }
  2205. };
  2206. /**
  2207. * Walk through all properties and convert them into
  2208. * getter/setters. This method should only be called when
  2209. * value type is Object.
  2210. */
  2211. Observer.prototype.walk = function walk (obj) {
  2212. var keys = Object.keys(obj);
  2213. for (var i = 0; i < keys.length; i++) {
  2214. defineReactive$$1(obj, keys[i]);
  2215. }
  2216. };
  2217. /**
  2218. * Observe a list of Array items.
  2219. */
  2220. Observer.prototype.observeArray = function observeArray (items) {
  2221. for (var i = 0, l = items.length; i < l; i++) {
  2222. observe(items[i]);
  2223. }
  2224. };
  2225. // helpers
  2226. /**
  2227. * Augment a target Object or Array by intercepting
  2228. * the prototype chain using __proto__
  2229. */
  2230. function protoAugment (target, src) {
  2231. /* eslint-disable no-proto */
  2232. target.__proto__ = src;
  2233. /* eslint-enable no-proto */
  2234. }
  2235. /**
  2236. * Augment a target Object or Array by defining
  2237. * hidden properties.
  2238. */
  2239. /* istanbul ignore next */
  2240. function copyAugment (target, src, keys) {
  2241. for (var i = 0, l = keys.length; i < l; i++) {
  2242. var key = keys[i];
  2243. def(target, key, src[key]);
  2244. }
  2245. }
  2246. /**
  2247. * Attempt to create an observer instance for a value,
  2248. * returns the new observer if successfully observed,
  2249. * or the existing observer if the value already has one.
  2250. */
  2251. function observe (value, asRootData) {
  2252. if (!isObject(value) || value instanceof VNode) {
  2253. return
  2254. }
  2255. var ob;
  2256. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  2257. ob = value.__ob__;
  2258. } else if (
  2259. shouldObserve &&
  2260. !isServerRendering() &&
  2261. (Array.isArray(value) || isPlainObject(value)) &&
  2262. Object.isExtensible(value) &&
  2263. !value._isVue
  2264. ) {
  2265. ob = new Observer(value);
  2266. }
  2267. if (asRootData && ob) {
  2268. ob.vmCount++;
  2269. }
  2270. return ob
  2271. }
  2272. /**
  2273. * Define a reactive property on an Object.
  2274. */
  2275. function defineReactive$$1 (
  2276. obj,
  2277. key,
  2278. val,
  2279. customSetter,
  2280. shallow
  2281. ) {
  2282. var dep = new Dep();
  2283. var property = Object.getOwnPropertyDescriptor(obj, key);
  2284. if (property && property.configurable === false) {
  2285. return
  2286. }
  2287. // cater for pre-defined getter/setters
  2288. var getter = property && property.get;
  2289. var setter = property && property.set;
  2290. if ((!getter || setter) && arguments.length === 2) {
  2291. val = obj[key];
  2292. }
  2293. var childOb = !shallow && observe(val);
  2294. Object.defineProperty(obj, key, {
  2295. enumerable: true,
  2296. configurable: true,
  2297. get: function reactiveGetter () {
  2298. var value = getter ? getter.call(obj) : val;
  2299. if (Dep.target) {
  2300. dep.depend();
  2301. if (childOb) {
  2302. childOb.dep.depend();
  2303. if (Array.isArray(value)) {
  2304. dependArray(value);
  2305. }
  2306. }
  2307. }
  2308. return value
  2309. },
  2310. set: function reactiveSetter (newVal) {
  2311. var value = getter ? getter.call(obj) : val;
  2312. /* eslint-disable no-self-compare */
  2313. if (newVal === value || (newVal !== newVal && value !== value)) {
  2314. return
  2315. }
  2316. /* eslint-enable no-self-compare */
  2317. if ("development" !== 'production' && customSetter) {
  2318. customSetter();
  2319. }
  2320. // #7981: for accessor properties without setter
  2321. if (getter && !setter) { return }
  2322. if (setter) {
  2323. setter.call(obj, newVal);
  2324. } else {
  2325. val = newVal;
  2326. }
  2327. childOb = !shallow && observe(newVal);
  2328. dep.notify();
  2329. }
  2330. });
  2331. }
  2332. /**
  2333. * Set a property on an object. Adds the new property and
  2334. * triggers change notification if the property doesn't
  2335. * already exist.
  2336. */
  2337. function set (target, key, val) {
  2338. if ("development" !== 'production' &&
  2339. (isUndef(target) || isPrimitive(target))
  2340. ) {
  2341. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  2342. }
  2343. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2344. target.length = Math.max(target.length, key);
  2345. target.splice(key, 1, val);
  2346. return val
  2347. }
  2348. if (key in target && !(key in Object.prototype)) {
  2349. target[key] = val;
  2350. return val
  2351. }
  2352. var ob = (target).__ob__;
  2353. if (target._isVue || (ob && ob.vmCount)) {
  2354. "development" !== 'production' && warn(
  2355. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  2356. 'at runtime - declare it upfront in the data option.'
  2357. );
  2358. return val
  2359. }
  2360. if (!ob) {
  2361. target[key] = val;
  2362. return val
  2363. }
  2364. defineReactive$$1(ob.value, key, val);
  2365. ob.dep.notify();
  2366. return val
  2367. }
  2368. /**
  2369. * Delete a property and trigger change if necessary.
  2370. */
  2371. function del (target, key) {
  2372. if ("development" !== 'production' &&
  2373. (isUndef(target) || isPrimitive(target))
  2374. ) {
  2375. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  2376. }
  2377. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2378. target.splice(key, 1);
  2379. return
  2380. }
  2381. var ob = (target).__ob__;
  2382. if (target._isVue || (ob && ob.vmCount)) {
  2383. "development" !== 'production' && warn(
  2384. 'Avoid deleting properties on a Vue instance or its root $data ' +
  2385. '- just set it to null.'
  2386. );
  2387. return
  2388. }
  2389. if (!hasOwn(target, key)) {
  2390. return
  2391. }
  2392. delete target[key];
  2393. if (!ob) {
  2394. return
  2395. }
  2396. ob.dep.notify();
  2397. }
  2398. /**
  2399. * Collect dependencies on array elements when the array is touched, since
  2400. * we cannot intercept array element access like property getters.
  2401. */
  2402. function dependArray (value) {
  2403. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  2404. e = value[i];
  2405. e && e.__ob__ && e.__ob__.dep.depend();
  2406. if (Array.isArray(e)) {
  2407. dependArray(e);
  2408. }
  2409. }
  2410. }
  2411. /* */
  2412. /**
  2413. * Option overwriting strategies are functions that handle
  2414. * how to merge a parent option value and a child option
  2415. * value into the final value.
  2416. */
  2417. var strats = config.optionMergeStrategies;
  2418. /**
  2419. * Options with restrictions
  2420. */
  2421. if (true) {
  2422. strats.el = strats.propsData = function (parent, child, vm, key) {
  2423. if (!vm) {
  2424. warn(
  2425. "option \"" + key + "\" can only be used during instance " +
  2426. 'creation with the `new` keyword.'
  2427. );
  2428. }
  2429. return defaultStrat(parent, child)
  2430. };
  2431. }
  2432. /**
  2433. * Helper that recursively merges two data objects together.
  2434. */
  2435. function mergeData (to, from) {
  2436. if (!from) { return to }
  2437. var key, toVal, fromVal;
  2438. var keys = Object.keys(from);
  2439. for (var i = 0; i < keys.length; i++) {
  2440. key = keys[i];
  2441. toVal = to[key];
  2442. fromVal = from[key];
  2443. if (!hasOwn(to, key)) {
  2444. set(to, key, fromVal);
  2445. } else if (
  2446. toVal !== fromVal &&
  2447. isPlainObject(toVal) &&
  2448. isPlainObject(fromVal)
  2449. ) {
  2450. mergeData(toVal, fromVal);
  2451. }
  2452. }
  2453. return to
  2454. }
  2455. /**
  2456. * Data
  2457. */
  2458. function mergeDataOrFn (
  2459. parentVal,
  2460. childVal,
  2461. vm
  2462. ) {
  2463. if (!vm) {
  2464. // in a Vue.extend merge, both should be functions
  2465. if (!childVal) {
  2466. return parentVal
  2467. }
  2468. if (!parentVal) {
  2469. return childVal
  2470. }
  2471. // when parentVal & childVal are both present,
  2472. // we need to return a function that returns the
  2473. // merged result of both functions... no need to
  2474. // check if parentVal is a function here because
  2475. // it has to be a function to pass previous merges.
  2476. return function mergedDataFn () {
  2477. return mergeData(
  2478. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  2479. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  2480. )
  2481. }
  2482. } else {
  2483. return function mergedInstanceDataFn () {
  2484. // instance merge
  2485. var instanceData = typeof childVal === 'function'
  2486. ? childVal.call(vm, vm)
  2487. : childVal;
  2488. var defaultData = typeof parentVal === 'function'
  2489. ? parentVal.call(vm, vm)
  2490. : parentVal;
  2491. if (instanceData) {
  2492. return mergeData(instanceData, defaultData)
  2493. } else {
  2494. return defaultData
  2495. }
  2496. }
  2497. }
  2498. }
  2499. strats.data = function (
  2500. parentVal,
  2501. childVal,
  2502. vm
  2503. ) {
  2504. if (!vm) {
  2505. if (childVal && typeof childVal !== 'function') {
  2506. "development" !== 'production' && warn(
  2507. 'The "data" option should be a function ' +
  2508. 'that returns a per-instance value in component ' +
  2509. 'definitions.',
  2510. vm
  2511. );
  2512. return parentVal
  2513. }
  2514. return mergeDataOrFn(parentVal, childVal)
  2515. }
  2516. return mergeDataOrFn(parentVal, childVal, vm)
  2517. };
  2518. /**
  2519. * Hooks and props are merged as arrays.
  2520. */
  2521. function mergeHook (
  2522. parentVal,
  2523. childVal
  2524. ) {
  2525. var res = childVal
  2526. ? parentVal
  2527. ? parentVal.concat(childVal)
  2528. : Array.isArray(childVal)
  2529. ? childVal
  2530. : [childVal]
  2531. : parentVal;
  2532. return res
  2533. ? dedupeHooks(res)
  2534. : res
  2535. }
  2536. function dedupeHooks (hooks) {
  2537. var res = [];
  2538. for (var i = 0; i < hooks.length; i++) {
  2539. if (res.indexOf(hooks[i]) === -1) {
  2540. res.push(hooks[i]);
  2541. }
  2542. }
  2543. return res
  2544. }
  2545. LIFECYCLE_HOOKS.forEach(function (hook) {
  2546. strats[hook] = mergeHook;
  2547. });
  2548. /**
  2549. * Assets
  2550. *
  2551. * When a vm is present (instance creation), we need to do
  2552. * a three-way merge between constructor options, instance
  2553. * options and parent options.
  2554. */
  2555. function mergeAssets (
  2556. parentVal,
  2557. childVal,
  2558. vm,
  2559. key
  2560. ) {
  2561. var res = Object.create(parentVal || null);
  2562. if (childVal) {
  2563. "development" !== 'production' && assertObjectType(key, childVal, vm);
  2564. return extend(res, childVal)
  2565. } else {
  2566. return res
  2567. }
  2568. }
  2569. ASSET_TYPES.forEach(function (type) {
  2570. strats[type + 's'] = mergeAssets;
  2571. });
  2572. /**
  2573. * Watchers.
  2574. *
  2575. * Watchers hashes should not overwrite one
  2576. * another, so we merge them as arrays.
  2577. */
  2578. strats.watch = function (
  2579. parentVal,
  2580. childVal,
  2581. vm,
  2582. key
  2583. ) {
  2584. // work around Firefox's Object.prototype.watch...
  2585. if (parentVal === nativeWatch) { parentVal = undefined; }
  2586. if (childVal === nativeWatch) { childVal = undefined; }
  2587. /* istanbul ignore if */
  2588. if (!childVal) { return Object.create(parentVal || null) }
  2589. if (true) {
  2590. assertObjectType(key, childVal, vm);
  2591. }
  2592. if (!parentVal) { return childVal }
  2593. var ret = {};
  2594. extend(ret, parentVal);
  2595. for (var key$1 in childVal) {
  2596. var parent = ret[key$1];
  2597. var child = childVal[key$1];
  2598. if (parent && !Array.isArray(parent)) {
  2599. parent = [parent];
  2600. }
  2601. ret[key$1] = parent
  2602. ? parent.concat(child)
  2603. : Array.isArray(child) ? child : [child];
  2604. }
  2605. return ret
  2606. };
  2607. /**
  2608. * Other object hashes.
  2609. */
  2610. strats.props =
  2611. strats.methods =
  2612. strats.inject =
  2613. strats.computed = function (
  2614. parentVal,
  2615. childVal,
  2616. vm,
  2617. key
  2618. ) {
  2619. if (childVal && "development" !== 'production') {
  2620. assertObjectType(key, childVal, vm);
  2621. }
  2622. if (!parentVal) { return childVal }
  2623. var ret = Object.create(null);
  2624. extend(ret, parentVal);
  2625. if (childVal) { extend(ret, childVal); }
  2626. return ret
  2627. };
  2628. strats.provide = mergeDataOrFn;
  2629. /**
  2630. * Default strategy.
  2631. */
  2632. var defaultStrat = function (parentVal, childVal) {
  2633. return childVal === undefined
  2634. ? parentVal
  2635. : childVal
  2636. };
  2637. /**
  2638. * Validate component names
  2639. */
  2640. function checkComponents (options) {
  2641. for (var key in options.components) {
  2642. validateComponentName(key);
  2643. }
  2644. }
  2645. function validateComponentName (name) {
  2646. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  2647. warn(
  2648. 'Invalid component name: "' + name + '". Component names ' +
  2649. 'can only contain alphanumeric characters and the hyphen, ' +
  2650. 'and must start with a letter.'
  2651. );
  2652. }
  2653. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  2654. warn(
  2655. 'Do not use built-in or reserved HTML elements as component ' +
  2656. 'id: ' + name
  2657. );
  2658. }
  2659. }
  2660. /**
  2661. * Ensure all props option syntax are normalized into the
  2662. * Object-based format.
  2663. */
  2664. function normalizeProps (options, vm) {
  2665. var props = options.props;
  2666. if (!props) { return }
  2667. var res = {};
  2668. var i, val, name;
  2669. if (Array.isArray(props)) {
  2670. i = props.length;
  2671. while (i--) {
  2672. val = props[i];
  2673. if (typeof val === 'string') {
  2674. name = camelize(val);
  2675. res[name] = { type: null };
  2676. } else if (true) {
  2677. warn('props must be strings when using array syntax.');
  2678. }
  2679. }
  2680. } else if (isPlainObject(props)) {
  2681. for (var key in props) {
  2682. val = props[key];
  2683. name = camelize(key);
  2684. res[name] = isPlainObject(val)
  2685. ? val
  2686. : { type: val };
  2687. }
  2688. } else if (true) {
  2689. warn(
  2690. "Invalid value for option \"props\": expected an Array or an Object, " +
  2691. "but got " + (toRawType(props)) + ".",
  2692. vm
  2693. );
  2694. }
  2695. options.props = res;
  2696. }
  2697. /**
  2698. * Normalize all injections into Object-based format
  2699. */
  2700. function normalizeInject (options, vm) {
  2701. var inject = options.inject;
  2702. if (!inject) { return }
  2703. var normalized = options.inject = {};
  2704. if (Array.isArray(inject)) {
  2705. for (var i = 0; i < inject.length; i++) {
  2706. normalized[inject[i]] = { from: inject[i] };
  2707. }
  2708. } else if (isPlainObject(inject)) {
  2709. for (var key in inject) {
  2710. var val = inject[key];
  2711. normalized[key] = isPlainObject(val)
  2712. ? extend({ from: key }, val)
  2713. : { from: val };
  2714. }
  2715. } else if (true) {
  2716. warn(
  2717. "Invalid value for option \"inject\": expected an Array or an Object, " +
  2718. "but got " + (toRawType(inject)) + ".",
  2719. vm
  2720. );
  2721. }
  2722. }
  2723. /**
  2724. * Normalize raw function directives into object format.
  2725. */
  2726. function normalizeDirectives (options) {
  2727. var dirs = options.directives;
  2728. if (dirs) {
  2729. for (var key in dirs) {
  2730. var def = dirs[key];
  2731. if (typeof def === 'function') {
  2732. dirs[key] = { bind: def, update: def };
  2733. }
  2734. }
  2735. }
  2736. }
  2737. function assertObjectType (name, value, vm) {
  2738. if (!isPlainObject(value)) {
  2739. warn(
  2740. "Invalid value for option \"" + name + "\": expected an Object, " +
  2741. "but got " + (toRawType(value)) + ".",
  2742. vm
  2743. );
  2744. }
  2745. }
  2746. /**
  2747. * Merge two option objects into a new one.
  2748. * Core utility used in both instantiation and inheritance.
  2749. */
  2750. function mergeOptions (
  2751. parent,
  2752. child,
  2753. vm
  2754. ) {
  2755. if (true) {
  2756. checkComponents(child);
  2757. }
  2758. if (typeof child === 'function') {
  2759. child = child.options;
  2760. }
  2761. normalizeProps(child, vm);
  2762. normalizeInject(child, vm);
  2763. normalizeDirectives(child);
  2764. // Apply extends and mixins on the child options,
  2765. // but only if it is a raw options object that isn't
  2766. // the result of another mergeOptions call.
  2767. // Only merged options has the _base property.
  2768. if (!child._base) {
  2769. if (child.extends) {
  2770. parent = mergeOptions(parent, child.extends, vm);
  2771. }
  2772. if (child.mixins) {
  2773. for (var i = 0, l = child.mixins.length; i < l; i++) {
  2774. parent = mergeOptions(parent, child.mixins[i], vm);
  2775. }
  2776. }
  2777. }
  2778. var options = {};
  2779. var key;
  2780. for (key in parent) {
  2781. mergeField(key);
  2782. }
  2783. for (key in child) {
  2784. if (!hasOwn(parent, key)) {
  2785. mergeField(key);
  2786. }
  2787. }
  2788. function mergeField (key) {
  2789. var strat = strats[key] || defaultStrat;
  2790. options[key] = strat(parent[key], child[key], vm, key);
  2791. }
  2792. return options
  2793. }
  2794. /**
  2795. * Resolve an asset.
  2796. * This function is used because child instances need access
  2797. * to assets defined in its ancestor chain.
  2798. */
  2799. function resolveAsset (
  2800. options,
  2801. type,
  2802. id,
  2803. warnMissing
  2804. ) {
  2805. /* istanbul ignore if */
  2806. if (typeof id !== 'string') {
  2807. return
  2808. }
  2809. var assets = options[type];
  2810. // check local registration variations first
  2811. if (hasOwn(assets, id)) { return assets[id] }
  2812. var camelizedId = camelize(id);
  2813. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  2814. var PascalCaseId = capitalize(camelizedId);
  2815. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  2816. // fallback to prototype chain
  2817. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  2818. if ("development" !== 'production' && warnMissing && !res) {
  2819. warn(
  2820. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  2821. options
  2822. );
  2823. }
  2824. return res
  2825. }
  2826. /* */
  2827. function validateProp (
  2828. key,
  2829. propOptions,
  2830. propsData,
  2831. vm
  2832. ) {
  2833. var prop = propOptions[key];
  2834. var absent = !hasOwn(propsData, key);
  2835. var value = propsData[key];
  2836. // boolean casting
  2837. var booleanIndex = getTypeIndex(Boolean, prop.type);
  2838. if (booleanIndex > -1) {
  2839. if (absent && !hasOwn(prop, 'default')) {
  2840. value = false;
  2841. } else if (value === '' || value === hyphenate(key)) {
  2842. // only cast empty string / same name to boolean if
  2843. // boolean has higher priority
  2844. var stringIndex = getTypeIndex(String, prop.type);
  2845. if (stringIndex < 0 || booleanIndex < stringIndex) {
  2846. value = true;
  2847. }
  2848. }
  2849. }
  2850. // check default value
  2851. if (value === undefined) {
  2852. value = getPropDefaultValue(vm, prop, key);
  2853. // since the default value is a fresh copy,
  2854. // make sure to observe it.
  2855. var prevShouldObserve = shouldObserve;
  2856. toggleObserving(true);
  2857. observe(value);
  2858. toggleObserving(prevShouldObserve);
  2859. }
  2860. if (
  2861. true
  2862. ) {
  2863. assertProp(prop, key, value, vm, absent);
  2864. }
  2865. return value
  2866. }
  2867. /**
  2868. * Get the default value of a prop.
  2869. */
  2870. function getPropDefaultValue (vm, prop, key) {
  2871. // no default, return undefined
  2872. if (!hasOwn(prop, 'default')) {
  2873. return undefined
  2874. }
  2875. var def = prop.default;
  2876. // warn against non-factory defaults for Object & Array
  2877. if ("development" !== 'production' && isObject(def)) {
  2878. warn(
  2879. 'Invalid default value for prop "' + key + '": ' +
  2880. 'Props with type Object/Array must use a factory function ' +
  2881. 'to return the default value.',
  2882. vm
  2883. );
  2884. }
  2885. // the raw prop value was also undefined from previous render,
  2886. // return previous default value to avoid unnecessary watcher trigger
  2887. if (vm && vm.$options.propsData &&
  2888. vm.$options.propsData[key] === undefined &&
  2889. vm._props[key] !== undefined
  2890. ) {
  2891. return vm._props[key]
  2892. }
  2893. // call factory function for non-Function types
  2894. // a value is Function if its prototype is function even across different execution context
  2895. return typeof def === 'function' && getType(prop.type) !== 'Function'
  2896. ? def.call(vm)
  2897. : def
  2898. }
  2899. /**
  2900. * Assert whether a prop is valid.
  2901. */
  2902. function assertProp (
  2903. prop,
  2904. name,
  2905. value,
  2906. vm,
  2907. absent
  2908. ) {
  2909. if (prop.required && absent) {
  2910. warn(
  2911. 'Missing required prop: "' + name + '"',
  2912. vm
  2913. );
  2914. return
  2915. }
  2916. if (value == null && !prop.required) {
  2917. return
  2918. }
  2919. var type = prop.type;
  2920. var valid = !type || type === true;
  2921. var expectedTypes = [];
  2922. if (type) {
  2923. if (!Array.isArray(type)) {
  2924. type = [type];
  2925. }
  2926. for (var i = 0; i < type.length && !valid; i++) {
  2927. var assertedType = assertType(value, type[i]);
  2928. expectedTypes.push(assertedType.expectedType || '');
  2929. valid = assertedType.valid;
  2930. }
  2931. }
  2932. if (!valid) {
  2933. warn(
  2934. getInvalidTypeMessage(name, value, expectedTypes),
  2935. vm
  2936. );
  2937. return
  2938. }
  2939. var validator = prop.validator;
  2940. if (validator) {
  2941. if (!validator(value)) {
  2942. warn(
  2943. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  2944. vm
  2945. );
  2946. }
  2947. }
  2948. }
  2949. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  2950. function assertType (value, type) {
  2951. var valid;
  2952. var expectedType = getType(type);
  2953. if (simpleCheckRE.test(expectedType)) {
  2954. var t = typeof value;
  2955. valid = t === expectedType.toLowerCase();
  2956. // for primitive wrapper objects
  2957. if (!valid && t === 'object') {
  2958. valid = value instanceof type;
  2959. }
  2960. } else if (expectedType === 'Object') {
  2961. valid = isPlainObject(value);
  2962. } else if (expectedType === 'Array') {
  2963. valid = Array.isArray(value);
  2964. } else {
  2965. valid = value instanceof type;
  2966. }
  2967. return {
  2968. valid: valid,
  2969. expectedType: expectedType
  2970. }
  2971. }
  2972. /**
  2973. * Use function string name to check built-in types,
  2974. * because a simple equality check will fail when running
  2975. * across different vms / iframes.
  2976. */
  2977. function getType (fn) {
  2978. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  2979. return match ? match[1] : ''
  2980. }
  2981. function isSameType (a, b) {
  2982. return getType(a) === getType(b)
  2983. }
  2984. function getTypeIndex (type, expectedTypes) {
  2985. if (!Array.isArray(expectedTypes)) {
  2986. return isSameType(expectedTypes, type) ? 0 : -1
  2987. }
  2988. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  2989. if (isSameType(expectedTypes[i], type)) {
  2990. return i
  2991. }
  2992. }
  2993. return -1
  2994. }
  2995. function getInvalidTypeMessage (name, value, expectedTypes) {
  2996. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  2997. " Expected " + (expectedTypes.map(capitalize).join(', '));
  2998. var expectedType = expectedTypes[0];
  2999. var receivedType = toRawType(value);
  3000. var expectedValue = styleValue(value, expectedType);
  3001. var receivedValue = styleValue(value, receivedType);
  3002. // check if we need to specify expected value
  3003. if (expectedTypes.length === 1 &&
  3004. isExplicable(expectedType) &&
  3005. !isBoolean(expectedType, receivedType)) {
  3006. message += " with value " + expectedValue;
  3007. }
  3008. message += ", got " + receivedType + " ";
  3009. // check if we need to specify received value
  3010. if (isExplicable(receivedType)) {
  3011. message += "with value " + receivedValue + ".";
  3012. }
  3013. return message
  3014. }
  3015. function styleValue (value, type) {
  3016. if (type === 'String') {
  3017. return ("\"" + value + "\"")
  3018. } else if (type === 'Number') {
  3019. return ("" + (Number(value)))
  3020. } else {
  3021. return ("" + value)
  3022. }
  3023. }
  3024. function isExplicable (value) {
  3025. var explicitTypes = ['string', 'number', 'boolean'];
  3026. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  3027. }
  3028. function isBoolean () {
  3029. var args = [], len = arguments.length;
  3030. while ( len-- ) args[ len ] = arguments[ len ];
  3031. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  3032. }
  3033. /* */
  3034. function handleError (err, vm, info) {
  3035. if (vm) {
  3036. var cur = vm;
  3037. while ((cur = cur.$parent)) {
  3038. var hooks = cur.$options.errorCaptured;
  3039. if (hooks) {
  3040. for (var i = 0; i < hooks.length; i++) {
  3041. try {
  3042. var capture = hooks[i].call(cur, err, vm, info) === false;
  3043. if (capture) { return }
  3044. } catch (e) {
  3045. globalHandleError(e, cur, 'errorCaptured hook');
  3046. }
  3047. }
  3048. }
  3049. }
  3050. }
  3051. globalHandleError(err, vm, info);
  3052. }
  3053. function globalHandleError (err, vm, info) {
  3054. if (config.errorHandler) {
  3055. try {
  3056. return config.errorHandler.call(null, err, vm, info)
  3057. } catch (e) {
  3058. logError(e, null, 'config.errorHandler');
  3059. }
  3060. }
  3061. logError(err, vm, info);
  3062. }
  3063. function logError (err, vm, info) {
  3064. if (true) {
  3065. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  3066. }
  3067. /* istanbul ignore else */
  3068. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  3069. console.error(err);
  3070. } else {
  3071. throw err
  3072. }
  3073. }
  3074. /* */
  3075. var callbacks = [];
  3076. var pending = false;
  3077. function flushCallbacks () {
  3078. pending = false;
  3079. var copies = callbacks.slice(0);
  3080. callbacks.length = 0;
  3081. for (var i = 0; i < copies.length; i++) {
  3082. copies[i]();
  3083. }
  3084. }
  3085. // Here we have async deferring wrappers using both microtasks and (macro) tasks.
  3086. // In < 2.4 we used microtasks everywhere, but there are some scenarios where
  3087. // microtasks have too high a priority and fire in between supposedly
  3088. // sequential events (e.g. #4521, #6690) or even between bubbling of the same
  3089. // event (#6566). However, using (macro) tasks everywhere also has subtle problems
  3090. // when state is changed right before repaint (e.g. #6813, out-in transitions).
  3091. // Here we use microtask by default, but expose a way to force (macro) task when
  3092. // needed (e.g. in event handlers attached by v-on).
  3093. var microTimerFunc;
  3094. var macroTimerFunc;
  3095. var useMacroTask = false;
  3096. // Determine (macro) task defer implementation.
  3097. // Technically setImmediate should be the ideal choice, but it's only available
  3098. // in IE. The only polyfill that consistently queues the callback after all DOM
  3099. // events triggered in the same loop is by using MessageChannel.
  3100. /* istanbul ignore if */
  3101. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3102. macroTimerFunc = function () {
  3103. setImmediate(flushCallbacks);
  3104. };
  3105. } else if (typeof MessageChannel !== 'undefined' && (
  3106. isNative(MessageChannel) ||
  3107. // PhantomJS
  3108. MessageChannel.toString() === '[object MessageChannelConstructor]'
  3109. )) {
  3110. var channel = new MessageChannel();
  3111. var port = channel.port2;
  3112. channel.port1.onmessage = flushCallbacks;
  3113. macroTimerFunc = function () {
  3114. port.postMessage(1);
  3115. };
  3116. } else {
  3117. /* istanbul ignore next */
  3118. macroTimerFunc = function () {
  3119. setTimeout(flushCallbacks, 0);
  3120. };
  3121. }
  3122. // Determine microtask defer implementation.
  3123. /* istanbul ignore next, $flow-disable-line */
  3124. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3125. var p = Promise.resolve();
  3126. microTimerFunc = function () {
  3127. p.then(flushCallbacks);
  3128. // in problematic UIWebViews, Promise.then doesn't completely break, but
  3129. // it can get stuck in a weird state where callbacks are pushed into the
  3130. // microtask queue but the queue isn't being flushed, until the browser
  3131. // needs to do some other work, e.g. handle a timer. Therefore we can
  3132. // "force" the microtask queue to be flushed by adding an empty timer.
  3133. if (isIOS) { setTimeout(noop); }
  3134. };
  3135. } else {
  3136. // fallback to macro
  3137. microTimerFunc = macroTimerFunc;
  3138. }
  3139. /**
  3140. * Wrap a function so that if any code inside triggers state change,
  3141. * the changes are queued using a (macro) task instead of a microtask.
  3142. */
  3143. function withMacroTask (fn) {
  3144. return fn._withTask || (fn._withTask = function () {
  3145. useMacroTask = true;
  3146. try {
  3147. return fn.apply(null, arguments)
  3148. } finally {
  3149. useMacroTask = false;
  3150. }
  3151. })
  3152. }
  3153. function nextTick (cb, ctx) {
  3154. var _resolve;
  3155. callbacks.push(function () {
  3156. if (cb) {
  3157. try {
  3158. cb.call(ctx);
  3159. } catch (e) {
  3160. handleError(e, ctx, 'nextTick');
  3161. }
  3162. } else if (_resolve) {
  3163. _resolve(ctx);
  3164. }
  3165. });
  3166. if (!pending) {
  3167. pending = true;
  3168. if (useMacroTask) {
  3169. macroTimerFunc();
  3170. } else {
  3171. microTimerFunc();
  3172. }
  3173. }
  3174. // $flow-disable-line
  3175. if (!cb && typeof Promise !== 'undefined') {
  3176. return new Promise(function (resolve) {
  3177. _resolve = resolve;
  3178. })
  3179. }
  3180. }
  3181. /* */
  3182. var mark;
  3183. var measure;
  3184. if (true) {
  3185. var perf = inBrowser && window.performance;
  3186. /* istanbul ignore if */
  3187. if (
  3188. perf &&
  3189. perf.mark &&
  3190. perf.measure &&
  3191. perf.clearMarks &&
  3192. perf.clearMeasures
  3193. ) {
  3194. mark = function (tag) { return perf.mark(tag); };
  3195. measure = function (name, startTag, endTag) {
  3196. perf.measure(name, startTag, endTag);
  3197. perf.clearMarks(startTag);
  3198. perf.clearMarks(endTag);
  3199. perf.clearMeasures(name);
  3200. };
  3201. }
  3202. }
  3203. /* not type checking this file because flow doesn't play well with Proxy */
  3204. var initProxy;
  3205. if (true) {
  3206. var allowedGlobals = makeMap(
  3207. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  3208. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  3209. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  3210. 'require' // for Webpack/Browserify
  3211. );
  3212. var warnNonPresent = function (target, key) {
  3213. warn(
  3214. "Property or method \"" + key + "\" is not defined on the instance but " +
  3215. 'referenced during render. Make sure that this property is reactive, ' +
  3216. 'either in the data option, or for class-based components, by ' +
  3217. 'initializing the property. ' +
  3218. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  3219. target
  3220. );
  3221. };
  3222. var warnReservedPrefix = function (target, key) {
  3223. warn(
  3224. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  3225. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  3226. 'prevent conflicts with Vue internals' +
  3227. 'See: https://vuejs.org/v2/api/#data',
  3228. target
  3229. );
  3230. };
  3231. var hasProxy =
  3232. typeof Proxy !== 'undefined' && isNative(Proxy);
  3233. if (hasProxy) {
  3234. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  3235. config.keyCodes = new Proxy(config.keyCodes, {
  3236. set: function set (target, key, value) {
  3237. if (isBuiltInModifier(key)) {
  3238. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  3239. return false
  3240. } else {
  3241. target[key] = value;
  3242. return true
  3243. }
  3244. }
  3245. });
  3246. }
  3247. var hasHandler = {
  3248. has: function has (target, key) {
  3249. var has = key in target;
  3250. var isAllowed = allowedGlobals(key) ||
  3251. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  3252. if (!has && !isAllowed) {
  3253. if (key in target.$data) { warnReservedPrefix(target, key); }
  3254. else { warnNonPresent(target, key); }
  3255. }
  3256. return has || !isAllowed
  3257. }
  3258. };
  3259. var getHandler = {
  3260. get: function get (target, key) {
  3261. if (typeof key === 'string' && !(key in target)) {
  3262. if (key in target.$data) { warnReservedPrefix(target, key); }
  3263. else { warnNonPresent(target, key); }
  3264. }
  3265. return target[key]
  3266. }
  3267. };
  3268. initProxy = function initProxy (vm) {
  3269. if (hasProxy) {
  3270. // determine which proxy handler to use
  3271. var options = vm.$options;
  3272. var handlers = options.render && options.render._withStripped
  3273. ? getHandler
  3274. : hasHandler;
  3275. vm._renderProxy = new Proxy(vm, handlers);
  3276. } else {
  3277. vm._renderProxy = vm;
  3278. }
  3279. };
  3280. }
  3281. /* */
  3282. var seenObjects = new _Set();
  3283. /**
  3284. * Recursively traverse an object to evoke all converted
  3285. * getters, so that every nested property inside the object
  3286. * is collected as a "deep" dependency.
  3287. */
  3288. function traverse (val) {
  3289. _traverse(val, seenObjects);
  3290. seenObjects.clear();
  3291. }
  3292. function _traverse (val, seen) {
  3293. var i, keys;
  3294. var isA = Array.isArray(val);
  3295. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  3296. return
  3297. }
  3298. if (val.__ob__) {
  3299. var depId = val.__ob__.dep.id;
  3300. if (seen.has(depId)) {
  3301. return
  3302. }
  3303. seen.add(depId);
  3304. }
  3305. if (isA) {
  3306. i = val.length;
  3307. while (i--) { _traverse(val[i], seen); }
  3308. } else {
  3309. keys = Object.keys(val);
  3310. i = keys.length;
  3311. while (i--) { _traverse(val[keys[i]], seen); }
  3312. }
  3313. }
  3314. /* */
  3315. var normalizeEvent = cached(function (name) {
  3316. var passive = name.charAt(0) === '&';
  3317. name = passive ? name.slice(1) : name;
  3318. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  3319. name = once$$1 ? name.slice(1) : name;
  3320. var capture = name.charAt(0) === '!';
  3321. name = capture ? name.slice(1) : name;
  3322. return {
  3323. name: name,
  3324. once: once$$1,
  3325. capture: capture,
  3326. passive: passive
  3327. }
  3328. });
  3329. function createFnInvoker (fns) {
  3330. function invoker () {
  3331. var arguments$1 = arguments;
  3332. var fns = invoker.fns;
  3333. if (Array.isArray(fns)) {
  3334. var cloned = fns.slice();
  3335. for (var i = 0; i < cloned.length; i++) {
  3336. cloned[i].apply(null, arguments$1);
  3337. }
  3338. } else {
  3339. // return handler return value for single handlers
  3340. return fns.apply(null, arguments)
  3341. }
  3342. }
  3343. invoker.fns = fns;
  3344. return invoker
  3345. }
  3346. function updateListeners (
  3347. on,
  3348. oldOn,
  3349. add,
  3350. remove$$1,
  3351. createOnceHandler,
  3352. vm
  3353. ) {
  3354. var name, def$$1, cur, old, event;
  3355. for (name in on) {
  3356. def$$1 = cur = on[name];
  3357. old = oldOn[name];
  3358. event = normalizeEvent(name);
  3359. if (isUndef(cur)) {
  3360. "development" !== 'production' && warn(
  3361. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  3362. vm
  3363. );
  3364. } else if (isUndef(old)) {
  3365. if (isUndef(cur.fns)) {
  3366. cur = on[name] = createFnInvoker(cur);
  3367. }
  3368. if (isTrue(event.once)) {
  3369. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  3370. }
  3371. add(event.name, cur, event.capture, event.passive, event.params);
  3372. } else if (cur !== old) {
  3373. old.fns = cur;
  3374. on[name] = old;
  3375. }
  3376. }
  3377. for (name in oldOn) {
  3378. if (isUndef(on[name])) {
  3379. event = normalizeEvent(name);
  3380. remove$$1(event.name, oldOn[name], event.capture);
  3381. }
  3382. }
  3383. }
  3384. /* */
  3385. function mergeVNodeHook (def, hookKey, hook) {
  3386. if (def instanceof VNode) {
  3387. def = def.data.hook || (def.data.hook = {});
  3388. }
  3389. var invoker;
  3390. var oldHook = def[hookKey];
  3391. function wrappedHook () {
  3392. hook.apply(this, arguments);
  3393. // important: remove merged hook to ensure it's called only once
  3394. // and prevent memory leak
  3395. remove(invoker.fns, wrappedHook);
  3396. }
  3397. if (isUndef(oldHook)) {
  3398. // no existing hook
  3399. invoker = createFnInvoker([wrappedHook]);
  3400. } else {
  3401. /* istanbul ignore if */
  3402. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  3403. // already a merged invoker
  3404. invoker = oldHook;
  3405. invoker.fns.push(wrappedHook);
  3406. } else {
  3407. // existing plain hook
  3408. invoker = createFnInvoker([oldHook, wrappedHook]);
  3409. }
  3410. }
  3411. invoker.merged = true;
  3412. def[hookKey] = invoker;
  3413. }
  3414. /* */
  3415. function extractPropsFromVNodeData (
  3416. data,
  3417. Ctor,
  3418. tag
  3419. ) {
  3420. // we are only extracting raw values here.
  3421. // validation and default values are handled in the child
  3422. // component itself.
  3423. var propOptions = Ctor.options.props;
  3424. if (isUndef(propOptions)) {
  3425. return
  3426. }
  3427. var res = {};
  3428. var attrs = data.attrs;
  3429. var props = data.props;
  3430. if (isDef(attrs) || isDef(props)) {
  3431. for (var key in propOptions) {
  3432. var altKey = hyphenate(key);
  3433. if (true) {
  3434. var keyInLowerCase = key.toLowerCase();
  3435. if (
  3436. key !== keyInLowerCase &&
  3437. attrs && hasOwn(attrs, keyInLowerCase)
  3438. ) {
  3439. tip(
  3440. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  3441. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  3442. " \"" + key + "\". " +
  3443. "Note that HTML attributes are case-insensitive and camelCased " +
  3444. "props need to use their kebab-case equivalents when using in-DOM " +
  3445. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  3446. );
  3447. }
  3448. }
  3449. checkProp(res, props, key, altKey, true) ||
  3450. checkProp(res, attrs, key, altKey, false);
  3451. }
  3452. }
  3453. return res
  3454. }
  3455. function checkProp (
  3456. res,
  3457. hash,
  3458. key,
  3459. altKey,
  3460. preserve
  3461. ) {
  3462. if (isDef(hash)) {
  3463. if (hasOwn(hash, key)) {
  3464. res[key] = hash[key];
  3465. if (!preserve) {
  3466. delete hash[key];
  3467. }
  3468. return true
  3469. } else if (hasOwn(hash, altKey)) {
  3470. res[key] = hash[altKey];
  3471. if (!preserve) {
  3472. delete hash[altKey];
  3473. }
  3474. return true
  3475. }
  3476. }
  3477. return false
  3478. }
  3479. /* */
  3480. // The template compiler attempts to minimize the need for normalization by
  3481. // statically analyzing the template at compile time.
  3482. //
  3483. // For plain HTML markup, normalization can be completely skipped because the
  3484. // generated render function is guaranteed to return Array<VNode>. There are
  3485. // two cases where extra normalization is needed:
  3486. // 1. When the children contains components - because a functional component
  3487. // may return an Array instead of a single root. In this case, just a simple
  3488. // normalization is needed - if any child is an Array, we flatten the whole
  3489. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  3490. // because functional components already normalize their own children.
  3491. function simpleNormalizeChildren (children) {
  3492. for (var i = 0; i < children.length; i++) {
  3493. if (Array.isArray(children[i])) {
  3494. return Array.prototype.concat.apply([], children)
  3495. }
  3496. }
  3497. return children
  3498. }
  3499. // 2. When the children contains constructs that always generated nested Arrays,
  3500. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  3501. // with hand-written render functions / JSX. In such cases a full normalization
  3502. // is needed to cater to all possible types of children values.
  3503. function normalizeChildren (children) {
  3504. return isPrimitive(children)
  3505. ? [createTextVNode(children)]
  3506. : Array.isArray(children)
  3507. ? normalizeArrayChildren(children)
  3508. : undefined
  3509. }
  3510. function isTextNode (node) {
  3511. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  3512. }
  3513. function normalizeArrayChildren (children, nestedIndex) {
  3514. var res = [];
  3515. var i, c, lastIndex, last;
  3516. for (i = 0; i < children.length; i++) {
  3517. c = children[i];
  3518. if (isUndef(c) || typeof c === 'boolean') { continue }
  3519. lastIndex = res.length - 1;
  3520. last = res[lastIndex];
  3521. // nested
  3522. if (Array.isArray(c)) {
  3523. if (c.length > 0) {
  3524. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  3525. // merge adjacent text nodes
  3526. if (isTextNode(c[0]) && isTextNode(last)) {
  3527. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  3528. c.shift();
  3529. }
  3530. res.push.apply(res, c);
  3531. }
  3532. } else if (isPrimitive(c)) {
  3533. if (isTextNode(last)) {
  3534. // merge adjacent text nodes
  3535. // this is necessary for SSR hydration because text nodes are
  3536. // essentially merged when rendered to HTML strings
  3537. res[lastIndex] = createTextVNode(last.text + c);
  3538. } else if (c !== '') {
  3539. // convert primitive to vnode
  3540. res.push(createTextVNode(c));
  3541. }
  3542. } else {
  3543. if (isTextNode(c) && isTextNode(last)) {
  3544. // merge adjacent text nodes
  3545. res[lastIndex] = createTextVNode(last.text + c.text);
  3546. } else {
  3547. // default key for nested array children (likely generated by v-for)
  3548. if (isTrue(children._isVList) &&
  3549. isDef(c.tag) &&
  3550. isUndef(c.key) &&
  3551. isDef(nestedIndex)) {
  3552. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  3553. }
  3554. res.push(c);
  3555. }
  3556. }
  3557. }
  3558. return res
  3559. }
  3560. /* */
  3561. function ensureCtor (comp, base) {
  3562. if (
  3563. comp.__esModule ||
  3564. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3565. ) {
  3566. comp = comp.default;
  3567. }
  3568. return isObject(comp)
  3569. ? base.extend(comp)
  3570. : comp
  3571. }
  3572. function createAsyncPlaceholder (
  3573. factory,
  3574. data,
  3575. context,
  3576. children,
  3577. tag
  3578. ) {
  3579. var node = createEmptyVNode();
  3580. node.asyncFactory = factory;
  3581. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3582. return node
  3583. }
  3584. function resolveAsyncComponent (
  3585. factory,
  3586. baseCtor,
  3587. context
  3588. ) {
  3589. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3590. return factory.errorComp
  3591. }
  3592. if (isDef(factory.resolved)) {
  3593. return factory.resolved
  3594. }
  3595. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3596. return factory.loadingComp
  3597. }
  3598. if (isDef(factory.contexts)) {
  3599. // already pending
  3600. factory.contexts.push(context);
  3601. } else {
  3602. var contexts = factory.contexts = [context];
  3603. var sync = true;
  3604. var forceRender = function (renderCompleted) {
  3605. for (var i = 0, l = contexts.length; i < l; i++) {
  3606. contexts[i].$forceUpdate();
  3607. }
  3608. if (renderCompleted) {
  3609. contexts.length = 0;
  3610. }
  3611. };
  3612. var resolve = once(function (res) {
  3613. // cache resolved
  3614. factory.resolved = ensureCtor(res, baseCtor);
  3615. // invoke callbacks only if this is not a synchronous resolve
  3616. // (async resolves are shimmed as synchronous during SSR)
  3617. if (!sync) {
  3618. forceRender(true);
  3619. } else {
  3620. contexts.length = 0;
  3621. }
  3622. });
  3623. var reject = once(function (reason) {
  3624. "development" !== 'production' && warn(
  3625. "Failed to resolve async component: " + (String(factory)) +
  3626. (reason ? ("\nReason: " + reason) : '')
  3627. );
  3628. if (isDef(factory.errorComp)) {
  3629. factory.error = true;
  3630. forceRender(true);
  3631. }
  3632. });
  3633. var res = factory(resolve, reject);
  3634. if (isObject(res)) {
  3635. if (typeof res.then === 'function') {
  3636. // () => Promise
  3637. if (isUndef(factory.resolved)) {
  3638. res.then(resolve, reject);
  3639. }
  3640. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  3641. res.component.then(resolve, reject);
  3642. if (isDef(res.error)) {
  3643. factory.errorComp = ensureCtor(res.error, baseCtor);
  3644. }
  3645. if (isDef(res.loading)) {
  3646. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3647. if (res.delay === 0) {
  3648. factory.loading = true;
  3649. } else {
  3650. setTimeout(function () {
  3651. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3652. factory.loading = true;
  3653. forceRender(false);
  3654. }
  3655. }, res.delay || 200);
  3656. }
  3657. }
  3658. if (isDef(res.timeout)) {
  3659. setTimeout(function () {
  3660. if (isUndef(factory.resolved)) {
  3661. reject(
  3662. true
  3663. ? ("timeout (" + (res.timeout) + "ms)")
  3664. : null
  3665. );
  3666. }
  3667. }, res.timeout);
  3668. }
  3669. }
  3670. }
  3671. sync = false;
  3672. // return in case resolved synchronously
  3673. return factory.loading
  3674. ? factory.loadingComp
  3675. : factory.resolved
  3676. }
  3677. }
  3678. /* */
  3679. function isAsyncPlaceholder (node) {
  3680. return node.isComment && node.asyncFactory
  3681. }
  3682. /* */
  3683. function getFirstComponentChild (children) {
  3684. if (Array.isArray(children)) {
  3685. for (var i = 0; i < children.length; i++) {
  3686. var c = children[i];
  3687. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3688. return c
  3689. }
  3690. }
  3691. }
  3692. }
  3693. /* */
  3694. /* */
  3695. function initEvents (vm) {
  3696. vm._events = Object.create(null);
  3697. vm._hasHookEvent = false;
  3698. // init parent attached events
  3699. var listeners = vm.$options._parentListeners;
  3700. if (listeners) {
  3701. updateComponentListeners(vm, listeners);
  3702. }
  3703. }
  3704. var target;
  3705. function add (event, fn) {
  3706. target.$on(event, fn);
  3707. }
  3708. function remove$1 (event, fn) {
  3709. target.$off(event, fn);
  3710. }
  3711. function createOnceHandler (event, fn) {
  3712. var _target = target;
  3713. return function onceHandler () {
  3714. var res = fn.apply(null, arguments);
  3715. if (res !== null) {
  3716. _target.$off(event, onceHandler);
  3717. }
  3718. }
  3719. }
  3720. function updateComponentListeners (
  3721. vm,
  3722. listeners,
  3723. oldListeners
  3724. ) {
  3725. target = vm;
  3726. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3727. target = undefined;
  3728. }
  3729. function eventsMixin (Vue) {
  3730. var hookRE = /^hook:/;
  3731. Vue.prototype.$on = function (event, fn) {
  3732. var vm = this;
  3733. if (Array.isArray(event)) {
  3734. for (var i = 0, l = event.length; i < l; i++) {
  3735. vm.$on(event[i], fn);
  3736. }
  3737. } else {
  3738. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3739. // optimize hook:event cost by using a boolean flag marked at registration
  3740. // instead of a hash lookup
  3741. if (hookRE.test(event)) {
  3742. vm._hasHookEvent = true;
  3743. }
  3744. }
  3745. return vm
  3746. };
  3747. Vue.prototype.$once = function (event, fn) {
  3748. var vm = this;
  3749. function on () {
  3750. vm.$off(event, on);
  3751. fn.apply(vm, arguments);
  3752. }
  3753. on.fn = fn;
  3754. vm.$on(event, on);
  3755. return vm
  3756. };
  3757. Vue.prototype.$off = function (event, fn) {
  3758. var vm = this;
  3759. // all
  3760. if (!arguments.length) {
  3761. vm._events = Object.create(null);
  3762. return vm
  3763. }
  3764. // array of events
  3765. if (Array.isArray(event)) {
  3766. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3767. vm.$off(event[i$1], fn);
  3768. }
  3769. return vm
  3770. }
  3771. // specific event
  3772. var cbs = vm._events[event];
  3773. if (!cbs) {
  3774. return vm
  3775. }
  3776. if (!fn) {
  3777. vm._events[event] = null;
  3778. return vm
  3779. }
  3780. // specific handler
  3781. var cb;
  3782. var i = cbs.length;
  3783. while (i--) {
  3784. cb = cbs[i];
  3785. if (cb === fn || cb.fn === fn) {
  3786. cbs.splice(i, 1);
  3787. break
  3788. }
  3789. }
  3790. return vm
  3791. };
  3792. Vue.prototype.$emit = function (event) {
  3793. var vm = this;
  3794. if (true) {
  3795. var lowerCaseEvent = event.toLowerCase();
  3796. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3797. tip(
  3798. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3799. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3800. "Note that HTML attributes are case-insensitive and you cannot use " +
  3801. "v-on to listen to camelCase events when using in-DOM templates. " +
  3802. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3803. );
  3804. }
  3805. }
  3806. var cbs = vm._events[event];
  3807. if (cbs) {
  3808. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3809. var args = toArray(arguments, 1);
  3810. for (var i = 0, l = cbs.length; i < l; i++) {
  3811. try {
  3812. cbs[i].apply(vm, args);
  3813. } catch (e) {
  3814. handleError(e, vm, ("event handler for \"" + event + "\""));
  3815. }
  3816. }
  3817. }
  3818. return vm
  3819. };
  3820. }
  3821. /* */
  3822. /**
  3823. * Runtime helper for resolving raw children VNodes into a slot object.
  3824. */
  3825. function resolveSlots (
  3826. children,
  3827. context
  3828. ) {
  3829. var slots = {};
  3830. if (!children) {
  3831. return slots
  3832. }
  3833. for (var i = 0, l = children.length; i < l; i++) {
  3834. var child = children[i];
  3835. var data = child.data;
  3836. // remove slot attribute if the node is resolved as a Vue slot node
  3837. if (data && data.attrs && data.attrs.slot) {
  3838. delete data.attrs.slot;
  3839. }
  3840. // named slots should only be respected if the vnode was rendered in the
  3841. // same context.
  3842. if ((child.context === context || child.fnContext === context) &&
  3843. data && data.slot != null
  3844. ) {
  3845. var name = data.slot;
  3846. var slot = (slots[name] || (slots[name] = []));
  3847. if (child.tag === 'template') {
  3848. slot.push.apply(slot, child.children || []);
  3849. } else {
  3850. slot.push(child);
  3851. }
  3852. } else {
  3853. (slots.default || (slots.default = [])).push(child);
  3854. }
  3855. }
  3856. // ignore slots that contains only whitespace
  3857. for (var name$1 in slots) {
  3858. if (slots[name$1].every(isWhitespace)) {
  3859. delete slots[name$1];
  3860. }
  3861. }
  3862. return slots
  3863. }
  3864. function isWhitespace (node) {
  3865. return (node.isComment && !node.asyncFactory) || node.text === ' '
  3866. }
  3867. function resolveScopedSlots (
  3868. fns, // see flow/vnode
  3869. res
  3870. ) {
  3871. res = res || {};
  3872. for (var i = 0; i < fns.length; i++) {
  3873. if (Array.isArray(fns[i])) {
  3874. resolveScopedSlots(fns[i], res);
  3875. } else {
  3876. res[fns[i].key] = fns[i].fn;
  3877. }
  3878. }
  3879. return res
  3880. }
  3881. /* */
  3882. var activeInstance = null;
  3883. var isUpdatingChildComponent = false;
  3884. function setActiveInstance(vm) {
  3885. var prevActiveInstance = activeInstance;
  3886. activeInstance = vm;
  3887. return function () {
  3888. activeInstance = prevActiveInstance;
  3889. }
  3890. }
  3891. function initLifecycle (vm) {
  3892. var options = vm.$options;
  3893. // locate first non-abstract parent
  3894. var parent = options.parent;
  3895. if (parent && !options.abstract) {
  3896. while (parent.$options.abstract && parent.$parent) {
  3897. parent = parent.$parent;
  3898. }
  3899. parent.$children.push(vm);
  3900. }
  3901. vm.$parent = parent;
  3902. vm.$root = parent ? parent.$root : vm;
  3903. vm.$children = [];
  3904. vm.$refs = {};
  3905. vm._watcher = null;
  3906. vm._inactive = null;
  3907. vm._directInactive = false;
  3908. vm._isMounted = false;
  3909. vm._isDestroyed = false;
  3910. vm._isBeingDestroyed = false;
  3911. }
  3912. function lifecycleMixin (Vue) {
  3913. Vue.prototype._update = function (vnode, hydrating) {
  3914. var vm = this;
  3915. var prevEl = vm.$el;
  3916. var prevVnode = vm._vnode;
  3917. var restoreActiveInstance = setActiveInstance(vm);
  3918. vm._vnode = vnode;
  3919. // Vue.prototype.__patch__ is injected in entry points
  3920. // based on the rendering backend used.
  3921. if (!prevVnode) {
  3922. // initial render
  3923. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3924. } else {
  3925. // updates
  3926. vm.$el = vm.__patch__(prevVnode, vnode);
  3927. }
  3928. restoreActiveInstance();
  3929. // update __vue__ reference
  3930. if (prevEl) {
  3931. prevEl.__vue__ = null;
  3932. }
  3933. if (vm.$el) {
  3934. vm.$el.__vue__ = vm;
  3935. }
  3936. // if parent is an HOC, update its $el as well
  3937. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3938. vm.$parent.$el = vm.$el;
  3939. }
  3940. // updated hook is called by the scheduler to ensure that children are
  3941. // updated in a parent's updated hook.
  3942. };
  3943. Vue.prototype.$forceUpdate = function () {
  3944. var vm = this;
  3945. if (vm._watcher) {
  3946. vm._watcher.update();
  3947. }
  3948. };
  3949. Vue.prototype.$destroy = function () {
  3950. var vm = this;
  3951. if (vm._isBeingDestroyed) {
  3952. return
  3953. }
  3954. callHook(vm, 'beforeDestroy');
  3955. vm._isBeingDestroyed = true;
  3956. // remove self from parent
  3957. var parent = vm.$parent;
  3958. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3959. remove(parent.$children, vm);
  3960. }
  3961. // teardown watchers
  3962. if (vm._watcher) {
  3963. vm._watcher.teardown();
  3964. }
  3965. var i = vm._watchers.length;
  3966. while (i--) {
  3967. vm._watchers[i].teardown();
  3968. }
  3969. // remove reference from data ob
  3970. // frozen object may not have observer.
  3971. if (vm._data.__ob__) {
  3972. vm._data.__ob__.vmCount--;
  3973. }
  3974. // call the last hook...
  3975. vm._isDestroyed = true;
  3976. // invoke destroy hooks on current rendered tree
  3977. vm.__patch__(vm._vnode, null);
  3978. // fire destroyed hook
  3979. callHook(vm, 'destroyed');
  3980. // turn off all instance listeners.
  3981. vm.$off();
  3982. // remove __vue__ reference
  3983. if (vm.$el) {
  3984. vm.$el.__vue__ = null;
  3985. }
  3986. // release circular reference (#6759)
  3987. if (vm.$vnode) {
  3988. vm.$vnode.parent = null;
  3989. }
  3990. };
  3991. }
  3992. function mountComponent (
  3993. vm,
  3994. el,
  3995. hydrating
  3996. ) {
  3997. vm.$el = el;
  3998. if (!vm.$options.render) {
  3999. vm.$options.render = createEmptyVNode;
  4000. if (true) {
  4001. /* istanbul ignore if */
  4002. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  4003. vm.$options.el || el) {
  4004. warn(
  4005. 'You are using the runtime-only build of Vue where the template ' +
  4006. 'compiler is not available. Either pre-compile the templates into ' +
  4007. 'render functions, or use the compiler-included build.',
  4008. vm
  4009. );
  4010. } else {
  4011. warn(
  4012. 'Failed to mount component: template or render function not defined.',
  4013. vm
  4014. );
  4015. }
  4016. }
  4017. }
  4018. callHook(vm, 'beforeMount');
  4019. var updateComponent;
  4020. /* istanbul ignore if */
  4021. if ("development" !== 'production' && config.performance && mark) {
  4022. updateComponent = function () {
  4023. var name = vm._name;
  4024. var id = vm._uid;
  4025. var startTag = "vue-perf-start:" + id;
  4026. var endTag = "vue-perf-end:" + id;
  4027. mark(startTag);
  4028. var vnode = vm._render();
  4029. mark(endTag);
  4030. measure(("vue " + name + " render"), startTag, endTag);
  4031. mark(startTag);
  4032. vm._update(vnode, hydrating);
  4033. mark(endTag);
  4034. measure(("vue " + name + " patch"), startTag, endTag);
  4035. };
  4036. } else {
  4037. updateComponent = function () {
  4038. vm._update(vm._render(), hydrating);
  4039. };
  4040. }
  4041. // we set this to vm._watcher inside the watcher's constructor
  4042. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  4043. // component's mounted hook), which relies on vm._watcher being already defined
  4044. new Watcher(vm, updateComponent, noop, {
  4045. before: function before () {
  4046. if (vm._isMounted && !vm._isDestroyed) {
  4047. callHook(vm, 'beforeUpdate');
  4048. }
  4049. }
  4050. }, true /* isRenderWatcher */);
  4051. hydrating = false;
  4052. // manually mounted instance, call mounted on self
  4053. // mounted is called for render-created child components in its inserted hook
  4054. if (vm.$vnode == null) {
  4055. vm._isMounted = true;
  4056. callHook(vm, 'mounted');
  4057. }
  4058. return vm
  4059. }
  4060. function updateChildComponent (
  4061. vm,
  4062. propsData,
  4063. listeners,
  4064. parentVnode,
  4065. renderChildren
  4066. ) {
  4067. if (true) {
  4068. isUpdatingChildComponent = true;
  4069. }
  4070. // determine whether component has slot children
  4071. // we need to do this before overwriting $options._renderChildren
  4072. var hasChildren = !!(
  4073. renderChildren || // has new static slots
  4074. vm.$options._renderChildren || // has old static slots
  4075. parentVnode.data.scopedSlots || // has new scoped slots
  4076. vm.$scopedSlots !== emptyObject // has old scoped slots
  4077. );
  4078. vm.$options._parentVnode = parentVnode;
  4079. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  4080. if (vm._vnode) { // update child tree's parent
  4081. vm._vnode.parent = parentVnode;
  4082. }
  4083. vm.$options._renderChildren = renderChildren;
  4084. // update $attrs and $listeners hash
  4085. // these are also reactive so they may trigger child update if the child
  4086. // used them during render
  4087. vm.$attrs = parentVnode.data.attrs || emptyObject;
  4088. vm.$listeners = listeners || emptyObject;
  4089. // update props
  4090. if (propsData && vm.$options.props) {
  4091. toggleObserving(false);
  4092. var props = vm._props;
  4093. var propKeys = vm.$options._propKeys || [];
  4094. for (var i = 0; i < propKeys.length; i++) {
  4095. var key = propKeys[i];
  4096. var propOptions = vm.$options.props; // wtf flow?
  4097. props[key] = validateProp(key, propOptions, propsData, vm);
  4098. }
  4099. toggleObserving(true);
  4100. // keep a copy of raw propsData
  4101. vm.$options.propsData = propsData;
  4102. }
  4103. // update listeners
  4104. listeners = listeners || emptyObject;
  4105. var oldListeners = vm.$options._parentListeners;
  4106. vm.$options._parentListeners = listeners;
  4107. updateComponentListeners(vm, listeners, oldListeners);
  4108. // resolve slots + force update if has children
  4109. if (hasChildren) {
  4110. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  4111. vm.$forceUpdate();
  4112. }
  4113. if (true) {
  4114. isUpdatingChildComponent = false;
  4115. }
  4116. }
  4117. function isInInactiveTree (vm) {
  4118. while (vm && (vm = vm.$parent)) {
  4119. if (vm._inactive) { return true }
  4120. }
  4121. return false
  4122. }
  4123. function activateChildComponent (vm, direct) {
  4124. if (direct) {
  4125. vm._directInactive = false;
  4126. if (isInInactiveTree(vm)) {
  4127. return
  4128. }
  4129. } else if (vm._directInactive) {
  4130. return
  4131. }
  4132. if (vm._inactive || vm._inactive === null) {
  4133. vm._inactive = false;
  4134. for (var i = 0; i < vm.$children.length; i++) {
  4135. activateChildComponent(vm.$children[i]);
  4136. }
  4137. callHook(vm, 'activated');
  4138. }
  4139. }
  4140. function deactivateChildComponent (vm, direct) {
  4141. if (direct) {
  4142. vm._directInactive = true;
  4143. if (isInInactiveTree(vm)) {
  4144. return
  4145. }
  4146. }
  4147. if (!vm._inactive) {
  4148. vm._inactive = true;
  4149. for (var i = 0; i < vm.$children.length; i++) {
  4150. deactivateChildComponent(vm.$children[i]);
  4151. }
  4152. callHook(vm, 'deactivated');
  4153. }
  4154. }
  4155. function callHook (vm, hook) {
  4156. // #7573 disable dep collection when invoking lifecycle hooks
  4157. pushTarget();
  4158. var handlers = vm.$options[hook];
  4159. if (handlers) {
  4160. for (var i = 0, j = handlers.length; i < j; i++) {
  4161. try {
  4162. handlers[i].call(vm);
  4163. } catch (e) {
  4164. handleError(e, vm, (hook + " hook"));
  4165. }
  4166. }
  4167. }
  4168. if (vm._hasHookEvent) {
  4169. vm.$emit('hook:' + hook);
  4170. }
  4171. popTarget();
  4172. }
  4173. /* */
  4174. var MAX_UPDATE_COUNT = 100;
  4175. var queue = [];
  4176. var activatedChildren = [];
  4177. var has = {};
  4178. var circular = {};
  4179. var waiting = false;
  4180. var flushing = false;
  4181. var index = 0;
  4182. /**
  4183. * Reset the scheduler's state.
  4184. */
  4185. function resetSchedulerState () {
  4186. index = queue.length = activatedChildren.length = 0;
  4187. has = {};
  4188. if (true) {
  4189. circular = {};
  4190. }
  4191. waiting = flushing = false;
  4192. }
  4193. /**
  4194. * Flush both queues and run the watchers.
  4195. */
  4196. function flushSchedulerQueue () {
  4197. flushing = true;
  4198. var watcher, id;
  4199. // Sort queue before flush.
  4200. // This ensures that:
  4201. // 1. Components are updated from parent to child. (because parent is always
  4202. // created before the child)
  4203. // 2. A component's user watchers are run before its render watcher (because
  4204. // user watchers are created before the render watcher)
  4205. // 3. If a component is destroyed during a parent component's watcher run,
  4206. // its watchers can be skipped.
  4207. queue.sort(function (a, b) { return a.id - b.id; });
  4208. // do not cache length because more watchers might be pushed
  4209. // as we run existing watchers
  4210. for (index = 0; index < queue.length; index++) {
  4211. watcher = queue[index];
  4212. if (watcher.before) {
  4213. watcher.before();
  4214. }
  4215. id = watcher.id;
  4216. has[id] = null;
  4217. watcher.run();
  4218. // in dev build, check and stop circular updates.
  4219. if ("development" !== 'production' && has[id] != null) {
  4220. circular[id] = (circular[id] || 0) + 1;
  4221. if (circular[id] > MAX_UPDATE_COUNT) {
  4222. warn(
  4223. 'You may have an infinite update loop ' + (
  4224. watcher.user
  4225. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  4226. : "in a component render function."
  4227. ),
  4228. watcher.vm
  4229. );
  4230. break
  4231. }
  4232. }
  4233. }
  4234. // keep copies of post queues before resetting state
  4235. var activatedQueue = activatedChildren.slice();
  4236. var updatedQueue = queue.slice();
  4237. resetSchedulerState();
  4238. // call component updated and activated hooks
  4239. callActivatedHooks(activatedQueue);
  4240. callUpdatedHooks(updatedQueue);
  4241. // devtool hook
  4242. /* istanbul ignore if */
  4243. if (devtools && config.devtools) {
  4244. devtools.emit('flush');
  4245. }
  4246. }
  4247. function callUpdatedHooks (queue) {
  4248. var i = queue.length;
  4249. while (i--) {
  4250. var watcher = queue[i];
  4251. var vm = watcher.vm;
  4252. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  4253. callHook(vm, 'updated');
  4254. }
  4255. }
  4256. }
  4257. /**
  4258. * Queue a kept-alive component that was activated during patch.
  4259. * The queue will be processed after the entire tree has been patched.
  4260. */
  4261. function queueActivatedComponent (vm) {
  4262. // setting _inactive to false here so that a render function can
  4263. // rely on checking whether it's in an inactive tree (e.g. router-view)
  4264. vm._inactive = false;
  4265. activatedChildren.push(vm);
  4266. }
  4267. function callActivatedHooks (queue) {
  4268. for (var i = 0; i < queue.length; i++) {
  4269. queue[i]._inactive = true;
  4270. activateChildComponent(queue[i], true /* true */);
  4271. }
  4272. }
  4273. /**
  4274. * Push a watcher into the watcher queue.
  4275. * Jobs with duplicate IDs will be skipped unless it's
  4276. * pushed when the queue is being flushed.
  4277. */
  4278. function queueWatcher (watcher) {
  4279. var id = watcher.id;
  4280. if (has[id] == null) {
  4281. has[id] = true;
  4282. if (!flushing) {
  4283. queue.push(watcher);
  4284. } else {
  4285. // if already flushing, splice the watcher based on its id
  4286. // if already past its id, it will be run next immediately.
  4287. var i = queue.length - 1;
  4288. while (i > index && queue[i].id > watcher.id) {
  4289. i--;
  4290. }
  4291. queue.splice(i + 1, 0, watcher);
  4292. }
  4293. // queue the flush
  4294. if (!waiting) {
  4295. waiting = true;
  4296. if ("development" !== 'production' && !config.async) {
  4297. flushSchedulerQueue();
  4298. return
  4299. }
  4300. nextTick(flushSchedulerQueue);
  4301. }
  4302. }
  4303. }
  4304. /* */
  4305. var uid$1 = 0;
  4306. /**
  4307. * A watcher parses an expression, collects dependencies,
  4308. * and fires callback when the expression value changes.
  4309. * This is used for both the $watch() api and directives.
  4310. */
  4311. var Watcher = function Watcher (
  4312. vm,
  4313. expOrFn,
  4314. cb,
  4315. options,
  4316. isRenderWatcher
  4317. ) {
  4318. this.vm = vm;
  4319. if (isRenderWatcher) {
  4320. vm._watcher = this;
  4321. }
  4322. vm._watchers.push(this);
  4323. // options
  4324. if (options) {
  4325. this.deep = !!options.deep;
  4326. this.user = !!options.user;
  4327. this.lazy = !!options.lazy;
  4328. this.sync = !!options.sync;
  4329. this.before = options.before;
  4330. } else {
  4331. this.deep = this.user = this.lazy = this.sync = false;
  4332. }
  4333. this.cb = cb;
  4334. this.id = ++uid$1; // uid for batching
  4335. this.active = true;
  4336. this.dirty = this.lazy; // for lazy watchers
  4337. this.deps = [];
  4338. this.newDeps = [];
  4339. this.depIds = new _Set();
  4340. this.newDepIds = new _Set();
  4341. this.expression = true
  4342. ? expOrFn.toString()
  4343. : '';
  4344. // parse expression for getter
  4345. if (typeof expOrFn === 'function') {
  4346. this.getter = expOrFn;
  4347. } else {
  4348. this.getter = parsePath(expOrFn);
  4349. if (!this.getter) {
  4350. this.getter = noop;
  4351. "development" !== 'production' && warn(
  4352. "Failed watching path: \"" + expOrFn + "\" " +
  4353. 'Watcher only accepts simple dot-delimited paths. ' +
  4354. 'For full control, use a function instead.',
  4355. vm
  4356. );
  4357. }
  4358. }
  4359. this.value = this.lazy
  4360. ? undefined
  4361. : this.get();
  4362. };
  4363. /**
  4364. * Evaluate the getter, and re-collect dependencies.
  4365. */
  4366. Watcher.prototype.get = function get () {
  4367. pushTarget(this);
  4368. var value;
  4369. var vm = this.vm;
  4370. try {
  4371. value = this.getter.call(vm, vm);
  4372. } catch (e) {
  4373. if (this.user) {
  4374. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4375. } else {
  4376. throw e
  4377. }
  4378. } finally {
  4379. // "touch" every property so they are all tracked as
  4380. // dependencies for deep watching
  4381. if (this.deep) {
  4382. traverse(value);
  4383. }
  4384. popTarget();
  4385. this.cleanupDeps();
  4386. }
  4387. return value
  4388. };
  4389. /**
  4390. * Add a dependency to this directive.
  4391. */
  4392. Watcher.prototype.addDep = function addDep (dep) {
  4393. var id = dep.id;
  4394. if (!this.newDepIds.has(id)) {
  4395. this.newDepIds.add(id);
  4396. this.newDeps.push(dep);
  4397. if (!this.depIds.has(id)) {
  4398. dep.addSub(this);
  4399. }
  4400. }
  4401. };
  4402. /**
  4403. * Clean up for dependency collection.
  4404. */
  4405. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4406. var i = this.deps.length;
  4407. while (i--) {
  4408. var dep = this.deps[i];
  4409. if (!this.newDepIds.has(dep.id)) {
  4410. dep.removeSub(this);
  4411. }
  4412. }
  4413. var tmp = this.depIds;
  4414. this.depIds = this.newDepIds;
  4415. this.newDepIds = tmp;
  4416. this.newDepIds.clear();
  4417. tmp = this.deps;
  4418. this.deps = this.newDeps;
  4419. this.newDeps = tmp;
  4420. this.newDeps.length = 0;
  4421. };
  4422. /**
  4423. * Subscriber interface.
  4424. * Will be called when a dependency changes.
  4425. */
  4426. Watcher.prototype.update = function update () {
  4427. /* istanbul ignore else */
  4428. if (this.lazy) {
  4429. this.dirty = true;
  4430. } else if (this.sync) {
  4431. this.run();
  4432. } else {
  4433. queueWatcher(this);
  4434. }
  4435. };
  4436. /**
  4437. * Scheduler job interface.
  4438. * Will be called by the scheduler.
  4439. */
  4440. Watcher.prototype.run = function run () {
  4441. if (this.active) {
  4442. var value = this.get();
  4443. if (
  4444. value !== this.value ||
  4445. // Deep watchers and watchers on Object/Arrays should fire even
  4446. // when the value is the same, because the value may
  4447. // have mutated.
  4448. isObject(value) ||
  4449. this.deep
  4450. ) {
  4451. // set new value
  4452. var oldValue = this.value;
  4453. this.value = value;
  4454. if (this.user) {
  4455. try {
  4456. this.cb.call(this.vm, value, oldValue);
  4457. } catch (e) {
  4458. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4459. }
  4460. } else {
  4461. this.cb.call(this.vm, value, oldValue);
  4462. }
  4463. }
  4464. }
  4465. };
  4466. /**
  4467. * Evaluate the value of the watcher.
  4468. * This only gets called for lazy watchers.
  4469. */
  4470. Watcher.prototype.evaluate = function evaluate () {
  4471. this.value = this.get();
  4472. this.dirty = false;
  4473. };
  4474. /**
  4475. * Depend on all deps collected by this watcher.
  4476. */
  4477. Watcher.prototype.depend = function depend () {
  4478. var i = this.deps.length;
  4479. while (i--) {
  4480. this.deps[i].depend();
  4481. }
  4482. };
  4483. /**
  4484. * Remove self from all dependencies' subscriber list.
  4485. */
  4486. Watcher.prototype.teardown = function teardown () {
  4487. if (this.active) {
  4488. // remove self from vm's watcher list
  4489. // this is a somewhat expensive operation so we skip it
  4490. // if the vm is being destroyed.
  4491. if (!this.vm._isBeingDestroyed) {
  4492. remove(this.vm._watchers, this);
  4493. }
  4494. var i = this.deps.length;
  4495. while (i--) {
  4496. this.deps[i].removeSub(this);
  4497. }
  4498. this.active = false;
  4499. }
  4500. };
  4501. /* */
  4502. var sharedPropertyDefinition = {
  4503. enumerable: true,
  4504. configurable: true,
  4505. get: noop,
  4506. set: noop
  4507. };
  4508. function proxy (target, sourceKey, key) {
  4509. sharedPropertyDefinition.get = function proxyGetter () {
  4510. return this[sourceKey][key]
  4511. };
  4512. sharedPropertyDefinition.set = function proxySetter (val) {
  4513. this[sourceKey][key] = val;
  4514. };
  4515. Object.defineProperty(target, key, sharedPropertyDefinition);
  4516. }
  4517. function initState (vm) {
  4518. vm._watchers = [];
  4519. var opts = vm.$options;
  4520. if (opts.props) { initProps(vm, opts.props); }
  4521. if (opts.methods) { initMethods(vm, opts.methods); }
  4522. if (opts.data) {
  4523. initData(vm);
  4524. } else {
  4525. observe(vm._data = {}, true /* asRootData */);
  4526. }
  4527. if (opts.computed) { initComputed(vm, opts.computed); }
  4528. if (opts.watch && opts.watch !== nativeWatch) {
  4529. initWatch(vm, opts.watch);
  4530. }
  4531. }
  4532. function initProps (vm, propsOptions) {
  4533. var propsData = vm.$options.propsData || {};
  4534. var props = vm._props = {};
  4535. // cache prop keys so that future props updates can iterate using Array
  4536. // instead of dynamic object key enumeration.
  4537. var keys = vm.$options._propKeys = [];
  4538. var isRoot = !vm.$parent;
  4539. // root instance props should be converted
  4540. if (!isRoot) {
  4541. toggleObserving(false);
  4542. }
  4543. var loop = function ( key ) {
  4544. keys.push(key);
  4545. var value = validateProp(key, propsOptions, propsData, vm);
  4546. /* istanbul ignore else */
  4547. if (true) {
  4548. var hyphenatedKey = hyphenate(key);
  4549. if (isReservedAttribute(hyphenatedKey) ||
  4550. config.isReservedAttr(hyphenatedKey)) {
  4551. warn(
  4552. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4553. vm
  4554. );
  4555. }
  4556. defineReactive$$1(props, key, value, function () {
  4557. if (!isRoot && !isUpdatingChildComponent) {
  4558. warn(
  4559. "Avoid mutating a prop directly since the value will be " +
  4560. "overwritten whenever the parent component re-renders. " +
  4561. "Instead, use a data or computed property based on the prop's " +
  4562. "value. Prop being mutated: \"" + key + "\"",
  4563. vm
  4564. );
  4565. }
  4566. });
  4567. } else {
  4568. defineReactive$$1(props, key, value);
  4569. }
  4570. // static props are already proxied on the component's prototype
  4571. // during Vue.extend(). We only need to proxy props defined at
  4572. // instantiation here.
  4573. if (!(key in vm)) {
  4574. proxy(vm, "_props", key);
  4575. }
  4576. };
  4577. for (var key in propsOptions) loop( key );
  4578. toggleObserving(true);
  4579. }
  4580. function initData (vm) {
  4581. var data = vm.$options.data;
  4582. data = vm._data = typeof data === 'function'
  4583. ? getData(data, vm)
  4584. : data || {};
  4585. if (!isPlainObject(data)) {
  4586. data = {};
  4587. "development" !== 'production' && warn(
  4588. 'data functions should return an object:\n' +
  4589. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4590. vm
  4591. );
  4592. }
  4593. // proxy data on instance
  4594. var keys = Object.keys(data);
  4595. var props = vm.$options.props;
  4596. var methods = vm.$options.methods;
  4597. var i = keys.length;
  4598. while (i--) {
  4599. var key = keys[i];
  4600. if (true) {
  4601. if (methods && hasOwn(methods, key)) {
  4602. warn(
  4603. ("Method \"" + key + "\" has already been defined as a data property."),
  4604. vm
  4605. );
  4606. }
  4607. }
  4608. if (props && hasOwn(props, key)) {
  4609. "development" !== 'production' && warn(
  4610. "The data property \"" + key + "\" is already declared as a prop. " +
  4611. "Use prop default value instead.",
  4612. vm
  4613. );
  4614. } else if (!isReserved(key)) {
  4615. proxy(vm, "_data", key);
  4616. }
  4617. }
  4618. // observe data
  4619. observe(data, true /* asRootData */);
  4620. }
  4621. function getData (data, vm) {
  4622. // #7573 disable dep collection when invoking data getters
  4623. pushTarget();
  4624. try {
  4625. return data.call(vm, vm)
  4626. } catch (e) {
  4627. handleError(e, vm, "data()");
  4628. return {}
  4629. } finally {
  4630. popTarget();
  4631. }
  4632. }
  4633. var computedWatcherOptions = { lazy: true };
  4634. function initComputed (vm, computed) {
  4635. // $flow-disable-line
  4636. var watchers = vm._computedWatchers = Object.create(null);
  4637. // computed properties are just getters during SSR
  4638. var isSSR = isServerRendering();
  4639. for (var key in computed) {
  4640. var userDef = computed[key];
  4641. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4642. if ("development" !== 'production' && getter == null) {
  4643. warn(
  4644. ("Getter is missing for computed property \"" + key + "\"."),
  4645. vm
  4646. );
  4647. }
  4648. if (!isSSR) {
  4649. // create internal watcher for the computed property.
  4650. watchers[key] = new Watcher(
  4651. vm,
  4652. getter || noop,
  4653. noop,
  4654. computedWatcherOptions
  4655. );
  4656. }
  4657. // component-defined computed properties are already defined on the
  4658. // component prototype. We only need to define computed properties defined
  4659. // at instantiation here.
  4660. if (!(key in vm)) {
  4661. defineComputed(vm, key, userDef);
  4662. } else if (true) {
  4663. if (key in vm.$data) {
  4664. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4665. } else if (vm.$options.props && key in vm.$options.props) {
  4666. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4667. }
  4668. }
  4669. }
  4670. }
  4671. function defineComputed (
  4672. target,
  4673. key,
  4674. userDef
  4675. ) {
  4676. var shouldCache = !isServerRendering();
  4677. if (typeof userDef === 'function') {
  4678. sharedPropertyDefinition.get = shouldCache
  4679. ? createComputedGetter(key)
  4680. : createGetterInvoker(userDef);
  4681. sharedPropertyDefinition.set = noop;
  4682. } else {
  4683. sharedPropertyDefinition.get = userDef.get
  4684. ? shouldCache && userDef.cache !== false
  4685. ? createComputedGetter(key)
  4686. : createGetterInvoker(userDef.get)
  4687. : noop;
  4688. sharedPropertyDefinition.set = userDef.set || noop;
  4689. }
  4690. if ("development" !== 'production' &&
  4691. sharedPropertyDefinition.set === noop) {
  4692. sharedPropertyDefinition.set = function () {
  4693. warn(
  4694. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4695. this
  4696. );
  4697. };
  4698. }
  4699. Object.defineProperty(target, key, sharedPropertyDefinition);
  4700. }
  4701. function createComputedGetter (key) {
  4702. return function computedGetter () {
  4703. var watcher = this._computedWatchers && this._computedWatchers[key];
  4704. if (watcher) {
  4705. if (watcher.dirty) {
  4706. watcher.evaluate();
  4707. }
  4708. if (Dep.target) {
  4709. watcher.depend();
  4710. }
  4711. return watcher.value
  4712. }
  4713. }
  4714. }
  4715. function createGetterInvoker(fn) {
  4716. return function computedGetter () {
  4717. return fn.call(this, this)
  4718. }
  4719. }
  4720. function initMethods (vm, methods) {
  4721. var props = vm.$options.props;
  4722. for (var key in methods) {
  4723. if (true) {
  4724. if (typeof methods[key] !== 'function') {
  4725. warn(
  4726. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4727. "Did you reference the function correctly?",
  4728. vm
  4729. );
  4730. }
  4731. if (props && hasOwn(props, key)) {
  4732. warn(
  4733. ("Method \"" + key + "\" has already been defined as a prop."),
  4734. vm
  4735. );
  4736. }
  4737. if ((key in vm) && isReserved(key)) {
  4738. warn(
  4739. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4740. "Avoid defining component methods that start with _ or $."
  4741. );
  4742. }
  4743. }
  4744. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4745. }
  4746. }
  4747. function initWatch (vm, watch) {
  4748. for (var key in watch) {
  4749. var handler = watch[key];
  4750. if (Array.isArray(handler)) {
  4751. for (var i = 0; i < handler.length; i++) {
  4752. createWatcher(vm, key, handler[i]);
  4753. }
  4754. } else {
  4755. createWatcher(vm, key, handler);
  4756. }
  4757. }
  4758. }
  4759. function createWatcher (
  4760. vm,
  4761. expOrFn,
  4762. handler,
  4763. options
  4764. ) {
  4765. if (isPlainObject(handler)) {
  4766. options = handler;
  4767. handler = handler.handler;
  4768. }
  4769. if (typeof handler === 'string') {
  4770. handler = vm[handler];
  4771. }
  4772. return vm.$watch(expOrFn, handler, options)
  4773. }
  4774. function stateMixin (Vue) {
  4775. // flow somehow has problems with directly declared definition object
  4776. // when using Object.defineProperty, so we have to procedurally build up
  4777. // the object here.
  4778. var dataDef = {};
  4779. dataDef.get = function () { return this._data };
  4780. var propsDef = {};
  4781. propsDef.get = function () { return this._props };
  4782. if (true) {
  4783. dataDef.set = function () {
  4784. warn(
  4785. 'Avoid replacing instance root $data. ' +
  4786. 'Use nested data properties instead.',
  4787. this
  4788. );
  4789. };
  4790. propsDef.set = function () {
  4791. warn("$props is readonly.", this);
  4792. };
  4793. }
  4794. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4795. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4796. Vue.prototype.$set = set;
  4797. Vue.prototype.$delete = del;
  4798. Vue.prototype.$watch = function (
  4799. expOrFn,
  4800. cb,
  4801. options
  4802. ) {
  4803. var vm = this;
  4804. if (isPlainObject(cb)) {
  4805. return createWatcher(vm, expOrFn, cb, options)
  4806. }
  4807. options = options || {};
  4808. options.user = true;
  4809. var watcher = new Watcher(vm, expOrFn, cb, options);
  4810. if (options.immediate) {
  4811. try {
  4812. cb.call(vm, watcher.value);
  4813. } catch (error) {
  4814. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4815. }
  4816. }
  4817. return function unwatchFn () {
  4818. watcher.teardown();
  4819. }
  4820. };
  4821. }
  4822. /* */
  4823. function initProvide (vm) {
  4824. var provide = vm.$options.provide;
  4825. if (provide) {
  4826. vm._provided = typeof provide === 'function'
  4827. ? provide.call(vm)
  4828. : provide;
  4829. }
  4830. }
  4831. function initInjections (vm) {
  4832. var result = resolveInject(vm.$options.inject, vm);
  4833. if (result) {
  4834. toggleObserving(false);
  4835. Object.keys(result).forEach(function (key) {
  4836. /* istanbul ignore else */
  4837. if (true) {
  4838. defineReactive$$1(vm, key, result[key], function () {
  4839. warn(
  4840. "Avoid mutating an injected value directly since the changes will be " +
  4841. "overwritten whenever the provided component re-renders. " +
  4842. "injection being mutated: \"" + key + "\"",
  4843. vm
  4844. );
  4845. });
  4846. } else {
  4847. defineReactive$$1(vm, key, result[key]);
  4848. }
  4849. });
  4850. toggleObserving(true);
  4851. }
  4852. }
  4853. function resolveInject (inject, vm) {
  4854. if (inject) {
  4855. // inject is :any because flow is not smart enough to figure out cached
  4856. var result = Object.create(null);
  4857. var keys = hasSymbol
  4858. ? Reflect.ownKeys(inject).filter(function (key) {
  4859. /* istanbul ignore next */
  4860. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  4861. })
  4862. : Object.keys(inject);
  4863. for (var i = 0; i < keys.length; i++) {
  4864. var key = keys[i];
  4865. var provideKey = inject[key].from;
  4866. var source = vm;
  4867. while (source) {
  4868. if (source._provided && hasOwn(source._provided, provideKey)) {
  4869. result[key] = source._provided[provideKey];
  4870. break
  4871. }
  4872. source = source.$parent;
  4873. }
  4874. if (!source) {
  4875. if ('default' in inject[key]) {
  4876. var provideDefault = inject[key].default;
  4877. result[key] = typeof provideDefault === 'function'
  4878. ? provideDefault.call(vm)
  4879. : provideDefault;
  4880. } else if (true) {
  4881. warn(("Injection \"" + key + "\" not found"), vm);
  4882. }
  4883. }
  4884. }
  4885. return result
  4886. }
  4887. }
  4888. /* */
  4889. /**
  4890. * Runtime helper for rendering v-for lists.
  4891. */
  4892. function renderList (
  4893. val,
  4894. render
  4895. ) {
  4896. var ret, i, l, keys, key;
  4897. if (Array.isArray(val) || typeof val === 'string') {
  4898. ret = new Array(val.length);
  4899. for (i = 0, l = val.length; i < l; i++) {
  4900. ret[i] = render(val[i], i);
  4901. }
  4902. } else if (typeof val === 'number') {
  4903. ret = new Array(val);
  4904. for (i = 0; i < val; i++) {
  4905. ret[i] = render(i + 1, i);
  4906. }
  4907. } else if (isObject(val)) {
  4908. keys = Object.keys(val);
  4909. ret = new Array(keys.length);
  4910. for (i = 0, l = keys.length; i < l; i++) {
  4911. key = keys[i];
  4912. ret[i] = render(val[key], key, i);
  4913. }
  4914. }
  4915. if (!isDef(ret)) {
  4916. ret = [];
  4917. }
  4918. (ret)._isVList = true;
  4919. return ret
  4920. }
  4921. /* */
  4922. /**
  4923. * Runtime helper for rendering <slot>
  4924. */
  4925. function renderSlot (
  4926. name,
  4927. fallback,
  4928. props,
  4929. bindObject
  4930. ) {
  4931. var scopedSlotFn = this.$scopedSlots[name];
  4932. var nodes;
  4933. if (scopedSlotFn) { // scoped slot
  4934. props = props || {};
  4935. if (bindObject) {
  4936. if ("development" !== 'production' && !isObject(bindObject)) {
  4937. warn(
  4938. 'slot v-bind without argument expects an Object',
  4939. this
  4940. );
  4941. }
  4942. props = extend(extend({}, bindObject), props);
  4943. }
  4944. nodes = scopedSlotFn(props) || fallback;
  4945. } else {
  4946. nodes = this.$slots[name] || fallback;
  4947. }
  4948. var target = props && props.slot;
  4949. if (target) {
  4950. return this.$createElement('template', { slot: target }, nodes)
  4951. } else {
  4952. return nodes
  4953. }
  4954. }
  4955. /* */
  4956. /**
  4957. * Runtime helper for resolving filters
  4958. */
  4959. function resolveFilter (id) {
  4960. return resolveAsset(this.$options, 'filters', id, true) || identity
  4961. }
  4962. /* */
  4963. function isKeyNotMatch (expect, actual) {
  4964. if (Array.isArray(expect)) {
  4965. return expect.indexOf(actual) === -1
  4966. } else {
  4967. return expect !== actual
  4968. }
  4969. }
  4970. /**
  4971. * Runtime helper for checking keyCodes from config.
  4972. * exposed as Vue.prototype._k
  4973. * passing in eventKeyName as last argument separately for backwards compat
  4974. */
  4975. function checkKeyCodes (
  4976. eventKeyCode,
  4977. key,
  4978. builtInKeyCode,
  4979. eventKeyName,
  4980. builtInKeyName
  4981. ) {
  4982. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  4983. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  4984. return isKeyNotMatch(builtInKeyName, eventKeyName)
  4985. } else if (mappedKeyCode) {
  4986. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  4987. } else if (eventKeyName) {
  4988. return hyphenate(eventKeyName) !== key
  4989. }
  4990. }
  4991. /* */
  4992. /**
  4993. * Runtime helper for merging v-bind="object" into a VNode's data.
  4994. */
  4995. function bindObjectProps (
  4996. data,
  4997. tag,
  4998. value,
  4999. asProp,
  5000. isSync
  5001. ) {
  5002. if (value) {
  5003. if (!isObject(value)) {
  5004. "development" !== 'production' && warn(
  5005. 'v-bind without argument expects an Object or Array value',
  5006. this
  5007. );
  5008. } else {
  5009. if (Array.isArray(value)) {
  5010. value = toObject(value);
  5011. }
  5012. var hash;
  5013. var loop = function ( key ) {
  5014. if (
  5015. key === 'class' ||
  5016. key === 'style' ||
  5017. isReservedAttribute(key)
  5018. ) {
  5019. hash = data;
  5020. } else {
  5021. var type = data.attrs && data.attrs.type;
  5022. hash = asProp || config.mustUseProp(tag, type, key)
  5023. ? data.domProps || (data.domProps = {})
  5024. : data.attrs || (data.attrs = {});
  5025. }
  5026. var camelizedKey = camelize(key);
  5027. if (!(key in hash) && !(camelizedKey in hash)) {
  5028. hash[key] = value[key];
  5029. if (isSync) {
  5030. var on = data.on || (data.on = {});
  5031. on[("update:" + camelizedKey)] = function ($event) {
  5032. value[key] = $event;
  5033. };
  5034. }
  5035. }
  5036. };
  5037. for (var key in value) loop( key );
  5038. }
  5039. }
  5040. return data
  5041. }
  5042. /* */
  5043. /**
  5044. * Runtime helper for rendering static trees.
  5045. */
  5046. function renderStatic (
  5047. index,
  5048. isInFor
  5049. ) {
  5050. var cached = this._staticTrees || (this._staticTrees = []);
  5051. var tree = cached[index];
  5052. // if has already-rendered static tree and not inside v-for,
  5053. // we can reuse the same tree.
  5054. if (tree && !isInFor) {
  5055. return tree
  5056. }
  5057. // otherwise, render a fresh tree.
  5058. tree = cached[index] = this.$options.staticRenderFns[index].call(
  5059. this._renderProxy,
  5060. null,
  5061. this // for render fns generated for functional component templates
  5062. );
  5063. markStatic(tree, ("__static__" + index), false);
  5064. return tree
  5065. }
  5066. /**
  5067. * Runtime helper for v-once.
  5068. * Effectively it means marking the node as static with a unique key.
  5069. */
  5070. function markOnce (
  5071. tree,
  5072. index,
  5073. key
  5074. ) {
  5075. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  5076. return tree
  5077. }
  5078. function markStatic (
  5079. tree,
  5080. key,
  5081. isOnce
  5082. ) {
  5083. if (Array.isArray(tree)) {
  5084. for (var i = 0; i < tree.length; i++) {
  5085. if (tree[i] && typeof tree[i] !== 'string') {
  5086. markStaticNode(tree[i], (key + "_" + i), isOnce);
  5087. }
  5088. }
  5089. } else {
  5090. markStaticNode(tree, key, isOnce);
  5091. }
  5092. }
  5093. function markStaticNode (node, key, isOnce) {
  5094. node.isStatic = true;
  5095. node.key = key;
  5096. node.isOnce = isOnce;
  5097. }
  5098. /* */
  5099. function bindObjectListeners (data, value) {
  5100. if (value) {
  5101. if (!isPlainObject(value)) {
  5102. "development" !== 'production' && warn(
  5103. 'v-on without argument expects an Object value',
  5104. this
  5105. );
  5106. } else {
  5107. var on = data.on = data.on ? extend({}, data.on) : {};
  5108. for (var key in value) {
  5109. var existing = on[key];
  5110. var ours = value[key];
  5111. on[key] = existing ? [].concat(existing, ours) : ours;
  5112. }
  5113. }
  5114. }
  5115. return data
  5116. }
  5117. /* */
  5118. function installRenderHelpers (target) {
  5119. target._o = markOnce;
  5120. target._n = toNumber;
  5121. target._s = toString;
  5122. target._l = renderList;
  5123. target._t = renderSlot;
  5124. target._q = looseEqual;
  5125. target._i = looseIndexOf;
  5126. target._m = renderStatic;
  5127. target._f = resolveFilter;
  5128. target._k = checkKeyCodes;
  5129. target._b = bindObjectProps;
  5130. target._v = createTextVNode;
  5131. target._e = createEmptyVNode;
  5132. target._u = resolveScopedSlots;
  5133. target._g = bindObjectListeners;
  5134. }
  5135. /* */
  5136. function FunctionalRenderContext (
  5137. data,
  5138. props,
  5139. children,
  5140. parent,
  5141. Ctor
  5142. ) {
  5143. var options = Ctor.options;
  5144. // ensure the createElement function in functional components
  5145. // gets a unique context - this is necessary for correct named slot check
  5146. var contextVm;
  5147. if (hasOwn(parent, '_uid')) {
  5148. contextVm = Object.create(parent);
  5149. // $flow-disable-line
  5150. contextVm._original = parent;
  5151. } else {
  5152. // the context vm passed in is a functional context as well.
  5153. // in this case we want to make sure we are able to get a hold to the
  5154. // real context instance.
  5155. contextVm = parent;
  5156. // $flow-disable-line
  5157. parent = parent._original;
  5158. }
  5159. var isCompiled = isTrue(options._compiled);
  5160. var needNormalization = !isCompiled;
  5161. this.data = data;
  5162. this.props = props;
  5163. this.children = children;
  5164. this.parent = parent;
  5165. this.listeners = data.on || emptyObject;
  5166. this.injections = resolveInject(options.inject, parent);
  5167. this.slots = function () { return resolveSlots(children, parent); };
  5168. // support for compiled functional template
  5169. if (isCompiled) {
  5170. // exposing $options for renderStatic()
  5171. this.$options = options;
  5172. // pre-resolve slots for renderSlot()
  5173. this.$slots = this.slots();
  5174. this.$scopedSlots = data.scopedSlots || emptyObject;
  5175. }
  5176. if (options._scopeId) {
  5177. this._c = function (a, b, c, d) {
  5178. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  5179. if (vnode && !Array.isArray(vnode)) {
  5180. vnode.fnScopeId = options._scopeId;
  5181. vnode.fnContext = parent;
  5182. }
  5183. return vnode
  5184. };
  5185. } else {
  5186. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  5187. }
  5188. }
  5189. installRenderHelpers(FunctionalRenderContext.prototype);
  5190. function createFunctionalComponent (
  5191. Ctor,
  5192. propsData,
  5193. data,
  5194. contextVm,
  5195. children
  5196. ) {
  5197. var options = Ctor.options;
  5198. var props = {};
  5199. var propOptions = options.props;
  5200. if (isDef(propOptions)) {
  5201. for (var key in propOptions) {
  5202. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  5203. }
  5204. } else {
  5205. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  5206. if (isDef(data.props)) { mergeProps(props, data.props); }
  5207. }
  5208. var renderContext = new FunctionalRenderContext(
  5209. data,
  5210. props,
  5211. children,
  5212. contextVm,
  5213. Ctor
  5214. );
  5215. var vnode = options.render.call(null, renderContext._c, renderContext);
  5216. if (vnode instanceof VNode) {
  5217. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  5218. } else if (Array.isArray(vnode)) {
  5219. var vnodes = normalizeChildren(vnode) || [];
  5220. var res = new Array(vnodes.length);
  5221. for (var i = 0; i < vnodes.length; i++) {
  5222. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  5223. }
  5224. return res
  5225. }
  5226. }
  5227. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  5228. // #7817 clone node before setting fnContext, otherwise if the node is reused
  5229. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  5230. // that should not be matched to match.
  5231. var clone = cloneVNode(vnode);
  5232. clone.fnContext = contextVm;
  5233. clone.fnOptions = options;
  5234. if (true) {
  5235. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  5236. }
  5237. if (data.slot) {
  5238. (clone.data || (clone.data = {})).slot = data.slot;
  5239. }
  5240. return clone
  5241. }
  5242. function mergeProps (to, from) {
  5243. for (var key in from) {
  5244. to[camelize(key)] = from[key];
  5245. }
  5246. }
  5247. /* */
  5248. /* */
  5249. /* */
  5250. /* */
  5251. // inline hooks to be invoked on component VNodes during patch
  5252. var componentVNodeHooks = {
  5253. init: function init (vnode, hydrating) {
  5254. if (
  5255. vnode.componentInstance &&
  5256. !vnode.componentInstance._isDestroyed &&
  5257. vnode.data.keepAlive
  5258. ) {
  5259. // kept-alive components, treat as a patch
  5260. var mountedNode = vnode; // work around flow
  5261. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  5262. } else {
  5263. var child = vnode.componentInstance = createComponentInstanceForVnode(
  5264. vnode,
  5265. activeInstance
  5266. );
  5267. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  5268. }
  5269. },
  5270. prepatch: function prepatch (oldVnode, vnode) {
  5271. var options = vnode.componentOptions;
  5272. var child = vnode.componentInstance = oldVnode.componentInstance;
  5273. updateChildComponent(
  5274. child,
  5275. options.propsData, // updated props
  5276. options.listeners, // updated listeners
  5277. vnode, // new parent vnode
  5278. options.children // new children
  5279. );
  5280. },
  5281. insert: function insert (vnode) {
  5282. var context = vnode.context;
  5283. var componentInstance = vnode.componentInstance;
  5284. if (!componentInstance._isMounted) {
  5285. componentInstance._isMounted = true;
  5286. callHook(componentInstance, 'mounted');
  5287. }
  5288. if (vnode.data.keepAlive) {
  5289. if (context._isMounted) {
  5290. // vue-router#1212
  5291. // During updates, a kept-alive component's child components may
  5292. // change, so directly walking the tree here may call activated hooks
  5293. // on incorrect children. Instead we push them into a queue which will
  5294. // be processed after the whole patch process ended.
  5295. queueActivatedComponent(componentInstance);
  5296. } else {
  5297. activateChildComponent(componentInstance, true /* direct */);
  5298. }
  5299. }
  5300. },
  5301. destroy: function destroy (vnode) {
  5302. var componentInstance = vnode.componentInstance;
  5303. if (!componentInstance._isDestroyed) {
  5304. if (!vnode.data.keepAlive) {
  5305. componentInstance.$destroy();
  5306. } else {
  5307. deactivateChildComponent(componentInstance, true /* direct */);
  5308. }
  5309. }
  5310. }
  5311. };
  5312. var hooksToMerge = Object.keys(componentVNodeHooks);
  5313. function createComponent (
  5314. Ctor,
  5315. data,
  5316. context,
  5317. children,
  5318. tag
  5319. ) {
  5320. if (isUndef(Ctor)) {
  5321. return
  5322. }
  5323. var baseCtor = context.$options._base;
  5324. // plain options object: turn it into a constructor
  5325. if (isObject(Ctor)) {
  5326. Ctor = baseCtor.extend(Ctor);
  5327. }
  5328. // if at this stage it's not a constructor or an async component factory,
  5329. // reject.
  5330. if (typeof Ctor !== 'function') {
  5331. if (true) {
  5332. warn(("Invalid Component definition: " + (String(Ctor))), context);
  5333. }
  5334. return
  5335. }
  5336. // async component
  5337. var asyncFactory;
  5338. if (isUndef(Ctor.cid)) {
  5339. asyncFactory = Ctor;
  5340. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  5341. if (Ctor === undefined) {
  5342. // return a placeholder node for async component, which is rendered
  5343. // as a comment node but preserves all the raw information for the node.
  5344. // the information will be used for async server-rendering and hydration.
  5345. return createAsyncPlaceholder(
  5346. asyncFactory,
  5347. data,
  5348. context,
  5349. children,
  5350. tag
  5351. )
  5352. }
  5353. }
  5354. data = data || {};
  5355. // resolve constructor options in case global mixins are applied after
  5356. // component constructor creation
  5357. resolveConstructorOptions(Ctor);
  5358. // transform component v-model data into props & events
  5359. if (isDef(data.model)) {
  5360. transformModel(Ctor.options, data);
  5361. }
  5362. // extract props
  5363. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  5364. // functional component
  5365. if (isTrue(Ctor.options.functional)) {
  5366. return createFunctionalComponent(Ctor, propsData, data, context, children)
  5367. }
  5368. // extract listeners, since these needs to be treated as
  5369. // child component listeners instead of DOM listeners
  5370. var listeners = data.on;
  5371. // replace with listeners with .native modifier
  5372. // so it gets processed during parent component patch.
  5373. data.on = data.nativeOn;
  5374. if (isTrue(Ctor.options.abstract)) {
  5375. // abstract components do not keep anything
  5376. // other than props & listeners & slot
  5377. // work around flow
  5378. var slot = data.slot;
  5379. data = {};
  5380. if (slot) {
  5381. data.slot = slot;
  5382. }
  5383. }
  5384. // install component management hooks onto the placeholder node
  5385. installComponentHooks(data);
  5386. // return a placeholder vnode
  5387. var name = Ctor.options.name || tag;
  5388. var vnode = new VNode(
  5389. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  5390. data, undefined, undefined, undefined, context,
  5391. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  5392. asyncFactory
  5393. );
  5394. return vnode
  5395. }
  5396. function createComponentInstanceForVnode (
  5397. vnode, // we know it's MountedComponentVNode but flow doesn't
  5398. parent // activeInstance in lifecycle state
  5399. ) {
  5400. var options = {
  5401. _isComponent: true,
  5402. _parentVnode: vnode,
  5403. parent: parent
  5404. };
  5405. // check inline-template render functions
  5406. var inlineTemplate = vnode.data.inlineTemplate;
  5407. if (isDef(inlineTemplate)) {
  5408. options.render = inlineTemplate.render;
  5409. options.staticRenderFns = inlineTemplate.staticRenderFns;
  5410. }
  5411. return new vnode.componentOptions.Ctor(options)
  5412. }
  5413. function installComponentHooks (data) {
  5414. var hooks = data.hook || (data.hook = {});
  5415. for (var i = 0; i < hooksToMerge.length; i++) {
  5416. var key = hooksToMerge[i];
  5417. var existing = hooks[key];
  5418. var toMerge = componentVNodeHooks[key];
  5419. if (existing !== toMerge && !(existing && existing._merged)) {
  5420. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  5421. }
  5422. }
  5423. }
  5424. function mergeHook$1 (f1, f2) {
  5425. var merged = function (a, b) {
  5426. // flow complains about extra args which is why we use any
  5427. f1(a, b);
  5428. f2(a, b);
  5429. };
  5430. merged._merged = true;
  5431. return merged
  5432. }
  5433. // transform component v-model info (value and callback) into
  5434. // prop and event handler respectively.
  5435. function transformModel (options, data) {
  5436. var prop = (options.model && options.model.prop) || 'value';
  5437. var event = (options.model && options.model.event) || 'input'
  5438. ;(data.props || (data.props = {}))[prop] = data.model.value;
  5439. var on = data.on || (data.on = {});
  5440. var existing = on[event];
  5441. var callback = data.model.callback;
  5442. if (isDef(existing)) {
  5443. if (
  5444. Array.isArray(existing)
  5445. ? existing.indexOf(callback) === -1
  5446. : existing !== callback
  5447. ) {
  5448. on[event] = [callback].concat(existing);
  5449. }
  5450. } else {
  5451. on[event] = callback;
  5452. }
  5453. }
  5454. /* */
  5455. var SIMPLE_NORMALIZE = 1;
  5456. var ALWAYS_NORMALIZE = 2;
  5457. // wrapper function for providing a more flexible interface
  5458. // without getting yelled at by flow
  5459. function createElement (
  5460. context,
  5461. tag,
  5462. data,
  5463. children,
  5464. normalizationType,
  5465. alwaysNormalize
  5466. ) {
  5467. if (Array.isArray(data) || isPrimitive(data)) {
  5468. normalizationType = children;
  5469. children = data;
  5470. data = undefined;
  5471. }
  5472. if (isTrue(alwaysNormalize)) {
  5473. normalizationType = ALWAYS_NORMALIZE;
  5474. }
  5475. return _createElement(context, tag, data, children, normalizationType)
  5476. }
  5477. function _createElement (
  5478. context,
  5479. tag,
  5480. data,
  5481. children,
  5482. normalizationType
  5483. ) {
  5484. if (isDef(data) && isDef((data).__ob__)) {
  5485. "development" !== 'production' && warn(
  5486. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  5487. 'Always create fresh vnode data objects in each render!',
  5488. context
  5489. );
  5490. return createEmptyVNode()
  5491. }
  5492. // object syntax in v-bind
  5493. if (isDef(data) && isDef(data.is)) {
  5494. tag = data.is;
  5495. }
  5496. if (!tag) {
  5497. // in case of component :is set to falsy value
  5498. return createEmptyVNode()
  5499. }
  5500. // warn against non-primitive key
  5501. if ("development" !== 'production' &&
  5502. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  5503. ) {
  5504. {
  5505. warn(
  5506. 'Avoid using non-primitive value as key, ' +
  5507. 'use string/number value instead.',
  5508. context
  5509. );
  5510. }
  5511. }
  5512. // support single function children as default scoped slot
  5513. if (Array.isArray(children) &&
  5514. typeof children[0] === 'function'
  5515. ) {
  5516. data = data || {};
  5517. data.scopedSlots = { default: children[0] };
  5518. children.length = 0;
  5519. }
  5520. if (normalizationType === ALWAYS_NORMALIZE) {
  5521. children = normalizeChildren(children);
  5522. } else if (normalizationType === SIMPLE_NORMALIZE) {
  5523. children = simpleNormalizeChildren(children);
  5524. }
  5525. var vnode, ns;
  5526. if (typeof tag === 'string') {
  5527. var Ctor;
  5528. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  5529. if (config.isReservedTag(tag)) {
  5530. // platform built-in elements
  5531. vnode = new VNode(
  5532. config.parsePlatformTagName(tag), data, children,
  5533. undefined, undefined, context
  5534. );
  5535. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  5536. // component
  5537. vnode = createComponent(Ctor, data, context, children, tag);
  5538. } else {
  5539. // unknown or unlisted namespaced elements
  5540. // check at runtime because it may get assigned a namespace when its
  5541. // parent normalizes children
  5542. vnode = new VNode(
  5543. tag, data, children,
  5544. undefined, undefined, context
  5545. );
  5546. }
  5547. } else {
  5548. // direct component options / constructor
  5549. vnode = createComponent(tag, data, context, children);
  5550. }
  5551. if (Array.isArray(vnode)) {
  5552. return vnode
  5553. } else if (isDef(vnode)) {
  5554. if (isDef(ns)) { applyNS(vnode, ns); }
  5555. if (isDef(data)) { registerDeepBindings(data); }
  5556. return vnode
  5557. } else {
  5558. return createEmptyVNode()
  5559. }
  5560. }
  5561. function applyNS (vnode, ns, force) {
  5562. vnode.ns = ns;
  5563. if (vnode.tag === 'foreignObject') {
  5564. // use default namespace inside foreignObject
  5565. ns = undefined;
  5566. force = true;
  5567. }
  5568. if (isDef(vnode.children)) {
  5569. for (var i = 0, l = vnode.children.length; i < l; i++) {
  5570. var child = vnode.children[i];
  5571. if (isDef(child.tag) && (
  5572. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  5573. applyNS(child, ns, force);
  5574. }
  5575. }
  5576. }
  5577. }
  5578. // ref #5318
  5579. // necessary to ensure parent re-render when deep bindings like :style and
  5580. // :class are used on slot nodes
  5581. function registerDeepBindings (data) {
  5582. if (isObject(data.style)) {
  5583. traverse(data.style);
  5584. }
  5585. if (isObject(data.class)) {
  5586. traverse(data.class);
  5587. }
  5588. }
  5589. /* */
  5590. function initRender (vm) {
  5591. vm._vnode = null; // the root of the child tree
  5592. vm._staticTrees = null; // v-once cached trees
  5593. var options = vm.$options;
  5594. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  5595. var renderContext = parentVnode && parentVnode.context;
  5596. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  5597. vm.$scopedSlots = emptyObject;
  5598. // bind the createElement fn to this instance
  5599. // so that we get proper render context inside it.
  5600. // args order: tag, data, children, normalizationType, alwaysNormalize
  5601. // internal version is used by render functions compiled from templates
  5602. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  5603. // normalization is always applied for the public version, used in
  5604. // user-written render functions.
  5605. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  5606. // $attrs & $listeners are exposed for easier HOC creation.
  5607. // they need to be reactive so that HOCs using them are always updated
  5608. var parentData = parentVnode && parentVnode.data;
  5609. /* istanbul ignore else */
  5610. if (true) {
  5611. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  5612. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  5613. }, true);
  5614. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  5615. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  5616. }, true);
  5617. } else {
  5618. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  5619. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  5620. }
  5621. }
  5622. function renderMixin (Vue) {
  5623. // install runtime convenience helpers
  5624. installRenderHelpers(Vue.prototype);
  5625. Vue.prototype.$nextTick = function (fn) {
  5626. return nextTick(fn, this)
  5627. };
  5628. Vue.prototype._render = function () {
  5629. var vm = this;
  5630. var ref = vm.$options;
  5631. var render = ref.render;
  5632. var _parentVnode = ref._parentVnode;
  5633. if (_parentVnode) {
  5634. vm.$scopedSlots = _parentVnode.data.scopedSlots || emptyObject;
  5635. }
  5636. // set parent vnode. this allows render functions to have access
  5637. // to the data on the placeholder node.
  5638. vm.$vnode = _parentVnode;
  5639. // render self
  5640. var vnode;
  5641. try {
  5642. vnode = render.call(vm._renderProxy, vm.$createElement);
  5643. } catch (e) {
  5644. handleError(e, vm, "render");
  5645. // return error render result,
  5646. // or previous vnode to prevent render error causing blank component
  5647. /* istanbul ignore else */
  5648. if ("development" !== 'production' && vm.$options.renderError) {
  5649. try {
  5650. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  5651. } catch (e) {
  5652. handleError(e, vm, "renderError");
  5653. vnode = vm._vnode;
  5654. }
  5655. } else {
  5656. vnode = vm._vnode;
  5657. }
  5658. }
  5659. // return empty vnode in case the render function errored out
  5660. if (!(vnode instanceof VNode)) {
  5661. if ("development" !== 'production' && Array.isArray(vnode)) {
  5662. warn(
  5663. 'Multiple root nodes returned from render function. Render function ' +
  5664. 'should return a single root node.',
  5665. vm
  5666. );
  5667. }
  5668. vnode = createEmptyVNode();
  5669. }
  5670. // set parent
  5671. vnode.parent = _parentVnode;
  5672. return vnode
  5673. };
  5674. }
  5675. /* */
  5676. var uid$3 = 0;
  5677. function initMixin (Vue) {
  5678. Vue.prototype._init = function (options) {
  5679. var vm = this;
  5680. // a uid
  5681. vm._uid = uid$3++;
  5682. var startTag, endTag;
  5683. /* istanbul ignore if */
  5684. if ("development" !== 'production' && config.performance && mark) {
  5685. startTag = "vue-perf-start:" + (vm._uid);
  5686. endTag = "vue-perf-end:" + (vm._uid);
  5687. mark(startTag);
  5688. }
  5689. // a flag to avoid this being observed
  5690. vm._isVue = true;
  5691. // merge options
  5692. if (options && options._isComponent) {
  5693. // optimize internal component instantiation
  5694. // since dynamic options merging is pretty slow, and none of the
  5695. // internal component options needs special treatment.
  5696. initInternalComponent(vm, options);
  5697. } else {
  5698. vm.$options = mergeOptions(
  5699. resolveConstructorOptions(vm.constructor),
  5700. options || {},
  5701. vm
  5702. );
  5703. }
  5704. /* istanbul ignore else */
  5705. if (true) {
  5706. initProxy(vm);
  5707. } else {
  5708. vm._renderProxy = vm;
  5709. }
  5710. // expose real self
  5711. vm._self = vm;
  5712. initLifecycle(vm);
  5713. initEvents(vm);
  5714. initRender(vm);
  5715. callHook(vm, 'beforeCreate');
  5716. initInjections(vm); // resolve injections before data/props
  5717. initState(vm);
  5718. initProvide(vm); // resolve provide after data/props
  5719. callHook(vm, 'created');
  5720. /* istanbul ignore if */
  5721. if ("development" !== 'production' && config.performance && mark) {
  5722. vm._name = formatComponentName(vm, false);
  5723. mark(endTag);
  5724. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  5725. }
  5726. if (vm.$options.el) {
  5727. vm.$mount(vm.$options.el);
  5728. }
  5729. };
  5730. }
  5731. function initInternalComponent (vm, options) {
  5732. var opts = vm.$options = Object.create(vm.constructor.options);
  5733. // doing this because it's faster than dynamic enumeration.
  5734. var parentVnode = options._parentVnode;
  5735. opts.parent = options.parent;
  5736. opts._parentVnode = parentVnode;
  5737. var vnodeComponentOptions = parentVnode.componentOptions;
  5738. opts.propsData = vnodeComponentOptions.propsData;
  5739. opts._parentListeners = vnodeComponentOptions.listeners;
  5740. opts._renderChildren = vnodeComponentOptions.children;
  5741. opts._componentTag = vnodeComponentOptions.tag;
  5742. if (options.render) {
  5743. opts.render = options.render;
  5744. opts.staticRenderFns = options.staticRenderFns;
  5745. }
  5746. }
  5747. function resolveConstructorOptions (Ctor) {
  5748. var options = Ctor.options;
  5749. if (Ctor.super) {
  5750. var superOptions = resolveConstructorOptions(Ctor.super);
  5751. var cachedSuperOptions = Ctor.superOptions;
  5752. if (superOptions !== cachedSuperOptions) {
  5753. // super option changed,
  5754. // need to resolve new options.
  5755. Ctor.superOptions = superOptions;
  5756. // check if there are any late-modified/attached options (#4976)
  5757. var modifiedOptions = resolveModifiedOptions(Ctor);
  5758. // update base extend options
  5759. if (modifiedOptions) {
  5760. extend(Ctor.extendOptions, modifiedOptions);
  5761. }
  5762. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  5763. if (options.name) {
  5764. options.components[options.name] = Ctor;
  5765. }
  5766. }
  5767. }
  5768. return options
  5769. }
  5770. function resolveModifiedOptions (Ctor) {
  5771. var modified;
  5772. var latest = Ctor.options;
  5773. var sealed = Ctor.sealedOptions;
  5774. for (var key in latest) {
  5775. if (latest[key] !== sealed[key]) {
  5776. if (!modified) { modified = {}; }
  5777. modified[key] = latest[key];
  5778. }
  5779. }
  5780. return modified
  5781. }
  5782. function Vue (options) {
  5783. if ("development" !== 'production' &&
  5784. !(this instanceof Vue)
  5785. ) {
  5786. warn('Vue is a constructor and should be called with the `new` keyword');
  5787. }
  5788. this._init(options);
  5789. }
  5790. initMixin(Vue);
  5791. stateMixin(Vue);
  5792. eventsMixin(Vue);
  5793. lifecycleMixin(Vue);
  5794. renderMixin(Vue);
  5795. /* */
  5796. function initUse (Vue) {
  5797. Vue.use = function (plugin) {
  5798. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  5799. if (installedPlugins.indexOf(plugin) > -1) {
  5800. return this
  5801. }
  5802. // additional parameters
  5803. var args = toArray(arguments, 1);
  5804. args.unshift(this);
  5805. if (typeof plugin.install === 'function') {
  5806. plugin.install.apply(plugin, args);
  5807. } else if (typeof plugin === 'function') {
  5808. plugin.apply(null, args);
  5809. }
  5810. installedPlugins.push(plugin);
  5811. return this
  5812. };
  5813. }
  5814. /* */
  5815. function initMixin$1 (Vue) {
  5816. Vue.mixin = function (mixin) {
  5817. this.options = mergeOptions(this.options, mixin);
  5818. return this
  5819. };
  5820. }
  5821. /* */
  5822. function initExtend (Vue) {
  5823. /**
  5824. * Each instance constructor, including Vue, has a unique
  5825. * cid. This enables us to create wrapped "child
  5826. * constructors" for prototypal inheritance and cache them.
  5827. */
  5828. Vue.cid = 0;
  5829. var cid = 1;
  5830. /**
  5831. * Class inheritance
  5832. */
  5833. Vue.extend = function (extendOptions) {
  5834. extendOptions = extendOptions || {};
  5835. var Super = this;
  5836. var SuperId = Super.cid;
  5837. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  5838. if (cachedCtors[SuperId]) {
  5839. return cachedCtors[SuperId]
  5840. }
  5841. var name = extendOptions.name || Super.options.name;
  5842. if ("development" !== 'production' && name) {
  5843. validateComponentName(name);
  5844. }
  5845. var Sub = function VueComponent (options) {
  5846. this._init(options);
  5847. };
  5848. Sub.prototype = Object.create(Super.prototype);
  5849. Sub.prototype.constructor = Sub;
  5850. Sub.cid = cid++;
  5851. Sub.options = mergeOptions(
  5852. Super.options,
  5853. extendOptions
  5854. );
  5855. Sub['super'] = Super;
  5856. // For props and computed properties, we define the proxy getters on
  5857. // the Vue instances at extension time, on the extended prototype. This
  5858. // avoids Object.defineProperty calls for each instance created.
  5859. if (Sub.options.props) {
  5860. initProps$1(Sub);
  5861. }
  5862. if (Sub.options.computed) {
  5863. initComputed$1(Sub);
  5864. }
  5865. // allow further extension/mixin/plugin usage
  5866. Sub.extend = Super.extend;
  5867. Sub.mixin = Super.mixin;
  5868. Sub.use = Super.use;
  5869. // create asset registers, so extended classes
  5870. // can have their private assets too.
  5871. ASSET_TYPES.forEach(function (type) {
  5872. Sub[type] = Super[type];
  5873. });
  5874. // enable recursive self-lookup
  5875. if (name) {
  5876. Sub.options.components[name] = Sub;
  5877. }
  5878. // keep a reference to the super options at extension time.
  5879. // later at instantiation we can check if Super's options have
  5880. // been updated.
  5881. Sub.superOptions = Super.options;
  5882. Sub.extendOptions = extendOptions;
  5883. Sub.sealedOptions = extend({}, Sub.options);
  5884. // cache constructor
  5885. cachedCtors[SuperId] = Sub;
  5886. return Sub
  5887. };
  5888. }
  5889. function initProps$1 (Comp) {
  5890. var props = Comp.options.props;
  5891. for (var key in props) {
  5892. proxy(Comp.prototype, "_props", key);
  5893. }
  5894. }
  5895. function initComputed$1 (Comp) {
  5896. var computed = Comp.options.computed;
  5897. for (var key in computed) {
  5898. defineComputed(Comp.prototype, key, computed[key]);
  5899. }
  5900. }
  5901. /* */
  5902. function initAssetRegisters (Vue) {
  5903. /**
  5904. * Create asset registration methods.
  5905. */
  5906. ASSET_TYPES.forEach(function (type) {
  5907. Vue[type] = function (
  5908. id,
  5909. definition
  5910. ) {
  5911. if (!definition) {
  5912. return this.options[type + 's'][id]
  5913. } else {
  5914. /* istanbul ignore if */
  5915. if ("development" !== 'production' && type === 'component') {
  5916. validateComponentName(id);
  5917. }
  5918. if (type === 'component' && isPlainObject(definition)) {
  5919. definition.name = definition.name || id;
  5920. definition = this.options._base.extend(definition);
  5921. }
  5922. if (type === 'directive' && typeof definition === 'function') {
  5923. definition = { bind: definition, update: definition };
  5924. }
  5925. this.options[type + 's'][id] = definition;
  5926. return definition
  5927. }
  5928. };
  5929. });
  5930. }
  5931. /* */
  5932. function getComponentName (opts) {
  5933. return opts && (opts.Ctor.options.name || opts.tag)
  5934. }
  5935. function matches (pattern, name) {
  5936. if (Array.isArray(pattern)) {
  5937. return pattern.indexOf(name) > -1
  5938. } else if (typeof pattern === 'string') {
  5939. return pattern.split(',').indexOf(name) > -1
  5940. } else if (isRegExp(pattern)) {
  5941. return pattern.test(name)
  5942. }
  5943. /* istanbul ignore next */
  5944. return false
  5945. }
  5946. function pruneCache (keepAliveInstance, filter) {
  5947. var cache = keepAliveInstance.cache;
  5948. var keys = keepAliveInstance.keys;
  5949. var _vnode = keepAliveInstance._vnode;
  5950. for (var key in cache) {
  5951. var cachedNode = cache[key];
  5952. if (cachedNode) {
  5953. var name = getComponentName(cachedNode.componentOptions);
  5954. if (name && !filter(name)) {
  5955. pruneCacheEntry(cache, key, keys, _vnode);
  5956. }
  5957. }
  5958. }
  5959. }
  5960. function pruneCacheEntry (
  5961. cache,
  5962. key,
  5963. keys,
  5964. current
  5965. ) {
  5966. var cached$$1 = cache[key];
  5967. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  5968. cached$$1.componentInstance.$destroy();
  5969. }
  5970. cache[key] = null;
  5971. remove(keys, key);
  5972. }
  5973. var patternTypes = [String, RegExp, Array];
  5974. var KeepAlive = {
  5975. name: 'keep-alive',
  5976. abstract: true,
  5977. props: {
  5978. include: patternTypes,
  5979. exclude: patternTypes,
  5980. max: [String, Number]
  5981. },
  5982. created: function created () {
  5983. this.cache = Object.create(null);
  5984. this.keys = [];
  5985. },
  5986. destroyed: function destroyed () {
  5987. for (var key in this.cache) {
  5988. pruneCacheEntry(this.cache, key, this.keys);
  5989. }
  5990. },
  5991. mounted: function mounted () {
  5992. var this$1 = this;
  5993. this.$watch('include', function (val) {
  5994. pruneCache(this$1, function (name) { return matches(val, name); });
  5995. });
  5996. this.$watch('exclude', function (val) {
  5997. pruneCache(this$1, function (name) { return !matches(val, name); });
  5998. });
  5999. },
  6000. render: function render () {
  6001. var slot = this.$slots.default;
  6002. var vnode = getFirstComponentChild(slot);
  6003. var componentOptions = vnode && vnode.componentOptions;
  6004. if (componentOptions) {
  6005. // check pattern
  6006. var name = getComponentName(componentOptions);
  6007. var ref = this;
  6008. var include = ref.include;
  6009. var exclude = ref.exclude;
  6010. if (
  6011. // not included
  6012. (include && (!name || !matches(include, name))) ||
  6013. // excluded
  6014. (exclude && name && matches(exclude, name))
  6015. ) {
  6016. return vnode
  6017. }
  6018. var ref$1 = this;
  6019. var cache = ref$1.cache;
  6020. var keys = ref$1.keys;
  6021. var key = vnode.key == null
  6022. // same constructor may get registered as different local components
  6023. // so cid alone is not enough (#3269)
  6024. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  6025. : vnode.key;
  6026. if (cache[key]) {
  6027. vnode.componentInstance = cache[key].componentInstance;
  6028. // make current key freshest
  6029. remove(keys, key);
  6030. keys.push(key);
  6031. } else {
  6032. cache[key] = vnode;
  6033. keys.push(key);
  6034. // prune oldest entry
  6035. if (this.max && keys.length > parseInt(this.max)) {
  6036. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  6037. }
  6038. }
  6039. vnode.data.keepAlive = true;
  6040. }
  6041. return vnode || (slot && slot[0])
  6042. }
  6043. };
  6044. var builtInComponents = {
  6045. KeepAlive: KeepAlive
  6046. };
  6047. /* */
  6048. function initGlobalAPI (Vue) {
  6049. // config
  6050. var configDef = {};
  6051. configDef.get = function () { return config; };
  6052. if (true) {
  6053. configDef.set = function () {
  6054. warn(
  6055. 'Do not replace the Vue.config object, set individual fields instead.'
  6056. );
  6057. };
  6058. }
  6059. Object.defineProperty(Vue, 'config', configDef);
  6060. // exposed util methods.
  6061. // NOTE: these are not considered part of the public API - avoid relying on
  6062. // them unless you are aware of the risk.
  6063. Vue.util = {
  6064. warn: warn,
  6065. extend: extend,
  6066. mergeOptions: mergeOptions,
  6067. defineReactive: defineReactive$$1
  6068. };
  6069. Vue.set = set;
  6070. Vue.delete = del;
  6071. Vue.nextTick = nextTick;
  6072. Vue.options = Object.create(null);
  6073. ASSET_TYPES.forEach(function (type) {
  6074. Vue.options[type + 's'] = Object.create(null);
  6075. });
  6076. // this is used to identify the "base" constructor to extend all plain-object
  6077. // components with in Weex's multi-instance scenarios.
  6078. Vue.options._base = Vue;
  6079. extend(Vue.options.components, builtInComponents);
  6080. initUse(Vue);
  6081. initMixin$1(Vue);
  6082. initExtend(Vue);
  6083. initAssetRegisters(Vue);
  6084. }
  6085. initGlobalAPI(Vue);
  6086. Object.defineProperty(Vue.prototype, '$isServer', {
  6087. get: isServerRendering
  6088. });
  6089. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6090. get: function get () {
  6091. /* istanbul ignore next */
  6092. return this.$vnode && this.$vnode.ssrContext
  6093. }
  6094. });
  6095. // expose FunctionalRenderContext for ssr runtime helper installation
  6096. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6097. value: FunctionalRenderContext
  6098. });
  6099. Vue.version = '2.5.22';
  6100. /* */
  6101. // these are reserved for web because they are directly compiled away
  6102. // during template compilation
  6103. var isReservedAttr = makeMap('style,class');
  6104. // attributes that should be using props for binding
  6105. var acceptValue = makeMap('input,textarea,option,select,progress');
  6106. var mustUseProp = function (tag, type, attr) {
  6107. return (
  6108. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  6109. (attr === 'selected' && tag === 'option') ||
  6110. (attr === 'checked' && tag === 'input') ||
  6111. (attr === 'muted' && tag === 'video')
  6112. )
  6113. };
  6114. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  6115. var isBooleanAttr = makeMap(
  6116. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  6117. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  6118. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  6119. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  6120. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  6121. 'truespeed,typemustmatch,visible'
  6122. );
  6123. var xlinkNS = 'http://www.w3.org/1999/xlink';
  6124. var isXlink = function (name) {
  6125. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  6126. };
  6127. var getXlinkProp = function (name) {
  6128. return isXlink(name) ? name.slice(6, name.length) : ''
  6129. };
  6130. var isFalsyAttrValue = function (val) {
  6131. return val == null || val === false
  6132. };
  6133. /* */
  6134. function genClassForVnode (vnode) {
  6135. var data = vnode.data;
  6136. var parentNode = vnode;
  6137. var childNode = vnode;
  6138. while (isDef(childNode.componentInstance)) {
  6139. childNode = childNode.componentInstance._vnode;
  6140. if (childNode && childNode.data) {
  6141. data = mergeClassData(childNode.data, data);
  6142. }
  6143. }
  6144. while (isDef(parentNode = parentNode.parent)) {
  6145. if (parentNode && parentNode.data) {
  6146. data = mergeClassData(data, parentNode.data);
  6147. }
  6148. }
  6149. return renderClass(data.staticClass, data.class)
  6150. }
  6151. function mergeClassData (child, parent) {
  6152. return {
  6153. staticClass: concat(child.staticClass, parent.staticClass),
  6154. class: isDef(child.class)
  6155. ? [child.class, parent.class]
  6156. : parent.class
  6157. }
  6158. }
  6159. function renderClass (
  6160. staticClass,
  6161. dynamicClass
  6162. ) {
  6163. if (isDef(staticClass) || isDef(dynamicClass)) {
  6164. return concat(staticClass, stringifyClass(dynamicClass))
  6165. }
  6166. /* istanbul ignore next */
  6167. return ''
  6168. }
  6169. function concat (a, b) {
  6170. return a ? b ? (a + ' ' + b) : a : (b || '')
  6171. }
  6172. function stringifyClass (value) {
  6173. if (Array.isArray(value)) {
  6174. return stringifyArray(value)
  6175. }
  6176. if (isObject(value)) {
  6177. return stringifyObject(value)
  6178. }
  6179. if (typeof value === 'string') {
  6180. return value
  6181. }
  6182. /* istanbul ignore next */
  6183. return ''
  6184. }
  6185. function stringifyArray (value) {
  6186. var res = '';
  6187. var stringified;
  6188. for (var i = 0, l = value.length; i < l; i++) {
  6189. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  6190. if (res) { res += ' '; }
  6191. res += stringified;
  6192. }
  6193. }
  6194. return res
  6195. }
  6196. function stringifyObject (value) {
  6197. var res = '';
  6198. for (var key in value) {
  6199. if (value[key]) {
  6200. if (res) { res += ' '; }
  6201. res += key;
  6202. }
  6203. }
  6204. return res
  6205. }
  6206. /* */
  6207. var namespaceMap = {
  6208. svg: 'http://www.w3.org/2000/svg',
  6209. math: 'http://www.w3.org/1998/Math/MathML'
  6210. };
  6211. var isHTMLTag = makeMap(
  6212. 'html,body,base,head,link,meta,style,title,' +
  6213. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  6214. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  6215. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  6216. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  6217. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  6218. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  6219. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  6220. 'output,progress,select,textarea,' +
  6221. 'details,dialog,menu,menuitem,summary,' +
  6222. 'content,element,shadow,template,blockquote,iframe,tfoot'
  6223. );
  6224. // this map is intentionally selective, only covering SVG elements that may
  6225. // contain child elements.
  6226. var isSVG = makeMap(
  6227. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  6228. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  6229. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  6230. true
  6231. );
  6232. var isPreTag = function (tag) { return tag === 'pre'; };
  6233. var isReservedTag = function (tag) {
  6234. return isHTMLTag(tag) || isSVG(tag)
  6235. };
  6236. function getTagNamespace (tag) {
  6237. if (isSVG(tag)) {
  6238. return 'svg'
  6239. }
  6240. // basic support for MathML
  6241. // note it doesn't support other MathML elements being component roots
  6242. if (tag === 'math') {
  6243. return 'math'
  6244. }
  6245. }
  6246. var unknownElementCache = Object.create(null);
  6247. function isUnknownElement (tag) {
  6248. /* istanbul ignore if */
  6249. if (!inBrowser) {
  6250. return true
  6251. }
  6252. if (isReservedTag(tag)) {
  6253. return false
  6254. }
  6255. tag = tag.toLowerCase();
  6256. /* istanbul ignore if */
  6257. if (unknownElementCache[tag] != null) {
  6258. return unknownElementCache[tag]
  6259. }
  6260. var el = document.createElement(tag);
  6261. if (tag.indexOf('-') > -1) {
  6262. // http://stackoverflow.com/a/28210364/1070244
  6263. return (unknownElementCache[tag] = (
  6264. el.constructor === window.HTMLUnknownElement ||
  6265. el.constructor === window.HTMLElement
  6266. ))
  6267. } else {
  6268. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  6269. }
  6270. }
  6271. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  6272. /* */
  6273. /**
  6274. * Query an element selector if it's not an element already.
  6275. */
  6276. function query (el) {
  6277. if (typeof el === 'string') {
  6278. var selected = document.querySelector(el);
  6279. if (!selected) {
  6280. "development" !== 'production' && warn(
  6281. 'Cannot find element: ' + el
  6282. );
  6283. return document.createElement('div')
  6284. }
  6285. return selected
  6286. } else {
  6287. return el
  6288. }
  6289. }
  6290. /* */
  6291. function createElement$1 (tagName, vnode) {
  6292. var elm = document.createElement(tagName);
  6293. if (tagName !== 'select') {
  6294. return elm
  6295. }
  6296. // false or null will remove the attribute but undefined will not
  6297. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  6298. elm.setAttribute('multiple', 'multiple');
  6299. }
  6300. return elm
  6301. }
  6302. function createElementNS (namespace, tagName) {
  6303. return document.createElementNS(namespaceMap[namespace], tagName)
  6304. }
  6305. function createTextNode (text) {
  6306. return document.createTextNode(text)
  6307. }
  6308. function createComment (text) {
  6309. return document.createComment(text)
  6310. }
  6311. function insertBefore (parentNode, newNode, referenceNode) {
  6312. parentNode.insertBefore(newNode, referenceNode);
  6313. }
  6314. function removeChild (node, child) {
  6315. node.removeChild(child);
  6316. }
  6317. function appendChild (node, child) {
  6318. node.appendChild(child);
  6319. }
  6320. function parentNode (node) {
  6321. return node.parentNode
  6322. }
  6323. function nextSibling (node) {
  6324. return node.nextSibling
  6325. }
  6326. function tagName (node) {
  6327. return node.tagName
  6328. }
  6329. function setTextContent (node, text) {
  6330. node.textContent = text;
  6331. }
  6332. function setStyleScope (node, scopeId) {
  6333. node.setAttribute(scopeId, '');
  6334. }
  6335. var nodeOps = /*#__PURE__*/Object.freeze({
  6336. createElement: createElement$1,
  6337. createElementNS: createElementNS,
  6338. createTextNode: createTextNode,
  6339. createComment: createComment,
  6340. insertBefore: insertBefore,
  6341. removeChild: removeChild,
  6342. appendChild: appendChild,
  6343. parentNode: parentNode,
  6344. nextSibling: nextSibling,
  6345. tagName: tagName,
  6346. setTextContent: setTextContent,
  6347. setStyleScope: setStyleScope
  6348. });
  6349. /* */
  6350. var ref = {
  6351. create: function create (_, vnode) {
  6352. registerRef(vnode);
  6353. },
  6354. update: function update (oldVnode, vnode) {
  6355. if (oldVnode.data.ref !== vnode.data.ref) {
  6356. registerRef(oldVnode, true);
  6357. registerRef(vnode);
  6358. }
  6359. },
  6360. destroy: function destroy (vnode) {
  6361. registerRef(vnode, true);
  6362. }
  6363. };
  6364. function registerRef (vnode, isRemoval) {
  6365. var key = vnode.data.ref;
  6366. if (!isDef(key)) { return }
  6367. var vm = vnode.context;
  6368. var ref = vnode.componentInstance || vnode.elm;
  6369. var refs = vm.$refs;
  6370. if (isRemoval) {
  6371. if (Array.isArray(refs[key])) {
  6372. remove(refs[key], ref);
  6373. } else if (refs[key] === ref) {
  6374. refs[key] = undefined;
  6375. }
  6376. } else {
  6377. if (vnode.data.refInFor) {
  6378. if (!Array.isArray(refs[key])) {
  6379. refs[key] = [ref];
  6380. } else if (refs[key].indexOf(ref) < 0) {
  6381. // $flow-disable-line
  6382. refs[key].push(ref);
  6383. }
  6384. } else {
  6385. refs[key] = ref;
  6386. }
  6387. }
  6388. }
  6389. /**
  6390. * Virtual DOM patching algorithm based on Snabbdom by
  6391. * Simon Friis Vindum (@paldepind)
  6392. * Licensed under the MIT License
  6393. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  6394. *
  6395. * modified by Evan You (@yyx990803)
  6396. *
  6397. * Not type-checking this because this file is perf-critical and the cost
  6398. * of making flow understand it is not worth it.
  6399. */
  6400. var emptyNode = new VNode('', {}, []);
  6401. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  6402. function sameVnode (a, b) {
  6403. return (
  6404. a.key === b.key && (
  6405. (
  6406. a.tag === b.tag &&
  6407. a.isComment === b.isComment &&
  6408. isDef(a.data) === isDef(b.data) &&
  6409. sameInputType(a, b)
  6410. ) || (
  6411. isTrue(a.isAsyncPlaceholder) &&
  6412. a.asyncFactory === b.asyncFactory &&
  6413. isUndef(b.asyncFactory.error)
  6414. )
  6415. )
  6416. )
  6417. }
  6418. function sameInputType (a, b) {
  6419. if (a.tag !== 'input') { return true }
  6420. var i;
  6421. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  6422. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  6423. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  6424. }
  6425. function createKeyToOldIdx (children, beginIdx, endIdx) {
  6426. var i, key;
  6427. var map = {};
  6428. for (i = beginIdx; i <= endIdx; ++i) {
  6429. key = children[i].key;
  6430. if (isDef(key)) { map[key] = i; }
  6431. }
  6432. return map
  6433. }
  6434. function createPatchFunction (backend) {
  6435. var i, j;
  6436. var cbs = {};
  6437. var modules = backend.modules;
  6438. var nodeOps = backend.nodeOps;
  6439. for (i = 0; i < hooks.length; ++i) {
  6440. cbs[hooks[i]] = [];
  6441. for (j = 0; j < modules.length; ++j) {
  6442. if (isDef(modules[j][hooks[i]])) {
  6443. cbs[hooks[i]].push(modules[j][hooks[i]]);
  6444. }
  6445. }
  6446. }
  6447. function emptyNodeAt (elm) {
  6448. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  6449. }
  6450. function createRmCb (childElm, listeners) {
  6451. function remove$$1 () {
  6452. if (--remove$$1.listeners === 0) {
  6453. removeNode(childElm);
  6454. }
  6455. }
  6456. remove$$1.listeners = listeners;
  6457. return remove$$1
  6458. }
  6459. function removeNode (el) {
  6460. var parent = nodeOps.parentNode(el);
  6461. // element may have already been removed due to v-html / v-text
  6462. if (isDef(parent)) {
  6463. nodeOps.removeChild(parent, el);
  6464. }
  6465. }
  6466. function isUnknownElement$$1 (vnode, inVPre) {
  6467. return (
  6468. !inVPre &&
  6469. !vnode.ns &&
  6470. !(
  6471. config.ignoredElements.length &&
  6472. config.ignoredElements.some(function (ignore) {
  6473. return isRegExp(ignore)
  6474. ? ignore.test(vnode.tag)
  6475. : ignore === vnode.tag
  6476. })
  6477. ) &&
  6478. config.isUnknownElement(vnode.tag)
  6479. )
  6480. }
  6481. var creatingElmInVPre = 0;
  6482. function createElm (
  6483. vnode,
  6484. insertedVnodeQueue,
  6485. parentElm,
  6486. refElm,
  6487. nested,
  6488. ownerArray,
  6489. index
  6490. ) {
  6491. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6492. // This vnode was used in a previous render!
  6493. // now it's used as a new node, overwriting its elm would cause
  6494. // potential patch errors down the road when it's used as an insertion
  6495. // reference node. Instead, we clone the node on-demand before creating
  6496. // associated DOM element for it.
  6497. vnode = ownerArray[index] = cloneVNode(vnode);
  6498. }
  6499. vnode.isRootInsert = !nested; // for transition enter check
  6500. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  6501. return
  6502. }
  6503. var data = vnode.data;
  6504. var children = vnode.children;
  6505. var tag = vnode.tag;
  6506. if (isDef(tag)) {
  6507. if (true) {
  6508. if (data && data.pre) {
  6509. creatingElmInVPre++;
  6510. }
  6511. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  6512. warn(
  6513. 'Unknown custom element: <' + tag + '> - did you ' +
  6514. 'register the component correctly? For recursive components, ' +
  6515. 'make sure to provide the "name" option.',
  6516. vnode.context
  6517. );
  6518. }
  6519. }
  6520. vnode.elm = vnode.ns
  6521. ? nodeOps.createElementNS(vnode.ns, tag)
  6522. : nodeOps.createElement(tag, vnode);
  6523. setScope(vnode);
  6524. /* istanbul ignore if */
  6525. {
  6526. createChildren(vnode, children, insertedVnodeQueue);
  6527. if (isDef(data)) {
  6528. invokeCreateHooks(vnode, insertedVnodeQueue);
  6529. }
  6530. insert(parentElm, vnode.elm, refElm);
  6531. }
  6532. if ("development" !== 'production' && data && data.pre) {
  6533. creatingElmInVPre--;
  6534. }
  6535. } else if (isTrue(vnode.isComment)) {
  6536. vnode.elm = nodeOps.createComment(vnode.text);
  6537. insert(parentElm, vnode.elm, refElm);
  6538. } else {
  6539. vnode.elm = nodeOps.createTextNode(vnode.text);
  6540. insert(parentElm, vnode.elm, refElm);
  6541. }
  6542. }
  6543. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  6544. var i = vnode.data;
  6545. if (isDef(i)) {
  6546. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  6547. if (isDef(i = i.hook) && isDef(i = i.init)) {
  6548. i(vnode, false /* hydrating */);
  6549. }
  6550. // after calling the init hook, if the vnode is a child component
  6551. // it should've created a child instance and mounted it. the child
  6552. // component also has set the placeholder vnode's elm.
  6553. // in that case we can just return the element and be done.
  6554. if (isDef(vnode.componentInstance)) {
  6555. initComponent(vnode, insertedVnodeQueue);
  6556. insert(parentElm, vnode.elm, refElm);
  6557. if (isTrue(isReactivated)) {
  6558. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  6559. }
  6560. return true
  6561. }
  6562. }
  6563. }
  6564. function initComponent (vnode, insertedVnodeQueue) {
  6565. if (isDef(vnode.data.pendingInsert)) {
  6566. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  6567. vnode.data.pendingInsert = null;
  6568. }
  6569. vnode.elm = vnode.componentInstance.$el;
  6570. if (isPatchable(vnode)) {
  6571. invokeCreateHooks(vnode, insertedVnodeQueue);
  6572. setScope(vnode);
  6573. } else {
  6574. // empty component root.
  6575. // skip all element-related modules except for ref (#3455)
  6576. registerRef(vnode);
  6577. // make sure to invoke the insert hook
  6578. insertedVnodeQueue.push(vnode);
  6579. }
  6580. }
  6581. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  6582. var i;
  6583. // hack for #4339: a reactivated component with inner transition
  6584. // does not trigger because the inner node's created hooks are not called
  6585. // again. It's not ideal to involve module-specific logic in here but
  6586. // there doesn't seem to be a better way to do it.
  6587. var innerNode = vnode;
  6588. while (innerNode.componentInstance) {
  6589. innerNode = innerNode.componentInstance._vnode;
  6590. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  6591. for (i = 0; i < cbs.activate.length; ++i) {
  6592. cbs.activate[i](emptyNode, innerNode);
  6593. }
  6594. insertedVnodeQueue.push(innerNode);
  6595. break
  6596. }
  6597. }
  6598. // unlike a newly created component,
  6599. // a reactivated keep-alive component doesn't insert itself
  6600. insert(parentElm, vnode.elm, refElm);
  6601. }
  6602. function insert (parent, elm, ref$$1) {
  6603. if (isDef(parent)) {
  6604. if (isDef(ref$$1)) {
  6605. if (nodeOps.parentNode(ref$$1) === parent) {
  6606. nodeOps.insertBefore(parent, elm, ref$$1);
  6607. }
  6608. } else {
  6609. nodeOps.appendChild(parent, elm);
  6610. }
  6611. }
  6612. }
  6613. function createChildren (vnode, children, insertedVnodeQueue) {
  6614. if (Array.isArray(children)) {
  6615. if (true) {
  6616. checkDuplicateKeys(children);
  6617. }
  6618. for (var i = 0; i < children.length; ++i) {
  6619. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  6620. }
  6621. } else if (isPrimitive(vnode.text)) {
  6622. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  6623. }
  6624. }
  6625. function isPatchable (vnode) {
  6626. while (vnode.componentInstance) {
  6627. vnode = vnode.componentInstance._vnode;
  6628. }
  6629. return isDef(vnode.tag)
  6630. }
  6631. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  6632. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  6633. cbs.create[i$1](emptyNode, vnode);
  6634. }
  6635. i = vnode.data.hook; // Reuse variable
  6636. if (isDef(i)) {
  6637. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  6638. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  6639. }
  6640. }
  6641. // set scope id attribute for scoped CSS.
  6642. // this is implemented as a special case to avoid the overhead
  6643. // of going through the normal attribute patching process.
  6644. function setScope (vnode) {
  6645. var i;
  6646. if (isDef(i = vnode.fnScopeId)) {
  6647. nodeOps.setStyleScope(vnode.elm, i);
  6648. } else {
  6649. var ancestor = vnode;
  6650. while (ancestor) {
  6651. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  6652. nodeOps.setStyleScope(vnode.elm, i);
  6653. }
  6654. ancestor = ancestor.parent;
  6655. }
  6656. }
  6657. // for slot content they should also get the scopeId from the host instance.
  6658. if (isDef(i = activeInstance) &&
  6659. i !== vnode.context &&
  6660. i !== vnode.fnContext &&
  6661. isDef(i = i.$options._scopeId)
  6662. ) {
  6663. nodeOps.setStyleScope(vnode.elm, i);
  6664. }
  6665. }
  6666. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  6667. for (; startIdx <= endIdx; ++startIdx) {
  6668. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  6669. }
  6670. }
  6671. function invokeDestroyHook (vnode) {
  6672. var i, j;
  6673. var data = vnode.data;
  6674. if (isDef(data)) {
  6675. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  6676. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  6677. }
  6678. if (isDef(i = vnode.children)) {
  6679. for (j = 0; j < vnode.children.length; ++j) {
  6680. invokeDestroyHook(vnode.children[j]);
  6681. }
  6682. }
  6683. }
  6684. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  6685. for (; startIdx <= endIdx; ++startIdx) {
  6686. var ch = vnodes[startIdx];
  6687. if (isDef(ch)) {
  6688. if (isDef(ch.tag)) {
  6689. removeAndInvokeRemoveHook(ch);
  6690. invokeDestroyHook(ch);
  6691. } else { // Text node
  6692. removeNode(ch.elm);
  6693. }
  6694. }
  6695. }
  6696. }
  6697. function removeAndInvokeRemoveHook (vnode, rm) {
  6698. if (isDef(rm) || isDef(vnode.data)) {
  6699. var i;
  6700. var listeners = cbs.remove.length + 1;
  6701. if (isDef(rm)) {
  6702. // we have a recursively passed down rm callback
  6703. // increase the listeners count
  6704. rm.listeners += listeners;
  6705. } else {
  6706. // directly removing
  6707. rm = createRmCb(vnode.elm, listeners);
  6708. }
  6709. // recursively invoke hooks on child component root node
  6710. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  6711. removeAndInvokeRemoveHook(i, rm);
  6712. }
  6713. for (i = 0; i < cbs.remove.length; ++i) {
  6714. cbs.remove[i](vnode, rm);
  6715. }
  6716. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  6717. i(vnode, rm);
  6718. } else {
  6719. rm();
  6720. }
  6721. } else {
  6722. removeNode(vnode.elm);
  6723. }
  6724. }
  6725. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  6726. var oldStartIdx = 0;
  6727. var newStartIdx = 0;
  6728. var oldEndIdx = oldCh.length - 1;
  6729. var oldStartVnode = oldCh[0];
  6730. var oldEndVnode = oldCh[oldEndIdx];
  6731. var newEndIdx = newCh.length - 1;
  6732. var newStartVnode = newCh[0];
  6733. var newEndVnode = newCh[newEndIdx];
  6734. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  6735. // removeOnly is a special flag used only by <transition-group>
  6736. // to ensure removed elements stay in correct relative positions
  6737. // during leaving transitions
  6738. var canMove = !removeOnly;
  6739. if (true) {
  6740. checkDuplicateKeys(newCh);
  6741. }
  6742. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  6743. if (isUndef(oldStartVnode)) {
  6744. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  6745. } else if (isUndef(oldEndVnode)) {
  6746. oldEndVnode = oldCh[--oldEndIdx];
  6747. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  6748. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6749. oldStartVnode = oldCh[++oldStartIdx];
  6750. newStartVnode = newCh[++newStartIdx];
  6751. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  6752. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6753. oldEndVnode = oldCh[--oldEndIdx];
  6754. newEndVnode = newCh[--newEndIdx];
  6755. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  6756. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6757. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  6758. oldStartVnode = oldCh[++oldStartIdx];
  6759. newEndVnode = newCh[--newEndIdx];
  6760. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  6761. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6762. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  6763. oldEndVnode = oldCh[--oldEndIdx];
  6764. newStartVnode = newCh[++newStartIdx];
  6765. } else {
  6766. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  6767. idxInOld = isDef(newStartVnode.key)
  6768. ? oldKeyToIdx[newStartVnode.key]
  6769. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  6770. if (isUndef(idxInOld)) { // New element
  6771. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6772. } else {
  6773. vnodeToMove = oldCh[idxInOld];
  6774. if (sameVnode(vnodeToMove, newStartVnode)) {
  6775. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6776. oldCh[idxInOld] = undefined;
  6777. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  6778. } else {
  6779. // same key but different element. treat as new element
  6780. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6781. }
  6782. }
  6783. newStartVnode = newCh[++newStartIdx];
  6784. }
  6785. }
  6786. if (oldStartIdx > oldEndIdx) {
  6787. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  6788. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  6789. } else if (newStartIdx > newEndIdx) {
  6790. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  6791. }
  6792. }
  6793. function checkDuplicateKeys (children) {
  6794. var seenKeys = {};
  6795. for (var i = 0; i < children.length; i++) {
  6796. var vnode = children[i];
  6797. var key = vnode.key;
  6798. if (isDef(key)) {
  6799. if (seenKeys[key]) {
  6800. warn(
  6801. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  6802. vnode.context
  6803. );
  6804. } else {
  6805. seenKeys[key] = true;
  6806. }
  6807. }
  6808. }
  6809. }
  6810. function findIdxInOld (node, oldCh, start, end) {
  6811. for (var i = start; i < end; i++) {
  6812. var c = oldCh[i];
  6813. if (isDef(c) && sameVnode(node, c)) { return i }
  6814. }
  6815. }
  6816. function patchVnode (
  6817. oldVnode,
  6818. vnode,
  6819. insertedVnodeQueue,
  6820. ownerArray,
  6821. index,
  6822. removeOnly
  6823. ) {
  6824. if (oldVnode === vnode) {
  6825. return
  6826. }
  6827. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6828. // clone reused vnode
  6829. vnode = ownerArray[index] = cloneVNode(vnode);
  6830. }
  6831. var elm = vnode.elm = oldVnode.elm;
  6832. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  6833. if (isDef(vnode.asyncFactory.resolved)) {
  6834. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  6835. } else {
  6836. vnode.isAsyncPlaceholder = true;
  6837. }
  6838. return
  6839. }
  6840. // reuse element for static trees.
  6841. // note we only do this if the vnode is cloned -
  6842. // if the new node is not cloned it means the render functions have been
  6843. // reset by the hot-reload-api and we need to do a proper re-render.
  6844. if (isTrue(vnode.isStatic) &&
  6845. isTrue(oldVnode.isStatic) &&
  6846. vnode.key === oldVnode.key &&
  6847. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  6848. ) {
  6849. vnode.componentInstance = oldVnode.componentInstance;
  6850. return
  6851. }
  6852. var i;
  6853. var data = vnode.data;
  6854. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  6855. i(oldVnode, vnode);
  6856. }
  6857. var oldCh = oldVnode.children;
  6858. var ch = vnode.children;
  6859. if (isDef(data) && isPatchable(vnode)) {
  6860. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  6861. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  6862. }
  6863. if (isUndef(vnode.text)) {
  6864. if (isDef(oldCh) && isDef(ch)) {
  6865. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  6866. } else if (isDef(ch)) {
  6867. if (true) {
  6868. checkDuplicateKeys(ch);
  6869. }
  6870. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  6871. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  6872. } else if (isDef(oldCh)) {
  6873. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  6874. } else if (isDef(oldVnode.text)) {
  6875. nodeOps.setTextContent(elm, '');
  6876. }
  6877. } else if (oldVnode.text !== vnode.text) {
  6878. nodeOps.setTextContent(elm, vnode.text);
  6879. }
  6880. if (isDef(data)) {
  6881. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  6882. }
  6883. }
  6884. function invokeInsertHook (vnode, queue, initial) {
  6885. // delay insert hooks for component root nodes, invoke them after the
  6886. // element is really inserted
  6887. if (isTrue(initial) && isDef(vnode.parent)) {
  6888. vnode.parent.data.pendingInsert = queue;
  6889. } else {
  6890. for (var i = 0; i < queue.length; ++i) {
  6891. queue[i].data.hook.insert(queue[i]);
  6892. }
  6893. }
  6894. }
  6895. var hydrationBailed = false;
  6896. // list of modules that can skip create hook during hydration because they
  6897. // are already rendered on the client or has no need for initialization
  6898. // Note: style is excluded because it relies on initial clone for future
  6899. // deep updates (#7063).
  6900. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  6901. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  6902. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  6903. var i;
  6904. var tag = vnode.tag;
  6905. var data = vnode.data;
  6906. var children = vnode.children;
  6907. inVPre = inVPre || (data && data.pre);
  6908. vnode.elm = elm;
  6909. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  6910. vnode.isAsyncPlaceholder = true;
  6911. return true
  6912. }
  6913. // assert node match
  6914. if (true) {
  6915. if (!assertNodeMatch(elm, vnode, inVPre)) {
  6916. return false
  6917. }
  6918. }
  6919. if (isDef(data)) {
  6920. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  6921. if (isDef(i = vnode.componentInstance)) {
  6922. // child component. it should have hydrated its own tree.
  6923. initComponent(vnode, insertedVnodeQueue);
  6924. return true
  6925. }
  6926. }
  6927. if (isDef(tag)) {
  6928. if (isDef(children)) {
  6929. // empty element, allow client to pick up and populate children
  6930. if (!elm.hasChildNodes()) {
  6931. createChildren(vnode, children, insertedVnodeQueue);
  6932. } else {
  6933. // v-html and domProps: innerHTML
  6934. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  6935. if (i !== elm.innerHTML) {
  6936. /* istanbul ignore if */
  6937. if ("development" !== 'production' &&
  6938. typeof console !== 'undefined' &&
  6939. !hydrationBailed
  6940. ) {
  6941. hydrationBailed = true;
  6942. console.warn('Parent: ', elm);
  6943. console.warn('server innerHTML: ', i);
  6944. console.warn('client innerHTML: ', elm.innerHTML);
  6945. }
  6946. return false
  6947. }
  6948. } else {
  6949. // iterate and compare children lists
  6950. var childrenMatch = true;
  6951. var childNode = elm.firstChild;
  6952. for (var i$1 = 0; i$1 < children.length; i$1++) {
  6953. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  6954. childrenMatch = false;
  6955. break
  6956. }
  6957. childNode = childNode.nextSibling;
  6958. }
  6959. // if childNode is not null, it means the actual childNodes list is
  6960. // longer than the virtual children list.
  6961. if (!childrenMatch || childNode) {
  6962. /* istanbul ignore if */
  6963. if ("development" !== 'production' &&
  6964. typeof console !== 'undefined' &&
  6965. !hydrationBailed
  6966. ) {
  6967. hydrationBailed = true;
  6968. console.warn('Parent: ', elm);
  6969. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  6970. }
  6971. return false
  6972. }
  6973. }
  6974. }
  6975. }
  6976. if (isDef(data)) {
  6977. var fullInvoke = false;
  6978. for (var key in data) {
  6979. if (!isRenderedModule(key)) {
  6980. fullInvoke = true;
  6981. invokeCreateHooks(vnode, insertedVnodeQueue);
  6982. break
  6983. }
  6984. }
  6985. if (!fullInvoke && data['class']) {
  6986. // ensure collecting deps for deep class bindings for future updates
  6987. traverse(data['class']);
  6988. }
  6989. }
  6990. } else if (elm.data !== vnode.text) {
  6991. elm.data = vnode.text;
  6992. }
  6993. return true
  6994. }
  6995. function assertNodeMatch (node, vnode, inVPre) {
  6996. if (isDef(vnode.tag)) {
  6997. return vnode.tag.indexOf('vue-component') === 0 || (
  6998. !isUnknownElement$$1(vnode, inVPre) &&
  6999. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  7000. )
  7001. } else {
  7002. return node.nodeType === (vnode.isComment ? 8 : 3)
  7003. }
  7004. }
  7005. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  7006. if (isUndef(vnode)) {
  7007. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  7008. return
  7009. }
  7010. var isInitialPatch = false;
  7011. var insertedVnodeQueue = [];
  7012. if (isUndef(oldVnode)) {
  7013. // empty mount (likely as component), create new root element
  7014. isInitialPatch = true;
  7015. createElm(vnode, insertedVnodeQueue);
  7016. } else {
  7017. var isRealElement = isDef(oldVnode.nodeType);
  7018. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  7019. // patch existing root node
  7020. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  7021. } else {
  7022. if (isRealElement) {
  7023. // mounting to a real element
  7024. // check if this is server-rendered content and if we can perform
  7025. // a successful hydration.
  7026. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  7027. oldVnode.removeAttribute(SSR_ATTR);
  7028. hydrating = true;
  7029. }
  7030. if (isTrue(hydrating)) {
  7031. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  7032. invokeInsertHook(vnode, insertedVnodeQueue, true);
  7033. return oldVnode
  7034. } else if (true) {
  7035. warn(
  7036. 'The client-side rendered virtual DOM tree is not matching ' +
  7037. 'server-rendered content. This is likely caused by incorrect ' +
  7038. 'HTML markup, for example nesting block-level elements inside ' +
  7039. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  7040. 'full client-side render.'
  7041. );
  7042. }
  7043. }
  7044. // either not server-rendered, or hydration failed.
  7045. // create an empty node and replace it
  7046. oldVnode = emptyNodeAt(oldVnode);
  7047. }
  7048. // replacing existing element
  7049. var oldElm = oldVnode.elm;
  7050. var parentElm = nodeOps.parentNode(oldElm);
  7051. // create new node
  7052. createElm(
  7053. vnode,
  7054. insertedVnodeQueue,
  7055. // extremely rare edge case: do not insert if old element is in a
  7056. // leaving transition. Only happens when combining transition +
  7057. // keep-alive + HOCs. (#4590)
  7058. oldElm._leaveCb ? null : parentElm,
  7059. nodeOps.nextSibling(oldElm)
  7060. );
  7061. // update parent placeholder node element, recursively
  7062. if (isDef(vnode.parent)) {
  7063. var ancestor = vnode.parent;
  7064. var patchable = isPatchable(vnode);
  7065. while (ancestor) {
  7066. for (var i = 0; i < cbs.destroy.length; ++i) {
  7067. cbs.destroy[i](ancestor);
  7068. }
  7069. ancestor.elm = vnode.elm;
  7070. if (patchable) {
  7071. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  7072. cbs.create[i$1](emptyNode, ancestor);
  7073. }
  7074. // #6513
  7075. // invoke insert hooks that may have been merged by create hooks.
  7076. // e.g. for directives that uses the "inserted" hook.
  7077. var insert = ancestor.data.hook.insert;
  7078. if (insert.merged) {
  7079. // start at index 1 to avoid re-invoking component mounted hook
  7080. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  7081. insert.fns[i$2]();
  7082. }
  7083. }
  7084. } else {
  7085. registerRef(ancestor);
  7086. }
  7087. ancestor = ancestor.parent;
  7088. }
  7089. }
  7090. // destroy old node
  7091. if (isDef(parentElm)) {
  7092. removeVnodes(parentElm, [oldVnode], 0, 0);
  7093. } else if (isDef(oldVnode.tag)) {
  7094. invokeDestroyHook(oldVnode);
  7095. }
  7096. }
  7097. }
  7098. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  7099. return vnode.elm
  7100. }
  7101. }
  7102. /* */
  7103. var directives = {
  7104. create: updateDirectives,
  7105. update: updateDirectives,
  7106. destroy: function unbindDirectives (vnode) {
  7107. updateDirectives(vnode, emptyNode);
  7108. }
  7109. };
  7110. function updateDirectives (oldVnode, vnode) {
  7111. if (oldVnode.data.directives || vnode.data.directives) {
  7112. _update(oldVnode, vnode);
  7113. }
  7114. }
  7115. function _update (oldVnode, vnode) {
  7116. var isCreate = oldVnode === emptyNode;
  7117. var isDestroy = vnode === emptyNode;
  7118. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  7119. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  7120. var dirsWithInsert = [];
  7121. var dirsWithPostpatch = [];
  7122. var key, oldDir, dir;
  7123. for (key in newDirs) {
  7124. oldDir = oldDirs[key];
  7125. dir = newDirs[key];
  7126. if (!oldDir) {
  7127. // new directive, bind
  7128. callHook$1(dir, 'bind', vnode, oldVnode);
  7129. if (dir.def && dir.def.inserted) {
  7130. dirsWithInsert.push(dir);
  7131. }
  7132. } else {
  7133. // existing directive, update
  7134. dir.oldValue = oldDir.value;
  7135. callHook$1(dir, 'update', vnode, oldVnode);
  7136. if (dir.def && dir.def.componentUpdated) {
  7137. dirsWithPostpatch.push(dir);
  7138. }
  7139. }
  7140. }
  7141. if (dirsWithInsert.length) {
  7142. var callInsert = function () {
  7143. for (var i = 0; i < dirsWithInsert.length; i++) {
  7144. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  7145. }
  7146. };
  7147. if (isCreate) {
  7148. mergeVNodeHook(vnode, 'insert', callInsert);
  7149. } else {
  7150. callInsert();
  7151. }
  7152. }
  7153. if (dirsWithPostpatch.length) {
  7154. mergeVNodeHook(vnode, 'postpatch', function () {
  7155. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  7156. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  7157. }
  7158. });
  7159. }
  7160. if (!isCreate) {
  7161. for (key in oldDirs) {
  7162. if (!newDirs[key]) {
  7163. // no longer present, unbind
  7164. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  7165. }
  7166. }
  7167. }
  7168. }
  7169. var emptyModifiers = Object.create(null);
  7170. function normalizeDirectives$1 (
  7171. dirs,
  7172. vm
  7173. ) {
  7174. var res = Object.create(null);
  7175. if (!dirs) {
  7176. // $flow-disable-line
  7177. return res
  7178. }
  7179. var i, dir;
  7180. for (i = 0; i < dirs.length; i++) {
  7181. dir = dirs[i];
  7182. if (!dir.modifiers) {
  7183. // $flow-disable-line
  7184. dir.modifiers = emptyModifiers;
  7185. }
  7186. res[getRawDirName(dir)] = dir;
  7187. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  7188. }
  7189. // $flow-disable-line
  7190. return res
  7191. }
  7192. function getRawDirName (dir) {
  7193. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  7194. }
  7195. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  7196. var fn = dir.def && dir.def[hook];
  7197. if (fn) {
  7198. try {
  7199. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  7200. } catch (e) {
  7201. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  7202. }
  7203. }
  7204. }
  7205. var baseModules = [
  7206. ref,
  7207. directives
  7208. ];
  7209. /* */
  7210. function updateAttrs (oldVnode, vnode) {
  7211. var opts = vnode.componentOptions;
  7212. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  7213. return
  7214. }
  7215. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  7216. return
  7217. }
  7218. var key, cur, old;
  7219. var elm = vnode.elm;
  7220. var oldAttrs = oldVnode.data.attrs || {};
  7221. var attrs = vnode.data.attrs || {};
  7222. // clone observed objects, as the user probably wants to mutate it
  7223. if (isDef(attrs.__ob__)) {
  7224. attrs = vnode.data.attrs = extend({}, attrs);
  7225. }
  7226. for (key in attrs) {
  7227. cur = attrs[key];
  7228. old = oldAttrs[key];
  7229. if (old !== cur) {
  7230. setAttr(elm, key, cur);
  7231. }
  7232. }
  7233. // #4391: in IE9, setting type can reset value for input[type=radio]
  7234. // #6666: IE/Edge forces progress value down to 1 before setting a max
  7235. /* istanbul ignore if */
  7236. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  7237. setAttr(elm, 'value', attrs.value);
  7238. }
  7239. for (key in oldAttrs) {
  7240. if (isUndef(attrs[key])) {
  7241. if (isXlink(key)) {
  7242. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7243. } else if (!isEnumeratedAttr(key)) {
  7244. elm.removeAttribute(key);
  7245. }
  7246. }
  7247. }
  7248. }
  7249. function setAttr (el, key, value) {
  7250. if (el.tagName.indexOf('-') > -1) {
  7251. baseSetAttr(el, key, value);
  7252. } else if (isBooleanAttr(key)) {
  7253. // set attribute for blank value
  7254. // e.g. <option disabled>Select one</option>
  7255. if (isFalsyAttrValue(value)) {
  7256. el.removeAttribute(key);
  7257. } else {
  7258. // technically allowfullscreen is a boolean attribute for <iframe>,
  7259. // but Flash expects a value of "true" when used on <embed> tag
  7260. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  7261. ? 'true'
  7262. : key;
  7263. el.setAttribute(key, value);
  7264. }
  7265. } else if (isEnumeratedAttr(key)) {
  7266. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  7267. } else if (isXlink(key)) {
  7268. if (isFalsyAttrValue(value)) {
  7269. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7270. } else {
  7271. el.setAttributeNS(xlinkNS, key, value);
  7272. }
  7273. } else {
  7274. baseSetAttr(el, key, value);
  7275. }
  7276. }
  7277. function baseSetAttr (el, key, value) {
  7278. if (isFalsyAttrValue(value)) {
  7279. el.removeAttribute(key);
  7280. } else {
  7281. // #7138: IE10 & 11 fires input event when setting placeholder on
  7282. // <textarea>... block the first input event and remove the blocker
  7283. // immediately.
  7284. /* istanbul ignore if */
  7285. if (
  7286. isIE && !isIE9 &&
  7287. (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') &&
  7288. key === 'placeholder' && !el.__ieph
  7289. ) {
  7290. var blocker = function (e) {
  7291. e.stopImmediatePropagation();
  7292. el.removeEventListener('input', blocker);
  7293. };
  7294. el.addEventListener('input', blocker);
  7295. // $flow-disable-line
  7296. el.__ieph = true; /* IE placeholder patched */
  7297. }
  7298. el.setAttribute(key, value);
  7299. }
  7300. }
  7301. var attrs = {
  7302. create: updateAttrs,
  7303. update: updateAttrs
  7304. };
  7305. /* */
  7306. function updateClass (oldVnode, vnode) {
  7307. var el = vnode.elm;
  7308. var data = vnode.data;
  7309. var oldData = oldVnode.data;
  7310. if (
  7311. isUndef(data.staticClass) &&
  7312. isUndef(data.class) && (
  7313. isUndef(oldData) || (
  7314. isUndef(oldData.staticClass) &&
  7315. isUndef(oldData.class)
  7316. )
  7317. )
  7318. ) {
  7319. return
  7320. }
  7321. var cls = genClassForVnode(vnode);
  7322. // handle transition classes
  7323. var transitionClass = el._transitionClasses;
  7324. if (isDef(transitionClass)) {
  7325. cls = concat(cls, stringifyClass(transitionClass));
  7326. }
  7327. // set the class
  7328. if (cls !== el._prevClass) {
  7329. el.setAttribute('class', cls);
  7330. el._prevClass = cls;
  7331. }
  7332. }
  7333. var klass = {
  7334. create: updateClass,
  7335. update: updateClass
  7336. };
  7337. /* */
  7338. var validDivisionCharRE = /[\w).+\-_$\]]/;
  7339. function parseFilters (exp) {
  7340. var inSingle = false;
  7341. var inDouble = false;
  7342. var inTemplateString = false;
  7343. var inRegex = false;
  7344. var curly = 0;
  7345. var square = 0;
  7346. var paren = 0;
  7347. var lastFilterIndex = 0;
  7348. var c, prev, i, expression, filters;
  7349. for (i = 0; i < exp.length; i++) {
  7350. prev = c;
  7351. c = exp.charCodeAt(i);
  7352. if (inSingle) {
  7353. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  7354. } else if (inDouble) {
  7355. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  7356. } else if (inTemplateString) {
  7357. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  7358. } else if (inRegex) {
  7359. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  7360. } else if (
  7361. c === 0x7C && // pipe
  7362. exp.charCodeAt(i + 1) !== 0x7C &&
  7363. exp.charCodeAt(i - 1) !== 0x7C &&
  7364. !curly && !square && !paren
  7365. ) {
  7366. if (expression === undefined) {
  7367. // first filter, end of expression
  7368. lastFilterIndex = i + 1;
  7369. expression = exp.slice(0, i).trim();
  7370. } else {
  7371. pushFilter();
  7372. }
  7373. } else {
  7374. switch (c) {
  7375. case 0x22: inDouble = true; break // "
  7376. case 0x27: inSingle = true; break // '
  7377. case 0x60: inTemplateString = true; break // `
  7378. case 0x28: paren++; break // (
  7379. case 0x29: paren--; break // )
  7380. case 0x5B: square++; break // [
  7381. case 0x5D: square--; break // ]
  7382. case 0x7B: curly++; break // {
  7383. case 0x7D: curly--; break // }
  7384. }
  7385. if (c === 0x2f) { // /
  7386. var j = i - 1;
  7387. var p = (void 0);
  7388. // find first non-whitespace prev char
  7389. for (; j >= 0; j--) {
  7390. p = exp.charAt(j);
  7391. if (p !== ' ') { break }
  7392. }
  7393. if (!p || !validDivisionCharRE.test(p)) {
  7394. inRegex = true;
  7395. }
  7396. }
  7397. }
  7398. }
  7399. if (expression === undefined) {
  7400. expression = exp.slice(0, i).trim();
  7401. } else if (lastFilterIndex !== 0) {
  7402. pushFilter();
  7403. }
  7404. function pushFilter () {
  7405. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  7406. lastFilterIndex = i + 1;
  7407. }
  7408. if (filters) {
  7409. for (i = 0; i < filters.length; i++) {
  7410. expression = wrapFilter(expression, filters[i]);
  7411. }
  7412. }
  7413. return expression
  7414. }
  7415. function wrapFilter (exp, filter) {
  7416. var i = filter.indexOf('(');
  7417. if (i < 0) {
  7418. // _f: resolveFilter
  7419. return ("_f(\"" + filter + "\")(" + exp + ")")
  7420. } else {
  7421. var name = filter.slice(0, i);
  7422. var args = filter.slice(i + 1);
  7423. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  7424. }
  7425. }
  7426. /* */
  7427. function baseWarn (msg) {
  7428. console.error(("[Vue compiler]: " + msg));
  7429. }
  7430. function pluckModuleFunction (
  7431. modules,
  7432. key
  7433. ) {
  7434. return modules
  7435. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  7436. : []
  7437. }
  7438. function addProp (el, name, value) {
  7439. (el.props || (el.props = [])).push({ name: name, value: value });
  7440. el.plain = false;
  7441. }
  7442. function addAttr (el, name, value) {
  7443. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  7444. el.plain = false;
  7445. }
  7446. // add a raw attr (use this in preTransforms)
  7447. function addRawAttr (el, name, value) {
  7448. el.attrsMap[name] = value;
  7449. el.attrsList.push({ name: name, value: value });
  7450. }
  7451. function addDirective (
  7452. el,
  7453. name,
  7454. rawName,
  7455. value,
  7456. arg,
  7457. modifiers
  7458. ) {
  7459. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  7460. el.plain = false;
  7461. }
  7462. function addHandler (
  7463. el,
  7464. name,
  7465. value,
  7466. modifiers,
  7467. important,
  7468. warn
  7469. ) {
  7470. modifiers = modifiers || emptyObject;
  7471. // warn prevent and passive modifier
  7472. /* istanbul ignore if */
  7473. if (
  7474. "development" !== 'production' && warn &&
  7475. modifiers.prevent && modifiers.passive
  7476. ) {
  7477. warn(
  7478. 'passive and prevent can\'t be used together. ' +
  7479. 'Passive handler can\'t prevent default event.'
  7480. );
  7481. }
  7482. // normalize click.right and click.middle since they don't actually fire
  7483. // this is technically browser-specific, but at least for now browsers are
  7484. // the only target envs that have right/middle clicks.
  7485. if (name === 'click') {
  7486. if (modifiers.right) {
  7487. name = 'contextmenu';
  7488. delete modifiers.right;
  7489. } else if (modifiers.middle) {
  7490. name = 'mouseup';
  7491. }
  7492. }
  7493. // check capture modifier
  7494. if (modifiers.capture) {
  7495. delete modifiers.capture;
  7496. name = '!' + name; // mark the event as captured
  7497. }
  7498. if (modifiers.once) {
  7499. delete modifiers.once;
  7500. name = '~' + name; // mark the event as once
  7501. }
  7502. /* istanbul ignore if */
  7503. if (modifiers.passive) {
  7504. delete modifiers.passive;
  7505. name = '&' + name; // mark the event as passive
  7506. }
  7507. var events;
  7508. if (modifiers.native) {
  7509. delete modifiers.native;
  7510. events = el.nativeEvents || (el.nativeEvents = {});
  7511. } else {
  7512. events = el.events || (el.events = {});
  7513. }
  7514. var newHandler = {
  7515. value: value.trim()
  7516. };
  7517. if (modifiers !== emptyObject) {
  7518. newHandler.modifiers = modifiers;
  7519. }
  7520. var handlers = events[name];
  7521. /* istanbul ignore if */
  7522. if (Array.isArray(handlers)) {
  7523. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  7524. } else if (handlers) {
  7525. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  7526. } else {
  7527. events[name] = newHandler;
  7528. }
  7529. el.plain = false;
  7530. }
  7531. function getBindingAttr (
  7532. el,
  7533. name,
  7534. getStatic
  7535. ) {
  7536. var dynamicValue =
  7537. getAndRemoveAttr(el, ':' + name) ||
  7538. getAndRemoveAttr(el, 'v-bind:' + name);
  7539. if (dynamicValue != null) {
  7540. return parseFilters(dynamicValue)
  7541. } else if (getStatic !== false) {
  7542. var staticValue = getAndRemoveAttr(el, name);
  7543. if (staticValue != null) {
  7544. return JSON.stringify(staticValue)
  7545. }
  7546. }
  7547. }
  7548. // note: this only removes the attr from the Array (attrsList) so that it
  7549. // doesn't get processed by processAttrs.
  7550. // By default it does NOT remove it from the map (attrsMap) because the map is
  7551. // needed during codegen.
  7552. function getAndRemoveAttr (
  7553. el,
  7554. name,
  7555. removeFromMap
  7556. ) {
  7557. var val;
  7558. if ((val = el.attrsMap[name]) != null) {
  7559. var list = el.attrsList;
  7560. for (var i = 0, l = list.length; i < l; i++) {
  7561. if (list[i].name === name) {
  7562. list.splice(i, 1);
  7563. break
  7564. }
  7565. }
  7566. }
  7567. if (removeFromMap) {
  7568. delete el.attrsMap[name];
  7569. }
  7570. return val
  7571. }
  7572. /* */
  7573. /**
  7574. * Cross-platform code generation for component v-model
  7575. */
  7576. function genComponentModel (
  7577. el,
  7578. value,
  7579. modifiers
  7580. ) {
  7581. var ref = modifiers || {};
  7582. var number = ref.number;
  7583. var trim = ref.trim;
  7584. var baseValueExpression = '$$v';
  7585. var valueExpression = baseValueExpression;
  7586. if (trim) {
  7587. valueExpression =
  7588. "(typeof " + baseValueExpression + " === 'string'" +
  7589. "? " + baseValueExpression + ".trim()" +
  7590. ": " + baseValueExpression + ")";
  7591. }
  7592. if (number) {
  7593. valueExpression = "_n(" + valueExpression + ")";
  7594. }
  7595. var assignment = genAssignmentCode(value, valueExpression);
  7596. el.model = {
  7597. value: ("(" + value + ")"),
  7598. expression: JSON.stringify(value),
  7599. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  7600. };
  7601. }
  7602. /**
  7603. * Cross-platform codegen helper for generating v-model value assignment code.
  7604. */
  7605. function genAssignmentCode (
  7606. value,
  7607. assignment
  7608. ) {
  7609. var res = parseModel(value);
  7610. if (res.key === null) {
  7611. return (value + "=" + assignment)
  7612. } else {
  7613. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  7614. }
  7615. }
  7616. /**
  7617. * Parse a v-model expression into a base path and a final key segment.
  7618. * Handles both dot-path and possible square brackets.
  7619. *
  7620. * Possible cases:
  7621. *
  7622. * - test
  7623. * - test[key]
  7624. * - test[test1[key]]
  7625. * - test["a"][key]
  7626. * - xxx.test[a[a].test1[key]]
  7627. * - test.xxx.a["asa"][test1[key]]
  7628. *
  7629. */
  7630. var len, str, chr, index$1, expressionPos, expressionEndPos;
  7631. function parseModel (val) {
  7632. // Fix https://github.com/vuejs/vue/pull/7730
  7633. // allow v-model="obj.val " (trailing whitespace)
  7634. val = val.trim();
  7635. len = val.length;
  7636. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  7637. index$1 = val.lastIndexOf('.');
  7638. if (index$1 > -1) {
  7639. return {
  7640. exp: val.slice(0, index$1),
  7641. key: '"' + val.slice(index$1 + 1) + '"'
  7642. }
  7643. } else {
  7644. return {
  7645. exp: val,
  7646. key: null
  7647. }
  7648. }
  7649. }
  7650. str = val;
  7651. index$1 = expressionPos = expressionEndPos = 0;
  7652. while (!eof()) {
  7653. chr = next();
  7654. /* istanbul ignore if */
  7655. if (isStringStart(chr)) {
  7656. parseString(chr);
  7657. } else if (chr === 0x5B) {
  7658. parseBracket(chr);
  7659. }
  7660. }
  7661. return {
  7662. exp: val.slice(0, expressionPos),
  7663. key: val.slice(expressionPos + 1, expressionEndPos)
  7664. }
  7665. }
  7666. function next () {
  7667. return str.charCodeAt(++index$1)
  7668. }
  7669. function eof () {
  7670. return index$1 >= len
  7671. }
  7672. function isStringStart (chr) {
  7673. return chr === 0x22 || chr === 0x27
  7674. }
  7675. function parseBracket (chr) {
  7676. var inBracket = 1;
  7677. expressionPos = index$1;
  7678. while (!eof()) {
  7679. chr = next();
  7680. if (isStringStart(chr)) {
  7681. parseString(chr);
  7682. continue
  7683. }
  7684. if (chr === 0x5B) { inBracket++; }
  7685. if (chr === 0x5D) { inBracket--; }
  7686. if (inBracket === 0) {
  7687. expressionEndPos = index$1;
  7688. break
  7689. }
  7690. }
  7691. }
  7692. function parseString (chr) {
  7693. var stringQuote = chr;
  7694. while (!eof()) {
  7695. chr = next();
  7696. if (chr === stringQuote) {
  7697. break
  7698. }
  7699. }
  7700. }
  7701. /* */
  7702. var warn$1;
  7703. // in some cases, the event used has to be determined at runtime
  7704. // so we used some reserved tokens during compile.
  7705. var RANGE_TOKEN = '__r';
  7706. var CHECKBOX_RADIO_TOKEN = '__c';
  7707. function model (
  7708. el,
  7709. dir,
  7710. _warn
  7711. ) {
  7712. warn$1 = _warn;
  7713. var value = dir.value;
  7714. var modifiers = dir.modifiers;
  7715. var tag = el.tag;
  7716. var type = el.attrsMap.type;
  7717. if (true) {
  7718. // inputs with type="file" are read only and setting the input's
  7719. // value will throw an error.
  7720. if (tag === 'input' && type === 'file') {
  7721. warn$1(
  7722. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  7723. "File inputs are read only. Use a v-on:change listener instead."
  7724. );
  7725. }
  7726. }
  7727. if (el.component) {
  7728. genComponentModel(el, value, modifiers);
  7729. // component v-model doesn't need extra runtime
  7730. return false
  7731. } else if (tag === 'select') {
  7732. genSelect(el, value, modifiers);
  7733. } else if (tag === 'input' && type === 'checkbox') {
  7734. genCheckboxModel(el, value, modifiers);
  7735. } else if (tag === 'input' && type === 'radio') {
  7736. genRadioModel(el, value, modifiers);
  7737. } else if (tag === 'input' || tag === 'textarea') {
  7738. genDefaultModel(el, value, modifiers);
  7739. } else if (!config.isReservedTag(tag)) {
  7740. genComponentModel(el, value, modifiers);
  7741. // component v-model doesn't need extra runtime
  7742. return false
  7743. } else if (true) {
  7744. warn$1(
  7745. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  7746. "v-model is not supported on this element type. " +
  7747. 'If you are working with contenteditable, it\'s recommended to ' +
  7748. 'wrap a library dedicated for that purpose inside a custom component.'
  7749. );
  7750. }
  7751. // ensure runtime directive metadata
  7752. return true
  7753. }
  7754. function genCheckboxModel (
  7755. el,
  7756. value,
  7757. modifiers
  7758. ) {
  7759. var number = modifiers && modifiers.number;
  7760. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7761. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  7762. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  7763. addProp(el, 'checked',
  7764. "Array.isArray(" + value + ")" +
  7765. "?_i(" + value + "," + valueBinding + ")>-1" + (
  7766. trueValueBinding === 'true'
  7767. ? (":(" + value + ")")
  7768. : (":_q(" + value + "," + trueValueBinding + ")")
  7769. )
  7770. );
  7771. addHandler(el, 'change',
  7772. "var $$a=" + value + "," +
  7773. '$$el=$event.target,' +
  7774. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  7775. 'if(Array.isArray($$a)){' +
  7776. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  7777. '$$i=_i($$a,$$v);' +
  7778. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  7779. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  7780. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  7781. null, true
  7782. );
  7783. }
  7784. function genRadioModel (
  7785. el,
  7786. value,
  7787. modifiers
  7788. ) {
  7789. var number = modifiers && modifiers.number;
  7790. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7791. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  7792. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  7793. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  7794. }
  7795. function genSelect (
  7796. el,
  7797. value,
  7798. modifiers
  7799. ) {
  7800. var number = modifiers && modifiers.number;
  7801. var selectedVal = "Array.prototype.filter" +
  7802. ".call($event.target.options,function(o){return o.selected})" +
  7803. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  7804. "return " + (number ? '_n(val)' : 'val') + "})";
  7805. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  7806. var code = "var $$selectedVal = " + selectedVal + ";";
  7807. code = code + " " + (genAssignmentCode(value, assignment));
  7808. addHandler(el, 'change', code, null, true);
  7809. }
  7810. function genDefaultModel (
  7811. el,
  7812. value,
  7813. modifiers
  7814. ) {
  7815. var type = el.attrsMap.type;
  7816. // warn if v-bind:value conflicts with v-model
  7817. // except for inputs with v-bind:type
  7818. if (true) {
  7819. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  7820. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7821. if (value$1 && !typeBinding) {
  7822. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  7823. warn$1(
  7824. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  7825. 'because the latter already expands to a value binding internally'
  7826. );
  7827. }
  7828. }
  7829. var ref = modifiers || {};
  7830. var lazy = ref.lazy;
  7831. var number = ref.number;
  7832. var trim = ref.trim;
  7833. var needCompositionGuard = !lazy && type !== 'range';
  7834. var event = lazy
  7835. ? 'change'
  7836. : type === 'range'
  7837. ? RANGE_TOKEN
  7838. : 'input';
  7839. var valueExpression = '$event.target.value';
  7840. if (trim) {
  7841. valueExpression = "$event.target.value.trim()";
  7842. }
  7843. if (number) {
  7844. valueExpression = "_n(" + valueExpression + ")";
  7845. }
  7846. var code = genAssignmentCode(value, valueExpression);
  7847. if (needCompositionGuard) {
  7848. code = "if($event.target.composing)return;" + code;
  7849. }
  7850. addProp(el, 'value', ("(" + value + ")"));
  7851. addHandler(el, event, code, null, true);
  7852. if (trim || number) {
  7853. addHandler(el, 'blur', '$forceUpdate()');
  7854. }
  7855. }
  7856. /* */
  7857. // normalize v-model event tokens that can only be determined at runtime.
  7858. // it's important to place the event as the first in the array because
  7859. // the whole point is ensuring the v-model callback gets called before
  7860. // user-attached handlers.
  7861. function normalizeEvents (on) {
  7862. /* istanbul ignore if */
  7863. if (isDef(on[RANGE_TOKEN])) {
  7864. // IE input[type=range] only supports `change` event
  7865. var event = isIE ? 'change' : 'input';
  7866. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  7867. delete on[RANGE_TOKEN];
  7868. }
  7869. // This was originally intended to fix #4521 but no longer necessary
  7870. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  7871. /* istanbul ignore if */
  7872. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  7873. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  7874. delete on[CHECKBOX_RADIO_TOKEN];
  7875. }
  7876. }
  7877. var target$1;
  7878. function createOnceHandler$1 (event, handler, capture) {
  7879. var _target = target$1; // save current target element in closure
  7880. return function onceHandler () {
  7881. var res = handler.apply(null, arguments);
  7882. if (res !== null) {
  7883. remove$2(event, onceHandler, capture, _target);
  7884. }
  7885. }
  7886. }
  7887. function add$1 (
  7888. event,
  7889. handler,
  7890. capture,
  7891. passive
  7892. ) {
  7893. handler = withMacroTask(handler);
  7894. target$1.addEventListener(
  7895. event,
  7896. handler,
  7897. supportsPassive
  7898. ? { capture: capture, passive: passive }
  7899. : capture
  7900. );
  7901. }
  7902. function remove$2 (
  7903. event,
  7904. handler,
  7905. capture,
  7906. _target
  7907. ) {
  7908. (_target || target$1).removeEventListener(
  7909. event,
  7910. handler._withTask || handler,
  7911. capture
  7912. );
  7913. }
  7914. function updateDOMListeners (oldVnode, vnode) {
  7915. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  7916. return
  7917. }
  7918. var on = vnode.data.on || {};
  7919. var oldOn = oldVnode.data.on || {};
  7920. target$1 = vnode.elm;
  7921. normalizeEvents(on);
  7922. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  7923. target$1 = undefined;
  7924. }
  7925. var events = {
  7926. create: updateDOMListeners,
  7927. update: updateDOMListeners
  7928. };
  7929. /* */
  7930. function updateDOMProps (oldVnode, vnode) {
  7931. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  7932. return
  7933. }
  7934. var key, cur;
  7935. var elm = vnode.elm;
  7936. var oldProps = oldVnode.data.domProps || {};
  7937. var props = vnode.data.domProps || {};
  7938. // clone observed objects, as the user probably wants to mutate it
  7939. if (isDef(props.__ob__)) {
  7940. props = vnode.data.domProps = extend({}, props);
  7941. }
  7942. for (key in oldProps) {
  7943. if (isUndef(props[key])) {
  7944. elm[key] = '';
  7945. }
  7946. }
  7947. for (key in props) {
  7948. cur = props[key];
  7949. // ignore children if the node has textContent or innerHTML,
  7950. // as these will throw away existing DOM nodes and cause removal errors
  7951. // on subsequent patches (#3360)
  7952. if (key === 'textContent' || key === 'innerHTML') {
  7953. if (vnode.children) { vnode.children.length = 0; }
  7954. if (cur === oldProps[key]) { continue }
  7955. // #6601 work around Chrome version <= 55 bug where single textNode
  7956. // replaced by innerHTML/textContent retains its parentNode property
  7957. if (elm.childNodes.length === 1) {
  7958. elm.removeChild(elm.childNodes[0]);
  7959. }
  7960. }
  7961. if (key === 'value') {
  7962. // store value as _value as well since
  7963. // non-string values will be stringified
  7964. elm._value = cur;
  7965. // avoid resetting cursor position when value is the same
  7966. var strCur = isUndef(cur) ? '' : String(cur);
  7967. if (shouldUpdateValue(elm, strCur)) {
  7968. elm.value = strCur;
  7969. }
  7970. } else {
  7971. elm[key] = cur;
  7972. }
  7973. }
  7974. }
  7975. // check platforms/web/util/attrs.js acceptValue
  7976. function shouldUpdateValue (elm, checkVal) {
  7977. return (!elm.composing && (
  7978. elm.tagName === 'OPTION' ||
  7979. isNotInFocusAndDirty(elm, checkVal) ||
  7980. isDirtyWithModifiers(elm, checkVal)
  7981. ))
  7982. }
  7983. function isNotInFocusAndDirty (elm, checkVal) {
  7984. // return true when textbox (.number and .trim) loses focus and its value is
  7985. // not equal to the updated value
  7986. var notInFocus = true;
  7987. // #6157
  7988. // work around IE bug when accessing document.activeElement in an iframe
  7989. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  7990. return notInFocus && elm.value !== checkVal
  7991. }
  7992. function isDirtyWithModifiers (elm, newVal) {
  7993. var value = elm.value;
  7994. var modifiers = elm._vModifiers; // injected by v-model runtime
  7995. if (isDef(modifiers)) {
  7996. if (modifiers.lazy) {
  7997. // inputs with lazy should only be updated when not in focus
  7998. return false
  7999. }
  8000. if (modifiers.number) {
  8001. return toNumber(value) !== toNumber(newVal)
  8002. }
  8003. if (modifiers.trim) {
  8004. return value.trim() !== newVal.trim()
  8005. }
  8006. }
  8007. return value !== newVal
  8008. }
  8009. var domProps = {
  8010. create: updateDOMProps,
  8011. update: updateDOMProps
  8012. };
  8013. /* */
  8014. var parseStyleText = cached(function (cssText) {
  8015. var res = {};
  8016. var listDelimiter = /;(?![^(]*\))/g;
  8017. var propertyDelimiter = /:(.+)/;
  8018. cssText.split(listDelimiter).forEach(function (item) {
  8019. if (item) {
  8020. var tmp = item.split(propertyDelimiter);
  8021. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8022. }
  8023. });
  8024. return res
  8025. });
  8026. // merge static and dynamic style data on the same vnode
  8027. function normalizeStyleData (data) {
  8028. var style = normalizeStyleBinding(data.style);
  8029. // static style is pre-processed into an object during compilation
  8030. // and is always a fresh object, so it's safe to merge into it
  8031. return data.staticStyle
  8032. ? extend(data.staticStyle, style)
  8033. : style
  8034. }
  8035. // normalize possible array / string values into Object
  8036. function normalizeStyleBinding (bindingStyle) {
  8037. if (Array.isArray(bindingStyle)) {
  8038. return toObject(bindingStyle)
  8039. }
  8040. if (typeof bindingStyle === 'string') {
  8041. return parseStyleText(bindingStyle)
  8042. }
  8043. return bindingStyle
  8044. }
  8045. /**
  8046. * parent component style should be after child's
  8047. * so that parent component's style could override it
  8048. */
  8049. function getStyle (vnode, checkChild) {
  8050. var res = {};
  8051. var styleData;
  8052. if (checkChild) {
  8053. var childNode = vnode;
  8054. while (childNode.componentInstance) {
  8055. childNode = childNode.componentInstance._vnode;
  8056. if (
  8057. childNode && childNode.data &&
  8058. (styleData = normalizeStyleData(childNode.data))
  8059. ) {
  8060. extend(res, styleData);
  8061. }
  8062. }
  8063. }
  8064. if ((styleData = normalizeStyleData(vnode.data))) {
  8065. extend(res, styleData);
  8066. }
  8067. var parentNode = vnode;
  8068. while ((parentNode = parentNode.parent)) {
  8069. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  8070. extend(res, styleData);
  8071. }
  8072. }
  8073. return res
  8074. }
  8075. /* */
  8076. var cssVarRE = /^--/;
  8077. var importantRE = /\s*!important$/;
  8078. var setProp = function (el, name, val) {
  8079. /* istanbul ignore if */
  8080. if (cssVarRE.test(name)) {
  8081. el.style.setProperty(name, val);
  8082. } else if (importantRE.test(val)) {
  8083. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  8084. } else {
  8085. var normalizedName = normalize(name);
  8086. if (Array.isArray(val)) {
  8087. // Support values array created by autoprefixer, e.g.
  8088. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  8089. // Set them one by one, and the browser will only set those it can recognize
  8090. for (var i = 0, len = val.length; i < len; i++) {
  8091. el.style[normalizedName] = val[i];
  8092. }
  8093. } else {
  8094. el.style[normalizedName] = val;
  8095. }
  8096. }
  8097. };
  8098. var vendorNames = ['Webkit', 'Moz', 'ms'];
  8099. var emptyStyle;
  8100. var normalize = cached(function (prop) {
  8101. emptyStyle = emptyStyle || document.createElement('div').style;
  8102. prop = camelize(prop);
  8103. if (prop !== 'filter' && (prop in emptyStyle)) {
  8104. return prop
  8105. }
  8106. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  8107. for (var i = 0; i < vendorNames.length; i++) {
  8108. var name = vendorNames[i] + capName;
  8109. if (name in emptyStyle) {
  8110. return name
  8111. }
  8112. }
  8113. });
  8114. function updateStyle (oldVnode, vnode) {
  8115. var data = vnode.data;
  8116. var oldData = oldVnode.data;
  8117. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  8118. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  8119. ) {
  8120. return
  8121. }
  8122. var cur, name;
  8123. var el = vnode.elm;
  8124. var oldStaticStyle = oldData.staticStyle;
  8125. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  8126. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  8127. var oldStyle = oldStaticStyle || oldStyleBinding;
  8128. var style = normalizeStyleBinding(vnode.data.style) || {};
  8129. // store normalized style under a different key for next diff
  8130. // make sure to clone it if it's reactive, since the user likely wants
  8131. // to mutate it.
  8132. vnode.data.normalizedStyle = isDef(style.__ob__)
  8133. ? extend({}, style)
  8134. : style;
  8135. var newStyle = getStyle(vnode, true);
  8136. for (name in oldStyle) {
  8137. if (isUndef(newStyle[name])) {
  8138. setProp(el, name, '');
  8139. }
  8140. }
  8141. for (name in newStyle) {
  8142. cur = newStyle[name];
  8143. if (cur !== oldStyle[name]) {
  8144. // ie9 setting to null has no effect, must use empty string
  8145. setProp(el, name, cur == null ? '' : cur);
  8146. }
  8147. }
  8148. }
  8149. var style = {
  8150. create: updateStyle,
  8151. update: updateStyle
  8152. };
  8153. /* */
  8154. var whitespaceRE = /\s+/;
  8155. /**
  8156. * Add class with compatibility for SVG since classList is not supported on
  8157. * SVG elements in IE
  8158. */
  8159. function addClass (el, cls) {
  8160. /* istanbul ignore if */
  8161. if (!cls || !(cls = cls.trim())) {
  8162. return
  8163. }
  8164. /* istanbul ignore else */
  8165. if (el.classList) {
  8166. if (cls.indexOf(' ') > -1) {
  8167. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  8168. } else {
  8169. el.classList.add(cls);
  8170. }
  8171. } else {
  8172. var cur = " " + (el.getAttribute('class') || '') + " ";
  8173. if (cur.indexOf(' ' + cls + ' ') < 0) {
  8174. el.setAttribute('class', (cur + cls).trim());
  8175. }
  8176. }
  8177. }
  8178. /**
  8179. * Remove class with compatibility for SVG since classList is not supported on
  8180. * SVG elements in IE
  8181. */
  8182. function removeClass (el, cls) {
  8183. /* istanbul ignore if */
  8184. if (!cls || !(cls = cls.trim())) {
  8185. return
  8186. }
  8187. /* istanbul ignore else */
  8188. if (el.classList) {
  8189. if (cls.indexOf(' ') > -1) {
  8190. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  8191. } else {
  8192. el.classList.remove(cls);
  8193. }
  8194. if (!el.classList.length) {
  8195. el.removeAttribute('class');
  8196. }
  8197. } else {
  8198. var cur = " " + (el.getAttribute('class') || '') + " ";
  8199. var tar = ' ' + cls + ' ';
  8200. while (cur.indexOf(tar) >= 0) {
  8201. cur = cur.replace(tar, ' ');
  8202. }
  8203. cur = cur.trim();
  8204. if (cur) {
  8205. el.setAttribute('class', cur);
  8206. } else {
  8207. el.removeAttribute('class');
  8208. }
  8209. }
  8210. }
  8211. /* */
  8212. function resolveTransition (def$$1) {
  8213. if (!def$$1) {
  8214. return
  8215. }
  8216. /* istanbul ignore else */
  8217. if (typeof def$$1 === 'object') {
  8218. var res = {};
  8219. if (def$$1.css !== false) {
  8220. extend(res, autoCssTransition(def$$1.name || 'v'));
  8221. }
  8222. extend(res, def$$1);
  8223. return res
  8224. } else if (typeof def$$1 === 'string') {
  8225. return autoCssTransition(def$$1)
  8226. }
  8227. }
  8228. var autoCssTransition = cached(function (name) {
  8229. return {
  8230. enterClass: (name + "-enter"),
  8231. enterToClass: (name + "-enter-to"),
  8232. enterActiveClass: (name + "-enter-active"),
  8233. leaveClass: (name + "-leave"),
  8234. leaveToClass: (name + "-leave-to"),
  8235. leaveActiveClass: (name + "-leave-active")
  8236. }
  8237. });
  8238. var hasTransition = inBrowser && !isIE9;
  8239. var TRANSITION = 'transition';
  8240. var ANIMATION = 'animation';
  8241. // Transition property/event sniffing
  8242. var transitionProp = 'transition';
  8243. var transitionEndEvent = 'transitionend';
  8244. var animationProp = 'animation';
  8245. var animationEndEvent = 'animationend';
  8246. if (hasTransition) {
  8247. /* istanbul ignore if */
  8248. if (window.ontransitionend === undefined &&
  8249. window.onwebkittransitionend !== undefined
  8250. ) {
  8251. transitionProp = 'WebkitTransition';
  8252. transitionEndEvent = 'webkitTransitionEnd';
  8253. }
  8254. if (window.onanimationend === undefined &&
  8255. window.onwebkitanimationend !== undefined
  8256. ) {
  8257. animationProp = 'WebkitAnimation';
  8258. animationEndEvent = 'webkitAnimationEnd';
  8259. }
  8260. }
  8261. // binding to window is necessary to make hot reload work in IE in strict mode
  8262. var raf = inBrowser
  8263. ? window.requestAnimationFrame
  8264. ? window.requestAnimationFrame.bind(window)
  8265. : setTimeout
  8266. : /* istanbul ignore next */ function (fn) { return fn(); };
  8267. function nextFrame (fn) {
  8268. raf(function () {
  8269. raf(fn);
  8270. });
  8271. }
  8272. function addTransitionClass (el, cls) {
  8273. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  8274. if (transitionClasses.indexOf(cls) < 0) {
  8275. transitionClasses.push(cls);
  8276. addClass(el, cls);
  8277. }
  8278. }
  8279. function removeTransitionClass (el, cls) {
  8280. if (el._transitionClasses) {
  8281. remove(el._transitionClasses, cls);
  8282. }
  8283. removeClass(el, cls);
  8284. }
  8285. function whenTransitionEnds (
  8286. el,
  8287. expectedType,
  8288. cb
  8289. ) {
  8290. var ref = getTransitionInfo(el, expectedType);
  8291. var type = ref.type;
  8292. var timeout = ref.timeout;
  8293. var propCount = ref.propCount;
  8294. if (!type) { return cb() }
  8295. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  8296. var ended = 0;
  8297. var end = function () {
  8298. el.removeEventListener(event, onEnd);
  8299. cb();
  8300. };
  8301. var onEnd = function (e) {
  8302. if (e.target === el) {
  8303. if (++ended >= propCount) {
  8304. end();
  8305. }
  8306. }
  8307. };
  8308. setTimeout(function () {
  8309. if (ended < propCount) {
  8310. end();
  8311. }
  8312. }, timeout + 1);
  8313. el.addEventListener(event, onEnd);
  8314. }
  8315. var transformRE = /\b(transform|all)(,|$)/;
  8316. function getTransitionInfo (el, expectedType) {
  8317. var styles = window.getComputedStyle(el);
  8318. // JSDOM may return undefined for transition properties
  8319. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  8320. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  8321. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  8322. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  8323. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  8324. var animationTimeout = getTimeout(animationDelays, animationDurations);
  8325. var type;
  8326. var timeout = 0;
  8327. var propCount = 0;
  8328. /* istanbul ignore if */
  8329. if (expectedType === TRANSITION) {
  8330. if (transitionTimeout > 0) {
  8331. type = TRANSITION;
  8332. timeout = transitionTimeout;
  8333. propCount = transitionDurations.length;
  8334. }
  8335. } else if (expectedType === ANIMATION) {
  8336. if (animationTimeout > 0) {
  8337. type = ANIMATION;
  8338. timeout = animationTimeout;
  8339. propCount = animationDurations.length;
  8340. }
  8341. } else {
  8342. timeout = Math.max(transitionTimeout, animationTimeout);
  8343. type = timeout > 0
  8344. ? transitionTimeout > animationTimeout
  8345. ? TRANSITION
  8346. : ANIMATION
  8347. : null;
  8348. propCount = type
  8349. ? type === TRANSITION
  8350. ? transitionDurations.length
  8351. : animationDurations.length
  8352. : 0;
  8353. }
  8354. var hasTransform =
  8355. type === TRANSITION &&
  8356. transformRE.test(styles[transitionProp + 'Property']);
  8357. return {
  8358. type: type,
  8359. timeout: timeout,
  8360. propCount: propCount,
  8361. hasTransform: hasTransform
  8362. }
  8363. }
  8364. function getTimeout (delays, durations) {
  8365. /* istanbul ignore next */
  8366. while (delays.length < durations.length) {
  8367. delays = delays.concat(delays);
  8368. }
  8369. return Math.max.apply(null, durations.map(function (d, i) {
  8370. return toMs(d) + toMs(delays[i])
  8371. }))
  8372. }
  8373. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  8374. // in a locale-dependent way, using a comma instead of a dot.
  8375. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  8376. // as a floor function) causing unexpected behaviors
  8377. function toMs (s) {
  8378. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  8379. }
  8380. /* */
  8381. function enter (vnode, toggleDisplay) {
  8382. var el = vnode.elm;
  8383. // call leave callback now
  8384. if (isDef(el._leaveCb)) {
  8385. el._leaveCb.cancelled = true;
  8386. el._leaveCb();
  8387. }
  8388. var data = resolveTransition(vnode.data.transition);
  8389. if (isUndef(data)) {
  8390. return
  8391. }
  8392. /* istanbul ignore if */
  8393. if (isDef(el._enterCb) || el.nodeType !== 1) {
  8394. return
  8395. }
  8396. var css = data.css;
  8397. var type = data.type;
  8398. var enterClass = data.enterClass;
  8399. var enterToClass = data.enterToClass;
  8400. var enterActiveClass = data.enterActiveClass;
  8401. var appearClass = data.appearClass;
  8402. var appearToClass = data.appearToClass;
  8403. var appearActiveClass = data.appearActiveClass;
  8404. var beforeEnter = data.beforeEnter;
  8405. var enter = data.enter;
  8406. var afterEnter = data.afterEnter;
  8407. var enterCancelled = data.enterCancelled;
  8408. var beforeAppear = data.beforeAppear;
  8409. var appear = data.appear;
  8410. var afterAppear = data.afterAppear;
  8411. var appearCancelled = data.appearCancelled;
  8412. var duration = data.duration;
  8413. // activeInstance will always be the <transition> component managing this
  8414. // transition. One edge case to check is when the <transition> is placed
  8415. // as the root node of a child component. In that case we need to check
  8416. // <transition>'s parent for appear check.
  8417. var context = activeInstance;
  8418. var transitionNode = activeInstance.$vnode;
  8419. while (transitionNode && transitionNode.parent) {
  8420. transitionNode = transitionNode.parent;
  8421. context = transitionNode.context;
  8422. }
  8423. var isAppear = !context._isMounted || !vnode.isRootInsert;
  8424. if (isAppear && !appear && appear !== '') {
  8425. return
  8426. }
  8427. var startClass = isAppear && appearClass
  8428. ? appearClass
  8429. : enterClass;
  8430. var activeClass = isAppear && appearActiveClass
  8431. ? appearActiveClass
  8432. : enterActiveClass;
  8433. var toClass = isAppear && appearToClass
  8434. ? appearToClass
  8435. : enterToClass;
  8436. var beforeEnterHook = isAppear
  8437. ? (beforeAppear || beforeEnter)
  8438. : beforeEnter;
  8439. var enterHook = isAppear
  8440. ? (typeof appear === 'function' ? appear : enter)
  8441. : enter;
  8442. var afterEnterHook = isAppear
  8443. ? (afterAppear || afterEnter)
  8444. : afterEnter;
  8445. var enterCancelledHook = isAppear
  8446. ? (appearCancelled || enterCancelled)
  8447. : enterCancelled;
  8448. var explicitEnterDuration = toNumber(
  8449. isObject(duration)
  8450. ? duration.enter
  8451. : duration
  8452. );
  8453. if ("development" !== 'production' && explicitEnterDuration != null) {
  8454. checkDuration(explicitEnterDuration, 'enter', vnode);
  8455. }
  8456. var expectsCSS = css !== false && !isIE9;
  8457. var userWantsControl = getHookArgumentsLength(enterHook);
  8458. var cb = el._enterCb = once(function () {
  8459. if (expectsCSS) {
  8460. removeTransitionClass(el, toClass);
  8461. removeTransitionClass(el, activeClass);
  8462. }
  8463. if (cb.cancelled) {
  8464. if (expectsCSS) {
  8465. removeTransitionClass(el, startClass);
  8466. }
  8467. enterCancelledHook && enterCancelledHook(el);
  8468. } else {
  8469. afterEnterHook && afterEnterHook(el);
  8470. }
  8471. el._enterCb = null;
  8472. });
  8473. if (!vnode.data.show) {
  8474. // remove pending leave element on enter by injecting an insert hook
  8475. mergeVNodeHook(vnode, 'insert', function () {
  8476. var parent = el.parentNode;
  8477. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  8478. if (pendingNode &&
  8479. pendingNode.tag === vnode.tag &&
  8480. pendingNode.elm._leaveCb
  8481. ) {
  8482. pendingNode.elm._leaveCb();
  8483. }
  8484. enterHook && enterHook(el, cb);
  8485. });
  8486. }
  8487. // start enter transition
  8488. beforeEnterHook && beforeEnterHook(el);
  8489. if (expectsCSS) {
  8490. addTransitionClass(el, startClass);
  8491. addTransitionClass(el, activeClass);
  8492. nextFrame(function () {
  8493. removeTransitionClass(el, startClass);
  8494. if (!cb.cancelled) {
  8495. addTransitionClass(el, toClass);
  8496. if (!userWantsControl) {
  8497. if (isValidDuration(explicitEnterDuration)) {
  8498. setTimeout(cb, explicitEnterDuration);
  8499. } else {
  8500. whenTransitionEnds(el, type, cb);
  8501. }
  8502. }
  8503. }
  8504. });
  8505. }
  8506. if (vnode.data.show) {
  8507. toggleDisplay && toggleDisplay();
  8508. enterHook && enterHook(el, cb);
  8509. }
  8510. if (!expectsCSS && !userWantsControl) {
  8511. cb();
  8512. }
  8513. }
  8514. function leave (vnode, rm) {
  8515. var el = vnode.elm;
  8516. // call enter callback now
  8517. if (isDef(el._enterCb)) {
  8518. el._enterCb.cancelled = true;
  8519. el._enterCb();
  8520. }
  8521. var data = resolveTransition(vnode.data.transition);
  8522. if (isUndef(data) || el.nodeType !== 1) {
  8523. return rm()
  8524. }
  8525. /* istanbul ignore if */
  8526. if (isDef(el._leaveCb)) {
  8527. return
  8528. }
  8529. var css = data.css;
  8530. var type = data.type;
  8531. var leaveClass = data.leaveClass;
  8532. var leaveToClass = data.leaveToClass;
  8533. var leaveActiveClass = data.leaveActiveClass;
  8534. var beforeLeave = data.beforeLeave;
  8535. var leave = data.leave;
  8536. var afterLeave = data.afterLeave;
  8537. var leaveCancelled = data.leaveCancelled;
  8538. var delayLeave = data.delayLeave;
  8539. var duration = data.duration;
  8540. var expectsCSS = css !== false && !isIE9;
  8541. var userWantsControl = getHookArgumentsLength(leave);
  8542. var explicitLeaveDuration = toNumber(
  8543. isObject(duration)
  8544. ? duration.leave
  8545. : duration
  8546. );
  8547. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  8548. checkDuration(explicitLeaveDuration, 'leave', vnode);
  8549. }
  8550. var cb = el._leaveCb = once(function () {
  8551. if (el.parentNode && el.parentNode._pending) {
  8552. el.parentNode._pending[vnode.key] = null;
  8553. }
  8554. if (expectsCSS) {
  8555. removeTransitionClass(el, leaveToClass);
  8556. removeTransitionClass(el, leaveActiveClass);
  8557. }
  8558. if (cb.cancelled) {
  8559. if (expectsCSS) {
  8560. removeTransitionClass(el, leaveClass);
  8561. }
  8562. leaveCancelled && leaveCancelled(el);
  8563. } else {
  8564. rm();
  8565. afterLeave && afterLeave(el);
  8566. }
  8567. el._leaveCb = null;
  8568. });
  8569. if (delayLeave) {
  8570. delayLeave(performLeave);
  8571. } else {
  8572. performLeave();
  8573. }
  8574. function performLeave () {
  8575. // the delayed leave may have already been cancelled
  8576. if (cb.cancelled) {
  8577. return
  8578. }
  8579. // record leaving element
  8580. if (!vnode.data.show && el.parentNode) {
  8581. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  8582. }
  8583. beforeLeave && beforeLeave(el);
  8584. if (expectsCSS) {
  8585. addTransitionClass(el, leaveClass);
  8586. addTransitionClass(el, leaveActiveClass);
  8587. nextFrame(function () {
  8588. removeTransitionClass(el, leaveClass);
  8589. if (!cb.cancelled) {
  8590. addTransitionClass(el, leaveToClass);
  8591. if (!userWantsControl) {
  8592. if (isValidDuration(explicitLeaveDuration)) {
  8593. setTimeout(cb, explicitLeaveDuration);
  8594. } else {
  8595. whenTransitionEnds(el, type, cb);
  8596. }
  8597. }
  8598. }
  8599. });
  8600. }
  8601. leave && leave(el, cb);
  8602. if (!expectsCSS && !userWantsControl) {
  8603. cb();
  8604. }
  8605. }
  8606. }
  8607. // only used in dev mode
  8608. function checkDuration (val, name, vnode) {
  8609. if (typeof val !== 'number') {
  8610. warn(
  8611. "<transition> explicit " + name + " duration is not a valid number - " +
  8612. "got " + (JSON.stringify(val)) + ".",
  8613. vnode.context
  8614. );
  8615. } else if (isNaN(val)) {
  8616. warn(
  8617. "<transition> explicit " + name + " duration is NaN - " +
  8618. 'the duration expression might be incorrect.',
  8619. vnode.context
  8620. );
  8621. }
  8622. }
  8623. function isValidDuration (val) {
  8624. return typeof val === 'number' && !isNaN(val)
  8625. }
  8626. /**
  8627. * Normalize a transition hook's argument length. The hook may be:
  8628. * - a merged hook (invoker) with the original in .fns
  8629. * - a wrapped component method (check ._length)
  8630. * - a plain function (.length)
  8631. */
  8632. function getHookArgumentsLength (fn) {
  8633. if (isUndef(fn)) {
  8634. return false
  8635. }
  8636. var invokerFns = fn.fns;
  8637. if (isDef(invokerFns)) {
  8638. // invoker
  8639. return getHookArgumentsLength(
  8640. Array.isArray(invokerFns)
  8641. ? invokerFns[0]
  8642. : invokerFns
  8643. )
  8644. } else {
  8645. return (fn._length || fn.length) > 1
  8646. }
  8647. }
  8648. function _enter (_, vnode) {
  8649. if (vnode.data.show !== true) {
  8650. enter(vnode);
  8651. }
  8652. }
  8653. var transition = inBrowser ? {
  8654. create: _enter,
  8655. activate: _enter,
  8656. remove: function remove$$1 (vnode, rm) {
  8657. /* istanbul ignore else */
  8658. if (vnode.data.show !== true) {
  8659. leave(vnode, rm);
  8660. } else {
  8661. rm();
  8662. }
  8663. }
  8664. } : {};
  8665. var platformModules = [
  8666. attrs,
  8667. klass,
  8668. events,
  8669. domProps,
  8670. style,
  8671. transition
  8672. ];
  8673. /* */
  8674. // the directive module should be applied last, after all
  8675. // built-in modules have been applied.
  8676. var modules = platformModules.concat(baseModules);
  8677. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  8678. /**
  8679. * Not type checking this file because flow doesn't like attaching
  8680. * properties to Elements.
  8681. */
  8682. /* istanbul ignore if */
  8683. if (isIE9) {
  8684. // http://www.matts411.com/post/internet-explorer-9-oninput/
  8685. document.addEventListener('selectionchange', function () {
  8686. var el = document.activeElement;
  8687. if (el && el.vmodel) {
  8688. trigger(el, 'input');
  8689. }
  8690. });
  8691. }
  8692. var directive = {
  8693. inserted: function inserted (el, binding, vnode, oldVnode) {
  8694. if (vnode.tag === 'select') {
  8695. // #6903
  8696. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  8697. mergeVNodeHook(vnode, 'postpatch', function () {
  8698. directive.componentUpdated(el, binding, vnode);
  8699. });
  8700. } else {
  8701. setSelected(el, binding, vnode.context);
  8702. }
  8703. el._vOptions = [].map.call(el.options, getValue);
  8704. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  8705. el._vModifiers = binding.modifiers;
  8706. if (!binding.modifiers.lazy) {
  8707. el.addEventListener('compositionstart', onCompositionStart);
  8708. el.addEventListener('compositionend', onCompositionEnd);
  8709. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  8710. // switching focus before confirming composition choice
  8711. // this also fixes the issue where some browsers e.g. iOS Chrome
  8712. // fires "change" instead of "input" on autocomplete.
  8713. el.addEventListener('change', onCompositionEnd);
  8714. /* istanbul ignore if */
  8715. if (isIE9) {
  8716. el.vmodel = true;
  8717. }
  8718. }
  8719. }
  8720. },
  8721. componentUpdated: function componentUpdated (el, binding, vnode) {
  8722. if (vnode.tag === 'select') {
  8723. setSelected(el, binding, vnode.context);
  8724. // in case the options rendered by v-for have changed,
  8725. // it's possible that the value is out-of-sync with the rendered options.
  8726. // detect such cases and filter out values that no longer has a matching
  8727. // option in the DOM.
  8728. var prevOptions = el._vOptions;
  8729. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  8730. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  8731. // trigger change event if
  8732. // no matching option found for at least one value
  8733. var needReset = el.multiple
  8734. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  8735. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  8736. if (needReset) {
  8737. trigger(el, 'change');
  8738. }
  8739. }
  8740. }
  8741. }
  8742. };
  8743. function setSelected (el, binding, vm) {
  8744. actuallySetSelected(el, binding, vm);
  8745. /* istanbul ignore if */
  8746. if (isIE || isEdge) {
  8747. setTimeout(function () {
  8748. actuallySetSelected(el, binding, vm);
  8749. }, 0);
  8750. }
  8751. }
  8752. function actuallySetSelected (el, binding, vm) {
  8753. var value = binding.value;
  8754. var isMultiple = el.multiple;
  8755. if (isMultiple && !Array.isArray(value)) {
  8756. "development" !== 'production' && warn(
  8757. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  8758. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  8759. vm
  8760. );
  8761. return
  8762. }
  8763. var selected, option;
  8764. for (var i = 0, l = el.options.length; i < l; i++) {
  8765. option = el.options[i];
  8766. if (isMultiple) {
  8767. selected = looseIndexOf(value, getValue(option)) > -1;
  8768. if (option.selected !== selected) {
  8769. option.selected = selected;
  8770. }
  8771. } else {
  8772. if (looseEqual(getValue(option), value)) {
  8773. if (el.selectedIndex !== i) {
  8774. el.selectedIndex = i;
  8775. }
  8776. return
  8777. }
  8778. }
  8779. }
  8780. if (!isMultiple) {
  8781. el.selectedIndex = -1;
  8782. }
  8783. }
  8784. function hasNoMatchingOption (value, options) {
  8785. return options.every(function (o) { return !looseEqual(o, value); })
  8786. }
  8787. function getValue (option) {
  8788. return '_value' in option
  8789. ? option._value
  8790. : option.value
  8791. }
  8792. function onCompositionStart (e) {
  8793. e.target.composing = true;
  8794. }
  8795. function onCompositionEnd (e) {
  8796. // prevent triggering an input event for no reason
  8797. if (!e.target.composing) { return }
  8798. e.target.composing = false;
  8799. trigger(e.target, 'input');
  8800. }
  8801. function trigger (el, type) {
  8802. var e = document.createEvent('HTMLEvents');
  8803. e.initEvent(type, true, true);
  8804. el.dispatchEvent(e);
  8805. }
  8806. /* */
  8807. // recursively search for possible transition defined inside the component root
  8808. function locateNode (vnode) {
  8809. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  8810. ? locateNode(vnode.componentInstance._vnode)
  8811. : vnode
  8812. }
  8813. var show = {
  8814. bind: function bind (el, ref, vnode) {
  8815. var value = ref.value;
  8816. vnode = locateNode(vnode);
  8817. var transition$$1 = vnode.data && vnode.data.transition;
  8818. var originalDisplay = el.__vOriginalDisplay =
  8819. el.style.display === 'none' ? '' : el.style.display;
  8820. if (value && transition$$1) {
  8821. vnode.data.show = true;
  8822. enter(vnode, function () {
  8823. el.style.display = originalDisplay;
  8824. });
  8825. } else {
  8826. el.style.display = value ? originalDisplay : 'none';
  8827. }
  8828. },
  8829. update: function update (el, ref, vnode) {
  8830. var value = ref.value;
  8831. var oldValue = ref.oldValue;
  8832. /* istanbul ignore if */
  8833. if (!value === !oldValue) { return }
  8834. vnode = locateNode(vnode);
  8835. var transition$$1 = vnode.data && vnode.data.transition;
  8836. if (transition$$1) {
  8837. vnode.data.show = true;
  8838. if (value) {
  8839. enter(vnode, function () {
  8840. el.style.display = el.__vOriginalDisplay;
  8841. });
  8842. } else {
  8843. leave(vnode, function () {
  8844. el.style.display = 'none';
  8845. });
  8846. }
  8847. } else {
  8848. el.style.display = value ? el.__vOriginalDisplay : 'none';
  8849. }
  8850. },
  8851. unbind: function unbind (
  8852. el,
  8853. binding,
  8854. vnode,
  8855. oldVnode,
  8856. isDestroy
  8857. ) {
  8858. if (!isDestroy) {
  8859. el.style.display = el.__vOriginalDisplay;
  8860. }
  8861. }
  8862. };
  8863. var platformDirectives = {
  8864. model: directive,
  8865. show: show
  8866. };
  8867. /* */
  8868. var transitionProps = {
  8869. name: String,
  8870. appear: Boolean,
  8871. css: Boolean,
  8872. mode: String,
  8873. type: String,
  8874. enterClass: String,
  8875. leaveClass: String,
  8876. enterToClass: String,
  8877. leaveToClass: String,
  8878. enterActiveClass: String,
  8879. leaveActiveClass: String,
  8880. appearClass: String,
  8881. appearActiveClass: String,
  8882. appearToClass: String,
  8883. duration: [Number, String, Object]
  8884. };
  8885. // in case the child is also an abstract component, e.g. <keep-alive>
  8886. // we want to recursively retrieve the real component to be rendered
  8887. function getRealChild (vnode) {
  8888. var compOptions = vnode && vnode.componentOptions;
  8889. if (compOptions && compOptions.Ctor.options.abstract) {
  8890. return getRealChild(getFirstComponentChild(compOptions.children))
  8891. } else {
  8892. return vnode
  8893. }
  8894. }
  8895. function extractTransitionData (comp) {
  8896. var data = {};
  8897. var options = comp.$options;
  8898. // props
  8899. for (var key in options.propsData) {
  8900. data[key] = comp[key];
  8901. }
  8902. // events.
  8903. // extract listeners and pass them directly to the transition methods
  8904. var listeners = options._parentListeners;
  8905. for (var key$1 in listeners) {
  8906. data[camelize(key$1)] = listeners[key$1];
  8907. }
  8908. return data
  8909. }
  8910. function placeholder (h, rawChild) {
  8911. if (/\d-keep-alive$/.test(rawChild.tag)) {
  8912. return h('keep-alive', {
  8913. props: rawChild.componentOptions.propsData
  8914. })
  8915. }
  8916. }
  8917. function hasParentTransition (vnode) {
  8918. while ((vnode = vnode.parent)) {
  8919. if (vnode.data.transition) {
  8920. return true
  8921. }
  8922. }
  8923. }
  8924. function isSameChild (child, oldChild) {
  8925. return oldChild.key === child.key && oldChild.tag === child.tag
  8926. }
  8927. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  8928. var isVShowDirective = function (d) { return d.name === 'show'; };
  8929. var Transition = {
  8930. name: 'transition',
  8931. props: transitionProps,
  8932. abstract: true,
  8933. render: function render (h) {
  8934. var this$1 = this;
  8935. var children = this.$slots.default;
  8936. if (!children) {
  8937. return
  8938. }
  8939. // filter out text nodes (possible whitespaces)
  8940. children = children.filter(isNotTextNode);
  8941. /* istanbul ignore if */
  8942. if (!children.length) {
  8943. return
  8944. }
  8945. // warn multiple elements
  8946. if ("development" !== 'production' && children.length > 1) {
  8947. warn(
  8948. '<transition> can only be used on a single element. Use ' +
  8949. '<transition-group> for lists.',
  8950. this.$parent
  8951. );
  8952. }
  8953. var mode = this.mode;
  8954. // warn invalid mode
  8955. if ("development" !== 'production' &&
  8956. mode && mode !== 'in-out' && mode !== 'out-in'
  8957. ) {
  8958. warn(
  8959. 'invalid <transition> mode: ' + mode,
  8960. this.$parent
  8961. );
  8962. }
  8963. var rawChild = children[0];
  8964. // if this is a component root node and the component's
  8965. // parent container node also has transition, skip.
  8966. if (hasParentTransition(this.$vnode)) {
  8967. return rawChild
  8968. }
  8969. // apply transition data to child
  8970. // use getRealChild() to ignore abstract components e.g. keep-alive
  8971. var child = getRealChild(rawChild);
  8972. /* istanbul ignore if */
  8973. if (!child) {
  8974. return rawChild
  8975. }
  8976. if (this._leaving) {
  8977. return placeholder(h, rawChild)
  8978. }
  8979. // ensure a key that is unique to the vnode type and to this transition
  8980. // component instance. This key will be used to remove pending leaving nodes
  8981. // during entering.
  8982. var id = "__transition-" + (this._uid) + "-";
  8983. child.key = child.key == null
  8984. ? child.isComment
  8985. ? id + 'comment'
  8986. : id + child.tag
  8987. : isPrimitive(child.key)
  8988. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  8989. : child.key;
  8990. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  8991. var oldRawChild = this._vnode;
  8992. var oldChild = getRealChild(oldRawChild);
  8993. // mark v-show
  8994. // so that the transition module can hand over the control to the directive
  8995. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  8996. child.data.show = true;
  8997. }
  8998. if (
  8999. oldChild &&
  9000. oldChild.data &&
  9001. !isSameChild(child, oldChild) &&
  9002. !isAsyncPlaceholder(oldChild) &&
  9003. // #6687 component root is a comment node
  9004. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  9005. ) {
  9006. // replace old child transition data with fresh one
  9007. // important for dynamic transitions!
  9008. var oldData = oldChild.data.transition = extend({}, data);
  9009. // handle transition mode
  9010. if (mode === 'out-in') {
  9011. // return placeholder node and queue update when leave finishes
  9012. this._leaving = true;
  9013. mergeVNodeHook(oldData, 'afterLeave', function () {
  9014. this$1._leaving = false;
  9015. this$1.$forceUpdate();
  9016. });
  9017. return placeholder(h, rawChild)
  9018. } else if (mode === 'in-out') {
  9019. if (isAsyncPlaceholder(child)) {
  9020. return oldRawChild
  9021. }
  9022. var delayedLeave;
  9023. var performLeave = function () { delayedLeave(); };
  9024. mergeVNodeHook(data, 'afterEnter', performLeave);
  9025. mergeVNodeHook(data, 'enterCancelled', performLeave);
  9026. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  9027. }
  9028. }
  9029. return rawChild
  9030. }
  9031. };
  9032. /* */
  9033. var props = extend({
  9034. tag: String,
  9035. moveClass: String
  9036. }, transitionProps);
  9037. delete props.mode;
  9038. var TransitionGroup = {
  9039. props: props,
  9040. beforeMount: function beforeMount () {
  9041. var this$1 = this;
  9042. var update = this._update;
  9043. this._update = function (vnode, hydrating) {
  9044. var restoreActiveInstance = setActiveInstance(this$1);
  9045. // force removing pass
  9046. this$1.__patch__(
  9047. this$1._vnode,
  9048. this$1.kept,
  9049. false, // hydrating
  9050. true // removeOnly (!important, avoids unnecessary moves)
  9051. );
  9052. this$1._vnode = this$1.kept;
  9053. restoreActiveInstance();
  9054. update.call(this$1, vnode, hydrating);
  9055. };
  9056. },
  9057. render: function render (h) {
  9058. var tag = this.tag || this.$vnode.data.tag || 'span';
  9059. var map = Object.create(null);
  9060. var prevChildren = this.prevChildren = this.children;
  9061. var rawChildren = this.$slots.default || [];
  9062. var children = this.children = [];
  9063. var transitionData = extractTransitionData(this);
  9064. for (var i = 0; i < rawChildren.length; i++) {
  9065. var c = rawChildren[i];
  9066. if (c.tag) {
  9067. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  9068. children.push(c);
  9069. map[c.key] = c
  9070. ;(c.data || (c.data = {})).transition = transitionData;
  9071. } else if (true) {
  9072. var opts = c.componentOptions;
  9073. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  9074. warn(("<transition-group> children must be keyed: <" + name + ">"));
  9075. }
  9076. }
  9077. }
  9078. if (prevChildren) {
  9079. var kept = [];
  9080. var removed = [];
  9081. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  9082. var c$1 = prevChildren[i$1];
  9083. c$1.data.transition = transitionData;
  9084. c$1.data.pos = c$1.elm.getBoundingClientRect();
  9085. if (map[c$1.key]) {
  9086. kept.push(c$1);
  9087. } else {
  9088. removed.push(c$1);
  9089. }
  9090. }
  9091. this.kept = h(tag, null, kept);
  9092. this.removed = removed;
  9093. }
  9094. return h(tag, null, children)
  9095. },
  9096. updated: function updated () {
  9097. var children = this.prevChildren;
  9098. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  9099. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  9100. return
  9101. }
  9102. // we divide the work into three loops to avoid mixing DOM reads and writes
  9103. // in each iteration - which helps prevent layout thrashing.
  9104. children.forEach(callPendingCbs);
  9105. children.forEach(recordPosition);
  9106. children.forEach(applyTranslation);
  9107. // force reflow to put everything in position
  9108. // assign to this to avoid being removed in tree-shaking
  9109. // $flow-disable-line
  9110. this._reflow = document.body.offsetHeight;
  9111. children.forEach(function (c) {
  9112. if (c.data.moved) {
  9113. var el = c.elm;
  9114. var s = el.style;
  9115. addTransitionClass(el, moveClass);
  9116. s.transform = s.WebkitTransform = s.transitionDuration = '';
  9117. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  9118. if (e && e.target !== el) {
  9119. return
  9120. }
  9121. if (!e || /transform$/.test(e.propertyName)) {
  9122. el.removeEventListener(transitionEndEvent, cb);
  9123. el._moveCb = null;
  9124. removeTransitionClass(el, moveClass);
  9125. }
  9126. });
  9127. }
  9128. });
  9129. },
  9130. methods: {
  9131. hasMove: function hasMove (el, moveClass) {
  9132. /* istanbul ignore if */
  9133. if (!hasTransition) {
  9134. return false
  9135. }
  9136. /* istanbul ignore if */
  9137. if (this._hasMove) {
  9138. return this._hasMove
  9139. }
  9140. // Detect whether an element with the move class applied has
  9141. // CSS transitions. Since the element may be inside an entering
  9142. // transition at this very moment, we make a clone of it and remove
  9143. // all other transition classes applied to ensure only the move class
  9144. // is applied.
  9145. var clone = el.cloneNode();
  9146. if (el._transitionClasses) {
  9147. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  9148. }
  9149. addClass(clone, moveClass);
  9150. clone.style.display = 'none';
  9151. this.$el.appendChild(clone);
  9152. var info = getTransitionInfo(clone);
  9153. this.$el.removeChild(clone);
  9154. return (this._hasMove = info.hasTransform)
  9155. }
  9156. }
  9157. };
  9158. function callPendingCbs (c) {
  9159. /* istanbul ignore if */
  9160. if (c.elm._moveCb) {
  9161. c.elm._moveCb();
  9162. }
  9163. /* istanbul ignore if */
  9164. if (c.elm._enterCb) {
  9165. c.elm._enterCb();
  9166. }
  9167. }
  9168. function recordPosition (c) {
  9169. c.data.newPos = c.elm.getBoundingClientRect();
  9170. }
  9171. function applyTranslation (c) {
  9172. var oldPos = c.data.pos;
  9173. var newPos = c.data.newPos;
  9174. var dx = oldPos.left - newPos.left;
  9175. var dy = oldPos.top - newPos.top;
  9176. if (dx || dy) {
  9177. c.data.moved = true;
  9178. var s = c.elm.style;
  9179. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  9180. s.transitionDuration = '0s';
  9181. }
  9182. }
  9183. var platformComponents = {
  9184. Transition: Transition,
  9185. TransitionGroup: TransitionGroup
  9186. };
  9187. /* */
  9188. // install platform specific utils
  9189. Vue.config.mustUseProp = mustUseProp;
  9190. Vue.config.isReservedTag = isReservedTag;
  9191. Vue.config.isReservedAttr = isReservedAttr;
  9192. Vue.config.getTagNamespace = getTagNamespace;
  9193. Vue.config.isUnknownElement = isUnknownElement;
  9194. // install platform runtime directives & components
  9195. extend(Vue.options.directives, platformDirectives);
  9196. extend(Vue.options.components, platformComponents);
  9197. // install platform patch function
  9198. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  9199. // public mount method
  9200. Vue.prototype.$mount = function (
  9201. el,
  9202. hydrating
  9203. ) {
  9204. el = el && inBrowser ? query(el) : undefined;
  9205. return mountComponent(this, el, hydrating)
  9206. };
  9207. // devtools global hook
  9208. /* istanbul ignore next */
  9209. if (inBrowser) {
  9210. setTimeout(function () {
  9211. if (config.devtools) {
  9212. if (devtools) {
  9213. devtools.emit('init', Vue);
  9214. } else if (
  9215. "development" !== 'production' &&
  9216. "development" !== 'test' &&
  9217. isChrome
  9218. ) {
  9219. console[console.info ? 'info' : 'log'](
  9220. 'Download the Vue Devtools extension for a better development experience:\n' +
  9221. 'https://github.com/vuejs/vue-devtools'
  9222. );
  9223. }
  9224. }
  9225. if ("development" !== 'production' &&
  9226. "development" !== 'test' &&
  9227. config.productionTip !== false &&
  9228. typeof console !== 'undefined'
  9229. ) {
  9230. console[console.info ? 'info' : 'log'](
  9231. "You are running Vue in development mode.\n" +
  9232. "Make sure to turn on production mode when deploying for production.\n" +
  9233. "See more tips at https://vuejs.org/guide/deployment.html"
  9234. );
  9235. }
  9236. }, 0);
  9237. }
  9238. /* */
  9239. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  9240. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  9241. var buildRegex = cached(function (delimiters) {
  9242. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  9243. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  9244. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  9245. });
  9246. function parseText (
  9247. text,
  9248. delimiters
  9249. ) {
  9250. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  9251. if (!tagRE.test(text)) {
  9252. return
  9253. }
  9254. var tokens = [];
  9255. var rawTokens = [];
  9256. var lastIndex = tagRE.lastIndex = 0;
  9257. var match, index, tokenValue;
  9258. while ((match = tagRE.exec(text))) {
  9259. index = match.index;
  9260. // push text token
  9261. if (index > lastIndex) {
  9262. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  9263. tokens.push(JSON.stringify(tokenValue));
  9264. }
  9265. // tag token
  9266. var exp = parseFilters(match[1].trim());
  9267. tokens.push(("_s(" + exp + ")"));
  9268. rawTokens.push({ '@binding': exp });
  9269. lastIndex = index + match[0].length;
  9270. }
  9271. if (lastIndex < text.length) {
  9272. rawTokens.push(tokenValue = text.slice(lastIndex));
  9273. tokens.push(JSON.stringify(tokenValue));
  9274. }
  9275. return {
  9276. expression: tokens.join('+'),
  9277. tokens: rawTokens
  9278. }
  9279. }
  9280. /* */
  9281. function transformNode (el, options) {
  9282. var warn = options.warn || baseWarn;
  9283. var staticClass = getAndRemoveAttr(el, 'class');
  9284. if ("development" !== 'production' && staticClass) {
  9285. var res = parseText(staticClass, options.delimiters);
  9286. if (res) {
  9287. warn(
  9288. "class=\"" + staticClass + "\": " +
  9289. 'Interpolation inside attributes has been removed. ' +
  9290. 'Use v-bind or the colon shorthand instead. For example, ' +
  9291. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  9292. );
  9293. }
  9294. }
  9295. if (staticClass) {
  9296. el.staticClass = JSON.stringify(staticClass);
  9297. }
  9298. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  9299. if (classBinding) {
  9300. el.classBinding = classBinding;
  9301. }
  9302. }
  9303. function genData (el) {
  9304. var data = '';
  9305. if (el.staticClass) {
  9306. data += "staticClass:" + (el.staticClass) + ",";
  9307. }
  9308. if (el.classBinding) {
  9309. data += "class:" + (el.classBinding) + ",";
  9310. }
  9311. return data
  9312. }
  9313. var klass$1 = {
  9314. staticKeys: ['staticClass'],
  9315. transformNode: transformNode,
  9316. genData: genData
  9317. };
  9318. /* */
  9319. function transformNode$1 (el, options) {
  9320. var warn = options.warn || baseWarn;
  9321. var staticStyle = getAndRemoveAttr(el, 'style');
  9322. if (staticStyle) {
  9323. /* istanbul ignore if */
  9324. if (true) {
  9325. var res = parseText(staticStyle, options.delimiters);
  9326. if (res) {
  9327. warn(
  9328. "style=\"" + staticStyle + "\": " +
  9329. 'Interpolation inside attributes has been removed. ' +
  9330. 'Use v-bind or the colon shorthand instead. For example, ' +
  9331. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  9332. );
  9333. }
  9334. }
  9335. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  9336. }
  9337. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  9338. if (styleBinding) {
  9339. el.styleBinding = styleBinding;
  9340. }
  9341. }
  9342. function genData$1 (el) {
  9343. var data = '';
  9344. if (el.staticStyle) {
  9345. data += "staticStyle:" + (el.staticStyle) + ",";
  9346. }
  9347. if (el.styleBinding) {
  9348. data += "style:(" + (el.styleBinding) + "),";
  9349. }
  9350. return data
  9351. }
  9352. var style$1 = {
  9353. staticKeys: ['staticStyle'],
  9354. transformNode: transformNode$1,
  9355. genData: genData$1
  9356. };
  9357. /* */
  9358. var decoder;
  9359. var he = {
  9360. decode: function decode (html) {
  9361. decoder = decoder || document.createElement('div');
  9362. decoder.innerHTML = html;
  9363. return decoder.textContent
  9364. }
  9365. };
  9366. /* */
  9367. var isUnaryTag = makeMap(
  9368. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  9369. 'link,meta,param,source,track,wbr'
  9370. );
  9371. // Elements that you can, intentionally, leave open
  9372. // (and which close themselves)
  9373. var canBeLeftOpenTag = makeMap(
  9374. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  9375. );
  9376. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  9377. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  9378. var isNonPhrasingTag = makeMap(
  9379. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  9380. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  9381. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  9382. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  9383. 'title,tr,track'
  9384. );
  9385. /**
  9386. * Not type-checking this file because it's mostly vendor code.
  9387. */
  9388. // Regular Expressions for parsing tags and attributes
  9389. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9390. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  9391. // but for Vue templates we can enforce a simple charset
  9392. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  9393. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  9394. var startTagOpen = new RegExp(("^<" + qnameCapture));
  9395. var startTagClose = /^\s*(\/?)>/;
  9396. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  9397. var doctype = /^<!DOCTYPE [^>]+>/i;
  9398. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  9399. var comment = /^<!\--/;
  9400. var conditionalComment = /^<!\[/;
  9401. // Special Elements (can contain anything)
  9402. var isPlainTextElement = makeMap('script,style,textarea', true);
  9403. var reCache = {};
  9404. var decodingMap = {
  9405. '&lt;': '<',
  9406. '&gt;': '>',
  9407. '&quot;': '"',
  9408. '&amp;': '&',
  9409. '&#10;': '\n',
  9410. '&#9;': '\t'
  9411. };
  9412. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  9413. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
  9414. // #5992
  9415. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  9416. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  9417. function decodeAttr (value, shouldDecodeNewlines) {
  9418. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  9419. return value.replace(re, function (match) { return decodingMap[match]; })
  9420. }
  9421. function parseHTML (html, options) {
  9422. var stack = [];
  9423. var expectHTML = options.expectHTML;
  9424. var isUnaryTag$$1 = options.isUnaryTag || no;
  9425. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  9426. var index = 0;
  9427. var last, lastTag;
  9428. while (html) {
  9429. last = html;
  9430. // Make sure we're not in a plaintext content element like script/style
  9431. if (!lastTag || !isPlainTextElement(lastTag)) {
  9432. var textEnd = html.indexOf('<');
  9433. if (textEnd === 0) {
  9434. // Comment:
  9435. if (comment.test(html)) {
  9436. var commentEnd = html.indexOf('-->');
  9437. if (commentEnd >= 0) {
  9438. if (options.shouldKeepComment) {
  9439. options.comment(html.substring(4, commentEnd));
  9440. }
  9441. advance(commentEnd + 3);
  9442. continue
  9443. }
  9444. }
  9445. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  9446. if (conditionalComment.test(html)) {
  9447. var conditionalEnd = html.indexOf(']>');
  9448. if (conditionalEnd >= 0) {
  9449. advance(conditionalEnd + 2);
  9450. continue
  9451. }
  9452. }
  9453. // Doctype:
  9454. var doctypeMatch = html.match(doctype);
  9455. if (doctypeMatch) {
  9456. advance(doctypeMatch[0].length);
  9457. continue
  9458. }
  9459. // End tag:
  9460. var endTagMatch = html.match(endTag);
  9461. if (endTagMatch) {
  9462. var curIndex = index;
  9463. advance(endTagMatch[0].length);
  9464. parseEndTag(endTagMatch[1], curIndex, index);
  9465. continue
  9466. }
  9467. // Start tag:
  9468. var startTagMatch = parseStartTag();
  9469. if (startTagMatch) {
  9470. handleStartTag(startTagMatch);
  9471. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  9472. advance(1);
  9473. }
  9474. continue
  9475. }
  9476. }
  9477. var text = (void 0), rest = (void 0), next = (void 0);
  9478. if (textEnd >= 0) {
  9479. rest = html.slice(textEnd);
  9480. while (
  9481. !endTag.test(rest) &&
  9482. !startTagOpen.test(rest) &&
  9483. !comment.test(rest) &&
  9484. !conditionalComment.test(rest)
  9485. ) {
  9486. // < in plain text, be forgiving and treat it as text
  9487. next = rest.indexOf('<', 1);
  9488. if (next < 0) { break }
  9489. textEnd += next;
  9490. rest = html.slice(textEnd);
  9491. }
  9492. text = html.substring(0, textEnd);
  9493. advance(textEnd);
  9494. }
  9495. if (textEnd < 0) {
  9496. text = html;
  9497. html = '';
  9498. }
  9499. if (options.chars && text) {
  9500. options.chars(text);
  9501. }
  9502. } else {
  9503. var endTagLength = 0;
  9504. var stackedTag = lastTag.toLowerCase();
  9505. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  9506. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  9507. endTagLength = endTag.length;
  9508. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  9509. text = text
  9510. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  9511. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  9512. }
  9513. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  9514. text = text.slice(1);
  9515. }
  9516. if (options.chars) {
  9517. options.chars(text);
  9518. }
  9519. return ''
  9520. });
  9521. index += html.length - rest$1.length;
  9522. html = rest$1;
  9523. parseEndTag(stackedTag, index - endTagLength, index);
  9524. }
  9525. if (html === last) {
  9526. options.chars && options.chars(html);
  9527. if ("development" !== 'production' && !stack.length && options.warn) {
  9528. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  9529. }
  9530. break
  9531. }
  9532. }
  9533. // Clean up any remaining tags
  9534. parseEndTag();
  9535. function advance (n) {
  9536. index += n;
  9537. html = html.substring(n);
  9538. }
  9539. function parseStartTag () {
  9540. var start = html.match(startTagOpen);
  9541. if (start) {
  9542. var match = {
  9543. tagName: start[1],
  9544. attrs: [],
  9545. start: index
  9546. };
  9547. advance(start[0].length);
  9548. var end, attr;
  9549. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  9550. advance(attr[0].length);
  9551. match.attrs.push(attr);
  9552. }
  9553. if (end) {
  9554. match.unarySlash = end[1];
  9555. advance(end[0].length);
  9556. match.end = index;
  9557. return match
  9558. }
  9559. }
  9560. }
  9561. function handleStartTag (match) {
  9562. var tagName = match.tagName;
  9563. var unarySlash = match.unarySlash;
  9564. if (expectHTML) {
  9565. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  9566. parseEndTag(lastTag);
  9567. }
  9568. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  9569. parseEndTag(tagName);
  9570. }
  9571. }
  9572. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  9573. var l = match.attrs.length;
  9574. var attrs = new Array(l);
  9575. for (var i = 0; i < l; i++) {
  9576. var args = match.attrs[i];
  9577. var value = args[3] || args[4] || args[5] || '';
  9578. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  9579. ? options.shouldDecodeNewlinesForHref
  9580. : options.shouldDecodeNewlines;
  9581. attrs[i] = {
  9582. name: args[1],
  9583. value: decodeAttr(value, shouldDecodeNewlines)
  9584. };
  9585. }
  9586. if (!unary) {
  9587. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  9588. lastTag = tagName;
  9589. }
  9590. if (options.start) {
  9591. options.start(tagName, attrs, unary, match.start, match.end);
  9592. }
  9593. }
  9594. function parseEndTag (tagName, start, end) {
  9595. var pos, lowerCasedTagName;
  9596. if (start == null) { start = index; }
  9597. if (end == null) { end = index; }
  9598. // Find the closest opened tag of the same type
  9599. if (tagName) {
  9600. lowerCasedTagName = tagName.toLowerCase();
  9601. for (pos = stack.length - 1; pos >= 0; pos--) {
  9602. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  9603. break
  9604. }
  9605. }
  9606. } else {
  9607. // If no tag name is provided, clean shop
  9608. pos = 0;
  9609. }
  9610. if (pos >= 0) {
  9611. // Close all the open elements, up the stack
  9612. for (var i = stack.length - 1; i >= pos; i--) {
  9613. if ("development" !== 'production' &&
  9614. (i > pos || !tagName) &&
  9615. options.warn
  9616. ) {
  9617. options.warn(
  9618. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  9619. );
  9620. }
  9621. if (options.end) {
  9622. options.end(stack[i].tag, start, end);
  9623. }
  9624. }
  9625. // Remove the open elements from the stack
  9626. stack.length = pos;
  9627. lastTag = pos && stack[pos - 1].tag;
  9628. } else if (lowerCasedTagName === 'br') {
  9629. if (options.start) {
  9630. options.start(tagName, [], true, start, end);
  9631. }
  9632. } else if (lowerCasedTagName === 'p') {
  9633. if (options.start) {
  9634. options.start(tagName, [], false, start, end);
  9635. }
  9636. if (options.end) {
  9637. options.end(tagName, start, end);
  9638. }
  9639. }
  9640. }
  9641. }
  9642. /* */
  9643. var onRE = /^@|^v-on:/;
  9644. var dirRE = /^v-|^@|^:/;
  9645. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  9646. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  9647. var stripParensRE = /^\(|\)$/g;
  9648. var argRE = /:(.*)$/;
  9649. var bindRE = /^:|^v-bind:/;
  9650. var modifierRE = /\.[^.]+/g;
  9651. var decodeHTMLCached = cached(he.decode);
  9652. // configurable state
  9653. var warn$2;
  9654. var delimiters;
  9655. var transforms;
  9656. var preTransforms;
  9657. var postTransforms;
  9658. var platformIsPreTag;
  9659. var platformMustUseProp;
  9660. var platformGetTagNamespace;
  9661. function createASTElement (
  9662. tag,
  9663. attrs,
  9664. parent
  9665. ) {
  9666. return {
  9667. type: 1,
  9668. tag: tag,
  9669. attrsList: attrs,
  9670. attrsMap: makeAttrsMap(attrs),
  9671. parent: parent,
  9672. children: []
  9673. }
  9674. }
  9675. /**
  9676. * Convert HTML string to AST.
  9677. */
  9678. function parse (
  9679. template,
  9680. options
  9681. ) {
  9682. warn$2 = options.warn || baseWarn;
  9683. platformIsPreTag = options.isPreTag || no;
  9684. platformMustUseProp = options.mustUseProp || no;
  9685. platformGetTagNamespace = options.getTagNamespace || no;
  9686. transforms = pluckModuleFunction(options.modules, 'transformNode');
  9687. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  9688. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  9689. delimiters = options.delimiters;
  9690. var stack = [];
  9691. var preserveWhitespace = options.preserveWhitespace !== false;
  9692. var root;
  9693. var currentParent;
  9694. var inVPre = false;
  9695. var inPre = false;
  9696. var warned = false;
  9697. function warnOnce (msg) {
  9698. if (!warned) {
  9699. warned = true;
  9700. warn$2(msg);
  9701. }
  9702. }
  9703. function closeElement (element) {
  9704. // check pre state
  9705. if (element.pre) {
  9706. inVPre = false;
  9707. }
  9708. if (platformIsPreTag(element.tag)) {
  9709. inPre = false;
  9710. }
  9711. // apply post-transforms
  9712. for (var i = 0; i < postTransforms.length; i++) {
  9713. postTransforms[i](element, options);
  9714. }
  9715. }
  9716. parseHTML(template, {
  9717. warn: warn$2,
  9718. expectHTML: options.expectHTML,
  9719. isUnaryTag: options.isUnaryTag,
  9720. canBeLeftOpenTag: options.canBeLeftOpenTag,
  9721. shouldDecodeNewlines: options.shouldDecodeNewlines,
  9722. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  9723. shouldKeepComment: options.comments,
  9724. start: function start (tag, attrs, unary) {
  9725. // check namespace.
  9726. // inherit parent ns if there is one
  9727. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  9728. // handle IE svg bug
  9729. /* istanbul ignore if */
  9730. if (isIE && ns === 'svg') {
  9731. attrs = guardIESVGBug(attrs);
  9732. }
  9733. var element = createASTElement(tag, attrs, currentParent);
  9734. if (ns) {
  9735. element.ns = ns;
  9736. }
  9737. if (isForbiddenTag(element) && !isServerRendering()) {
  9738. element.forbidden = true;
  9739. "development" !== 'production' && warn$2(
  9740. 'Templates should only be responsible for mapping the state to the ' +
  9741. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  9742. "<" + tag + ">" + ', as they will not be parsed.'
  9743. );
  9744. }
  9745. // apply pre-transforms
  9746. for (var i = 0; i < preTransforms.length; i++) {
  9747. element = preTransforms[i](element, options) || element;
  9748. }
  9749. if (!inVPre) {
  9750. processPre(element);
  9751. if (element.pre) {
  9752. inVPre = true;
  9753. }
  9754. }
  9755. if (platformIsPreTag(element.tag)) {
  9756. inPre = true;
  9757. }
  9758. if (inVPre) {
  9759. processRawAttrs(element);
  9760. } else if (!element.processed) {
  9761. // structural directives
  9762. processFor(element);
  9763. processIf(element);
  9764. processOnce(element);
  9765. // element-scope stuff
  9766. processElement(element, options);
  9767. }
  9768. function checkRootConstraints (el) {
  9769. if (true) {
  9770. if (el.tag === 'slot' || el.tag === 'template') {
  9771. warnOnce(
  9772. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  9773. 'contain multiple nodes.'
  9774. );
  9775. }
  9776. if (el.attrsMap.hasOwnProperty('v-for')) {
  9777. warnOnce(
  9778. 'Cannot use v-for on stateful component root element because ' +
  9779. 'it renders multiple elements.'
  9780. );
  9781. }
  9782. }
  9783. }
  9784. // tree management
  9785. if (!root) {
  9786. root = element;
  9787. checkRootConstraints(root);
  9788. } else if (!stack.length) {
  9789. // allow root elements with v-if, v-else-if and v-else
  9790. if (root.if && (element.elseif || element.else)) {
  9791. checkRootConstraints(element);
  9792. addIfCondition(root, {
  9793. exp: element.elseif,
  9794. block: element
  9795. });
  9796. } else if (true) {
  9797. warnOnce(
  9798. "Component template should contain exactly one root element. " +
  9799. "If you are using v-if on multiple elements, " +
  9800. "use v-else-if to chain them instead."
  9801. );
  9802. }
  9803. }
  9804. if (currentParent && !element.forbidden) {
  9805. if (element.elseif || element.else) {
  9806. processIfConditions(element, currentParent);
  9807. } else if (element.slotScope) { // scoped slot
  9808. currentParent.plain = false;
  9809. var name = element.slotTarget || '"default"'
  9810. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  9811. } else {
  9812. currentParent.children.push(element);
  9813. element.parent = currentParent;
  9814. }
  9815. }
  9816. if (!unary) {
  9817. currentParent = element;
  9818. stack.push(element);
  9819. } else {
  9820. closeElement(element);
  9821. }
  9822. },
  9823. end: function end () {
  9824. // remove trailing whitespace
  9825. var element = stack[stack.length - 1];
  9826. var lastNode = element.children[element.children.length - 1];
  9827. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  9828. element.children.pop();
  9829. }
  9830. // pop stack
  9831. stack.length -= 1;
  9832. currentParent = stack[stack.length - 1];
  9833. closeElement(element);
  9834. },
  9835. chars: function chars (text) {
  9836. if (!currentParent) {
  9837. if (true) {
  9838. if (text === template) {
  9839. warnOnce(
  9840. 'Component template requires a root element, rather than just text.'
  9841. );
  9842. } else if ((text = text.trim())) {
  9843. warnOnce(
  9844. ("text \"" + text + "\" outside root element will be ignored.")
  9845. );
  9846. }
  9847. }
  9848. return
  9849. }
  9850. // IE textarea placeholder bug
  9851. /* istanbul ignore if */
  9852. if (isIE &&
  9853. currentParent.tag === 'textarea' &&
  9854. currentParent.attrsMap.placeholder === text
  9855. ) {
  9856. return
  9857. }
  9858. var children = currentParent.children;
  9859. text = inPre || text.trim()
  9860. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  9861. // only preserve whitespace if its not right after a starting tag
  9862. : preserveWhitespace && children.length ? ' ' : '';
  9863. if (text) {
  9864. var res;
  9865. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  9866. children.push({
  9867. type: 2,
  9868. expression: res.expression,
  9869. tokens: res.tokens,
  9870. text: text
  9871. });
  9872. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  9873. children.push({
  9874. type: 3,
  9875. text: text
  9876. });
  9877. }
  9878. }
  9879. },
  9880. comment: function comment (text) {
  9881. currentParent.children.push({
  9882. type: 3,
  9883. text: text,
  9884. isComment: true
  9885. });
  9886. }
  9887. });
  9888. return root
  9889. }
  9890. function processPre (el) {
  9891. if (getAndRemoveAttr(el, 'v-pre') != null) {
  9892. el.pre = true;
  9893. }
  9894. }
  9895. function processRawAttrs (el) {
  9896. var l = el.attrsList.length;
  9897. if (l) {
  9898. var attrs = el.attrs = new Array(l);
  9899. for (var i = 0; i < l; i++) {
  9900. attrs[i] = {
  9901. name: el.attrsList[i].name,
  9902. value: JSON.stringify(el.attrsList[i].value)
  9903. };
  9904. }
  9905. } else if (!el.pre) {
  9906. // non root node in pre blocks with no attributes
  9907. el.plain = true;
  9908. }
  9909. }
  9910. function processElement (element, options) {
  9911. processKey(element);
  9912. // determine whether this is a plain element after
  9913. // removing structural attributes
  9914. element.plain = !element.key && !element.attrsList.length;
  9915. processRef(element);
  9916. processSlot(element);
  9917. processComponent(element);
  9918. for (var i = 0; i < transforms.length; i++) {
  9919. element = transforms[i](element, options) || element;
  9920. }
  9921. processAttrs(element);
  9922. }
  9923. function processKey (el) {
  9924. var exp = getBindingAttr(el, 'key');
  9925. if (exp) {
  9926. if (true) {
  9927. if (el.tag === 'template') {
  9928. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  9929. }
  9930. if (el.for) {
  9931. var iterator = el.iterator2 || el.iterator1;
  9932. var parent = el.parent;
  9933. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9934. warn$2(
  9935. "Do not use v-for index as key on <transition-group> children, " +
  9936. "this is the same as not using keys."
  9937. );
  9938. }
  9939. }
  9940. }
  9941. el.key = exp;
  9942. }
  9943. }
  9944. function processRef (el) {
  9945. var ref = getBindingAttr(el, 'ref');
  9946. if (ref) {
  9947. el.ref = ref;
  9948. el.refInFor = checkInFor(el);
  9949. }
  9950. }
  9951. function processFor (el) {
  9952. var exp;
  9953. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9954. var res = parseFor(exp);
  9955. if (res) {
  9956. extend(el, res);
  9957. } else if (true) {
  9958. warn$2(
  9959. ("Invalid v-for expression: " + exp)
  9960. );
  9961. }
  9962. }
  9963. }
  9964. function parseFor (exp) {
  9965. var inMatch = exp.match(forAliasRE);
  9966. if (!inMatch) { return }
  9967. var res = {};
  9968. res.for = inMatch[2].trim();
  9969. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9970. var iteratorMatch = alias.match(forIteratorRE);
  9971. if (iteratorMatch) {
  9972. res.alias = alias.replace(forIteratorRE, '').trim();
  9973. res.iterator1 = iteratorMatch[1].trim();
  9974. if (iteratorMatch[2]) {
  9975. res.iterator2 = iteratorMatch[2].trim();
  9976. }
  9977. } else {
  9978. res.alias = alias;
  9979. }
  9980. return res
  9981. }
  9982. function processIf (el) {
  9983. var exp = getAndRemoveAttr(el, 'v-if');
  9984. if (exp) {
  9985. el.if = exp;
  9986. addIfCondition(el, {
  9987. exp: exp,
  9988. block: el
  9989. });
  9990. } else {
  9991. if (getAndRemoveAttr(el, 'v-else') != null) {
  9992. el.else = true;
  9993. }
  9994. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9995. if (elseif) {
  9996. el.elseif = elseif;
  9997. }
  9998. }
  9999. }
  10000. function processIfConditions (el, parent) {
  10001. var prev = findPrevElement(parent.children);
  10002. if (prev && prev.if) {
  10003. addIfCondition(prev, {
  10004. exp: el.elseif,
  10005. block: el
  10006. });
  10007. } else if (true) {
  10008. warn$2(
  10009. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  10010. "used on element <" + (el.tag) + "> without corresponding v-if."
  10011. );
  10012. }
  10013. }
  10014. function findPrevElement (children) {
  10015. var i = children.length;
  10016. while (i--) {
  10017. if (children[i].type === 1) {
  10018. return children[i]
  10019. } else {
  10020. if ("development" !== 'production' && children[i].text !== ' ') {
  10021. warn$2(
  10022. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  10023. "will be ignored."
  10024. );
  10025. }
  10026. children.pop();
  10027. }
  10028. }
  10029. }
  10030. function addIfCondition (el, condition) {
  10031. if (!el.ifConditions) {
  10032. el.ifConditions = [];
  10033. }
  10034. el.ifConditions.push(condition);
  10035. }
  10036. function processOnce (el) {
  10037. var once$$1 = getAndRemoveAttr(el, 'v-once');
  10038. if (once$$1 != null) {
  10039. el.once = true;
  10040. }
  10041. }
  10042. function processSlot (el) {
  10043. if (el.tag === 'slot') {
  10044. el.slotName = getBindingAttr(el, 'name');
  10045. if ("development" !== 'production' && el.key) {
  10046. warn$2(
  10047. "`key` does not work on <slot> because slots are abstract outlets " +
  10048. "and can possibly expand into multiple elements. " +
  10049. "Use the key on a wrapping element instead."
  10050. );
  10051. }
  10052. } else {
  10053. var slotScope;
  10054. if (el.tag === 'template') {
  10055. slotScope = getAndRemoveAttr(el, 'scope');
  10056. /* istanbul ignore if */
  10057. if ("development" !== 'production' && slotScope) {
  10058. warn$2(
  10059. "the \"scope\" attribute for scoped slots have been deprecated and " +
  10060. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  10061. "can also be used on plain elements in addition to <template> to " +
  10062. "denote scoped slots.",
  10063. true
  10064. );
  10065. }
  10066. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  10067. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  10068. /* istanbul ignore if */
  10069. if ("development" !== 'production' && el.attrsMap['v-for']) {
  10070. warn$2(
  10071. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  10072. "(v-for takes higher priority). Use a wrapper <template> for the " +
  10073. "scoped slot to make it clearer.",
  10074. true
  10075. );
  10076. }
  10077. el.slotScope = slotScope;
  10078. }
  10079. var slotTarget = getBindingAttr(el, 'slot');
  10080. if (slotTarget) {
  10081. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  10082. // preserve slot as an attribute for native shadow DOM compat
  10083. // only for non-scoped slots.
  10084. if (el.tag !== 'template' && !el.slotScope) {
  10085. addAttr(el, 'slot', slotTarget);
  10086. }
  10087. }
  10088. }
  10089. }
  10090. function processComponent (el) {
  10091. var binding;
  10092. if ((binding = getBindingAttr(el, 'is'))) {
  10093. el.component = binding;
  10094. }
  10095. if (getAndRemoveAttr(el, 'inline-template') != null) {
  10096. el.inlineTemplate = true;
  10097. }
  10098. }
  10099. function processAttrs (el) {
  10100. var list = el.attrsList;
  10101. var i, l, name, rawName, value, modifiers, isProp;
  10102. for (i = 0, l = list.length; i < l; i++) {
  10103. name = rawName = list[i].name;
  10104. value = list[i].value;
  10105. if (dirRE.test(name)) {
  10106. // mark element as dynamic
  10107. el.hasBindings = true;
  10108. // modifiers
  10109. modifiers = parseModifiers(name);
  10110. if (modifiers) {
  10111. name = name.replace(modifierRE, '');
  10112. }
  10113. if (bindRE.test(name)) { // v-bind
  10114. name = name.replace(bindRE, '');
  10115. value = parseFilters(value);
  10116. isProp = false;
  10117. if (
  10118. "development" !== 'production' &&
  10119. value.trim().length === 0
  10120. ) {
  10121. warn$2(
  10122. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  10123. );
  10124. }
  10125. if (modifiers) {
  10126. if (modifiers.prop) {
  10127. isProp = true;
  10128. name = camelize(name);
  10129. if (name === 'innerHtml') { name = 'innerHTML'; }
  10130. }
  10131. if (modifiers.camel) {
  10132. name = camelize(name);
  10133. }
  10134. if (modifiers.sync) {
  10135. addHandler(
  10136. el,
  10137. ("update:" + (camelize(name))),
  10138. genAssignmentCode(value, "$event")
  10139. );
  10140. }
  10141. }
  10142. if (isProp || (
  10143. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  10144. )) {
  10145. addProp(el, name, value);
  10146. } else {
  10147. addAttr(el, name, value);
  10148. }
  10149. } else if (onRE.test(name)) { // v-on
  10150. name = name.replace(onRE, '');
  10151. addHandler(el, name, value, modifiers, false, warn$2);
  10152. } else { // normal directives
  10153. name = name.replace(dirRE, '');
  10154. // parse arg
  10155. var argMatch = name.match(argRE);
  10156. var arg = argMatch && argMatch[1];
  10157. if (arg) {
  10158. name = name.slice(0, -(arg.length + 1));
  10159. }
  10160. addDirective(el, name, rawName, value, arg, modifiers);
  10161. if ("development" !== 'production' && name === 'model') {
  10162. checkForAliasModel(el, value);
  10163. }
  10164. }
  10165. } else {
  10166. // literal attribute
  10167. if (true) {
  10168. var res = parseText(value, delimiters);
  10169. if (res) {
  10170. warn$2(
  10171. name + "=\"" + value + "\": " +
  10172. 'Interpolation inside attributes has been removed. ' +
  10173. 'Use v-bind or the colon shorthand instead. For example, ' +
  10174. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  10175. );
  10176. }
  10177. }
  10178. addAttr(el, name, JSON.stringify(value));
  10179. // #6887 firefox doesn't update muted state if set via attribute
  10180. // even immediately after element creation
  10181. if (!el.component &&
  10182. name === 'muted' &&
  10183. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  10184. addProp(el, name, 'true');
  10185. }
  10186. }
  10187. }
  10188. }
  10189. function checkInFor (el) {
  10190. var parent = el;
  10191. while (parent) {
  10192. if (parent.for !== undefined) {
  10193. return true
  10194. }
  10195. parent = parent.parent;
  10196. }
  10197. return false
  10198. }
  10199. function parseModifiers (name) {
  10200. var match = name.match(modifierRE);
  10201. if (match) {
  10202. var ret = {};
  10203. match.forEach(function (m) { ret[m.slice(1)] = true; });
  10204. return ret
  10205. }
  10206. }
  10207. function makeAttrsMap (attrs) {
  10208. var map = {};
  10209. for (var i = 0, l = attrs.length; i < l; i++) {
  10210. if (
  10211. "development" !== 'production' &&
  10212. map[attrs[i].name] && !isIE && !isEdge
  10213. ) {
  10214. warn$2('duplicate attribute: ' + attrs[i].name);
  10215. }
  10216. map[attrs[i].name] = attrs[i].value;
  10217. }
  10218. return map
  10219. }
  10220. // for script (e.g. type="x/template") or style, do not decode content
  10221. function isTextTag (el) {
  10222. return el.tag === 'script' || el.tag === 'style'
  10223. }
  10224. function isForbiddenTag (el) {
  10225. return (
  10226. el.tag === 'style' ||
  10227. (el.tag === 'script' && (
  10228. !el.attrsMap.type ||
  10229. el.attrsMap.type === 'text/javascript'
  10230. ))
  10231. )
  10232. }
  10233. var ieNSBug = /^xmlns:NS\d+/;
  10234. var ieNSPrefix = /^NS\d+:/;
  10235. /* istanbul ignore next */
  10236. function guardIESVGBug (attrs) {
  10237. var res = [];
  10238. for (var i = 0; i < attrs.length; i++) {
  10239. var attr = attrs[i];
  10240. if (!ieNSBug.test(attr.name)) {
  10241. attr.name = attr.name.replace(ieNSPrefix, '');
  10242. res.push(attr);
  10243. }
  10244. }
  10245. return res
  10246. }
  10247. function checkForAliasModel (el, value) {
  10248. var _el = el;
  10249. while (_el) {
  10250. if (_el.for && _el.alias === value) {
  10251. warn$2(
  10252. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  10253. "You are binding v-model directly to a v-for iteration alias. " +
  10254. "This will not be able to modify the v-for source array because " +
  10255. "writing to the alias is like modifying a function local variable. " +
  10256. "Consider using an array of objects and use v-model on an object property instead."
  10257. );
  10258. }
  10259. _el = _el.parent;
  10260. }
  10261. }
  10262. /* */
  10263. function preTransformNode (el, options) {
  10264. if (el.tag === 'input') {
  10265. var map = el.attrsMap;
  10266. if (!map['v-model']) {
  10267. return
  10268. }
  10269. var typeBinding;
  10270. if (map[':type'] || map['v-bind:type']) {
  10271. typeBinding = getBindingAttr(el, 'type');
  10272. }
  10273. if (!map.type && !typeBinding && map['v-bind']) {
  10274. typeBinding = "(" + (map['v-bind']) + ").type";
  10275. }
  10276. if (typeBinding) {
  10277. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  10278. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  10279. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  10280. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  10281. // 1. checkbox
  10282. var branch0 = cloneASTElement(el);
  10283. // process for on the main node
  10284. processFor(branch0);
  10285. addRawAttr(branch0, 'type', 'checkbox');
  10286. processElement(branch0, options);
  10287. branch0.processed = true; // prevent it from double-processed
  10288. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  10289. addIfCondition(branch0, {
  10290. exp: branch0.if,
  10291. block: branch0
  10292. });
  10293. // 2. add radio else-if condition
  10294. var branch1 = cloneASTElement(el);
  10295. getAndRemoveAttr(branch1, 'v-for', true);
  10296. addRawAttr(branch1, 'type', 'radio');
  10297. processElement(branch1, options);
  10298. addIfCondition(branch0, {
  10299. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  10300. block: branch1
  10301. });
  10302. // 3. other
  10303. var branch2 = cloneASTElement(el);
  10304. getAndRemoveAttr(branch2, 'v-for', true);
  10305. addRawAttr(branch2, ':type', typeBinding);
  10306. processElement(branch2, options);
  10307. addIfCondition(branch0, {
  10308. exp: ifCondition,
  10309. block: branch2
  10310. });
  10311. if (hasElse) {
  10312. branch0.else = true;
  10313. } else if (elseIfCondition) {
  10314. branch0.elseif = elseIfCondition;
  10315. }
  10316. return branch0
  10317. }
  10318. }
  10319. }
  10320. function cloneASTElement (el) {
  10321. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  10322. }
  10323. var model$1 = {
  10324. preTransformNode: preTransformNode
  10325. };
  10326. var modules$1 = [
  10327. klass$1,
  10328. style$1,
  10329. model$1
  10330. ];
  10331. /* */
  10332. function text (el, dir) {
  10333. if (dir.value) {
  10334. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  10335. }
  10336. }
  10337. /* */
  10338. function html (el, dir) {
  10339. if (dir.value) {
  10340. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  10341. }
  10342. }
  10343. var directives$1 = {
  10344. model: model,
  10345. text: text,
  10346. html: html
  10347. };
  10348. /* */
  10349. var baseOptions = {
  10350. expectHTML: true,
  10351. modules: modules$1,
  10352. directives: directives$1,
  10353. isPreTag: isPreTag,
  10354. isUnaryTag: isUnaryTag,
  10355. mustUseProp: mustUseProp,
  10356. canBeLeftOpenTag: canBeLeftOpenTag,
  10357. isReservedTag: isReservedTag,
  10358. getTagNamespace: getTagNamespace,
  10359. staticKeys: genStaticKeys(modules$1)
  10360. };
  10361. /* */
  10362. var isStaticKey;
  10363. var isPlatformReservedTag;
  10364. var genStaticKeysCached = cached(genStaticKeys$1);
  10365. /**
  10366. * Goal of the optimizer: walk the generated template AST tree
  10367. * and detect sub-trees that are purely static, i.e. parts of
  10368. * the DOM that never needs to change.
  10369. *
  10370. * Once we detect these sub-trees, we can:
  10371. *
  10372. * 1. Hoist them into constants, so that we no longer need to
  10373. * create fresh nodes for them on each re-render;
  10374. * 2. Completely skip them in the patching process.
  10375. */
  10376. function optimize (root, options) {
  10377. if (!root) { return }
  10378. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  10379. isPlatformReservedTag = options.isReservedTag || no;
  10380. // first pass: mark all non-static nodes.
  10381. markStatic$1(root);
  10382. // second pass: mark static roots.
  10383. markStaticRoots(root, false);
  10384. }
  10385. function genStaticKeys$1 (keys) {
  10386. return makeMap(
  10387. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  10388. (keys ? ',' + keys : '')
  10389. )
  10390. }
  10391. function markStatic$1 (node) {
  10392. node.static = isStatic(node);
  10393. if (node.type === 1) {
  10394. // do not make component slot content static. this avoids
  10395. // 1. components not able to mutate slot nodes
  10396. // 2. static slot content fails for hot-reloading
  10397. if (
  10398. !isPlatformReservedTag(node.tag) &&
  10399. node.tag !== 'slot' &&
  10400. node.attrsMap['inline-template'] == null
  10401. ) {
  10402. return
  10403. }
  10404. for (var i = 0, l = node.children.length; i < l; i++) {
  10405. var child = node.children[i];
  10406. markStatic$1(child);
  10407. if (!child.static) {
  10408. node.static = false;
  10409. }
  10410. }
  10411. if (node.ifConditions) {
  10412. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  10413. var block = node.ifConditions[i$1].block;
  10414. markStatic$1(block);
  10415. if (!block.static) {
  10416. node.static = false;
  10417. }
  10418. }
  10419. }
  10420. }
  10421. }
  10422. function markStaticRoots (node, isInFor) {
  10423. if (node.type === 1) {
  10424. if (node.static || node.once) {
  10425. node.staticInFor = isInFor;
  10426. }
  10427. // For a node to qualify as a static root, it should have children that
  10428. // are not just static text. Otherwise the cost of hoisting out will
  10429. // outweigh the benefits and it's better off to just always render it fresh.
  10430. if (node.static && node.children.length && !(
  10431. node.children.length === 1 &&
  10432. node.children[0].type === 3
  10433. )) {
  10434. node.staticRoot = true;
  10435. return
  10436. } else {
  10437. node.staticRoot = false;
  10438. }
  10439. if (node.children) {
  10440. for (var i = 0, l = node.children.length; i < l; i++) {
  10441. markStaticRoots(node.children[i], isInFor || !!node.for);
  10442. }
  10443. }
  10444. if (node.ifConditions) {
  10445. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  10446. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  10447. }
  10448. }
  10449. }
  10450. }
  10451. function isStatic (node) {
  10452. if (node.type === 2) { // expression
  10453. return false
  10454. }
  10455. if (node.type === 3) { // text
  10456. return true
  10457. }
  10458. return !!(node.pre || (
  10459. !node.hasBindings && // no dynamic bindings
  10460. !node.if && !node.for && // not v-if or v-for or v-else
  10461. !isBuiltInTag(node.tag) && // not a built-in
  10462. isPlatformReservedTag(node.tag) && // not a component
  10463. !isDirectChildOfTemplateFor(node) &&
  10464. Object.keys(node).every(isStaticKey)
  10465. ))
  10466. }
  10467. function isDirectChildOfTemplateFor (node) {
  10468. while (node.parent) {
  10469. node = node.parent;
  10470. if (node.tag !== 'template') {
  10471. return false
  10472. }
  10473. if (node.for) {
  10474. return true
  10475. }
  10476. }
  10477. return false
  10478. }
  10479. /* */
  10480. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  10481. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  10482. // KeyboardEvent.keyCode aliases
  10483. var keyCodes = {
  10484. esc: 27,
  10485. tab: 9,
  10486. enter: 13,
  10487. space: 32,
  10488. up: 38,
  10489. left: 37,
  10490. right: 39,
  10491. down: 40,
  10492. 'delete': [8, 46]
  10493. };
  10494. // KeyboardEvent.key aliases
  10495. var keyNames = {
  10496. // #7880: IE11 and Edge use `Esc` for Escape key name.
  10497. esc: ['Esc', 'Escape'],
  10498. tab: 'Tab',
  10499. enter: 'Enter',
  10500. // #9112: IE11 uses `Spacebar` for Space key name.
  10501. space: [' ', 'Spacebar'],
  10502. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  10503. up: ['Up', 'ArrowUp'],
  10504. left: ['Left', 'ArrowLeft'],
  10505. right: ['Right', 'ArrowRight'],
  10506. down: ['Down', 'ArrowDown'],
  10507. // #9112: IE11 uses `Del` for Delete key name.
  10508. 'delete': ['Backspace', 'Delete', 'Del']
  10509. };
  10510. // #4868: modifiers that prevent the execution of the listener
  10511. // need to explicitly return null so that we can determine whether to remove
  10512. // the listener for .once
  10513. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  10514. var modifierCode = {
  10515. stop: '$event.stopPropagation();',
  10516. prevent: '$event.preventDefault();',
  10517. self: genGuard("$event.target !== $event.currentTarget"),
  10518. ctrl: genGuard("!$event.ctrlKey"),
  10519. shift: genGuard("!$event.shiftKey"),
  10520. alt: genGuard("!$event.altKey"),
  10521. meta: genGuard("!$event.metaKey"),
  10522. left: genGuard("'button' in $event && $event.button !== 0"),
  10523. middle: genGuard("'button' in $event && $event.button !== 1"),
  10524. right: genGuard("'button' in $event && $event.button !== 2")
  10525. };
  10526. function genHandlers (
  10527. events,
  10528. isNative
  10529. ) {
  10530. var res = isNative ? 'nativeOn:{' : 'on:{';
  10531. for (var name in events) {
  10532. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  10533. }
  10534. return res.slice(0, -1) + '}'
  10535. }
  10536. function genHandler (
  10537. name,
  10538. handler
  10539. ) {
  10540. if (!handler) {
  10541. return 'function(){}'
  10542. }
  10543. if (Array.isArray(handler)) {
  10544. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  10545. }
  10546. var isMethodPath = simplePathRE.test(handler.value);
  10547. var isFunctionExpression = fnExpRE.test(handler.value);
  10548. if (!handler.modifiers) {
  10549. if (isMethodPath || isFunctionExpression) {
  10550. return handler.value
  10551. }
  10552. return ("function($event){" + (handler.value) + "}") // inline statement
  10553. } else {
  10554. var code = '';
  10555. var genModifierCode = '';
  10556. var keys = [];
  10557. for (var key in handler.modifiers) {
  10558. if (modifierCode[key]) {
  10559. genModifierCode += modifierCode[key];
  10560. // left/right
  10561. if (keyCodes[key]) {
  10562. keys.push(key);
  10563. }
  10564. } else if (key === 'exact') {
  10565. var modifiers = (handler.modifiers);
  10566. genModifierCode += genGuard(
  10567. ['ctrl', 'shift', 'alt', 'meta']
  10568. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  10569. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  10570. .join('||')
  10571. );
  10572. } else {
  10573. keys.push(key);
  10574. }
  10575. }
  10576. if (keys.length) {
  10577. code += genKeyFilter(keys);
  10578. }
  10579. // Make sure modifiers like prevent and stop get executed after key filtering
  10580. if (genModifierCode) {
  10581. code += genModifierCode;
  10582. }
  10583. var handlerCode = isMethodPath
  10584. ? ("return " + (handler.value) + "($event)")
  10585. : isFunctionExpression
  10586. ? ("return (" + (handler.value) + ")($event)")
  10587. : handler.value;
  10588. return ("function($event){" + code + handlerCode + "}")
  10589. }
  10590. }
  10591. function genKeyFilter (keys) {
  10592. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  10593. }
  10594. function genFilterCode (key) {
  10595. var keyVal = parseInt(key, 10);
  10596. if (keyVal) {
  10597. return ("$event.keyCode!==" + keyVal)
  10598. }
  10599. var keyCode = keyCodes[key];
  10600. var keyName = keyNames[key];
  10601. return (
  10602. "_k($event.keyCode," +
  10603. (JSON.stringify(key)) + "," +
  10604. (JSON.stringify(keyCode)) + "," +
  10605. "$event.key," +
  10606. "" + (JSON.stringify(keyName)) +
  10607. ")"
  10608. )
  10609. }
  10610. /* */
  10611. function on (el, dir) {
  10612. if ("development" !== 'production' && dir.modifiers) {
  10613. warn("v-on without argument does not support modifiers.");
  10614. }
  10615. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  10616. }
  10617. /* */
  10618. function bind$1 (el, dir) {
  10619. el.wrapData = function (code) {
  10620. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  10621. };
  10622. }
  10623. /* */
  10624. var baseDirectives = {
  10625. on: on,
  10626. bind: bind$1,
  10627. cloak: noop
  10628. };
  10629. /* */
  10630. var CodegenState = function CodegenState (options) {
  10631. this.options = options;
  10632. this.warn = options.warn || baseWarn;
  10633. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  10634. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  10635. this.directives = extend(extend({}, baseDirectives), options.directives);
  10636. var isReservedTag = options.isReservedTag || no;
  10637. this.maybeComponent = function (el) { return !(isReservedTag(el.tag) && !el.component); };
  10638. this.onceId = 0;
  10639. this.staticRenderFns = [];
  10640. this.pre = false;
  10641. };
  10642. function generate (
  10643. ast,
  10644. options
  10645. ) {
  10646. var state = new CodegenState(options);
  10647. var code = ast ? genElement(ast, state) : '_c("div")';
  10648. return {
  10649. render: ("with(this){return " + code + "}"),
  10650. staticRenderFns: state.staticRenderFns
  10651. }
  10652. }
  10653. function genElement (el, state) {
  10654. if (el.parent) {
  10655. el.pre = el.pre || el.parent.pre;
  10656. }
  10657. if (el.staticRoot && !el.staticProcessed) {
  10658. return genStatic(el, state)
  10659. } else if (el.once && !el.onceProcessed) {
  10660. return genOnce(el, state)
  10661. } else if (el.for && !el.forProcessed) {
  10662. return genFor(el, state)
  10663. } else if (el.if && !el.ifProcessed) {
  10664. return genIf(el, state)
  10665. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  10666. return genChildren(el, state) || 'void 0'
  10667. } else if (el.tag === 'slot') {
  10668. return genSlot(el, state)
  10669. } else {
  10670. // component or element
  10671. var code;
  10672. if (el.component) {
  10673. code = genComponent(el.component, el, state);
  10674. } else {
  10675. var data;
  10676. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  10677. data = genData$2(el, state);
  10678. }
  10679. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10680. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  10681. }
  10682. // module transforms
  10683. for (var i = 0; i < state.transforms.length; i++) {
  10684. code = state.transforms[i](el, code);
  10685. }
  10686. return code
  10687. }
  10688. }
  10689. // hoist static sub-trees out
  10690. function genStatic (el, state) {
  10691. el.staticProcessed = true;
  10692. // Some elements (templates) need to behave differently inside of a v-pre
  10693. // node. All pre nodes are static roots, so we can use this as a location to
  10694. // wrap a state change and reset it upon exiting the pre node.
  10695. var originalPreState = state.pre;
  10696. if (el.pre) {
  10697. state.pre = el.pre;
  10698. }
  10699. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  10700. state.pre = originalPreState;
  10701. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  10702. }
  10703. // v-once
  10704. function genOnce (el, state) {
  10705. el.onceProcessed = true;
  10706. if (el.if && !el.ifProcessed) {
  10707. return genIf(el, state)
  10708. } else if (el.staticInFor) {
  10709. var key = '';
  10710. var parent = el.parent;
  10711. while (parent) {
  10712. if (parent.for) {
  10713. key = parent.key;
  10714. break
  10715. }
  10716. parent = parent.parent;
  10717. }
  10718. if (!key) {
  10719. "development" !== 'production' && state.warn(
  10720. "v-once can only be used inside v-for that is keyed. "
  10721. );
  10722. return genElement(el, state)
  10723. }
  10724. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  10725. } else {
  10726. return genStatic(el, state)
  10727. }
  10728. }
  10729. function genIf (
  10730. el,
  10731. state,
  10732. altGen,
  10733. altEmpty
  10734. ) {
  10735. el.ifProcessed = true; // avoid recursion
  10736. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  10737. }
  10738. function genIfConditions (
  10739. conditions,
  10740. state,
  10741. altGen,
  10742. altEmpty
  10743. ) {
  10744. if (!conditions.length) {
  10745. return altEmpty || '_e()'
  10746. }
  10747. var condition = conditions.shift();
  10748. if (condition.exp) {
  10749. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  10750. } else {
  10751. return ("" + (genTernaryExp(condition.block)))
  10752. }
  10753. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  10754. function genTernaryExp (el) {
  10755. return altGen
  10756. ? altGen(el, state)
  10757. : el.once
  10758. ? genOnce(el, state)
  10759. : genElement(el, state)
  10760. }
  10761. }
  10762. function genFor (
  10763. el,
  10764. state,
  10765. altGen,
  10766. altHelper
  10767. ) {
  10768. var exp = el.for;
  10769. var alias = el.alias;
  10770. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10771. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10772. if ("development" !== 'production' &&
  10773. state.maybeComponent(el) &&
  10774. el.tag !== 'slot' &&
  10775. el.tag !== 'template' &&
  10776. !el.key
  10777. ) {
  10778. state.warn(
  10779. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10780. "v-for should have explicit keys. " +
  10781. "See https://vuejs.org/guide/list.html#key for more info.",
  10782. true /* tip */
  10783. );
  10784. }
  10785. el.forProcessed = true; // avoid recursion
  10786. return (altHelper || '_l') + "((" + exp + ")," +
  10787. "function(" + alias + iterator1 + iterator2 + "){" +
  10788. "return " + ((altGen || genElement)(el, state)) +
  10789. '})'
  10790. }
  10791. function genData$2 (el, state) {
  10792. var data = '{';
  10793. // directives first.
  10794. // directives may mutate the el's other properties before they are generated.
  10795. var dirs = genDirectives(el, state);
  10796. if (dirs) { data += dirs + ','; }
  10797. // key
  10798. if (el.key) {
  10799. data += "key:" + (el.key) + ",";
  10800. }
  10801. // ref
  10802. if (el.ref) {
  10803. data += "ref:" + (el.ref) + ",";
  10804. }
  10805. if (el.refInFor) {
  10806. data += "refInFor:true,";
  10807. }
  10808. // pre
  10809. if (el.pre) {
  10810. data += "pre:true,";
  10811. }
  10812. // record original tag name for components using "is" attribute
  10813. if (el.component) {
  10814. data += "tag:\"" + (el.tag) + "\",";
  10815. }
  10816. // module data generation functions
  10817. for (var i = 0; i < state.dataGenFns.length; i++) {
  10818. data += state.dataGenFns[i](el);
  10819. }
  10820. // attributes
  10821. if (el.attrs) {
  10822. data += "attrs:{" + (genProps(el.attrs)) + "},";
  10823. }
  10824. // DOM props
  10825. if (el.props) {
  10826. data += "domProps:{" + (genProps(el.props)) + "},";
  10827. }
  10828. // event handlers
  10829. if (el.events) {
  10830. data += (genHandlers(el.events, false)) + ",";
  10831. }
  10832. if (el.nativeEvents) {
  10833. data += (genHandlers(el.nativeEvents, true)) + ",";
  10834. }
  10835. // slot target
  10836. // only for non-scoped slots
  10837. if (el.slotTarget && !el.slotScope) {
  10838. data += "slot:" + (el.slotTarget) + ",";
  10839. }
  10840. // scoped slots
  10841. if (el.scopedSlots) {
  10842. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  10843. }
  10844. // component v-model
  10845. if (el.model) {
  10846. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10847. }
  10848. // inline-template
  10849. if (el.inlineTemplate) {
  10850. var inlineTemplate = genInlineTemplate(el, state);
  10851. if (inlineTemplate) {
  10852. data += inlineTemplate + ",";
  10853. }
  10854. }
  10855. data = data.replace(/,$/, '') + '}';
  10856. // v-bind data wrap
  10857. if (el.wrapData) {
  10858. data = el.wrapData(data);
  10859. }
  10860. // v-on data wrap
  10861. if (el.wrapListeners) {
  10862. data = el.wrapListeners(data);
  10863. }
  10864. return data
  10865. }
  10866. function genDirectives (el, state) {
  10867. var dirs = el.directives;
  10868. if (!dirs) { return }
  10869. var res = 'directives:[';
  10870. var hasRuntime = false;
  10871. var i, l, dir, needRuntime;
  10872. for (i = 0, l = dirs.length; i < l; i++) {
  10873. dir = dirs[i];
  10874. needRuntime = true;
  10875. var gen = state.directives[dir.name];
  10876. if (gen) {
  10877. // compile-time directive that manipulates AST.
  10878. // returns true if it also needs a runtime counterpart.
  10879. needRuntime = !!gen(el, dir, state.warn);
  10880. }
  10881. if (needRuntime) {
  10882. hasRuntime = true;
  10883. 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))) : '') + "},";
  10884. }
  10885. }
  10886. if (hasRuntime) {
  10887. return res.slice(0, -1) + ']'
  10888. }
  10889. }
  10890. function genInlineTemplate (el, state) {
  10891. var ast = el.children[0];
  10892. if ("development" !== 'production' && (
  10893. el.children.length !== 1 || ast.type !== 1
  10894. )) {
  10895. state.warn('Inline-template components must have exactly one child element.');
  10896. }
  10897. if (ast.type === 1) {
  10898. var inlineRenderFns = generate(ast, state.options);
  10899. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10900. }
  10901. }
  10902. function genScopedSlots (
  10903. slots,
  10904. state
  10905. ) {
  10906. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  10907. return genScopedSlot(key, slots[key], state)
  10908. }).join(',')) + "])")
  10909. }
  10910. function genScopedSlot (
  10911. key,
  10912. el,
  10913. state
  10914. ) {
  10915. if (el.for && !el.forProcessed) {
  10916. return genForScopedSlot(key, el, state)
  10917. }
  10918. var fn = "function(" + (String(el.slotScope)) + "){" +
  10919. "return " + (el.tag === 'template'
  10920. ? el.if
  10921. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10922. : genChildren(el, state) || 'undefined'
  10923. : genElement(el, state)) + "}";
  10924. return ("{key:" + key + ",fn:" + fn + "}")
  10925. }
  10926. function genForScopedSlot (
  10927. key,
  10928. el,
  10929. state
  10930. ) {
  10931. var exp = el.for;
  10932. var alias = el.alias;
  10933. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10934. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10935. el.forProcessed = true; // avoid recursion
  10936. return "_l((" + exp + ")," +
  10937. "function(" + alias + iterator1 + iterator2 + "){" +
  10938. "return " + (genScopedSlot(key, el, state)) +
  10939. '})'
  10940. }
  10941. function genChildren (
  10942. el,
  10943. state,
  10944. checkSkip,
  10945. altGenElement,
  10946. altGenNode
  10947. ) {
  10948. var children = el.children;
  10949. if (children.length) {
  10950. var el$1 = children[0];
  10951. // optimize single v-for
  10952. if (children.length === 1 &&
  10953. el$1.for &&
  10954. el$1.tag !== 'template' &&
  10955. el$1.tag !== 'slot'
  10956. ) {
  10957. var normalizationType = checkSkip
  10958. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10959. : "";
  10960. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10961. }
  10962. var normalizationType$1 = checkSkip
  10963. ? getNormalizationType(children, state.maybeComponent)
  10964. : 0;
  10965. var gen = altGenNode || genNode;
  10966. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10967. }
  10968. }
  10969. // determine the normalization needed for the children array.
  10970. // 0: no normalization needed
  10971. // 1: simple normalization needed (possible 1-level deep nested array)
  10972. // 2: full normalization needed
  10973. function getNormalizationType (
  10974. children,
  10975. maybeComponent
  10976. ) {
  10977. var res = 0;
  10978. for (var i = 0; i < children.length; i++) {
  10979. var el = children[i];
  10980. if (el.type !== 1) {
  10981. continue
  10982. }
  10983. if (needsNormalization(el) ||
  10984. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10985. res = 2;
  10986. break
  10987. }
  10988. if (maybeComponent(el) ||
  10989. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10990. res = 1;
  10991. }
  10992. }
  10993. return res
  10994. }
  10995. function needsNormalization (el) {
  10996. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10997. }
  10998. function genNode (node, state) {
  10999. if (node.type === 1) {
  11000. return genElement(node, state)
  11001. } else if (node.type === 3 && node.isComment) {
  11002. return genComment(node)
  11003. } else {
  11004. return genText(node)
  11005. }
  11006. }
  11007. function genText (text) {
  11008. return ("_v(" + (text.type === 2
  11009. ? text.expression // no need for () because already wrapped in _s()
  11010. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  11011. }
  11012. function genComment (comment) {
  11013. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  11014. }
  11015. function genSlot (el, state) {
  11016. var slotName = el.slotName || '"default"';
  11017. var children = genChildren(el, state);
  11018. var res = "_t(" + slotName + (children ? ("," + children) : '');
  11019. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  11020. var bind$$1 = el.attrsMap['v-bind'];
  11021. if ((attrs || bind$$1) && !children) {
  11022. res += ",null";
  11023. }
  11024. if (attrs) {
  11025. res += "," + attrs;
  11026. }
  11027. if (bind$$1) {
  11028. res += (attrs ? '' : ',null') + "," + bind$$1;
  11029. }
  11030. return res + ')'
  11031. }
  11032. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  11033. function genComponent (
  11034. componentName,
  11035. el,
  11036. state
  11037. ) {
  11038. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  11039. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  11040. }
  11041. function genProps (props) {
  11042. var res = '';
  11043. for (var i = 0; i < props.length; i++) {
  11044. var prop = props[i];
  11045. /* istanbul ignore if */
  11046. {
  11047. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  11048. }
  11049. }
  11050. return res.slice(0, -1)
  11051. }
  11052. // #3895, #4268
  11053. function transformSpecialNewlines (text) {
  11054. return text
  11055. .replace(/\u2028/g, '\\u2028')
  11056. .replace(/\u2029/g, '\\u2029')
  11057. }
  11058. /* */
  11059. // these keywords should not appear inside expressions, but operators like
  11060. // typeof, instanceof and in are allowed
  11061. var prohibitedKeywordRE = new RegExp('\\b' + (
  11062. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  11063. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  11064. 'extends,finally,continue,debugger,function,arguments'
  11065. ).split(',').join('\\b|\\b') + '\\b');
  11066. // these unary operators should not be used as property/method names
  11067. var unaryOperatorsRE = new RegExp('\\b' + (
  11068. 'delete,typeof,void'
  11069. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  11070. // strip strings in expressions
  11071. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  11072. // detect problematic expressions in a template
  11073. function detectErrors (ast) {
  11074. var errors = [];
  11075. if (ast) {
  11076. checkNode(ast, errors);
  11077. }
  11078. return errors
  11079. }
  11080. function checkNode (node, errors) {
  11081. if (node.type === 1) {
  11082. for (var name in node.attrsMap) {
  11083. if (dirRE.test(name)) {
  11084. var value = node.attrsMap[name];
  11085. if (value) {
  11086. if (name === 'v-for') {
  11087. checkFor(node, ("v-for=\"" + value + "\""), errors);
  11088. } else if (onRE.test(name)) {
  11089. checkEvent(value, (name + "=\"" + value + "\""), errors);
  11090. } else {
  11091. checkExpression(value, (name + "=\"" + value + "\""), errors);
  11092. }
  11093. }
  11094. }
  11095. }
  11096. if (node.children) {
  11097. for (var i = 0; i < node.children.length; i++) {
  11098. checkNode(node.children[i], errors);
  11099. }
  11100. }
  11101. } else if (node.type === 2) {
  11102. checkExpression(node.expression, node.text, errors);
  11103. }
  11104. }
  11105. function checkEvent (exp, text, errors) {
  11106. var stipped = exp.replace(stripStringRE, '');
  11107. var keywordMatch = stipped.match(unaryOperatorsRE);
  11108. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  11109. errors.push(
  11110. "avoid using JavaScript unary operator as property name: " +
  11111. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  11112. );
  11113. }
  11114. checkExpression(exp, text, errors);
  11115. }
  11116. function checkFor (node, text, errors) {
  11117. checkExpression(node.for || '', text, errors);
  11118. checkIdentifier(node.alias, 'v-for alias', text, errors);
  11119. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  11120. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  11121. }
  11122. function checkIdentifier (
  11123. ident,
  11124. type,
  11125. text,
  11126. errors
  11127. ) {
  11128. if (typeof ident === 'string') {
  11129. try {
  11130. new Function(("var " + ident + "=_"));
  11131. } catch (e) {
  11132. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  11133. }
  11134. }
  11135. }
  11136. function checkExpression (exp, text, errors) {
  11137. try {
  11138. new Function(("return " + exp));
  11139. } catch (e) {
  11140. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  11141. if (keywordMatch) {
  11142. errors.push(
  11143. "avoid using JavaScript keyword as property name: " +
  11144. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
  11145. );
  11146. } else {
  11147. errors.push(
  11148. "invalid expression: " + (e.message) + " in\n\n" +
  11149. " " + exp + "\n\n" +
  11150. " Raw expression: " + (text.trim()) + "\n"
  11151. );
  11152. }
  11153. }
  11154. }
  11155. /* */
  11156. function createFunction (code, errors) {
  11157. try {
  11158. return new Function(code)
  11159. } catch (err) {
  11160. errors.push({ err: err, code: code });
  11161. return noop
  11162. }
  11163. }
  11164. function createCompileToFunctionFn (compile) {
  11165. var cache = Object.create(null);
  11166. return function compileToFunctions (
  11167. template,
  11168. options,
  11169. vm
  11170. ) {
  11171. options = extend({}, options);
  11172. var warn$$1 = options.warn || warn;
  11173. delete options.warn;
  11174. /* istanbul ignore if */
  11175. if (true) {
  11176. // detect possible CSP restriction
  11177. try {
  11178. new Function('return 1');
  11179. } catch (e) {
  11180. if (e.toString().match(/unsafe-eval|CSP/)) {
  11181. warn$$1(
  11182. 'It seems you are using the standalone build of Vue.js in an ' +
  11183. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  11184. 'The template compiler cannot work in this environment. Consider ' +
  11185. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  11186. 'templates into render functions.'
  11187. );
  11188. }
  11189. }
  11190. }
  11191. // check cache
  11192. var key = options.delimiters
  11193. ? String(options.delimiters) + template
  11194. : template;
  11195. if (cache[key]) {
  11196. return cache[key]
  11197. }
  11198. // compile
  11199. var compiled = compile(template, options);
  11200. // check compilation errors/tips
  11201. if (true) {
  11202. if (compiled.errors && compiled.errors.length) {
  11203. warn$$1(
  11204. "Error compiling template:\n\n" + template + "\n\n" +
  11205. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  11206. vm
  11207. );
  11208. }
  11209. if (compiled.tips && compiled.tips.length) {
  11210. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  11211. }
  11212. }
  11213. // turn code into functions
  11214. var res = {};
  11215. var fnGenErrors = [];
  11216. res.render = createFunction(compiled.render, fnGenErrors);
  11217. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  11218. return createFunction(code, fnGenErrors)
  11219. });
  11220. // check function generation errors.
  11221. // this should only happen if there is a bug in the compiler itself.
  11222. // mostly for codegen development use
  11223. /* istanbul ignore if */
  11224. if (true) {
  11225. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  11226. warn$$1(
  11227. "Failed to generate render function:\n\n" +
  11228. fnGenErrors.map(function (ref) {
  11229. var err = ref.err;
  11230. var code = ref.code;
  11231. return ((err.toString()) + " in\n\n" + code + "\n");
  11232. }).join('\n'),
  11233. vm
  11234. );
  11235. }
  11236. }
  11237. return (cache[key] = res)
  11238. }
  11239. }
  11240. /* */
  11241. function createCompilerCreator (baseCompile) {
  11242. return function createCompiler (baseOptions) {
  11243. function compile (
  11244. template,
  11245. options
  11246. ) {
  11247. var finalOptions = Object.create(baseOptions);
  11248. var errors = [];
  11249. var tips = [];
  11250. finalOptions.warn = function (msg, tip) {
  11251. (tip ? tips : errors).push(msg);
  11252. };
  11253. if (options) {
  11254. // merge custom modules
  11255. if (options.modules) {
  11256. finalOptions.modules =
  11257. (baseOptions.modules || []).concat(options.modules);
  11258. }
  11259. // merge custom directives
  11260. if (options.directives) {
  11261. finalOptions.directives = extend(
  11262. Object.create(baseOptions.directives || null),
  11263. options.directives
  11264. );
  11265. }
  11266. // copy other options
  11267. for (var key in options) {
  11268. if (key !== 'modules' && key !== 'directives') {
  11269. finalOptions[key] = options[key];
  11270. }
  11271. }
  11272. }
  11273. var compiled = baseCompile(template, finalOptions);
  11274. if (true) {
  11275. errors.push.apply(errors, detectErrors(compiled.ast));
  11276. }
  11277. compiled.errors = errors;
  11278. compiled.tips = tips;
  11279. return compiled
  11280. }
  11281. return {
  11282. compile: compile,
  11283. compileToFunctions: createCompileToFunctionFn(compile)
  11284. }
  11285. }
  11286. }
  11287. /* */
  11288. // `createCompilerCreator` allows creating compilers that use alternative
  11289. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  11290. // Here we just export a default compiler using the default parts.
  11291. var createCompiler = createCompilerCreator(function baseCompile (
  11292. template,
  11293. options
  11294. ) {
  11295. var ast = parse(template.trim(), options);
  11296. if (options.optimize !== false) {
  11297. optimize(ast, options);
  11298. }
  11299. var code = generate(ast, options);
  11300. return {
  11301. ast: ast,
  11302. render: code.render,
  11303. staticRenderFns: code.staticRenderFns
  11304. }
  11305. });
  11306. /* */
  11307. var ref$1 = createCompiler(baseOptions);
  11308. var compile = ref$1.compile;
  11309. var compileToFunctions = ref$1.compileToFunctions;
  11310. /* */
  11311. // check whether current browser encodes a char inside attribute values
  11312. var div;
  11313. function getShouldDecode (href) {
  11314. div = div || document.createElement('div');
  11315. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  11316. return div.innerHTML.indexOf('&#10;') > 0
  11317. }
  11318. // #3663: IE encodes newlines inside attribute values while other browsers don't
  11319. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  11320. // #6828: chrome encodes content in a[href]
  11321. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  11322. /* */
  11323. var idToTemplate = cached(function (id) {
  11324. var el = query(id);
  11325. return el && el.innerHTML
  11326. });
  11327. var mount = Vue.prototype.$mount;
  11328. Vue.prototype.$mount = function (
  11329. el,
  11330. hydrating
  11331. ) {
  11332. el = el && query(el);
  11333. /* istanbul ignore if */
  11334. if (el === document.body || el === document.documentElement) {
  11335. "development" !== 'production' && warn(
  11336. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  11337. );
  11338. return this
  11339. }
  11340. var options = this.$options;
  11341. // resolve template/el and convert to render function
  11342. if (!options.render) {
  11343. var template = options.template;
  11344. if (template) {
  11345. if (typeof template === 'string') {
  11346. if (template.charAt(0) === '#') {
  11347. template = idToTemplate(template);
  11348. /* istanbul ignore if */
  11349. if ("development" !== 'production' && !template) {
  11350. warn(
  11351. ("Template element not found or is empty: " + (options.template)),
  11352. this
  11353. );
  11354. }
  11355. }
  11356. } else if (template.nodeType) {
  11357. template = template.innerHTML;
  11358. } else {
  11359. if (true) {
  11360. warn('invalid template option:' + template, this);
  11361. }
  11362. return this
  11363. }
  11364. } else if (el) {
  11365. template = getOuterHTML(el);
  11366. }
  11367. if (template) {
  11368. /* istanbul ignore if */
  11369. if ("development" !== 'production' && config.performance && mark) {
  11370. mark('compile');
  11371. }
  11372. var ref = compileToFunctions(template, {
  11373. shouldDecodeNewlines: shouldDecodeNewlines,
  11374. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  11375. delimiters: options.delimiters,
  11376. comments: options.comments
  11377. }, this);
  11378. var render = ref.render;
  11379. var staticRenderFns = ref.staticRenderFns;
  11380. options.render = render;
  11381. options.staticRenderFns = staticRenderFns;
  11382. /* istanbul ignore if */
  11383. if ("development" !== 'production' && config.performance && mark) {
  11384. mark('compile end');
  11385. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  11386. }
  11387. }
  11388. }
  11389. return mount.call(this, el, hydrating)
  11390. };
  11391. /**
  11392. * Get outerHTML of elements, taking care
  11393. * of SVG elements in IE as well.
  11394. */
  11395. function getOuterHTML (el) {
  11396. if (el.outerHTML) {
  11397. return el.outerHTML
  11398. } else {
  11399. var container = document.createElement('div');
  11400. container.appendChild(el.cloneNode(true));
  11401. return container.innerHTML
  11402. }
  11403. }
  11404. Vue.compile = compileToFunctions;
  11405. module.exports = Vue;
  11406. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(38).setImmediate))
  11407. /***/ }),
  11408. /* 6 */
  11409. /***/ (function(module, exports, __webpack_require__) {
  11410. module.exports = __webpack_require__(20);
  11411. /***/ }),
  11412. /* 7 */
  11413. /***/ (function(module, exports, __webpack_require__) {
  11414. "use strict";
  11415. module.exports = function bind(fn, thisArg) {
  11416. return function wrap() {
  11417. var args = new Array(arguments.length);
  11418. for (var i = 0; i < args.length; i++) {
  11419. args[i] = arguments[i];
  11420. }
  11421. return fn.apply(thisArg, args);
  11422. };
  11423. };
  11424. /***/ }),
  11425. /* 8 */
  11426. /***/ (function(module, exports) {
  11427. // shim for using process in browser
  11428. var process = module.exports = {};
  11429. // cached from whatever global is present so that test runners that stub it
  11430. // don't break things. But we need to wrap it in a try catch in case it is
  11431. // wrapped in strict mode code which doesn't define any globals. It's inside a
  11432. // function because try/catches deoptimize in certain engines.
  11433. var cachedSetTimeout;
  11434. var cachedClearTimeout;
  11435. function defaultSetTimout() {
  11436. throw new Error('setTimeout has not been defined');
  11437. }
  11438. function defaultClearTimeout () {
  11439. throw new Error('clearTimeout has not been defined');
  11440. }
  11441. (function () {
  11442. try {
  11443. if (typeof setTimeout === 'function') {
  11444. cachedSetTimeout = setTimeout;
  11445. } else {
  11446. cachedSetTimeout = defaultSetTimout;
  11447. }
  11448. } catch (e) {
  11449. cachedSetTimeout = defaultSetTimout;
  11450. }
  11451. try {
  11452. if (typeof clearTimeout === 'function') {
  11453. cachedClearTimeout = clearTimeout;
  11454. } else {
  11455. cachedClearTimeout = defaultClearTimeout;
  11456. }
  11457. } catch (e) {
  11458. cachedClearTimeout = defaultClearTimeout;
  11459. }
  11460. } ())
  11461. function runTimeout(fun) {
  11462. if (cachedSetTimeout === setTimeout) {
  11463. //normal enviroments in sane situations
  11464. return setTimeout(fun, 0);
  11465. }
  11466. // if setTimeout wasn't available but was latter defined
  11467. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  11468. cachedSetTimeout = setTimeout;
  11469. return setTimeout(fun, 0);
  11470. }
  11471. try {
  11472. // when when somebody has screwed with setTimeout but no I.E. maddness
  11473. return cachedSetTimeout(fun, 0);
  11474. } catch(e){
  11475. try {
  11476. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  11477. return cachedSetTimeout.call(null, fun, 0);
  11478. } catch(e){
  11479. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  11480. return cachedSetTimeout.call(this, fun, 0);
  11481. }
  11482. }
  11483. }
  11484. function runClearTimeout(marker) {
  11485. if (cachedClearTimeout === clearTimeout) {
  11486. //normal enviroments in sane situations
  11487. return clearTimeout(marker);
  11488. }
  11489. // if clearTimeout wasn't available but was latter defined
  11490. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  11491. cachedClearTimeout = clearTimeout;
  11492. return clearTimeout(marker);
  11493. }
  11494. try {
  11495. // when when somebody has screwed with setTimeout but no I.E. maddness
  11496. return cachedClearTimeout(marker);
  11497. } catch (e){
  11498. try {
  11499. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  11500. return cachedClearTimeout.call(null, marker);
  11501. } catch (e){
  11502. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  11503. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  11504. return cachedClearTimeout.call(this, marker);
  11505. }
  11506. }
  11507. }
  11508. var queue = [];
  11509. var draining = false;
  11510. var currentQueue;
  11511. var queueIndex = -1;
  11512. function cleanUpNextTick() {
  11513. if (!draining || !currentQueue) {
  11514. return;
  11515. }
  11516. draining = false;
  11517. if (currentQueue.length) {
  11518. queue = currentQueue.concat(queue);
  11519. } else {
  11520. queueIndex = -1;
  11521. }
  11522. if (queue.length) {
  11523. drainQueue();
  11524. }
  11525. }
  11526. function drainQueue() {
  11527. if (draining) {
  11528. return;
  11529. }
  11530. var timeout = runTimeout(cleanUpNextTick);
  11531. draining = true;
  11532. var len = queue.length;
  11533. while(len) {
  11534. currentQueue = queue;
  11535. queue = [];
  11536. while (++queueIndex < len) {
  11537. if (currentQueue) {
  11538. currentQueue[queueIndex].run();
  11539. }
  11540. }
  11541. queueIndex = -1;
  11542. len = queue.length;
  11543. }
  11544. currentQueue = null;
  11545. draining = false;
  11546. runClearTimeout(timeout);
  11547. }
  11548. process.nextTick = function (fun) {
  11549. var args = new Array(arguments.length - 1);
  11550. if (arguments.length > 1) {
  11551. for (var i = 1; i < arguments.length; i++) {
  11552. args[i - 1] = arguments[i];
  11553. }
  11554. }
  11555. queue.push(new Item(fun, args));
  11556. if (queue.length === 1 && !draining) {
  11557. runTimeout(drainQueue);
  11558. }
  11559. };
  11560. // v8 likes predictible objects
  11561. function Item(fun, array) {
  11562. this.fun = fun;
  11563. this.array = array;
  11564. }
  11565. Item.prototype.run = function () {
  11566. this.fun.apply(null, this.array);
  11567. };
  11568. process.title = 'browser';
  11569. process.browser = true;
  11570. process.env = {};
  11571. process.argv = [];
  11572. process.version = ''; // empty string to avoid regexp issues
  11573. process.versions = {};
  11574. function noop() {}
  11575. process.on = noop;
  11576. process.addListener = noop;
  11577. process.once = noop;
  11578. process.off = noop;
  11579. process.removeListener = noop;
  11580. process.removeAllListeners = noop;
  11581. process.emit = noop;
  11582. process.prependListener = noop;
  11583. process.prependOnceListener = noop;
  11584. process.listeners = function (name) { return [] }
  11585. process.binding = function (name) {
  11586. throw new Error('process.binding is not supported');
  11587. };
  11588. process.cwd = function () { return '/' };
  11589. process.chdir = function (dir) {
  11590. throw new Error('process.chdir is not supported');
  11591. };
  11592. process.umask = function() { return 0; };
  11593. /***/ }),
  11594. /* 9 */
  11595. /***/ (function(module, exports, __webpack_require__) {
  11596. "use strict";
  11597. var utils = __webpack_require__(0);
  11598. var settle = __webpack_require__(24);
  11599. var buildURL = __webpack_require__(26);
  11600. var parseHeaders = __webpack_require__(27);
  11601. var isURLSameOrigin = __webpack_require__(28);
  11602. var createError = __webpack_require__(10);
  11603. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(29);
  11604. module.exports = function xhrAdapter(config) {
  11605. return new Promise(function dispatchXhrRequest(resolve, reject) {
  11606. var requestData = config.data;
  11607. var requestHeaders = config.headers;
  11608. if (utils.isFormData(requestData)) {
  11609. delete requestHeaders['Content-Type']; // Let the browser set it
  11610. }
  11611. var request = new XMLHttpRequest();
  11612. var loadEvent = 'onreadystatechange';
  11613. var xDomain = false;
  11614. // For IE 8/9 CORS support
  11615. // Only supports POST and GET calls and doesn't returns the response headers.
  11616. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  11617. if ("development" !== 'test' &&
  11618. typeof window !== 'undefined' &&
  11619. window.XDomainRequest && !('withCredentials' in request) &&
  11620. !isURLSameOrigin(config.url)) {
  11621. request = new window.XDomainRequest();
  11622. loadEvent = 'onload';
  11623. xDomain = true;
  11624. request.onprogress = function handleProgress() {};
  11625. request.ontimeout = function handleTimeout() {};
  11626. }
  11627. // HTTP basic authentication
  11628. if (config.auth) {
  11629. var username = config.auth.username || '';
  11630. var password = config.auth.password || '';
  11631. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  11632. }
  11633. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  11634. // Set the request timeout in MS
  11635. request.timeout = config.timeout;
  11636. // Listen for ready state
  11637. request[loadEvent] = function handleLoad() {
  11638. if (!request || (request.readyState !== 4 && !xDomain)) {
  11639. return;
  11640. }
  11641. // The request errored out and we didn't get a response, this will be
  11642. // handled by onerror instead
  11643. // With one exception: request that using file: protocol, most browsers
  11644. // will return status as 0 even though it's a successful request
  11645. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  11646. return;
  11647. }
  11648. // Prepare the response
  11649. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  11650. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  11651. var response = {
  11652. data: responseData,
  11653. // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
  11654. status: request.status === 1223 ? 204 : request.status,
  11655. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  11656. headers: responseHeaders,
  11657. config: config,
  11658. request: request
  11659. };
  11660. settle(resolve, reject, response);
  11661. // Clean up request
  11662. request = null;
  11663. };
  11664. // Handle low level network errors
  11665. request.onerror = function handleError() {
  11666. // Real errors are hidden from us by the browser
  11667. // onerror should only fire if it's a network error
  11668. reject(createError('Network Error', config, null, request));
  11669. // Clean up request
  11670. request = null;
  11671. };
  11672. // Handle timeout
  11673. request.ontimeout = function handleTimeout() {
  11674. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
  11675. request));
  11676. // Clean up request
  11677. request = null;
  11678. };
  11679. // Add xsrf header
  11680. // This is only done if running in a standard browser environment.
  11681. // Specifically not if we're in a web worker, or react-native.
  11682. if (utils.isStandardBrowserEnv()) {
  11683. var cookies = __webpack_require__(30);
  11684. // Add xsrf header
  11685. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  11686. cookies.read(config.xsrfCookieName) :
  11687. undefined;
  11688. if (xsrfValue) {
  11689. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  11690. }
  11691. }
  11692. // Add headers to the request
  11693. if ('setRequestHeader' in request) {
  11694. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  11695. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  11696. // Remove Content-Type if data is undefined
  11697. delete requestHeaders[key];
  11698. } else {
  11699. // Otherwise add header to the request
  11700. request.setRequestHeader(key, val);
  11701. }
  11702. });
  11703. }
  11704. // Add withCredentials to request if needed
  11705. if (config.withCredentials) {
  11706. request.withCredentials = true;
  11707. }
  11708. // Add responseType to request if needed
  11709. if (config.responseType) {
  11710. try {
  11711. request.responseType = config.responseType;
  11712. } catch (e) {
  11713. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  11714. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  11715. if (config.responseType !== 'json') {
  11716. throw e;
  11717. }
  11718. }
  11719. }
  11720. // Handle progress if needed
  11721. if (typeof config.onDownloadProgress === 'function') {
  11722. request.addEventListener('progress', config.onDownloadProgress);
  11723. }
  11724. // Not all browsers support upload events
  11725. if (typeof config.onUploadProgress === 'function' && request.upload) {
  11726. request.upload.addEventListener('progress', config.onUploadProgress);
  11727. }
  11728. if (config.cancelToken) {
  11729. // Handle cancellation
  11730. config.cancelToken.promise.then(function onCanceled(cancel) {
  11731. if (!request) {
  11732. return;
  11733. }
  11734. request.abort();
  11735. reject(cancel);
  11736. // Clean up request
  11737. request = null;
  11738. });
  11739. }
  11740. if (requestData === undefined) {
  11741. requestData = null;
  11742. }
  11743. // Send the request
  11744. request.send(requestData);
  11745. });
  11746. };
  11747. /***/ }),
  11748. /* 10 */
  11749. /***/ (function(module, exports, __webpack_require__) {
  11750. "use strict";
  11751. var enhanceError = __webpack_require__(25);
  11752. /**
  11753. * Create an Error with the specified message, config, error code, request and response.
  11754. *
  11755. * @param {string} message The error message.
  11756. * @param {Object} config The config.
  11757. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  11758. * @param {Object} [request] The request.
  11759. * @param {Object} [response] The response.
  11760. * @returns {Error} The created error.
  11761. */
  11762. module.exports = function createError(message, config, code, request, response) {
  11763. var error = new Error(message);
  11764. return enhanceError(error, config, code, request, response);
  11765. };
  11766. /***/ }),
  11767. /* 11 */
  11768. /***/ (function(module, exports, __webpack_require__) {
  11769. "use strict";
  11770. module.exports = function isCancel(value) {
  11771. return !!(value && value.__CANCEL__);
  11772. };
  11773. /***/ }),
  11774. /* 12 */
  11775. /***/ (function(module, exports, __webpack_require__) {
  11776. "use strict";
  11777. /**
  11778. * A `Cancel` is an object that is thrown when an operation is canceled.
  11779. *
  11780. * @class
  11781. * @param {string=} message The message.
  11782. */
  11783. function Cancel(message) {
  11784. this.message = message;
  11785. }
  11786. Cancel.prototype.toString = function toString() {
  11787. return 'Cancel' + (this.message ? ': ' + this.message : '');
  11788. };
  11789. Cancel.prototype.__CANCEL__ = true;
  11790. module.exports = Cancel;
  11791. /***/ }),
  11792. /* 13 */
  11793. /***/ (function(module, exports, __webpack_require__) {
  11794. __webpack_require__(14);
  11795. module.exports = __webpack_require__(63);
  11796. /***/ }),
  11797. /* 14 */
  11798. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11799. "use strict";
  11800. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  11801. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_we_vue__ = __webpack_require__(40);
  11802. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_we_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_we_vue__);
  11803. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vue_router__ = __webpack_require__(41);
  11804. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__store___ = __webpack_require__(42);
  11805. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__routes__ = __webpack_require__(45);
  11806. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_LayoutComponent_vue__ = __webpack_require__(60);
  11807. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_LayoutComponent_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__components_LayoutComponent_vue__);
  11808. /**
  11809. * First we will load all of this project's JavaScript dependencies which
  11810. * includes Vue and other libraries. It is a great starting point when
  11811. * building robust, powerful web applications using Vue and Laravel.
  11812. */
  11813. __webpack_require__(15);
  11814. window.Vue = __webpack_require__(5);
  11815. Vue.use(__WEBPACK_IMPORTED_MODULE_1_vue_router__["a" /* default */]);
  11816. Vue.use(__WEBPACK_IMPORTED_MODULE_0_we_vue___default.a);
  11817. // vuex 数据存储所需对象
  11818. // 路由配置文件
  11819. // 实例化路由
  11820. var router = new __WEBPACK_IMPORTED_MODULE_1_vue_router__["a" /* default */]({
  11821. routes: __WEBPACK_IMPORTED_MODULE_3__routes__["a" /* default */]
  11822. });
  11823. var app = new Vue({
  11824. el: '#app',
  11825. store: __WEBPACK_IMPORTED_MODULE_2__store___["a" /* default */],
  11826. router: router,
  11827. components: { Layout: __WEBPACK_IMPORTED_MODULE_4__components_LayoutComponent_vue___default.a },
  11828. template: '<Layout/>'
  11829. });
  11830. /***/ }),
  11831. /* 15 */
  11832. /***/ (function(module, exports, __webpack_require__) {
  11833. window._ = __webpack_require__(16);
  11834. /**
  11835. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  11836. * for JavaScript based Bootstrap features such as modals and tabs. This
  11837. * code may be modified to fit the specific needs of your application.
  11838. */
  11839. try {
  11840. window.$ = window.jQuery = __webpack_require__(18);
  11841. __webpack_require__(19);
  11842. } catch (e) {}
  11843. /**
  11844. * We'll load the axios HTTP library which allows us to easily issue requests
  11845. * to our Laravel back-end. This library automatically handles sending the
  11846. * CSRF token as a header based on the value of the "XSRF" token cookie.
  11847. */
  11848. window.axios = __webpack_require__(6);
  11849. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  11850. /**
  11851. * Next we will register the CSRF Token as a common header with Axios so that
  11852. * all outgoing HTTP requests automatically have it attached. This is just
  11853. * a simple convenience so we don't have to attach every token manually.
  11854. */
  11855. var token = document.head.querySelector('meta[name="csrf-token"]');
  11856. if (token) {
  11857. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  11858. } else {
  11859. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  11860. }
  11861. /**
  11862. * Echo exposes an expressive API for subscribing to channels and listening
  11863. * for events that are broadcast by Laravel. Echo and event broadcasting
  11864. * allows your team to easily build robust real-time web applications.
  11865. */
  11866. // import Echo from 'laravel-echo'
  11867. // window.Pusher = require('pusher-js');
  11868. // window.Echo = new Echo({
  11869. // broadcaster: 'pusher',
  11870. // key: process.env.MIX_PUSHER_APP_KEY,
  11871. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  11872. // encrypted: true
  11873. // });
  11874. /***/ }),
  11875. /* 16 */
  11876. /***/ (function(module, exports, __webpack_require__) {
  11877. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  11878. * @license
  11879. * Lodash <https://lodash.com/>
  11880. * Copyright JS Foundation and other contributors <https://js.foundation/>
  11881. * Released under MIT license <https://lodash.com/license>
  11882. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  11883. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  11884. */
  11885. ;(function() {
  11886. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  11887. var undefined;
  11888. /** Used as the semantic version number. */
  11889. var VERSION = '4.17.11';
  11890. /** Used as the size to enable large array optimizations. */
  11891. var LARGE_ARRAY_SIZE = 200;
  11892. /** Error message constants. */
  11893. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  11894. FUNC_ERROR_TEXT = 'Expected a function';
  11895. /** Used to stand-in for `undefined` hash values. */
  11896. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  11897. /** Used as the maximum memoize cache size. */
  11898. var MAX_MEMOIZE_SIZE = 500;
  11899. /** Used as the internal argument placeholder. */
  11900. var PLACEHOLDER = '__lodash_placeholder__';
  11901. /** Used to compose bitmasks for cloning. */
  11902. var CLONE_DEEP_FLAG = 1,
  11903. CLONE_FLAT_FLAG = 2,
  11904. CLONE_SYMBOLS_FLAG = 4;
  11905. /** Used to compose bitmasks for value comparisons. */
  11906. var COMPARE_PARTIAL_FLAG = 1,
  11907. COMPARE_UNORDERED_FLAG = 2;
  11908. /** Used to compose bitmasks for function metadata. */
  11909. var WRAP_BIND_FLAG = 1,
  11910. WRAP_BIND_KEY_FLAG = 2,
  11911. WRAP_CURRY_BOUND_FLAG = 4,
  11912. WRAP_CURRY_FLAG = 8,
  11913. WRAP_CURRY_RIGHT_FLAG = 16,
  11914. WRAP_PARTIAL_FLAG = 32,
  11915. WRAP_PARTIAL_RIGHT_FLAG = 64,
  11916. WRAP_ARY_FLAG = 128,
  11917. WRAP_REARG_FLAG = 256,
  11918. WRAP_FLIP_FLAG = 512;
  11919. /** Used as default options for `_.truncate`. */
  11920. var DEFAULT_TRUNC_LENGTH = 30,
  11921. DEFAULT_TRUNC_OMISSION = '...';
  11922. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  11923. var HOT_COUNT = 800,
  11924. HOT_SPAN = 16;
  11925. /** Used to indicate the type of lazy iteratees. */
  11926. var LAZY_FILTER_FLAG = 1,
  11927. LAZY_MAP_FLAG = 2,
  11928. LAZY_WHILE_FLAG = 3;
  11929. /** Used as references for various `Number` constants. */
  11930. var INFINITY = 1 / 0,
  11931. MAX_SAFE_INTEGER = 9007199254740991,
  11932. MAX_INTEGER = 1.7976931348623157e+308,
  11933. NAN = 0 / 0;
  11934. /** Used as references for the maximum length and index of an array. */
  11935. var MAX_ARRAY_LENGTH = 4294967295,
  11936. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  11937. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  11938. /** Used to associate wrap methods with their bit flags. */
  11939. var wrapFlags = [
  11940. ['ary', WRAP_ARY_FLAG],
  11941. ['bind', WRAP_BIND_FLAG],
  11942. ['bindKey', WRAP_BIND_KEY_FLAG],
  11943. ['curry', WRAP_CURRY_FLAG],
  11944. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  11945. ['flip', WRAP_FLIP_FLAG],
  11946. ['partial', WRAP_PARTIAL_FLAG],
  11947. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  11948. ['rearg', WRAP_REARG_FLAG]
  11949. ];
  11950. /** `Object#toString` result references. */
  11951. var argsTag = '[object Arguments]',
  11952. arrayTag = '[object Array]',
  11953. asyncTag = '[object AsyncFunction]',
  11954. boolTag = '[object Boolean]',
  11955. dateTag = '[object Date]',
  11956. domExcTag = '[object DOMException]',
  11957. errorTag = '[object Error]',
  11958. funcTag = '[object Function]',
  11959. genTag = '[object GeneratorFunction]',
  11960. mapTag = '[object Map]',
  11961. numberTag = '[object Number]',
  11962. nullTag = '[object Null]',
  11963. objectTag = '[object Object]',
  11964. promiseTag = '[object Promise]',
  11965. proxyTag = '[object Proxy]',
  11966. regexpTag = '[object RegExp]',
  11967. setTag = '[object Set]',
  11968. stringTag = '[object String]',
  11969. symbolTag = '[object Symbol]',
  11970. undefinedTag = '[object Undefined]',
  11971. weakMapTag = '[object WeakMap]',
  11972. weakSetTag = '[object WeakSet]';
  11973. var arrayBufferTag = '[object ArrayBuffer]',
  11974. dataViewTag = '[object DataView]',
  11975. float32Tag = '[object Float32Array]',
  11976. float64Tag = '[object Float64Array]',
  11977. int8Tag = '[object Int8Array]',
  11978. int16Tag = '[object Int16Array]',
  11979. int32Tag = '[object Int32Array]',
  11980. uint8Tag = '[object Uint8Array]',
  11981. uint8ClampedTag = '[object Uint8ClampedArray]',
  11982. uint16Tag = '[object Uint16Array]',
  11983. uint32Tag = '[object Uint32Array]';
  11984. /** Used to match empty string literals in compiled template source. */
  11985. var reEmptyStringLeading = /\b__p \+= '';/g,
  11986. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  11987. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  11988. /** Used to match HTML entities and HTML characters. */
  11989. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  11990. reUnescapedHtml = /[&<>"']/g,
  11991. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  11992. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  11993. /** Used to match template delimiters. */
  11994. var reEscape = /<%-([\s\S]+?)%>/g,
  11995. reEvaluate = /<%([\s\S]+?)%>/g,
  11996. reInterpolate = /<%=([\s\S]+?)%>/g;
  11997. /** Used to match property names within property paths. */
  11998. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  11999. reIsPlainProp = /^\w*$/,
  12000. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  12001. /**
  12002. * Used to match `RegExp`
  12003. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  12004. */
  12005. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  12006. reHasRegExpChar = RegExp(reRegExpChar.source);
  12007. /** Used to match leading and trailing whitespace. */
  12008. var reTrim = /^\s+|\s+$/g,
  12009. reTrimStart = /^\s+/,
  12010. reTrimEnd = /\s+$/;
  12011. /** Used to match wrap detail comments. */
  12012. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  12013. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  12014. reSplitDetails = /,? & /;
  12015. /** Used to match words composed of alphanumeric characters. */
  12016. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  12017. /** Used to match backslashes in property paths. */
  12018. var reEscapeChar = /\\(\\)?/g;
  12019. /**
  12020. * Used to match
  12021. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  12022. */
  12023. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  12024. /** Used to match `RegExp` flags from their coerced string values. */
  12025. var reFlags = /\w*$/;
  12026. /** Used to detect bad signed hexadecimal string values. */
  12027. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  12028. /** Used to detect binary string values. */
  12029. var reIsBinary = /^0b[01]+$/i;
  12030. /** Used to detect host constructors (Safari). */
  12031. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  12032. /** Used to detect octal string values. */
  12033. var reIsOctal = /^0o[0-7]+$/i;
  12034. /** Used to detect unsigned integer values. */
  12035. var reIsUint = /^(?:0|[1-9]\d*)$/;
  12036. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  12037. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  12038. /** Used to ensure capturing order of template delimiters. */
  12039. var reNoMatch = /($^)/;
  12040. /** Used to match unescaped characters in compiled string literals. */
  12041. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  12042. /** Used to compose unicode character classes. */
  12043. var rsAstralRange = '\\ud800-\\udfff',
  12044. rsComboMarksRange = '\\u0300-\\u036f',
  12045. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  12046. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  12047. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  12048. rsDingbatRange = '\\u2700-\\u27bf',
  12049. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  12050. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  12051. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  12052. rsPunctuationRange = '\\u2000-\\u206f',
  12053. 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',
  12054. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  12055. rsVarRange = '\\ufe0e\\ufe0f',
  12056. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  12057. /** Used to compose unicode capture groups. */
  12058. var rsApos = "['\u2019]",
  12059. rsAstral = '[' + rsAstralRange + ']',
  12060. rsBreak = '[' + rsBreakRange + ']',
  12061. rsCombo = '[' + rsComboRange + ']',
  12062. rsDigits = '\\d+',
  12063. rsDingbat = '[' + rsDingbatRange + ']',
  12064. rsLower = '[' + rsLowerRange + ']',
  12065. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  12066. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  12067. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  12068. rsNonAstral = '[^' + rsAstralRange + ']',
  12069. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  12070. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  12071. rsUpper = '[' + rsUpperRange + ']',
  12072. rsZWJ = '\\u200d';
  12073. /** Used to compose unicode regexes. */
  12074. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  12075. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  12076. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  12077. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  12078. reOptMod = rsModifier + '?',
  12079. rsOptVar = '[' + rsVarRange + ']?',
  12080. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  12081. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  12082. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  12083. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  12084. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  12085. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  12086. /** Used to match apostrophes. */
  12087. var reApos = RegExp(rsApos, 'g');
  12088. /**
  12089. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  12090. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  12091. */
  12092. var reComboMark = RegExp(rsCombo, 'g');
  12093. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  12094. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  12095. /** Used to match complex or compound words. */
  12096. var reUnicodeWord = RegExp([
  12097. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  12098. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  12099. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  12100. rsUpper + '+' + rsOptContrUpper,
  12101. rsOrdUpper,
  12102. rsOrdLower,
  12103. rsDigits,
  12104. rsEmoji
  12105. ].join('|'), 'g');
  12106. /** 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/). */
  12107. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  12108. /** Used to detect strings that need a more robust regexp to match words. */
  12109. 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 ]/;
  12110. /** Used to assign default `context` object properties. */
  12111. var contextProps = [
  12112. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  12113. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  12114. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  12115. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  12116. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  12117. ];
  12118. /** Used to make template sourceURLs easier to identify. */
  12119. var templateCounter = -1;
  12120. /** Used to identify `toStringTag` values of typed arrays. */
  12121. var typedArrayTags = {};
  12122. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  12123. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  12124. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  12125. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  12126. typedArrayTags[uint32Tag] = true;
  12127. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  12128. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  12129. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  12130. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  12131. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  12132. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  12133. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  12134. typedArrayTags[weakMapTag] = false;
  12135. /** Used to identify `toStringTag` values supported by `_.clone`. */
  12136. var cloneableTags = {};
  12137. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  12138. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  12139. cloneableTags[boolTag] = cloneableTags[dateTag] =
  12140. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  12141. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  12142. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  12143. cloneableTags[numberTag] = cloneableTags[objectTag] =
  12144. cloneableTags[regexpTag] = cloneableTags[setTag] =
  12145. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  12146. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  12147. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  12148. cloneableTags[errorTag] = cloneableTags[funcTag] =
  12149. cloneableTags[weakMapTag] = false;
  12150. /** Used to map Latin Unicode letters to basic Latin letters. */
  12151. var deburredLetters = {
  12152. // Latin-1 Supplement block.
  12153. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  12154. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  12155. '\xc7': 'C', '\xe7': 'c',
  12156. '\xd0': 'D', '\xf0': 'd',
  12157. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  12158. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  12159. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  12160. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  12161. '\xd1': 'N', '\xf1': 'n',
  12162. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  12163. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  12164. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  12165. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  12166. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  12167. '\xc6': 'Ae', '\xe6': 'ae',
  12168. '\xde': 'Th', '\xfe': 'th',
  12169. '\xdf': 'ss',
  12170. // Latin Extended-A block.
  12171. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  12172. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  12173. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  12174. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  12175. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  12176. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  12177. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  12178. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  12179. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  12180. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  12181. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  12182. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  12183. '\u0134': 'J', '\u0135': 'j',
  12184. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  12185. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  12186. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  12187. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  12188. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  12189. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  12190. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  12191. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  12192. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  12193. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  12194. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  12195. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  12196. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  12197. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  12198. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  12199. '\u0174': 'W', '\u0175': 'w',
  12200. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  12201. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  12202. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  12203. '\u0132': 'IJ', '\u0133': 'ij',
  12204. '\u0152': 'Oe', '\u0153': 'oe',
  12205. '\u0149': "'n", '\u017f': 's'
  12206. };
  12207. /** Used to map characters to HTML entities. */
  12208. var htmlEscapes = {
  12209. '&': '&amp;',
  12210. '<': '&lt;',
  12211. '>': '&gt;',
  12212. '"': '&quot;',
  12213. "'": '&#39;'
  12214. };
  12215. /** Used to map HTML entities to characters. */
  12216. var htmlUnescapes = {
  12217. '&amp;': '&',
  12218. '&lt;': '<',
  12219. '&gt;': '>',
  12220. '&quot;': '"',
  12221. '&#39;': "'"
  12222. };
  12223. /** Used to escape characters for inclusion in compiled string literals. */
  12224. var stringEscapes = {
  12225. '\\': '\\',
  12226. "'": "'",
  12227. '\n': 'n',
  12228. '\r': 'r',
  12229. '\u2028': 'u2028',
  12230. '\u2029': 'u2029'
  12231. };
  12232. /** Built-in method references without a dependency on `root`. */
  12233. var freeParseFloat = parseFloat,
  12234. freeParseInt = parseInt;
  12235. /** Detect free variable `global` from Node.js. */
  12236. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  12237. /** Detect free variable `self`. */
  12238. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  12239. /** Used as a reference to the global object. */
  12240. var root = freeGlobal || freeSelf || Function('return this')();
  12241. /** Detect free variable `exports`. */
  12242. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  12243. /** Detect free variable `module`. */
  12244. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  12245. /** Detect the popular CommonJS extension `module.exports`. */
  12246. var moduleExports = freeModule && freeModule.exports === freeExports;
  12247. /** Detect free variable `process` from Node.js. */
  12248. var freeProcess = moduleExports && freeGlobal.process;
  12249. /** Used to access faster Node.js helpers. */
  12250. var nodeUtil = (function() {
  12251. try {
  12252. // Use `util.types` for Node.js 10+.
  12253. var types = freeModule && freeModule.require && freeModule.require('util').types;
  12254. if (types) {
  12255. return types;
  12256. }
  12257. // Legacy `process.binding('util')` for Node.js < 10.
  12258. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  12259. } catch (e) {}
  12260. }());
  12261. /* Node.js helper references. */
  12262. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  12263. nodeIsDate = nodeUtil && nodeUtil.isDate,
  12264. nodeIsMap = nodeUtil && nodeUtil.isMap,
  12265. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  12266. nodeIsSet = nodeUtil && nodeUtil.isSet,
  12267. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  12268. /*--------------------------------------------------------------------------*/
  12269. /**
  12270. * A faster alternative to `Function#apply`, this function invokes `func`
  12271. * with the `this` binding of `thisArg` and the arguments of `args`.
  12272. *
  12273. * @private
  12274. * @param {Function} func The function to invoke.
  12275. * @param {*} thisArg The `this` binding of `func`.
  12276. * @param {Array} args The arguments to invoke `func` with.
  12277. * @returns {*} Returns the result of `func`.
  12278. */
  12279. function apply(func, thisArg, args) {
  12280. switch (args.length) {
  12281. case 0: return func.call(thisArg);
  12282. case 1: return func.call(thisArg, args[0]);
  12283. case 2: return func.call(thisArg, args[0], args[1]);
  12284. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  12285. }
  12286. return func.apply(thisArg, args);
  12287. }
  12288. /**
  12289. * A specialized version of `baseAggregator` for arrays.
  12290. *
  12291. * @private
  12292. * @param {Array} [array] The array to iterate over.
  12293. * @param {Function} setter The function to set `accumulator` values.
  12294. * @param {Function} iteratee The iteratee to transform keys.
  12295. * @param {Object} accumulator The initial aggregated object.
  12296. * @returns {Function} Returns `accumulator`.
  12297. */
  12298. function arrayAggregator(array, setter, iteratee, accumulator) {
  12299. var index = -1,
  12300. length = array == null ? 0 : array.length;
  12301. while (++index < length) {
  12302. var value = array[index];
  12303. setter(accumulator, value, iteratee(value), array);
  12304. }
  12305. return accumulator;
  12306. }
  12307. /**
  12308. * A specialized version of `_.forEach` for arrays without support for
  12309. * iteratee shorthands.
  12310. *
  12311. * @private
  12312. * @param {Array} [array] The array to iterate over.
  12313. * @param {Function} iteratee The function invoked per iteration.
  12314. * @returns {Array} Returns `array`.
  12315. */
  12316. function arrayEach(array, iteratee) {
  12317. var index = -1,
  12318. length = array == null ? 0 : array.length;
  12319. while (++index < length) {
  12320. if (iteratee(array[index], index, array) === false) {
  12321. break;
  12322. }
  12323. }
  12324. return array;
  12325. }
  12326. /**
  12327. * A specialized version of `_.forEachRight` for arrays without support for
  12328. * iteratee shorthands.
  12329. *
  12330. * @private
  12331. * @param {Array} [array] The array to iterate over.
  12332. * @param {Function} iteratee The function invoked per iteration.
  12333. * @returns {Array} Returns `array`.
  12334. */
  12335. function arrayEachRight(array, iteratee) {
  12336. var length = array == null ? 0 : array.length;
  12337. while (length--) {
  12338. if (iteratee(array[length], length, array) === false) {
  12339. break;
  12340. }
  12341. }
  12342. return array;
  12343. }
  12344. /**
  12345. * A specialized version of `_.every` for arrays without support for
  12346. * iteratee shorthands.
  12347. *
  12348. * @private
  12349. * @param {Array} [array] The array to iterate over.
  12350. * @param {Function} predicate The function invoked per iteration.
  12351. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  12352. * else `false`.
  12353. */
  12354. function arrayEvery(array, predicate) {
  12355. var index = -1,
  12356. length = array == null ? 0 : array.length;
  12357. while (++index < length) {
  12358. if (!predicate(array[index], index, array)) {
  12359. return false;
  12360. }
  12361. }
  12362. return true;
  12363. }
  12364. /**
  12365. * A specialized version of `_.filter` for arrays without support for
  12366. * iteratee shorthands.
  12367. *
  12368. * @private
  12369. * @param {Array} [array] The array to iterate over.
  12370. * @param {Function} predicate The function invoked per iteration.
  12371. * @returns {Array} Returns the new filtered array.
  12372. */
  12373. function arrayFilter(array, predicate) {
  12374. var index = -1,
  12375. length = array == null ? 0 : array.length,
  12376. resIndex = 0,
  12377. result = [];
  12378. while (++index < length) {
  12379. var value = array[index];
  12380. if (predicate(value, index, array)) {
  12381. result[resIndex++] = value;
  12382. }
  12383. }
  12384. return result;
  12385. }
  12386. /**
  12387. * A specialized version of `_.includes` for arrays without support for
  12388. * specifying an index to search from.
  12389. *
  12390. * @private
  12391. * @param {Array} [array] The array to inspect.
  12392. * @param {*} target The value to search for.
  12393. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  12394. */
  12395. function arrayIncludes(array, value) {
  12396. var length = array == null ? 0 : array.length;
  12397. return !!length && baseIndexOf(array, value, 0) > -1;
  12398. }
  12399. /**
  12400. * This function is like `arrayIncludes` except that it accepts a comparator.
  12401. *
  12402. * @private
  12403. * @param {Array} [array] The array to inspect.
  12404. * @param {*} target The value to search for.
  12405. * @param {Function} comparator The comparator invoked per element.
  12406. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  12407. */
  12408. function arrayIncludesWith(array, value, comparator) {
  12409. var index = -1,
  12410. length = array == null ? 0 : array.length;
  12411. while (++index < length) {
  12412. if (comparator(value, array[index])) {
  12413. return true;
  12414. }
  12415. }
  12416. return false;
  12417. }
  12418. /**
  12419. * A specialized version of `_.map` for arrays without support for iteratee
  12420. * shorthands.
  12421. *
  12422. * @private
  12423. * @param {Array} [array] The array to iterate over.
  12424. * @param {Function} iteratee The function invoked per iteration.
  12425. * @returns {Array} Returns the new mapped array.
  12426. */
  12427. function arrayMap(array, iteratee) {
  12428. var index = -1,
  12429. length = array == null ? 0 : array.length,
  12430. result = Array(length);
  12431. while (++index < length) {
  12432. result[index] = iteratee(array[index], index, array);
  12433. }
  12434. return result;
  12435. }
  12436. /**
  12437. * Appends the elements of `values` to `array`.
  12438. *
  12439. * @private
  12440. * @param {Array} array The array to modify.
  12441. * @param {Array} values The values to append.
  12442. * @returns {Array} Returns `array`.
  12443. */
  12444. function arrayPush(array, values) {
  12445. var index = -1,
  12446. length = values.length,
  12447. offset = array.length;
  12448. while (++index < length) {
  12449. array[offset + index] = values[index];
  12450. }
  12451. return array;
  12452. }
  12453. /**
  12454. * A specialized version of `_.reduce` for arrays without support for
  12455. * iteratee shorthands.
  12456. *
  12457. * @private
  12458. * @param {Array} [array] The array to iterate over.
  12459. * @param {Function} iteratee The function invoked per iteration.
  12460. * @param {*} [accumulator] The initial value.
  12461. * @param {boolean} [initAccum] Specify using the first element of `array` as
  12462. * the initial value.
  12463. * @returns {*} Returns the accumulated value.
  12464. */
  12465. function arrayReduce(array, iteratee, accumulator, initAccum) {
  12466. var index = -1,
  12467. length = array == null ? 0 : array.length;
  12468. if (initAccum && length) {
  12469. accumulator = array[++index];
  12470. }
  12471. while (++index < length) {
  12472. accumulator = iteratee(accumulator, array[index], index, array);
  12473. }
  12474. return accumulator;
  12475. }
  12476. /**
  12477. * A specialized version of `_.reduceRight` for arrays without support for
  12478. * iteratee shorthands.
  12479. *
  12480. * @private
  12481. * @param {Array} [array] The array to iterate over.
  12482. * @param {Function} iteratee The function invoked per iteration.
  12483. * @param {*} [accumulator] The initial value.
  12484. * @param {boolean} [initAccum] Specify using the last element of `array` as
  12485. * the initial value.
  12486. * @returns {*} Returns the accumulated value.
  12487. */
  12488. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  12489. var length = array == null ? 0 : array.length;
  12490. if (initAccum && length) {
  12491. accumulator = array[--length];
  12492. }
  12493. while (length--) {
  12494. accumulator = iteratee(accumulator, array[length], length, array);
  12495. }
  12496. return accumulator;
  12497. }
  12498. /**
  12499. * A specialized version of `_.some` for arrays without support for iteratee
  12500. * shorthands.
  12501. *
  12502. * @private
  12503. * @param {Array} [array] The array to iterate over.
  12504. * @param {Function} predicate The function invoked per iteration.
  12505. * @returns {boolean} Returns `true` if any element passes the predicate check,
  12506. * else `false`.
  12507. */
  12508. function arraySome(array, predicate) {
  12509. var index = -1,
  12510. length = array == null ? 0 : array.length;
  12511. while (++index < length) {
  12512. if (predicate(array[index], index, array)) {
  12513. return true;
  12514. }
  12515. }
  12516. return false;
  12517. }
  12518. /**
  12519. * Gets the size of an ASCII `string`.
  12520. *
  12521. * @private
  12522. * @param {string} string The string inspect.
  12523. * @returns {number} Returns the string size.
  12524. */
  12525. var asciiSize = baseProperty('length');
  12526. /**
  12527. * Converts an ASCII `string` to an array.
  12528. *
  12529. * @private
  12530. * @param {string} string The string to convert.
  12531. * @returns {Array} Returns the converted array.
  12532. */
  12533. function asciiToArray(string) {
  12534. return string.split('');
  12535. }
  12536. /**
  12537. * Splits an ASCII `string` into an array of its words.
  12538. *
  12539. * @private
  12540. * @param {string} The string to inspect.
  12541. * @returns {Array} Returns the words of `string`.
  12542. */
  12543. function asciiWords(string) {
  12544. return string.match(reAsciiWord) || [];
  12545. }
  12546. /**
  12547. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  12548. * without support for iteratee shorthands, which iterates over `collection`
  12549. * using `eachFunc`.
  12550. *
  12551. * @private
  12552. * @param {Array|Object} collection The collection to inspect.
  12553. * @param {Function} predicate The function invoked per iteration.
  12554. * @param {Function} eachFunc The function to iterate over `collection`.
  12555. * @returns {*} Returns the found element or its key, else `undefined`.
  12556. */
  12557. function baseFindKey(collection, predicate, eachFunc) {
  12558. var result;
  12559. eachFunc(collection, function(value, key, collection) {
  12560. if (predicate(value, key, collection)) {
  12561. result = key;
  12562. return false;
  12563. }
  12564. });
  12565. return result;
  12566. }
  12567. /**
  12568. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  12569. * support for iteratee shorthands.
  12570. *
  12571. * @private
  12572. * @param {Array} array The array to inspect.
  12573. * @param {Function} predicate The function invoked per iteration.
  12574. * @param {number} fromIndex The index to search from.
  12575. * @param {boolean} [fromRight] Specify iterating from right to left.
  12576. * @returns {number} Returns the index of the matched value, else `-1`.
  12577. */
  12578. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  12579. var length = array.length,
  12580. index = fromIndex + (fromRight ? 1 : -1);
  12581. while ((fromRight ? index-- : ++index < length)) {
  12582. if (predicate(array[index], index, array)) {
  12583. return index;
  12584. }
  12585. }
  12586. return -1;
  12587. }
  12588. /**
  12589. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  12590. *
  12591. * @private
  12592. * @param {Array} array The array to inspect.
  12593. * @param {*} value The value to search for.
  12594. * @param {number} fromIndex The index to search from.
  12595. * @returns {number} Returns the index of the matched value, else `-1`.
  12596. */
  12597. function baseIndexOf(array, value, fromIndex) {
  12598. return value === value
  12599. ? strictIndexOf(array, value, fromIndex)
  12600. : baseFindIndex(array, baseIsNaN, fromIndex);
  12601. }
  12602. /**
  12603. * This function is like `baseIndexOf` except that it accepts a comparator.
  12604. *
  12605. * @private
  12606. * @param {Array} array The array to inspect.
  12607. * @param {*} value The value to search for.
  12608. * @param {number} fromIndex The index to search from.
  12609. * @param {Function} comparator The comparator invoked per element.
  12610. * @returns {number} Returns the index of the matched value, else `-1`.
  12611. */
  12612. function baseIndexOfWith(array, value, fromIndex, comparator) {
  12613. var index = fromIndex - 1,
  12614. length = array.length;
  12615. while (++index < length) {
  12616. if (comparator(array[index], value)) {
  12617. return index;
  12618. }
  12619. }
  12620. return -1;
  12621. }
  12622. /**
  12623. * The base implementation of `_.isNaN` without support for number objects.
  12624. *
  12625. * @private
  12626. * @param {*} value The value to check.
  12627. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  12628. */
  12629. function baseIsNaN(value) {
  12630. return value !== value;
  12631. }
  12632. /**
  12633. * The base implementation of `_.mean` and `_.meanBy` without support for
  12634. * iteratee shorthands.
  12635. *
  12636. * @private
  12637. * @param {Array} array The array to iterate over.
  12638. * @param {Function} iteratee The function invoked per iteration.
  12639. * @returns {number} Returns the mean.
  12640. */
  12641. function baseMean(array, iteratee) {
  12642. var length = array == null ? 0 : array.length;
  12643. return length ? (baseSum(array, iteratee) / length) : NAN;
  12644. }
  12645. /**
  12646. * The base implementation of `_.property` without support for deep paths.
  12647. *
  12648. * @private
  12649. * @param {string} key The key of the property to get.
  12650. * @returns {Function} Returns the new accessor function.
  12651. */
  12652. function baseProperty(key) {
  12653. return function(object) {
  12654. return object == null ? undefined : object[key];
  12655. };
  12656. }
  12657. /**
  12658. * The base implementation of `_.propertyOf` without support for deep paths.
  12659. *
  12660. * @private
  12661. * @param {Object} object The object to query.
  12662. * @returns {Function} Returns the new accessor function.
  12663. */
  12664. function basePropertyOf(object) {
  12665. return function(key) {
  12666. return object == null ? undefined : object[key];
  12667. };
  12668. }
  12669. /**
  12670. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  12671. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  12672. *
  12673. * @private
  12674. * @param {Array|Object} collection The collection to iterate over.
  12675. * @param {Function} iteratee The function invoked per iteration.
  12676. * @param {*} accumulator The initial value.
  12677. * @param {boolean} initAccum Specify using the first or last element of
  12678. * `collection` as the initial value.
  12679. * @param {Function} eachFunc The function to iterate over `collection`.
  12680. * @returns {*} Returns the accumulated value.
  12681. */
  12682. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  12683. eachFunc(collection, function(value, index, collection) {
  12684. accumulator = initAccum
  12685. ? (initAccum = false, value)
  12686. : iteratee(accumulator, value, index, collection);
  12687. });
  12688. return accumulator;
  12689. }
  12690. /**
  12691. * The base implementation of `_.sortBy` which uses `comparer` to define the
  12692. * sort order of `array` and replaces criteria objects with their corresponding
  12693. * values.
  12694. *
  12695. * @private
  12696. * @param {Array} array The array to sort.
  12697. * @param {Function} comparer The function to define sort order.
  12698. * @returns {Array} Returns `array`.
  12699. */
  12700. function baseSortBy(array, comparer) {
  12701. var length = array.length;
  12702. array.sort(comparer);
  12703. while (length--) {
  12704. array[length] = array[length].value;
  12705. }
  12706. return array;
  12707. }
  12708. /**
  12709. * The base implementation of `_.sum` and `_.sumBy` without support for
  12710. * iteratee shorthands.
  12711. *
  12712. * @private
  12713. * @param {Array} array The array to iterate over.
  12714. * @param {Function} iteratee The function invoked per iteration.
  12715. * @returns {number} Returns the sum.
  12716. */
  12717. function baseSum(array, iteratee) {
  12718. var result,
  12719. index = -1,
  12720. length = array.length;
  12721. while (++index < length) {
  12722. var current = iteratee(array[index]);
  12723. if (current !== undefined) {
  12724. result = result === undefined ? current : (result + current);
  12725. }
  12726. }
  12727. return result;
  12728. }
  12729. /**
  12730. * The base implementation of `_.times` without support for iteratee shorthands
  12731. * or max array length checks.
  12732. *
  12733. * @private
  12734. * @param {number} n The number of times to invoke `iteratee`.
  12735. * @param {Function} iteratee The function invoked per iteration.
  12736. * @returns {Array} Returns the array of results.
  12737. */
  12738. function baseTimes(n, iteratee) {
  12739. var index = -1,
  12740. result = Array(n);
  12741. while (++index < n) {
  12742. result[index] = iteratee(index);
  12743. }
  12744. return result;
  12745. }
  12746. /**
  12747. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  12748. * of key-value pairs for `object` corresponding to the property names of `props`.
  12749. *
  12750. * @private
  12751. * @param {Object} object The object to query.
  12752. * @param {Array} props The property names to get values for.
  12753. * @returns {Object} Returns the key-value pairs.
  12754. */
  12755. function baseToPairs(object, props) {
  12756. return arrayMap(props, function(key) {
  12757. return [key, object[key]];
  12758. });
  12759. }
  12760. /**
  12761. * The base implementation of `_.unary` without support for storing metadata.
  12762. *
  12763. * @private
  12764. * @param {Function} func The function to cap arguments for.
  12765. * @returns {Function} Returns the new capped function.
  12766. */
  12767. function baseUnary(func) {
  12768. return function(value) {
  12769. return func(value);
  12770. };
  12771. }
  12772. /**
  12773. * The base implementation of `_.values` and `_.valuesIn` which creates an
  12774. * array of `object` property values corresponding to the property names
  12775. * of `props`.
  12776. *
  12777. * @private
  12778. * @param {Object} object The object to query.
  12779. * @param {Array} props The property names to get values for.
  12780. * @returns {Object} Returns the array of property values.
  12781. */
  12782. function baseValues(object, props) {
  12783. return arrayMap(props, function(key) {
  12784. return object[key];
  12785. });
  12786. }
  12787. /**
  12788. * Checks if a `cache` value for `key` exists.
  12789. *
  12790. * @private
  12791. * @param {Object} cache The cache to query.
  12792. * @param {string} key The key of the entry to check.
  12793. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  12794. */
  12795. function cacheHas(cache, key) {
  12796. return cache.has(key);
  12797. }
  12798. /**
  12799. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  12800. * that is not found in the character symbols.
  12801. *
  12802. * @private
  12803. * @param {Array} strSymbols The string symbols to inspect.
  12804. * @param {Array} chrSymbols The character symbols to find.
  12805. * @returns {number} Returns the index of the first unmatched string symbol.
  12806. */
  12807. function charsStartIndex(strSymbols, chrSymbols) {
  12808. var index = -1,
  12809. length = strSymbols.length;
  12810. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  12811. return index;
  12812. }
  12813. /**
  12814. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  12815. * that is not found in the character symbols.
  12816. *
  12817. * @private
  12818. * @param {Array} strSymbols The string symbols to inspect.
  12819. * @param {Array} chrSymbols The character symbols to find.
  12820. * @returns {number} Returns the index of the last unmatched string symbol.
  12821. */
  12822. function charsEndIndex(strSymbols, chrSymbols) {
  12823. var index = strSymbols.length;
  12824. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  12825. return index;
  12826. }
  12827. /**
  12828. * Gets the number of `placeholder` occurrences in `array`.
  12829. *
  12830. * @private
  12831. * @param {Array} array The array to inspect.
  12832. * @param {*} placeholder The placeholder to search for.
  12833. * @returns {number} Returns the placeholder count.
  12834. */
  12835. function countHolders(array, placeholder) {
  12836. var length = array.length,
  12837. result = 0;
  12838. while (length--) {
  12839. if (array[length] === placeholder) {
  12840. ++result;
  12841. }
  12842. }
  12843. return result;
  12844. }
  12845. /**
  12846. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  12847. * letters to basic Latin letters.
  12848. *
  12849. * @private
  12850. * @param {string} letter The matched letter to deburr.
  12851. * @returns {string} Returns the deburred letter.
  12852. */
  12853. var deburrLetter = basePropertyOf(deburredLetters);
  12854. /**
  12855. * Used by `_.escape` to convert characters to HTML entities.
  12856. *
  12857. * @private
  12858. * @param {string} chr The matched character to escape.
  12859. * @returns {string} Returns the escaped character.
  12860. */
  12861. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  12862. /**
  12863. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  12864. *
  12865. * @private
  12866. * @param {string} chr The matched character to escape.
  12867. * @returns {string} Returns the escaped character.
  12868. */
  12869. function escapeStringChar(chr) {
  12870. return '\\' + stringEscapes[chr];
  12871. }
  12872. /**
  12873. * Gets the value at `key` of `object`.
  12874. *
  12875. * @private
  12876. * @param {Object} [object] The object to query.
  12877. * @param {string} key The key of the property to get.
  12878. * @returns {*} Returns the property value.
  12879. */
  12880. function getValue(object, key) {
  12881. return object == null ? undefined : object[key];
  12882. }
  12883. /**
  12884. * Checks if `string` contains Unicode symbols.
  12885. *
  12886. * @private
  12887. * @param {string} string The string to inspect.
  12888. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  12889. */
  12890. function hasUnicode(string) {
  12891. return reHasUnicode.test(string);
  12892. }
  12893. /**
  12894. * Checks if `string` contains a word composed of Unicode symbols.
  12895. *
  12896. * @private
  12897. * @param {string} string The string to inspect.
  12898. * @returns {boolean} Returns `true` if a word is found, else `false`.
  12899. */
  12900. function hasUnicodeWord(string) {
  12901. return reHasUnicodeWord.test(string);
  12902. }
  12903. /**
  12904. * Converts `iterator` to an array.
  12905. *
  12906. * @private
  12907. * @param {Object} iterator The iterator to convert.
  12908. * @returns {Array} Returns the converted array.
  12909. */
  12910. function iteratorToArray(iterator) {
  12911. var data,
  12912. result = [];
  12913. while (!(data = iterator.next()).done) {
  12914. result.push(data.value);
  12915. }
  12916. return result;
  12917. }
  12918. /**
  12919. * Converts `map` to its key-value pairs.
  12920. *
  12921. * @private
  12922. * @param {Object} map The map to convert.
  12923. * @returns {Array} Returns the key-value pairs.
  12924. */
  12925. function mapToArray(map) {
  12926. var index = -1,
  12927. result = Array(map.size);
  12928. map.forEach(function(value, key) {
  12929. result[++index] = [key, value];
  12930. });
  12931. return result;
  12932. }
  12933. /**
  12934. * Creates a unary function that invokes `func` with its argument transformed.
  12935. *
  12936. * @private
  12937. * @param {Function} func The function to wrap.
  12938. * @param {Function} transform The argument transform.
  12939. * @returns {Function} Returns the new function.
  12940. */
  12941. function overArg(func, transform) {
  12942. return function(arg) {
  12943. return func(transform(arg));
  12944. };
  12945. }
  12946. /**
  12947. * Replaces all `placeholder` elements in `array` with an internal placeholder
  12948. * and returns an array of their indexes.
  12949. *
  12950. * @private
  12951. * @param {Array} array The array to modify.
  12952. * @param {*} placeholder The placeholder to replace.
  12953. * @returns {Array} Returns the new array of placeholder indexes.
  12954. */
  12955. function replaceHolders(array, placeholder) {
  12956. var index = -1,
  12957. length = array.length,
  12958. resIndex = 0,
  12959. result = [];
  12960. while (++index < length) {
  12961. var value = array[index];
  12962. if (value === placeholder || value === PLACEHOLDER) {
  12963. array[index] = PLACEHOLDER;
  12964. result[resIndex++] = index;
  12965. }
  12966. }
  12967. return result;
  12968. }
  12969. /**
  12970. * Converts `set` to an array of its values.
  12971. *
  12972. * @private
  12973. * @param {Object} set The set to convert.
  12974. * @returns {Array} Returns the values.
  12975. */
  12976. function setToArray(set) {
  12977. var index = -1,
  12978. result = Array(set.size);
  12979. set.forEach(function(value) {
  12980. result[++index] = value;
  12981. });
  12982. return result;
  12983. }
  12984. /**
  12985. * Converts `set` to its value-value pairs.
  12986. *
  12987. * @private
  12988. * @param {Object} set The set to convert.
  12989. * @returns {Array} Returns the value-value pairs.
  12990. */
  12991. function setToPairs(set) {
  12992. var index = -1,
  12993. result = Array(set.size);
  12994. set.forEach(function(value) {
  12995. result[++index] = [value, value];
  12996. });
  12997. return result;
  12998. }
  12999. /**
  13000. * A specialized version of `_.indexOf` which performs strict equality
  13001. * comparisons of values, i.e. `===`.
  13002. *
  13003. * @private
  13004. * @param {Array} array The array to inspect.
  13005. * @param {*} value The value to search for.
  13006. * @param {number} fromIndex The index to search from.
  13007. * @returns {number} Returns the index of the matched value, else `-1`.
  13008. */
  13009. function strictIndexOf(array, value, fromIndex) {
  13010. var index = fromIndex - 1,
  13011. length = array.length;
  13012. while (++index < length) {
  13013. if (array[index] === value) {
  13014. return index;
  13015. }
  13016. }
  13017. return -1;
  13018. }
  13019. /**
  13020. * A specialized version of `_.lastIndexOf` which performs strict equality
  13021. * comparisons of values, i.e. `===`.
  13022. *
  13023. * @private
  13024. * @param {Array} array The array to inspect.
  13025. * @param {*} value The value to search for.
  13026. * @param {number} fromIndex The index to search from.
  13027. * @returns {number} Returns the index of the matched value, else `-1`.
  13028. */
  13029. function strictLastIndexOf(array, value, fromIndex) {
  13030. var index = fromIndex + 1;
  13031. while (index--) {
  13032. if (array[index] === value) {
  13033. return index;
  13034. }
  13035. }
  13036. return index;
  13037. }
  13038. /**
  13039. * Gets the number of symbols in `string`.
  13040. *
  13041. * @private
  13042. * @param {string} string The string to inspect.
  13043. * @returns {number} Returns the string size.
  13044. */
  13045. function stringSize(string) {
  13046. return hasUnicode(string)
  13047. ? unicodeSize(string)
  13048. : asciiSize(string);
  13049. }
  13050. /**
  13051. * Converts `string` to an array.
  13052. *
  13053. * @private
  13054. * @param {string} string The string to convert.
  13055. * @returns {Array} Returns the converted array.
  13056. */
  13057. function stringToArray(string) {
  13058. return hasUnicode(string)
  13059. ? unicodeToArray(string)
  13060. : asciiToArray(string);
  13061. }
  13062. /**
  13063. * Used by `_.unescape` to convert HTML entities to characters.
  13064. *
  13065. * @private
  13066. * @param {string} chr The matched character to unescape.
  13067. * @returns {string} Returns the unescaped character.
  13068. */
  13069. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  13070. /**
  13071. * Gets the size of a Unicode `string`.
  13072. *
  13073. * @private
  13074. * @param {string} string The string inspect.
  13075. * @returns {number} Returns the string size.
  13076. */
  13077. function unicodeSize(string) {
  13078. var result = reUnicode.lastIndex = 0;
  13079. while (reUnicode.test(string)) {
  13080. ++result;
  13081. }
  13082. return result;
  13083. }
  13084. /**
  13085. * Converts a Unicode `string` to an array.
  13086. *
  13087. * @private
  13088. * @param {string} string The string to convert.
  13089. * @returns {Array} Returns the converted array.
  13090. */
  13091. function unicodeToArray(string) {
  13092. return string.match(reUnicode) || [];
  13093. }
  13094. /**
  13095. * Splits a Unicode `string` into an array of its words.
  13096. *
  13097. * @private
  13098. * @param {string} The string to inspect.
  13099. * @returns {Array} Returns the words of `string`.
  13100. */
  13101. function unicodeWords(string) {
  13102. return string.match(reUnicodeWord) || [];
  13103. }
  13104. /*--------------------------------------------------------------------------*/
  13105. /**
  13106. * Create a new pristine `lodash` function using the `context` object.
  13107. *
  13108. * @static
  13109. * @memberOf _
  13110. * @since 1.1.0
  13111. * @category Util
  13112. * @param {Object} [context=root] The context object.
  13113. * @returns {Function} Returns a new `lodash` function.
  13114. * @example
  13115. *
  13116. * _.mixin({ 'foo': _.constant('foo') });
  13117. *
  13118. * var lodash = _.runInContext();
  13119. * lodash.mixin({ 'bar': lodash.constant('bar') });
  13120. *
  13121. * _.isFunction(_.foo);
  13122. * // => true
  13123. * _.isFunction(_.bar);
  13124. * // => false
  13125. *
  13126. * lodash.isFunction(lodash.foo);
  13127. * // => false
  13128. * lodash.isFunction(lodash.bar);
  13129. * // => true
  13130. *
  13131. * // Create a suped-up `defer` in Node.js.
  13132. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  13133. */
  13134. var runInContext = (function runInContext(context) {
  13135. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  13136. /** Built-in constructor references. */
  13137. var Array = context.Array,
  13138. Date = context.Date,
  13139. Error = context.Error,
  13140. Function = context.Function,
  13141. Math = context.Math,
  13142. Object = context.Object,
  13143. RegExp = context.RegExp,
  13144. String = context.String,
  13145. TypeError = context.TypeError;
  13146. /** Used for built-in method references. */
  13147. var arrayProto = Array.prototype,
  13148. funcProto = Function.prototype,
  13149. objectProto = Object.prototype;
  13150. /** Used to detect overreaching core-js shims. */
  13151. var coreJsData = context['__core-js_shared__'];
  13152. /** Used to resolve the decompiled source of functions. */
  13153. var funcToString = funcProto.toString;
  13154. /** Used to check objects for own properties. */
  13155. var hasOwnProperty = objectProto.hasOwnProperty;
  13156. /** Used to generate unique IDs. */
  13157. var idCounter = 0;
  13158. /** Used to detect methods masquerading as native. */
  13159. var maskSrcKey = (function() {
  13160. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  13161. return uid ? ('Symbol(src)_1.' + uid) : '';
  13162. }());
  13163. /**
  13164. * Used to resolve the
  13165. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  13166. * of values.
  13167. */
  13168. var nativeObjectToString = objectProto.toString;
  13169. /** Used to infer the `Object` constructor. */
  13170. var objectCtorString = funcToString.call(Object);
  13171. /** Used to restore the original `_` reference in `_.noConflict`. */
  13172. var oldDash = root._;
  13173. /** Used to detect if a method is native. */
  13174. var reIsNative = RegExp('^' +
  13175. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  13176. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  13177. );
  13178. /** Built-in value references. */
  13179. var Buffer = moduleExports ? context.Buffer : undefined,
  13180. Symbol = context.Symbol,
  13181. Uint8Array = context.Uint8Array,
  13182. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  13183. getPrototype = overArg(Object.getPrototypeOf, Object),
  13184. objectCreate = Object.create,
  13185. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  13186. splice = arrayProto.splice,
  13187. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  13188. symIterator = Symbol ? Symbol.iterator : undefined,
  13189. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  13190. var defineProperty = (function() {
  13191. try {
  13192. var func = getNative(Object, 'defineProperty');
  13193. func({}, '', {});
  13194. return func;
  13195. } catch (e) {}
  13196. }());
  13197. /** Mocked built-ins. */
  13198. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  13199. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  13200. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  13201. /* Built-in method references for those with the same name as other `lodash` methods. */
  13202. var nativeCeil = Math.ceil,
  13203. nativeFloor = Math.floor,
  13204. nativeGetSymbols = Object.getOwnPropertySymbols,
  13205. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  13206. nativeIsFinite = context.isFinite,
  13207. nativeJoin = arrayProto.join,
  13208. nativeKeys = overArg(Object.keys, Object),
  13209. nativeMax = Math.max,
  13210. nativeMin = Math.min,
  13211. nativeNow = Date.now,
  13212. nativeParseInt = context.parseInt,
  13213. nativeRandom = Math.random,
  13214. nativeReverse = arrayProto.reverse;
  13215. /* Built-in method references that are verified to be native. */
  13216. var DataView = getNative(context, 'DataView'),
  13217. Map = getNative(context, 'Map'),
  13218. Promise = getNative(context, 'Promise'),
  13219. Set = getNative(context, 'Set'),
  13220. WeakMap = getNative(context, 'WeakMap'),
  13221. nativeCreate = getNative(Object, 'create');
  13222. /** Used to store function metadata. */
  13223. var metaMap = WeakMap && new WeakMap;
  13224. /** Used to lookup unminified function names. */
  13225. var realNames = {};
  13226. /** Used to detect maps, sets, and weakmaps. */
  13227. var dataViewCtorString = toSource(DataView),
  13228. mapCtorString = toSource(Map),
  13229. promiseCtorString = toSource(Promise),
  13230. setCtorString = toSource(Set),
  13231. weakMapCtorString = toSource(WeakMap);
  13232. /** Used to convert symbols to primitives and strings. */
  13233. var symbolProto = Symbol ? Symbol.prototype : undefined,
  13234. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  13235. symbolToString = symbolProto ? symbolProto.toString : undefined;
  13236. /*------------------------------------------------------------------------*/
  13237. /**
  13238. * Creates a `lodash` object which wraps `value` to enable implicit method
  13239. * chain sequences. Methods that operate on and return arrays, collections,
  13240. * and functions can be chained together. Methods that retrieve a single value
  13241. * or may return a primitive value will automatically end the chain sequence
  13242. * and return the unwrapped value. Otherwise, the value must be unwrapped
  13243. * with `_#value`.
  13244. *
  13245. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  13246. * enabled using `_.chain`.
  13247. *
  13248. * The execution of chained methods is lazy, that is, it's deferred until
  13249. * `_#value` is implicitly or explicitly called.
  13250. *
  13251. * Lazy evaluation allows several methods to support shortcut fusion.
  13252. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  13253. * the creation of intermediate arrays and can greatly reduce the number of
  13254. * iteratee executions. Sections of a chain sequence qualify for shortcut
  13255. * fusion if the section is applied to an array and iteratees accept only
  13256. * one argument. The heuristic for whether a section qualifies for shortcut
  13257. * fusion is subject to change.
  13258. *
  13259. * Chaining is supported in custom builds as long as the `_#value` method is
  13260. * directly or indirectly included in the build.
  13261. *
  13262. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  13263. *
  13264. * The wrapper `Array` methods are:
  13265. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  13266. *
  13267. * The wrapper `String` methods are:
  13268. * `replace` and `split`
  13269. *
  13270. * The wrapper methods that support shortcut fusion are:
  13271. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  13272. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  13273. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  13274. *
  13275. * The chainable wrapper methods are:
  13276. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  13277. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  13278. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  13279. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  13280. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  13281. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  13282. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  13283. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  13284. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  13285. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  13286. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  13287. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  13288. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  13289. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  13290. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  13291. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  13292. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  13293. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  13294. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  13295. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  13296. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  13297. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  13298. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  13299. * `zipObject`, `zipObjectDeep`, and `zipWith`
  13300. *
  13301. * The wrapper methods that are **not** chainable by default are:
  13302. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  13303. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  13304. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  13305. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  13306. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  13307. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  13308. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  13309. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  13310. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  13311. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  13312. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  13313. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  13314. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  13315. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  13316. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  13317. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  13318. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  13319. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  13320. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  13321. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  13322. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  13323. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  13324. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  13325. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  13326. * `upperFirst`, `value`, and `words`
  13327. *
  13328. * @name _
  13329. * @constructor
  13330. * @category Seq
  13331. * @param {*} value The value to wrap in a `lodash` instance.
  13332. * @returns {Object} Returns the new `lodash` wrapper instance.
  13333. * @example
  13334. *
  13335. * function square(n) {
  13336. * return n * n;
  13337. * }
  13338. *
  13339. * var wrapped = _([1, 2, 3]);
  13340. *
  13341. * // Returns an unwrapped value.
  13342. * wrapped.reduce(_.add);
  13343. * // => 6
  13344. *
  13345. * // Returns a wrapped value.
  13346. * var squares = wrapped.map(square);
  13347. *
  13348. * _.isArray(squares);
  13349. * // => false
  13350. *
  13351. * _.isArray(squares.value());
  13352. * // => true
  13353. */
  13354. function lodash(value) {
  13355. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  13356. if (value instanceof LodashWrapper) {
  13357. return value;
  13358. }
  13359. if (hasOwnProperty.call(value, '__wrapped__')) {
  13360. return wrapperClone(value);
  13361. }
  13362. }
  13363. return new LodashWrapper(value);
  13364. }
  13365. /**
  13366. * The base implementation of `_.create` without support for assigning
  13367. * properties to the created object.
  13368. *
  13369. * @private
  13370. * @param {Object} proto The object to inherit from.
  13371. * @returns {Object} Returns the new object.
  13372. */
  13373. var baseCreate = (function() {
  13374. function object() {}
  13375. return function(proto) {
  13376. if (!isObject(proto)) {
  13377. return {};
  13378. }
  13379. if (objectCreate) {
  13380. return objectCreate(proto);
  13381. }
  13382. object.prototype = proto;
  13383. var result = new object;
  13384. object.prototype = undefined;
  13385. return result;
  13386. };
  13387. }());
  13388. /**
  13389. * The function whose prototype chain sequence wrappers inherit from.
  13390. *
  13391. * @private
  13392. */
  13393. function baseLodash() {
  13394. // No operation performed.
  13395. }
  13396. /**
  13397. * The base constructor for creating `lodash` wrapper objects.
  13398. *
  13399. * @private
  13400. * @param {*} value The value to wrap.
  13401. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  13402. */
  13403. function LodashWrapper(value, chainAll) {
  13404. this.__wrapped__ = value;
  13405. this.__actions__ = [];
  13406. this.__chain__ = !!chainAll;
  13407. this.__index__ = 0;
  13408. this.__values__ = undefined;
  13409. }
  13410. /**
  13411. * By default, the template delimiters used by lodash are like those in
  13412. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  13413. * following template settings to use alternative delimiters.
  13414. *
  13415. * @static
  13416. * @memberOf _
  13417. * @type {Object}
  13418. */
  13419. lodash.templateSettings = {
  13420. /**
  13421. * Used to detect `data` property values to be HTML-escaped.
  13422. *
  13423. * @memberOf _.templateSettings
  13424. * @type {RegExp}
  13425. */
  13426. 'escape': reEscape,
  13427. /**
  13428. * Used to detect code to be evaluated.
  13429. *
  13430. * @memberOf _.templateSettings
  13431. * @type {RegExp}
  13432. */
  13433. 'evaluate': reEvaluate,
  13434. /**
  13435. * Used to detect `data` property values to inject.
  13436. *
  13437. * @memberOf _.templateSettings
  13438. * @type {RegExp}
  13439. */
  13440. 'interpolate': reInterpolate,
  13441. /**
  13442. * Used to reference the data object in the template text.
  13443. *
  13444. * @memberOf _.templateSettings
  13445. * @type {string}
  13446. */
  13447. 'variable': '',
  13448. /**
  13449. * Used to import variables into the compiled template.
  13450. *
  13451. * @memberOf _.templateSettings
  13452. * @type {Object}
  13453. */
  13454. 'imports': {
  13455. /**
  13456. * A reference to the `lodash` function.
  13457. *
  13458. * @memberOf _.templateSettings.imports
  13459. * @type {Function}
  13460. */
  13461. '_': lodash
  13462. }
  13463. };
  13464. // Ensure wrappers are instances of `baseLodash`.
  13465. lodash.prototype = baseLodash.prototype;
  13466. lodash.prototype.constructor = lodash;
  13467. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  13468. LodashWrapper.prototype.constructor = LodashWrapper;
  13469. /*------------------------------------------------------------------------*/
  13470. /**
  13471. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  13472. *
  13473. * @private
  13474. * @constructor
  13475. * @param {*} value The value to wrap.
  13476. */
  13477. function LazyWrapper(value) {
  13478. this.__wrapped__ = value;
  13479. this.__actions__ = [];
  13480. this.__dir__ = 1;
  13481. this.__filtered__ = false;
  13482. this.__iteratees__ = [];
  13483. this.__takeCount__ = MAX_ARRAY_LENGTH;
  13484. this.__views__ = [];
  13485. }
  13486. /**
  13487. * Creates a clone of the lazy wrapper object.
  13488. *
  13489. * @private
  13490. * @name clone
  13491. * @memberOf LazyWrapper
  13492. * @returns {Object} Returns the cloned `LazyWrapper` object.
  13493. */
  13494. function lazyClone() {
  13495. var result = new LazyWrapper(this.__wrapped__);
  13496. result.__actions__ = copyArray(this.__actions__);
  13497. result.__dir__ = this.__dir__;
  13498. result.__filtered__ = this.__filtered__;
  13499. result.__iteratees__ = copyArray(this.__iteratees__);
  13500. result.__takeCount__ = this.__takeCount__;
  13501. result.__views__ = copyArray(this.__views__);
  13502. return result;
  13503. }
  13504. /**
  13505. * Reverses the direction of lazy iteration.
  13506. *
  13507. * @private
  13508. * @name reverse
  13509. * @memberOf LazyWrapper
  13510. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  13511. */
  13512. function lazyReverse() {
  13513. if (this.__filtered__) {
  13514. var result = new LazyWrapper(this);
  13515. result.__dir__ = -1;
  13516. result.__filtered__ = true;
  13517. } else {
  13518. result = this.clone();
  13519. result.__dir__ *= -1;
  13520. }
  13521. return result;
  13522. }
  13523. /**
  13524. * Extracts the unwrapped value from its lazy wrapper.
  13525. *
  13526. * @private
  13527. * @name value
  13528. * @memberOf LazyWrapper
  13529. * @returns {*} Returns the unwrapped value.
  13530. */
  13531. function lazyValue() {
  13532. var array = this.__wrapped__.value(),
  13533. dir = this.__dir__,
  13534. isArr = isArray(array),
  13535. isRight = dir < 0,
  13536. arrLength = isArr ? array.length : 0,
  13537. view = getView(0, arrLength, this.__views__),
  13538. start = view.start,
  13539. end = view.end,
  13540. length = end - start,
  13541. index = isRight ? end : (start - 1),
  13542. iteratees = this.__iteratees__,
  13543. iterLength = iteratees.length,
  13544. resIndex = 0,
  13545. takeCount = nativeMin(length, this.__takeCount__);
  13546. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  13547. return baseWrapperValue(array, this.__actions__);
  13548. }
  13549. var result = [];
  13550. outer:
  13551. while (length-- && resIndex < takeCount) {
  13552. index += dir;
  13553. var iterIndex = -1,
  13554. value = array[index];
  13555. while (++iterIndex < iterLength) {
  13556. var data = iteratees[iterIndex],
  13557. iteratee = data.iteratee,
  13558. type = data.type,
  13559. computed = iteratee(value);
  13560. if (type == LAZY_MAP_FLAG) {
  13561. value = computed;
  13562. } else if (!computed) {
  13563. if (type == LAZY_FILTER_FLAG) {
  13564. continue outer;
  13565. } else {
  13566. break outer;
  13567. }
  13568. }
  13569. }
  13570. result[resIndex++] = value;
  13571. }
  13572. return result;
  13573. }
  13574. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  13575. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  13576. LazyWrapper.prototype.constructor = LazyWrapper;
  13577. /*------------------------------------------------------------------------*/
  13578. /**
  13579. * Creates a hash object.
  13580. *
  13581. * @private
  13582. * @constructor
  13583. * @param {Array} [entries] The key-value pairs to cache.
  13584. */
  13585. function Hash(entries) {
  13586. var index = -1,
  13587. length = entries == null ? 0 : entries.length;
  13588. this.clear();
  13589. while (++index < length) {
  13590. var entry = entries[index];
  13591. this.set(entry[0], entry[1]);
  13592. }
  13593. }
  13594. /**
  13595. * Removes all key-value entries from the hash.
  13596. *
  13597. * @private
  13598. * @name clear
  13599. * @memberOf Hash
  13600. */
  13601. function hashClear() {
  13602. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  13603. this.size = 0;
  13604. }
  13605. /**
  13606. * Removes `key` and its value from the hash.
  13607. *
  13608. * @private
  13609. * @name delete
  13610. * @memberOf Hash
  13611. * @param {Object} hash The hash to modify.
  13612. * @param {string} key The key of the value to remove.
  13613. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13614. */
  13615. function hashDelete(key) {
  13616. var result = this.has(key) && delete this.__data__[key];
  13617. this.size -= result ? 1 : 0;
  13618. return result;
  13619. }
  13620. /**
  13621. * Gets the hash value for `key`.
  13622. *
  13623. * @private
  13624. * @name get
  13625. * @memberOf Hash
  13626. * @param {string} key The key of the value to get.
  13627. * @returns {*} Returns the entry value.
  13628. */
  13629. function hashGet(key) {
  13630. var data = this.__data__;
  13631. if (nativeCreate) {
  13632. var result = data[key];
  13633. return result === HASH_UNDEFINED ? undefined : result;
  13634. }
  13635. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  13636. }
  13637. /**
  13638. * Checks if a hash value for `key` exists.
  13639. *
  13640. * @private
  13641. * @name has
  13642. * @memberOf Hash
  13643. * @param {string} key The key of the entry to check.
  13644. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13645. */
  13646. function hashHas(key) {
  13647. var data = this.__data__;
  13648. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  13649. }
  13650. /**
  13651. * Sets the hash `key` to `value`.
  13652. *
  13653. * @private
  13654. * @name set
  13655. * @memberOf Hash
  13656. * @param {string} key The key of the value to set.
  13657. * @param {*} value The value to set.
  13658. * @returns {Object} Returns the hash instance.
  13659. */
  13660. function hashSet(key, value) {
  13661. var data = this.__data__;
  13662. this.size += this.has(key) ? 0 : 1;
  13663. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  13664. return this;
  13665. }
  13666. // Add methods to `Hash`.
  13667. Hash.prototype.clear = hashClear;
  13668. Hash.prototype['delete'] = hashDelete;
  13669. Hash.prototype.get = hashGet;
  13670. Hash.prototype.has = hashHas;
  13671. Hash.prototype.set = hashSet;
  13672. /*------------------------------------------------------------------------*/
  13673. /**
  13674. * Creates an list cache object.
  13675. *
  13676. * @private
  13677. * @constructor
  13678. * @param {Array} [entries] The key-value pairs to cache.
  13679. */
  13680. function ListCache(entries) {
  13681. var index = -1,
  13682. length = entries == null ? 0 : entries.length;
  13683. this.clear();
  13684. while (++index < length) {
  13685. var entry = entries[index];
  13686. this.set(entry[0], entry[1]);
  13687. }
  13688. }
  13689. /**
  13690. * Removes all key-value entries from the list cache.
  13691. *
  13692. * @private
  13693. * @name clear
  13694. * @memberOf ListCache
  13695. */
  13696. function listCacheClear() {
  13697. this.__data__ = [];
  13698. this.size = 0;
  13699. }
  13700. /**
  13701. * Removes `key` and its value from the list cache.
  13702. *
  13703. * @private
  13704. * @name delete
  13705. * @memberOf ListCache
  13706. * @param {string} key The key of the value to remove.
  13707. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13708. */
  13709. function listCacheDelete(key) {
  13710. var data = this.__data__,
  13711. index = assocIndexOf(data, key);
  13712. if (index < 0) {
  13713. return false;
  13714. }
  13715. var lastIndex = data.length - 1;
  13716. if (index == lastIndex) {
  13717. data.pop();
  13718. } else {
  13719. splice.call(data, index, 1);
  13720. }
  13721. --this.size;
  13722. return true;
  13723. }
  13724. /**
  13725. * Gets the list cache value for `key`.
  13726. *
  13727. * @private
  13728. * @name get
  13729. * @memberOf ListCache
  13730. * @param {string} key The key of the value to get.
  13731. * @returns {*} Returns the entry value.
  13732. */
  13733. function listCacheGet(key) {
  13734. var data = this.__data__,
  13735. index = assocIndexOf(data, key);
  13736. return index < 0 ? undefined : data[index][1];
  13737. }
  13738. /**
  13739. * Checks if a list cache value for `key` exists.
  13740. *
  13741. * @private
  13742. * @name has
  13743. * @memberOf ListCache
  13744. * @param {string} key The key of the entry to check.
  13745. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13746. */
  13747. function listCacheHas(key) {
  13748. return assocIndexOf(this.__data__, key) > -1;
  13749. }
  13750. /**
  13751. * Sets the list cache `key` to `value`.
  13752. *
  13753. * @private
  13754. * @name set
  13755. * @memberOf ListCache
  13756. * @param {string} key The key of the value to set.
  13757. * @param {*} value The value to set.
  13758. * @returns {Object} Returns the list cache instance.
  13759. */
  13760. function listCacheSet(key, value) {
  13761. var data = this.__data__,
  13762. index = assocIndexOf(data, key);
  13763. if (index < 0) {
  13764. ++this.size;
  13765. data.push([key, value]);
  13766. } else {
  13767. data[index][1] = value;
  13768. }
  13769. return this;
  13770. }
  13771. // Add methods to `ListCache`.
  13772. ListCache.prototype.clear = listCacheClear;
  13773. ListCache.prototype['delete'] = listCacheDelete;
  13774. ListCache.prototype.get = listCacheGet;
  13775. ListCache.prototype.has = listCacheHas;
  13776. ListCache.prototype.set = listCacheSet;
  13777. /*------------------------------------------------------------------------*/
  13778. /**
  13779. * Creates a map cache object to store key-value pairs.
  13780. *
  13781. * @private
  13782. * @constructor
  13783. * @param {Array} [entries] The key-value pairs to cache.
  13784. */
  13785. function MapCache(entries) {
  13786. var index = -1,
  13787. length = entries == null ? 0 : entries.length;
  13788. this.clear();
  13789. while (++index < length) {
  13790. var entry = entries[index];
  13791. this.set(entry[0], entry[1]);
  13792. }
  13793. }
  13794. /**
  13795. * Removes all key-value entries from the map.
  13796. *
  13797. * @private
  13798. * @name clear
  13799. * @memberOf MapCache
  13800. */
  13801. function mapCacheClear() {
  13802. this.size = 0;
  13803. this.__data__ = {
  13804. 'hash': new Hash,
  13805. 'map': new (Map || ListCache),
  13806. 'string': new Hash
  13807. };
  13808. }
  13809. /**
  13810. * Removes `key` and its value from the map.
  13811. *
  13812. * @private
  13813. * @name delete
  13814. * @memberOf MapCache
  13815. * @param {string} key The key of the value to remove.
  13816. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13817. */
  13818. function mapCacheDelete(key) {
  13819. var result = getMapData(this, key)['delete'](key);
  13820. this.size -= result ? 1 : 0;
  13821. return result;
  13822. }
  13823. /**
  13824. * Gets the map value for `key`.
  13825. *
  13826. * @private
  13827. * @name get
  13828. * @memberOf MapCache
  13829. * @param {string} key The key of the value to get.
  13830. * @returns {*} Returns the entry value.
  13831. */
  13832. function mapCacheGet(key) {
  13833. return getMapData(this, key).get(key);
  13834. }
  13835. /**
  13836. * Checks if a map value for `key` exists.
  13837. *
  13838. * @private
  13839. * @name has
  13840. * @memberOf MapCache
  13841. * @param {string} key The key of the entry to check.
  13842. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13843. */
  13844. function mapCacheHas(key) {
  13845. return getMapData(this, key).has(key);
  13846. }
  13847. /**
  13848. * Sets the map `key` to `value`.
  13849. *
  13850. * @private
  13851. * @name set
  13852. * @memberOf MapCache
  13853. * @param {string} key The key of the value to set.
  13854. * @param {*} value The value to set.
  13855. * @returns {Object} Returns the map cache instance.
  13856. */
  13857. function mapCacheSet(key, value) {
  13858. var data = getMapData(this, key),
  13859. size = data.size;
  13860. data.set(key, value);
  13861. this.size += data.size == size ? 0 : 1;
  13862. return this;
  13863. }
  13864. // Add methods to `MapCache`.
  13865. MapCache.prototype.clear = mapCacheClear;
  13866. MapCache.prototype['delete'] = mapCacheDelete;
  13867. MapCache.prototype.get = mapCacheGet;
  13868. MapCache.prototype.has = mapCacheHas;
  13869. MapCache.prototype.set = mapCacheSet;
  13870. /*------------------------------------------------------------------------*/
  13871. /**
  13872. *
  13873. * Creates an array cache object to store unique values.
  13874. *
  13875. * @private
  13876. * @constructor
  13877. * @param {Array} [values] The values to cache.
  13878. */
  13879. function SetCache(values) {
  13880. var index = -1,
  13881. length = values == null ? 0 : values.length;
  13882. this.__data__ = new MapCache;
  13883. while (++index < length) {
  13884. this.add(values[index]);
  13885. }
  13886. }
  13887. /**
  13888. * Adds `value` to the array cache.
  13889. *
  13890. * @private
  13891. * @name add
  13892. * @memberOf SetCache
  13893. * @alias push
  13894. * @param {*} value The value to cache.
  13895. * @returns {Object} Returns the cache instance.
  13896. */
  13897. function setCacheAdd(value) {
  13898. this.__data__.set(value, HASH_UNDEFINED);
  13899. return this;
  13900. }
  13901. /**
  13902. * Checks if `value` is in the array cache.
  13903. *
  13904. * @private
  13905. * @name has
  13906. * @memberOf SetCache
  13907. * @param {*} value The value to search for.
  13908. * @returns {number} Returns `true` if `value` is found, else `false`.
  13909. */
  13910. function setCacheHas(value) {
  13911. return this.__data__.has(value);
  13912. }
  13913. // Add methods to `SetCache`.
  13914. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  13915. SetCache.prototype.has = setCacheHas;
  13916. /*------------------------------------------------------------------------*/
  13917. /**
  13918. * Creates a stack cache object to store key-value pairs.
  13919. *
  13920. * @private
  13921. * @constructor
  13922. * @param {Array} [entries] The key-value pairs to cache.
  13923. */
  13924. function Stack(entries) {
  13925. var data = this.__data__ = new ListCache(entries);
  13926. this.size = data.size;
  13927. }
  13928. /**
  13929. * Removes all key-value entries from the stack.
  13930. *
  13931. * @private
  13932. * @name clear
  13933. * @memberOf Stack
  13934. */
  13935. function stackClear() {
  13936. this.__data__ = new ListCache;
  13937. this.size = 0;
  13938. }
  13939. /**
  13940. * Removes `key` and its value from the stack.
  13941. *
  13942. * @private
  13943. * @name delete
  13944. * @memberOf Stack
  13945. * @param {string} key The key of the value to remove.
  13946. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13947. */
  13948. function stackDelete(key) {
  13949. var data = this.__data__,
  13950. result = data['delete'](key);
  13951. this.size = data.size;
  13952. return result;
  13953. }
  13954. /**
  13955. * Gets the stack value for `key`.
  13956. *
  13957. * @private
  13958. * @name get
  13959. * @memberOf Stack
  13960. * @param {string} key The key of the value to get.
  13961. * @returns {*} Returns the entry value.
  13962. */
  13963. function stackGet(key) {
  13964. return this.__data__.get(key);
  13965. }
  13966. /**
  13967. * Checks if a stack value for `key` exists.
  13968. *
  13969. * @private
  13970. * @name has
  13971. * @memberOf Stack
  13972. * @param {string} key The key of the entry to check.
  13973. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13974. */
  13975. function stackHas(key) {
  13976. return this.__data__.has(key);
  13977. }
  13978. /**
  13979. * Sets the stack `key` to `value`.
  13980. *
  13981. * @private
  13982. * @name set
  13983. * @memberOf Stack
  13984. * @param {string} key The key of the value to set.
  13985. * @param {*} value The value to set.
  13986. * @returns {Object} Returns the stack cache instance.
  13987. */
  13988. function stackSet(key, value) {
  13989. var data = this.__data__;
  13990. if (data instanceof ListCache) {
  13991. var pairs = data.__data__;
  13992. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  13993. pairs.push([key, value]);
  13994. this.size = ++data.size;
  13995. return this;
  13996. }
  13997. data = this.__data__ = new MapCache(pairs);
  13998. }
  13999. data.set(key, value);
  14000. this.size = data.size;
  14001. return this;
  14002. }
  14003. // Add methods to `Stack`.
  14004. Stack.prototype.clear = stackClear;
  14005. Stack.prototype['delete'] = stackDelete;
  14006. Stack.prototype.get = stackGet;
  14007. Stack.prototype.has = stackHas;
  14008. Stack.prototype.set = stackSet;
  14009. /*------------------------------------------------------------------------*/
  14010. /**
  14011. * Creates an array of the enumerable property names of the array-like `value`.
  14012. *
  14013. * @private
  14014. * @param {*} value The value to query.
  14015. * @param {boolean} inherited Specify returning inherited property names.
  14016. * @returns {Array} Returns the array of property names.
  14017. */
  14018. function arrayLikeKeys(value, inherited) {
  14019. var isArr = isArray(value),
  14020. isArg = !isArr && isArguments(value),
  14021. isBuff = !isArr && !isArg && isBuffer(value),
  14022. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  14023. skipIndexes = isArr || isArg || isBuff || isType,
  14024. result = skipIndexes ? baseTimes(value.length, String) : [],
  14025. length = result.length;
  14026. for (var key in value) {
  14027. if ((inherited || hasOwnProperty.call(value, key)) &&
  14028. !(skipIndexes && (
  14029. // Safari 9 has enumerable `arguments.length` in strict mode.
  14030. key == 'length' ||
  14031. // Node.js 0.10 has enumerable non-index properties on buffers.
  14032. (isBuff && (key == 'offset' || key == 'parent')) ||
  14033. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  14034. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  14035. // Skip index properties.
  14036. isIndex(key, length)
  14037. ))) {
  14038. result.push(key);
  14039. }
  14040. }
  14041. return result;
  14042. }
  14043. /**
  14044. * A specialized version of `_.sample` for arrays.
  14045. *
  14046. * @private
  14047. * @param {Array} array The array to sample.
  14048. * @returns {*} Returns the random element.
  14049. */
  14050. function arraySample(array) {
  14051. var length = array.length;
  14052. return length ? array[baseRandom(0, length - 1)] : undefined;
  14053. }
  14054. /**
  14055. * A specialized version of `_.sampleSize` for arrays.
  14056. *
  14057. * @private
  14058. * @param {Array} array The array to sample.
  14059. * @param {number} n The number of elements to sample.
  14060. * @returns {Array} Returns the random elements.
  14061. */
  14062. function arraySampleSize(array, n) {
  14063. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  14064. }
  14065. /**
  14066. * A specialized version of `_.shuffle` for arrays.
  14067. *
  14068. * @private
  14069. * @param {Array} array The array to shuffle.
  14070. * @returns {Array} Returns the new shuffled array.
  14071. */
  14072. function arrayShuffle(array) {
  14073. return shuffleSelf(copyArray(array));
  14074. }
  14075. /**
  14076. * This function is like `assignValue` except that it doesn't assign
  14077. * `undefined` values.
  14078. *
  14079. * @private
  14080. * @param {Object} object The object to modify.
  14081. * @param {string} key The key of the property to assign.
  14082. * @param {*} value The value to assign.
  14083. */
  14084. function assignMergeValue(object, key, value) {
  14085. if ((value !== undefined && !eq(object[key], value)) ||
  14086. (value === undefined && !(key in object))) {
  14087. baseAssignValue(object, key, value);
  14088. }
  14089. }
  14090. /**
  14091. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  14092. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  14093. * for equality comparisons.
  14094. *
  14095. * @private
  14096. * @param {Object} object The object to modify.
  14097. * @param {string} key The key of the property to assign.
  14098. * @param {*} value The value to assign.
  14099. */
  14100. function assignValue(object, key, value) {
  14101. var objValue = object[key];
  14102. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  14103. (value === undefined && !(key in object))) {
  14104. baseAssignValue(object, key, value);
  14105. }
  14106. }
  14107. /**
  14108. * Gets the index at which the `key` is found in `array` of key-value pairs.
  14109. *
  14110. * @private
  14111. * @param {Array} array The array to inspect.
  14112. * @param {*} key The key to search for.
  14113. * @returns {number} Returns the index of the matched value, else `-1`.
  14114. */
  14115. function assocIndexOf(array, key) {
  14116. var length = array.length;
  14117. while (length--) {
  14118. if (eq(array[length][0], key)) {
  14119. return length;
  14120. }
  14121. }
  14122. return -1;
  14123. }
  14124. /**
  14125. * Aggregates elements of `collection` on `accumulator` with keys transformed
  14126. * by `iteratee` and values set by `setter`.
  14127. *
  14128. * @private
  14129. * @param {Array|Object} collection The collection to iterate over.
  14130. * @param {Function} setter The function to set `accumulator` values.
  14131. * @param {Function} iteratee The iteratee to transform keys.
  14132. * @param {Object} accumulator The initial aggregated object.
  14133. * @returns {Function} Returns `accumulator`.
  14134. */
  14135. function baseAggregator(collection, setter, iteratee, accumulator) {
  14136. baseEach(collection, function(value, key, collection) {
  14137. setter(accumulator, value, iteratee(value), collection);
  14138. });
  14139. return accumulator;
  14140. }
  14141. /**
  14142. * The base implementation of `_.assign` without support for multiple sources
  14143. * or `customizer` functions.
  14144. *
  14145. * @private
  14146. * @param {Object} object The destination object.
  14147. * @param {Object} source The source object.
  14148. * @returns {Object} Returns `object`.
  14149. */
  14150. function baseAssign(object, source) {
  14151. return object && copyObject(source, keys(source), object);
  14152. }
  14153. /**
  14154. * The base implementation of `_.assignIn` without support for multiple sources
  14155. * or `customizer` functions.
  14156. *
  14157. * @private
  14158. * @param {Object} object The destination object.
  14159. * @param {Object} source The source object.
  14160. * @returns {Object} Returns `object`.
  14161. */
  14162. function baseAssignIn(object, source) {
  14163. return object && copyObject(source, keysIn(source), object);
  14164. }
  14165. /**
  14166. * The base implementation of `assignValue` and `assignMergeValue` without
  14167. * value checks.
  14168. *
  14169. * @private
  14170. * @param {Object} object The object to modify.
  14171. * @param {string} key The key of the property to assign.
  14172. * @param {*} value The value to assign.
  14173. */
  14174. function baseAssignValue(object, key, value) {
  14175. if (key == '__proto__' && defineProperty) {
  14176. defineProperty(object, key, {
  14177. 'configurable': true,
  14178. 'enumerable': true,
  14179. 'value': value,
  14180. 'writable': true
  14181. });
  14182. } else {
  14183. object[key] = value;
  14184. }
  14185. }
  14186. /**
  14187. * The base implementation of `_.at` without support for individual paths.
  14188. *
  14189. * @private
  14190. * @param {Object} object The object to iterate over.
  14191. * @param {string[]} paths The property paths to pick.
  14192. * @returns {Array} Returns the picked elements.
  14193. */
  14194. function baseAt(object, paths) {
  14195. var index = -1,
  14196. length = paths.length,
  14197. result = Array(length),
  14198. skip = object == null;
  14199. while (++index < length) {
  14200. result[index] = skip ? undefined : get(object, paths[index]);
  14201. }
  14202. return result;
  14203. }
  14204. /**
  14205. * The base implementation of `_.clamp` which doesn't coerce arguments.
  14206. *
  14207. * @private
  14208. * @param {number} number The number to clamp.
  14209. * @param {number} [lower] The lower bound.
  14210. * @param {number} upper The upper bound.
  14211. * @returns {number} Returns the clamped number.
  14212. */
  14213. function baseClamp(number, lower, upper) {
  14214. if (number === number) {
  14215. if (upper !== undefined) {
  14216. number = number <= upper ? number : upper;
  14217. }
  14218. if (lower !== undefined) {
  14219. number = number >= lower ? number : lower;
  14220. }
  14221. }
  14222. return number;
  14223. }
  14224. /**
  14225. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  14226. * traversed objects.
  14227. *
  14228. * @private
  14229. * @param {*} value The value to clone.
  14230. * @param {boolean} bitmask The bitmask flags.
  14231. * 1 - Deep clone
  14232. * 2 - Flatten inherited properties
  14233. * 4 - Clone symbols
  14234. * @param {Function} [customizer] The function to customize cloning.
  14235. * @param {string} [key] The key of `value`.
  14236. * @param {Object} [object] The parent object of `value`.
  14237. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  14238. * @returns {*} Returns the cloned value.
  14239. */
  14240. function baseClone(value, bitmask, customizer, key, object, stack) {
  14241. var result,
  14242. isDeep = bitmask & CLONE_DEEP_FLAG,
  14243. isFlat = bitmask & CLONE_FLAT_FLAG,
  14244. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  14245. if (customizer) {
  14246. result = object ? customizer(value, key, object, stack) : customizer(value);
  14247. }
  14248. if (result !== undefined) {
  14249. return result;
  14250. }
  14251. if (!isObject(value)) {
  14252. return value;
  14253. }
  14254. var isArr = isArray(value);
  14255. if (isArr) {
  14256. result = initCloneArray(value);
  14257. if (!isDeep) {
  14258. return copyArray(value, result);
  14259. }
  14260. } else {
  14261. var tag = getTag(value),
  14262. isFunc = tag == funcTag || tag == genTag;
  14263. if (isBuffer(value)) {
  14264. return cloneBuffer(value, isDeep);
  14265. }
  14266. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  14267. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  14268. if (!isDeep) {
  14269. return isFlat
  14270. ? copySymbolsIn(value, baseAssignIn(result, value))
  14271. : copySymbols(value, baseAssign(result, value));
  14272. }
  14273. } else {
  14274. if (!cloneableTags[tag]) {
  14275. return object ? value : {};
  14276. }
  14277. result = initCloneByTag(value, tag, isDeep);
  14278. }
  14279. }
  14280. // Check for circular references and return its corresponding clone.
  14281. stack || (stack = new Stack);
  14282. var stacked = stack.get(value);
  14283. if (stacked) {
  14284. return stacked;
  14285. }
  14286. stack.set(value, result);
  14287. if (isSet(value)) {
  14288. value.forEach(function(subValue) {
  14289. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  14290. });
  14291. return result;
  14292. }
  14293. if (isMap(value)) {
  14294. value.forEach(function(subValue, key) {
  14295. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  14296. });
  14297. return result;
  14298. }
  14299. var keysFunc = isFull
  14300. ? (isFlat ? getAllKeysIn : getAllKeys)
  14301. : (isFlat ? keysIn : keys);
  14302. var props = isArr ? undefined : keysFunc(value);
  14303. arrayEach(props || value, function(subValue, key) {
  14304. if (props) {
  14305. key = subValue;
  14306. subValue = value[key];
  14307. }
  14308. // Recursively populate clone (susceptible to call stack limits).
  14309. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  14310. });
  14311. return result;
  14312. }
  14313. /**
  14314. * The base implementation of `_.conforms` which doesn't clone `source`.
  14315. *
  14316. * @private
  14317. * @param {Object} source The object of property predicates to conform to.
  14318. * @returns {Function} Returns the new spec function.
  14319. */
  14320. function baseConforms(source) {
  14321. var props = keys(source);
  14322. return function(object) {
  14323. return baseConformsTo(object, source, props);
  14324. };
  14325. }
  14326. /**
  14327. * The base implementation of `_.conformsTo` which accepts `props` to check.
  14328. *
  14329. * @private
  14330. * @param {Object} object The object to inspect.
  14331. * @param {Object} source The object of property predicates to conform to.
  14332. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  14333. */
  14334. function baseConformsTo(object, source, props) {
  14335. var length = props.length;
  14336. if (object == null) {
  14337. return !length;
  14338. }
  14339. object = Object(object);
  14340. while (length--) {
  14341. var key = props[length],
  14342. predicate = source[key],
  14343. value = object[key];
  14344. if ((value === undefined && !(key in object)) || !predicate(value)) {
  14345. return false;
  14346. }
  14347. }
  14348. return true;
  14349. }
  14350. /**
  14351. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  14352. * to provide to `func`.
  14353. *
  14354. * @private
  14355. * @param {Function} func The function to delay.
  14356. * @param {number} wait The number of milliseconds to delay invocation.
  14357. * @param {Array} args The arguments to provide to `func`.
  14358. * @returns {number|Object} Returns the timer id or timeout object.
  14359. */
  14360. function baseDelay(func, wait, args) {
  14361. if (typeof func != 'function') {
  14362. throw new TypeError(FUNC_ERROR_TEXT);
  14363. }
  14364. return setTimeout(function() { func.apply(undefined, args); }, wait);
  14365. }
  14366. /**
  14367. * The base implementation of methods like `_.difference` without support
  14368. * for excluding multiple arrays or iteratee shorthands.
  14369. *
  14370. * @private
  14371. * @param {Array} array The array to inspect.
  14372. * @param {Array} values The values to exclude.
  14373. * @param {Function} [iteratee] The iteratee invoked per element.
  14374. * @param {Function} [comparator] The comparator invoked per element.
  14375. * @returns {Array} Returns the new array of filtered values.
  14376. */
  14377. function baseDifference(array, values, iteratee, comparator) {
  14378. var index = -1,
  14379. includes = arrayIncludes,
  14380. isCommon = true,
  14381. length = array.length,
  14382. result = [],
  14383. valuesLength = values.length;
  14384. if (!length) {
  14385. return result;
  14386. }
  14387. if (iteratee) {
  14388. values = arrayMap(values, baseUnary(iteratee));
  14389. }
  14390. if (comparator) {
  14391. includes = arrayIncludesWith;
  14392. isCommon = false;
  14393. }
  14394. else if (values.length >= LARGE_ARRAY_SIZE) {
  14395. includes = cacheHas;
  14396. isCommon = false;
  14397. values = new SetCache(values);
  14398. }
  14399. outer:
  14400. while (++index < length) {
  14401. var value = array[index],
  14402. computed = iteratee == null ? value : iteratee(value);
  14403. value = (comparator || value !== 0) ? value : 0;
  14404. if (isCommon && computed === computed) {
  14405. var valuesIndex = valuesLength;
  14406. while (valuesIndex--) {
  14407. if (values[valuesIndex] === computed) {
  14408. continue outer;
  14409. }
  14410. }
  14411. result.push(value);
  14412. }
  14413. else if (!includes(values, computed, comparator)) {
  14414. result.push(value);
  14415. }
  14416. }
  14417. return result;
  14418. }
  14419. /**
  14420. * The base implementation of `_.forEach` without support for iteratee shorthands.
  14421. *
  14422. * @private
  14423. * @param {Array|Object} collection The collection to iterate over.
  14424. * @param {Function} iteratee The function invoked per iteration.
  14425. * @returns {Array|Object} Returns `collection`.
  14426. */
  14427. var baseEach = createBaseEach(baseForOwn);
  14428. /**
  14429. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  14430. *
  14431. * @private
  14432. * @param {Array|Object} collection The collection to iterate over.
  14433. * @param {Function} iteratee The function invoked per iteration.
  14434. * @returns {Array|Object} Returns `collection`.
  14435. */
  14436. var baseEachRight = createBaseEach(baseForOwnRight, true);
  14437. /**
  14438. * The base implementation of `_.every` without support for iteratee shorthands.
  14439. *
  14440. * @private
  14441. * @param {Array|Object} collection The collection to iterate over.
  14442. * @param {Function} predicate The function invoked per iteration.
  14443. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  14444. * else `false`
  14445. */
  14446. function baseEvery(collection, predicate) {
  14447. var result = true;
  14448. baseEach(collection, function(value, index, collection) {
  14449. result = !!predicate(value, index, collection);
  14450. return result;
  14451. });
  14452. return result;
  14453. }
  14454. /**
  14455. * The base implementation of methods like `_.max` and `_.min` which accepts a
  14456. * `comparator` to determine the extremum value.
  14457. *
  14458. * @private
  14459. * @param {Array} array The array to iterate over.
  14460. * @param {Function} iteratee The iteratee invoked per iteration.
  14461. * @param {Function} comparator The comparator used to compare values.
  14462. * @returns {*} Returns the extremum value.
  14463. */
  14464. function baseExtremum(array, iteratee, comparator) {
  14465. var index = -1,
  14466. length = array.length;
  14467. while (++index < length) {
  14468. var value = array[index],
  14469. current = iteratee(value);
  14470. if (current != null && (computed === undefined
  14471. ? (current === current && !isSymbol(current))
  14472. : comparator(current, computed)
  14473. )) {
  14474. var computed = current,
  14475. result = value;
  14476. }
  14477. }
  14478. return result;
  14479. }
  14480. /**
  14481. * The base implementation of `_.fill` without an iteratee call guard.
  14482. *
  14483. * @private
  14484. * @param {Array} array The array to fill.
  14485. * @param {*} value The value to fill `array` with.
  14486. * @param {number} [start=0] The start position.
  14487. * @param {number} [end=array.length] The end position.
  14488. * @returns {Array} Returns `array`.
  14489. */
  14490. function baseFill(array, value, start, end) {
  14491. var length = array.length;
  14492. start = toInteger(start);
  14493. if (start < 0) {
  14494. start = -start > length ? 0 : (length + start);
  14495. }
  14496. end = (end === undefined || end > length) ? length : toInteger(end);
  14497. if (end < 0) {
  14498. end += length;
  14499. }
  14500. end = start > end ? 0 : toLength(end);
  14501. while (start < end) {
  14502. array[start++] = value;
  14503. }
  14504. return array;
  14505. }
  14506. /**
  14507. * The base implementation of `_.filter` without support for iteratee shorthands.
  14508. *
  14509. * @private
  14510. * @param {Array|Object} collection The collection to iterate over.
  14511. * @param {Function} predicate The function invoked per iteration.
  14512. * @returns {Array} Returns the new filtered array.
  14513. */
  14514. function baseFilter(collection, predicate) {
  14515. var result = [];
  14516. baseEach(collection, function(value, index, collection) {
  14517. if (predicate(value, index, collection)) {
  14518. result.push(value);
  14519. }
  14520. });
  14521. return result;
  14522. }
  14523. /**
  14524. * The base implementation of `_.flatten` with support for restricting flattening.
  14525. *
  14526. * @private
  14527. * @param {Array} array The array to flatten.
  14528. * @param {number} depth The maximum recursion depth.
  14529. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  14530. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  14531. * @param {Array} [result=[]] The initial result value.
  14532. * @returns {Array} Returns the new flattened array.
  14533. */
  14534. function baseFlatten(array, depth, predicate, isStrict, result) {
  14535. var index = -1,
  14536. length = array.length;
  14537. predicate || (predicate = isFlattenable);
  14538. result || (result = []);
  14539. while (++index < length) {
  14540. var value = array[index];
  14541. if (depth > 0 && predicate(value)) {
  14542. if (depth > 1) {
  14543. // Recursively flatten arrays (susceptible to call stack limits).
  14544. baseFlatten(value, depth - 1, predicate, isStrict, result);
  14545. } else {
  14546. arrayPush(result, value);
  14547. }
  14548. } else if (!isStrict) {
  14549. result[result.length] = value;
  14550. }
  14551. }
  14552. return result;
  14553. }
  14554. /**
  14555. * The base implementation of `baseForOwn` which iterates over `object`
  14556. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  14557. * Iteratee functions may exit iteration early by explicitly returning `false`.
  14558. *
  14559. * @private
  14560. * @param {Object} object The object to iterate over.
  14561. * @param {Function} iteratee The function invoked per iteration.
  14562. * @param {Function} keysFunc The function to get the keys of `object`.
  14563. * @returns {Object} Returns `object`.
  14564. */
  14565. var baseFor = createBaseFor();
  14566. /**
  14567. * This function is like `baseFor` except that it iterates over properties
  14568. * in the opposite order.
  14569. *
  14570. * @private
  14571. * @param {Object} object The object to iterate over.
  14572. * @param {Function} iteratee The function invoked per iteration.
  14573. * @param {Function} keysFunc The function to get the keys of `object`.
  14574. * @returns {Object} Returns `object`.
  14575. */
  14576. var baseForRight = createBaseFor(true);
  14577. /**
  14578. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  14579. *
  14580. * @private
  14581. * @param {Object} object The object to iterate over.
  14582. * @param {Function} iteratee The function invoked per iteration.
  14583. * @returns {Object} Returns `object`.
  14584. */
  14585. function baseForOwn(object, iteratee) {
  14586. return object && baseFor(object, iteratee, keys);
  14587. }
  14588. /**
  14589. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  14590. *
  14591. * @private
  14592. * @param {Object} object The object to iterate over.
  14593. * @param {Function} iteratee The function invoked per iteration.
  14594. * @returns {Object} Returns `object`.
  14595. */
  14596. function baseForOwnRight(object, iteratee) {
  14597. return object && baseForRight(object, iteratee, keys);
  14598. }
  14599. /**
  14600. * The base implementation of `_.functions` which creates an array of
  14601. * `object` function property names filtered from `props`.
  14602. *
  14603. * @private
  14604. * @param {Object} object The object to inspect.
  14605. * @param {Array} props The property names to filter.
  14606. * @returns {Array} Returns the function names.
  14607. */
  14608. function baseFunctions(object, props) {
  14609. return arrayFilter(props, function(key) {
  14610. return isFunction(object[key]);
  14611. });
  14612. }
  14613. /**
  14614. * The base implementation of `_.get` without support for default values.
  14615. *
  14616. * @private
  14617. * @param {Object} object The object to query.
  14618. * @param {Array|string} path The path of the property to get.
  14619. * @returns {*} Returns the resolved value.
  14620. */
  14621. function baseGet(object, path) {
  14622. path = castPath(path, object);
  14623. var index = 0,
  14624. length = path.length;
  14625. while (object != null && index < length) {
  14626. object = object[toKey(path[index++])];
  14627. }
  14628. return (index && index == length) ? object : undefined;
  14629. }
  14630. /**
  14631. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  14632. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  14633. * symbols of `object`.
  14634. *
  14635. * @private
  14636. * @param {Object} object The object to query.
  14637. * @param {Function} keysFunc The function to get the keys of `object`.
  14638. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  14639. * @returns {Array} Returns the array of property names and symbols.
  14640. */
  14641. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  14642. var result = keysFunc(object);
  14643. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  14644. }
  14645. /**
  14646. * The base implementation of `getTag` without fallbacks for buggy environments.
  14647. *
  14648. * @private
  14649. * @param {*} value The value to query.
  14650. * @returns {string} Returns the `toStringTag`.
  14651. */
  14652. function baseGetTag(value) {
  14653. if (value == null) {
  14654. return value === undefined ? undefinedTag : nullTag;
  14655. }
  14656. return (symToStringTag && symToStringTag in Object(value))
  14657. ? getRawTag(value)
  14658. : objectToString(value);
  14659. }
  14660. /**
  14661. * The base implementation of `_.gt` which doesn't coerce arguments.
  14662. *
  14663. * @private
  14664. * @param {*} value The value to compare.
  14665. * @param {*} other The other value to compare.
  14666. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  14667. * else `false`.
  14668. */
  14669. function baseGt(value, other) {
  14670. return value > other;
  14671. }
  14672. /**
  14673. * The base implementation of `_.has` without support for deep paths.
  14674. *
  14675. * @private
  14676. * @param {Object} [object] The object to query.
  14677. * @param {Array|string} key The key to check.
  14678. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  14679. */
  14680. function baseHas(object, key) {
  14681. return object != null && hasOwnProperty.call(object, key);
  14682. }
  14683. /**
  14684. * The base implementation of `_.hasIn` without support for deep paths.
  14685. *
  14686. * @private
  14687. * @param {Object} [object] The object to query.
  14688. * @param {Array|string} key The key to check.
  14689. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  14690. */
  14691. function baseHasIn(object, key) {
  14692. return object != null && key in Object(object);
  14693. }
  14694. /**
  14695. * The base implementation of `_.inRange` which doesn't coerce arguments.
  14696. *
  14697. * @private
  14698. * @param {number} number The number to check.
  14699. * @param {number} start The start of the range.
  14700. * @param {number} end The end of the range.
  14701. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14702. */
  14703. function baseInRange(number, start, end) {
  14704. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  14705. }
  14706. /**
  14707. * The base implementation of methods like `_.intersection`, without support
  14708. * for iteratee shorthands, that accepts an array of arrays to inspect.
  14709. *
  14710. * @private
  14711. * @param {Array} arrays The arrays to inspect.
  14712. * @param {Function} [iteratee] The iteratee invoked per element.
  14713. * @param {Function} [comparator] The comparator invoked per element.
  14714. * @returns {Array} Returns the new array of shared values.
  14715. */
  14716. function baseIntersection(arrays, iteratee, comparator) {
  14717. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  14718. length = arrays[0].length,
  14719. othLength = arrays.length,
  14720. othIndex = othLength,
  14721. caches = Array(othLength),
  14722. maxLength = Infinity,
  14723. result = [];
  14724. while (othIndex--) {
  14725. var array = arrays[othIndex];
  14726. if (othIndex && iteratee) {
  14727. array = arrayMap(array, baseUnary(iteratee));
  14728. }
  14729. maxLength = nativeMin(array.length, maxLength);
  14730. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  14731. ? new SetCache(othIndex && array)
  14732. : undefined;
  14733. }
  14734. array = arrays[0];
  14735. var index = -1,
  14736. seen = caches[0];
  14737. outer:
  14738. while (++index < length && result.length < maxLength) {
  14739. var value = array[index],
  14740. computed = iteratee ? iteratee(value) : value;
  14741. value = (comparator || value !== 0) ? value : 0;
  14742. if (!(seen
  14743. ? cacheHas(seen, computed)
  14744. : includes(result, computed, comparator)
  14745. )) {
  14746. othIndex = othLength;
  14747. while (--othIndex) {
  14748. var cache = caches[othIndex];
  14749. if (!(cache
  14750. ? cacheHas(cache, computed)
  14751. : includes(arrays[othIndex], computed, comparator))
  14752. ) {
  14753. continue outer;
  14754. }
  14755. }
  14756. if (seen) {
  14757. seen.push(computed);
  14758. }
  14759. result.push(value);
  14760. }
  14761. }
  14762. return result;
  14763. }
  14764. /**
  14765. * The base implementation of `_.invert` and `_.invertBy` which inverts
  14766. * `object` with values transformed by `iteratee` and set by `setter`.
  14767. *
  14768. * @private
  14769. * @param {Object} object The object to iterate over.
  14770. * @param {Function} setter The function to set `accumulator` values.
  14771. * @param {Function} iteratee The iteratee to transform values.
  14772. * @param {Object} accumulator The initial inverted object.
  14773. * @returns {Function} Returns `accumulator`.
  14774. */
  14775. function baseInverter(object, setter, iteratee, accumulator) {
  14776. baseForOwn(object, function(value, key, object) {
  14777. setter(accumulator, iteratee(value), key, object);
  14778. });
  14779. return accumulator;
  14780. }
  14781. /**
  14782. * The base implementation of `_.invoke` without support for individual
  14783. * method arguments.
  14784. *
  14785. * @private
  14786. * @param {Object} object The object to query.
  14787. * @param {Array|string} path The path of the method to invoke.
  14788. * @param {Array} args The arguments to invoke the method with.
  14789. * @returns {*} Returns the result of the invoked method.
  14790. */
  14791. function baseInvoke(object, path, args) {
  14792. path = castPath(path, object);
  14793. object = parent(object, path);
  14794. var func = object == null ? object : object[toKey(last(path))];
  14795. return func == null ? undefined : apply(func, object, args);
  14796. }
  14797. /**
  14798. * The base implementation of `_.isArguments`.
  14799. *
  14800. * @private
  14801. * @param {*} value The value to check.
  14802. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  14803. */
  14804. function baseIsArguments(value) {
  14805. return isObjectLike(value) && baseGetTag(value) == argsTag;
  14806. }
  14807. /**
  14808. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  14809. *
  14810. * @private
  14811. * @param {*} value The value to check.
  14812. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  14813. */
  14814. function baseIsArrayBuffer(value) {
  14815. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  14816. }
  14817. /**
  14818. * The base implementation of `_.isDate` without Node.js optimizations.
  14819. *
  14820. * @private
  14821. * @param {*} value The value to check.
  14822. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  14823. */
  14824. function baseIsDate(value) {
  14825. return isObjectLike(value) && baseGetTag(value) == dateTag;
  14826. }
  14827. /**
  14828. * The base implementation of `_.isEqual` which supports partial comparisons
  14829. * and tracks traversed objects.
  14830. *
  14831. * @private
  14832. * @param {*} value The value to compare.
  14833. * @param {*} other The other value to compare.
  14834. * @param {boolean} bitmask The bitmask flags.
  14835. * 1 - Unordered comparison
  14836. * 2 - Partial comparison
  14837. * @param {Function} [customizer] The function to customize comparisons.
  14838. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  14839. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  14840. */
  14841. function baseIsEqual(value, other, bitmask, customizer, stack) {
  14842. if (value === other) {
  14843. return true;
  14844. }
  14845. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  14846. return value !== value && other !== other;
  14847. }
  14848. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  14849. }
  14850. /**
  14851. * A specialized version of `baseIsEqual` for arrays and objects which performs
  14852. * deep comparisons and tracks traversed objects enabling objects with circular
  14853. * references to be compared.
  14854. *
  14855. * @private
  14856. * @param {Object} object The object to compare.
  14857. * @param {Object} other The other object to compare.
  14858. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  14859. * @param {Function} customizer The function to customize comparisons.
  14860. * @param {Function} equalFunc The function to determine equivalents of values.
  14861. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  14862. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  14863. */
  14864. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  14865. var objIsArr = isArray(object),
  14866. othIsArr = isArray(other),
  14867. objTag = objIsArr ? arrayTag : getTag(object),
  14868. othTag = othIsArr ? arrayTag : getTag(other);
  14869. objTag = objTag == argsTag ? objectTag : objTag;
  14870. othTag = othTag == argsTag ? objectTag : othTag;
  14871. var objIsObj = objTag == objectTag,
  14872. othIsObj = othTag == objectTag,
  14873. isSameTag = objTag == othTag;
  14874. if (isSameTag && isBuffer(object)) {
  14875. if (!isBuffer(other)) {
  14876. return false;
  14877. }
  14878. objIsArr = true;
  14879. objIsObj = false;
  14880. }
  14881. if (isSameTag && !objIsObj) {
  14882. stack || (stack = new Stack);
  14883. return (objIsArr || isTypedArray(object))
  14884. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  14885. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  14886. }
  14887. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  14888. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  14889. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  14890. if (objIsWrapped || othIsWrapped) {
  14891. var objUnwrapped = objIsWrapped ? object.value() : object,
  14892. othUnwrapped = othIsWrapped ? other.value() : other;
  14893. stack || (stack = new Stack);
  14894. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  14895. }
  14896. }
  14897. if (!isSameTag) {
  14898. return false;
  14899. }
  14900. stack || (stack = new Stack);
  14901. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  14902. }
  14903. /**
  14904. * The base implementation of `_.isMap` without Node.js optimizations.
  14905. *
  14906. * @private
  14907. * @param {*} value The value to check.
  14908. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  14909. */
  14910. function baseIsMap(value) {
  14911. return isObjectLike(value) && getTag(value) == mapTag;
  14912. }
  14913. /**
  14914. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  14915. *
  14916. * @private
  14917. * @param {Object} object The object to inspect.
  14918. * @param {Object} source The object of property values to match.
  14919. * @param {Array} matchData The property names, values, and compare flags to match.
  14920. * @param {Function} [customizer] The function to customize comparisons.
  14921. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  14922. */
  14923. function baseIsMatch(object, source, matchData, customizer) {
  14924. var index = matchData.length,
  14925. length = index,
  14926. noCustomizer = !customizer;
  14927. if (object == null) {
  14928. return !length;
  14929. }
  14930. object = Object(object);
  14931. while (index--) {
  14932. var data = matchData[index];
  14933. if ((noCustomizer && data[2])
  14934. ? data[1] !== object[data[0]]
  14935. : !(data[0] in object)
  14936. ) {
  14937. return false;
  14938. }
  14939. }
  14940. while (++index < length) {
  14941. data = matchData[index];
  14942. var key = data[0],
  14943. objValue = object[key],
  14944. srcValue = data[1];
  14945. if (noCustomizer && data[2]) {
  14946. if (objValue === undefined && !(key in object)) {
  14947. return false;
  14948. }
  14949. } else {
  14950. var stack = new Stack;
  14951. if (customizer) {
  14952. var result = customizer(objValue, srcValue, key, object, source, stack);
  14953. }
  14954. if (!(result === undefined
  14955. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  14956. : result
  14957. )) {
  14958. return false;
  14959. }
  14960. }
  14961. }
  14962. return true;
  14963. }
  14964. /**
  14965. * The base implementation of `_.isNative` without bad shim checks.
  14966. *
  14967. * @private
  14968. * @param {*} value The value to check.
  14969. * @returns {boolean} Returns `true` if `value` is a native function,
  14970. * else `false`.
  14971. */
  14972. function baseIsNative(value) {
  14973. if (!isObject(value) || isMasked(value)) {
  14974. return false;
  14975. }
  14976. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  14977. return pattern.test(toSource(value));
  14978. }
  14979. /**
  14980. * The base implementation of `_.isRegExp` without Node.js optimizations.
  14981. *
  14982. * @private
  14983. * @param {*} value The value to check.
  14984. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  14985. */
  14986. function baseIsRegExp(value) {
  14987. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  14988. }
  14989. /**
  14990. * The base implementation of `_.isSet` without Node.js optimizations.
  14991. *
  14992. * @private
  14993. * @param {*} value The value to check.
  14994. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  14995. */
  14996. function baseIsSet(value) {
  14997. return isObjectLike(value) && getTag(value) == setTag;
  14998. }
  14999. /**
  15000. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  15001. *
  15002. * @private
  15003. * @param {*} value The value to check.
  15004. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  15005. */
  15006. function baseIsTypedArray(value) {
  15007. return isObjectLike(value) &&
  15008. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  15009. }
  15010. /**
  15011. * The base implementation of `_.iteratee`.
  15012. *
  15013. * @private
  15014. * @param {*} [value=_.identity] The value to convert to an iteratee.
  15015. * @returns {Function} Returns the iteratee.
  15016. */
  15017. function baseIteratee(value) {
  15018. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  15019. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  15020. if (typeof value == 'function') {
  15021. return value;
  15022. }
  15023. if (value == null) {
  15024. return identity;
  15025. }
  15026. if (typeof value == 'object') {
  15027. return isArray(value)
  15028. ? baseMatchesProperty(value[0], value[1])
  15029. : baseMatches(value);
  15030. }
  15031. return property(value);
  15032. }
  15033. /**
  15034. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  15035. *
  15036. * @private
  15037. * @param {Object} object The object to query.
  15038. * @returns {Array} Returns the array of property names.
  15039. */
  15040. function baseKeys(object) {
  15041. if (!isPrototype(object)) {
  15042. return nativeKeys(object);
  15043. }
  15044. var result = [];
  15045. for (var key in Object(object)) {
  15046. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  15047. result.push(key);
  15048. }
  15049. }
  15050. return result;
  15051. }
  15052. /**
  15053. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  15054. *
  15055. * @private
  15056. * @param {Object} object The object to query.
  15057. * @returns {Array} Returns the array of property names.
  15058. */
  15059. function baseKeysIn(object) {
  15060. if (!isObject(object)) {
  15061. return nativeKeysIn(object);
  15062. }
  15063. var isProto = isPrototype(object),
  15064. result = [];
  15065. for (var key in object) {
  15066. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  15067. result.push(key);
  15068. }
  15069. }
  15070. return result;
  15071. }
  15072. /**
  15073. * The base implementation of `_.lt` which doesn't coerce arguments.
  15074. *
  15075. * @private
  15076. * @param {*} value The value to compare.
  15077. * @param {*} other The other value to compare.
  15078. * @returns {boolean} Returns `true` if `value` is less than `other`,
  15079. * else `false`.
  15080. */
  15081. function baseLt(value, other) {
  15082. return value < other;
  15083. }
  15084. /**
  15085. * The base implementation of `_.map` without support for iteratee shorthands.
  15086. *
  15087. * @private
  15088. * @param {Array|Object} collection The collection to iterate over.
  15089. * @param {Function} iteratee The function invoked per iteration.
  15090. * @returns {Array} Returns the new mapped array.
  15091. */
  15092. function baseMap(collection, iteratee) {
  15093. var index = -1,
  15094. result = isArrayLike(collection) ? Array(collection.length) : [];
  15095. baseEach(collection, function(value, key, collection) {
  15096. result[++index] = iteratee(value, key, collection);
  15097. });
  15098. return result;
  15099. }
  15100. /**
  15101. * The base implementation of `_.matches` which doesn't clone `source`.
  15102. *
  15103. * @private
  15104. * @param {Object} source The object of property values to match.
  15105. * @returns {Function} Returns the new spec function.
  15106. */
  15107. function baseMatches(source) {
  15108. var matchData = getMatchData(source);
  15109. if (matchData.length == 1 && matchData[0][2]) {
  15110. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  15111. }
  15112. return function(object) {
  15113. return object === source || baseIsMatch(object, source, matchData);
  15114. };
  15115. }
  15116. /**
  15117. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  15118. *
  15119. * @private
  15120. * @param {string} path The path of the property to get.
  15121. * @param {*} srcValue The value to match.
  15122. * @returns {Function} Returns the new spec function.
  15123. */
  15124. function baseMatchesProperty(path, srcValue) {
  15125. if (isKey(path) && isStrictComparable(srcValue)) {
  15126. return matchesStrictComparable(toKey(path), srcValue);
  15127. }
  15128. return function(object) {
  15129. var objValue = get(object, path);
  15130. return (objValue === undefined && objValue === srcValue)
  15131. ? hasIn(object, path)
  15132. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  15133. };
  15134. }
  15135. /**
  15136. * The base implementation of `_.merge` without support for multiple sources.
  15137. *
  15138. * @private
  15139. * @param {Object} object The destination object.
  15140. * @param {Object} source The source object.
  15141. * @param {number} srcIndex The index of `source`.
  15142. * @param {Function} [customizer] The function to customize merged values.
  15143. * @param {Object} [stack] Tracks traversed source values and their merged
  15144. * counterparts.
  15145. */
  15146. function baseMerge(object, source, srcIndex, customizer, stack) {
  15147. if (object === source) {
  15148. return;
  15149. }
  15150. baseFor(source, function(srcValue, key) {
  15151. if (isObject(srcValue)) {
  15152. stack || (stack = new Stack);
  15153. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  15154. }
  15155. else {
  15156. var newValue = customizer
  15157. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  15158. : undefined;
  15159. if (newValue === undefined) {
  15160. newValue = srcValue;
  15161. }
  15162. assignMergeValue(object, key, newValue);
  15163. }
  15164. }, keysIn);
  15165. }
  15166. /**
  15167. * A specialized version of `baseMerge` for arrays and objects which performs
  15168. * deep merges and tracks traversed objects enabling objects with circular
  15169. * references to be merged.
  15170. *
  15171. * @private
  15172. * @param {Object} object The destination object.
  15173. * @param {Object} source The source object.
  15174. * @param {string} key The key of the value to merge.
  15175. * @param {number} srcIndex The index of `source`.
  15176. * @param {Function} mergeFunc The function to merge values.
  15177. * @param {Function} [customizer] The function to customize assigned values.
  15178. * @param {Object} [stack] Tracks traversed source values and their merged
  15179. * counterparts.
  15180. */
  15181. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  15182. var objValue = safeGet(object, key),
  15183. srcValue = safeGet(source, key),
  15184. stacked = stack.get(srcValue);
  15185. if (stacked) {
  15186. assignMergeValue(object, key, stacked);
  15187. return;
  15188. }
  15189. var newValue = customizer
  15190. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  15191. : undefined;
  15192. var isCommon = newValue === undefined;
  15193. if (isCommon) {
  15194. var isArr = isArray(srcValue),
  15195. isBuff = !isArr && isBuffer(srcValue),
  15196. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  15197. newValue = srcValue;
  15198. if (isArr || isBuff || isTyped) {
  15199. if (isArray(objValue)) {
  15200. newValue = objValue;
  15201. }
  15202. else if (isArrayLikeObject(objValue)) {
  15203. newValue = copyArray(objValue);
  15204. }
  15205. else if (isBuff) {
  15206. isCommon = false;
  15207. newValue = cloneBuffer(srcValue, true);
  15208. }
  15209. else if (isTyped) {
  15210. isCommon = false;
  15211. newValue = cloneTypedArray(srcValue, true);
  15212. }
  15213. else {
  15214. newValue = [];
  15215. }
  15216. }
  15217. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  15218. newValue = objValue;
  15219. if (isArguments(objValue)) {
  15220. newValue = toPlainObject(objValue);
  15221. }
  15222. else if (!isObject(objValue) || isFunction(objValue)) {
  15223. newValue = initCloneObject(srcValue);
  15224. }
  15225. }
  15226. else {
  15227. isCommon = false;
  15228. }
  15229. }
  15230. if (isCommon) {
  15231. // Recursively merge objects and arrays (susceptible to call stack limits).
  15232. stack.set(srcValue, newValue);
  15233. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  15234. stack['delete'](srcValue);
  15235. }
  15236. assignMergeValue(object, key, newValue);
  15237. }
  15238. /**
  15239. * The base implementation of `_.nth` which doesn't coerce arguments.
  15240. *
  15241. * @private
  15242. * @param {Array} array The array to query.
  15243. * @param {number} n The index of the element to return.
  15244. * @returns {*} Returns the nth element of `array`.
  15245. */
  15246. function baseNth(array, n) {
  15247. var length = array.length;
  15248. if (!length) {
  15249. return;
  15250. }
  15251. n += n < 0 ? length : 0;
  15252. return isIndex(n, length) ? array[n] : undefined;
  15253. }
  15254. /**
  15255. * The base implementation of `_.orderBy` without param guards.
  15256. *
  15257. * @private
  15258. * @param {Array|Object} collection The collection to iterate over.
  15259. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  15260. * @param {string[]} orders The sort orders of `iteratees`.
  15261. * @returns {Array} Returns the new sorted array.
  15262. */
  15263. function baseOrderBy(collection, iteratees, orders) {
  15264. var index = -1;
  15265. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  15266. var result = baseMap(collection, function(value, key, collection) {
  15267. var criteria = arrayMap(iteratees, function(iteratee) {
  15268. return iteratee(value);
  15269. });
  15270. return { 'criteria': criteria, 'index': ++index, 'value': value };
  15271. });
  15272. return baseSortBy(result, function(object, other) {
  15273. return compareMultiple(object, other, orders);
  15274. });
  15275. }
  15276. /**
  15277. * The base implementation of `_.pick` without support for individual
  15278. * property identifiers.
  15279. *
  15280. * @private
  15281. * @param {Object} object The source object.
  15282. * @param {string[]} paths The property paths to pick.
  15283. * @returns {Object} Returns the new object.
  15284. */
  15285. function basePick(object, paths) {
  15286. return basePickBy(object, paths, function(value, path) {
  15287. return hasIn(object, path);
  15288. });
  15289. }
  15290. /**
  15291. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  15292. *
  15293. * @private
  15294. * @param {Object} object The source object.
  15295. * @param {string[]} paths The property paths to pick.
  15296. * @param {Function} predicate The function invoked per property.
  15297. * @returns {Object} Returns the new object.
  15298. */
  15299. function basePickBy(object, paths, predicate) {
  15300. var index = -1,
  15301. length = paths.length,
  15302. result = {};
  15303. while (++index < length) {
  15304. var path = paths[index],
  15305. value = baseGet(object, path);
  15306. if (predicate(value, path)) {
  15307. baseSet(result, castPath(path, object), value);
  15308. }
  15309. }
  15310. return result;
  15311. }
  15312. /**
  15313. * A specialized version of `baseProperty` which supports deep paths.
  15314. *
  15315. * @private
  15316. * @param {Array|string} path The path of the property to get.
  15317. * @returns {Function} Returns the new accessor function.
  15318. */
  15319. function basePropertyDeep(path) {
  15320. return function(object) {
  15321. return baseGet(object, path);
  15322. };
  15323. }
  15324. /**
  15325. * The base implementation of `_.pullAllBy` without support for iteratee
  15326. * shorthands.
  15327. *
  15328. * @private
  15329. * @param {Array} array The array to modify.
  15330. * @param {Array} values The values to remove.
  15331. * @param {Function} [iteratee] The iteratee invoked per element.
  15332. * @param {Function} [comparator] The comparator invoked per element.
  15333. * @returns {Array} Returns `array`.
  15334. */
  15335. function basePullAll(array, values, iteratee, comparator) {
  15336. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  15337. index = -1,
  15338. length = values.length,
  15339. seen = array;
  15340. if (array === values) {
  15341. values = copyArray(values);
  15342. }
  15343. if (iteratee) {
  15344. seen = arrayMap(array, baseUnary(iteratee));
  15345. }
  15346. while (++index < length) {
  15347. var fromIndex = 0,
  15348. value = values[index],
  15349. computed = iteratee ? iteratee(value) : value;
  15350. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  15351. if (seen !== array) {
  15352. splice.call(seen, fromIndex, 1);
  15353. }
  15354. splice.call(array, fromIndex, 1);
  15355. }
  15356. }
  15357. return array;
  15358. }
  15359. /**
  15360. * The base implementation of `_.pullAt` without support for individual
  15361. * indexes or capturing the removed elements.
  15362. *
  15363. * @private
  15364. * @param {Array} array The array to modify.
  15365. * @param {number[]} indexes The indexes of elements to remove.
  15366. * @returns {Array} Returns `array`.
  15367. */
  15368. function basePullAt(array, indexes) {
  15369. var length = array ? indexes.length : 0,
  15370. lastIndex = length - 1;
  15371. while (length--) {
  15372. var index = indexes[length];
  15373. if (length == lastIndex || index !== previous) {
  15374. var previous = index;
  15375. if (isIndex(index)) {
  15376. splice.call(array, index, 1);
  15377. } else {
  15378. baseUnset(array, index);
  15379. }
  15380. }
  15381. }
  15382. return array;
  15383. }
  15384. /**
  15385. * The base implementation of `_.random` without support for returning
  15386. * floating-point numbers.
  15387. *
  15388. * @private
  15389. * @param {number} lower The lower bound.
  15390. * @param {number} upper The upper bound.
  15391. * @returns {number} Returns the random number.
  15392. */
  15393. function baseRandom(lower, upper) {
  15394. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  15395. }
  15396. /**
  15397. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  15398. * coerce arguments.
  15399. *
  15400. * @private
  15401. * @param {number} start The start of the range.
  15402. * @param {number} end The end of the range.
  15403. * @param {number} step The value to increment or decrement by.
  15404. * @param {boolean} [fromRight] Specify iterating from right to left.
  15405. * @returns {Array} Returns the range of numbers.
  15406. */
  15407. function baseRange(start, end, step, fromRight) {
  15408. var index = -1,
  15409. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  15410. result = Array(length);
  15411. while (length--) {
  15412. result[fromRight ? length : ++index] = start;
  15413. start += step;
  15414. }
  15415. return result;
  15416. }
  15417. /**
  15418. * The base implementation of `_.repeat` which doesn't coerce arguments.
  15419. *
  15420. * @private
  15421. * @param {string} string The string to repeat.
  15422. * @param {number} n The number of times to repeat the string.
  15423. * @returns {string} Returns the repeated string.
  15424. */
  15425. function baseRepeat(string, n) {
  15426. var result = '';
  15427. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  15428. return result;
  15429. }
  15430. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  15431. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  15432. do {
  15433. if (n % 2) {
  15434. result += string;
  15435. }
  15436. n = nativeFloor(n / 2);
  15437. if (n) {
  15438. string += string;
  15439. }
  15440. } while (n);
  15441. return result;
  15442. }
  15443. /**
  15444. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  15445. *
  15446. * @private
  15447. * @param {Function} func The function to apply a rest parameter to.
  15448. * @param {number} [start=func.length-1] The start position of the rest parameter.
  15449. * @returns {Function} Returns the new function.
  15450. */
  15451. function baseRest(func, start) {
  15452. return setToString(overRest(func, start, identity), func + '');
  15453. }
  15454. /**
  15455. * The base implementation of `_.sample`.
  15456. *
  15457. * @private
  15458. * @param {Array|Object} collection The collection to sample.
  15459. * @returns {*} Returns the random element.
  15460. */
  15461. function baseSample(collection) {
  15462. return arraySample(values(collection));
  15463. }
  15464. /**
  15465. * The base implementation of `_.sampleSize` without param guards.
  15466. *
  15467. * @private
  15468. * @param {Array|Object} collection The collection to sample.
  15469. * @param {number} n The number of elements to sample.
  15470. * @returns {Array} Returns the random elements.
  15471. */
  15472. function baseSampleSize(collection, n) {
  15473. var array = values(collection);
  15474. return shuffleSelf(array, baseClamp(n, 0, array.length));
  15475. }
  15476. /**
  15477. * The base implementation of `_.set`.
  15478. *
  15479. * @private
  15480. * @param {Object} object The object to modify.
  15481. * @param {Array|string} path The path of the property to set.
  15482. * @param {*} value The value to set.
  15483. * @param {Function} [customizer] The function to customize path creation.
  15484. * @returns {Object} Returns `object`.
  15485. */
  15486. function baseSet(object, path, value, customizer) {
  15487. if (!isObject(object)) {
  15488. return object;
  15489. }
  15490. path = castPath(path, object);
  15491. var index = -1,
  15492. length = path.length,
  15493. lastIndex = length - 1,
  15494. nested = object;
  15495. while (nested != null && ++index < length) {
  15496. var key = toKey(path[index]),
  15497. newValue = value;
  15498. if (index != lastIndex) {
  15499. var objValue = nested[key];
  15500. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  15501. if (newValue === undefined) {
  15502. newValue = isObject(objValue)
  15503. ? objValue
  15504. : (isIndex(path[index + 1]) ? [] : {});
  15505. }
  15506. }
  15507. assignValue(nested, key, newValue);
  15508. nested = nested[key];
  15509. }
  15510. return object;
  15511. }
  15512. /**
  15513. * The base implementation of `setData` without support for hot loop shorting.
  15514. *
  15515. * @private
  15516. * @param {Function} func The function to associate metadata with.
  15517. * @param {*} data The metadata.
  15518. * @returns {Function} Returns `func`.
  15519. */
  15520. var baseSetData = !metaMap ? identity : function(func, data) {
  15521. metaMap.set(func, data);
  15522. return func;
  15523. };
  15524. /**
  15525. * The base implementation of `setToString` without support for hot loop shorting.
  15526. *
  15527. * @private
  15528. * @param {Function} func The function to modify.
  15529. * @param {Function} string The `toString` result.
  15530. * @returns {Function} Returns `func`.
  15531. */
  15532. var baseSetToString = !defineProperty ? identity : function(func, string) {
  15533. return defineProperty(func, 'toString', {
  15534. 'configurable': true,
  15535. 'enumerable': false,
  15536. 'value': constant(string),
  15537. 'writable': true
  15538. });
  15539. };
  15540. /**
  15541. * The base implementation of `_.shuffle`.
  15542. *
  15543. * @private
  15544. * @param {Array|Object} collection The collection to shuffle.
  15545. * @returns {Array} Returns the new shuffled array.
  15546. */
  15547. function baseShuffle(collection) {
  15548. return shuffleSelf(values(collection));
  15549. }
  15550. /**
  15551. * The base implementation of `_.slice` without an iteratee call guard.
  15552. *
  15553. * @private
  15554. * @param {Array} array The array to slice.
  15555. * @param {number} [start=0] The start position.
  15556. * @param {number} [end=array.length] The end position.
  15557. * @returns {Array} Returns the slice of `array`.
  15558. */
  15559. function baseSlice(array, start, end) {
  15560. var index = -1,
  15561. length = array.length;
  15562. if (start < 0) {
  15563. start = -start > length ? 0 : (length + start);
  15564. }
  15565. end = end > length ? length : end;
  15566. if (end < 0) {
  15567. end += length;
  15568. }
  15569. length = start > end ? 0 : ((end - start) >>> 0);
  15570. start >>>= 0;
  15571. var result = Array(length);
  15572. while (++index < length) {
  15573. result[index] = array[index + start];
  15574. }
  15575. return result;
  15576. }
  15577. /**
  15578. * The base implementation of `_.some` without support for iteratee shorthands.
  15579. *
  15580. * @private
  15581. * @param {Array|Object} collection The collection to iterate over.
  15582. * @param {Function} predicate The function invoked per iteration.
  15583. * @returns {boolean} Returns `true` if any element passes the predicate check,
  15584. * else `false`.
  15585. */
  15586. function baseSome(collection, predicate) {
  15587. var result;
  15588. baseEach(collection, function(value, index, collection) {
  15589. result = predicate(value, index, collection);
  15590. return !result;
  15591. });
  15592. return !!result;
  15593. }
  15594. /**
  15595. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  15596. * performs a binary search of `array` to determine the index at which `value`
  15597. * should be inserted into `array` in order to maintain its sort order.
  15598. *
  15599. * @private
  15600. * @param {Array} array The sorted array to inspect.
  15601. * @param {*} value The value to evaluate.
  15602. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  15603. * @returns {number} Returns the index at which `value` should be inserted
  15604. * into `array`.
  15605. */
  15606. function baseSortedIndex(array, value, retHighest) {
  15607. var low = 0,
  15608. high = array == null ? low : array.length;
  15609. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  15610. while (low < high) {
  15611. var mid = (low + high) >>> 1,
  15612. computed = array[mid];
  15613. if (computed !== null && !isSymbol(computed) &&
  15614. (retHighest ? (computed <= value) : (computed < value))) {
  15615. low = mid + 1;
  15616. } else {
  15617. high = mid;
  15618. }
  15619. }
  15620. return high;
  15621. }
  15622. return baseSortedIndexBy(array, value, identity, retHighest);
  15623. }
  15624. /**
  15625. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  15626. * which invokes `iteratee` for `value` and each element of `array` to compute
  15627. * their sort ranking. The iteratee is invoked with one argument; (value).
  15628. *
  15629. * @private
  15630. * @param {Array} array The sorted array to inspect.
  15631. * @param {*} value The value to evaluate.
  15632. * @param {Function} iteratee The iteratee invoked per element.
  15633. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  15634. * @returns {number} Returns the index at which `value` should be inserted
  15635. * into `array`.
  15636. */
  15637. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  15638. value = iteratee(value);
  15639. var low = 0,
  15640. high = array == null ? 0 : array.length,
  15641. valIsNaN = value !== value,
  15642. valIsNull = value === null,
  15643. valIsSymbol = isSymbol(value),
  15644. valIsUndefined = value === undefined;
  15645. while (low < high) {
  15646. var mid = nativeFloor((low + high) / 2),
  15647. computed = iteratee(array[mid]),
  15648. othIsDefined = computed !== undefined,
  15649. othIsNull = computed === null,
  15650. othIsReflexive = computed === computed,
  15651. othIsSymbol = isSymbol(computed);
  15652. if (valIsNaN) {
  15653. var setLow = retHighest || othIsReflexive;
  15654. } else if (valIsUndefined) {
  15655. setLow = othIsReflexive && (retHighest || othIsDefined);
  15656. } else if (valIsNull) {
  15657. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  15658. } else if (valIsSymbol) {
  15659. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  15660. } else if (othIsNull || othIsSymbol) {
  15661. setLow = false;
  15662. } else {
  15663. setLow = retHighest ? (computed <= value) : (computed < value);
  15664. }
  15665. if (setLow) {
  15666. low = mid + 1;
  15667. } else {
  15668. high = mid;
  15669. }
  15670. }
  15671. return nativeMin(high, MAX_ARRAY_INDEX);
  15672. }
  15673. /**
  15674. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  15675. * support for iteratee shorthands.
  15676. *
  15677. * @private
  15678. * @param {Array} array The array to inspect.
  15679. * @param {Function} [iteratee] The iteratee invoked per element.
  15680. * @returns {Array} Returns the new duplicate free array.
  15681. */
  15682. function baseSortedUniq(array, iteratee) {
  15683. var index = -1,
  15684. length = array.length,
  15685. resIndex = 0,
  15686. result = [];
  15687. while (++index < length) {
  15688. var value = array[index],
  15689. computed = iteratee ? iteratee(value) : value;
  15690. if (!index || !eq(computed, seen)) {
  15691. var seen = computed;
  15692. result[resIndex++] = value === 0 ? 0 : value;
  15693. }
  15694. }
  15695. return result;
  15696. }
  15697. /**
  15698. * The base implementation of `_.toNumber` which doesn't ensure correct
  15699. * conversions of binary, hexadecimal, or octal string values.
  15700. *
  15701. * @private
  15702. * @param {*} value The value to process.
  15703. * @returns {number} Returns the number.
  15704. */
  15705. function baseToNumber(value) {
  15706. if (typeof value == 'number') {
  15707. return value;
  15708. }
  15709. if (isSymbol(value)) {
  15710. return NAN;
  15711. }
  15712. return +value;
  15713. }
  15714. /**
  15715. * The base implementation of `_.toString` which doesn't convert nullish
  15716. * values to empty strings.
  15717. *
  15718. * @private
  15719. * @param {*} value The value to process.
  15720. * @returns {string} Returns the string.
  15721. */
  15722. function baseToString(value) {
  15723. // Exit early for strings to avoid a performance hit in some environments.
  15724. if (typeof value == 'string') {
  15725. return value;
  15726. }
  15727. if (isArray(value)) {
  15728. // Recursively convert values (susceptible to call stack limits).
  15729. return arrayMap(value, baseToString) + '';
  15730. }
  15731. if (isSymbol(value)) {
  15732. return symbolToString ? symbolToString.call(value) : '';
  15733. }
  15734. var result = (value + '');
  15735. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  15736. }
  15737. /**
  15738. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  15739. *
  15740. * @private
  15741. * @param {Array} array The array to inspect.
  15742. * @param {Function} [iteratee] The iteratee invoked per element.
  15743. * @param {Function} [comparator] The comparator invoked per element.
  15744. * @returns {Array} Returns the new duplicate free array.
  15745. */
  15746. function baseUniq(array, iteratee, comparator) {
  15747. var index = -1,
  15748. includes = arrayIncludes,
  15749. length = array.length,
  15750. isCommon = true,
  15751. result = [],
  15752. seen = result;
  15753. if (comparator) {
  15754. isCommon = false;
  15755. includes = arrayIncludesWith;
  15756. }
  15757. else if (length >= LARGE_ARRAY_SIZE) {
  15758. var set = iteratee ? null : createSet(array);
  15759. if (set) {
  15760. return setToArray(set);
  15761. }
  15762. isCommon = false;
  15763. includes = cacheHas;
  15764. seen = new SetCache;
  15765. }
  15766. else {
  15767. seen = iteratee ? [] : result;
  15768. }
  15769. outer:
  15770. while (++index < length) {
  15771. var value = array[index],
  15772. computed = iteratee ? iteratee(value) : value;
  15773. value = (comparator || value !== 0) ? value : 0;
  15774. if (isCommon && computed === computed) {
  15775. var seenIndex = seen.length;
  15776. while (seenIndex--) {
  15777. if (seen[seenIndex] === computed) {
  15778. continue outer;
  15779. }
  15780. }
  15781. if (iteratee) {
  15782. seen.push(computed);
  15783. }
  15784. result.push(value);
  15785. }
  15786. else if (!includes(seen, computed, comparator)) {
  15787. if (seen !== result) {
  15788. seen.push(computed);
  15789. }
  15790. result.push(value);
  15791. }
  15792. }
  15793. return result;
  15794. }
  15795. /**
  15796. * The base implementation of `_.unset`.
  15797. *
  15798. * @private
  15799. * @param {Object} object The object to modify.
  15800. * @param {Array|string} path The property path to unset.
  15801. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  15802. */
  15803. function baseUnset(object, path) {
  15804. path = castPath(path, object);
  15805. object = parent(object, path);
  15806. return object == null || delete object[toKey(last(path))];
  15807. }
  15808. /**
  15809. * The base implementation of `_.update`.
  15810. *
  15811. * @private
  15812. * @param {Object} object The object to modify.
  15813. * @param {Array|string} path The path of the property to update.
  15814. * @param {Function} updater The function to produce the updated value.
  15815. * @param {Function} [customizer] The function to customize path creation.
  15816. * @returns {Object} Returns `object`.
  15817. */
  15818. function baseUpdate(object, path, updater, customizer) {
  15819. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  15820. }
  15821. /**
  15822. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  15823. * without support for iteratee shorthands.
  15824. *
  15825. * @private
  15826. * @param {Array} array The array to query.
  15827. * @param {Function} predicate The function invoked per iteration.
  15828. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  15829. * @param {boolean} [fromRight] Specify iterating from right to left.
  15830. * @returns {Array} Returns the slice of `array`.
  15831. */
  15832. function baseWhile(array, predicate, isDrop, fromRight) {
  15833. var length = array.length,
  15834. index = fromRight ? length : -1;
  15835. while ((fromRight ? index-- : ++index < length) &&
  15836. predicate(array[index], index, array)) {}
  15837. return isDrop
  15838. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  15839. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  15840. }
  15841. /**
  15842. * The base implementation of `wrapperValue` which returns the result of
  15843. * performing a sequence of actions on the unwrapped `value`, where each
  15844. * successive action is supplied the return value of the previous.
  15845. *
  15846. * @private
  15847. * @param {*} value The unwrapped value.
  15848. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  15849. * @returns {*} Returns the resolved value.
  15850. */
  15851. function baseWrapperValue(value, actions) {
  15852. var result = value;
  15853. if (result instanceof LazyWrapper) {
  15854. result = result.value();
  15855. }
  15856. return arrayReduce(actions, function(result, action) {
  15857. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  15858. }, result);
  15859. }
  15860. /**
  15861. * The base implementation of methods like `_.xor`, without support for
  15862. * iteratee shorthands, that accepts an array of arrays to inspect.
  15863. *
  15864. * @private
  15865. * @param {Array} arrays The arrays to inspect.
  15866. * @param {Function} [iteratee] The iteratee invoked per element.
  15867. * @param {Function} [comparator] The comparator invoked per element.
  15868. * @returns {Array} Returns the new array of values.
  15869. */
  15870. function baseXor(arrays, iteratee, comparator) {
  15871. var length = arrays.length;
  15872. if (length < 2) {
  15873. return length ? baseUniq(arrays[0]) : [];
  15874. }
  15875. var index = -1,
  15876. result = Array(length);
  15877. while (++index < length) {
  15878. var array = arrays[index],
  15879. othIndex = -1;
  15880. while (++othIndex < length) {
  15881. if (othIndex != index) {
  15882. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  15883. }
  15884. }
  15885. }
  15886. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  15887. }
  15888. /**
  15889. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  15890. *
  15891. * @private
  15892. * @param {Array} props The property identifiers.
  15893. * @param {Array} values The property values.
  15894. * @param {Function} assignFunc The function to assign values.
  15895. * @returns {Object} Returns the new object.
  15896. */
  15897. function baseZipObject(props, values, assignFunc) {
  15898. var index = -1,
  15899. length = props.length,
  15900. valsLength = values.length,
  15901. result = {};
  15902. while (++index < length) {
  15903. var value = index < valsLength ? values[index] : undefined;
  15904. assignFunc(result, props[index], value);
  15905. }
  15906. return result;
  15907. }
  15908. /**
  15909. * Casts `value` to an empty array if it's not an array like object.
  15910. *
  15911. * @private
  15912. * @param {*} value The value to inspect.
  15913. * @returns {Array|Object} Returns the cast array-like object.
  15914. */
  15915. function castArrayLikeObject(value) {
  15916. return isArrayLikeObject(value) ? value : [];
  15917. }
  15918. /**
  15919. * Casts `value` to `identity` if it's not a function.
  15920. *
  15921. * @private
  15922. * @param {*} value The value to inspect.
  15923. * @returns {Function} Returns cast function.
  15924. */
  15925. function castFunction(value) {
  15926. return typeof value == 'function' ? value : identity;
  15927. }
  15928. /**
  15929. * Casts `value` to a path array if it's not one.
  15930. *
  15931. * @private
  15932. * @param {*} value The value to inspect.
  15933. * @param {Object} [object] The object to query keys on.
  15934. * @returns {Array} Returns the cast property path array.
  15935. */
  15936. function castPath(value, object) {
  15937. if (isArray(value)) {
  15938. return value;
  15939. }
  15940. return isKey(value, object) ? [value] : stringToPath(toString(value));
  15941. }
  15942. /**
  15943. * A `baseRest` alias which can be replaced with `identity` by module
  15944. * replacement plugins.
  15945. *
  15946. * @private
  15947. * @type {Function}
  15948. * @param {Function} func The function to apply a rest parameter to.
  15949. * @returns {Function} Returns the new function.
  15950. */
  15951. var castRest = baseRest;
  15952. /**
  15953. * Casts `array` to a slice if it's needed.
  15954. *
  15955. * @private
  15956. * @param {Array} array The array to inspect.
  15957. * @param {number} start The start position.
  15958. * @param {number} [end=array.length] The end position.
  15959. * @returns {Array} Returns the cast slice.
  15960. */
  15961. function castSlice(array, start, end) {
  15962. var length = array.length;
  15963. end = end === undefined ? length : end;
  15964. return (!start && end >= length) ? array : baseSlice(array, start, end);
  15965. }
  15966. /**
  15967. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  15968. *
  15969. * @private
  15970. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  15971. */
  15972. var clearTimeout = ctxClearTimeout || function(id) {
  15973. return root.clearTimeout(id);
  15974. };
  15975. /**
  15976. * Creates a clone of `buffer`.
  15977. *
  15978. * @private
  15979. * @param {Buffer} buffer The buffer to clone.
  15980. * @param {boolean} [isDeep] Specify a deep clone.
  15981. * @returns {Buffer} Returns the cloned buffer.
  15982. */
  15983. function cloneBuffer(buffer, isDeep) {
  15984. if (isDeep) {
  15985. return buffer.slice();
  15986. }
  15987. var length = buffer.length,
  15988. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  15989. buffer.copy(result);
  15990. return result;
  15991. }
  15992. /**
  15993. * Creates a clone of `arrayBuffer`.
  15994. *
  15995. * @private
  15996. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  15997. * @returns {ArrayBuffer} Returns the cloned array buffer.
  15998. */
  15999. function cloneArrayBuffer(arrayBuffer) {
  16000. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  16001. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  16002. return result;
  16003. }
  16004. /**
  16005. * Creates a clone of `dataView`.
  16006. *
  16007. * @private
  16008. * @param {Object} dataView The data view to clone.
  16009. * @param {boolean} [isDeep] Specify a deep clone.
  16010. * @returns {Object} Returns the cloned data view.
  16011. */
  16012. function cloneDataView(dataView, isDeep) {
  16013. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  16014. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  16015. }
  16016. /**
  16017. * Creates a clone of `regexp`.
  16018. *
  16019. * @private
  16020. * @param {Object} regexp The regexp to clone.
  16021. * @returns {Object} Returns the cloned regexp.
  16022. */
  16023. function cloneRegExp(regexp) {
  16024. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  16025. result.lastIndex = regexp.lastIndex;
  16026. return result;
  16027. }
  16028. /**
  16029. * Creates a clone of the `symbol` object.
  16030. *
  16031. * @private
  16032. * @param {Object} symbol The symbol object to clone.
  16033. * @returns {Object} Returns the cloned symbol object.
  16034. */
  16035. function cloneSymbol(symbol) {
  16036. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  16037. }
  16038. /**
  16039. * Creates a clone of `typedArray`.
  16040. *
  16041. * @private
  16042. * @param {Object} typedArray The typed array to clone.
  16043. * @param {boolean} [isDeep] Specify a deep clone.
  16044. * @returns {Object} Returns the cloned typed array.
  16045. */
  16046. function cloneTypedArray(typedArray, isDeep) {
  16047. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  16048. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  16049. }
  16050. /**
  16051. * Compares values to sort them in ascending order.
  16052. *
  16053. * @private
  16054. * @param {*} value The value to compare.
  16055. * @param {*} other The other value to compare.
  16056. * @returns {number} Returns the sort order indicator for `value`.
  16057. */
  16058. function compareAscending(value, other) {
  16059. if (value !== other) {
  16060. var valIsDefined = value !== undefined,
  16061. valIsNull = value === null,
  16062. valIsReflexive = value === value,
  16063. valIsSymbol = isSymbol(value);
  16064. var othIsDefined = other !== undefined,
  16065. othIsNull = other === null,
  16066. othIsReflexive = other === other,
  16067. othIsSymbol = isSymbol(other);
  16068. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  16069. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  16070. (valIsNull && othIsDefined && othIsReflexive) ||
  16071. (!valIsDefined && othIsReflexive) ||
  16072. !valIsReflexive) {
  16073. return 1;
  16074. }
  16075. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  16076. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  16077. (othIsNull && valIsDefined && valIsReflexive) ||
  16078. (!othIsDefined && valIsReflexive) ||
  16079. !othIsReflexive) {
  16080. return -1;
  16081. }
  16082. }
  16083. return 0;
  16084. }
  16085. /**
  16086. * Used by `_.orderBy` to compare multiple properties of a value to another
  16087. * and stable sort them.
  16088. *
  16089. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  16090. * specify an order of "desc" for descending or "asc" for ascending sort order
  16091. * of corresponding values.
  16092. *
  16093. * @private
  16094. * @param {Object} object The object to compare.
  16095. * @param {Object} other The other object to compare.
  16096. * @param {boolean[]|string[]} orders The order to sort by for each property.
  16097. * @returns {number} Returns the sort order indicator for `object`.
  16098. */
  16099. function compareMultiple(object, other, orders) {
  16100. var index = -1,
  16101. objCriteria = object.criteria,
  16102. othCriteria = other.criteria,
  16103. length = objCriteria.length,
  16104. ordersLength = orders.length;
  16105. while (++index < length) {
  16106. var result = compareAscending(objCriteria[index], othCriteria[index]);
  16107. if (result) {
  16108. if (index >= ordersLength) {
  16109. return result;
  16110. }
  16111. var order = orders[index];
  16112. return result * (order == 'desc' ? -1 : 1);
  16113. }
  16114. }
  16115. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  16116. // that causes it, under certain circumstances, to provide the same value for
  16117. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  16118. // for more details.
  16119. //
  16120. // This also ensures a stable sort in V8 and other engines.
  16121. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  16122. return object.index - other.index;
  16123. }
  16124. /**
  16125. * Creates an array that is the composition of partially applied arguments,
  16126. * placeholders, and provided arguments into a single array of arguments.
  16127. *
  16128. * @private
  16129. * @param {Array} args The provided arguments.
  16130. * @param {Array} partials The arguments to prepend to those provided.
  16131. * @param {Array} holders The `partials` placeholder indexes.
  16132. * @params {boolean} [isCurried] Specify composing for a curried function.
  16133. * @returns {Array} Returns the new array of composed arguments.
  16134. */
  16135. function composeArgs(args, partials, holders, isCurried) {
  16136. var argsIndex = -1,
  16137. argsLength = args.length,
  16138. holdersLength = holders.length,
  16139. leftIndex = -1,
  16140. leftLength = partials.length,
  16141. rangeLength = nativeMax(argsLength - holdersLength, 0),
  16142. result = Array(leftLength + rangeLength),
  16143. isUncurried = !isCurried;
  16144. while (++leftIndex < leftLength) {
  16145. result[leftIndex] = partials[leftIndex];
  16146. }
  16147. while (++argsIndex < holdersLength) {
  16148. if (isUncurried || argsIndex < argsLength) {
  16149. result[holders[argsIndex]] = args[argsIndex];
  16150. }
  16151. }
  16152. while (rangeLength--) {
  16153. result[leftIndex++] = args[argsIndex++];
  16154. }
  16155. return result;
  16156. }
  16157. /**
  16158. * This function is like `composeArgs` except that the arguments composition
  16159. * is tailored for `_.partialRight`.
  16160. *
  16161. * @private
  16162. * @param {Array} args The provided arguments.
  16163. * @param {Array} partials The arguments to append to those provided.
  16164. * @param {Array} holders The `partials` placeholder indexes.
  16165. * @params {boolean} [isCurried] Specify composing for a curried function.
  16166. * @returns {Array} Returns the new array of composed arguments.
  16167. */
  16168. function composeArgsRight(args, partials, holders, isCurried) {
  16169. var argsIndex = -1,
  16170. argsLength = args.length,
  16171. holdersIndex = -1,
  16172. holdersLength = holders.length,
  16173. rightIndex = -1,
  16174. rightLength = partials.length,
  16175. rangeLength = nativeMax(argsLength - holdersLength, 0),
  16176. result = Array(rangeLength + rightLength),
  16177. isUncurried = !isCurried;
  16178. while (++argsIndex < rangeLength) {
  16179. result[argsIndex] = args[argsIndex];
  16180. }
  16181. var offset = argsIndex;
  16182. while (++rightIndex < rightLength) {
  16183. result[offset + rightIndex] = partials[rightIndex];
  16184. }
  16185. while (++holdersIndex < holdersLength) {
  16186. if (isUncurried || argsIndex < argsLength) {
  16187. result[offset + holders[holdersIndex]] = args[argsIndex++];
  16188. }
  16189. }
  16190. return result;
  16191. }
  16192. /**
  16193. * Copies the values of `source` to `array`.
  16194. *
  16195. * @private
  16196. * @param {Array} source The array to copy values from.
  16197. * @param {Array} [array=[]] The array to copy values to.
  16198. * @returns {Array} Returns `array`.
  16199. */
  16200. function copyArray(source, array) {
  16201. var index = -1,
  16202. length = source.length;
  16203. array || (array = Array(length));
  16204. while (++index < length) {
  16205. array[index] = source[index];
  16206. }
  16207. return array;
  16208. }
  16209. /**
  16210. * Copies properties of `source` to `object`.
  16211. *
  16212. * @private
  16213. * @param {Object} source The object to copy properties from.
  16214. * @param {Array} props The property identifiers to copy.
  16215. * @param {Object} [object={}] The object to copy properties to.
  16216. * @param {Function} [customizer] The function to customize copied values.
  16217. * @returns {Object} Returns `object`.
  16218. */
  16219. function copyObject(source, props, object, customizer) {
  16220. var isNew = !object;
  16221. object || (object = {});
  16222. var index = -1,
  16223. length = props.length;
  16224. while (++index < length) {
  16225. var key = props[index];
  16226. var newValue = customizer
  16227. ? customizer(object[key], source[key], key, object, source)
  16228. : undefined;
  16229. if (newValue === undefined) {
  16230. newValue = source[key];
  16231. }
  16232. if (isNew) {
  16233. baseAssignValue(object, key, newValue);
  16234. } else {
  16235. assignValue(object, key, newValue);
  16236. }
  16237. }
  16238. return object;
  16239. }
  16240. /**
  16241. * Copies own symbols of `source` to `object`.
  16242. *
  16243. * @private
  16244. * @param {Object} source The object to copy symbols from.
  16245. * @param {Object} [object={}] The object to copy symbols to.
  16246. * @returns {Object} Returns `object`.
  16247. */
  16248. function copySymbols(source, object) {
  16249. return copyObject(source, getSymbols(source), object);
  16250. }
  16251. /**
  16252. * Copies own and inherited symbols of `source` to `object`.
  16253. *
  16254. * @private
  16255. * @param {Object} source The object to copy symbols from.
  16256. * @param {Object} [object={}] The object to copy symbols to.
  16257. * @returns {Object} Returns `object`.
  16258. */
  16259. function copySymbolsIn(source, object) {
  16260. return copyObject(source, getSymbolsIn(source), object);
  16261. }
  16262. /**
  16263. * Creates a function like `_.groupBy`.
  16264. *
  16265. * @private
  16266. * @param {Function} setter The function to set accumulator values.
  16267. * @param {Function} [initializer] The accumulator object initializer.
  16268. * @returns {Function} Returns the new aggregator function.
  16269. */
  16270. function createAggregator(setter, initializer) {
  16271. return function(collection, iteratee) {
  16272. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  16273. accumulator = initializer ? initializer() : {};
  16274. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  16275. };
  16276. }
  16277. /**
  16278. * Creates a function like `_.assign`.
  16279. *
  16280. * @private
  16281. * @param {Function} assigner The function to assign values.
  16282. * @returns {Function} Returns the new assigner function.
  16283. */
  16284. function createAssigner(assigner) {
  16285. return baseRest(function(object, sources) {
  16286. var index = -1,
  16287. length = sources.length,
  16288. customizer = length > 1 ? sources[length - 1] : undefined,
  16289. guard = length > 2 ? sources[2] : undefined;
  16290. customizer = (assigner.length > 3 && typeof customizer == 'function')
  16291. ? (length--, customizer)
  16292. : undefined;
  16293. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  16294. customizer = length < 3 ? undefined : customizer;
  16295. length = 1;
  16296. }
  16297. object = Object(object);
  16298. while (++index < length) {
  16299. var source = sources[index];
  16300. if (source) {
  16301. assigner(object, source, index, customizer);
  16302. }
  16303. }
  16304. return object;
  16305. });
  16306. }
  16307. /**
  16308. * Creates a `baseEach` or `baseEachRight` function.
  16309. *
  16310. * @private
  16311. * @param {Function} eachFunc The function to iterate over a collection.
  16312. * @param {boolean} [fromRight] Specify iterating from right to left.
  16313. * @returns {Function} Returns the new base function.
  16314. */
  16315. function createBaseEach(eachFunc, fromRight) {
  16316. return function(collection, iteratee) {
  16317. if (collection == null) {
  16318. return collection;
  16319. }
  16320. if (!isArrayLike(collection)) {
  16321. return eachFunc(collection, iteratee);
  16322. }
  16323. var length = collection.length,
  16324. index = fromRight ? length : -1,
  16325. iterable = Object(collection);
  16326. while ((fromRight ? index-- : ++index < length)) {
  16327. if (iteratee(iterable[index], index, iterable) === false) {
  16328. break;
  16329. }
  16330. }
  16331. return collection;
  16332. };
  16333. }
  16334. /**
  16335. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  16336. *
  16337. * @private
  16338. * @param {boolean} [fromRight] Specify iterating from right to left.
  16339. * @returns {Function} Returns the new base function.
  16340. */
  16341. function createBaseFor(fromRight) {
  16342. return function(object, iteratee, keysFunc) {
  16343. var index = -1,
  16344. iterable = Object(object),
  16345. props = keysFunc(object),
  16346. length = props.length;
  16347. while (length--) {
  16348. var key = props[fromRight ? length : ++index];
  16349. if (iteratee(iterable[key], key, iterable) === false) {
  16350. break;
  16351. }
  16352. }
  16353. return object;
  16354. };
  16355. }
  16356. /**
  16357. * Creates a function that wraps `func` to invoke it with the optional `this`
  16358. * binding of `thisArg`.
  16359. *
  16360. * @private
  16361. * @param {Function} func The function to wrap.
  16362. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16363. * @param {*} [thisArg] The `this` binding of `func`.
  16364. * @returns {Function} Returns the new wrapped function.
  16365. */
  16366. function createBind(func, bitmask, thisArg) {
  16367. var isBind = bitmask & WRAP_BIND_FLAG,
  16368. Ctor = createCtor(func);
  16369. function wrapper() {
  16370. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  16371. return fn.apply(isBind ? thisArg : this, arguments);
  16372. }
  16373. return wrapper;
  16374. }
  16375. /**
  16376. * Creates a function like `_.lowerFirst`.
  16377. *
  16378. * @private
  16379. * @param {string} methodName The name of the `String` case method to use.
  16380. * @returns {Function} Returns the new case function.
  16381. */
  16382. function createCaseFirst(methodName) {
  16383. return function(string) {
  16384. string = toString(string);
  16385. var strSymbols = hasUnicode(string)
  16386. ? stringToArray(string)
  16387. : undefined;
  16388. var chr = strSymbols
  16389. ? strSymbols[0]
  16390. : string.charAt(0);
  16391. var trailing = strSymbols
  16392. ? castSlice(strSymbols, 1).join('')
  16393. : string.slice(1);
  16394. return chr[methodName]() + trailing;
  16395. };
  16396. }
  16397. /**
  16398. * Creates a function like `_.camelCase`.
  16399. *
  16400. * @private
  16401. * @param {Function} callback The function to combine each word.
  16402. * @returns {Function} Returns the new compounder function.
  16403. */
  16404. function createCompounder(callback) {
  16405. return function(string) {
  16406. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  16407. };
  16408. }
  16409. /**
  16410. * Creates a function that produces an instance of `Ctor` regardless of
  16411. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  16412. *
  16413. * @private
  16414. * @param {Function} Ctor The constructor to wrap.
  16415. * @returns {Function} Returns the new wrapped function.
  16416. */
  16417. function createCtor(Ctor) {
  16418. return function() {
  16419. // Use a `switch` statement to work with class constructors. See
  16420. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  16421. // for more details.
  16422. var args = arguments;
  16423. switch (args.length) {
  16424. case 0: return new Ctor;
  16425. case 1: return new Ctor(args[0]);
  16426. case 2: return new Ctor(args[0], args[1]);
  16427. case 3: return new Ctor(args[0], args[1], args[2]);
  16428. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  16429. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  16430. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  16431. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  16432. }
  16433. var thisBinding = baseCreate(Ctor.prototype),
  16434. result = Ctor.apply(thisBinding, args);
  16435. // Mimic the constructor's `return` behavior.
  16436. // See https://es5.github.io/#x13.2.2 for more details.
  16437. return isObject(result) ? result : thisBinding;
  16438. };
  16439. }
  16440. /**
  16441. * Creates a function that wraps `func` to enable currying.
  16442. *
  16443. * @private
  16444. * @param {Function} func The function to wrap.
  16445. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16446. * @param {number} arity The arity of `func`.
  16447. * @returns {Function} Returns the new wrapped function.
  16448. */
  16449. function createCurry(func, bitmask, arity) {
  16450. var Ctor = createCtor(func);
  16451. function wrapper() {
  16452. var length = arguments.length,
  16453. args = Array(length),
  16454. index = length,
  16455. placeholder = getHolder(wrapper);
  16456. while (index--) {
  16457. args[index] = arguments[index];
  16458. }
  16459. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  16460. ? []
  16461. : replaceHolders(args, placeholder);
  16462. length -= holders.length;
  16463. if (length < arity) {
  16464. return createRecurry(
  16465. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  16466. args, holders, undefined, undefined, arity - length);
  16467. }
  16468. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  16469. return apply(fn, this, args);
  16470. }
  16471. return wrapper;
  16472. }
  16473. /**
  16474. * Creates a `_.find` or `_.findLast` function.
  16475. *
  16476. * @private
  16477. * @param {Function} findIndexFunc The function to find the collection index.
  16478. * @returns {Function} Returns the new find function.
  16479. */
  16480. function createFind(findIndexFunc) {
  16481. return function(collection, predicate, fromIndex) {
  16482. var iterable = Object(collection);
  16483. if (!isArrayLike(collection)) {
  16484. var iteratee = getIteratee(predicate, 3);
  16485. collection = keys(collection);
  16486. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  16487. }
  16488. var index = findIndexFunc(collection, predicate, fromIndex);
  16489. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  16490. };
  16491. }
  16492. /**
  16493. * Creates a `_.flow` or `_.flowRight` function.
  16494. *
  16495. * @private
  16496. * @param {boolean} [fromRight] Specify iterating from right to left.
  16497. * @returns {Function} Returns the new flow function.
  16498. */
  16499. function createFlow(fromRight) {
  16500. return flatRest(function(funcs) {
  16501. var length = funcs.length,
  16502. index = length,
  16503. prereq = LodashWrapper.prototype.thru;
  16504. if (fromRight) {
  16505. funcs.reverse();
  16506. }
  16507. while (index--) {
  16508. var func = funcs[index];
  16509. if (typeof func != 'function') {
  16510. throw new TypeError(FUNC_ERROR_TEXT);
  16511. }
  16512. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  16513. var wrapper = new LodashWrapper([], true);
  16514. }
  16515. }
  16516. index = wrapper ? index : length;
  16517. while (++index < length) {
  16518. func = funcs[index];
  16519. var funcName = getFuncName(func),
  16520. data = funcName == 'wrapper' ? getData(func) : undefined;
  16521. if (data && isLaziable(data[0]) &&
  16522. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  16523. !data[4].length && data[9] == 1
  16524. ) {
  16525. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  16526. } else {
  16527. wrapper = (func.length == 1 && isLaziable(func))
  16528. ? wrapper[funcName]()
  16529. : wrapper.thru(func);
  16530. }
  16531. }
  16532. return function() {
  16533. var args = arguments,
  16534. value = args[0];
  16535. if (wrapper && args.length == 1 && isArray(value)) {
  16536. return wrapper.plant(value).value();
  16537. }
  16538. var index = 0,
  16539. result = length ? funcs[index].apply(this, args) : value;
  16540. while (++index < length) {
  16541. result = funcs[index].call(this, result);
  16542. }
  16543. return result;
  16544. };
  16545. });
  16546. }
  16547. /**
  16548. * Creates a function that wraps `func` to invoke it with optional `this`
  16549. * binding of `thisArg`, partial application, and currying.
  16550. *
  16551. * @private
  16552. * @param {Function|string} func The function or method name to wrap.
  16553. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16554. * @param {*} [thisArg] The `this` binding of `func`.
  16555. * @param {Array} [partials] The arguments to prepend to those provided to
  16556. * the new function.
  16557. * @param {Array} [holders] The `partials` placeholder indexes.
  16558. * @param {Array} [partialsRight] The arguments to append to those provided
  16559. * to the new function.
  16560. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  16561. * @param {Array} [argPos] The argument positions of the new function.
  16562. * @param {number} [ary] The arity cap of `func`.
  16563. * @param {number} [arity] The arity of `func`.
  16564. * @returns {Function} Returns the new wrapped function.
  16565. */
  16566. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  16567. var isAry = bitmask & WRAP_ARY_FLAG,
  16568. isBind = bitmask & WRAP_BIND_FLAG,
  16569. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  16570. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  16571. isFlip = bitmask & WRAP_FLIP_FLAG,
  16572. Ctor = isBindKey ? undefined : createCtor(func);
  16573. function wrapper() {
  16574. var length = arguments.length,
  16575. args = Array(length),
  16576. index = length;
  16577. while (index--) {
  16578. args[index] = arguments[index];
  16579. }
  16580. if (isCurried) {
  16581. var placeholder = getHolder(wrapper),
  16582. holdersCount = countHolders(args, placeholder);
  16583. }
  16584. if (partials) {
  16585. args = composeArgs(args, partials, holders, isCurried);
  16586. }
  16587. if (partialsRight) {
  16588. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  16589. }
  16590. length -= holdersCount;
  16591. if (isCurried && length < arity) {
  16592. var newHolders = replaceHolders(args, placeholder);
  16593. return createRecurry(
  16594. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  16595. args, newHolders, argPos, ary, arity - length
  16596. );
  16597. }
  16598. var thisBinding = isBind ? thisArg : this,
  16599. fn = isBindKey ? thisBinding[func] : func;
  16600. length = args.length;
  16601. if (argPos) {
  16602. args = reorder(args, argPos);
  16603. } else if (isFlip && length > 1) {
  16604. args.reverse();
  16605. }
  16606. if (isAry && ary < length) {
  16607. args.length = ary;
  16608. }
  16609. if (this && this !== root && this instanceof wrapper) {
  16610. fn = Ctor || createCtor(fn);
  16611. }
  16612. return fn.apply(thisBinding, args);
  16613. }
  16614. return wrapper;
  16615. }
  16616. /**
  16617. * Creates a function like `_.invertBy`.
  16618. *
  16619. * @private
  16620. * @param {Function} setter The function to set accumulator values.
  16621. * @param {Function} toIteratee The function to resolve iteratees.
  16622. * @returns {Function} Returns the new inverter function.
  16623. */
  16624. function createInverter(setter, toIteratee) {
  16625. return function(object, iteratee) {
  16626. return baseInverter(object, setter, toIteratee(iteratee), {});
  16627. };
  16628. }
  16629. /**
  16630. * Creates a function that performs a mathematical operation on two values.
  16631. *
  16632. * @private
  16633. * @param {Function} operator The function to perform the operation.
  16634. * @param {number} [defaultValue] The value used for `undefined` arguments.
  16635. * @returns {Function} Returns the new mathematical operation function.
  16636. */
  16637. function createMathOperation(operator, defaultValue) {
  16638. return function(value, other) {
  16639. var result;
  16640. if (value === undefined && other === undefined) {
  16641. return defaultValue;
  16642. }
  16643. if (value !== undefined) {
  16644. result = value;
  16645. }
  16646. if (other !== undefined) {
  16647. if (result === undefined) {
  16648. return other;
  16649. }
  16650. if (typeof value == 'string' || typeof other == 'string') {
  16651. value = baseToString(value);
  16652. other = baseToString(other);
  16653. } else {
  16654. value = baseToNumber(value);
  16655. other = baseToNumber(other);
  16656. }
  16657. result = operator(value, other);
  16658. }
  16659. return result;
  16660. };
  16661. }
  16662. /**
  16663. * Creates a function like `_.over`.
  16664. *
  16665. * @private
  16666. * @param {Function} arrayFunc The function to iterate over iteratees.
  16667. * @returns {Function} Returns the new over function.
  16668. */
  16669. function createOver(arrayFunc) {
  16670. return flatRest(function(iteratees) {
  16671. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  16672. return baseRest(function(args) {
  16673. var thisArg = this;
  16674. return arrayFunc(iteratees, function(iteratee) {
  16675. return apply(iteratee, thisArg, args);
  16676. });
  16677. });
  16678. });
  16679. }
  16680. /**
  16681. * Creates the padding for `string` based on `length`. The `chars` string
  16682. * is truncated if the number of characters exceeds `length`.
  16683. *
  16684. * @private
  16685. * @param {number} length The padding length.
  16686. * @param {string} [chars=' '] The string used as padding.
  16687. * @returns {string} Returns the padding for `string`.
  16688. */
  16689. function createPadding(length, chars) {
  16690. chars = chars === undefined ? ' ' : baseToString(chars);
  16691. var charsLength = chars.length;
  16692. if (charsLength < 2) {
  16693. return charsLength ? baseRepeat(chars, length) : chars;
  16694. }
  16695. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  16696. return hasUnicode(chars)
  16697. ? castSlice(stringToArray(result), 0, length).join('')
  16698. : result.slice(0, length);
  16699. }
  16700. /**
  16701. * Creates a function that wraps `func` to invoke it with the `this` binding
  16702. * of `thisArg` and `partials` prepended to the arguments it receives.
  16703. *
  16704. * @private
  16705. * @param {Function} func The function to wrap.
  16706. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16707. * @param {*} thisArg The `this` binding of `func`.
  16708. * @param {Array} partials The arguments to prepend to those provided to
  16709. * the new function.
  16710. * @returns {Function} Returns the new wrapped function.
  16711. */
  16712. function createPartial(func, bitmask, thisArg, partials) {
  16713. var isBind = bitmask & WRAP_BIND_FLAG,
  16714. Ctor = createCtor(func);
  16715. function wrapper() {
  16716. var argsIndex = -1,
  16717. argsLength = arguments.length,
  16718. leftIndex = -1,
  16719. leftLength = partials.length,
  16720. args = Array(leftLength + argsLength),
  16721. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  16722. while (++leftIndex < leftLength) {
  16723. args[leftIndex] = partials[leftIndex];
  16724. }
  16725. while (argsLength--) {
  16726. args[leftIndex++] = arguments[++argsIndex];
  16727. }
  16728. return apply(fn, isBind ? thisArg : this, args);
  16729. }
  16730. return wrapper;
  16731. }
  16732. /**
  16733. * Creates a `_.range` or `_.rangeRight` function.
  16734. *
  16735. * @private
  16736. * @param {boolean} [fromRight] Specify iterating from right to left.
  16737. * @returns {Function} Returns the new range function.
  16738. */
  16739. function createRange(fromRight) {
  16740. return function(start, end, step) {
  16741. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  16742. end = step = undefined;
  16743. }
  16744. // Ensure the sign of `-0` is preserved.
  16745. start = toFinite(start);
  16746. if (end === undefined) {
  16747. end = start;
  16748. start = 0;
  16749. } else {
  16750. end = toFinite(end);
  16751. }
  16752. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  16753. return baseRange(start, end, step, fromRight);
  16754. };
  16755. }
  16756. /**
  16757. * Creates a function that performs a relational operation on two values.
  16758. *
  16759. * @private
  16760. * @param {Function} operator The function to perform the operation.
  16761. * @returns {Function} Returns the new relational operation function.
  16762. */
  16763. function createRelationalOperation(operator) {
  16764. return function(value, other) {
  16765. if (!(typeof value == 'string' && typeof other == 'string')) {
  16766. value = toNumber(value);
  16767. other = toNumber(other);
  16768. }
  16769. return operator(value, other);
  16770. };
  16771. }
  16772. /**
  16773. * Creates a function that wraps `func` to continue currying.
  16774. *
  16775. * @private
  16776. * @param {Function} func The function to wrap.
  16777. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16778. * @param {Function} wrapFunc The function to create the `func` wrapper.
  16779. * @param {*} placeholder The placeholder value.
  16780. * @param {*} [thisArg] The `this` binding of `func`.
  16781. * @param {Array} [partials] The arguments to prepend to those provided to
  16782. * the new function.
  16783. * @param {Array} [holders] The `partials` placeholder indexes.
  16784. * @param {Array} [argPos] The argument positions of the new function.
  16785. * @param {number} [ary] The arity cap of `func`.
  16786. * @param {number} [arity] The arity of `func`.
  16787. * @returns {Function} Returns the new wrapped function.
  16788. */
  16789. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  16790. var isCurry = bitmask & WRAP_CURRY_FLAG,
  16791. newHolders = isCurry ? holders : undefined,
  16792. newHoldersRight = isCurry ? undefined : holders,
  16793. newPartials = isCurry ? partials : undefined,
  16794. newPartialsRight = isCurry ? undefined : partials;
  16795. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  16796. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  16797. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  16798. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  16799. }
  16800. var newData = [
  16801. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  16802. newHoldersRight, argPos, ary, arity
  16803. ];
  16804. var result = wrapFunc.apply(undefined, newData);
  16805. if (isLaziable(func)) {
  16806. setData(result, newData);
  16807. }
  16808. result.placeholder = placeholder;
  16809. return setWrapToString(result, func, bitmask);
  16810. }
  16811. /**
  16812. * Creates a function like `_.round`.
  16813. *
  16814. * @private
  16815. * @param {string} methodName The name of the `Math` method to use when rounding.
  16816. * @returns {Function} Returns the new round function.
  16817. */
  16818. function createRound(methodName) {
  16819. var func = Math[methodName];
  16820. return function(number, precision) {
  16821. number = toNumber(number);
  16822. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  16823. if (precision) {
  16824. // Shift with exponential notation to avoid floating-point issues.
  16825. // See [MDN](https://mdn.io/round#Examples) for more details.
  16826. var pair = (toString(number) + 'e').split('e'),
  16827. value = func(pair[0] + 'e' + (+pair[1] + precision));
  16828. pair = (toString(value) + 'e').split('e');
  16829. return +(pair[0] + 'e' + (+pair[1] - precision));
  16830. }
  16831. return func(number);
  16832. };
  16833. }
  16834. /**
  16835. * Creates a set object of `values`.
  16836. *
  16837. * @private
  16838. * @param {Array} values The values to add to the set.
  16839. * @returns {Object} Returns the new set.
  16840. */
  16841. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  16842. return new Set(values);
  16843. };
  16844. /**
  16845. * Creates a `_.toPairs` or `_.toPairsIn` function.
  16846. *
  16847. * @private
  16848. * @param {Function} keysFunc The function to get the keys of a given object.
  16849. * @returns {Function} Returns the new pairs function.
  16850. */
  16851. function createToPairs(keysFunc) {
  16852. return function(object) {
  16853. var tag = getTag(object);
  16854. if (tag == mapTag) {
  16855. return mapToArray(object);
  16856. }
  16857. if (tag == setTag) {
  16858. return setToPairs(object);
  16859. }
  16860. return baseToPairs(object, keysFunc(object));
  16861. };
  16862. }
  16863. /**
  16864. * Creates a function that either curries or invokes `func` with optional
  16865. * `this` binding and partially applied arguments.
  16866. *
  16867. * @private
  16868. * @param {Function|string} func The function or method name to wrap.
  16869. * @param {number} bitmask The bitmask flags.
  16870. * 1 - `_.bind`
  16871. * 2 - `_.bindKey`
  16872. * 4 - `_.curry` or `_.curryRight` of a bound function
  16873. * 8 - `_.curry`
  16874. * 16 - `_.curryRight`
  16875. * 32 - `_.partial`
  16876. * 64 - `_.partialRight`
  16877. * 128 - `_.rearg`
  16878. * 256 - `_.ary`
  16879. * 512 - `_.flip`
  16880. * @param {*} [thisArg] The `this` binding of `func`.
  16881. * @param {Array} [partials] The arguments to be partially applied.
  16882. * @param {Array} [holders] The `partials` placeholder indexes.
  16883. * @param {Array} [argPos] The argument positions of the new function.
  16884. * @param {number} [ary] The arity cap of `func`.
  16885. * @param {number} [arity] The arity of `func`.
  16886. * @returns {Function} Returns the new wrapped function.
  16887. */
  16888. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  16889. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  16890. if (!isBindKey && typeof func != 'function') {
  16891. throw new TypeError(FUNC_ERROR_TEXT);
  16892. }
  16893. var length = partials ? partials.length : 0;
  16894. if (!length) {
  16895. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  16896. partials = holders = undefined;
  16897. }
  16898. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  16899. arity = arity === undefined ? arity : toInteger(arity);
  16900. length -= holders ? holders.length : 0;
  16901. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  16902. var partialsRight = partials,
  16903. holdersRight = holders;
  16904. partials = holders = undefined;
  16905. }
  16906. var data = isBindKey ? undefined : getData(func);
  16907. var newData = [
  16908. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  16909. argPos, ary, arity
  16910. ];
  16911. if (data) {
  16912. mergeData(newData, data);
  16913. }
  16914. func = newData[0];
  16915. bitmask = newData[1];
  16916. thisArg = newData[2];
  16917. partials = newData[3];
  16918. holders = newData[4];
  16919. arity = newData[9] = newData[9] === undefined
  16920. ? (isBindKey ? 0 : func.length)
  16921. : nativeMax(newData[9] - length, 0);
  16922. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  16923. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  16924. }
  16925. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  16926. var result = createBind(func, bitmask, thisArg);
  16927. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  16928. result = createCurry(func, bitmask, arity);
  16929. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  16930. result = createPartial(func, bitmask, thisArg, partials);
  16931. } else {
  16932. result = createHybrid.apply(undefined, newData);
  16933. }
  16934. var setter = data ? baseSetData : setData;
  16935. return setWrapToString(setter(result, newData), func, bitmask);
  16936. }
  16937. /**
  16938. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  16939. * of source objects to the destination object for all destination properties
  16940. * that resolve to `undefined`.
  16941. *
  16942. * @private
  16943. * @param {*} objValue The destination value.
  16944. * @param {*} srcValue The source value.
  16945. * @param {string} key The key of the property to assign.
  16946. * @param {Object} object The parent object of `objValue`.
  16947. * @returns {*} Returns the value to assign.
  16948. */
  16949. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  16950. if (objValue === undefined ||
  16951. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  16952. return srcValue;
  16953. }
  16954. return objValue;
  16955. }
  16956. /**
  16957. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  16958. * objects into destination objects that are passed thru.
  16959. *
  16960. * @private
  16961. * @param {*} objValue The destination value.
  16962. * @param {*} srcValue The source value.
  16963. * @param {string} key The key of the property to merge.
  16964. * @param {Object} object The parent object of `objValue`.
  16965. * @param {Object} source The parent object of `srcValue`.
  16966. * @param {Object} [stack] Tracks traversed source values and their merged
  16967. * counterparts.
  16968. * @returns {*} Returns the value to assign.
  16969. */
  16970. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  16971. if (isObject(objValue) && isObject(srcValue)) {
  16972. // Recursively merge objects and arrays (susceptible to call stack limits).
  16973. stack.set(srcValue, objValue);
  16974. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  16975. stack['delete'](srcValue);
  16976. }
  16977. return objValue;
  16978. }
  16979. /**
  16980. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  16981. * objects.
  16982. *
  16983. * @private
  16984. * @param {*} value The value to inspect.
  16985. * @param {string} key The key of the property to inspect.
  16986. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  16987. */
  16988. function customOmitClone(value) {
  16989. return isPlainObject(value) ? undefined : value;
  16990. }
  16991. /**
  16992. * A specialized version of `baseIsEqualDeep` for arrays with support for
  16993. * partial deep comparisons.
  16994. *
  16995. * @private
  16996. * @param {Array} array The array to compare.
  16997. * @param {Array} other The other array to compare.
  16998. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16999. * @param {Function} customizer The function to customize comparisons.
  17000. * @param {Function} equalFunc The function to determine equivalents of values.
  17001. * @param {Object} stack Tracks traversed `array` and `other` objects.
  17002. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  17003. */
  17004. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  17005. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  17006. arrLength = array.length,
  17007. othLength = other.length;
  17008. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  17009. return false;
  17010. }
  17011. // Assume cyclic values are equal.
  17012. var stacked = stack.get(array);
  17013. if (stacked && stack.get(other)) {
  17014. return stacked == other;
  17015. }
  17016. var index = -1,
  17017. result = true,
  17018. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  17019. stack.set(array, other);
  17020. stack.set(other, array);
  17021. // Ignore non-index properties.
  17022. while (++index < arrLength) {
  17023. var arrValue = array[index],
  17024. othValue = other[index];
  17025. if (customizer) {
  17026. var compared = isPartial
  17027. ? customizer(othValue, arrValue, index, other, array, stack)
  17028. : customizer(arrValue, othValue, index, array, other, stack);
  17029. }
  17030. if (compared !== undefined) {
  17031. if (compared) {
  17032. continue;
  17033. }
  17034. result = false;
  17035. break;
  17036. }
  17037. // Recursively compare arrays (susceptible to call stack limits).
  17038. if (seen) {
  17039. if (!arraySome(other, function(othValue, othIndex) {
  17040. if (!cacheHas(seen, othIndex) &&
  17041. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  17042. return seen.push(othIndex);
  17043. }
  17044. })) {
  17045. result = false;
  17046. break;
  17047. }
  17048. } else if (!(
  17049. arrValue === othValue ||
  17050. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  17051. )) {
  17052. result = false;
  17053. break;
  17054. }
  17055. }
  17056. stack['delete'](array);
  17057. stack['delete'](other);
  17058. return result;
  17059. }
  17060. /**
  17061. * A specialized version of `baseIsEqualDeep` for comparing objects of
  17062. * the same `toStringTag`.
  17063. *
  17064. * **Note:** This function only supports comparing values with tags of
  17065. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  17066. *
  17067. * @private
  17068. * @param {Object} object The object to compare.
  17069. * @param {Object} other The other object to compare.
  17070. * @param {string} tag The `toStringTag` of the objects to compare.
  17071. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  17072. * @param {Function} customizer The function to customize comparisons.
  17073. * @param {Function} equalFunc The function to determine equivalents of values.
  17074. * @param {Object} stack Tracks traversed `object` and `other` objects.
  17075. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  17076. */
  17077. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  17078. switch (tag) {
  17079. case dataViewTag:
  17080. if ((object.byteLength != other.byteLength) ||
  17081. (object.byteOffset != other.byteOffset)) {
  17082. return false;
  17083. }
  17084. object = object.buffer;
  17085. other = other.buffer;
  17086. case arrayBufferTag:
  17087. if ((object.byteLength != other.byteLength) ||
  17088. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  17089. return false;
  17090. }
  17091. return true;
  17092. case boolTag:
  17093. case dateTag:
  17094. case numberTag:
  17095. // Coerce booleans to `1` or `0` and dates to milliseconds.
  17096. // Invalid dates are coerced to `NaN`.
  17097. return eq(+object, +other);
  17098. case errorTag:
  17099. return object.name == other.name && object.message == other.message;
  17100. case regexpTag:
  17101. case stringTag:
  17102. // Coerce regexes to strings and treat strings, primitives and objects,
  17103. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  17104. // for more details.
  17105. return object == (other + '');
  17106. case mapTag:
  17107. var convert = mapToArray;
  17108. case setTag:
  17109. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  17110. convert || (convert = setToArray);
  17111. if (object.size != other.size && !isPartial) {
  17112. return false;
  17113. }
  17114. // Assume cyclic values are equal.
  17115. var stacked = stack.get(object);
  17116. if (stacked) {
  17117. return stacked == other;
  17118. }
  17119. bitmask |= COMPARE_UNORDERED_FLAG;
  17120. // Recursively compare objects (susceptible to call stack limits).
  17121. stack.set(object, other);
  17122. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  17123. stack['delete'](object);
  17124. return result;
  17125. case symbolTag:
  17126. if (symbolValueOf) {
  17127. return symbolValueOf.call(object) == symbolValueOf.call(other);
  17128. }
  17129. }
  17130. return false;
  17131. }
  17132. /**
  17133. * A specialized version of `baseIsEqualDeep` for objects with support for
  17134. * partial deep comparisons.
  17135. *
  17136. * @private
  17137. * @param {Object} object The object to compare.
  17138. * @param {Object} other The other object to compare.
  17139. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  17140. * @param {Function} customizer The function to customize comparisons.
  17141. * @param {Function} equalFunc The function to determine equivalents of values.
  17142. * @param {Object} stack Tracks traversed `object` and `other` objects.
  17143. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  17144. */
  17145. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  17146. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  17147. objProps = getAllKeys(object),
  17148. objLength = objProps.length,
  17149. othProps = getAllKeys(other),
  17150. othLength = othProps.length;
  17151. if (objLength != othLength && !isPartial) {
  17152. return false;
  17153. }
  17154. var index = objLength;
  17155. while (index--) {
  17156. var key = objProps[index];
  17157. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  17158. return false;
  17159. }
  17160. }
  17161. // Assume cyclic values are equal.
  17162. var stacked = stack.get(object);
  17163. if (stacked && stack.get(other)) {
  17164. return stacked == other;
  17165. }
  17166. var result = true;
  17167. stack.set(object, other);
  17168. stack.set(other, object);
  17169. var skipCtor = isPartial;
  17170. while (++index < objLength) {
  17171. key = objProps[index];
  17172. var objValue = object[key],
  17173. othValue = other[key];
  17174. if (customizer) {
  17175. var compared = isPartial
  17176. ? customizer(othValue, objValue, key, other, object, stack)
  17177. : customizer(objValue, othValue, key, object, other, stack);
  17178. }
  17179. // Recursively compare objects (susceptible to call stack limits).
  17180. if (!(compared === undefined
  17181. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  17182. : compared
  17183. )) {
  17184. result = false;
  17185. break;
  17186. }
  17187. skipCtor || (skipCtor = key == 'constructor');
  17188. }
  17189. if (result && !skipCtor) {
  17190. var objCtor = object.constructor,
  17191. othCtor = other.constructor;
  17192. // Non `Object` object instances with different constructors are not equal.
  17193. if (objCtor != othCtor &&
  17194. ('constructor' in object && 'constructor' in other) &&
  17195. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  17196. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  17197. result = false;
  17198. }
  17199. }
  17200. stack['delete'](object);
  17201. stack['delete'](other);
  17202. return result;
  17203. }
  17204. /**
  17205. * A specialized version of `baseRest` which flattens the rest array.
  17206. *
  17207. * @private
  17208. * @param {Function} func The function to apply a rest parameter to.
  17209. * @returns {Function} Returns the new function.
  17210. */
  17211. function flatRest(func) {
  17212. return setToString(overRest(func, undefined, flatten), func + '');
  17213. }
  17214. /**
  17215. * Creates an array of own enumerable property names and symbols of `object`.
  17216. *
  17217. * @private
  17218. * @param {Object} object The object to query.
  17219. * @returns {Array} Returns the array of property names and symbols.
  17220. */
  17221. function getAllKeys(object) {
  17222. return baseGetAllKeys(object, keys, getSymbols);
  17223. }
  17224. /**
  17225. * Creates an array of own and inherited enumerable property names and
  17226. * symbols of `object`.
  17227. *
  17228. * @private
  17229. * @param {Object} object The object to query.
  17230. * @returns {Array} Returns the array of property names and symbols.
  17231. */
  17232. function getAllKeysIn(object) {
  17233. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  17234. }
  17235. /**
  17236. * Gets metadata for `func`.
  17237. *
  17238. * @private
  17239. * @param {Function} func The function to query.
  17240. * @returns {*} Returns the metadata for `func`.
  17241. */
  17242. var getData = !metaMap ? noop : function(func) {
  17243. return metaMap.get(func);
  17244. };
  17245. /**
  17246. * Gets the name of `func`.
  17247. *
  17248. * @private
  17249. * @param {Function} func The function to query.
  17250. * @returns {string} Returns the function name.
  17251. */
  17252. function getFuncName(func) {
  17253. var result = (func.name + ''),
  17254. array = realNames[result],
  17255. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  17256. while (length--) {
  17257. var data = array[length],
  17258. otherFunc = data.func;
  17259. if (otherFunc == null || otherFunc == func) {
  17260. return data.name;
  17261. }
  17262. }
  17263. return result;
  17264. }
  17265. /**
  17266. * Gets the argument placeholder value for `func`.
  17267. *
  17268. * @private
  17269. * @param {Function} func The function to inspect.
  17270. * @returns {*} Returns the placeholder value.
  17271. */
  17272. function getHolder(func) {
  17273. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  17274. return object.placeholder;
  17275. }
  17276. /**
  17277. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  17278. * this function returns the custom method, otherwise it returns `baseIteratee`.
  17279. * If arguments are provided, the chosen function is invoked with them and
  17280. * its result is returned.
  17281. *
  17282. * @private
  17283. * @param {*} [value] The value to convert to an iteratee.
  17284. * @param {number} [arity] The arity of the created iteratee.
  17285. * @returns {Function} Returns the chosen function or its result.
  17286. */
  17287. function getIteratee() {
  17288. var result = lodash.iteratee || iteratee;
  17289. result = result === iteratee ? baseIteratee : result;
  17290. return arguments.length ? result(arguments[0], arguments[1]) : result;
  17291. }
  17292. /**
  17293. * Gets the data for `map`.
  17294. *
  17295. * @private
  17296. * @param {Object} map The map to query.
  17297. * @param {string} key The reference key.
  17298. * @returns {*} Returns the map data.
  17299. */
  17300. function getMapData(map, key) {
  17301. var data = map.__data__;
  17302. return isKeyable(key)
  17303. ? data[typeof key == 'string' ? 'string' : 'hash']
  17304. : data.map;
  17305. }
  17306. /**
  17307. * Gets the property names, values, and compare flags of `object`.
  17308. *
  17309. * @private
  17310. * @param {Object} object The object to query.
  17311. * @returns {Array} Returns the match data of `object`.
  17312. */
  17313. function getMatchData(object) {
  17314. var result = keys(object),
  17315. length = result.length;
  17316. while (length--) {
  17317. var key = result[length],
  17318. value = object[key];
  17319. result[length] = [key, value, isStrictComparable(value)];
  17320. }
  17321. return result;
  17322. }
  17323. /**
  17324. * Gets the native function at `key` of `object`.
  17325. *
  17326. * @private
  17327. * @param {Object} object The object to query.
  17328. * @param {string} key The key of the method to get.
  17329. * @returns {*} Returns the function if it's native, else `undefined`.
  17330. */
  17331. function getNative(object, key) {
  17332. var value = getValue(object, key);
  17333. return baseIsNative(value) ? value : undefined;
  17334. }
  17335. /**
  17336. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  17337. *
  17338. * @private
  17339. * @param {*} value The value to query.
  17340. * @returns {string} Returns the raw `toStringTag`.
  17341. */
  17342. function getRawTag(value) {
  17343. var isOwn = hasOwnProperty.call(value, symToStringTag),
  17344. tag = value[symToStringTag];
  17345. try {
  17346. value[symToStringTag] = undefined;
  17347. var unmasked = true;
  17348. } catch (e) {}
  17349. var result = nativeObjectToString.call(value);
  17350. if (unmasked) {
  17351. if (isOwn) {
  17352. value[symToStringTag] = tag;
  17353. } else {
  17354. delete value[symToStringTag];
  17355. }
  17356. }
  17357. return result;
  17358. }
  17359. /**
  17360. * Creates an array of the own enumerable symbols of `object`.
  17361. *
  17362. * @private
  17363. * @param {Object} object The object to query.
  17364. * @returns {Array} Returns the array of symbols.
  17365. */
  17366. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  17367. if (object == null) {
  17368. return [];
  17369. }
  17370. object = Object(object);
  17371. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  17372. return propertyIsEnumerable.call(object, symbol);
  17373. });
  17374. };
  17375. /**
  17376. * Creates an array of the own and inherited enumerable symbols of `object`.
  17377. *
  17378. * @private
  17379. * @param {Object} object The object to query.
  17380. * @returns {Array} Returns the array of symbols.
  17381. */
  17382. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  17383. var result = [];
  17384. while (object) {
  17385. arrayPush(result, getSymbols(object));
  17386. object = getPrototype(object);
  17387. }
  17388. return result;
  17389. };
  17390. /**
  17391. * Gets the `toStringTag` of `value`.
  17392. *
  17393. * @private
  17394. * @param {*} value The value to query.
  17395. * @returns {string} Returns the `toStringTag`.
  17396. */
  17397. var getTag = baseGetTag;
  17398. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  17399. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  17400. (Map && getTag(new Map) != mapTag) ||
  17401. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  17402. (Set && getTag(new Set) != setTag) ||
  17403. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  17404. getTag = function(value) {
  17405. var result = baseGetTag(value),
  17406. Ctor = result == objectTag ? value.constructor : undefined,
  17407. ctorString = Ctor ? toSource(Ctor) : '';
  17408. if (ctorString) {
  17409. switch (ctorString) {
  17410. case dataViewCtorString: return dataViewTag;
  17411. case mapCtorString: return mapTag;
  17412. case promiseCtorString: return promiseTag;
  17413. case setCtorString: return setTag;
  17414. case weakMapCtorString: return weakMapTag;
  17415. }
  17416. }
  17417. return result;
  17418. };
  17419. }
  17420. /**
  17421. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  17422. *
  17423. * @private
  17424. * @param {number} start The start of the view.
  17425. * @param {number} end The end of the view.
  17426. * @param {Array} transforms The transformations to apply to the view.
  17427. * @returns {Object} Returns an object containing the `start` and `end`
  17428. * positions of the view.
  17429. */
  17430. function getView(start, end, transforms) {
  17431. var index = -1,
  17432. length = transforms.length;
  17433. while (++index < length) {
  17434. var data = transforms[index],
  17435. size = data.size;
  17436. switch (data.type) {
  17437. case 'drop': start += size; break;
  17438. case 'dropRight': end -= size; break;
  17439. case 'take': end = nativeMin(end, start + size); break;
  17440. case 'takeRight': start = nativeMax(start, end - size); break;
  17441. }
  17442. }
  17443. return { 'start': start, 'end': end };
  17444. }
  17445. /**
  17446. * Extracts wrapper details from the `source` body comment.
  17447. *
  17448. * @private
  17449. * @param {string} source The source to inspect.
  17450. * @returns {Array} Returns the wrapper details.
  17451. */
  17452. function getWrapDetails(source) {
  17453. var match = source.match(reWrapDetails);
  17454. return match ? match[1].split(reSplitDetails) : [];
  17455. }
  17456. /**
  17457. * Checks if `path` exists on `object`.
  17458. *
  17459. * @private
  17460. * @param {Object} object The object to query.
  17461. * @param {Array|string} path The path to check.
  17462. * @param {Function} hasFunc The function to check properties.
  17463. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  17464. */
  17465. function hasPath(object, path, hasFunc) {
  17466. path = castPath(path, object);
  17467. var index = -1,
  17468. length = path.length,
  17469. result = false;
  17470. while (++index < length) {
  17471. var key = toKey(path[index]);
  17472. if (!(result = object != null && hasFunc(object, key))) {
  17473. break;
  17474. }
  17475. object = object[key];
  17476. }
  17477. if (result || ++index != length) {
  17478. return result;
  17479. }
  17480. length = object == null ? 0 : object.length;
  17481. return !!length && isLength(length) && isIndex(key, length) &&
  17482. (isArray(object) || isArguments(object));
  17483. }
  17484. /**
  17485. * Initializes an array clone.
  17486. *
  17487. * @private
  17488. * @param {Array} array The array to clone.
  17489. * @returns {Array} Returns the initialized clone.
  17490. */
  17491. function initCloneArray(array) {
  17492. var length = array.length,
  17493. result = new array.constructor(length);
  17494. // Add properties assigned by `RegExp#exec`.
  17495. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  17496. result.index = array.index;
  17497. result.input = array.input;
  17498. }
  17499. return result;
  17500. }
  17501. /**
  17502. * Initializes an object clone.
  17503. *
  17504. * @private
  17505. * @param {Object} object The object to clone.
  17506. * @returns {Object} Returns the initialized clone.
  17507. */
  17508. function initCloneObject(object) {
  17509. return (typeof object.constructor == 'function' && !isPrototype(object))
  17510. ? baseCreate(getPrototype(object))
  17511. : {};
  17512. }
  17513. /**
  17514. * Initializes an object clone based on its `toStringTag`.
  17515. *
  17516. * **Note:** This function only supports cloning values with tags of
  17517. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  17518. *
  17519. * @private
  17520. * @param {Object} object The object to clone.
  17521. * @param {string} tag The `toStringTag` of the object to clone.
  17522. * @param {boolean} [isDeep] Specify a deep clone.
  17523. * @returns {Object} Returns the initialized clone.
  17524. */
  17525. function initCloneByTag(object, tag, isDeep) {
  17526. var Ctor = object.constructor;
  17527. switch (tag) {
  17528. case arrayBufferTag:
  17529. return cloneArrayBuffer(object);
  17530. case boolTag:
  17531. case dateTag:
  17532. return new Ctor(+object);
  17533. case dataViewTag:
  17534. return cloneDataView(object, isDeep);
  17535. case float32Tag: case float64Tag:
  17536. case int8Tag: case int16Tag: case int32Tag:
  17537. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  17538. return cloneTypedArray(object, isDeep);
  17539. case mapTag:
  17540. return new Ctor;
  17541. case numberTag:
  17542. case stringTag:
  17543. return new Ctor(object);
  17544. case regexpTag:
  17545. return cloneRegExp(object);
  17546. case setTag:
  17547. return new Ctor;
  17548. case symbolTag:
  17549. return cloneSymbol(object);
  17550. }
  17551. }
  17552. /**
  17553. * Inserts wrapper `details` in a comment at the top of the `source` body.
  17554. *
  17555. * @private
  17556. * @param {string} source The source to modify.
  17557. * @returns {Array} details The details to insert.
  17558. * @returns {string} Returns the modified source.
  17559. */
  17560. function insertWrapDetails(source, details) {
  17561. var length = details.length;
  17562. if (!length) {
  17563. return source;
  17564. }
  17565. var lastIndex = length - 1;
  17566. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  17567. details = details.join(length > 2 ? ', ' : ' ');
  17568. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  17569. }
  17570. /**
  17571. * Checks if `value` is a flattenable `arguments` object or array.
  17572. *
  17573. * @private
  17574. * @param {*} value The value to check.
  17575. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  17576. */
  17577. function isFlattenable(value) {
  17578. return isArray(value) || isArguments(value) ||
  17579. !!(spreadableSymbol && value && value[spreadableSymbol]);
  17580. }
  17581. /**
  17582. * Checks if `value` is a valid array-like index.
  17583. *
  17584. * @private
  17585. * @param {*} value The value to check.
  17586. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  17587. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  17588. */
  17589. function isIndex(value, length) {
  17590. var type = typeof value;
  17591. length = length == null ? MAX_SAFE_INTEGER : length;
  17592. return !!length &&
  17593. (type == 'number' ||
  17594. (type != 'symbol' && reIsUint.test(value))) &&
  17595. (value > -1 && value % 1 == 0 && value < length);
  17596. }
  17597. /**
  17598. * Checks if the given arguments are from an iteratee call.
  17599. *
  17600. * @private
  17601. * @param {*} value The potential iteratee value argument.
  17602. * @param {*} index The potential iteratee index or key argument.
  17603. * @param {*} object The potential iteratee object argument.
  17604. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  17605. * else `false`.
  17606. */
  17607. function isIterateeCall(value, index, object) {
  17608. if (!isObject(object)) {
  17609. return false;
  17610. }
  17611. var type = typeof index;
  17612. if (type == 'number'
  17613. ? (isArrayLike(object) && isIndex(index, object.length))
  17614. : (type == 'string' && index in object)
  17615. ) {
  17616. return eq(object[index], value);
  17617. }
  17618. return false;
  17619. }
  17620. /**
  17621. * Checks if `value` is a property name and not a property path.
  17622. *
  17623. * @private
  17624. * @param {*} value The value to check.
  17625. * @param {Object} [object] The object to query keys on.
  17626. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  17627. */
  17628. function isKey(value, object) {
  17629. if (isArray(value)) {
  17630. return false;
  17631. }
  17632. var type = typeof value;
  17633. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  17634. value == null || isSymbol(value)) {
  17635. return true;
  17636. }
  17637. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  17638. (object != null && value in Object(object));
  17639. }
  17640. /**
  17641. * Checks if `value` is suitable for use as unique object key.
  17642. *
  17643. * @private
  17644. * @param {*} value The value to check.
  17645. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  17646. */
  17647. function isKeyable(value) {
  17648. var type = typeof value;
  17649. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  17650. ? (value !== '__proto__')
  17651. : (value === null);
  17652. }
  17653. /**
  17654. * Checks if `func` has a lazy counterpart.
  17655. *
  17656. * @private
  17657. * @param {Function} func The function to check.
  17658. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  17659. * else `false`.
  17660. */
  17661. function isLaziable(func) {
  17662. var funcName = getFuncName(func),
  17663. other = lodash[funcName];
  17664. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  17665. return false;
  17666. }
  17667. if (func === other) {
  17668. return true;
  17669. }
  17670. var data = getData(other);
  17671. return !!data && func === data[0];
  17672. }
  17673. /**
  17674. * Checks if `func` has its source masked.
  17675. *
  17676. * @private
  17677. * @param {Function} func The function to check.
  17678. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  17679. */
  17680. function isMasked(func) {
  17681. return !!maskSrcKey && (maskSrcKey in func);
  17682. }
  17683. /**
  17684. * Checks if `func` is capable of being masked.
  17685. *
  17686. * @private
  17687. * @param {*} value The value to check.
  17688. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  17689. */
  17690. var isMaskable = coreJsData ? isFunction : stubFalse;
  17691. /**
  17692. * Checks if `value` is likely a prototype object.
  17693. *
  17694. * @private
  17695. * @param {*} value The value to check.
  17696. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  17697. */
  17698. function isPrototype(value) {
  17699. var Ctor = value && value.constructor,
  17700. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  17701. return value === proto;
  17702. }
  17703. /**
  17704. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  17705. *
  17706. * @private
  17707. * @param {*} value The value to check.
  17708. * @returns {boolean} Returns `true` if `value` if suitable for strict
  17709. * equality comparisons, else `false`.
  17710. */
  17711. function isStrictComparable(value) {
  17712. return value === value && !isObject(value);
  17713. }
  17714. /**
  17715. * A specialized version of `matchesProperty` for source values suitable
  17716. * for strict equality comparisons, i.e. `===`.
  17717. *
  17718. * @private
  17719. * @param {string} key The key of the property to get.
  17720. * @param {*} srcValue The value to match.
  17721. * @returns {Function} Returns the new spec function.
  17722. */
  17723. function matchesStrictComparable(key, srcValue) {
  17724. return function(object) {
  17725. if (object == null) {
  17726. return false;
  17727. }
  17728. return object[key] === srcValue &&
  17729. (srcValue !== undefined || (key in Object(object)));
  17730. };
  17731. }
  17732. /**
  17733. * A specialized version of `_.memoize` which clears the memoized function's
  17734. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  17735. *
  17736. * @private
  17737. * @param {Function} func The function to have its output memoized.
  17738. * @returns {Function} Returns the new memoized function.
  17739. */
  17740. function memoizeCapped(func) {
  17741. var result = memoize(func, function(key) {
  17742. if (cache.size === MAX_MEMOIZE_SIZE) {
  17743. cache.clear();
  17744. }
  17745. return key;
  17746. });
  17747. var cache = result.cache;
  17748. return result;
  17749. }
  17750. /**
  17751. * Merges the function metadata of `source` into `data`.
  17752. *
  17753. * Merging metadata reduces the number of wrappers used to invoke a function.
  17754. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  17755. * may be applied regardless of execution order. Methods like `_.ary` and
  17756. * `_.rearg` modify function arguments, making the order in which they are
  17757. * executed important, preventing the merging of metadata. However, we make
  17758. * an exception for a safe combined case where curried functions have `_.ary`
  17759. * and or `_.rearg` applied.
  17760. *
  17761. * @private
  17762. * @param {Array} data The destination metadata.
  17763. * @param {Array} source The source metadata.
  17764. * @returns {Array} Returns `data`.
  17765. */
  17766. function mergeData(data, source) {
  17767. var bitmask = data[1],
  17768. srcBitmask = source[1],
  17769. newBitmask = bitmask | srcBitmask,
  17770. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  17771. var isCombo =
  17772. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  17773. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  17774. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  17775. // Exit early if metadata can't be merged.
  17776. if (!(isCommon || isCombo)) {
  17777. return data;
  17778. }
  17779. // Use source `thisArg` if available.
  17780. if (srcBitmask & WRAP_BIND_FLAG) {
  17781. data[2] = source[2];
  17782. // Set when currying a bound function.
  17783. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  17784. }
  17785. // Compose partial arguments.
  17786. var value = source[3];
  17787. if (value) {
  17788. var partials = data[3];
  17789. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  17790. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  17791. }
  17792. // Compose partial right arguments.
  17793. value = source[5];
  17794. if (value) {
  17795. partials = data[5];
  17796. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  17797. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  17798. }
  17799. // Use source `argPos` if available.
  17800. value = source[7];
  17801. if (value) {
  17802. data[7] = value;
  17803. }
  17804. // Use source `ary` if it's smaller.
  17805. if (srcBitmask & WRAP_ARY_FLAG) {
  17806. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  17807. }
  17808. // Use source `arity` if one is not provided.
  17809. if (data[9] == null) {
  17810. data[9] = source[9];
  17811. }
  17812. // Use source `func` and merge bitmasks.
  17813. data[0] = source[0];
  17814. data[1] = newBitmask;
  17815. return data;
  17816. }
  17817. /**
  17818. * This function is like
  17819. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  17820. * except that it includes inherited enumerable properties.
  17821. *
  17822. * @private
  17823. * @param {Object} object The object to query.
  17824. * @returns {Array} Returns the array of property names.
  17825. */
  17826. function nativeKeysIn(object) {
  17827. var result = [];
  17828. if (object != null) {
  17829. for (var key in Object(object)) {
  17830. result.push(key);
  17831. }
  17832. }
  17833. return result;
  17834. }
  17835. /**
  17836. * Converts `value` to a string using `Object.prototype.toString`.
  17837. *
  17838. * @private
  17839. * @param {*} value The value to convert.
  17840. * @returns {string} Returns the converted string.
  17841. */
  17842. function objectToString(value) {
  17843. return nativeObjectToString.call(value);
  17844. }
  17845. /**
  17846. * A specialized version of `baseRest` which transforms the rest array.
  17847. *
  17848. * @private
  17849. * @param {Function} func The function to apply a rest parameter to.
  17850. * @param {number} [start=func.length-1] The start position of the rest parameter.
  17851. * @param {Function} transform The rest array transform.
  17852. * @returns {Function} Returns the new function.
  17853. */
  17854. function overRest(func, start, transform) {
  17855. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  17856. return function() {
  17857. var args = arguments,
  17858. index = -1,
  17859. length = nativeMax(args.length - start, 0),
  17860. array = Array(length);
  17861. while (++index < length) {
  17862. array[index] = args[start + index];
  17863. }
  17864. index = -1;
  17865. var otherArgs = Array(start + 1);
  17866. while (++index < start) {
  17867. otherArgs[index] = args[index];
  17868. }
  17869. otherArgs[start] = transform(array);
  17870. return apply(func, this, otherArgs);
  17871. };
  17872. }
  17873. /**
  17874. * Gets the parent value at `path` of `object`.
  17875. *
  17876. * @private
  17877. * @param {Object} object The object to query.
  17878. * @param {Array} path The path to get the parent value of.
  17879. * @returns {*} Returns the parent value.
  17880. */
  17881. function parent(object, path) {
  17882. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  17883. }
  17884. /**
  17885. * Reorder `array` according to the specified indexes where the element at
  17886. * the first index is assigned as the first element, the element at
  17887. * the second index is assigned as the second element, and so on.
  17888. *
  17889. * @private
  17890. * @param {Array} array The array to reorder.
  17891. * @param {Array} indexes The arranged array indexes.
  17892. * @returns {Array} Returns `array`.
  17893. */
  17894. function reorder(array, indexes) {
  17895. var arrLength = array.length,
  17896. length = nativeMin(indexes.length, arrLength),
  17897. oldArray = copyArray(array);
  17898. while (length--) {
  17899. var index = indexes[length];
  17900. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  17901. }
  17902. return array;
  17903. }
  17904. /**
  17905. * Gets the value at `key`, unless `key` is "__proto__".
  17906. *
  17907. * @private
  17908. * @param {Object} object The object to query.
  17909. * @param {string} key The key of the property to get.
  17910. * @returns {*} Returns the property value.
  17911. */
  17912. function safeGet(object, key) {
  17913. if (key == '__proto__') {
  17914. return;
  17915. }
  17916. return object[key];
  17917. }
  17918. /**
  17919. * Sets metadata for `func`.
  17920. *
  17921. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  17922. * period of time, it will trip its breaker and transition to an identity
  17923. * function to avoid garbage collection pauses in V8. See
  17924. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  17925. * for more details.
  17926. *
  17927. * @private
  17928. * @param {Function} func The function to associate metadata with.
  17929. * @param {*} data The metadata.
  17930. * @returns {Function} Returns `func`.
  17931. */
  17932. var setData = shortOut(baseSetData);
  17933. /**
  17934. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  17935. *
  17936. * @private
  17937. * @param {Function} func The function to delay.
  17938. * @param {number} wait The number of milliseconds to delay invocation.
  17939. * @returns {number|Object} Returns the timer id or timeout object.
  17940. */
  17941. var setTimeout = ctxSetTimeout || function(func, wait) {
  17942. return root.setTimeout(func, wait);
  17943. };
  17944. /**
  17945. * Sets the `toString` method of `func` to return `string`.
  17946. *
  17947. * @private
  17948. * @param {Function} func The function to modify.
  17949. * @param {Function} string The `toString` result.
  17950. * @returns {Function} Returns `func`.
  17951. */
  17952. var setToString = shortOut(baseSetToString);
  17953. /**
  17954. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  17955. * with wrapper details in a comment at the top of the source body.
  17956. *
  17957. * @private
  17958. * @param {Function} wrapper The function to modify.
  17959. * @param {Function} reference The reference function.
  17960. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  17961. * @returns {Function} Returns `wrapper`.
  17962. */
  17963. function setWrapToString(wrapper, reference, bitmask) {
  17964. var source = (reference + '');
  17965. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  17966. }
  17967. /**
  17968. * Creates a function that'll short out and invoke `identity` instead
  17969. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  17970. * milliseconds.
  17971. *
  17972. * @private
  17973. * @param {Function} func The function to restrict.
  17974. * @returns {Function} Returns the new shortable function.
  17975. */
  17976. function shortOut(func) {
  17977. var count = 0,
  17978. lastCalled = 0;
  17979. return function() {
  17980. var stamp = nativeNow(),
  17981. remaining = HOT_SPAN - (stamp - lastCalled);
  17982. lastCalled = stamp;
  17983. if (remaining > 0) {
  17984. if (++count >= HOT_COUNT) {
  17985. return arguments[0];
  17986. }
  17987. } else {
  17988. count = 0;
  17989. }
  17990. return func.apply(undefined, arguments);
  17991. };
  17992. }
  17993. /**
  17994. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  17995. *
  17996. * @private
  17997. * @param {Array} array The array to shuffle.
  17998. * @param {number} [size=array.length] The size of `array`.
  17999. * @returns {Array} Returns `array`.
  18000. */
  18001. function shuffleSelf(array, size) {
  18002. var index = -1,
  18003. length = array.length,
  18004. lastIndex = length - 1;
  18005. size = size === undefined ? length : size;
  18006. while (++index < size) {
  18007. var rand = baseRandom(index, lastIndex),
  18008. value = array[rand];
  18009. array[rand] = array[index];
  18010. array[index] = value;
  18011. }
  18012. array.length = size;
  18013. return array;
  18014. }
  18015. /**
  18016. * Converts `string` to a property path array.
  18017. *
  18018. * @private
  18019. * @param {string} string The string to convert.
  18020. * @returns {Array} Returns the property path array.
  18021. */
  18022. var stringToPath = memoizeCapped(function(string) {
  18023. var result = [];
  18024. if (string.charCodeAt(0) === 46 /* . */) {
  18025. result.push('');
  18026. }
  18027. string.replace(rePropName, function(match, number, quote, subString) {
  18028. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  18029. });
  18030. return result;
  18031. });
  18032. /**
  18033. * Converts `value` to a string key if it's not a string or symbol.
  18034. *
  18035. * @private
  18036. * @param {*} value The value to inspect.
  18037. * @returns {string|symbol} Returns the key.
  18038. */
  18039. function toKey(value) {
  18040. if (typeof value == 'string' || isSymbol(value)) {
  18041. return value;
  18042. }
  18043. var result = (value + '');
  18044. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  18045. }
  18046. /**
  18047. * Converts `func` to its source code.
  18048. *
  18049. * @private
  18050. * @param {Function} func The function to convert.
  18051. * @returns {string} Returns the source code.
  18052. */
  18053. function toSource(func) {
  18054. if (func != null) {
  18055. try {
  18056. return funcToString.call(func);
  18057. } catch (e) {}
  18058. try {
  18059. return (func + '');
  18060. } catch (e) {}
  18061. }
  18062. return '';
  18063. }
  18064. /**
  18065. * Updates wrapper `details` based on `bitmask` flags.
  18066. *
  18067. * @private
  18068. * @returns {Array} details The details to modify.
  18069. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18070. * @returns {Array} Returns `details`.
  18071. */
  18072. function updateWrapDetails(details, bitmask) {
  18073. arrayEach(wrapFlags, function(pair) {
  18074. var value = '_.' + pair[0];
  18075. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  18076. details.push(value);
  18077. }
  18078. });
  18079. return details.sort();
  18080. }
  18081. /**
  18082. * Creates a clone of `wrapper`.
  18083. *
  18084. * @private
  18085. * @param {Object} wrapper The wrapper to clone.
  18086. * @returns {Object} Returns the cloned wrapper.
  18087. */
  18088. function wrapperClone(wrapper) {
  18089. if (wrapper instanceof LazyWrapper) {
  18090. return wrapper.clone();
  18091. }
  18092. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  18093. result.__actions__ = copyArray(wrapper.__actions__);
  18094. result.__index__ = wrapper.__index__;
  18095. result.__values__ = wrapper.__values__;
  18096. return result;
  18097. }
  18098. /*------------------------------------------------------------------------*/
  18099. /**
  18100. * Creates an array of elements split into groups the length of `size`.
  18101. * If `array` can't be split evenly, the final chunk will be the remaining
  18102. * elements.
  18103. *
  18104. * @static
  18105. * @memberOf _
  18106. * @since 3.0.0
  18107. * @category Array
  18108. * @param {Array} array The array to process.
  18109. * @param {number} [size=1] The length of each chunk
  18110. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18111. * @returns {Array} Returns the new array of chunks.
  18112. * @example
  18113. *
  18114. * _.chunk(['a', 'b', 'c', 'd'], 2);
  18115. * // => [['a', 'b'], ['c', 'd']]
  18116. *
  18117. * _.chunk(['a', 'b', 'c', 'd'], 3);
  18118. * // => [['a', 'b', 'c'], ['d']]
  18119. */
  18120. function chunk(array, size, guard) {
  18121. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  18122. size = 1;
  18123. } else {
  18124. size = nativeMax(toInteger(size), 0);
  18125. }
  18126. var length = array == null ? 0 : array.length;
  18127. if (!length || size < 1) {
  18128. return [];
  18129. }
  18130. var index = 0,
  18131. resIndex = 0,
  18132. result = Array(nativeCeil(length / size));
  18133. while (index < length) {
  18134. result[resIndex++] = baseSlice(array, index, (index += size));
  18135. }
  18136. return result;
  18137. }
  18138. /**
  18139. * Creates an array with all falsey values removed. The values `false`, `null`,
  18140. * `0`, `""`, `undefined`, and `NaN` are falsey.
  18141. *
  18142. * @static
  18143. * @memberOf _
  18144. * @since 0.1.0
  18145. * @category Array
  18146. * @param {Array} array The array to compact.
  18147. * @returns {Array} Returns the new array of filtered values.
  18148. * @example
  18149. *
  18150. * _.compact([0, 1, false, 2, '', 3]);
  18151. * // => [1, 2, 3]
  18152. */
  18153. function compact(array) {
  18154. var index = -1,
  18155. length = array == null ? 0 : array.length,
  18156. resIndex = 0,
  18157. result = [];
  18158. while (++index < length) {
  18159. var value = array[index];
  18160. if (value) {
  18161. result[resIndex++] = value;
  18162. }
  18163. }
  18164. return result;
  18165. }
  18166. /**
  18167. * Creates a new array concatenating `array` with any additional arrays
  18168. * and/or values.
  18169. *
  18170. * @static
  18171. * @memberOf _
  18172. * @since 4.0.0
  18173. * @category Array
  18174. * @param {Array} array The array to concatenate.
  18175. * @param {...*} [values] The values to concatenate.
  18176. * @returns {Array} Returns the new concatenated array.
  18177. * @example
  18178. *
  18179. * var array = [1];
  18180. * var other = _.concat(array, 2, [3], [[4]]);
  18181. *
  18182. * console.log(other);
  18183. * // => [1, 2, 3, [4]]
  18184. *
  18185. * console.log(array);
  18186. * // => [1]
  18187. */
  18188. function concat() {
  18189. var length = arguments.length;
  18190. if (!length) {
  18191. return [];
  18192. }
  18193. var args = Array(length - 1),
  18194. array = arguments[0],
  18195. index = length;
  18196. while (index--) {
  18197. args[index - 1] = arguments[index];
  18198. }
  18199. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  18200. }
  18201. /**
  18202. * Creates an array of `array` values not included in the other given arrays
  18203. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  18204. * for equality comparisons. The order and references of result values are
  18205. * determined by the first array.
  18206. *
  18207. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  18208. *
  18209. * @static
  18210. * @memberOf _
  18211. * @since 0.1.0
  18212. * @category Array
  18213. * @param {Array} array The array to inspect.
  18214. * @param {...Array} [values] The values to exclude.
  18215. * @returns {Array} Returns the new array of filtered values.
  18216. * @see _.without, _.xor
  18217. * @example
  18218. *
  18219. * _.difference([2, 1], [2, 3]);
  18220. * // => [1]
  18221. */
  18222. var difference = baseRest(function(array, values) {
  18223. return isArrayLikeObject(array)
  18224. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  18225. : [];
  18226. });
  18227. /**
  18228. * This method is like `_.difference` except that it accepts `iteratee` which
  18229. * is invoked for each element of `array` and `values` to generate the criterion
  18230. * by which they're compared. The order and references of result values are
  18231. * determined by the first array. The iteratee is invoked with one argument:
  18232. * (value).
  18233. *
  18234. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  18235. *
  18236. * @static
  18237. * @memberOf _
  18238. * @since 4.0.0
  18239. * @category Array
  18240. * @param {Array} array The array to inspect.
  18241. * @param {...Array} [values] The values to exclude.
  18242. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  18243. * @returns {Array} Returns the new array of filtered values.
  18244. * @example
  18245. *
  18246. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  18247. * // => [1.2]
  18248. *
  18249. * // The `_.property` iteratee shorthand.
  18250. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  18251. * // => [{ 'x': 2 }]
  18252. */
  18253. var differenceBy = baseRest(function(array, values) {
  18254. var iteratee = last(values);
  18255. if (isArrayLikeObject(iteratee)) {
  18256. iteratee = undefined;
  18257. }
  18258. return isArrayLikeObject(array)
  18259. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  18260. : [];
  18261. });
  18262. /**
  18263. * This method is like `_.difference` except that it accepts `comparator`
  18264. * which is invoked to compare elements of `array` to `values`. The order and
  18265. * references of result values are determined by the first array. The comparator
  18266. * is invoked with two arguments: (arrVal, othVal).
  18267. *
  18268. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  18269. *
  18270. * @static
  18271. * @memberOf _
  18272. * @since 4.0.0
  18273. * @category Array
  18274. * @param {Array} array The array to inspect.
  18275. * @param {...Array} [values] The values to exclude.
  18276. * @param {Function} [comparator] The comparator invoked per element.
  18277. * @returns {Array} Returns the new array of filtered values.
  18278. * @example
  18279. *
  18280. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  18281. *
  18282. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  18283. * // => [{ 'x': 2, 'y': 1 }]
  18284. */
  18285. var differenceWith = baseRest(function(array, values) {
  18286. var comparator = last(values);
  18287. if (isArrayLikeObject(comparator)) {
  18288. comparator = undefined;
  18289. }
  18290. return isArrayLikeObject(array)
  18291. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  18292. : [];
  18293. });
  18294. /**
  18295. * Creates a slice of `array` with `n` elements dropped from the beginning.
  18296. *
  18297. * @static
  18298. * @memberOf _
  18299. * @since 0.5.0
  18300. * @category Array
  18301. * @param {Array} array The array to query.
  18302. * @param {number} [n=1] The number of elements to drop.
  18303. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18304. * @returns {Array} Returns the slice of `array`.
  18305. * @example
  18306. *
  18307. * _.drop([1, 2, 3]);
  18308. * // => [2, 3]
  18309. *
  18310. * _.drop([1, 2, 3], 2);
  18311. * // => [3]
  18312. *
  18313. * _.drop([1, 2, 3], 5);
  18314. * // => []
  18315. *
  18316. * _.drop([1, 2, 3], 0);
  18317. * // => [1, 2, 3]
  18318. */
  18319. function drop(array, n, guard) {
  18320. var length = array == null ? 0 : array.length;
  18321. if (!length) {
  18322. return [];
  18323. }
  18324. n = (guard || n === undefined) ? 1 : toInteger(n);
  18325. return baseSlice(array, n < 0 ? 0 : n, length);
  18326. }
  18327. /**
  18328. * Creates a slice of `array` with `n` elements dropped from the end.
  18329. *
  18330. * @static
  18331. * @memberOf _
  18332. * @since 3.0.0
  18333. * @category Array
  18334. * @param {Array} array The array to query.
  18335. * @param {number} [n=1] The number of elements to drop.
  18336. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18337. * @returns {Array} Returns the slice of `array`.
  18338. * @example
  18339. *
  18340. * _.dropRight([1, 2, 3]);
  18341. * // => [1, 2]
  18342. *
  18343. * _.dropRight([1, 2, 3], 2);
  18344. * // => [1]
  18345. *
  18346. * _.dropRight([1, 2, 3], 5);
  18347. * // => []
  18348. *
  18349. * _.dropRight([1, 2, 3], 0);
  18350. * // => [1, 2, 3]
  18351. */
  18352. function dropRight(array, n, guard) {
  18353. var length = array == null ? 0 : array.length;
  18354. if (!length) {
  18355. return [];
  18356. }
  18357. n = (guard || n === undefined) ? 1 : toInteger(n);
  18358. n = length - n;
  18359. return baseSlice(array, 0, n < 0 ? 0 : n);
  18360. }
  18361. /**
  18362. * Creates a slice of `array` excluding elements dropped from the end.
  18363. * Elements are dropped until `predicate` returns falsey. The predicate is
  18364. * invoked with three arguments: (value, index, array).
  18365. *
  18366. * @static
  18367. * @memberOf _
  18368. * @since 3.0.0
  18369. * @category Array
  18370. * @param {Array} array The array to query.
  18371. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18372. * @returns {Array} Returns the slice of `array`.
  18373. * @example
  18374. *
  18375. * var users = [
  18376. * { 'user': 'barney', 'active': true },
  18377. * { 'user': 'fred', 'active': false },
  18378. * { 'user': 'pebbles', 'active': false }
  18379. * ];
  18380. *
  18381. * _.dropRightWhile(users, function(o) { return !o.active; });
  18382. * // => objects for ['barney']
  18383. *
  18384. * // The `_.matches` iteratee shorthand.
  18385. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  18386. * // => objects for ['barney', 'fred']
  18387. *
  18388. * // The `_.matchesProperty` iteratee shorthand.
  18389. * _.dropRightWhile(users, ['active', false]);
  18390. * // => objects for ['barney']
  18391. *
  18392. * // The `_.property` iteratee shorthand.
  18393. * _.dropRightWhile(users, 'active');
  18394. * // => objects for ['barney', 'fred', 'pebbles']
  18395. */
  18396. function dropRightWhile(array, predicate) {
  18397. return (array && array.length)
  18398. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  18399. : [];
  18400. }
  18401. /**
  18402. * Creates a slice of `array` excluding elements dropped from the beginning.
  18403. * Elements are dropped until `predicate` returns falsey. The predicate is
  18404. * invoked with three arguments: (value, index, array).
  18405. *
  18406. * @static
  18407. * @memberOf _
  18408. * @since 3.0.0
  18409. * @category Array
  18410. * @param {Array} array The array to query.
  18411. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18412. * @returns {Array} Returns the slice of `array`.
  18413. * @example
  18414. *
  18415. * var users = [
  18416. * { 'user': 'barney', 'active': false },
  18417. * { 'user': 'fred', 'active': false },
  18418. * { 'user': 'pebbles', 'active': true }
  18419. * ];
  18420. *
  18421. * _.dropWhile(users, function(o) { return !o.active; });
  18422. * // => objects for ['pebbles']
  18423. *
  18424. * // The `_.matches` iteratee shorthand.
  18425. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  18426. * // => objects for ['fred', 'pebbles']
  18427. *
  18428. * // The `_.matchesProperty` iteratee shorthand.
  18429. * _.dropWhile(users, ['active', false]);
  18430. * // => objects for ['pebbles']
  18431. *
  18432. * // The `_.property` iteratee shorthand.
  18433. * _.dropWhile(users, 'active');
  18434. * // => objects for ['barney', 'fred', 'pebbles']
  18435. */
  18436. function dropWhile(array, predicate) {
  18437. return (array && array.length)
  18438. ? baseWhile(array, getIteratee(predicate, 3), true)
  18439. : [];
  18440. }
  18441. /**
  18442. * Fills elements of `array` with `value` from `start` up to, but not
  18443. * including, `end`.
  18444. *
  18445. * **Note:** This method mutates `array`.
  18446. *
  18447. * @static
  18448. * @memberOf _
  18449. * @since 3.2.0
  18450. * @category Array
  18451. * @param {Array} array The array to fill.
  18452. * @param {*} value The value to fill `array` with.
  18453. * @param {number} [start=0] The start position.
  18454. * @param {number} [end=array.length] The end position.
  18455. * @returns {Array} Returns `array`.
  18456. * @example
  18457. *
  18458. * var array = [1, 2, 3];
  18459. *
  18460. * _.fill(array, 'a');
  18461. * console.log(array);
  18462. * // => ['a', 'a', 'a']
  18463. *
  18464. * _.fill(Array(3), 2);
  18465. * // => [2, 2, 2]
  18466. *
  18467. * _.fill([4, 6, 8, 10], '*', 1, 3);
  18468. * // => [4, '*', '*', 10]
  18469. */
  18470. function fill(array, value, start, end) {
  18471. var length = array == null ? 0 : array.length;
  18472. if (!length) {
  18473. return [];
  18474. }
  18475. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  18476. start = 0;
  18477. end = length;
  18478. }
  18479. return baseFill(array, value, start, end);
  18480. }
  18481. /**
  18482. * This method is like `_.find` except that it returns the index of the first
  18483. * element `predicate` returns truthy for instead of the element itself.
  18484. *
  18485. * @static
  18486. * @memberOf _
  18487. * @since 1.1.0
  18488. * @category Array
  18489. * @param {Array} array The array to inspect.
  18490. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18491. * @param {number} [fromIndex=0] The index to search from.
  18492. * @returns {number} Returns the index of the found element, else `-1`.
  18493. * @example
  18494. *
  18495. * var users = [
  18496. * { 'user': 'barney', 'active': false },
  18497. * { 'user': 'fred', 'active': false },
  18498. * { 'user': 'pebbles', 'active': true }
  18499. * ];
  18500. *
  18501. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  18502. * // => 0
  18503. *
  18504. * // The `_.matches` iteratee shorthand.
  18505. * _.findIndex(users, { 'user': 'fred', 'active': false });
  18506. * // => 1
  18507. *
  18508. * // The `_.matchesProperty` iteratee shorthand.
  18509. * _.findIndex(users, ['active', false]);
  18510. * // => 0
  18511. *
  18512. * // The `_.property` iteratee shorthand.
  18513. * _.findIndex(users, 'active');
  18514. * // => 2
  18515. */
  18516. function findIndex(array, predicate, fromIndex) {
  18517. var length = array == null ? 0 : array.length;
  18518. if (!length) {
  18519. return -1;
  18520. }
  18521. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  18522. if (index < 0) {
  18523. index = nativeMax(length + index, 0);
  18524. }
  18525. return baseFindIndex(array, getIteratee(predicate, 3), index);
  18526. }
  18527. /**
  18528. * This method is like `_.findIndex` except that it iterates over elements
  18529. * of `collection` from right to left.
  18530. *
  18531. * @static
  18532. * @memberOf _
  18533. * @since 2.0.0
  18534. * @category Array
  18535. * @param {Array} array The array to inspect.
  18536. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18537. * @param {number} [fromIndex=array.length-1] The index to search from.
  18538. * @returns {number} Returns the index of the found element, else `-1`.
  18539. * @example
  18540. *
  18541. * var users = [
  18542. * { 'user': 'barney', 'active': true },
  18543. * { 'user': 'fred', 'active': false },
  18544. * { 'user': 'pebbles', 'active': false }
  18545. * ];
  18546. *
  18547. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  18548. * // => 2
  18549. *
  18550. * // The `_.matches` iteratee shorthand.
  18551. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  18552. * // => 0
  18553. *
  18554. * // The `_.matchesProperty` iteratee shorthand.
  18555. * _.findLastIndex(users, ['active', false]);
  18556. * // => 2
  18557. *
  18558. * // The `_.property` iteratee shorthand.
  18559. * _.findLastIndex(users, 'active');
  18560. * // => 0
  18561. */
  18562. function findLastIndex(array, predicate, fromIndex) {
  18563. var length = array == null ? 0 : array.length;
  18564. if (!length) {
  18565. return -1;
  18566. }
  18567. var index = length - 1;
  18568. if (fromIndex !== undefined) {
  18569. index = toInteger(fromIndex);
  18570. index = fromIndex < 0
  18571. ? nativeMax(length + index, 0)
  18572. : nativeMin(index, length - 1);
  18573. }
  18574. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  18575. }
  18576. /**
  18577. * Flattens `array` a single level deep.
  18578. *
  18579. * @static
  18580. * @memberOf _
  18581. * @since 0.1.0
  18582. * @category Array
  18583. * @param {Array} array The array to flatten.
  18584. * @returns {Array} Returns the new flattened array.
  18585. * @example
  18586. *
  18587. * _.flatten([1, [2, [3, [4]], 5]]);
  18588. * // => [1, 2, [3, [4]], 5]
  18589. */
  18590. function flatten(array) {
  18591. var length = array == null ? 0 : array.length;
  18592. return length ? baseFlatten(array, 1) : [];
  18593. }
  18594. /**
  18595. * Recursively flattens `array`.
  18596. *
  18597. * @static
  18598. * @memberOf _
  18599. * @since 3.0.0
  18600. * @category Array
  18601. * @param {Array} array The array to flatten.
  18602. * @returns {Array} Returns the new flattened array.
  18603. * @example
  18604. *
  18605. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  18606. * // => [1, 2, 3, 4, 5]
  18607. */
  18608. function flattenDeep(array) {
  18609. var length = array == null ? 0 : array.length;
  18610. return length ? baseFlatten(array, INFINITY) : [];
  18611. }
  18612. /**
  18613. * Recursively flatten `array` up to `depth` times.
  18614. *
  18615. * @static
  18616. * @memberOf _
  18617. * @since 4.4.0
  18618. * @category Array
  18619. * @param {Array} array The array to flatten.
  18620. * @param {number} [depth=1] The maximum recursion depth.
  18621. * @returns {Array} Returns the new flattened array.
  18622. * @example
  18623. *
  18624. * var array = [1, [2, [3, [4]], 5]];
  18625. *
  18626. * _.flattenDepth(array, 1);
  18627. * // => [1, 2, [3, [4]], 5]
  18628. *
  18629. * _.flattenDepth(array, 2);
  18630. * // => [1, 2, 3, [4], 5]
  18631. */
  18632. function flattenDepth(array, depth) {
  18633. var length = array == null ? 0 : array.length;
  18634. if (!length) {
  18635. return [];
  18636. }
  18637. depth = depth === undefined ? 1 : toInteger(depth);
  18638. return baseFlatten(array, depth);
  18639. }
  18640. /**
  18641. * The inverse of `_.toPairs`; this method returns an object composed
  18642. * from key-value `pairs`.
  18643. *
  18644. * @static
  18645. * @memberOf _
  18646. * @since 4.0.0
  18647. * @category Array
  18648. * @param {Array} pairs The key-value pairs.
  18649. * @returns {Object} Returns the new object.
  18650. * @example
  18651. *
  18652. * _.fromPairs([['a', 1], ['b', 2]]);
  18653. * // => { 'a': 1, 'b': 2 }
  18654. */
  18655. function fromPairs(pairs) {
  18656. var index = -1,
  18657. length = pairs == null ? 0 : pairs.length,
  18658. result = {};
  18659. while (++index < length) {
  18660. var pair = pairs[index];
  18661. result[pair[0]] = pair[1];
  18662. }
  18663. return result;
  18664. }
  18665. /**
  18666. * Gets the first element of `array`.
  18667. *
  18668. * @static
  18669. * @memberOf _
  18670. * @since 0.1.0
  18671. * @alias first
  18672. * @category Array
  18673. * @param {Array} array The array to query.
  18674. * @returns {*} Returns the first element of `array`.
  18675. * @example
  18676. *
  18677. * _.head([1, 2, 3]);
  18678. * // => 1
  18679. *
  18680. * _.head([]);
  18681. * // => undefined
  18682. */
  18683. function head(array) {
  18684. return (array && array.length) ? array[0] : undefined;
  18685. }
  18686. /**
  18687. * Gets the index at which the first occurrence of `value` is found in `array`
  18688. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  18689. * for equality comparisons. If `fromIndex` is negative, it's used as the
  18690. * offset from the end of `array`.
  18691. *
  18692. * @static
  18693. * @memberOf _
  18694. * @since 0.1.0
  18695. * @category Array
  18696. * @param {Array} array The array to inspect.
  18697. * @param {*} value The value to search for.
  18698. * @param {number} [fromIndex=0] The index to search from.
  18699. * @returns {number} Returns the index of the matched value, else `-1`.
  18700. * @example
  18701. *
  18702. * _.indexOf([1, 2, 1, 2], 2);
  18703. * // => 1
  18704. *
  18705. * // Search from the `fromIndex`.
  18706. * _.indexOf([1, 2, 1, 2], 2, 2);
  18707. * // => 3
  18708. */
  18709. function indexOf(array, value, fromIndex) {
  18710. var length = array == null ? 0 : array.length;
  18711. if (!length) {
  18712. return -1;
  18713. }
  18714. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  18715. if (index < 0) {
  18716. index = nativeMax(length + index, 0);
  18717. }
  18718. return baseIndexOf(array, value, index);
  18719. }
  18720. /**
  18721. * Gets all but the last element of `array`.
  18722. *
  18723. * @static
  18724. * @memberOf _
  18725. * @since 0.1.0
  18726. * @category Array
  18727. * @param {Array} array The array to query.
  18728. * @returns {Array} Returns the slice of `array`.
  18729. * @example
  18730. *
  18731. * _.initial([1, 2, 3]);
  18732. * // => [1, 2]
  18733. */
  18734. function initial(array) {
  18735. var length = array == null ? 0 : array.length;
  18736. return length ? baseSlice(array, 0, -1) : [];
  18737. }
  18738. /**
  18739. * Creates an array of unique values that are included in all given arrays
  18740. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  18741. * for equality comparisons. The order and references of result values are
  18742. * determined by the first array.
  18743. *
  18744. * @static
  18745. * @memberOf _
  18746. * @since 0.1.0
  18747. * @category Array
  18748. * @param {...Array} [arrays] The arrays to inspect.
  18749. * @returns {Array} Returns the new array of intersecting values.
  18750. * @example
  18751. *
  18752. * _.intersection([2, 1], [2, 3]);
  18753. * // => [2]
  18754. */
  18755. var intersection = baseRest(function(arrays) {
  18756. var mapped = arrayMap(arrays, castArrayLikeObject);
  18757. return (mapped.length && mapped[0] === arrays[0])
  18758. ? baseIntersection(mapped)
  18759. : [];
  18760. });
  18761. /**
  18762. * This method is like `_.intersection` except that it accepts `iteratee`
  18763. * which is invoked for each element of each `arrays` to generate the criterion
  18764. * by which they're compared. The order and references of result values are
  18765. * determined by the first array. The iteratee is invoked with one argument:
  18766. * (value).
  18767. *
  18768. * @static
  18769. * @memberOf _
  18770. * @since 4.0.0
  18771. * @category Array
  18772. * @param {...Array} [arrays] The arrays to inspect.
  18773. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  18774. * @returns {Array} Returns the new array of intersecting values.
  18775. * @example
  18776. *
  18777. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  18778. * // => [2.1]
  18779. *
  18780. * // The `_.property` iteratee shorthand.
  18781. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  18782. * // => [{ 'x': 1 }]
  18783. */
  18784. var intersectionBy = baseRest(function(arrays) {
  18785. var iteratee = last(arrays),
  18786. mapped = arrayMap(arrays, castArrayLikeObject);
  18787. if (iteratee === last(mapped)) {
  18788. iteratee = undefined;
  18789. } else {
  18790. mapped.pop();
  18791. }
  18792. return (mapped.length && mapped[0] === arrays[0])
  18793. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  18794. : [];
  18795. });
  18796. /**
  18797. * This method is like `_.intersection` except that it accepts `comparator`
  18798. * which is invoked to compare elements of `arrays`. The order and references
  18799. * of result values are determined by the first array. The comparator is
  18800. * invoked with two arguments: (arrVal, othVal).
  18801. *
  18802. * @static
  18803. * @memberOf _
  18804. * @since 4.0.0
  18805. * @category Array
  18806. * @param {...Array} [arrays] The arrays to inspect.
  18807. * @param {Function} [comparator] The comparator invoked per element.
  18808. * @returns {Array} Returns the new array of intersecting values.
  18809. * @example
  18810. *
  18811. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  18812. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  18813. *
  18814. * _.intersectionWith(objects, others, _.isEqual);
  18815. * // => [{ 'x': 1, 'y': 2 }]
  18816. */
  18817. var intersectionWith = baseRest(function(arrays) {
  18818. var comparator = last(arrays),
  18819. mapped = arrayMap(arrays, castArrayLikeObject);
  18820. comparator = typeof comparator == 'function' ? comparator : undefined;
  18821. if (comparator) {
  18822. mapped.pop();
  18823. }
  18824. return (mapped.length && mapped[0] === arrays[0])
  18825. ? baseIntersection(mapped, undefined, comparator)
  18826. : [];
  18827. });
  18828. /**
  18829. * Converts all elements in `array` into a string separated by `separator`.
  18830. *
  18831. * @static
  18832. * @memberOf _
  18833. * @since 4.0.0
  18834. * @category Array
  18835. * @param {Array} array The array to convert.
  18836. * @param {string} [separator=','] The element separator.
  18837. * @returns {string} Returns the joined string.
  18838. * @example
  18839. *
  18840. * _.join(['a', 'b', 'c'], '~');
  18841. * // => 'a~b~c'
  18842. */
  18843. function join(array, separator) {
  18844. return array == null ? '' : nativeJoin.call(array, separator);
  18845. }
  18846. /**
  18847. * Gets the last element of `array`.
  18848. *
  18849. * @static
  18850. * @memberOf _
  18851. * @since 0.1.0
  18852. * @category Array
  18853. * @param {Array} array The array to query.
  18854. * @returns {*} Returns the last element of `array`.
  18855. * @example
  18856. *
  18857. * _.last([1, 2, 3]);
  18858. * // => 3
  18859. */
  18860. function last(array) {
  18861. var length = array == null ? 0 : array.length;
  18862. return length ? array[length - 1] : undefined;
  18863. }
  18864. /**
  18865. * This method is like `_.indexOf` except that it iterates over elements of
  18866. * `array` from right to left.
  18867. *
  18868. * @static
  18869. * @memberOf _
  18870. * @since 0.1.0
  18871. * @category Array
  18872. * @param {Array} array The array to inspect.
  18873. * @param {*} value The value to search for.
  18874. * @param {number} [fromIndex=array.length-1] The index to search from.
  18875. * @returns {number} Returns the index of the matched value, else `-1`.
  18876. * @example
  18877. *
  18878. * _.lastIndexOf([1, 2, 1, 2], 2);
  18879. * // => 3
  18880. *
  18881. * // Search from the `fromIndex`.
  18882. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  18883. * // => 1
  18884. */
  18885. function lastIndexOf(array, value, fromIndex) {
  18886. var length = array == null ? 0 : array.length;
  18887. if (!length) {
  18888. return -1;
  18889. }
  18890. var index = length;
  18891. if (fromIndex !== undefined) {
  18892. index = toInteger(fromIndex);
  18893. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  18894. }
  18895. return value === value
  18896. ? strictLastIndexOf(array, value, index)
  18897. : baseFindIndex(array, baseIsNaN, index, true);
  18898. }
  18899. /**
  18900. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  18901. * element from the end is returned.
  18902. *
  18903. * @static
  18904. * @memberOf _
  18905. * @since 4.11.0
  18906. * @category Array
  18907. * @param {Array} array The array to query.
  18908. * @param {number} [n=0] The index of the element to return.
  18909. * @returns {*} Returns the nth element of `array`.
  18910. * @example
  18911. *
  18912. * var array = ['a', 'b', 'c', 'd'];
  18913. *
  18914. * _.nth(array, 1);
  18915. * // => 'b'
  18916. *
  18917. * _.nth(array, -2);
  18918. * // => 'c';
  18919. */
  18920. function nth(array, n) {
  18921. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  18922. }
  18923. /**
  18924. * Removes all given values from `array` using
  18925. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  18926. * for equality comparisons.
  18927. *
  18928. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  18929. * to remove elements from an array by predicate.
  18930. *
  18931. * @static
  18932. * @memberOf _
  18933. * @since 2.0.0
  18934. * @category Array
  18935. * @param {Array} array The array to modify.
  18936. * @param {...*} [values] The values to remove.
  18937. * @returns {Array} Returns `array`.
  18938. * @example
  18939. *
  18940. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  18941. *
  18942. * _.pull(array, 'a', 'c');
  18943. * console.log(array);
  18944. * // => ['b', 'b']
  18945. */
  18946. var pull = baseRest(pullAll);
  18947. /**
  18948. * This method is like `_.pull` except that it accepts an array of values to remove.
  18949. *
  18950. * **Note:** Unlike `_.difference`, this method mutates `array`.
  18951. *
  18952. * @static
  18953. * @memberOf _
  18954. * @since 4.0.0
  18955. * @category Array
  18956. * @param {Array} array The array to modify.
  18957. * @param {Array} values The values to remove.
  18958. * @returns {Array} Returns `array`.
  18959. * @example
  18960. *
  18961. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  18962. *
  18963. * _.pullAll(array, ['a', 'c']);
  18964. * console.log(array);
  18965. * // => ['b', 'b']
  18966. */
  18967. function pullAll(array, values) {
  18968. return (array && array.length && values && values.length)
  18969. ? basePullAll(array, values)
  18970. : array;
  18971. }
  18972. /**
  18973. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  18974. * invoked for each element of `array` and `values` to generate the criterion
  18975. * by which they're compared. The iteratee is invoked with one argument: (value).
  18976. *
  18977. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  18978. *
  18979. * @static
  18980. * @memberOf _
  18981. * @since 4.0.0
  18982. * @category Array
  18983. * @param {Array} array The array to modify.
  18984. * @param {Array} values The values to remove.
  18985. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  18986. * @returns {Array} Returns `array`.
  18987. * @example
  18988. *
  18989. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  18990. *
  18991. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  18992. * console.log(array);
  18993. * // => [{ 'x': 2 }]
  18994. */
  18995. function pullAllBy(array, values, iteratee) {
  18996. return (array && array.length && values && values.length)
  18997. ? basePullAll(array, values, getIteratee(iteratee, 2))
  18998. : array;
  18999. }
  19000. /**
  19001. * This method is like `_.pullAll` except that it accepts `comparator` which
  19002. * is invoked to compare elements of `array` to `values`. The comparator is
  19003. * invoked with two arguments: (arrVal, othVal).
  19004. *
  19005. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  19006. *
  19007. * @static
  19008. * @memberOf _
  19009. * @since 4.6.0
  19010. * @category Array
  19011. * @param {Array} array The array to modify.
  19012. * @param {Array} values The values to remove.
  19013. * @param {Function} [comparator] The comparator invoked per element.
  19014. * @returns {Array} Returns `array`.
  19015. * @example
  19016. *
  19017. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  19018. *
  19019. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  19020. * console.log(array);
  19021. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  19022. */
  19023. function pullAllWith(array, values, comparator) {
  19024. return (array && array.length && values && values.length)
  19025. ? basePullAll(array, values, undefined, comparator)
  19026. : array;
  19027. }
  19028. /**
  19029. * Removes elements from `array` corresponding to `indexes` and returns an
  19030. * array of removed elements.
  19031. *
  19032. * **Note:** Unlike `_.at`, this method mutates `array`.
  19033. *
  19034. * @static
  19035. * @memberOf _
  19036. * @since 3.0.0
  19037. * @category Array
  19038. * @param {Array} array The array to modify.
  19039. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  19040. * @returns {Array} Returns the new array of removed elements.
  19041. * @example
  19042. *
  19043. * var array = ['a', 'b', 'c', 'd'];
  19044. * var pulled = _.pullAt(array, [1, 3]);
  19045. *
  19046. * console.log(array);
  19047. * // => ['a', 'c']
  19048. *
  19049. * console.log(pulled);
  19050. * // => ['b', 'd']
  19051. */
  19052. var pullAt = flatRest(function(array, indexes) {
  19053. var length = array == null ? 0 : array.length,
  19054. result = baseAt(array, indexes);
  19055. basePullAt(array, arrayMap(indexes, function(index) {
  19056. return isIndex(index, length) ? +index : index;
  19057. }).sort(compareAscending));
  19058. return result;
  19059. });
  19060. /**
  19061. * Removes all elements from `array` that `predicate` returns truthy for
  19062. * and returns an array of the removed elements. The predicate is invoked
  19063. * with three arguments: (value, index, array).
  19064. *
  19065. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  19066. * to pull elements from an array by value.
  19067. *
  19068. * @static
  19069. * @memberOf _
  19070. * @since 2.0.0
  19071. * @category Array
  19072. * @param {Array} array The array to modify.
  19073. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  19074. * @returns {Array} Returns the new array of removed elements.
  19075. * @example
  19076. *
  19077. * var array = [1, 2, 3, 4];
  19078. * var evens = _.remove(array, function(n) {
  19079. * return n % 2 == 0;
  19080. * });
  19081. *
  19082. * console.log(array);
  19083. * // => [1, 3]
  19084. *
  19085. * console.log(evens);
  19086. * // => [2, 4]
  19087. */
  19088. function remove(array, predicate) {
  19089. var result = [];
  19090. if (!(array && array.length)) {
  19091. return result;
  19092. }
  19093. var index = -1,
  19094. indexes = [],
  19095. length = array.length;
  19096. predicate = getIteratee(predicate, 3);
  19097. while (++index < length) {
  19098. var value = array[index];
  19099. if (predicate(value, index, array)) {
  19100. result.push(value);
  19101. indexes.push(index);
  19102. }
  19103. }
  19104. basePullAt(array, indexes);
  19105. return result;
  19106. }
  19107. /**
  19108. * Reverses `array` so that the first element becomes the last, the second
  19109. * element becomes the second to last, and so on.
  19110. *
  19111. * **Note:** This method mutates `array` and is based on
  19112. * [`Array#reverse`](https://mdn.io/Array/reverse).
  19113. *
  19114. * @static
  19115. * @memberOf _
  19116. * @since 4.0.0
  19117. * @category Array
  19118. * @param {Array} array The array to modify.
  19119. * @returns {Array} Returns `array`.
  19120. * @example
  19121. *
  19122. * var array = [1, 2, 3];
  19123. *
  19124. * _.reverse(array);
  19125. * // => [3, 2, 1]
  19126. *
  19127. * console.log(array);
  19128. * // => [3, 2, 1]
  19129. */
  19130. function reverse(array) {
  19131. return array == null ? array : nativeReverse.call(array);
  19132. }
  19133. /**
  19134. * Creates a slice of `array` from `start` up to, but not including, `end`.
  19135. *
  19136. * **Note:** This method is used instead of
  19137. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  19138. * returned.
  19139. *
  19140. * @static
  19141. * @memberOf _
  19142. * @since 3.0.0
  19143. * @category Array
  19144. * @param {Array} array The array to slice.
  19145. * @param {number} [start=0] The start position.
  19146. * @param {number} [end=array.length] The end position.
  19147. * @returns {Array} Returns the slice of `array`.
  19148. */
  19149. function slice(array, start, end) {
  19150. var length = array == null ? 0 : array.length;
  19151. if (!length) {
  19152. return [];
  19153. }
  19154. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  19155. start = 0;
  19156. end = length;
  19157. }
  19158. else {
  19159. start = start == null ? 0 : toInteger(start);
  19160. end = end === undefined ? length : toInteger(end);
  19161. }
  19162. return baseSlice(array, start, end);
  19163. }
  19164. /**
  19165. * Uses a binary search to determine the lowest index at which `value`
  19166. * should be inserted into `array` in order to maintain its sort order.
  19167. *
  19168. * @static
  19169. * @memberOf _
  19170. * @since 0.1.0
  19171. * @category Array
  19172. * @param {Array} array The sorted array to inspect.
  19173. * @param {*} value The value to evaluate.
  19174. * @returns {number} Returns the index at which `value` should be inserted
  19175. * into `array`.
  19176. * @example
  19177. *
  19178. * _.sortedIndex([30, 50], 40);
  19179. * // => 1
  19180. */
  19181. function sortedIndex(array, value) {
  19182. return baseSortedIndex(array, value);
  19183. }
  19184. /**
  19185. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  19186. * which is invoked for `value` and each element of `array` to compute their
  19187. * sort ranking. The iteratee is invoked with one argument: (value).
  19188. *
  19189. * @static
  19190. * @memberOf _
  19191. * @since 4.0.0
  19192. * @category Array
  19193. * @param {Array} array The sorted array to inspect.
  19194. * @param {*} value The value to evaluate.
  19195. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19196. * @returns {number} Returns the index at which `value` should be inserted
  19197. * into `array`.
  19198. * @example
  19199. *
  19200. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  19201. *
  19202. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  19203. * // => 0
  19204. *
  19205. * // The `_.property` iteratee shorthand.
  19206. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  19207. * // => 0
  19208. */
  19209. function sortedIndexBy(array, value, iteratee) {
  19210. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  19211. }
  19212. /**
  19213. * This method is like `_.indexOf` except that it performs a binary
  19214. * search on a sorted `array`.
  19215. *
  19216. * @static
  19217. * @memberOf _
  19218. * @since 4.0.0
  19219. * @category Array
  19220. * @param {Array} array The array to inspect.
  19221. * @param {*} value The value to search for.
  19222. * @returns {number} Returns the index of the matched value, else `-1`.
  19223. * @example
  19224. *
  19225. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  19226. * // => 1
  19227. */
  19228. function sortedIndexOf(array, value) {
  19229. var length = array == null ? 0 : array.length;
  19230. if (length) {
  19231. var index = baseSortedIndex(array, value);
  19232. if (index < length && eq(array[index], value)) {
  19233. return index;
  19234. }
  19235. }
  19236. return -1;
  19237. }
  19238. /**
  19239. * This method is like `_.sortedIndex` except that it returns the highest
  19240. * index at which `value` should be inserted into `array` in order to
  19241. * maintain its sort order.
  19242. *
  19243. * @static
  19244. * @memberOf _
  19245. * @since 3.0.0
  19246. * @category Array
  19247. * @param {Array} array The sorted array to inspect.
  19248. * @param {*} value The value to evaluate.
  19249. * @returns {number} Returns the index at which `value` should be inserted
  19250. * into `array`.
  19251. * @example
  19252. *
  19253. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  19254. * // => 4
  19255. */
  19256. function sortedLastIndex(array, value) {
  19257. return baseSortedIndex(array, value, true);
  19258. }
  19259. /**
  19260. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  19261. * which is invoked for `value` and each element of `array` to compute their
  19262. * sort ranking. The iteratee is invoked with one argument: (value).
  19263. *
  19264. * @static
  19265. * @memberOf _
  19266. * @since 4.0.0
  19267. * @category Array
  19268. * @param {Array} array The sorted array to inspect.
  19269. * @param {*} value The value to evaluate.
  19270. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19271. * @returns {number} Returns the index at which `value` should be inserted
  19272. * into `array`.
  19273. * @example
  19274. *
  19275. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  19276. *
  19277. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  19278. * // => 1
  19279. *
  19280. * // The `_.property` iteratee shorthand.
  19281. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  19282. * // => 1
  19283. */
  19284. function sortedLastIndexBy(array, value, iteratee) {
  19285. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  19286. }
  19287. /**
  19288. * This method is like `_.lastIndexOf` except that it performs a binary
  19289. * search on a sorted `array`.
  19290. *
  19291. * @static
  19292. * @memberOf _
  19293. * @since 4.0.0
  19294. * @category Array
  19295. * @param {Array} array The array to inspect.
  19296. * @param {*} value The value to search for.
  19297. * @returns {number} Returns the index of the matched value, else `-1`.
  19298. * @example
  19299. *
  19300. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  19301. * // => 3
  19302. */
  19303. function sortedLastIndexOf(array, value) {
  19304. var length = array == null ? 0 : array.length;
  19305. if (length) {
  19306. var index = baseSortedIndex(array, value, true) - 1;
  19307. if (eq(array[index], value)) {
  19308. return index;
  19309. }
  19310. }
  19311. return -1;
  19312. }
  19313. /**
  19314. * This method is like `_.uniq` except that it's designed and optimized
  19315. * for sorted arrays.
  19316. *
  19317. * @static
  19318. * @memberOf _
  19319. * @since 4.0.0
  19320. * @category Array
  19321. * @param {Array} array The array to inspect.
  19322. * @returns {Array} Returns the new duplicate free array.
  19323. * @example
  19324. *
  19325. * _.sortedUniq([1, 1, 2]);
  19326. * // => [1, 2]
  19327. */
  19328. function sortedUniq(array) {
  19329. return (array && array.length)
  19330. ? baseSortedUniq(array)
  19331. : [];
  19332. }
  19333. /**
  19334. * This method is like `_.uniqBy` except that it's designed and optimized
  19335. * for sorted arrays.
  19336. *
  19337. * @static
  19338. * @memberOf _
  19339. * @since 4.0.0
  19340. * @category Array
  19341. * @param {Array} array The array to inspect.
  19342. * @param {Function} [iteratee] The iteratee invoked per element.
  19343. * @returns {Array} Returns the new duplicate free array.
  19344. * @example
  19345. *
  19346. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  19347. * // => [1.1, 2.3]
  19348. */
  19349. function sortedUniqBy(array, iteratee) {
  19350. return (array && array.length)
  19351. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  19352. : [];
  19353. }
  19354. /**
  19355. * Gets all but the first element of `array`.
  19356. *
  19357. * @static
  19358. * @memberOf _
  19359. * @since 4.0.0
  19360. * @category Array
  19361. * @param {Array} array The array to query.
  19362. * @returns {Array} Returns the slice of `array`.
  19363. * @example
  19364. *
  19365. * _.tail([1, 2, 3]);
  19366. * // => [2, 3]
  19367. */
  19368. function tail(array) {
  19369. var length = array == null ? 0 : array.length;
  19370. return length ? baseSlice(array, 1, length) : [];
  19371. }
  19372. /**
  19373. * Creates a slice of `array` with `n` elements taken from the beginning.
  19374. *
  19375. * @static
  19376. * @memberOf _
  19377. * @since 0.1.0
  19378. * @category Array
  19379. * @param {Array} array The array to query.
  19380. * @param {number} [n=1] The number of elements to take.
  19381. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  19382. * @returns {Array} Returns the slice of `array`.
  19383. * @example
  19384. *
  19385. * _.take([1, 2, 3]);
  19386. * // => [1]
  19387. *
  19388. * _.take([1, 2, 3], 2);
  19389. * // => [1, 2]
  19390. *
  19391. * _.take([1, 2, 3], 5);
  19392. * // => [1, 2, 3]
  19393. *
  19394. * _.take([1, 2, 3], 0);
  19395. * // => []
  19396. */
  19397. function take(array, n, guard) {
  19398. if (!(array && array.length)) {
  19399. return [];
  19400. }
  19401. n = (guard || n === undefined) ? 1 : toInteger(n);
  19402. return baseSlice(array, 0, n < 0 ? 0 : n);
  19403. }
  19404. /**
  19405. * Creates a slice of `array` with `n` elements taken from the end.
  19406. *
  19407. * @static
  19408. * @memberOf _
  19409. * @since 3.0.0
  19410. * @category Array
  19411. * @param {Array} array The array to query.
  19412. * @param {number} [n=1] The number of elements to take.
  19413. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  19414. * @returns {Array} Returns the slice of `array`.
  19415. * @example
  19416. *
  19417. * _.takeRight([1, 2, 3]);
  19418. * // => [3]
  19419. *
  19420. * _.takeRight([1, 2, 3], 2);
  19421. * // => [2, 3]
  19422. *
  19423. * _.takeRight([1, 2, 3], 5);
  19424. * // => [1, 2, 3]
  19425. *
  19426. * _.takeRight([1, 2, 3], 0);
  19427. * // => []
  19428. */
  19429. function takeRight(array, n, guard) {
  19430. var length = array == null ? 0 : array.length;
  19431. if (!length) {
  19432. return [];
  19433. }
  19434. n = (guard || n === undefined) ? 1 : toInteger(n);
  19435. n = length - n;
  19436. return baseSlice(array, n < 0 ? 0 : n, length);
  19437. }
  19438. /**
  19439. * Creates a slice of `array` with elements taken from the end. Elements are
  19440. * taken until `predicate` returns falsey. The predicate is invoked with
  19441. * three arguments: (value, index, array).
  19442. *
  19443. * @static
  19444. * @memberOf _
  19445. * @since 3.0.0
  19446. * @category Array
  19447. * @param {Array} array The array to query.
  19448. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  19449. * @returns {Array} Returns the slice of `array`.
  19450. * @example
  19451. *
  19452. * var users = [
  19453. * { 'user': 'barney', 'active': true },
  19454. * { 'user': 'fred', 'active': false },
  19455. * { 'user': 'pebbles', 'active': false }
  19456. * ];
  19457. *
  19458. * _.takeRightWhile(users, function(o) { return !o.active; });
  19459. * // => objects for ['fred', 'pebbles']
  19460. *
  19461. * // The `_.matches` iteratee shorthand.
  19462. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  19463. * // => objects for ['pebbles']
  19464. *
  19465. * // The `_.matchesProperty` iteratee shorthand.
  19466. * _.takeRightWhile(users, ['active', false]);
  19467. * // => objects for ['fred', 'pebbles']
  19468. *
  19469. * // The `_.property` iteratee shorthand.
  19470. * _.takeRightWhile(users, 'active');
  19471. * // => []
  19472. */
  19473. function takeRightWhile(array, predicate) {
  19474. return (array && array.length)
  19475. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  19476. : [];
  19477. }
  19478. /**
  19479. * Creates a slice of `array` with elements taken from the beginning. Elements
  19480. * are taken until `predicate` returns falsey. The predicate is invoked with
  19481. * three arguments: (value, index, array).
  19482. *
  19483. * @static
  19484. * @memberOf _
  19485. * @since 3.0.0
  19486. * @category Array
  19487. * @param {Array} array The array to query.
  19488. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  19489. * @returns {Array} Returns the slice of `array`.
  19490. * @example
  19491. *
  19492. * var users = [
  19493. * { 'user': 'barney', 'active': false },
  19494. * { 'user': 'fred', 'active': false },
  19495. * { 'user': 'pebbles', 'active': true }
  19496. * ];
  19497. *
  19498. * _.takeWhile(users, function(o) { return !o.active; });
  19499. * // => objects for ['barney', 'fred']
  19500. *
  19501. * // The `_.matches` iteratee shorthand.
  19502. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  19503. * // => objects for ['barney']
  19504. *
  19505. * // The `_.matchesProperty` iteratee shorthand.
  19506. * _.takeWhile(users, ['active', false]);
  19507. * // => objects for ['barney', 'fred']
  19508. *
  19509. * // The `_.property` iteratee shorthand.
  19510. * _.takeWhile(users, 'active');
  19511. * // => []
  19512. */
  19513. function takeWhile(array, predicate) {
  19514. return (array && array.length)
  19515. ? baseWhile(array, getIteratee(predicate, 3))
  19516. : [];
  19517. }
  19518. /**
  19519. * Creates an array of unique values, in order, from all given arrays using
  19520. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19521. * for equality comparisons.
  19522. *
  19523. * @static
  19524. * @memberOf _
  19525. * @since 0.1.0
  19526. * @category Array
  19527. * @param {...Array} [arrays] The arrays to inspect.
  19528. * @returns {Array} Returns the new array of combined values.
  19529. * @example
  19530. *
  19531. * _.union([2], [1, 2]);
  19532. * // => [2, 1]
  19533. */
  19534. var union = baseRest(function(arrays) {
  19535. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  19536. });
  19537. /**
  19538. * This method is like `_.union` except that it accepts `iteratee` which is
  19539. * invoked for each element of each `arrays` to generate the criterion by
  19540. * which uniqueness is computed. Result values are chosen from the first
  19541. * array in which the value occurs. The iteratee is invoked with one argument:
  19542. * (value).
  19543. *
  19544. * @static
  19545. * @memberOf _
  19546. * @since 4.0.0
  19547. * @category Array
  19548. * @param {...Array} [arrays] The arrays to inspect.
  19549. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19550. * @returns {Array} Returns the new array of combined values.
  19551. * @example
  19552. *
  19553. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  19554. * // => [2.1, 1.2]
  19555. *
  19556. * // The `_.property` iteratee shorthand.
  19557. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  19558. * // => [{ 'x': 1 }, { 'x': 2 }]
  19559. */
  19560. var unionBy = baseRest(function(arrays) {
  19561. var iteratee = last(arrays);
  19562. if (isArrayLikeObject(iteratee)) {
  19563. iteratee = undefined;
  19564. }
  19565. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  19566. });
  19567. /**
  19568. * This method is like `_.union` except that it accepts `comparator` which
  19569. * is invoked to compare elements of `arrays`. Result values are chosen from
  19570. * the first array in which the value occurs. The comparator is invoked
  19571. * with two arguments: (arrVal, othVal).
  19572. *
  19573. * @static
  19574. * @memberOf _
  19575. * @since 4.0.0
  19576. * @category Array
  19577. * @param {...Array} [arrays] The arrays to inspect.
  19578. * @param {Function} [comparator] The comparator invoked per element.
  19579. * @returns {Array} Returns the new array of combined values.
  19580. * @example
  19581. *
  19582. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  19583. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  19584. *
  19585. * _.unionWith(objects, others, _.isEqual);
  19586. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  19587. */
  19588. var unionWith = baseRest(function(arrays) {
  19589. var comparator = last(arrays);
  19590. comparator = typeof comparator == 'function' ? comparator : undefined;
  19591. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  19592. });
  19593. /**
  19594. * Creates a duplicate-free version of an array, using
  19595. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19596. * for equality comparisons, in which only the first occurrence of each element
  19597. * is kept. The order of result values is determined by the order they occur
  19598. * in the array.
  19599. *
  19600. * @static
  19601. * @memberOf _
  19602. * @since 0.1.0
  19603. * @category Array
  19604. * @param {Array} array The array to inspect.
  19605. * @returns {Array} Returns the new duplicate free array.
  19606. * @example
  19607. *
  19608. * _.uniq([2, 1, 2]);
  19609. * // => [2, 1]
  19610. */
  19611. function uniq(array) {
  19612. return (array && array.length) ? baseUniq(array) : [];
  19613. }
  19614. /**
  19615. * This method is like `_.uniq` except that it accepts `iteratee` which is
  19616. * invoked for each element in `array` to generate the criterion by which
  19617. * uniqueness is computed. The order of result values is determined by the
  19618. * order they occur in the array. The iteratee is invoked with one argument:
  19619. * (value).
  19620. *
  19621. * @static
  19622. * @memberOf _
  19623. * @since 4.0.0
  19624. * @category Array
  19625. * @param {Array} array The array to inspect.
  19626. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19627. * @returns {Array} Returns the new duplicate free array.
  19628. * @example
  19629. *
  19630. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  19631. * // => [2.1, 1.2]
  19632. *
  19633. * // The `_.property` iteratee shorthand.
  19634. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  19635. * // => [{ 'x': 1 }, { 'x': 2 }]
  19636. */
  19637. function uniqBy(array, iteratee) {
  19638. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  19639. }
  19640. /**
  19641. * This method is like `_.uniq` except that it accepts `comparator` which
  19642. * is invoked to compare elements of `array`. The order of result values is
  19643. * determined by the order they occur in the array.The comparator is invoked
  19644. * with two arguments: (arrVal, othVal).
  19645. *
  19646. * @static
  19647. * @memberOf _
  19648. * @since 4.0.0
  19649. * @category Array
  19650. * @param {Array} array The array to inspect.
  19651. * @param {Function} [comparator] The comparator invoked per element.
  19652. * @returns {Array} Returns the new duplicate free array.
  19653. * @example
  19654. *
  19655. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  19656. *
  19657. * _.uniqWith(objects, _.isEqual);
  19658. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  19659. */
  19660. function uniqWith(array, comparator) {
  19661. comparator = typeof comparator == 'function' ? comparator : undefined;
  19662. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  19663. }
  19664. /**
  19665. * This method is like `_.zip` except that it accepts an array of grouped
  19666. * elements and creates an array regrouping the elements to their pre-zip
  19667. * configuration.
  19668. *
  19669. * @static
  19670. * @memberOf _
  19671. * @since 1.2.0
  19672. * @category Array
  19673. * @param {Array} array The array of grouped elements to process.
  19674. * @returns {Array} Returns the new array of regrouped elements.
  19675. * @example
  19676. *
  19677. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  19678. * // => [['a', 1, true], ['b', 2, false]]
  19679. *
  19680. * _.unzip(zipped);
  19681. * // => [['a', 'b'], [1, 2], [true, false]]
  19682. */
  19683. function unzip(array) {
  19684. if (!(array && array.length)) {
  19685. return [];
  19686. }
  19687. var length = 0;
  19688. array = arrayFilter(array, function(group) {
  19689. if (isArrayLikeObject(group)) {
  19690. length = nativeMax(group.length, length);
  19691. return true;
  19692. }
  19693. });
  19694. return baseTimes(length, function(index) {
  19695. return arrayMap(array, baseProperty(index));
  19696. });
  19697. }
  19698. /**
  19699. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  19700. * how regrouped values should be combined. The iteratee is invoked with the
  19701. * elements of each group: (...group).
  19702. *
  19703. * @static
  19704. * @memberOf _
  19705. * @since 3.8.0
  19706. * @category Array
  19707. * @param {Array} array The array of grouped elements to process.
  19708. * @param {Function} [iteratee=_.identity] The function to combine
  19709. * regrouped values.
  19710. * @returns {Array} Returns the new array of regrouped elements.
  19711. * @example
  19712. *
  19713. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  19714. * // => [[1, 10, 100], [2, 20, 200]]
  19715. *
  19716. * _.unzipWith(zipped, _.add);
  19717. * // => [3, 30, 300]
  19718. */
  19719. function unzipWith(array, iteratee) {
  19720. if (!(array && array.length)) {
  19721. return [];
  19722. }
  19723. var result = unzip(array);
  19724. if (iteratee == null) {
  19725. return result;
  19726. }
  19727. return arrayMap(result, function(group) {
  19728. return apply(iteratee, undefined, group);
  19729. });
  19730. }
  19731. /**
  19732. * Creates an array excluding all given values using
  19733. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19734. * for equality comparisons.
  19735. *
  19736. * **Note:** Unlike `_.pull`, this method returns a new array.
  19737. *
  19738. * @static
  19739. * @memberOf _
  19740. * @since 0.1.0
  19741. * @category Array
  19742. * @param {Array} array The array to inspect.
  19743. * @param {...*} [values] The values to exclude.
  19744. * @returns {Array} Returns the new array of filtered values.
  19745. * @see _.difference, _.xor
  19746. * @example
  19747. *
  19748. * _.without([2, 1, 2, 3], 1, 2);
  19749. * // => [3]
  19750. */
  19751. var without = baseRest(function(array, values) {
  19752. return isArrayLikeObject(array)
  19753. ? baseDifference(array, values)
  19754. : [];
  19755. });
  19756. /**
  19757. * Creates an array of unique values that is the
  19758. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  19759. * of the given arrays. The order of result values is determined by the order
  19760. * they occur in the arrays.
  19761. *
  19762. * @static
  19763. * @memberOf _
  19764. * @since 2.4.0
  19765. * @category Array
  19766. * @param {...Array} [arrays] The arrays to inspect.
  19767. * @returns {Array} Returns the new array of filtered values.
  19768. * @see _.difference, _.without
  19769. * @example
  19770. *
  19771. * _.xor([2, 1], [2, 3]);
  19772. * // => [1, 3]
  19773. */
  19774. var xor = baseRest(function(arrays) {
  19775. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  19776. });
  19777. /**
  19778. * This method is like `_.xor` except that it accepts `iteratee` which is
  19779. * invoked for each element of each `arrays` to generate the criterion by
  19780. * which by which they're compared. The order of result values is determined
  19781. * by the order they occur in the arrays. The iteratee is invoked with one
  19782. * argument: (value).
  19783. *
  19784. * @static
  19785. * @memberOf _
  19786. * @since 4.0.0
  19787. * @category Array
  19788. * @param {...Array} [arrays] The arrays to inspect.
  19789. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19790. * @returns {Array} Returns the new array of filtered values.
  19791. * @example
  19792. *
  19793. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  19794. * // => [1.2, 3.4]
  19795. *
  19796. * // The `_.property` iteratee shorthand.
  19797. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  19798. * // => [{ 'x': 2 }]
  19799. */
  19800. var xorBy = baseRest(function(arrays) {
  19801. var iteratee = last(arrays);
  19802. if (isArrayLikeObject(iteratee)) {
  19803. iteratee = undefined;
  19804. }
  19805. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  19806. });
  19807. /**
  19808. * This method is like `_.xor` except that it accepts `comparator` which is
  19809. * invoked to compare elements of `arrays`. The order of result values is
  19810. * determined by the order they occur in the arrays. The comparator is invoked
  19811. * with two arguments: (arrVal, othVal).
  19812. *
  19813. * @static
  19814. * @memberOf _
  19815. * @since 4.0.0
  19816. * @category Array
  19817. * @param {...Array} [arrays] The arrays to inspect.
  19818. * @param {Function} [comparator] The comparator invoked per element.
  19819. * @returns {Array} Returns the new array of filtered values.
  19820. * @example
  19821. *
  19822. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  19823. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  19824. *
  19825. * _.xorWith(objects, others, _.isEqual);
  19826. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  19827. */
  19828. var xorWith = baseRest(function(arrays) {
  19829. var comparator = last(arrays);
  19830. comparator = typeof comparator == 'function' ? comparator : undefined;
  19831. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  19832. });
  19833. /**
  19834. * Creates an array of grouped elements, the first of which contains the
  19835. * first elements of the given arrays, the second of which contains the
  19836. * second elements of the given arrays, and so on.
  19837. *
  19838. * @static
  19839. * @memberOf _
  19840. * @since 0.1.0
  19841. * @category Array
  19842. * @param {...Array} [arrays] The arrays to process.
  19843. * @returns {Array} Returns the new array of grouped elements.
  19844. * @example
  19845. *
  19846. * _.zip(['a', 'b'], [1, 2], [true, false]);
  19847. * // => [['a', 1, true], ['b', 2, false]]
  19848. */
  19849. var zip = baseRest(unzip);
  19850. /**
  19851. * This method is like `_.fromPairs` except that it accepts two arrays,
  19852. * one of property identifiers and one of corresponding values.
  19853. *
  19854. * @static
  19855. * @memberOf _
  19856. * @since 0.4.0
  19857. * @category Array
  19858. * @param {Array} [props=[]] The property identifiers.
  19859. * @param {Array} [values=[]] The property values.
  19860. * @returns {Object} Returns the new object.
  19861. * @example
  19862. *
  19863. * _.zipObject(['a', 'b'], [1, 2]);
  19864. * // => { 'a': 1, 'b': 2 }
  19865. */
  19866. function zipObject(props, values) {
  19867. return baseZipObject(props || [], values || [], assignValue);
  19868. }
  19869. /**
  19870. * This method is like `_.zipObject` except that it supports property paths.
  19871. *
  19872. * @static
  19873. * @memberOf _
  19874. * @since 4.1.0
  19875. * @category Array
  19876. * @param {Array} [props=[]] The property identifiers.
  19877. * @param {Array} [values=[]] The property values.
  19878. * @returns {Object} Returns the new object.
  19879. * @example
  19880. *
  19881. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  19882. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  19883. */
  19884. function zipObjectDeep(props, values) {
  19885. return baseZipObject(props || [], values || [], baseSet);
  19886. }
  19887. /**
  19888. * This method is like `_.zip` except that it accepts `iteratee` to specify
  19889. * how grouped values should be combined. The iteratee is invoked with the
  19890. * elements of each group: (...group).
  19891. *
  19892. * @static
  19893. * @memberOf _
  19894. * @since 3.8.0
  19895. * @category Array
  19896. * @param {...Array} [arrays] The arrays to process.
  19897. * @param {Function} [iteratee=_.identity] The function to combine
  19898. * grouped values.
  19899. * @returns {Array} Returns the new array of grouped elements.
  19900. * @example
  19901. *
  19902. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  19903. * return a + b + c;
  19904. * });
  19905. * // => [111, 222]
  19906. */
  19907. var zipWith = baseRest(function(arrays) {
  19908. var length = arrays.length,
  19909. iteratee = length > 1 ? arrays[length - 1] : undefined;
  19910. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  19911. return unzipWith(arrays, iteratee);
  19912. });
  19913. /*------------------------------------------------------------------------*/
  19914. /**
  19915. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  19916. * chain sequences enabled. The result of such sequences must be unwrapped
  19917. * with `_#value`.
  19918. *
  19919. * @static
  19920. * @memberOf _
  19921. * @since 1.3.0
  19922. * @category Seq
  19923. * @param {*} value The value to wrap.
  19924. * @returns {Object} Returns the new `lodash` wrapper instance.
  19925. * @example
  19926. *
  19927. * var users = [
  19928. * { 'user': 'barney', 'age': 36 },
  19929. * { 'user': 'fred', 'age': 40 },
  19930. * { 'user': 'pebbles', 'age': 1 }
  19931. * ];
  19932. *
  19933. * var youngest = _
  19934. * .chain(users)
  19935. * .sortBy('age')
  19936. * .map(function(o) {
  19937. * return o.user + ' is ' + o.age;
  19938. * })
  19939. * .head()
  19940. * .value();
  19941. * // => 'pebbles is 1'
  19942. */
  19943. function chain(value) {
  19944. var result = lodash(value);
  19945. result.__chain__ = true;
  19946. return result;
  19947. }
  19948. /**
  19949. * This method invokes `interceptor` and returns `value`. The interceptor
  19950. * is invoked with one argument; (value). The purpose of this method is to
  19951. * "tap into" a method chain sequence in order to modify intermediate results.
  19952. *
  19953. * @static
  19954. * @memberOf _
  19955. * @since 0.1.0
  19956. * @category Seq
  19957. * @param {*} value The value to provide to `interceptor`.
  19958. * @param {Function} interceptor The function to invoke.
  19959. * @returns {*} Returns `value`.
  19960. * @example
  19961. *
  19962. * _([1, 2, 3])
  19963. * .tap(function(array) {
  19964. * // Mutate input array.
  19965. * array.pop();
  19966. * })
  19967. * .reverse()
  19968. * .value();
  19969. * // => [2, 1]
  19970. */
  19971. function tap(value, interceptor) {
  19972. interceptor(value);
  19973. return value;
  19974. }
  19975. /**
  19976. * This method is like `_.tap` except that it returns the result of `interceptor`.
  19977. * The purpose of this method is to "pass thru" values replacing intermediate
  19978. * results in a method chain sequence.
  19979. *
  19980. * @static
  19981. * @memberOf _
  19982. * @since 3.0.0
  19983. * @category Seq
  19984. * @param {*} value The value to provide to `interceptor`.
  19985. * @param {Function} interceptor The function to invoke.
  19986. * @returns {*} Returns the result of `interceptor`.
  19987. * @example
  19988. *
  19989. * _(' abc ')
  19990. * .chain()
  19991. * .trim()
  19992. * .thru(function(value) {
  19993. * return [value];
  19994. * })
  19995. * .value();
  19996. * // => ['abc']
  19997. */
  19998. function thru(value, interceptor) {
  19999. return interceptor(value);
  20000. }
  20001. /**
  20002. * This method is the wrapper version of `_.at`.
  20003. *
  20004. * @name at
  20005. * @memberOf _
  20006. * @since 1.0.0
  20007. * @category Seq
  20008. * @param {...(string|string[])} [paths] The property paths to pick.
  20009. * @returns {Object} Returns the new `lodash` wrapper instance.
  20010. * @example
  20011. *
  20012. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  20013. *
  20014. * _(object).at(['a[0].b.c', 'a[1]']).value();
  20015. * // => [3, 4]
  20016. */
  20017. var wrapperAt = flatRest(function(paths) {
  20018. var length = paths.length,
  20019. start = length ? paths[0] : 0,
  20020. value = this.__wrapped__,
  20021. interceptor = function(object) { return baseAt(object, paths); };
  20022. if (length > 1 || this.__actions__.length ||
  20023. !(value instanceof LazyWrapper) || !isIndex(start)) {
  20024. return this.thru(interceptor);
  20025. }
  20026. value = value.slice(start, +start + (length ? 1 : 0));
  20027. value.__actions__.push({
  20028. 'func': thru,
  20029. 'args': [interceptor],
  20030. 'thisArg': undefined
  20031. });
  20032. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  20033. if (length && !array.length) {
  20034. array.push(undefined);
  20035. }
  20036. return array;
  20037. });
  20038. });
  20039. /**
  20040. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  20041. *
  20042. * @name chain
  20043. * @memberOf _
  20044. * @since 0.1.0
  20045. * @category Seq
  20046. * @returns {Object} Returns the new `lodash` wrapper instance.
  20047. * @example
  20048. *
  20049. * var users = [
  20050. * { 'user': 'barney', 'age': 36 },
  20051. * { 'user': 'fred', 'age': 40 }
  20052. * ];
  20053. *
  20054. * // A sequence without explicit chaining.
  20055. * _(users).head();
  20056. * // => { 'user': 'barney', 'age': 36 }
  20057. *
  20058. * // A sequence with explicit chaining.
  20059. * _(users)
  20060. * .chain()
  20061. * .head()
  20062. * .pick('user')
  20063. * .value();
  20064. * // => { 'user': 'barney' }
  20065. */
  20066. function wrapperChain() {
  20067. return chain(this);
  20068. }
  20069. /**
  20070. * Executes the chain sequence and returns the wrapped result.
  20071. *
  20072. * @name commit
  20073. * @memberOf _
  20074. * @since 3.2.0
  20075. * @category Seq
  20076. * @returns {Object} Returns the new `lodash` wrapper instance.
  20077. * @example
  20078. *
  20079. * var array = [1, 2];
  20080. * var wrapped = _(array).push(3);
  20081. *
  20082. * console.log(array);
  20083. * // => [1, 2]
  20084. *
  20085. * wrapped = wrapped.commit();
  20086. * console.log(array);
  20087. * // => [1, 2, 3]
  20088. *
  20089. * wrapped.last();
  20090. * // => 3
  20091. *
  20092. * console.log(array);
  20093. * // => [1, 2, 3]
  20094. */
  20095. function wrapperCommit() {
  20096. return new LodashWrapper(this.value(), this.__chain__);
  20097. }
  20098. /**
  20099. * Gets the next value on a wrapped object following the
  20100. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  20101. *
  20102. * @name next
  20103. * @memberOf _
  20104. * @since 4.0.0
  20105. * @category Seq
  20106. * @returns {Object} Returns the next iterator value.
  20107. * @example
  20108. *
  20109. * var wrapped = _([1, 2]);
  20110. *
  20111. * wrapped.next();
  20112. * // => { 'done': false, 'value': 1 }
  20113. *
  20114. * wrapped.next();
  20115. * // => { 'done': false, 'value': 2 }
  20116. *
  20117. * wrapped.next();
  20118. * // => { 'done': true, 'value': undefined }
  20119. */
  20120. function wrapperNext() {
  20121. if (this.__values__ === undefined) {
  20122. this.__values__ = toArray(this.value());
  20123. }
  20124. var done = this.__index__ >= this.__values__.length,
  20125. value = done ? undefined : this.__values__[this.__index__++];
  20126. return { 'done': done, 'value': value };
  20127. }
  20128. /**
  20129. * Enables the wrapper to be iterable.
  20130. *
  20131. * @name Symbol.iterator
  20132. * @memberOf _
  20133. * @since 4.0.0
  20134. * @category Seq
  20135. * @returns {Object} Returns the wrapper object.
  20136. * @example
  20137. *
  20138. * var wrapped = _([1, 2]);
  20139. *
  20140. * wrapped[Symbol.iterator]() === wrapped;
  20141. * // => true
  20142. *
  20143. * Array.from(wrapped);
  20144. * // => [1, 2]
  20145. */
  20146. function wrapperToIterator() {
  20147. return this;
  20148. }
  20149. /**
  20150. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  20151. *
  20152. * @name plant
  20153. * @memberOf _
  20154. * @since 3.2.0
  20155. * @category Seq
  20156. * @param {*} value The value to plant.
  20157. * @returns {Object} Returns the new `lodash` wrapper instance.
  20158. * @example
  20159. *
  20160. * function square(n) {
  20161. * return n * n;
  20162. * }
  20163. *
  20164. * var wrapped = _([1, 2]).map(square);
  20165. * var other = wrapped.plant([3, 4]);
  20166. *
  20167. * other.value();
  20168. * // => [9, 16]
  20169. *
  20170. * wrapped.value();
  20171. * // => [1, 4]
  20172. */
  20173. function wrapperPlant(value) {
  20174. var result,
  20175. parent = this;
  20176. while (parent instanceof baseLodash) {
  20177. var clone = wrapperClone(parent);
  20178. clone.__index__ = 0;
  20179. clone.__values__ = undefined;
  20180. if (result) {
  20181. previous.__wrapped__ = clone;
  20182. } else {
  20183. result = clone;
  20184. }
  20185. var previous = clone;
  20186. parent = parent.__wrapped__;
  20187. }
  20188. previous.__wrapped__ = value;
  20189. return result;
  20190. }
  20191. /**
  20192. * This method is the wrapper version of `_.reverse`.
  20193. *
  20194. * **Note:** This method mutates the wrapped array.
  20195. *
  20196. * @name reverse
  20197. * @memberOf _
  20198. * @since 0.1.0
  20199. * @category Seq
  20200. * @returns {Object} Returns the new `lodash` wrapper instance.
  20201. * @example
  20202. *
  20203. * var array = [1, 2, 3];
  20204. *
  20205. * _(array).reverse().value()
  20206. * // => [3, 2, 1]
  20207. *
  20208. * console.log(array);
  20209. * // => [3, 2, 1]
  20210. */
  20211. function wrapperReverse() {
  20212. var value = this.__wrapped__;
  20213. if (value instanceof LazyWrapper) {
  20214. var wrapped = value;
  20215. if (this.__actions__.length) {
  20216. wrapped = new LazyWrapper(this);
  20217. }
  20218. wrapped = wrapped.reverse();
  20219. wrapped.__actions__.push({
  20220. 'func': thru,
  20221. 'args': [reverse],
  20222. 'thisArg': undefined
  20223. });
  20224. return new LodashWrapper(wrapped, this.__chain__);
  20225. }
  20226. return this.thru(reverse);
  20227. }
  20228. /**
  20229. * Executes the chain sequence to resolve the unwrapped value.
  20230. *
  20231. * @name value
  20232. * @memberOf _
  20233. * @since 0.1.0
  20234. * @alias toJSON, valueOf
  20235. * @category Seq
  20236. * @returns {*} Returns the resolved unwrapped value.
  20237. * @example
  20238. *
  20239. * _([1, 2, 3]).value();
  20240. * // => [1, 2, 3]
  20241. */
  20242. function wrapperValue() {
  20243. return baseWrapperValue(this.__wrapped__, this.__actions__);
  20244. }
  20245. /*------------------------------------------------------------------------*/
  20246. /**
  20247. * Creates an object composed of keys generated from the results of running
  20248. * each element of `collection` thru `iteratee`. The corresponding value of
  20249. * each key is the number of times the key was returned by `iteratee`. The
  20250. * iteratee is invoked with one argument: (value).
  20251. *
  20252. * @static
  20253. * @memberOf _
  20254. * @since 0.5.0
  20255. * @category Collection
  20256. * @param {Array|Object} collection The collection to iterate over.
  20257. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  20258. * @returns {Object} Returns the composed aggregate object.
  20259. * @example
  20260. *
  20261. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  20262. * // => { '4': 1, '6': 2 }
  20263. *
  20264. * // The `_.property` iteratee shorthand.
  20265. * _.countBy(['one', 'two', 'three'], 'length');
  20266. * // => { '3': 2, '5': 1 }
  20267. */
  20268. var countBy = createAggregator(function(result, value, key) {
  20269. if (hasOwnProperty.call(result, key)) {
  20270. ++result[key];
  20271. } else {
  20272. baseAssignValue(result, key, 1);
  20273. }
  20274. });
  20275. /**
  20276. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  20277. * Iteration is stopped once `predicate` returns falsey. The predicate is
  20278. * invoked with three arguments: (value, index|key, collection).
  20279. *
  20280. * **Note:** This method returns `true` for
  20281. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  20282. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  20283. * elements of empty collections.
  20284. *
  20285. * @static
  20286. * @memberOf _
  20287. * @since 0.1.0
  20288. * @category Collection
  20289. * @param {Array|Object} collection The collection to iterate over.
  20290. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20291. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20292. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20293. * else `false`.
  20294. * @example
  20295. *
  20296. * _.every([true, 1, null, 'yes'], Boolean);
  20297. * // => false
  20298. *
  20299. * var users = [
  20300. * { 'user': 'barney', 'age': 36, 'active': false },
  20301. * { 'user': 'fred', 'age': 40, 'active': false }
  20302. * ];
  20303. *
  20304. * // The `_.matches` iteratee shorthand.
  20305. * _.every(users, { 'user': 'barney', 'active': false });
  20306. * // => false
  20307. *
  20308. * // The `_.matchesProperty` iteratee shorthand.
  20309. * _.every(users, ['active', false]);
  20310. * // => true
  20311. *
  20312. * // The `_.property` iteratee shorthand.
  20313. * _.every(users, 'active');
  20314. * // => false
  20315. */
  20316. function every(collection, predicate, guard) {
  20317. var func = isArray(collection) ? arrayEvery : baseEvery;
  20318. if (guard && isIterateeCall(collection, predicate, guard)) {
  20319. predicate = undefined;
  20320. }
  20321. return func(collection, getIteratee(predicate, 3));
  20322. }
  20323. /**
  20324. * Iterates over elements of `collection`, returning an array of all elements
  20325. * `predicate` returns truthy for. The predicate is invoked with three
  20326. * arguments: (value, index|key, collection).
  20327. *
  20328. * **Note:** Unlike `_.remove`, this method returns a new array.
  20329. *
  20330. * @static
  20331. * @memberOf _
  20332. * @since 0.1.0
  20333. * @category Collection
  20334. * @param {Array|Object} collection The collection to iterate over.
  20335. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20336. * @returns {Array} Returns the new filtered array.
  20337. * @see _.reject
  20338. * @example
  20339. *
  20340. * var users = [
  20341. * { 'user': 'barney', 'age': 36, 'active': true },
  20342. * { 'user': 'fred', 'age': 40, 'active': false }
  20343. * ];
  20344. *
  20345. * _.filter(users, function(o) { return !o.active; });
  20346. * // => objects for ['fred']
  20347. *
  20348. * // The `_.matches` iteratee shorthand.
  20349. * _.filter(users, { 'age': 36, 'active': true });
  20350. * // => objects for ['barney']
  20351. *
  20352. * // The `_.matchesProperty` iteratee shorthand.
  20353. * _.filter(users, ['active', false]);
  20354. * // => objects for ['fred']
  20355. *
  20356. * // The `_.property` iteratee shorthand.
  20357. * _.filter(users, 'active');
  20358. * // => objects for ['barney']
  20359. */
  20360. function filter(collection, predicate) {
  20361. var func = isArray(collection) ? arrayFilter : baseFilter;
  20362. return func(collection, getIteratee(predicate, 3));
  20363. }
  20364. /**
  20365. * Iterates over elements of `collection`, returning the first element
  20366. * `predicate` returns truthy for. The predicate is invoked with three
  20367. * arguments: (value, index|key, collection).
  20368. *
  20369. * @static
  20370. * @memberOf _
  20371. * @since 0.1.0
  20372. * @category Collection
  20373. * @param {Array|Object} collection The collection to inspect.
  20374. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20375. * @param {number} [fromIndex=0] The index to search from.
  20376. * @returns {*} Returns the matched element, else `undefined`.
  20377. * @example
  20378. *
  20379. * var users = [
  20380. * { 'user': 'barney', 'age': 36, 'active': true },
  20381. * { 'user': 'fred', 'age': 40, 'active': false },
  20382. * { 'user': 'pebbles', 'age': 1, 'active': true }
  20383. * ];
  20384. *
  20385. * _.find(users, function(o) { return o.age < 40; });
  20386. * // => object for 'barney'
  20387. *
  20388. * // The `_.matches` iteratee shorthand.
  20389. * _.find(users, { 'age': 1, 'active': true });
  20390. * // => object for 'pebbles'
  20391. *
  20392. * // The `_.matchesProperty` iteratee shorthand.
  20393. * _.find(users, ['active', false]);
  20394. * // => object for 'fred'
  20395. *
  20396. * // The `_.property` iteratee shorthand.
  20397. * _.find(users, 'active');
  20398. * // => object for 'barney'
  20399. */
  20400. var find = createFind(findIndex);
  20401. /**
  20402. * This method is like `_.find` except that it iterates over elements of
  20403. * `collection` from right to left.
  20404. *
  20405. * @static
  20406. * @memberOf _
  20407. * @since 2.0.0
  20408. * @category Collection
  20409. * @param {Array|Object} collection The collection to inspect.
  20410. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20411. * @param {number} [fromIndex=collection.length-1] The index to search from.
  20412. * @returns {*} Returns the matched element, else `undefined`.
  20413. * @example
  20414. *
  20415. * _.findLast([1, 2, 3, 4], function(n) {
  20416. * return n % 2 == 1;
  20417. * });
  20418. * // => 3
  20419. */
  20420. var findLast = createFind(findLastIndex);
  20421. /**
  20422. * Creates a flattened array of values by running each element in `collection`
  20423. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  20424. * with three arguments: (value, index|key, collection).
  20425. *
  20426. * @static
  20427. * @memberOf _
  20428. * @since 4.0.0
  20429. * @category Collection
  20430. * @param {Array|Object} collection The collection to iterate over.
  20431. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20432. * @returns {Array} Returns the new flattened array.
  20433. * @example
  20434. *
  20435. * function duplicate(n) {
  20436. * return [n, n];
  20437. * }
  20438. *
  20439. * _.flatMap([1, 2], duplicate);
  20440. * // => [1, 1, 2, 2]
  20441. */
  20442. function flatMap(collection, iteratee) {
  20443. return baseFlatten(map(collection, iteratee), 1);
  20444. }
  20445. /**
  20446. * This method is like `_.flatMap` except that it recursively flattens the
  20447. * mapped results.
  20448. *
  20449. * @static
  20450. * @memberOf _
  20451. * @since 4.7.0
  20452. * @category Collection
  20453. * @param {Array|Object} collection The collection to iterate over.
  20454. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20455. * @returns {Array} Returns the new flattened array.
  20456. * @example
  20457. *
  20458. * function duplicate(n) {
  20459. * return [[[n, n]]];
  20460. * }
  20461. *
  20462. * _.flatMapDeep([1, 2], duplicate);
  20463. * // => [1, 1, 2, 2]
  20464. */
  20465. function flatMapDeep(collection, iteratee) {
  20466. return baseFlatten(map(collection, iteratee), INFINITY);
  20467. }
  20468. /**
  20469. * This method is like `_.flatMap` except that it recursively flattens the
  20470. * mapped results up to `depth` times.
  20471. *
  20472. * @static
  20473. * @memberOf _
  20474. * @since 4.7.0
  20475. * @category Collection
  20476. * @param {Array|Object} collection The collection to iterate over.
  20477. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20478. * @param {number} [depth=1] The maximum recursion depth.
  20479. * @returns {Array} Returns the new flattened array.
  20480. * @example
  20481. *
  20482. * function duplicate(n) {
  20483. * return [[[n, n]]];
  20484. * }
  20485. *
  20486. * _.flatMapDepth([1, 2], duplicate, 2);
  20487. * // => [[1, 1], [2, 2]]
  20488. */
  20489. function flatMapDepth(collection, iteratee, depth) {
  20490. depth = depth === undefined ? 1 : toInteger(depth);
  20491. return baseFlatten(map(collection, iteratee), depth);
  20492. }
  20493. /**
  20494. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  20495. * The iteratee is invoked with three arguments: (value, index|key, collection).
  20496. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20497. *
  20498. * **Note:** As with other "Collections" methods, objects with a "length"
  20499. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  20500. * or `_.forOwn` for object iteration.
  20501. *
  20502. * @static
  20503. * @memberOf _
  20504. * @since 0.1.0
  20505. * @alias each
  20506. * @category Collection
  20507. * @param {Array|Object} collection The collection to iterate over.
  20508. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20509. * @returns {Array|Object} Returns `collection`.
  20510. * @see _.forEachRight
  20511. * @example
  20512. *
  20513. * _.forEach([1, 2], function(value) {
  20514. * console.log(value);
  20515. * });
  20516. * // => Logs `1` then `2`.
  20517. *
  20518. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  20519. * console.log(key);
  20520. * });
  20521. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  20522. */
  20523. function forEach(collection, iteratee) {
  20524. var func = isArray(collection) ? arrayEach : baseEach;
  20525. return func(collection, getIteratee(iteratee, 3));
  20526. }
  20527. /**
  20528. * This method is like `_.forEach` except that it iterates over elements of
  20529. * `collection` from right to left.
  20530. *
  20531. * @static
  20532. * @memberOf _
  20533. * @since 2.0.0
  20534. * @alias eachRight
  20535. * @category Collection
  20536. * @param {Array|Object} collection The collection to iterate over.
  20537. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20538. * @returns {Array|Object} Returns `collection`.
  20539. * @see _.forEach
  20540. * @example
  20541. *
  20542. * _.forEachRight([1, 2], function(value) {
  20543. * console.log(value);
  20544. * });
  20545. * // => Logs `2` then `1`.
  20546. */
  20547. function forEachRight(collection, iteratee) {
  20548. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  20549. return func(collection, getIteratee(iteratee, 3));
  20550. }
  20551. /**
  20552. * Creates an object composed of keys generated from the results of running
  20553. * each element of `collection` thru `iteratee`. The order of grouped values
  20554. * is determined by the order they occur in `collection`. The corresponding
  20555. * value of each key is an array of elements responsible for generating the
  20556. * key. The iteratee is invoked with one argument: (value).
  20557. *
  20558. * @static
  20559. * @memberOf _
  20560. * @since 0.1.0
  20561. * @category Collection
  20562. * @param {Array|Object} collection The collection to iterate over.
  20563. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  20564. * @returns {Object} Returns the composed aggregate object.
  20565. * @example
  20566. *
  20567. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  20568. * // => { '4': [4.2], '6': [6.1, 6.3] }
  20569. *
  20570. * // The `_.property` iteratee shorthand.
  20571. * _.groupBy(['one', 'two', 'three'], 'length');
  20572. * // => { '3': ['one', 'two'], '5': ['three'] }
  20573. */
  20574. var groupBy = createAggregator(function(result, value, key) {
  20575. if (hasOwnProperty.call(result, key)) {
  20576. result[key].push(value);
  20577. } else {
  20578. baseAssignValue(result, key, [value]);
  20579. }
  20580. });
  20581. /**
  20582. * Checks if `value` is in `collection`. If `collection` is a string, it's
  20583. * checked for a substring of `value`, otherwise
  20584. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20585. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  20586. * the offset from the end of `collection`.
  20587. *
  20588. * @static
  20589. * @memberOf _
  20590. * @since 0.1.0
  20591. * @category Collection
  20592. * @param {Array|Object|string} collection The collection to inspect.
  20593. * @param {*} value The value to search for.
  20594. * @param {number} [fromIndex=0] The index to search from.
  20595. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  20596. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  20597. * @example
  20598. *
  20599. * _.includes([1, 2, 3], 1);
  20600. * // => true
  20601. *
  20602. * _.includes([1, 2, 3], 1, 2);
  20603. * // => false
  20604. *
  20605. * _.includes({ 'a': 1, 'b': 2 }, 1);
  20606. * // => true
  20607. *
  20608. * _.includes('abcd', 'bc');
  20609. * // => true
  20610. */
  20611. function includes(collection, value, fromIndex, guard) {
  20612. collection = isArrayLike(collection) ? collection : values(collection);
  20613. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  20614. var length = collection.length;
  20615. if (fromIndex < 0) {
  20616. fromIndex = nativeMax(length + fromIndex, 0);
  20617. }
  20618. return isString(collection)
  20619. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  20620. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  20621. }
  20622. /**
  20623. * Invokes the method at `path` of each element in `collection`, returning
  20624. * an array of the results of each invoked method. Any additional arguments
  20625. * are provided to each invoked method. If `path` is a function, it's invoked
  20626. * for, and `this` bound to, each element in `collection`.
  20627. *
  20628. * @static
  20629. * @memberOf _
  20630. * @since 4.0.0
  20631. * @category Collection
  20632. * @param {Array|Object} collection The collection to iterate over.
  20633. * @param {Array|Function|string} path The path of the method to invoke or
  20634. * the function invoked per iteration.
  20635. * @param {...*} [args] The arguments to invoke each method with.
  20636. * @returns {Array} Returns the array of results.
  20637. * @example
  20638. *
  20639. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  20640. * // => [[1, 5, 7], [1, 2, 3]]
  20641. *
  20642. * _.invokeMap([123, 456], String.prototype.split, '');
  20643. * // => [['1', '2', '3'], ['4', '5', '6']]
  20644. */
  20645. var invokeMap = baseRest(function(collection, path, args) {
  20646. var index = -1,
  20647. isFunc = typeof path == 'function',
  20648. result = isArrayLike(collection) ? Array(collection.length) : [];
  20649. baseEach(collection, function(value) {
  20650. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  20651. });
  20652. return result;
  20653. });
  20654. /**
  20655. * Creates an object composed of keys generated from the results of running
  20656. * each element of `collection` thru `iteratee`. The corresponding value of
  20657. * each key is the last element responsible for generating the key. The
  20658. * iteratee is invoked with one argument: (value).
  20659. *
  20660. * @static
  20661. * @memberOf _
  20662. * @since 4.0.0
  20663. * @category Collection
  20664. * @param {Array|Object} collection The collection to iterate over.
  20665. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  20666. * @returns {Object} Returns the composed aggregate object.
  20667. * @example
  20668. *
  20669. * var array = [
  20670. * { 'dir': 'left', 'code': 97 },
  20671. * { 'dir': 'right', 'code': 100 }
  20672. * ];
  20673. *
  20674. * _.keyBy(array, function(o) {
  20675. * return String.fromCharCode(o.code);
  20676. * });
  20677. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  20678. *
  20679. * _.keyBy(array, 'dir');
  20680. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  20681. */
  20682. var keyBy = createAggregator(function(result, value, key) {
  20683. baseAssignValue(result, key, value);
  20684. });
  20685. /**
  20686. * Creates an array of values by running each element in `collection` thru
  20687. * `iteratee`. The iteratee is invoked with three arguments:
  20688. * (value, index|key, collection).
  20689. *
  20690. * Many lodash methods are guarded to work as iteratees for methods like
  20691. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  20692. *
  20693. * The guarded methods are:
  20694. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  20695. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  20696. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  20697. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  20698. *
  20699. * @static
  20700. * @memberOf _
  20701. * @since 0.1.0
  20702. * @category Collection
  20703. * @param {Array|Object} collection The collection to iterate over.
  20704. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20705. * @returns {Array} Returns the new mapped array.
  20706. * @example
  20707. *
  20708. * function square(n) {
  20709. * return n * n;
  20710. * }
  20711. *
  20712. * _.map([4, 8], square);
  20713. * // => [16, 64]
  20714. *
  20715. * _.map({ 'a': 4, 'b': 8 }, square);
  20716. * // => [16, 64] (iteration order is not guaranteed)
  20717. *
  20718. * var users = [
  20719. * { 'user': 'barney' },
  20720. * { 'user': 'fred' }
  20721. * ];
  20722. *
  20723. * // The `_.property` iteratee shorthand.
  20724. * _.map(users, 'user');
  20725. * // => ['barney', 'fred']
  20726. */
  20727. function map(collection, iteratee) {
  20728. var func = isArray(collection) ? arrayMap : baseMap;
  20729. return func(collection, getIteratee(iteratee, 3));
  20730. }
  20731. /**
  20732. * This method is like `_.sortBy` except that it allows specifying the sort
  20733. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  20734. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  20735. * descending or "asc" for ascending sort order of corresponding values.
  20736. *
  20737. * @static
  20738. * @memberOf _
  20739. * @since 4.0.0
  20740. * @category Collection
  20741. * @param {Array|Object} collection The collection to iterate over.
  20742. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  20743. * The iteratees to sort by.
  20744. * @param {string[]} [orders] The sort orders of `iteratees`.
  20745. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  20746. * @returns {Array} Returns the new sorted array.
  20747. * @example
  20748. *
  20749. * var users = [
  20750. * { 'user': 'fred', 'age': 48 },
  20751. * { 'user': 'barney', 'age': 34 },
  20752. * { 'user': 'fred', 'age': 40 },
  20753. * { 'user': 'barney', 'age': 36 }
  20754. * ];
  20755. *
  20756. * // Sort by `user` in ascending order and by `age` in descending order.
  20757. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  20758. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  20759. */
  20760. function orderBy(collection, iteratees, orders, guard) {
  20761. if (collection == null) {
  20762. return [];
  20763. }
  20764. if (!isArray(iteratees)) {
  20765. iteratees = iteratees == null ? [] : [iteratees];
  20766. }
  20767. orders = guard ? undefined : orders;
  20768. if (!isArray(orders)) {
  20769. orders = orders == null ? [] : [orders];
  20770. }
  20771. return baseOrderBy(collection, iteratees, orders);
  20772. }
  20773. /**
  20774. * Creates an array of elements split into two groups, the first of which
  20775. * contains elements `predicate` returns truthy for, the second of which
  20776. * contains elements `predicate` returns falsey for. The predicate is
  20777. * invoked with one argument: (value).
  20778. *
  20779. * @static
  20780. * @memberOf _
  20781. * @since 3.0.0
  20782. * @category Collection
  20783. * @param {Array|Object} collection The collection to iterate over.
  20784. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20785. * @returns {Array} Returns the array of grouped elements.
  20786. * @example
  20787. *
  20788. * var users = [
  20789. * { 'user': 'barney', 'age': 36, 'active': false },
  20790. * { 'user': 'fred', 'age': 40, 'active': true },
  20791. * { 'user': 'pebbles', 'age': 1, 'active': false }
  20792. * ];
  20793. *
  20794. * _.partition(users, function(o) { return o.active; });
  20795. * // => objects for [['fred'], ['barney', 'pebbles']]
  20796. *
  20797. * // The `_.matches` iteratee shorthand.
  20798. * _.partition(users, { 'age': 1, 'active': false });
  20799. * // => objects for [['pebbles'], ['barney', 'fred']]
  20800. *
  20801. * // The `_.matchesProperty` iteratee shorthand.
  20802. * _.partition(users, ['active', false]);
  20803. * // => objects for [['barney', 'pebbles'], ['fred']]
  20804. *
  20805. * // The `_.property` iteratee shorthand.
  20806. * _.partition(users, 'active');
  20807. * // => objects for [['fred'], ['barney', 'pebbles']]
  20808. */
  20809. var partition = createAggregator(function(result, value, key) {
  20810. result[key ? 0 : 1].push(value);
  20811. }, function() { return [[], []]; });
  20812. /**
  20813. * Reduces `collection` to a value which is the accumulated result of running
  20814. * each element in `collection` thru `iteratee`, where each successive
  20815. * invocation is supplied the return value of the previous. If `accumulator`
  20816. * is not given, the first element of `collection` is used as the initial
  20817. * value. The iteratee is invoked with four arguments:
  20818. * (accumulator, value, index|key, collection).
  20819. *
  20820. * Many lodash methods are guarded to work as iteratees for methods like
  20821. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  20822. *
  20823. * The guarded methods are:
  20824. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  20825. * and `sortBy`
  20826. *
  20827. * @static
  20828. * @memberOf _
  20829. * @since 0.1.0
  20830. * @category Collection
  20831. * @param {Array|Object} collection The collection to iterate over.
  20832. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20833. * @param {*} [accumulator] The initial value.
  20834. * @returns {*} Returns the accumulated value.
  20835. * @see _.reduceRight
  20836. * @example
  20837. *
  20838. * _.reduce([1, 2], function(sum, n) {
  20839. * return sum + n;
  20840. * }, 0);
  20841. * // => 3
  20842. *
  20843. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  20844. * (result[value] || (result[value] = [])).push(key);
  20845. * return result;
  20846. * }, {});
  20847. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  20848. */
  20849. function reduce(collection, iteratee, accumulator) {
  20850. var func = isArray(collection) ? arrayReduce : baseReduce,
  20851. initAccum = arguments.length < 3;
  20852. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  20853. }
  20854. /**
  20855. * This method is like `_.reduce` except that it iterates over elements of
  20856. * `collection` from right to left.
  20857. *
  20858. * @static
  20859. * @memberOf _
  20860. * @since 0.1.0
  20861. * @category Collection
  20862. * @param {Array|Object} collection The collection to iterate over.
  20863. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20864. * @param {*} [accumulator] The initial value.
  20865. * @returns {*} Returns the accumulated value.
  20866. * @see _.reduce
  20867. * @example
  20868. *
  20869. * var array = [[0, 1], [2, 3], [4, 5]];
  20870. *
  20871. * _.reduceRight(array, function(flattened, other) {
  20872. * return flattened.concat(other);
  20873. * }, []);
  20874. * // => [4, 5, 2, 3, 0, 1]
  20875. */
  20876. function reduceRight(collection, iteratee, accumulator) {
  20877. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  20878. initAccum = arguments.length < 3;
  20879. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  20880. }
  20881. /**
  20882. * The opposite of `_.filter`; this method returns the elements of `collection`
  20883. * that `predicate` does **not** return truthy for.
  20884. *
  20885. * @static
  20886. * @memberOf _
  20887. * @since 0.1.0
  20888. * @category Collection
  20889. * @param {Array|Object} collection The collection to iterate over.
  20890. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20891. * @returns {Array} Returns the new filtered array.
  20892. * @see _.filter
  20893. * @example
  20894. *
  20895. * var users = [
  20896. * { 'user': 'barney', 'age': 36, 'active': false },
  20897. * { 'user': 'fred', 'age': 40, 'active': true }
  20898. * ];
  20899. *
  20900. * _.reject(users, function(o) { return !o.active; });
  20901. * // => objects for ['fred']
  20902. *
  20903. * // The `_.matches` iteratee shorthand.
  20904. * _.reject(users, { 'age': 40, 'active': true });
  20905. * // => objects for ['barney']
  20906. *
  20907. * // The `_.matchesProperty` iteratee shorthand.
  20908. * _.reject(users, ['active', false]);
  20909. * // => objects for ['fred']
  20910. *
  20911. * // The `_.property` iteratee shorthand.
  20912. * _.reject(users, 'active');
  20913. * // => objects for ['barney']
  20914. */
  20915. function reject(collection, predicate) {
  20916. var func = isArray(collection) ? arrayFilter : baseFilter;
  20917. return func(collection, negate(getIteratee(predicate, 3)));
  20918. }
  20919. /**
  20920. * Gets a random element from `collection`.
  20921. *
  20922. * @static
  20923. * @memberOf _
  20924. * @since 2.0.0
  20925. * @category Collection
  20926. * @param {Array|Object} collection The collection to sample.
  20927. * @returns {*} Returns the random element.
  20928. * @example
  20929. *
  20930. * _.sample([1, 2, 3, 4]);
  20931. * // => 2
  20932. */
  20933. function sample(collection) {
  20934. var func = isArray(collection) ? arraySample : baseSample;
  20935. return func(collection);
  20936. }
  20937. /**
  20938. * Gets `n` random elements at unique keys from `collection` up to the
  20939. * size of `collection`.
  20940. *
  20941. * @static
  20942. * @memberOf _
  20943. * @since 4.0.0
  20944. * @category Collection
  20945. * @param {Array|Object} collection The collection to sample.
  20946. * @param {number} [n=1] The number of elements to sample.
  20947. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20948. * @returns {Array} Returns the random elements.
  20949. * @example
  20950. *
  20951. * _.sampleSize([1, 2, 3], 2);
  20952. * // => [3, 1]
  20953. *
  20954. * _.sampleSize([1, 2, 3], 4);
  20955. * // => [2, 3, 1]
  20956. */
  20957. function sampleSize(collection, n, guard) {
  20958. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  20959. n = 1;
  20960. } else {
  20961. n = toInteger(n);
  20962. }
  20963. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  20964. return func(collection, n);
  20965. }
  20966. /**
  20967. * Creates an array of shuffled values, using a version of the
  20968. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  20969. *
  20970. * @static
  20971. * @memberOf _
  20972. * @since 0.1.0
  20973. * @category Collection
  20974. * @param {Array|Object} collection The collection to shuffle.
  20975. * @returns {Array} Returns the new shuffled array.
  20976. * @example
  20977. *
  20978. * _.shuffle([1, 2, 3, 4]);
  20979. * // => [4, 1, 3, 2]
  20980. */
  20981. function shuffle(collection) {
  20982. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  20983. return func(collection);
  20984. }
  20985. /**
  20986. * Gets the size of `collection` by returning its length for array-like
  20987. * values or the number of own enumerable string keyed properties for objects.
  20988. *
  20989. * @static
  20990. * @memberOf _
  20991. * @since 0.1.0
  20992. * @category Collection
  20993. * @param {Array|Object|string} collection The collection to inspect.
  20994. * @returns {number} Returns the collection size.
  20995. * @example
  20996. *
  20997. * _.size([1, 2, 3]);
  20998. * // => 3
  20999. *
  21000. * _.size({ 'a': 1, 'b': 2 });
  21001. * // => 2
  21002. *
  21003. * _.size('pebbles');
  21004. * // => 7
  21005. */
  21006. function size(collection) {
  21007. if (collection == null) {
  21008. return 0;
  21009. }
  21010. if (isArrayLike(collection)) {
  21011. return isString(collection) ? stringSize(collection) : collection.length;
  21012. }
  21013. var tag = getTag(collection);
  21014. if (tag == mapTag || tag == setTag) {
  21015. return collection.size;
  21016. }
  21017. return baseKeys(collection).length;
  21018. }
  21019. /**
  21020. * Checks if `predicate` returns truthy for **any** element of `collection`.
  21021. * Iteration is stopped once `predicate` returns truthy. The predicate is
  21022. * invoked with three arguments: (value, index|key, collection).
  21023. *
  21024. * @static
  21025. * @memberOf _
  21026. * @since 0.1.0
  21027. * @category Collection
  21028. * @param {Array|Object} collection The collection to iterate over.
  21029. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21030. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21031. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21032. * else `false`.
  21033. * @example
  21034. *
  21035. * _.some([null, 0, 'yes', false], Boolean);
  21036. * // => true
  21037. *
  21038. * var users = [
  21039. * { 'user': 'barney', 'active': true },
  21040. * { 'user': 'fred', 'active': false }
  21041. * ];
  21042. *
  21043. * // The `_.matches` iteratee shorthand.
  21044. * _.some(users, { 'user': 'barney', 'active': false });
  21045. * // => false
  21046. *
  21047. * // The `_.matchesProperty` iteratee shorthand.
  21048. * _.some(users, ['active', false]);
  21049. * // => true
  21050. *
  21051. * // The `_.property` iteratee shorthand.
  21052. * _.some(users, 'active');
  21053. * // => true
  21054. */
  21055. function some(collection, predicate, guard) {
  21056. var func = isArray(collection) ? arraySome : baseSome;
  21057. if (guard && isIterateeCall(collection, predicate, guard)) {
  21058. predicate = undefined;
  21059. }
  21060. return func(collection, getIteratee(predicate, 3));
  21061. }
  21062. /**
  21063. * Creates an array of elements, sorted in ascending order by the results of
  21064. * running each element in a collection thru each iteratee. This method
  21065. * performs a stable sort, that is, it preserves the original sort order of
  21066. * equal elements. The iteratees are invoked with one argument: (value).
  21067. *
  21068. * @static
  21069. * @memberOf _
  21070. * @since 0.1.0
  21071. * @category Collection
  21072. * @param {Array|Object} collection The collection to iterate over.
  21073. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  21074. * The iteratees to sort by.
  21075. * @returns {Array} Returns the new sorted array.
  21076. * @example
  21077. *
  21078. * var users = [
  21079. * { 'user': 'fred', 'age': 48 },
  21080. * { 'user': 'barney', 'age': 36 },
  21081. * { 'user': 'fred', 'age': 40 },
  21082. * { 'user': 'barney', 'age': 34 }
  21083. * ];
  21084. *
  21085. * _.sortBy(users, [function(o) { return o.user; }]);
  21086. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  21087. *
  21088. * _.sortBy(users, ['user', 'age']);
  21089. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  21090. */
  21091. var sortBy = baseRest(function(collection, iteratees) {
  21092. if (collection == null) {
  21093. return [];
  21094. }
  21095. var length = iteratees.length;
  21096. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  21097. iteratees = [];
  21098. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  21099. iteratees = [iteratees[0]];
  21100. }
  21101. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  21102. });
  21103. /*------------------------------------------------------------------------*/
  21104. /**
  21105. * Gets the timestamp of the number of milliseconds that have elapsed since
  21106. * the Unix epoch (1 January 1970 00:00:00 UTC).
  21107. *
  21108. * @static
  21109. * @memberOf _
  21110. * @since 2.4.0
  21111. * @category Date
  21112. * @returns {number} Returns the timestamp.
  21113. * @example
  21114. *
  21115. * _.defer(function(stamp) {
  21116. * console.log(_.now() - stamp);
  21117. * }, _.now());
  21118. * // => Logs the number of milliseconds it took for the deferred invocation.
  21119. */
  21120. var now = ctxNow || function() {
  21121. return root.Date.now();
  21122. };
  21123. /*------------------------------------------------------------------------*/
  21124. /**
  21125. * The opposite of `_.before`; this method creates a function that invokes
  21126. * `func` once it's called `n` or more times.
  21127. *
  21128. * @static
  21129. * @memberOf _
  21130. * @since 0.1.0
  21131. * @category Function
  21132. * @param {number} n The number of calls before `func` is invoked.
  21133. * @param {Function} func The function to restrict.
  21134. * @returns {Function} Returns the new restricted function.
  21135. * @example
  21136. *
  21137. * var saves = ['profile', 'settings'];
  21138. *
  21139. * var done = _.after(saves.length, function() {
  21140. * console.log('done saving!');
  21141. * });
  21142. *
  21143. * _.forEach(saves, function(type) {
  21144. * asyncSave({ 'type': type, 'complete': done });
  21145. * });
  21146. * // => Logs 'done saving!' after the two async saves have completed.
  21147. */
  21148. function after(n, func) {
  21149. if (typeof func != 'function') {
  21150. throw new TypeError(FUNC_ERROR_TEXT);
  21151. }
  21152. n = toInteger(n);
  21153. return function() {
  21154. if (--n < 1) {
  21155. return func.apply(this, arguments);
  21156. }
  21157. };
  21158. }
  21159. /**
  21160. * Creates a function that invokes `func`, with up to `n` arguments,
  21161. * ignoring any additional arguments.
  21162. *
  21163. * @static
  21164. * @memberOf _
  21165. * @since 3.0.0
  21166. * @category Function
  21167. * @param {Function} func The function to cap arguments for.
  21168. * @param {number} [n=func.length] The arity cap.
  21169. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21170. * @returns {Function} Returns the new capped function.
  21171. * @example
  21172. *
  21173. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  21174. * // => [6, 8, 10]
  21175. */
  21176. function ary(func, n, guard) {
  21177. n = guard ? undefined : n;
  21178. n = (func && n == null) ? func.length : n;
  21179. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  21180. }
  21181. /**
  21182. * Creates a function that invokes `func`, with the `this` binding and arguments
  21183. * of the created function, while it's called less than `n` times. Subsequent
  21184. * calls to the created function return the result of the last `func` invocation.
  21185. *
  21186. * @static
  21187. * @memberOf _
  21188. * @since 3.0.0
  21189. * @category Function
  21190. * @param {number} n The number of calls at which `func` is no longer invoked.
  21191. * @param {Function} func The function to restrict.
  21192. * @returns {Function} Returns the new restricted function.
  21193. * @example
  21194. *
  21195. * jQuery(element).on('click', _.before(5, addContactToList));
  21196. * // => Allows adding up to 4 contacts to the list.
  21197. */
  21198. function before(n, func) {
  21199. var result;
  21200. if (typeof func != 'function') {
  21201. throw new TypeError(FUNC_ERROR_TEXT);
  21202. }
  21203. n = toInteger(n);
  21204. return function() {
  21205. if (--n > 0) {
  21206. result = func.apply(this, arguments);
  21207. }
  21208. if (n <= 1) {
  21209. func = undefined;
  21210. }
  21211. return result;
  21212. };
  21213. }
  21214. /**
  21215. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  21216. * and `partials` prepended to the arguments it receives.
  21217. *
  21218. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  21219. * may be used as a placeholder for partially applied arguments.
  21220. *
  21221. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  21222. * property of bound functions.
  21223. *
  21224. * @static
  21225. * @memberOf _
  21226. * @since 0.1.0
  21227. * @category Function
  21228. * @param {Function} func The function to bind.
  21229. * @param {*} thisArg The `this` binding of `func`.
  21230. * @param {...*} [partials] The arguments to be partially applied.
  21231. * @returns {Function} Returns the new bound function.
  21232. * @example
  21233. *
  21234. * function greet(greeting, punctuation) {
  21235. * return greeting + ' ' + this.user + punctuation;
  21236. * }
  21237. *
  21238. * var object = { 'user': 'fred' };
  21239. *
  21240. * var bound = _.bind(greet, object, 'hi');
  21241. * bound('!');
  21242. * // => 'hi fred!'
  21243. *
  21244. * // Bound with placeholders.
  21245. * var bound = _.bind(greet, object, _, '!');
  21246. * bound('hi');
  21247. * // => 'hi fred!'
  21248. */
  21249. var bind = baseRest(function(func, thisArg, partials) {
  21250. var bitmask = WRAP_BIND_FLAG;
  21251. if (partials.length) {
  21252. var holders = replaceHolders(partials, getHolder(bind));
  21253. bitmask |= WRAP_PARTIAL_FLAG;
  21254. }
  21255. return createWrap(func, bitmask, thisArg, partials, holders);
  21256. });
  21257. /**
  21258. * Creates a function that invokes the method at `object[key]` with `partials`
  21259. * prepended to the arguments it receives.
  21260. *
  21261. * This method differs from `_.bind` by allowing bound functions to reference
  21262. * methods that may be redefined or don't yet exist. See
  21263. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  21264. * for more details.
  21265. *
  21266. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  21267. * builds, may be used as a placeholder for partially applied arguments.
  21268. *
  21269. * @static
  21270. * @memberOf _
  21271. * @since 0.10.0
  21272. * @category Function
  21273. * @param {Object} object The object to invoke the method on.
  21274. * @param {string} key The key of the method.
  21275. * @param {...*} [partials] The arguments to be partially applied.
  21276. * @returns {Function} Returns the new bound function.
  21277. * @example
  21278. *
  21279. * var object = {
  21280. * 'user': 'fred',
  21281. * 'greet': function(greeting, punctuation) {
  21282. * return greeting + ' ' + this.user + punctuation;
  21283. * }
  21284. * };
  21285. *
  21286. * var bound = _.bindKey(object, 'greet', 'hi');
  21287. * bound('!');
  21288. * // => 'hi fred!'
  21289. *
  21290. * object.greet = function(greeting, punctuation) {
  21291. * return greeting + 'ya ' + this.user + punctuation;
  21292. * };
  21293. *
  21294. * bound('!');
  21295. * // => 'hiya fred!'
  21296. *
  21297. * // Bound with placeholders.
  21298. * var bound = _.bindKey(object, 'greet', _, '!');
  21299. * bound('hi');
  21300. * // => 'hiya fred!'
  21301. */
  21302. var bindKey = baseRest(function(object, key, partials) {
  21303. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  21304. if (partials.length) {
  21305. var holders = replaceHolders(partials, getHolder(bindKey));
  21306. bitmask |= WRAP_PARTIAL_FLAG;
  21307. }
  21308. return createWrap(key, bitmask, object, partials, holders);
  21309. });
  21310. /**
  21311. * Creates a function that accepts arguments of `func` and either invokes
  21312. * `func` returning its result, if at least `arity` number of arguments have
  21313. * been provided, or returns a function that accepts the remaining `func`
  21314. * arguments, and so on. The arity of `func` may be specified if `func.length`
  21315. * is not sufficient.
  21316. *
  21317. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  21318. * may be used as a placeholder for provided arguments.
  21319. *
  21320. * **Note:** This method doesn't set the "length" property of curried functions.
  21321. *
  21322. * @static
  21323. * @memberOf _
  21324. * @since 2.0.0
  21325. * @category Function
  21326. * @param {Function} func The function to curry.
  21327. * @param {number} [arity=func.length] The arity of `func`.
  21328. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21329. * @returns {Function} Returns the new curried function.
  21330. * @example
  21331. *
  21332. * var abc = function(a, b, c) {
  21333. * return [a, b, c];
  21334. * };
  21335. *
  21336. * var curried = _.curry(abc);
  21337. *
  21338. * curried(1)(2)(3);
  21339. * // => [1, 2, 3]
  21340. *
  21341. * curried(1, 2)(3);
  21342. * // => [1, 2, 3]
  21343. *
  21344. * curried(1, 2, 3);
  21345. * // => [1, 2, 3]
  21346. *
  21347. * // Curried with placeholders.
  21348. * curried(1)(_, 3)(2);
  21349. * // => [1, 2, 3]
  21350. */
  21351. function curry(func, arity, guard) {
  21352. arity = guard ? undefined : arity;
  21353. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  21354. result.placeholder = curry.placeholder;
  21355. return result;
  21356. }
  21357. /**
  21358. * This method is like `_.curry` except that arguments are applied to `func`
  21359. * in the manner of `_.partialRight` instead of `_.partial`.
  21360. *
  21361. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  21362. * builds, may be used as a placeholder for provided arguments.
  21363. *
  21364. * **Note:** This method doesn't set the "length" property of curried functions.
  21365. *
  21366. * @static
  21367. * @memberOf _
  21368. * @since 3.0.0
  21369. * @category Function
  21370. * @param {Function} func The function to curry.
  21371. * @param {number} [arity=func.length] The arity of `func`.
  21372. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21373. * @returns {Function} Returns the new curried function.
  21374. * @example
  21375. *
  21376. * var abc = function(a, b, c) {
  21377. * return [a, b, c];
  21378. * };
  21379. *
  21380. * var curried = _.curryRight(abc);
  21381. *
  21382. * curried(3)(2)(1);
  21383. * // => [1, 2, 3]
  21384. *
  21385. * curried(2, 3)(1);
  21386. * // => [1, 2, 3]
  21387. *
  21388. * curried(1, 2, 3);
  21389. * // => [1, 2, 3]
  21390. *
  21391. * // Curried with placeholders.
  21392. * curried(3)(1, _)(2);
  21393. * // => [1, 2, 3]
  21394. */
  21395. function curryRight(func, arity, guard) {
  21396. arity = guard ? undefined : arity;
  21397. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  21398. result.placeholder = curryRight.placeholder;
  21399. return result;
  21400. }
  21401. /**
  21402. * Creates a debounced function that delays invoking `func` until after `wait`
  21403. * milliseconds have elapsed since the last time the debounced function was
  21404. * invoked. The debounced function comes with a `cancel` method to cancel
  21405. * delayed `func` invocations and a `flush` method to immediately invoke them.
  21406. * Provide `options` to indicate whether `func` should be invoked on the
  21407. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  21408. * with the last arguments provided to the debounced function. Subsequent
  21409. * calls to the debounced function return the result of the last `func`
  21410. * invocation.
  21411. *
  21412. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  21413. * invoked on the trailing edge of the timeout only if the debounced function
  21414. * is invoked more than once during the `wait` timeout.
  21415. *
  21416. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  21417. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  21418. *
  21419. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  21420. * for details over the differences between `_.debounce` and `_.throttle`.
  21421. *
  21422. * @static
  21423. * @memberOf _
  21424. * @since 0.1.0
  21425. * @category Function
  21426. * @param {Function} func The function to debounce.
  21427. * @param {number} [wait=0] The number of milliseconds to delay.
  21428. * @param {Object} [options={}] The options object.
  21429. * @param {boolean} [options.leading=false]
  21430. * Specify invoking on the leading edge of the timeout.
  21431. * @param {number} [options.maxWait]
  21432. * The maximum time `func` is allowed to be delayed before it's invoked.
  21433. * @param {boolean} [options.trailing=true]
  21434. * Specify invoking on the trailing edge of the timeout.
  21435. * @returns {Function} Returns the new debounced function.
  21436. * @example
  21437. *
  21438. * // Avoid costly calculations while the window size is in flux.
  21439. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  21440. *
  21441. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  21442. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  21443. * 'leading': true,
  21444. * 'trailing': false
  21445. * }));
  21446. *
  21447. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  21448. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  21449. * var source = new EventSource('/stream');
  21450. * jQuery(source).on('message', debounced);
  21451. *
  21452. * // Cancel the trailing debounced invocation.
  21453. * jQuery(window).on('popstate', debounced.cancel);
  21454. */
  21455. function debounce(func, wait, options) {
  21456. var lastArgs,
  21457. lastThis,
  21458. maxWait,
  21459. result,
  21460. timerId,
  21461. lastCallTime,
  21462. lastInvokeTime = 0,
  21463. leading = false,
  21464. maxing = false,
  21465. trailing = true;
  21466. if (typeof func != 'function') {
  21467. throw new TypeError(FUNC_ERROR_TEXT);
  21468. }
  21469. wait = toNumber(wait) || 0;
  21470. if (isObject(options)) {
  21471. leading = !!options.leading;
  21472. maxing = 'maxWait' in options;
  21473. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  21474. trailing = 'trailing' in options ? !!options.trailing : trailing;
  21475. }
  21476. function invokeFunc(time) {
  21477. var args = lastArgs,
  21478. thisArg = lastThis;
  21479. lastArgs = lastThis = undefined;
  21480. lastInvokeTime = time;
  21481. result = func.apply(thisArg, args);
  21482. return result;
  21483. }
  21484. function leadingEdge(time) {
  21485. // Reset any `maxWait` timer.
  21486. lastInvokeTime = time;
  21487. // Start the timer for the trailing edge.
  21488. timerId = setTimeout(timerExpired, wait);
  21489. // Invoke the leading edge.
  21490. return leading ? invokeFunc(time) : result;
  21491. }
  21492. function remainingWait(time) {
  21493. var timeSinceLastCall = time - lastCallTime,
  21494. timeSinceLastInvoke = time - lastInvokeTime,
  21495. timeWaiting = wait - timeSinceLastCall;
  21496. return maxing
  21497. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  21498. : timeWaiting;
  21499. }
  21500. function shouldInvoke(time) {
  21501. var timeSinceLastCall = time - lastCallTime,
  21502. timeSinceLastInvoke = time - lastInvokeTime;
  21503. // Either this is the first call, activity has stopped and we're at the
  21504. // trailing edge, the system time has gone backwards and we're treating
  21505. // it as the trailing edge, or we've hit the `maxWait` limit.
  21506. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  21507. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  21508. }
  21509. function timerExpired() {
  21510. var time = now();
  21511. if (shouldInvoke(time)) {
  21512. return trailingEdge(time);
  21513. }
  21514. // Restart the timer.
  21515. timerId = setTimeout(timerExpired, remainingWait(time));
  21516. }
  21517. function trailingEdge(time) {
  21518. timerId = undefined;
  21519. // Only invoke if we have `lastArgs` which means `func` has been
  21520. // debounced at least once.
  21521. if (trailing && lastArgs) {
  21522. return invokeFunc(time);
  21523. }
  21524. lastArgs = lastThis = undefined;
  21525. return result;
  21526. }
  21527. function cancel() {
  21528. if (timerId !== undefined) {
  21529. clearTimeout(timerId);
  21530. }
  21531. lastInvokeTime = 0;
  21532. lastArgs = lastCallTime = lastThis = timerId = undefined;
  21533. }
  21534. function flush() {
  21535. return timerId === undefined ? result : trailingEdge(now());
  21536. }
  21537. function debounced() {
  21538. var time = now(),
  21539. isInvoking = shouldInvoke(time);
  21540. lastArgs = arguments;
  21541. lastThis = this;
  21542. lastCallTime = time;
  21543. if (isInvoking) {
  21544. if (timerId === undefined) {
  21545. return leadingEdge(lastCallTime);
  21546. }
  21547. if (maxing) {
  21548. // Handle invocations in a tight loop.
  21549. timerId = setTimeout(timerExpired, wait);
  21550. return invokeFunc(lastCallTime);
  21551. }
  21552. }
  21553. if (timerId === undefined) {
  21554. timerId = setTimeout(timerExpired, wait);
  21555. }
  21556. return result;
  21557. }
  21558. debounced.cancel = cancel;
  21559. debounced.flush = flush;
  21560. return debounced;
  21561. }
  21562. /**
  21563. * Defers invoking the `func` until the current call stack has cleared. Any
  21564. * additional arguments are provided to `func` when it's invoked.
  21565. *
  21566. * @static
  21567. * @memberOf _
  21568. * @since 0.1.0
  21569. * @category Function
  21570. * @param {Function} func The function to defer.
  21571. * @param {...*} [args] The arguments to invoke `func` with.
  21572. * @returns {number} Returns the timer id.
  21573. * @example
  21574. *
  21575. * _.defer(function(text) {
  21576. * console.log(text);
  21577. * }, 'deferred');
  21578. * // => Logs 'deferred' after one millisecond.
  21579. */
  21580. var defer = baseRest(function(func, args) {
  21581. return baseDelay(func, 1, args);
  21582. });
  21583. /**
  21584. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  21585. * provided to `func` when it's invoked.
  21586. *
  21587. * @static
  21588. * @memberOf _
  21589. * @since 0.1.0
  21590. * @category Function
  21591. * @param {Function} func The function to delay.
  21592. * @param {number} wait The number of milliseconds to delay invocation.
  21593. * @param {...*} [args] The arguments to invoke `func` with.
  21594. * @returns {number} Returns the timer id.
  21595. * @example
  21596. *
  21597. * _.delay(function(text) {
  21598. * console.log(text);
  21599. * }, 1000, 'later');
  21600. * // => Logs 'later' after one second.
  21601. */
  21602. var delay = baseRest(function(func, wait, args) {
  21603. return baseDelay(func, toNumber(wait) || 0, args);
  21604. });
  21605. /**
  21606. * Creates a function that invokes `func` with arguments reversed.
  21607. *
  21608. * @static
  21609. * @memberOf _
  21610. * @since 4.0.0
  21611. * @category Function
  21612. * @param {Function} func The function to flip arguments for.
  21613. * @returns {Function} Returns the new flipped function.
  21614. * @example
  21615. *
  21616. * var flipped = _.flip(function() {
  21617. * return _.toArray(arguments);
  21618. * });
  21619. *
  21620. * flipped('a', 'b', 'c', 'd');
  21621. * // => ['d', 'c', 'b', 'a']
  21622. */
  21623. function flip(func) {
  21624. return createWrap(func, WRAP_FLIP_FLAG);
  21625. }
  21626. /**
  21627. * Creates a function that memoizes the result of `func`. If `resolver` is
  21628. * provided, it determines the cache key for storing the result based on the
  21629. * arguments provided to the memoized function. By default, the first argument
  21630. * provided to the memoized function is used as the map cache key. The `func`
  21631. * is invoked with the `this` binding of the memoized function.
  21632. *
  21633. * **Note:** The cache is exposed as the `cache` property on the memoized
  21634. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  21635. * constructor with one whose instances implement the
  21636. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  21637. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  21638. *
  21639. * @static
  21640. * @memberOf _
  21641. * @since 0.1.0
  21642. * @category Function
  21643. * @param {Function} func The function to have its output memoized.
  21644. * @param {Function} [resolver] The function to resolve the cache key.
  21645. * @returns {Function} Returns the new memoized function.
  21646. * @example
  21647. *
  21648. * var object = { 'a': 1, 'b': 2 };
  21649. * var other = { 'c': 3, 'd': 4 };
  21650. *
  21651. * var values = _.memoize(_.values);
  21652. * values(object);
  21653. * // => [1, 2]
  21654. *
  21655. * values(other);
  21656. * // => [3, 4]
  21657. *
  21658. * object.a = 2;
  21659. * values(object);
  21660. * // => [1, 2]
  21661. *
  21662. * // Modify the result cache.
  21663. * values.cache.set(object, ['a', 'b']);
  21664. * values(object);
  21665. * // => ['a', 'b']
  21666. *
  21667. * // Replace `_.memoize.Cache`.
  21668. * _.memoize.Cache = WeakMap;
  21669. */
  21670. function memoize(func, resolver) {
  21671. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  21672. throw new TypeError(FUNC_ERROR_TEXT);
  21673. }
  21674. var memoized = function() {
  21675. var args = arguments,
  21676. key = resolver ? resolver.apply(this, args) : args[0],
  21677. cache = memoized.cache;
  21678. if (cache.has(key)) {
  21679. return cache.get(key);
  21680. }
  21681. var result = func.apply(this, args);
  21682. memoized.cache = cache.set(key, result) || cache;
  21683. return result;
  21684. };
  21685. memoized.cache = new (memoize.Cache || MapCache);
  21686. return memoized;
  21687. }
  21688. // Expose `MapCache`.
  21689. memoize.Cache = MapCache;
  21690. /**
  21691. * Creates a function that negates the result of the predicate `func`. The
  21692. * `func` predicate is invoked with the `this` binding and arguments of the
  21693. * created function.
  21694. *
  21695. * @static
  21696. * @memberOf _
  21697. * @since 3.0.0
  21698. * @category Function
  21699. * @param {Function} predicate The predicate to negate.
  21700. * @returns {Function} Returns the new negated function.
  21701. * @example
  21702. *
  21703. * function isEven(n) {
  21704. * return n % 2 == 0;
  21705. * }
  21706. *
  21707. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  21708. * // => [1, 3, 5]
  21709. */
  21710. function negate(predicate) {
  21711. if (typeof predicate != 'function') {
  21712. throw new TypeError(FUNC_ERROR_TEXT);
  21713. }
  21714. return function() {
  21715. var args = arguments;
  21716. switch (args.length) {
  21717. case 0: return !predicate.call(this);
  21718. case 1: return !predicate.call(this, args[0]);
  21719. case 2: return !predicate.call(this, args[0], args[1]);
  21720. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  21721. }
  21722. return !predicate.apply(this, args);
  21723. };
  21724. }
  21725. /**
  21726. * Creates a function that is restricted to invoking `func` once. Repeat calls
  21727. * to the function return the value of the first invocation. The `func` is
  21728. * invoked with the `this` binding and arguments of the created function.
  21729. *
  21730. * @static
  21731. * @memberOf _
  21732. * @since 0.1.0
  21733. * @category Function
  21734. * @param {Function} func The function to restrict.
  21735. * @returns {Function} Returns the new restricted function.
  21736. * @example
  21737. *
  21738. * var initialize = _.once(createApplication);
  21739. * initialize();
  21740. * initialize();
  21741. * // => `createApplication` is invoked once
  21742. */
  21743. function once(func) {
  21744. return before(2, func);
  21745. }
  21746. /**
  21747. * Creates a function that invokes `func` with its arguments transformed.
  21748. *
  21749. * @static
  21750. * @since 4.0.0
  21751. * @memberOf _
  21752. * @category Function
  21753. * @param {Function} func The function to wrap.
  21754. * @param {...(Function|Function[])} [transforms=[_.identity]]
  21755. * The argument transforms.
  21756. * @returns {Function} Returns the new function.
  21757. * @example
  21758. *
  21759. * function doubled(n) {
  21760. * return n * 2;
  21761. * }
  21762. *
  21763. * function square(n) {
  21764. * return n * n;
  21765. * }
  21766. *
  21767. * var func = _.overArgs(function(x, y) {
  21768. * return [x, y];
  21769. * }, [square, doubled]);
  21770. *
  21771. * func(9, 3);
  21772. * // => [81, 6]
  21773. *
  21774. * func(10, 5);
  21775. * // => [100, 10]
  21776. */
  21777. var overArgs = castRest(function(func, transforms) {
  21778. transforms = (transforms.length == 1 && isArray(transforms[0]))
  21779. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  21780. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  21781. var funcsLength = transforms.length;
  21782. return baseRest(function(args) {
  21783. var index = -1,
  21784. length = nativeMin(args.length, funcsLength);
  21785. while (++index < length) {
  21786. args[index] = transforms[index].call(this, args[index]);
  21787. }
  21788. return apply(func, this, args);
  21789. });
  21790. });
  21791. /**
  21792. * Creates a function that invokes `func` with `partials` prepended to the
  21793. * arguments it receives. This method is like `_.bind` except it does **not**
  21794. * alter the `this` binding.
  21795. *
  21796. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  21797. * builds, may be used as a placeholder for partially applied arguments.
  21798. *
  21799. * **Note:** This method doesn't set the "length" property of partially
  21800. * applied functions.
  21801. *
  21802. * @static
  21803. * @memberOf _
  21804. * @since 0.2.0
  21805. * @category Function
  21806. * @param {Function} func The function to partially apply arguments to.
  21807. * @param {...*} [partials] The arguments to be partially applied.
  21808. * @returns {Function} Returns the new partially applied function.
  21809. * @example
  21810. *
  21811. * function greet(greeting, name) {
  21812. * return greeting + ' ' + name;
  21813. * }
  21814. *
  21815. * var sayHelloTo = _.partial(greet, 'hello');
  21816. * sayHelloTo('fred');
  21817. * // => 'hello fred'
  21818. *
  21819. * // Partially applied with placeholders.
  21820. * var greetFred = _.partial(greet, _, 'fred');
  21821. * greetFred('hi');
  21822. * // => 'hi fred'
  21823. */
  21824. var partial = baseRest(function(func, partials) {
  21825. var holders = replaceHolders(partials, getHolder(partial));
  21826. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  21827. });
  21828. /**
  21829. * This method is like `_.partial` except that partially applied arguments
  21830. * are appended to the arguments it receives.
  21831. *
  21832. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  21833. * builds, may be used as a placeholder for partially applied arguments.
  21834. *
  21835. * **Note:** This method doesn't set the "length" property of partially
  21836. * applied functions.
  21837. *
  21838. * @static
  21839. * @memberOf _
  21840. * @since 1.0.0
  21841. * @category Function
  21842. * @param {Function} func The function to partially apply arguments to.
  21843. * @param {...*} [partials] The arguments to be partially applied.
  21844. * @returns {Function} Returns the new partially applied function.
  21845. * @example
  21846. *
  21847. * function greet(greeting, name) {
  21848. * return greeting + ' ' + name;
  21849. * }
  21850. *
  21851. * var greetFred = _.partialRight(greet, 'fred');
  21852. * greetFred('hi');
  21853. * // => 'hi fred'
  21854. *
  21855. * // Partially applied with placeholders.
  21856. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  21857. * sayHelloTo('fred');
  21858. * // => 'hello fred'
  21859. */
  21860. var partialRight = baseRest(function(func, partials) {
  21861. var holders = replaceHolders(partials, getHolder(partialRight));
  21862. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  21863. });
  21864. /**
  21865. * Creates a function that invokes `func` with arguments arranged according
  21866. * to the specified `indexes` where the argument value at the first index is
  21867. * provided as the first argument, the argument value at the second index is
  21868. * provided as the second argument, and so on.
  21869. *
  21870. * @static
  21871. * @memberOf _
  21872. * @since 3.0.0
  21873. * @category Function
  21874. * @param {Function} func The function to rearrange arguments for.
  21875. * @param {...(number|number[])} indexes The arranged argument indexes.
  21876. * @returns {Function} Returns the new function.
  21877. * @example
  21878. *
  21879. * var rearged = _.rearg(function(a, b, c) {
  21880. * return [a, b, c];
  21881. * }, [2, 0, 1]);
  21882. *
  21883. * rearged('b', 'c', 'a')
  21884. * // => ['a', 'b', 'c']
  21885. */
  21886. var rearg = flatRest(function(func, indexes) {
  21887. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  21888. });
  21889. /**
  21890. * Creates a function that invokes `func` with the `this` binding of the
  21891. * created function and arguments from `start` and beyond provided as
  21892. * an array.
  21893. *
  21894. * **Note:** This method is based on the
  21895. * [rest parameter](https://mdn.io/rest_parameters).
  21896. *
  21897. * @static
  21898. * @memberOf _
  21899. * @since 4.0.0
  21900. * @category Function
  21901. * @param {Function} func The function to apply a rest parameter to.
  21902. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21903. * @returns {Function} Returns the new function.
  21904. * @example
  21905. *
  21906. * var say = _.rest(function(what, names) {
  21907. * return what + ' ' + _.initial(names).join(', ') +
  21908. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  21909. * });
  21910. *
  21911. * say('hello', 'fred', 'barney', 'pebbles');
  21912. * // => 'hello fred, barney, & pebbles'
  21913. */
  21914. function rest(func, start) {
  21915. if (typeof func != 'function') {
  21916. throw new TypeError(FUNC_ERROR_TEXT);
  21917. }
  21918. start = start === undefined ? start : toInteger(start);
  21919. return baseRest(func, start);
  21920. }
  21921. /**
  21922. * Creates a function that invokes `func` with the `this` binding of the
  21923. * create function and an array of arguments much like
  21924. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  21925. *
  21926. * **Note:** This method is based on the
  21927. * [spread operator](https://mdn.io/spread_operator).
  21928. *
  21929. * @static
  21930. * @memberOf _
  21931. * @since 3.2.0
  21932. * @category Function
  21933. * @param {Function} func The function to spread arguments over.
  21934. * @param {number} [start=0] The start position of the spread.
  21935. * @returns {Function} Returns the new function.
  21936. * @example
  21937. *
  21938. * var say = _.spread(function(who, what) {
  21939. * return who + ' says ' + what;
  21940. * });
  21941. *
  21942. * say(['fred', 'hello']);
  21943. * // => 'fred says hello'
  21944. *
  21945. * var numbers = Promise.all([
  21946. * Promise.resolve(40),
  21947. * Promise.resolve(36)
  21948. * ]);
  21949. *
  21950. * numbers.then(_.spread(function(x, y) {
  21951. * return x + y;
  21952. * }));
  21953. * // => a Promise of 76
  21954. */
  21955. function spread(func, start) {
  21956. if (typeof func != 'function') {
  21957. throw new TypeError(FUNC_ERROR_TEXT);
  21958. }
  21959. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  21960. return baseRest(function(args) {
  21961. var array = args[start],
  21962. otherArgs = castSlice(args, 0, start);
  21963. if (array) {
  21964. arrayPush(otherArgs, array);
  21965. }
  21966. return apply(func, this, otherArgs);
  21967. });
  21968. }
  21969. /**
  21970. * Creates a throttled function that only invokes `func` at most once per
  21971. * every `wait` milliseconds. The throttled function comes with a `cancel`
  21972. * method to cancel delayed `func` invocations and a `flush` method to
  21973. * immediately invoke them. Provide `options` to indicate whether `func`
  21974. * should be invoked on the leading and/or trailing edge of the `wait`
  21975. * timeout. The `func` is invoked with the last arguments provided to the
  21976. * throttled function. Subsequent calls to the throttled function return the
  21977. * result of the last `func` invocation.
  21978. *
  21979. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  21980. * invoked on the trailing edge of the timeout only if the throttled function
  21981. * is invoked more than once during the `wait` timeout.
  21982. *
  21983. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  21984. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  21985. *
  21986. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  21987. * for details over the differences between `_.throttle` and `_.debounce`.
  21988. *
  21989. * @static
  21990. * @memberOf _
  21991. * @since 0.1.0
  21992. * @category Function
  21993. * @param {Function} func The function to throttle.
  21994. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  21995. * @param {Object} [options={}] The options object.
  21996. * @param {boolean} [options.leading=true]
  21997. * Specify invoking on the leading edge of the timeout.
  21998. * @param {boolean} [options.trailing=true]
  21999. * Specify invoking on the trailing edge of the timeout.
  22000. * @returns {Function} Returns the new throttled function.
  22001. * @example
  22002. *
  22003. * // Avoid excessively updating the position while scrolling.
  22004. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  22005. *
  22006. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  22007. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  22008. * jQuery(element).on('click', throttled);
  22009. *
  22010. * // Cancel the trailing throttled invocation.
  22011. * jQuery(window).on('popstate', throttled.cancel);
  22012. */
  22013. function throttle(func, wait, options) {
  22014. var leading = true,
  22015. trailing = true;
  22016. if (typeof func != 'function') {
  22017. throw new TypeError(FUNC_ERROR_TEXT);
  22018. }
  22019. if (isObject(options)) {
  22020. leading = 'leading' in options ? !!options.leading : leading;
  22021. trailing = 'trailing' in options ? !!options.trailing : trailing;
  22022. }
  22023. return debounce(func, wait, {
  22024. 'leading': leading,
  22025. 'maxWait': wait,
  22026. 'trailing': trailing
  22027. });
  22028. }
  22029. /**
  22030. * Creates a function that accepts up to one argument, ignoring any
  22031. * additional arguments.
  22032. *
  22033. * @static
  22034. * @memberOf _
  22035. * @since 4.0.0
  22036. * @category Function
  22037. * @param {Function} func The function to cap arguments for.
  22038. * @returns {Function} Returns the new capped function.
  22039. * @example
  22040. *
  22041. * _.map(['6', '8', '10'], _.unary(parseInt));
  22042. * // => [6, 8, 10]
  22043. */
  22044. function unary(func) {
  22045. return ary(func, 1);
  22046. }
  22047. /**
  22048. * Creates a function that provides `value` to `wrapper` as its first
  22049. * argument. Any additional arguments provided to the function are appended
  22050. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  22051. * binding of the created function.
  22052. *
  22053. * @static
  22054. * @memberOf _
  22055. * @since 0.1.0
  22056. * @category Function
  22057. * @param {*} value The value to wrap.
  22058. * @param {Function} [wrapper=identity] The wrapper function.
  22059. * @returns {Function} Returns the new function.
  22060. * @example
  22061. *
  22062. * var p = _.wrap(_.escape, function(func, text) {
  22063. * return '<p>' + func(text) + '</p>';
  22064. * });
  22065. *
  22066. * p('fred, barney, & pebbles');
  22067. * // => '<p>fred, barney, &amp; pebbles</p>'
  22068. */
  22069. function wrap(value, wrapper) {
  22070. return partial(castFunction(wrapper), value);
  22071. }
  22072. /*------------------------------------------------------------------------*/
  22073. /**
  22074. * Casts `value` as an array if it's not one.
  22075. *
  22076. * @static
  22077. * @memberOf _
  22078. * @since 4.4.0
  22079. * @category Lang
  22080. * @param {*} value The value to inspect.
  22081. * @returns {Array} Returns the cast array.
  22082. * @example
  22083. *
  22084. * _.castArray(1);
  22085. * // => [1]
  22086. *
  22087. * _.castArray({ 'a': 1 });
  22088. * // => [{ 'a': 1 }]
  22089. *
  22090. * _.castArray('abc');
  22091. * // => ['abc']
  22092. *
  22093. * _.castArray(null);
  22094. * // => [null]
  22095. *
  22096. * _.castArray(undefined);
  22097. * // => [undefined]
  22098. *
  22099. * _.castArray();
  22100. * // => []
  22101. *
  22102. * var array = [1, 2, 3];
  22103. * console.log(_.castArray(array) === array);
  22104. * // => true
  22105. */
  22106. function castArray() {
  22107. if (!arguments.length) {
  22108. return [];
  22109. }
  22110. var value = arguments[0];
  22111. return isArray(value) ? value : [value];
  22112. }
  22113. /**
  22114. * Creates a shallow clone of `value`.
  22115. *
  22116. * **Note:** This method is loosely based on the
  22117. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  22118. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  22119. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  22120. * arrays. The own enumerable properties of `arguments` objects are cloned
  22121. * as plain objects. An empty object is returned for uncloneable values such
  22122. * as error objects, functions, DOM nodes, and WeakMaps.
  22123. *
  22124. * @static
  22125. * @memberOf _
  22126. * @since 0.1.0
  22127. * @category Lang
  22128. * @param {*} value The value to clone.
  22129. * @returns {*} Returns the cloned value.
  22130. * @see _.cloneDeep
  22131. * @example
  22132. *
  22133. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  22134. *
  22135. * var shallow = _.clone(objects);
  22136. * console.log(shallow[0] === objects[0]);
  22137. * // => true
  22138. */
  22139. function clone(value) {
  22140. return baseClone(value, CLONE_SYMBOLS_FLAG);
  22141. }
  22142. /**
  22143. * This method is like `_.clone` except that it accepts `customizer` which
  22144. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  22145. * cloning is handled by the method instead. The `customizer` is invoked with
  22146. * up to four arguments; (value [, index|key, object, stack]).
  22147. *
  22148. * @static
  22149. * @memberOf _
  22150. * @since 4.0.0
  22151. * @category Lang
  22152. * @param {*} value The value to clone.
  22153. * @param {Function} [customizer] The function to customize cloning.
  22154. * @returns {*} Returns the cloned value.
  22155. * @see _.cloneDeepWith
  22156. * @example
  22157. *
  22158. * function customizer(value) {
  22159. * if (_.isElement(value)) {
  22160. * return value.cloneNode(false);
  22161. * }
  22162. * }
  22163. *
  22164. * var el = _.cloneWith(document.body, customizer);
  22165. *
  22166. * console.log(el === document.body);
  22167. * // => false
  22168. * console.log(el.nodeName);
  22169. * // => 'BODY'
  22170. * console.log(el.childNodes.length);
  22171. * // => 0
  22172. */
  22173. function cloneWith(value, customizer) {
  22174. customizer = typeof customizer == 'function' ? customizer : undefined;
  22175. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  22176. }
  22177. /**
  22178. * This method is like `_.clone` except that it recursively clones `value`.
  22179. *
  22180. * @static
  22181. * @memberOf _
  22182. * @since 1.0.0
  22183. * @category Lang
  22184. * @param {*} value The value to recursively clone.
  22185. * @returns {*} Returns the deep cloned value.
  22186. * @see _.clone
  22187. * @example
  22188. *
  22189. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  22190. *
  22191. * var deep = _.cloneDeep(objects);
  22192. * console.log(deep[0] === objects[0]);
  22193. * // => false
  22194. */
  22195. function cloneDeep(value) {
  22196. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  22197. }
  22198. /**
  22199. * This method is like `_.cloneWith` except that it recursively clones `value`.
  22200. *
  22201. * @static
  22202. * @memberOf _
  22203. * @since 4.0.0
  22204. * @category Lang
  22205. * @param {*} value The value to recursively clone.
  22206. * @param {Function} [customizer] The function to customize cloning.
  22207. * @returns {*} Returns the deep cloned value.
  22208. * @see _.cloneWith
  22209. * @example
  22210. *
  22211. * function customizer(value) {
  22212. * if (_.isElement(value)) {
  22213. * return value.cloneNode(true);
  22214. * }
  22215. * }
  22216. *
  22217. * var el = _.cloneDeepWith(document.body, customizer);
  22218. *
  22219. * console.log(el === document.body);
  22220. * // => false
  22221. * console.log(el.nodeName);
  22222. * // => 'BODY'
  22223. * console.log(el.childNodes.length);
  22224. * // => 20
  22225. */
  22226. function cloneDeepWith(value, customizer) {
  22227. customizer = typeof customizer == 'function' ? customizer : undefined;
  22228. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  22229. }
  22230. /**
  22231. * Checks if `object` conforms to `source` by invoking the predicate
  22232. * properties of `source` with the corresponding property values of `object`.
  22233. *
  22234. * **Note:** This method is equivalent to `_.conforms` when `source` is
  22235. * partially applied.
  22236. *
  22237. * @static
  22238. * @memberOf _
  22239. * @since 4.14.0
  22240. * @category Lang
  22241. * @param {Object} object The object to inspect.
  22242. * @param {Object} source The object of property predicates to conform to.
  22243. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  22244. * @example
  22245. *
  22246. * var object = { 'a': 1, 'b': 2 };
  22247. *
  22248. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  22249. * // => true
  22250. *
  22251. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  22252. * // => false
  22253. */
  22254. function conformsTo(object, source) {
  22255. return source == null || baseConformsTo(object, source, keys(source));
  22256. }
  22257. /**
  22258. * Performs a
  22259. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  22260. * comparison between two values to determine if they are equivalent.
  22261. *
  22262. * @static
  22263. * @memberOf _
  22264. * @since 4.0.0
  22265. * @category Lang
  22266. * @param {*} value The value to compare.
  22267. * @param {*} other The other value to compare.
  22268. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22269. * @example
  22270. *
  22271. * var object = { 'a': 1 };
  22272. * var other = { 'a': 1 };
  22273. *
  22274. * _.eq(object, object);
  22275. * // => true
  22276. *
  22277. * _.eq(object, other);
  22278. * // => false
  22279. *
  22280. * _.eq('a', 'a');
  22281. * // => true
  22282. *
  22283. * _.eq('a', Object('a'));
  22284. * // => false
  22285. *
  22286. * _.eq(NaN, NaN);
  22287. * // => true
  22288. */
  22289. function eq(value, other) {
  22290. return value === other || (value !== value && other !== other);
  22291. }
  22292. /**
  22293. * Checks if `value` is greater than `other`.
  22294. *
  22295. * @static
  22296. * @memberOf _
  22297. * @since 3.9.0
  22298. * @category Lang
  22299. * @param {*} value The value to compare.
  22300. * @param {*} other The other value to compare.
  22301. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  22302. * else `false`.
  22303. * @see _.lt
  22304. * @example
  22305. *
  22306. * _.gt(3, 1);
  22307. * // => true
  22308. *
  22309. * _.gt(3, 3);
  22310. * // => false
  22311. *
  22312. * _.gt(1, 3);
  22313. * // => false
  22314. */
  22315. var gt = createRelationalOperation(baseGt);
  22316. /**
  22317. * Checks if `value` is greater than or equal to `other`.
  22318. *
  22319. * @static
  22320. * @memberOf _
  22321. * @since 3.9.0
  22322. * @category Lang
  22323. * @param {*} value The value to compare.
  22324. * @param {*} other The other value to compare.
  22325. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  22326. * `other`, else `false`.
  22327. * @see _.lte
  22328. * @example
  22329. *
  22330. * _.gte(3, 1);
  22331. * // => true
  22332. *
  22333. * _.gte(3, 3);
  22334. * // => true
  22335. *
  22336. * _.gte(1, 3);
  22337. * // => false
  22338. */
  22339. var gte = createRelationalOperation(function(value, other) {
  22340. return value >= other;
  22341. });
  22342. /**
  22343. * Checks if `value` is likely an `arguments` object.
  22344. *
  22345. * @static
  22346. * @memberOf _
  22347. * @since 0.1.0
  22348. * @category Lang
  22349. * @param {*} value The value to check.
  22350. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22351. * else `false`.
  22352. * @example
  22353. *
  22354. * _.isArguments(function() { return arguments; }());
  22355. * // => true
  22356. *
  22357. * _.isArguments([1, 2, 3]);
  22358. * // => false
  22359. */
  22360. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  22361. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  22362. !propertyIsEnumerable.call(value, 'callee');
  22363. };
  22364. /**
  22365. * Checks if `value` is classified as an `Array` object.
  22366. *
  22367. * @static
  22368. * @memberOf _
  22369. * @since 0.1.0
  22370. * @category Lang
  22371. * @param {*} value The value to check.
  22372. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  22373. * @example
  22374. *
  22375. * _.isArray([1, 2, 3]);
  22376. * // => true
  22377. *
  22378. * _.isArray(document.body.children);
  22379. * // => false
  22380. *
  22381. * _.isArray('abc');
  22382. * // => false
  22383. *
  22384. * _.isArray(_.noop);
  22385. * // => false
  22386. */
  22387. var isArray = Array.isArray;
  22388. /**
  22389. * Checks if `value` is classified as an `ArrayBuffer` object.
  22390. *
  22391. * @static
  22392. * @memberOf _
  22393. * @since 4.3.0
  22394. * @category Lang
  22395. * @param {*} value The value to check.
  22396. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22397. * @example
  22398. *
  22399. * _.isArrayBuffer(new ArrayBuffer(2));
  22400. * // => true
  22401. *
  22402. * _.isArrayBuffer(new Array(2));
  22403. * // => false
  22404. */
  22405. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  22406. /**
  22407. * Checks if `value` is array-like. A value is considered array-like if it's
  22408. * not a function and has a `value.length` that's an integer greater than or
  22409. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  22410. *
  22411. * @static
  22412. * @memberOf _
  22413. * @since 4.0.0
  22414. * @category Lang
  22415. * @param {*} value The value to check.
  22416. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  22417. * @example
  22418. *
  22419. * _.isArrayLike([1, 2, 3]);
  22420. * // => true
  22421. *
  22422. * _.isArrayLike(document.body.children);
  22423. * // => true
  22424. *
  22425. * _.isArrayLike('abc');
  22426. * // => true
  22427. *
  22428. * _.isArrayLike(_.noop);
  22429. * // => false
  22430. */
  22431. function isArrayLike(value) {
  22432. return value != null && isLength(value.length) && !isFunction(value);
  22433. }
  22434. /**
  22435. * This method is like `_.isArrayLike` except that it also checks if `value`
  22436. * is an object.
  22437. *
  22438. * @static
  22439. * @memberOf _
  22440. * @since 4.0.0
  22441. * @category Lang
  22442. * @param {*} value The value to check.
  22443. * @returns {boolean} Returns `true` if `value` is an array-like object,
  22444. * else `false`.
  22445. * @example
  22446. *
  22447. * _.isArrayLikeObject([1, 2, 3]);
  22448. * // => true
  22449. *
  22450. * _.isArrayLikeObject(document.body.children);
  22451. * // => true
  22452. *
  22453. * _.isArrayLikeObject('abc');
  22454. * // => false
  22455. *
  22456. * _.isArrayLikeObject(_.noop);
  22457. * // => false
  22458. */
  22459. function isArrayLikeObject(value) {
  22460. return isObjectLike(value) && isArrayLike(value);
  22461. }
  22462. /**
  22463. * Checks if `value` is classified as a boolean primitive or object.
  22464. *
  22465. * @static
  22466. * @memberOf _
  22467. * @since 0.1.0
  22468. * @category Lang
  22469. * @param {*} value The value to check.
  22470. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  22471. * @example
  22472. *
  22473. * _.isBoolean(false);
  22474. * // => true
  22475. *
  22476. * _.isBoolean(null);
  22477. * // => false
  22478. */
  22479. function isBoolean(value) {
  22480. return value === true || value === false ||
  22481. (isObjectLike(value) && baseGetTag(value) == boolTag);
  22482. }
  22483. /**
  22484. * Checks if `value` is a buffer.
  22485. *
  22486. * @static
  22487. * @memberOf _
  22488. * @since 4.3.0
  22489. * @category Lang
  22490. * @param {*} value The value to check.
  22491. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  22492. * @example
  22493. *
  22494. * _.isBuffer(new Buffer(2));
  22495. * // => true
  22496. *
  22497. * _.isBuffer(new Uint8Array(2));
  22498. * // => false
  22499. */
  22500. var isBuffer = nativeIsBuffer || stubFalse;
  22501. /**
  22502. * Checks if `value` is classified as a `Date` object.
  22503. *
  22504. * @static
  22505. * @memberOf _
  22506. * @since 0.1.0
  22507. * @category Lang
  22508. * @param {*} value The value to check.
  22509. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22510. * @example
  22511. *
  22512. * _.isDate(new Date);
  22513. * // => true
  22514. *
  22515. * _.isDate('Mon April 23 2012');
  22516. * // => false
  22517. */
  22518. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  22519. /**
  22520. * Checks if `value` is likely a DOM element.
  22521. *
  22522. * @static
  22523. * @memberOf _
  22524. * @since 0.1.0
  22525. * @category Lang
  22526. * @param {*} value The value to check.
  22527. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  22528. * @example
  22529. *
  22530. * _.isElement(document.body);
  22531. * // => true
  22532. *
  22533. * _.isElement('<body>');
  22534. * // => false
  22535. */
  22536. function isElement(value) {
  22537. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  22538. }
  22539. /**
  22540. * Checks if `value` is an empty object, collection, map, or set.
  22541. *
  22542. * Objects are considered empty if they have no own enumerable string keyed
  22543. * properties.
  22544. *
  22545. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  22546. * jQuery-like collections are considered empty if they have a `length` of `0`.
  22547. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  22548. *
  22549. * @static
  22550. * @memberOf _
  22551. * @since 0.1.0
  22552. * @category Lang
  22553. * @param {*} value The value to check.
  22554. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  22555. * @example
  22556. *
  22557. * _.isEmpty(null);
  22558. * // => true
  22559. *
  22560. * _.isEmpty(true);
  22561. * // => true
  22562. *
  22563. * _.isEmpty(1);
  22564. * // => true
  22565. *
  22566. * _.isEmpty([1, 2, 3]);
  22567. * // => false
  22568. *
  22569. * _.isEmpty({ 'a': 1 });
  22570. * // => false
  22571. */
  22572. function isEmpty(value) {
  22573. if (value == null) {
  22574. return true;
  22575. }
  22576. if (isArrayLike(value) &&
  22577. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  22578. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  22579. return !value.length;
  22580. }
  22581. var tag = getTag(value);
  22582. if (tag == mapTag || tag == setTag) {
  22583. return !value.size;
  22584. }
  22585. if (isPrototype(value)) {
  22586. return !baseKeys(value).length;
  22587. }
  22588. for (var key in value) {
  22589. if (hasOwnProperty.call(value, key)) {
  22590. return false;
  22591. }
  22592. }
  22593. return true;
  22594. }
  22595. /**
  22596. * Performs a deep comparison between two values to determine if they are
  22597. * equivalent.
  22598. *
  22599. * **Note:** This method supports comparing arrays, array buffers, booleans,
  22600. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  22601. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  22602. * by their own, not inherited, enumerable properties. Functions and DOM
  22603. * nodes are compared by strict equality, i.e. `===`.
  22604. *
  22605. * @static
  22606. * @memberOf _
  22607. * @since 0.1.0
  22608. * @category Lang
  22609. * @param {*} value The value to compare.
  22610. * @param {*} other The other value to compare.
  22611. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22612. * @example
  22613. *
  22614. * var object = { 'a': 1 };
  22615. * var other = { 'a': 1 };
  22616. *
  22617. * _.isEqual(object, other);
  22618. * // => true
  22619. *
  22620. * object === other;
  22621. * // => false
  22622. */
  22623. function isEqual(value, other) {
  22624. return baseIsEqual(value, other);
  22625. }
  22626. /**
  22627. * This method is like `_.isEqual` except that it accepts `customizer` which
  22628. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  22629. * are handled by the method instead. The `customizer` is invoked with up to
  22630. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  22631. *
  22632. * @static
  22633. * @memberOf _
  22634. * @since 4.0.0
  22635. * @category Lang
  22636. * @param {*} value The value to compare.
  22637. * @param {*} other The other value to compare.
  22638. * @param {Function} [customizer] The function to customize comparisons.
  22639. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22640. * @example
  22641. *
  22642. * function isGreeting(value) {
  22643. * return /^h(?:i|ello)$/.test(value);
  22644. * }
  22645. *
  22646. * function customizer(objValue, othValue) {
  22647. * if (isGreeting(objValue) && isGreeting(othValue)) {
  22648. * return true;
  22649. * }
  22650. * }
  22651. *
  22652. * var array = ['hello', 'goodbye'];
  22653. * var other = ['hi', 'goodbye'];
  22654. *
  22655. * _.isEqualWith(array, other, customizer);
  22656. * // => true
  22657. */
  22658. function isEqualWith(value, other, customizer) {
  22659. customizer = typeof customizer == 'function' ? customizer : undefined;
  22660. var result = customizer ? customizer(value, other) : undefined;
  22661. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  22662. }
  22663. /**
  22664. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  22665. * `SyntaxError`, `TypeError`, or `URIError` object.
  22666. *
  22667. * @static
  22668. * @memberOf _
  22669. * @since 3.0.0
  22670. * @category Lang
  22671. * @param {*} value The value to check.
  22672. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  22673. * @example
  22674. *
  22675. * _.isError(new Error);
  22676. * // => true
  22677. *
  22678. * _.isError(Error);
  22679. * // => false
  22680. */
  22681. function isError(value) {
  22682. if (!isObjectLike(value)) {
  22683. return false;
  22684. }
  22685. var tag = baseGetTag(value);
  22686. return tag == errorTag || tag == domExcTag ||
  22687. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  22688. }
  22689. /**
  22690. * Checks if `value` is a finite primitive number.
  22691. *
  22692. * **Note:** This method is based on
  22693. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  22694. *
  22695. * @static
  22696. * @memberOf _
  22697. * @since 0.1.0
  22698. * @category Lang
  22699. * @param {*} value The value to check.
  22700. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  22701. * @example
  22702. *
  22703. * _.isFinite(3);
  22704. * // => true
  22705. *
  22706. * _.isFinite(Number.MIN_VALUE);
  22707. * // => true
  22708. *
  22709. * _.isFinite(Infinity);
  22710. * // => false
  22711. *
  22712. * _.isFinite('3');
  22713. * // => false
  22714. */
  22715. function isFinite(value) {
  22716. return typeof value == 'number' && nativeIsFinite(value);
  22717. }
  22718. /**
  22719. * Checks if `value` is classified as a `Function` object.
  22720. *
  22721. * @static
  22722. * @memberOf _
  22723. * @since 0.1.0
  22724. * @category Lang
  22725. * @param {*} value The value to check.
  22726. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  22727. * @example
  22728. *
  22729. * _.isFunction(_);
  22730. * // => true
  22731. *
  22732. * _.isFunction(/abc/);
  22733. * // => false
  22734. */
  22735. function isFunction(value) {
  22736. if (!isObject(value)) {
  22737. return false;
  22738. }
  22739. // The use of `Object#toString` avoids issues with the `typeof` operator
  22740. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  22741. var tag = baseGetTag(value);
  22742. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  22743. }
  22744. /**
  22745. * Checks if `value` is an integer.
  22746. *
  22747. * **Note:** This method is based on
  22748. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  22749. *
  22750. * @static
  22751. * @memberOf _
  22752. * @since 4.0.0
  22753. * @category Lang
  22754. * @param {*} value The value to check.
  22755. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  22756. * @example
  22757. *
  22758. * _.isInteger(3);
  22759. * // => true
  22760. *
  22761. * _.isInteger(Number.MIN_VALUE);
  22762. * // => false
  22763. *
  22764. * _.isInteger(Infinity);
  22765. * // => false
  22766. *
  22767. * _.isInteger('3');
  22768. * // => false
  22769. */
  22770. function isInteger(value) {
  22771. return typeof value == 'number' && value == toInteger(value);
  22772. }
  22773. /**
  22774. * Checks if `value` is a valid array-like length.
  22775. *
  22776. * **Note:** This method is loosely based on
  22777. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  22778. *
  22779. * @static
  22780. * @memberOf _
  22781. * @since 4.0.0
  22782. * @category Lang
  22783. * @param {*} value The value to check.
  22784. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  22785. * @example
  22786. *
  22787. * _.isLength(3);
  22788. * // => true
  22789. *
  22790. * _.isLength(Number.MIN_VALUE);
  22791. * // => false
  22792. *
  22793. * _.isLength(Infinity);
  22794. * // => false
  22795. *
  22796. * _.isLength('3');
  22797. * // => false
  22798. */
  22799. function isLength(value) {
  22800. return typeof value == 'number' &&
  22801. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  22802. }
  22803. /**
  22804. * Checks if `value` is the
  22805. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  22806. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  22807. *
  22808. * @static
  22809. * @memberOf _
  22810. * @since 0.1.0
  22811. * @category Lang
  22812. * @param {*} value The value to check.
  22813. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  22814. * @example
  22815. *
  22816. * _.isObject({});
  22817. * // => true
  22818. *
  22819. * _.isObject([1, 2, 3]);
  22820. * // => true
  22821. *
  22822. * _.isObject(_.noop);
  22823. * // => true
  22824. *
  22825. * _.isObject(null);
  22826. * // => false
  22827. */
  22828. function isObject(value) {
  22829. var type = typeof value;
  22830. return value != null && (type == 'object' || type == 'function');
  22831. }
  22832. /**
  22833. * Checks if `value` is object-like. A value is object-like if it's not `null`
  22834. * and has a `typeof` result of "object".
  22835. *
  22836. * @static
  22837. * @memberOf _
  22838. * @since 4.0.0
  22839. * @category Lang
  22840. * @param {*} value The value to check.
  22841. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  22842. * @example
  22843. *
  22844. * _.isObjectLike({});
  22845. * // => true
  22846. *
  22847. * _.isObjectLike([1, 2, 3]);
  22848. * // => true
  22849. *
  22850. * _.isObjectLike(_.noop);
  22851. * // => false
  22852. *
  22853. * _.isObjectLike(null);
  22854. * // => false
  22855. */
  22856. function isObjectLike(value) {
  22857. return value != null && typeof value == 'object';
  22858. }
  22859. /**
  22860. * Checks if `value` is classified as a `Map` object.
  22861. *
  22862. * @static
  22863. * @memberOf _
  22864. * @since 4.3.0
  22865. * @category Lang
  22866. * @param {*} value The value to check.
  22867. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22868. * @example
  22869. *
  22870. * _.isMap(new Map);
  22871. * // => true
  22872. *
  22873. * _.isMap(new WeakMap);
  22874. * // => false
  22875. */
  22876. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  22877. /**
  22878. * Performs a partial deep comparison between `object` and `source` to
  22879. * determine if `object` contains equivalent property values.
  22880. *
  22881. * **Note:** This method is equivalent to `_.matches` when `source` is
  22882. * partially applied.
  22883. *
  22884. * Partial comparisons will match empty array and empty object `source`
  22885. * values against any array or object value, respectively. See `_.isEqual`
  22886. * for a list of supported value comparisons.
  22887. *
  22888. * @static
  22889. * @memberOf _
  22890. * @since 3.0.0
  22891. * @category Lang
  22892. * @param {Object} object The object to inspect.
  22893. * @param {Object} source The object of property values to match.
  22894. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22895. * @example
  22896. *
  22897. * var object = { 'a': 1, 'b': 2 };
  22898. *
  22899. * _.isMatch(object, { 'b': 2 });
  22900. * // => true
  22901. *
  22902. * _.isMatch(object, { 'b': 1 });
  22903. * // => false
  22904. */
  22905. function isMatch(object, source) {
  22906. return object === source || baseIsMatch(object, source, getMatchData(source));
  22907. }
  22908. /**
  22909. * This method is like `_.isMatch` except that it accepts `customizer` which
  22910. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  22911. * are handled by the method instead. The `customizer` is invoked with five
  22912. * arguments: (objValue, srcValue, index|key, object, source).
  22913. *
  22914. * @static
  22915. * @memberOf _
  22916. * @since 4.0.0
  22917. * @category Lang
  22918. * @param {Object} object The object to inspect.
  22919. * @param {Object} source The object of property values to match.
  22920. * @param {Function} [customizer] The function to customize comparisons.
  22921. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22922. * @example
  22923. *
  22924. * function isGreeting(value) {
  22925. * return /^h(?:i|ello)$/.test(value);
  22926. * }
  22927. *
  22928. * function customizer(objValue, srcValue) {
  22929. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  22930. * return true;
  22931. * }
  22932. * }
  22933. *
  22934. * var object = { 'greeting': 'hello' };
  22935. * var source = { 'greeting': 'hi' };
  22936. *
  22937. * _.isMatchWith(object, source, customizer);
  22938. * // => true
  22939. */
  22940. function isMatchWith(object, source, customizer) {
  22941. customizer = typeof customizer == 'function' ? customizer : undefined;
  22942. return baseIsMatch(object, source, getMatchData(source), customizer);
  22943. }
  22944. /**
  22945. * Checks if `value` is `NaN`.
  22946. *
  22947. * **Note:** This method is based on
  22948. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  22949. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  22950. * `undefined` and other non-number values.
  22951. *
  22952. * @static
  22953. * @memberOf _
  22954. * @since 0.1.0
  22955. * @category Lang
  22956. * @param {*} value The value to check.
  22957. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  22958. * @example
  22959. *
  22960. * _.isNaN(NaN);
  22961. * // => true
  22962. *
  22963. * _.isNaN(new Number(NaN));
  22964. * // => true
  22965. *
  22966. * isNaN(undefined);
  22967. * // => true
  22968. *
  22969. * _.isNaN(undefined);
  22970. * // => false
  22971. */
  22972. function isNaN(value) {
  22973. // An `NaN` primitive is the only value that is not equal to itself.
  22974. // Perform the `toStringTag` check first to avoid errors with some
  22975. // ActiveX objects in IE.
  22976. return isNumber(value) && value != +value;
  22977. }
  22978. /**
  22979. * Checks if `value` is a pristine native function.
  22980. *
  22981. * **Note:** This method can't reliably detect native functions in the presence
  22982. * of the core-js package because core-js circumvents this kind of detection.
  22983. * Despite multiple requests, the core-js maintainer has made it clear: any
  22984. * attempt to fix the detection will be obstructed. As a result, we're left
  22985. * with little choice but to throw an error. Unfortunately, this also affects
  22986. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  22987. * which rely on core-js.
  22988. *
  22989. * @static
  22990. * @memberOf _
  22991. * @since 3.0.0
  22992. * @category Lang
  22993. * @param {*} value The value to check.
  22994. * @returns {boolean} Returns `true` if `value` is a native function,
  22995. * else `false`.
  22996. * @example
  22997. *
  22998. * _.isNative(Array.prototype.push);
  22999. * // => true
  23000. *
  23001. * _.isNative(_);
  23002. * // => false
  23003. */
  23004. function isNative(value) {
  23005. if (isMaskable(value)) {
  23006. throw new Error(CORE_ERROR_TEXT);
  23007. }
  23008. return baseIsNative(value);
  23009. }
  23010. /**
  23011. * Checks if `value` is `null`.
  23012. *
  23013. * @static
  23014. * @memberOf _
  23015. * @since 0.1.0
  23016. * @category Lang
  23017. * @param {*} value The value to check.
  23018. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  23019. * @example
  23020. *
  23021. * _.isNull(null);
  23022. * // => true
  23023. *
  23024. * _.isNull(void 0);
  23025. * // => false
  23026. */
  23027. function isNull(value) {
  23028. return value === null;
  23029. }
  23030. /**
  23031. * Checks if `value` is `null` or `undefined`.
  23032. *
  23033. * @static
  23034. * @memberOf _
  23035. * @since 4.0.0
  23036. * @category Lang
  23037. * @param {*} value The value to check.
  23038. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  23039. * @example
  23040. *
  23041. * _.isNil(null);
  23042. * // => true
  23043. *
  23044. * _.isNil(void 0);
  23045. * // => true
  23046. *
  23047. * _.isNil(NaN);
  23048. * // => false
  23049. */
  23050. function isNil(value) {
  23051. return value == null;
  23052. }
  23053. /**
  23054. * Checks if `value` is classified as a `Number` primitive or object.
  23055. *
  23056. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  23057. * classified as numbers, use the `_.isFinite` method.
  23058. *
  23059. * @static
  23060. * @memberOf _
  23061. * @since 0.1.0
  23062. * @category Lang
  23063. * @param {*} value The value to check.
  23064. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  23065. * @example
  23066. *
  23067. * _.isNumber(3);
  23068. * // => true
  23069. *
  23070. * _.isNumber(Number.MIN_VALUE);
  23071. * // => true
  23072. *
  23073. * _.isNumber(Infinity);
  23074. * // => true
  23075. *
  23076. * _.isNumber('3');
  23077. * // => false
  23078. */
  23079. function isNumber(value) {
  23080. return typeof value == 'number' ||
  23081. (isObjectLike(value) && baseGetTag(value) == numberTag);
  23082. }
  23083. /**
  23084. * Checks if `value` is a plain object, that is, an object created by the
  23085. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  23086. *
  23087. * @static
  23088. * @memberOf _
  23089. * @since 0.8.0
  23090. * @category Lang
  23091. * @param {*} value The value to check.
  23092. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  23093. * @example
  23094. *
  23095. * function Foo() {
  23096. * this.a = 1;
  23097. * }
  23098. *
  23099. * _.isPlainObject(new Foo);
  23100. * // => false
  23101. *
  23102. * _.isPlainObject([1, 2, 3]);
  23103. * // => false
  23104. *
  23105. * _.isPlainObject({ 'x': 0, 'y': 0 });
  23106. * // => true
  23107. *
  23108. * _.isPlainObject(Object.create(null));
  23109. * // => true
  23110. */
  23111. function isPlainObject(value) {
  23112. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  23113. return false;
  23114. }
  23115. var proto = getPrototype(value);
  23116. if (proto === null) {
  23117. return true;
  23118. }
  23119. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  23120. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  23121. funcToString.call(Ctor) == objectCtorString;
  23122. }
  23123. /**
  23124. * Checks if `value` is classified as a `RegExp` object.
  23125. *
  23126. * @static
  23127. * @memberOf _
  23128. * @since 0.1.0
  23129. * @category Lang
  23130. * @param {*} value The value to check.
  23131. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  23132. * @example
  23133. *
  23134. * _.isRegExp(/abc/);
  23135. * // => true
  23136. *
  23137. * _.isRegExp('/abc/');
  23138. * // => false
  23139. */
  23140. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  23141. /**
  23142. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  23143. * double precision number which isn't the result of a rounded unsafe integer.
  23144. *
  23145. * **Note:** This method is based on
  23146. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  23147. *
  23148. * @static
  23149. * @memberOf _
  23150. * @since 4.0.0
  23151. * @category Lang
  23152. * @param {*} value The value to check.
  23153. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  23154. * @example
  23155. *
  23156. * _.isSafeInteger(3);
  23157. * // => true
  23158. *
  23159. * _.isSafeInteger(Number.MIN_VALUE);
  23160. * // => false
  23161. *
  23162. * _.isSafeInteger(Infinity);
  23163. * // => false
  23164. *
  23165. * _.isSafeInteger('3');
  23166. * // => false
  23167. */
  23168. function isSafeInteger(value) {
  23169. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  23170. }
  23171. /**
  23172. * Checks if `value` is classified as a `Set` object.
  23173. *
  23174. * @static
  23175. * @memberOf _
  23176. * @since 4.3.0
  23177. * @category Lang
  23178. * @param {*} value The value to check.
  23179. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  23180. * @example
  23181. *
  23182. * _.isSet(new Set);
  23183. * // => true
  23184. *
  23185. * _.isSet(new WeakSet);
  23186. * // => false
  23187. */
  23188. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  23189. /**
  23190. * Checks if `value` is classified as a `String` primitive or object.
  23191. *
  23192. * @static
  23193. * @since 0.1.0
  23194. * @memberOf _
  23195. * @category Lang
  23196. * @param {*} value The value to check.
  23197. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  23198. * @example
  23199. *
  23200. * _.isString('abc');
  23201. * // => true
  23202. *
  23203. * _.isString(1);
  23204. * // => false
  23205. */
  23206. function isString(value) {
  23207. return typeof value == 'string' ||
  23208. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  23209. }
  23210. /**
  23211. * Checks if `value` is classified as a `Symbol` primitive or object.
  23212. *
  23213. * @static
  23214. * @memberOf _
  23215. * @since 4.0.0
  23216. * @category Lang
  23217. * @param {*} value The value to check.
  23218. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  23219. * @example
  23220. *
  23221. * _.isSymbol(Symbol.iterator);
  23222. * // => true
  23223. *
  23224. * _.isSymbol('abc');
  23225. * // => false
  23226. */
  23227. function isSymbol(value) {
  23228. return typeof value == 'symbol' ||
  23229. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  23230. }
  23231. /**
  23232. * Checks if `value` is classified as a typed array.
  23233. *
  23234. * @static
  23235. * @memberOf _
  23236. * @since 3.0.0
  23237. * @category Lang
  23238. * @param {*} value The value to check.
  23239. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  23240. * @example
  23241. *
  23242. * _.isTypedArray(new Uint8Array);
  23243. * // => true
  23244. *
  23245. * _.isTypedArray([]);
  23246. * // => false
  23247. */
  23248. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  23249. /**
  23250. * Checks if `value` is `undefined`.
  23251. *
  23252. * @static
  23253. * @since 0.1.0
  23254. * @memberOf _
  23255. * @category Lang
  23256. * @param {*} value The value to check.
  23257. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  23258. * @example
  23259. *
  23260. * _.isUndefined(void 0);
  23261. * // => true
  23262. *
  23263. * _.isUndefined(null);
  23264. * // => false
  23265. */
  23266. function isUndefined(value) {
  23267. return value === undefined;
  23268. }
  23269. /**
  23270. * Checks if `value` is classified as a `WeakMap` object.
  23271. *
  23272. * @static
  23273. * @memberOf _
  23274. * @since 4.3.0
  23275. * @category Lang
  23276. * @param {*} value The value to check.
  23277. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  23278. * @example
  23279. *
  23280. * _.isWeakMap(new WeakMap);
  23281. * // => true
  23282. *
  23283. * _.isWeakMap(new Map);
  23284. * // => false
  23285. */
  23286. function isWeakMap(value) {
  23287. return isObjectLike(value) && getTag(value) == weakMapTag;
  23288. }
  23289. /**
  23290. * Checks if `value` is classified as a `WeakSet` object.
  23291. *
  23292. * @static
  23293. * @memberOf _
  23294. * @since 4.3.0
  23295. * @category Lang
  23296. * @param {*} value The value to check.
  23297. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  23298. * @example
  23299. *
  23300. * _.isWeakSet(new WeakSet);
  23301. * // => true
  23302. *
  23303. * _.isWeakSet(new Set);
  23304. * // => false
  23305. */
  23306. function isWeakSet(value) {
  23307. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  23308. }
  23309. /**
  23310. * Checks if `value` is less than `other`.
  23311. *
  23312. * @static
  23313. * @memberOf _
  23314. * @since 3.9.0
  23315. * @category Lang
  23316. * @param {*} value The value to compare.
  23317. * @param {*} other The other value to compare.
  23318. * @returns {boolean} Returns `true` if `value` is less than `other`,
  23319. * else `false`.
  23320. * @see _.gt
  23321. * @example
  23322. *
  23323. * _.lt(1, 3);
  23324. * // => true
  23325. *
  23326. * _.lt(3, 3);
  23327. * // => false
  23328. *
  23329. * _.lt(3, 1);
  23330. * // => false
  23331. */
  23332. var lt = createRelationalOperation(baseLt);
  23333. /**
  23334. * Checks if `value` is less than or equal to `other`.
  23335. *
  23336. * @static
  23337. * @memberOf _
  23338. * @since 3.9.0
  23339. * @category Lang
  23340. * @param {*} value The value to compare.
  23341. * @param {*} other The other value to compare.
  23342. * @returns {boolean} Returns `true` if `value` is less than or equal to
  23343. * `other`, else `false`.
  23344. * @see _.gte
  23345. * @example
  23346. *
  23347. * _.lte(1, 3);
  23348. * // => true
  23349. *
  23350. * _.lte(3, 3);
  23351. * // => true
  23352. *
  23353. * _.lte(3, 1);
  23354. * // => false
  23355. */
  23356. var lte = createRelationalOperation(function(value, other) {
  23357. return value <= other;
  23358. });
  23359. /**
  23360. * Converts `value` to an array.
  23361. *
  23362. * @static
  23363. * @since 0.1.0
  23364. * @memberOf _
  23365. * @category Lang
  23366. * @param {*} value The value to convert.
  23367. * @returns {Array} Returns the converted array.
  23368. * @example
  23369. *
  23370. * _.toArray({ 'a': 1, 'b': 2 });
  23371. * // => [1, 2]
  23372. *
  23373. * _.toArray('abc');
  23374. * // => ['a', 'b', 'c']
  23375. *
  23376. * _.toArray(1);
  23377. * // => []
  23378. *
  23379. * _.toArray(null);
  23380. * // => []
  23381. */
  23382. function toArray(value) {
  23383. if (!value) {
  23384. return [];
  23385. }
  23386. if (isArrayLike(value)) {
  23387. return isString(value) ? stringToArray(value) : copyArray(value);
  23388. }
  23389. if (symIterator && value[symIterator]) {
  23390. return iteratorToArray(value[symIterator]());
  23391. }
  23392. var tag = getTag(value),
  23393. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  23394. return func(value);
  23395. }
  23396. /**
  23397. * Converts `value` to a finite number.
  23398. *
  23399. * @static
  23400. * @memberOf _
  23401. * @since 4.12.0
  23402. * @category Lang
  23403. * @param {*} value The value to convert.
  23404. * @returns {number} Returns the converted number.
  23405. * @example
  23406. *
  23407. * _.toFinite(3.2);
  23408. * // => 3.2
  23409. *
  23410. * _.toFinite(Number.MIN_VALUE);
  23411. * // => 5e-324
  23412. *
  23413. * _.toFinite(Infinity);
  23414. * // => 1.7976931348623157e+308
  23415. *
  23416. * _.toFinite('3.2');
  23417. * // => 3.2
  23418. */
  23419. function toFinite(value) {
  23420. if (!value) {
  23421. return value === 0 ? value : 0;
  23422. }
  23423. value = toNumber(value);
  23424. if (value === INFINITY || value === -INFINITY) {
  23425. var sign = (value < 0 ? -1 : 1);
  23426. return sign * MAX_INTEGER;
  23427. }
  23428. return value === value ? value : 0;
  23429. }
  23430. /**
  23431. * Converts `value` to an integer.
  23432. *
  23433. * **Note:** This method is loosely based on
  23434. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  23435. *
  23436. * @static
  23437. * @memberOf _
  23438. * @since 4.0.0
  23439. * @category Lang
  23440. * @param {*} value The value to convert.
  23441. * @returns {number} Returns the converted integer.
  23442. * @example
  23443. *
  23444. * _.toInteger(3.2);
  23445. * // => 3
  23446. *
  23447. * _.toInteger(Number.MIN_VALUE);
  23448. * // => 0
  23449. *
  23450. * _.toInteger(Infinity);
  23451. * // => 1.7976931348623157e+308
  23452. *
  23453. * _.toInteger('3.2');
  23454. * // => 3
  23455. */
  23456. function toInteger(value) {
  23457. var result = toFinite(value),
  23458. remainder = result % 1;
  23459. return result === result ? (remainder ? result - remainder : result) : 0;
  23460. }
  23461. /**
  23462. * Converts `value` to an integer suitable for use as the length of an
  23463. * array-like object.
  23464. *
  23465. * **Note:** This method is based on
  23466. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  23467. *
  23468. * @static
  23469. * @memberOf _
  23470. * @since 4.0.0
  23471. * @category Lang
  23472. * @param {*} value The value to convert.
  23473. * @returns {number} Returns the converted integer.
  23474. * @example
  23475. *
  23476. * _.toLength(3.2);
  23477. * // => 3
  23478. *
  23479. * _.toLength(Number.MIN_VALUE);
  23480. * // => 0
  23481. *
  23482. * _.toLength(Infinity);
  23483. * // => 4294967295
  23484. *
  23485. * _.toLength('3.2');
  23486. * // => 3
  23487. */
  23488. function toLength(value) {
  23489. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  23490. }
  23491. /**
  23492. * Converts `value` to a number.
  23493. *
  23494. * @static
  23495. * @memberOf _
  23496. * @since 4.0.0
  23497. * @category Lang
  23498. * @param {*} value The value to process.
  23499. * @returns {number} Returns the number.
  23500. * @example
  23501. *
  23502. * _.toNumber(3.2);
  23503. * // => 3.2
  23504. *
  23505. * _.toNumber(Number.MIN_VALUE);
  23506. * // => 5e-324
  23507. *
  23508. * _.toNumber(Infinity);
  23509. * // => Infinity
  23510. *
  23511. * _.toNumber('3.2');
  23512. * // => 3.2
  23513. */
  23514. function toNumber(value) {
  23515. if (typeof value == 'number') {
  23516. return value;
  23517. }
  23518. if (isSymbol(value)) {
  23519. return NAN;
  23520. }
  23521. if (isObject(value)) {
  23522. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  23523. value = isObject(other) ? (other + '') : other;
  23524. }
  23525. if (typeof value != 'string') {
  23526. return value === 0 ? value : +value;
  23527. }
  23528. value = value.replace(reTrim, '');
  23529. var isBinary = reIsBinary.test(value);
  23530. return (isBinary || reIsOctal.test(value))
  23531. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  23532. : (reIsBadHex.test(value) ? NAN : +value);
  23533. }
  23534. /**
  23535. * Converts `value` to a plain object flattening inherited enumerable string
  23536. * keyed properties of `value` to own properties of the plain object.
  23537. *
  23538. * @static
  23539. * @memberOf _
  23540. * @since 3.0.0
  23541. * @category Lang
  23542. * @param {*} value The value to convert.
  23543. * @returns {Object} Returns the converted plain object.
  23544. * @example
  23545. *
  23546. * function Foo() {
  23547. * this.b = 2;
  23548. * }
  23549. *
  23550. * Foo.prototype.c = 3;
  23551. *
  23552. * _.assign({ 'a': 1 }, new Foo);
  23553. * // => { 'a': 1, 'b': 2 }
  23554. *
  23555. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  23556. * // => { 'a': 1, 'b': 2, 'c': 3 }
  23557. */
  23558. function toPlainObject(value) {
  23559. return copyObject(value, keysIn(value));
  23560. }
  23561. /**
  23562. * Converts `value` to a safe integer. A safe integer can be compared and
  23563. * represented correctly.
  23564. *
  23565. * @static
  23566. * @memberOf _
  23567. * @since 4.0.0
  23568. * @category Lang
  23569. * @param {*} value The value to convert.
  23570. * @returns {number} Returns the converted integer.
  23571. * @example
  23572. *
  23573. * _.toSafeInteger(3.2);
  23574. * // => 3
  23575. *
  23576. * _.toSafeInteger(Number.MIN_VALUE);
  23577. * // => 0
  23578. *
  23579. * _.toSafeInteger(Infinity);
  23580. * // => 9007199254740991
  23581. *
  23582. * _.toSafeInteger('3.2');
  23583. * // => 3
  23584. */
  23585. function toSafeInteger(value) {
  23586. return value
  23587. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  23588. : (value === 0 ? value : 0);
  23589. }
  23590. /**
  23591. * Converts `value` to a string. An empty string is returned for `null`
  23592. * and `undefined` values. The sign of `-0` is preserved.
  23593. *
  23594. * @static
  23595. * @memberOf _
  23596. * @since 4.0.0
  23597. * @category Lang
  23598. * @param {*} value The value to convert.
  23599. * @returns {string} Returns the converted string.
  23600. * @example
  23601. *
  23602. * _.toString(null);
  23603. * // => ''
  23604. *
  23605. * _.toString(-0);
  23606. * // => '-0'
  23607. *
  23608. * _.toString([1, 2, 3]);
  23609. * // => '1,2,3'
  23610. */
  23611. function toString(value) {
  23612. return value == null ? '' : baseToString(value);
  23613. }
  23614. /*------------------------------------------------------------------------*/
  23615. /**
  23616. * Assigns own enumerable string keyed properties of source objects to the
  23617. * destination object. Source objects are applied from left to right.
  23618. * Subsequent sources overwrite property assignments of previous sources.
  23619. *
  23620. * **Note:** This method mutates `object` and is loosely based on
  23621. * [`Object.assign`](https://mdn.io/Object/assign).
  23622. *
  23623. * @static
  23624. * @memberOf _
  23625. * @since 0.10.0
  23626. * @category Object
  23627. * @param {Object} object The destination object.
  23628. * @param {...Object} [sources] The source objects.
  23629. * @returns {Object} Returns `object`.
  23630. * @see _.assignIn
  23631. * @example
  23632. *
  23633. * function Foo() {
  23634. * this.a = 1;
  23635. * }
  23636. *
  23637. * function Bar() {
  23638. * this.c = 3;
  23639. * }
  23640. *
  23641. * Foo.prototype.b = 2;
  23642. * Bar.prototype.d = 4;
  23643. *
  23644. * _.assign({ 'a': 0 }, new Foo, new Bar);
  23645. * // => { 'a': 1, 'c': 3 }
  23646. */
  23647. var assign = createAssigner(function(object, source) {
  23648. if (isPrototype(source) || isArrayLike(source)) {
  23649. copyObject(source, keys(source), object);
  23650. return;
  23651. }
  23652. for (var key in source) {
  23653. if (hasOwnProperty.call(source, key)) {
  23654. assignValue(object, key, source[key]);
  23655. }
  23656. }
  23657. });
  23658. /**
  23659. * This method is like `_.assign` except that it iterates over own and
  23660. * inherited source properties.
  23661. *
  23662. * **Note:** This method mutates `object`.
  23663. *
  23664. * @static
  23665. * @memberOf _
  23666. * @since 4.0.0
  23667. * @alias extend
  23668. * @category Object
  23669. * @param {Object} object The destination object.
  23670. * @param {...Object} [sources] The source objects.
  23671. * @returns {Object} Returns `object`.
  23672. * @see _.assign
  23673. * @example
  23674. *
  23675. * function Foo() {
  23676. * this.a = 1;
  23677. * }
  23678. *
  23679. * function Bar() {
  23680. * this.c = 3;
  23681. * }
  23682. *
  23683. * Foo.prototype.b = 2;
  23684. * Bar.prototype.d = 4;
  23685. *
  23686. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  23687. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  23688. */
  23689. var assignIn = createAssigner(function(object, source) {
  23690. copyObject(source, keysIn(source), object);
  23691. });
  23692. /**
  23693. * This method is like `_.assignIn` except that it accepts `customizer`
  23694. * which is invoked to produce the assigned values. If `customizer` returns
  23695. * `undefined`, assignment is handled by the method instead. The `customizer`
  23696. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  23697. *
  23698. * **Note:** This method mutates `object`.
  23699. *
  23700. * @static
  23701. * @memberOf _
  23702. * @since 4.0.0
  23703. * @alias extendWith
  23704. * @category Object
  23705. * @param {Object} object The destination object.
  23706. * @param {...Object} sources The source objects.
  23707. * @param {Function} [customizer] The function to customize assigned values.
  23708. * @returns {Object} Returns `object`.
  23709. * @see _.assignWith
  23710. * @example
  23711. *
  23712. * function customizer(objValue, srcValue) {
  23713. * return _.isUndefined(objValue) ? srcValue : objValue;
  23714. * }
  23715. *
  23716. * var defaults = _.partialRight(_.assignInWith, customizer);
  23717. *
  23718. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  23719. * // => { 'a': 1, 'b': 2 }
  23720. */
  23721. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  23722. copyObject(source, keysIn(source), object, customizer);
  23723. });
  23724. /**
  23725. * This method is like `_.assign` except that it accepts `customizer`
  23726. * which is invoked to produce the assigned values. If `customizer` returns
  23727. * `undefined`, assignment is handled by the method instead. The `customizer`
  23728. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  23729. *
  23730. * **Note:** This method mutates `object`.
  23731. *
  23732. * @static
  23733. * @memberOf _
  23734. * @since 4.0.0
  23735. * @category Object
  23736. * @param {Object} object The destination object.
  23737. * @param {...Object} sources The source objects.
  23738. * @param {Function} [customizer] The function to customize assigned values.
  23739. * @returns {Object} Returns `object`.
  23740. * @see _.assignInWith
  23741. * @example
  23742. *
  23743. * function customizer(objValue, srcValue) {
  23744. * return _.isUndefined(objValue) ? srcValue : objValue;
  23745. * }
  23746. *
  23747. * var defaults = _.partialRight(_.assignWith, customizer);
  23748. *
  23749. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  23750. * // => { 'a': 1, 'b': 2 }
  23751. */
  23752. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  23753. copyObject(source, keys(source), object, customizer);
  23754. });
  23755. /**
  23756. * Creates an array of values corresponding to `paths` of `object`.
  23757. *
  23758. * @static
  23759. * @memberOf _
  23760. * @since 1.0.0
  23761. * @category Object
  23762. * @param {Object} object The object to iterate over.
  23763. * @param {...(string|string[])} [paths] The property paths to pick.
  23764. * @returns {Array} Returns the picked values.
  23765. * @example
  23766. *
  23767. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  23768. *
  23769. * _.at(object, ['a[0].b.c', 'a[1]']);
  23770. * // => [3, 4]
  23771. */
  23772. var at = flatRest(baseAt);
  23773. /**
  23774. * Creates an object that inherits from the `prototype` object. If a
  23775. * `properties` object is given, its own enumerable string keyed properties
  23776. * are assigned to the created object.
  23777. *
  23778. * @static
  23779. * @memberOf _
  23780. * @since 2.3.0
  23781. * @category Object
  23782. * @param {Object} prototype The object to inherit from.
  23783. * @param {Object} [properties] The properties to assign to the object.
  23784. * @returns {Object} Returns the new object.
  23785. * @example
  23786. *
  23787. * function Shape() {
  23788. * this.x = 0;
  23789. * this.y = 0;
  23790. * }
  23791. *
  23792. * function Circle() {
  23793. * Shape.call(this);
  23794. * }
  23795. *
  23796. * Circle.prototype = _.create(Shape.prototype, {
  23797. * 'constructor': Circle
  23798. * });
  23799. *
  23800. * var circle = new Circle;
  23801. * circle instanceof Circle;
  23802. * // => true
  23803. *
  23804. * circle instanceof Shape;
  23805. * // => true
  23806. */
  23807. function create(prototype, properties) {
  23808. var result = baseCreate(prototype);
  23809. return properties == null ? result : baseAssign(result, properties);
  23810. }
  23811. /**
  23812. * Assigns own and inherited enumerable string keyed properties of source
  23813. * objects to the destination object for all destination properties that
  23814. * resolve to `undefined`. Source objects are applied from left to right.
  23815. * Once a property is set, additional values of the same property are ignored.
  23816. *
  23817. * **Note:** This method mutates `object`.
  23818. *
  23819. * @static
  23820. * @since 0.1.0
  23821. * @memberOf _
  23822. * @category Object
  23823. * @param {Object} object The destination object.
  23824. * @param {...Object} [sources] The source objects.
  23825. * @returns {Object} Returns `object`.
  23826. * @see _.defaultsDeep
  23827. * @example
  23828. *
  23829. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  23830. * // => { 'a': 1, 'b': 2 }
  23831. */
  23832. var defaults = baseRest(function(object, sources) {
  23833. object = Object(object);
  23834. var index = -1;
  23835. var length = sources.length;
  23836. var guard = length > 2 ? sources[2] : undefined;
  23837. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23838. length = 1;
  23839. }
  23840. while (++index < length) {
  23841. var source = sources[index];
  23842. var props = keysIn(source);
  23843. var propsIndex = -1;
  23844. var propsLength = props.length;
  23845. while (++propsIndex < propsLength) {
  23846. var key = props[propsIndex];
  23847. var value = object[key];
  23848. if (value === undefined ||
  23849. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23850. object[key] = source[key];
  23851. }
  23852. }
  23853. }
  23854. return object;
  23855. });
  23856. /**
  23857. * This method is like `_.defaults` except that it recursively assigns
  23858. * default properties.
  23859. *
  23860. * **Note:** This method mutates `object`.
  23861. *
  23862. * @static
  23863. * @memberOf _
  23864. * @since 3.10.0
  23865. * @category Object
  23866. * @param {Object} object The destination object.
  23867. * @param {...Object} [sources] The source objects.
  23868. * @returns {Object} Returns `object`.
  23869. * @see _.defaults
  23870. * @example
  23871. *
  23872. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  23873. * // => { 'a': { 'b': 2, 'c': 3 } }
  23874. */
  23875. var defaultsDeep = baseRest(function(args) {
  23876. args.push(undefined, customDefaultsMerge);
  23877. return apply(mergeWith, undefined, args);
  23878. });
  23879. /**
  23880. * This method is like `_.find` except that it returns the key of the first
  23881. * element `predicate` returns truthy for instead of the element itself.
  23882. *
  23883. * @static
  23884. * @memberOf _
  23885. * @since 1.1.0
  23886. * @category Object
  23887. * @param {Object} object The object to inspect.
  23888. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23889. * @returns {string|undefined} Returns the key of the matched element,
  23890. * else `undefined`.
  23891. * @example
  23892. *
  23893. * var users = {
  23894. * 'barney': { 'age': 36, 'active': true },
  23895. * 'fred': { 'age': 40, 'active': false },
  23896. * 'pebbles': { 'age': 1, 'active': true }
  23897. * };
  23898. *
  23899. * _.findKey(users, function(o) { return o.age < 40; });
  23900. * // => 'barney' (iteration order is not guaranteed)
  23901. *
  23902. * // The `_.matches` iteratee shorthand.
  23903. * _.findKey(users, { 'age': 1, 'active': true });
  23904. * // => 'pebbles'
  23905. *
  23906. * // The `_.matchesProperty` iteratee shorthand.
  23907. * _.findKey(users, ['active', false]);
  23908. * // => 'fred'
  23909. *
  23910. * // The `_.property` iteratee shorthand.
  23911. * _.findKey(users, 'active');
  23912. * // => 'barney'
  23913. */
  23914. function findKey(object, predicate) {
  23915. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  23916. }
  23917. /**
  23918. * This method is like `_.findKey` except that it iterates over elements of
  23919. * a collection in the opposite order.
  23920. *
  23921. * @static
  23922. * @memberOf _
  23923. * @since 2.0.0
  23924. * @category Object
  23925. * @param {Object} object The object to inspect.
  23926. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23927. * @returns {string|undefined} Returns the key of the matched element,
  23928. * else `undefined`.
  23929. * @example
  23930. *
  23931. * var users = {
  23932. * 'barney': { 'age': 36, 'active': true },
  23933. * 'fred': { 'age': 40, 'active': false },
  23934. * 'pebbles': { 'age': 1, 'active': true }
  23935. * };
  23936. *
  23937. * _.findLastKey(users, function(o) { return o.age < 40; });
  23938. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  23939. *
  23940. * // The `_.matches` iteratee shorthand.
  23941. * _.findLastKey(users, { 'age': 36, 'active': true });
  23942. * // => 'barney'
  23943. *
  23944. * // The `_.matchesProperty` iteratee shorthand.
  23945. * _.findLastKey(users, ['active', false]);
  23946. * // => 'fred'
  23947. *
  23948. * // The `_.property` iteratee shorthand.
  23949. * _.findLastKey(users, 'active');
  23950. * // => 'pebbles'
  23951. */
  23952. function findLastKey(object, predicate) {
  23953. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  23954. }
  23955. /**
  23956. * Iterates over own and inherited enumerable string keyed properties of an
  23957. * object and invokes `iteratee` for each property. The iteratee is invoked
  23958. * with three arguments: (value, key, object). Iteratee functions may exit
  23959. * iteration early by explicitly returning `false`.
  23960. *
  23961. * @static
  23962. * @memberOf _
  23963. * @since 0.3.0
  23964. * @category Object
  23965. * @param {Object} object The object to iterate over.
  23966. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  23967. * @returns {Object} Returns `object`.
  23968. * @see _.forInRight
  23969. * @example
  23970. *
  23971. * function Foo() {
  23972. * this.a = 1;
  23973. * this.b = 2;
  23974. * }
  23975. *
  23976. * Foo.prototype.c = 3;
  23977. *
  23978. * _.forIn(new Foo, function(value, key) {
  23979. * console.log(key);
  23980. * });
  23981. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  23982. */
  23983. function forIn(object, iteratee) {
  23984. return object == null
  23985. ? object
  23986. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  23987. }
  23988. /**
  23989. * This method is like `_.forIn` except that it iterates over properties of
  23990. * `object` in the opposite order.
  23991. *
  23992. * @static
  23993. * @memberOf _
  23994. * @since 2.0.0
  23995. * @category Object
  23996. * @param {Object} object The object to iterate over.
  23997. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  23998. * @returns {Object} Returns `object`.
  23999. * @see _.forIn
  24000. * @example
  24001. *
  24002. * function Foo() {
  24003. * this.a = 1;
  24004. * this.b = 2;
  24005. * }
  24006. *
  24007. * Foo.prototype.c = 3;
  24008. *
  24009. * _.forInRight(new Foo, function(value, key) {
  24010. * console.log(key);
  24011. * });
  24012. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  24013. */
  24014. function forInRight(object, iteratee) {
  24015. return object == null
  24016. ? object
  24017. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  24018. }
  24019. /**
  24020. * Iterates over own enumerable string keyed properties of an object and
  24021. * invokes `iteratee` for each property. The iteratee is invoked with three
  24022. * arguments: (value, key, object). Iteratee functions may exit iteration
  24023. * early by explicitly returning `false`.
  24024. *
  24025. * @static
  24026. * @memberOf _
  24027. * @since 0.3.0
  24028. * @category Object
  24029. * @param {Object} object The object to iterate over.
  24030. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24031. * @returns {Object} Returns `object`.
  24032. * @see _.forOwnRight
  24033. * @example
  24034. *
  24035. * function Foo() {
  24036. * this.a = 1;
  24037. * this.b = 2;
  24038. * }
  24039. *
  24040. * Foo.prototype.c = 3;
  24041. *
  24042. * _.forOwn(new Foo, function(value, key) {
  24043. * console.log(key);
  24044. * });
  24045. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  24046. */
  24047. function forOwn(object, iteratee) {
  24048. return object && baseForOwn(object, getIteratee(iteratee, 3));
  24049. }
  24050. /**
  24051. * This method is like `_.forOwn` except that it iterates over properties of
  24052. * `object` in the opposite order.
  24053. *
  24054. * @static
  24055. * @memberOf _
  24056. * @since 2.0.0
  24057. * @category Object
  24058. * @param {Object} object The object to iterate over.
  24059. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24060. * @returns {Object} Returns `object`.
  24061. * @see _.forOwn
  24062. * @example
  24063. *
  24064. * function Foo() {
  24065. * this.a = 1;
  24066. * this.b = 2;
  24067. * }
  24068. *
  24069. * Foo.prototype.c = 3;
  24070. *
  24071. * _.forOwnRight(new Foo, function(value, key) {
  24072. * console.log(key);
  24073. * });
  24074. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  24075. */
  24076. function forOwnRight(object, iteratee) {
  24077. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  24078. }
  24079. /**
  24080. * Creates an array of function property names from own enumerable properties
  24081. * of `object`.
  24082. *
  24083. * @static
  24084. * @since 0.1.0
  24085. * @memberOf _
  24086. * @category Object
  24087. * @param {Object} object The object to inspect.
  24088. * @returns {Array} Returns the function names.
  24089. * @see _.functionsIn
  24090. * @example
  24091. *
  24092. * function Foo() {
  24093. * this.a = _.constant('a');
  24094. * this.b = _.constant('b');
  24095. * }
  24096. *
  24097. * Foo.prototype.c = _.constant('c');
  24098. *
  24099. * _.functions(new Foo);
  24100. * // => ['a', 'b']
  24101. */
  24102. function functions(object) {
  24103. return object == null ? [] : baseFunctions(object, keys(object));
  24104. }
  24105. /**
  24106. * Creates an array of function property names from own and inherited
  24107. * enumerable properties of `object`.
  24108. *
  24109. * @static
  24110. * @memberOf _
  24111. * @since 4.0.0
  24112. * @category Object
  24113. * @param {Object} object The object to inspect.
  24114. * @returns {Array} Returns the function names.
  24115. * @see _.functions
  24116. * @example
  24117. *
  24118. * function Foo() {
  24119. * this.a = _.constant('a');
  24120. * this.b = _.constant('b');
  24121. * }
  24122. *
  24123. * Foo.prototype.c = _.constant('c');
  24124. *
  24125. * _.functionsIn(new Foo);
  24126. * // => ['a', 'b', 'c']
  24127. */
  24128. function functionsIn(object) {
  24129. return object == null ? [] : baseFunctions(object, keysIn(object));
  24130. }
  24131. /**
  24132. * Gets the value at `path` of `object`. If the resolved value is
  24133. * `undefined`, the `defaultValue` is returned in its place.
  24134. *
  24135. * @static
  24136. * @memberOf _
  24137. * @since 3.7.0
  24138. * @category Object
  24139. * @param {Object} object The object to query.
  24140. * @param {Array|string} path The path of the property to get.
  24141. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  24142. * @returns {*} Returns the resolved value.
  24143. * @example
  24144. *
  24145. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  24146. *
  24147. * _.get(object, 'a[0].b.c');
  24148. * // => 3
  24149. *
  24150. * _.get(object, ['a', '0', 'b', 'c']);
  24151. * // => 3
  24152. *
  24153. * _.get(object, 'a.b.c', 'default');
  24154. * // => 'default'
  24155. */
  24156. function get(object, path, defaultValue) {
  24157. var result = object == null ? undefined : baseGet(object, path);
  24158. return result === undefined ? defaultValue : result;
  24159. }
  24160. /**
  24161. * Checks if `path` is a direct property of `object`.
  24162. *
  24163. * @static
  24164. * @since 0.1.0
  24165. * @memberOf _
  24166. * @category Object
  24167. * @param {Object} object The object to query.
  24168. * @param {Array|string} path The path to check.
  24169. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24170. * @example
  24171. *
  24172. * var object = { 'a': { 'b': 2 } };
  24173. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  24174. *
  24175. * _.has(object, 'a');
  24176. * // => true
  24177. *
  24178. * _.has(object, 'a.b');
  24179. * // => true
  24180. *
  24181. * _.has(object, ['a', 'b']);
  24182. * // => true
  24183. *
  24184. * _.has(other, 'a');
  24185. * // => false
  24186. */
  24187. function has(object, path) {
  24188. return object != null && hasPath(object, path, baseHas);
  24189. }
  24190. /**
  24191. * Checks if `path` is a direct or inherited property of `object`.
  24192. *
  24193. * @static
  24194. * @memberOf _
  24195. * @since 4.0.0
  24196. * @category Object
  24197. * @param {Object} object The object to query.
  24198. * @param {Array|string} path The path to check.
  24199. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24200. * @example
  24201. *
  24202. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  24203. *
  24204. * _.hasIn(object, 'a');
  24205. * // => true
  24206. *
  24207. * _.hasIn(object, 'a.b');
  24208. * // => true
  24209. *
  24210. * _.hasIn(object, ['a', 'b']);
  24211. * // => true
  24212. *
  24213. * _.hasIn(object, 'b');
  24214. * // => false
  24215. */
  24216. function hasIn(object, path) {
  24217. return object != null && hasPath(object, path, baseHasIn);
  24218. }
  24219. /**
  24220. * Creates an object composed of the inverted keys and values of `object`.
  24221. * If `object` contains duplicate values, subsequent values overwrite
  24222. * property assignments of previous values.
  24223. *
  24224. * @static
  24225. * @memberOf _
  24226. * @since 0.7.0
  24227. * @category Object
  24228. * @param {Object} object The object to invert.
  24229. * @returns {Object} Returns the new inverted object.
  24230. * @example
  24231. *
  24232. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  24233. *
  24234. * _.invert(object);
  24235. * // => { '1': 'c', '2': 'b' }
  24236. */
  24237. var invert = createInverter(function(result, value, key) {
  24238. if (value != null &&
  24239. typeof value.toString != 'function') {
  24240. value = nativeObjectToString.call(value);
  24241. }
  24242. result[value] = key;
  24243. }, constant(identity));
  24244. /**
  24245. * This method is like `_.invert` except that the inverted object is generated
  24246. * from the results of running each element of `object` thru `iteratee`. The
  24247. * corresponding inverted value of each inverted key is an array of keys
  24248. * responsible for generating the inverted value. The iteratee is invoked
  24249. * with one argument: (value).
  24250. *
  24251. * @static
  24252. * @memberOf _
  24253. * @since 4.1.0
  24254. * @category Object
  24255. * @param {Object} object The object to invert.
  24256. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24257. * @returns {Object} Returns the new inverted object.
  24258. * @example
  24259. *
  24260. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  24261. *
  24262. * _.invertBy(object);
  24263. * // => { '1': ['a', 'c'], '2': ['b'] }
  24264. *
  24265. * _.invertBy(object, function(value) {
  24266. * return 'group' + value;
  24267. * });
  24268. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  24269. */
  24270. var invertBy = createInverter(function(result, value, key) {
  24271. if (value != null &&
  24272. typeof value.toString != 'function') {
  24273. value = nativeObjectToString.call(value);
  24274. }
  24275. if (hasOwnProperty.call(result, value)) {
  24276. result[value].push(key);
  24277. } else {
  24278. result[value] = [key];
  24279. }
  24280. }, getIteratee);
  24281. /**
  24282. * Invokes the method at `path` of `object`.
  24283. *
  24284. * @static
  24285. * @memberOf _
  24286. * @since 4.0.0
  24287. * @category Object
  24288. * @param {Object} object The object to query.
  24289. * @param {Array|string} path The path of the method to invoke.
  24290. * @param {...*} [args] The arguments to invoke the method with.
  24291. * @returns {*} Returns the result of the invoked method.
  24292. * @example
  24293. *
  24294. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  24295. *
  24296. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  24297. * // => [2, 3]
  24298. */
  24299. var invoke = baseRest(baseInvoke);
  24300. /**
  24301. * Creates an array of the own enumerable property names of `object`.
  24302. *
  24303. * **Note:** Non-object values are coerced to objects. See the
  24304. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24305. * for more details.
  24306. *
  24307. * @static
  24308. * @since 0.1.0
  24309. * @memberOf _
  24310. * @category Object
  24311. * @param {Object} object The object to query.
  24312. * @returns {Array} Returns the array of property names.
  24313. * @example
  24314. *
  24315. * function Foo() {
  24316. * this.a = 1;
  24317. * this.b = 2;
  24318. * }
  24319. *
  24320. * Foo.prototype.c = 3;
  24321. *
  24322. * _.keys(new Foo);
  24323. * // => ['a', 'b'] (iteration order is not guaranteed)
  24324. *
  24325. * _.keys('hi');
  24326. * // => ['0', '1']
  24327. */
  24328. function keys(object) {
  24329. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  24330. }
  24331. /**
  24332. * Creates an array of the own and inherited enumerable property names of `object`.
  24333. *
  24334. * **Note:** Non-object values are coerced to objects.
  24335. *
  24336. * @static
  24337. * @memberOf _
  24338. * @since 3.0.0
  24339. * @category Object
  24340. * @param {Object} object The object to query.
  24341. * @returns {Array} Returns the array of property names.
  24342. * @example
  24343. *
  24344. * function Foo() {
  24345. * this.a = 1;
  24346. * this.b = 2;
  24347. * }
  24348. *
  24349. * Foo.prototype.c = 3;
  24350. *
  24351. * _.keysIn(new Foo);
  24352. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  24353. */
  24354. function keysIn(object) {
  24355. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  24356. }
  24357. /**
  24358. * The opposite of `_.mapValues`; this method creates an object with the
  24359. * same values as `object` and keys generated by running each own enumerable
  24360. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  24361. * with three arguments: (value, key, object).
  24362. *
  24363. * @static
  24364. * @memberOf _
  24365. * @since 3.8.0
  24366. * @category Object
  24367. * @param {Object} object The object to iterate over.
  24368. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24369. * @returns {Object} Returns the new mapped object.
  24370. * @see _.mapValues
  24371. * @example
  24372. *
  24373. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  24374. * return key + value;
  24375. * });
  24376. * // => { 'a1': 1, 'b2': 2 }
  24377. */
  24378. function mapKeys(object, iteratee) {
  24379. var result = {};
  24380. iteratee = getIteratee(iteratee, 3);
  24381. baseForOwn(object, function(value, key, object) {
  24382. baseAssignValue(result, iteratee(value, key, object), value);
  24383. });
  24384. return result;
  24385. }
  24386. /**
  24387. * Creates an object with the same keys as `object` and values generated
  24388. * by running each own enumerable string keyed property of `object` thru
  24389. * `iteratee`. The iteratee is invoked with three arguments:
  24390. * (value, key, object).
  24391. *
  24392. * @static
  24393. * @memberOf _
  24394. * @since 2.4.0
  24395. * @category Object
  24396. * @param {Object} object The object to iterate over.
  24397. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24398. * @returns {Object} Returns the new mapped object.
  24399. * @see _.mapKeys
  24400. * @example
  24401. *
  24402. * var users = {
  24403. * 'fred': { 'user': 'fred', 'age': 40 },
  24404. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  24405. * };
  24406. *
  24407. * _.mapValues(users, function(o) { return o.age; });
  24408. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  24409. *
  24410. * // The `_.property` iteratee shorthand.
  24411. * _.mapValues(users, 'age');
  24412. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  24413. */
  24414. function mapValues(object, iteratee) {
  24415. var result = {};
  24416. iteratee = getIteratee(iteratee, 3);
  24417. baseForOwn(object, function(value, key, object) {
  24418. baseAssignValue(result, key, iteratee(value, key, object));
  24419. });
  24420. return result;
  24421. }
  24422. /**
  24423. * This method is like `_.assign` except that it recursively merges own and
  24424. * inherited enumerable string keyed properties of source objects into the
  24425. * destination object. Source properties that resolve to `undefined` are
  24426. * skipped if a destination value exists. Array and plain object properties
  24427. * are merged recursively. Other objects and value types are overridden by
  24428. * assignment. Source objects are applied from left to right. Subsequent
  24429. * sources overwrite property assignments of previous sources.
  24430. *
  24431. * **Note:** This method mutates `object`.
  24432. *
  24433. * @static
  24434. * @memberOf _
  24435. * @since 0.5.0
  24436. * @category Object
  24437. * @param {Object} object The destination object.
  24438. * @param {...Object} [sources] The source objects.
  24439. * @returns {Object} Returns `object`.
  24440. * @example
  24441. *
  24442. * var object = {
  24443. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  24444. * };
  24445. *
  24446. * var other = {
  24447. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  24448. * };
  24449. *
  24450. * _.merge(object, other);
  24451. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  24452. */
  24453. var merge = createAssigner(function(object, source, srcIndex) {
  24454. baseMerge(object, source, srcIndex);
  24455. });
  24456. /**
  24457. * This method is like `_.merge` except that it accepts `customizer` which
  24458. * is invoked to produce the merged values of the destination and source
  24459. * properties. If `customizer` returns `undefined`, merging is handled by the
  24460. * method instead. The `customizer` is invoked with six arguments:
  24461. * (objValue, srcValue, key, object, source, stack).
  24462. *
  24463. * **Note:** This method mutates `object`.
  24464. *
  24465. * @static
  24466. * @memberOf _
  24467. * @since 4.0.0
  24468. * @category Object
  24469. * @param {Object} object The destination object.
  24470. * @param {...Object} sources The source objects.
  24471. * @param {Function} customizer The function to customize assigned values.
  24472. * @returns {Object} Returns `object`.
  24473. * @example
  24474. *
  24475. * function customizer(objValue, srcValue) {
  24476. * if (_.isArray(objValue)) {
  24477. * return objValue.concat(srcValue);
  24478. * }
  24479. * }
  24480. *
  24481. * var object = { 'a': [1], 'b': [2] };
  24482. * var other = { 'a': [3], 'b': [4] };
  24483. *
  24484. * _.mergeWith(object, other, customizer);
  24485. * // => { 'a': [1, 3], 'b': [2, 4] }
  24486. */
  24487. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  24488. baseMerge(object, source, srcIndex, customizer);
  24489. });
  24490. /**
  24491. * The opposite of `_.pick`; this method creates an object composed of the
  24492. * own and inherited enumerable property paths of `object` that are not omitted.
  24493. *
  24494. * **Note:** This method is considerably slower than `_.pick`.
  24495. *
  24496. * @static
  24497. * @since 0.1.0
  24498. * @memberOf _
  24499. * @category Object
  24500. * @param {Object} object The source object.
  24501. * @param {...(string|string[])} [paths] The property paths to omit.
  24502. * @returns {Object} Returns the new object.
  24503. * @example
  24504. *
  24505. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  24506. *
  24507. * _.omit(object, ['a', 'c']);
  24508. * // => { 'b': '2' }
  24509. */
  24510. var omit = flatRest(function(object, paths) {
  24511. var result = {};
  24512. if (object == null) {
  24513. return result;
  24514. }
  24515. var isDeep = false;
  24516. paths = arrayMap(paths, function(path) {
  24517. path = castPath(path, object);
  24518. isDeep || (isDeep = path.length > 1);
  24519. return path;
  24520. });
  24521. copyObject(object, getAllKeysIn(object), result);
  24522. if (isDeep) {
  24523. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  24524. }
  24525. var length = paths.length;
  24526. while (length--) {
  24527. baseUnset(result, paths[length]);
  24528. }
  24529. return result;
  24530. });
  24531. /**
  24532. * The opposite of `_.pickBy`; this method creates an object composed of
  24533. * the own and inherited enumerable string keyed properties of `object` that
  24534. * `predicate` doesn't return truthy for. The predicate is invoked with two
  24535. * arguments: (value, key).
  24536. *
  24537. * @static
  24538. * @memberOf _
  24539. * @since 4.0.0
  24540. * @category Object
  24541. * @param {Object} object The source object.
  24542. * @param {Function} [predicate=_.identity] The function invoked per property.
  24543. * @returns {Object} Returns the new object.
  24544. * @example
  24545. *
  24546. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  24547. *
  24548. * _.omitBy(object, _.isNumber);
  24549. * // => { 'b': '2' }
  24550. */
  24551. function omitBy(object, predicate) {
  24552. return pickBy(object, negate(getIteratee(predicate)));
  24553. }
  24554. /**
  24555. * Creates an object composed of the picked `object` properties.
  24556. *
  24557. * @static
  24558. * @since 0.1.0
  24559. * @memberOf _
  24560. * @category Object
  24561. * @param {Object} object The source object.
  24562. * @param {...(string|string[])} [paths] The property paths to pick.
  24563. * @returns {Object} Returns the new object.
  24564. * @example
  24565. *
  24566. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  24567. *
  24568. * _.pick(object, ['a', 'c']);
  24569. * // => { 'a': 1, 'c': 3 }
  24570. */
  24571. var pick = flatRest(function(object, paths) {
  24572. return object == null ? {} : basePick(object, paths);
  24573. });
  24574. /**
  24575. * Creates an object composed of the `object` properties `predicate` returns
  24576. * truthy for. The predicate is invoked with two arguments: (value, key).
  24577. *
  24578. * @static
  24579. * @memberOf _
  24580. * @since 4.0.0
  24581. * @category Object
  24582. * @param {Object} object The source object.
  24583. * @param {Function} [predicate=_.identity] The function invoked per property.
  24584. * @returns {Object} Returns the new object.
  24585. * @example
  24586. *
  24587. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  24588. *
  24589. * _.pickBy(object, _.isNumber);
  24590. * // => { 'a': 1, 'c': 3 }
  24591. */
  24592. function pickBy(object, predicate) {
  24593. if (object == null) {
  24594. return {};
  24595. }
  24596. var props = arrayMap(getAllKeysIn(object), function(prop) {
  24597. return [prop];
  24598. });
  24599. predicate = getIteratee(predicate);
  24600. return basePickBy(object, props, function(value, path) {
  24601. return predicate(value, path[0]);
  24602. });
  24603. }
  24604. /**
  24605. * This method is like `_.get` except that if the resolved value is a
  24606. * function it's invoked with the `this` binding of its parent object and
  24607. * its result is returned.
  24608. *
  24609. * @static
  24610. * @since 0.1.0
  24611. * @memberOf _
  24612. * @category Object
  24613. * @param {Object} object The object to query.
  24614. * @param {Array|string} path The path of the property to resolve.
  24615. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  24616. * @returns {*} Returns the resolved value.
  24617. * @example
  24618. *
  24619. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  24620. *
  24621. * _.result(object, 'a[0].b.c1');
  24622. * // => 3
  24623. *
  24624. * _.result(object, 'a[0].b.c2');
  24625. * // => 4
  24626. *
  24627. * _.result(object, 'a[0].b.c3', 'default');
  24628. * // => 'default'
  24629. *
  24630. * _.result(object, 'a[0].b.c3', _.constant('default'));
  24631. * // => 'default'
  24632. */
  24633. function result(object, path, defaultValue) {
  24634. path = castPath(path, object);
  24635. var index = -1,
  24636. length = path.length;
  24637. // Ensure the loop is entered when path is empty.
  24638. if (!length) {
  24639. length = 1;
  24640. object = undefined;
  24641. }
  24642. while (++index < length) {
  24643. var value = object == null ? undefined : object[toKey(path[index])];
  24644. if (value === undefined) {
  24645. index = length;
  24646. value = defaultValue;
  24647. }
  24648. object = isFunction(value) ? value.call(object) : value;
  24649. }
  24650. return object;
  24651. }
  24652. /**
  24653. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  24654. * it's created. Arrays are created for missing index properties while objects
  24655. * are created for all other missing properties. Use `_.setWith` to customize
  24656. * `path` creation.
  24657. *
  24658. * **Note:** This method mutates `object`.
  24659. *
  24660. * @static
  24661. * @memberOf _
  24662. * @since 3.7.0
  24663. * @category Object
  24664. * @param {Object} object The object to modify.
  24665. * @param {Array|string} path The path of the property to set.
  24666. * @param {*} value The value to set.
  24667. * @returns {Object} Returns `object`.
  24668. * @example
  24669. *
  24670. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  24671. *
  24672. * _.set(object, 'a[0].b.c', 4);
  24673. * console.log(object.a[0].b.c);
  24674. * // => 4
  24675. *
  24676. * _.set(object, ['x', '0', 'y', 'z'], 5);
  24677. * console.log(object.x[0].y.z);
  24678. * // => 5
  24679. */
  24680. function set(object, path, value) {
  24681. return object == null ? object : baseSet(object, path, value);
  24682. }
  24683. /**
  24684. * This method is like `_.set` except that it accepts `customizer` which is
  24685. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  24686. * path creation is handled by the method instead. The `customizer` is invoked
  24687. * with three arguments: (nsValue, key, nsObject).
  24688. *
  24689. * **Note:** This method mutates `object`.
  24690. *
  24691. * @static
  24692. * @memberOf _
  24693. * @since 4.0.0
  24694. * @category Object
  24695. * @param {Object} object The object to modify.
  24696. * @param {Array|string} path The path of the property to set.
  24697. * @param {*} value The value to set.
  24698. * @param {Function} [customizer] The function to customize assigned values.
  24699. * @returns {Object} Returns `object`.
  24700. * @example
  24701. *
  24702. * var object = {};
  24703. *
  24704. * _.setWith(object, '[0][1]', 'a', Object);
  24705. * // => { '0': { '1': 'a' } }
  24706. */
  24707. function setWith(object, path, value, customizer) {
  24708. customizer = typeof customizer == 'function' ? customizer : undefined;
  24709. return object == null ? object : baseSet(object, path, value, customizer);
  24710. }
  24711. /**
  24712. * Creates an array of own enumerable string keyed-value pairs for `object`
  24713. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  24714. * entries are returned.
  24715. *
  24716. * @static
  24717. * @memberOf _
  24718. * @since 4.0.0
  24719. * @alias entries
  24720. * @category Object
  24721. * @param {Object} object The object to query.
  24722. * @returns {Array} Returns the key-value pairs.
  24723. * @example
  24724. *
  24725. * function Foo() {
  24726. * this.a = 1;
  24727. * this.b = 2;
  24728. * }
  24729. *
  24730. * Foo.prototype.c = 3;
  24731. *
  24732. * _.toPairs(new Foo);
  24733. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  24734. */
  24735. var toPairs = createToPairs(keys);
  24736. /**
  24737. * Creates an array of own and inherited enumerable string keyed-value pairs
  24738. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  24739. * or set, its entries are returned.
  24740. *
  24741. * @static
  24742. * @memberOf _
  24743. * @since 4.0.0
  24744. * @alias entriesIn
  24745. * @category Object
  24746. * @param {Object} object The object to query.
  24747. * @returns {Array} Returns the key-value pairs.
  24748. * @example
  24749. *
  24750. * function Foo() {
  24751. * this.a = 1;
  24752. * this.b = 2;
  24753. * }
  24754. *
  24755. * Foo.prototype.c = 3;
  24756. *
  24757. * _.toPairsIn(new Foo);
  24758. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  24759. */
  24760. var toPairsIn = createToPairs(keysIn);
  24761. /**
  24762. * An alternative to `_.reduce`; this method transforms `object` to a new
  24763. * `accumulator` object which is the result of running each of its own
  24764. * enumerable string keyed properties thru `iteratee`, with each invocation
  24765. * potentially mutating the `accumulator` object. If `accumulator` is not
  24766. * provided, a new object with the same `[[Prototype]]` will be used. The
  24767. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  24768. * Iteratee functions may exit iteration early by explicitly returning `false`.
  24769. *
  24770. * @static
  24771. * @memberOf _
  24772. * @since 1.3.0
  24773. * @category Object
  24774. * @param {Object} object The object to iterate over.
  24775. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24776. * @param {*} [accumulator] The custom accumulator value.
  24777. * @returns {*} Returns the accumulated value.
  24778. * @example
  24779. *
  24780. * _.transform([2, 3, 4], function(result, n) {
  24781. * result.push(n *= n);
  24782. * return n % 2 == 0;
  24783. * }, []);
  24784. * // => [4, 9]
  24785. *
  24786. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  24787. * (result[value] || (result[value] = [])).push(key);
  24788. * }, {});
  24789. * // => { '1': ['a', 'c'], '2': ['b'] }
  24790. */
  24791. function transform(object, iteratee, accumulator) {
  24792. var isArr = isArray(object),
  24793. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  24794. iteratee = getIteratee(iteratee, 4);
  24795. if (accumulator == null) {
  24796. var Ctor = object && object.constructor;
  24797. if (isArrLike) {
  24798. accumulator = isArr ? new Ctor : [];
  24799. }
  24800. else if (isObject(object)) {
  24801. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  24802. }
  24803. else {
  24804. accumulator = {};
  24805. }
  24806. }
  24807. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  24808. return iteratee(accumulator, value, index, object);
  24809. });
  24810. return accumulator;
  24811. }
  24812. /**
  24813. * Removes the property at `path` of `object`.
  24814. *
  24815. * **Note:** This method mutates `object`.
  24816. *
  24817. * @static
  24818. * @memberOf _
  24819. * @since 4.0.0
  24820. * @category Object
  24821. * @param {Object} object The object to modify.
  24822. * @param {Array|string} path The path of the property to unset.
  24823. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  24824. * @example
  24825. *
  24826. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  24827. * _.unset(object, 'a[0].b.c');
  24828. * // => true
  24829. *
  24830. * console.log(object);
  24831. * // => { 'a': [{ 'b': {} }] };
  24832. *
  24833. * _.unset(object, ['a', '0', 'b', 'c']);
  24834. * // => true
  24835. *
  24836. * console.log(object);
  24837. * // => { 'a': [{ 'b': {} }] };
  24838. */
  24839. function unset(object, path) {
  24840. return object == null ? true : baseUnset(object, path);
  24841. }
  24842. /**
  24843. * This method is like `_.set` except that accepts `updater` to produce the
  24844. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  24845. * is invoked with one argument: (value).
  24846. *
  24847. * **Note:** This method mutates `object`.
  24848. *
  24849. * @static
  24850. * @memberOf _
  24851. * @since 4.6.0
  24852. * @category Object
  24853. * @param {Object} object The object to modify.
  24854. * @param {Array|string} path The path of the property to set.
  24855. * @param {Function} updater The function to produce the updated value.
  24856. * @returns {Object} Returns `object`.
  24857. * @example
  24858. *
  24859. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  24860. *
  24861. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  24862. * console.log(object.a[0].b.c);
  24863. * // => 9
  24864. *
  24865. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  24866. * console.log(object.x[0].y.z);
  24867. * // => 0
  24868. */
  24869. function update(object, path, updater) {
  24870. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  24871. }
  24872. /**
  24873. * This method is like `_.update` except that it accepts `customizer` which is
  24874. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  24875. * path creation is handled by the method instead. The `customizer` is invoked
  24876. * with three arguments: (nsValue, key, nsObject).
  24877. *
  24878. * **Note:** This method mutates `object`.
  24879. *
  24880. * @static
  24881. * @memberOf _
  24882. * @since 4.6.0
  24883. * @category Object
  24884. * @param {Object} object The object to modify.
  24885. * @param {Array|string} path The path of the property to set.
  24886. * @param {Function} updater The function to produce the updated value.
  24887. * @param {Function} [customizer] The function to customize assigned values.
  24888. * @returns {Object} Returns `object`.
  24889. * @example
  24890. *
  24891. * var object = {};
  24892. *
  24893. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  24894. * // => { '0': { '1': 'a' } }
  24895. */
  24896. function updateWith(object, path, updater, customizer) {
  24897. customizer = typeof customizer == 'function' ? customizer : undefined;
  24898. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  24899. }
  24900. /**
  24901. * Creates an array of the own enumerable string keyed property values of `object`.
  24902. *
  24903. * **Note:** Non-object values are coerced to objects.
  24904. *
  24905. * @static
  24906. * @since 0.1.0
  24907. * @memberOf _
  24908. * @category Object
  24909. * @param {Object} object The object to query.
  24910. * @returns {Array} Returns the array of property values.
  24911. * @example
  24912. *
  24913. * function Foo() {
  24914. * this.a = 1;
  24915. * this.b = 2;
  24916. * }
  24917. *
  24918. * Foo.prototype.c = 3;
  24919. *
  24920. * _.values(new Foo);
  24921. * // => [1, 2] (iteration order is not guaranteed)
  24922. *
  24923. * _.values('hi');
  24924. * // => ['h', 'i']
  24925. */
  24926. function values(object) {
  24927. return object == null ? [] : baseValues(object, keys(object));
  24928. }
  24929. /**
  24930. * Creates an array of the own and inherited enumerable string keyed property
  24931. * values of `object`.
  24932. *
  24933. * **Note:** Non-object values are coerced to objects.
  24934. *
  24935. * @static
  24936. * @memberOf _
  24937. * @since 3.0.0
  24938. * @category Object
  24939. * @param {Object} object The object to query.
  24940. * @returns {Array} Returns the array of property values.
  24941. * @example
  24942. *
  24943. * function Foo() {
  24944. * this.a = 1;
  24945. * this.b = 2;
  24946. * }
  24947. *
  24948. * Foo.prototype.c = 3;
  24949. *
  24950. * _.valuesIn(new Foo);
  24951. * // => [1, 2, 3] (iteration order is not guaranteed)
  24952. */
  24953. function valuesIn(object) {
  24954. return object == null ? [] : baseValues(object, keysIn(object));
  24955. }
  24956. /*------------------------------------------------------------------------*/
  24957. /**
  24958. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  24959. *
  24960. * @static
  24961. * @memberOf _
  24962. * @since 4.0.0
  24963. * @category Number
  24964. * @param {number} number The number to clamp.
  24965. * @param {number} [lower] The lower bound.
  24966. * @param {number} upper The upper bound.
  24967. * @returns {number} Returns the clamped number.
  24968. * @example
  24969. *
  24970. * _.clamp(-10, -5, 5);
  24971. * // => -5
  24972. *
  24973. * _.clamp(10, -5, 5);
  24974. * // => 5
  24975. */
  24976. function clamp(number, lower, upper) {
  24977. if (upper === undefined) {
  24978. upper = lower;
  24979. lower = undefined;
  24980. }
  24981. if (upper !== undefined) {
  24982. upper = toNumber(upper);
  24983. upper = upper === upper ? upper : 0;
  24984. }
  24985. if (lower !== undefined) {
  24986. lower = toNumber(lower);
  24987. lower = lower === lower ? lower : 0;
  24988. }
  24989. return baseClamp(toNumber(number), lower, upper);
  24990. }
  24991. /**
  24992. * Checks if `n` is between `start` and up to, but not including, `end`. If
  24993. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  24994. * If `start` is greater than `end` the params are swapped to support
  24995. * negative ranges.
  24996. *
  24997. * @static
  24998. * @memberOf _
  24999. * @since 3.3.0
  25000. * @category Number
  25001. * @param {number} number The number to check.
  25002. * @param {number} [start=0] The start of the range.
  25003. * @param {number} end The end of the range.
  25004. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  25005. * @see _.range, _.rangeRight
  25006. * @example
  25007. *
  25008. * _.inRange(3, 2, 4);
  25009. * // => true
  25010. *
  25011. * _.inRange(4, 8);
  25012. * // => true
  25013. *
  25014. * _.inRange(4, 2);
  25015. * // => false
  25016. *
  25017. * _.inRange(2, 2);
  25018. * // => false
  25019. *
  25020. * _.inRange(1.2, 2);
  25021. * // => true
  25022. *
  25023. * _.inRange(5.2, 4);
  25024. * // => false
  25025. *
  25026. * _.inRange(-3, -2, -6);
  25027. * // => true
  25028. */
  25029. function inRange(number, start, end) {
  25030. start = toFinite(start);
  25031. if (end === undefined) {
  25032. end = start;
  25033. start = 0;
  25034. } else {
  25035. end = toFinite(end);
  25036. }
  25037. number = toNumber(number);
  25038. return baseInRange(number, start, end);
  25039. }
  25040. /**
  25041. * Produces a random number between the inclusive `lower` and `upper` bounds.
  25042. * If only one argument is provided a number between `0` and the given number
  25043. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  25044. * floats, a floating-point number is returned instead of an integer.
  25045. *
  25046. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  25047. * floating-point values which can produce unexpected results.
  25048. *
  25049. * @static
  25050. * @memberOf _
  25051. * @since 0.7.0
  25052. * @category Number
  25053. * @param {number} [lower=0] The lower bound.
  25054. * @param {number} [upper=1] The upper bound.
  25055. * @param {boolean} [floating] Specify returning a floating-point number.
  25056. * @returns {number} Returns the random number.
  25057. * @example
  25058. *
  25059. * _.random(0, 5);
  25060. * // => an integer between 0 and 5
  25061. *
  25062. * _.random(5);
  25063. * // => also an integer between 0 and 5
  25064. *
  25065. * _.random(5, true);
  25066. * // => a floating-point number between 0 and 5
  25067. *
  25068. * _.random(1.2, 5.2);
  25069. * // => a floating-point number between 1.2 and 5.2
  25070. */
  25071. function random(lower, upper, floating) {
  25072. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  25073. upper = floating = undefined;
  25074. }
  25075. if (floating === undefined) {
  25076. if (typeof upper == 'boolean') {
  25077. floating = upper;
  25078. upper = undefined;
  25079. }
  25080. else if (typeof lower == 'boolean') {
  25081. floating = lower;
  25082. lower = undefined;
  25083. }
  25084. }
  25085. if (lower === undefined && upper === undefined) {
  25086. lower = 0;
  25087. upper = 1;
  25088. }
  25089. else {
  25090. lower = toFinite(lower);
  25091. if (upper === undefined) {
  25092. upper = lower;
  25093. lower = 0;
  25094. } else {
  25095. upper = toFinite(upper);
  25096. }
  25097. }
  25098. if (lower > upper) {
  25099. var temp = lower;
  25100. lower = upper;
  25101. upper = temp;
  25102. }
  25103. if (floating || lower % 1 || upper % 1) {
  25104. var rand = nativeRandom();
  25105. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  25106. }
  25107. return baseRandom(lower, upper);
  25108. }
  25109. /*------------------------------------------------------------------------*/
  25110. /**
  25111. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  25112. *
  25113. * @static
  25114. * @memberOf _
  25115. * @since 3.0.0
  25116. * @category String
  25117. * @param {string} [string=''] The string to convert.
  25118. * @returns {string} Returns the camel cased string.
  25119. * @example
  25120. *
  25121. * _.camelCase('Foo Bar');
  25122. * // => 'fooBar'
  25123. *
  25124. * _.camelCase('--foo-bar--');
  25125. * // => 'fooBar'
  25126. *
  25127. * _.camelCase('__FOO_BAR__');
  25128. * // => 'fooBar'
  25129. */
  25130. var camelCase = createCompounder(function(result, word, index) {
  25131. word = word.toLowerCase();
  25132. return result + (index ? capitalize(word) : word);
  25133. });
  25134. /**
  25135. * Converts the first character of `string` to upper case and the remaining
  25136. * to lower case.
  25137. *
  25138. * @static
  25139. * @memberOf _
  25140. * @since 3.0.0
  25141. * @category String
  25142. * @param {string} [string=''] The string to capitalize.
  25143. * @returns {string} Returns the capitalized string.
  25144. * @example
  25145. *
  25146. * _.capitalize('FRED');
  25147. * // => 'Fred'
  25148. */
  25149. function capitalize(string) {
  25150. return upperFirst(toString(string).toLowerCase());
  25151. }
  25152. /**
  25153. * Deburrs `string` by converting
  25154. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  25155. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  25156. * letters to basic Latin letters and removing
  25157. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  25158. *
  25159. * @static
  25160. * @memberOf _
  25161. * @since 3.0.0
  25162. * @category String
  25163. * @param {string} [string=''] The string to deburr.
  25164. * @returns {string} Returns the deburred string.
  25165. * @example
  25166. *
  25167. * _.deburr('déjà vu');
  25168. * // => 'deja vu'
  25169. */
  25170. function deburr(string) {
  25171. string = toString(string);
  25172. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  25173. }
  25174. /**
  25175. * Checks if `string` ends with the given target string.
  25176. *
  25177. * @static
  25178. * @memberOf _
  25179. * @since 3.0.0
  25180. * @category String
  25181. * @param {string} [string=''] The string to inspect.
  25182. * @param {string} [target] The string to search for.
  25183. * @param {number} [position=string.length] The position to search up to.
  25184. * @returns {boolean} Returns `true` if `string` ends with `target`,
  25185. * else `false`.
  25186. * @example
  25187. *
  25188. * _.endsWith('abc', 'c');
  25189. * // => true
  25190. *
  25191. * _.endsWith('abc', 'b');
  25192. * // => false
  25193. *
  25194. * _.endsWith('abc', 'b', 2);
  25195. * // => true
  25196. */
  25197. function endsWith(string, target, position) {
  25198. string = toString(string);
  25199. target = baseToString(target);
  25200. var length = string.length;
  25201. position = position === undefined
  25202. ? length
  25203. : baseClamp(toInteger(position), 0, length);
  25204. var end = position;
  25205. position -= target.length;
  25206. return position >= 0 && string.slice(position, end) == target;
  25207. }
  25208. /**
  25209. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  25210. * corresponding HTML entities.
  25211. *
  25212. * **Note:** No other characters are escaped. To escape additional
  25213. * characters use a third-party library like [_he_](https://mths.be/he).
  25214. *
  25215. * Though the ">" character is escaped for symmetry, characters like
  25216. * ">" and "/" don't need escaping in HTML and have no special meaning
  25217. * unless they're part of a tag or unquoted attribute value. See
  25218. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  25219. * (under "semi-related fun fact") for more details.
  25220. *
  25221. * When working with HTML you should always
  25222. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  25223. * XSS vectors.
  25224. *
  25225. * @static
  25226. * @since 0.1.0
  25227. * @memberOf _
  25228. * @category String
  25229. * @param {string} [string=''] The string to escape.
  25230. * @returns {string} Returns the escaped string.
  25231. * @example
  25232. *
  25233. * _.escape('fred, barney, & pebbles');
  25234. * // => 'fred, barney, &amp; pebbles'
  25235. */
  25236. function escape(string) {
  25237. string = toString(string);
  25238. return (string && reHasUnescapedHtml.test(string))
  25239. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  25240. : string;
  25241. }
  25242. /**
  25243. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  25244. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  25245. *
  25246. * @static
  25247. * @memberOf _
  25248. * @since 3.0.0
  25249. * @category String
  25250. * @param {string} [string=''] The string to escape.
  25251. * @returns {string} Returns the escaped string.
  25252. * @example
  25253. *
  25254. * _.escapeRegExp('[lodash](https://lodash.com/)');
  25255. * // => '\[lodash\]\(https://lodash\.com/\)'
  25256. */
  25257. function escapeRegExp(string) {
  25258. string = toString(string);
  25259. return (string && reHasRegExpChar.test(string))
  25260. ? string.replace(reRegExpChar, '\\$&')
  25261. : string;
  25262. }
  25263. /**
  25264. * Converts `string` to
  25265. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  25266. *
  25267. * @static
  25268. * @memberOf _
  25269. * @since 3.0.0
  25270. * @category String
  25271. * @param {string} [string=''] The string to convert.
  25272. * @returns {string} Returns the kebab cased string.
  25273. * @example
  25274. *
  25275. * _.kebabCase('Foo Bar');
  25276. * // => 'foo-bar'
  25277. *
  25278. * _.kebabCase('fooBar');
  25279. * // => 'foo-bar'
  25280. *
  25281. * _.kebabCase('__FOO_BAR__');
  25282. * // => 'foo-bar'
  25283. */
  25284. var kebabCase = createCompounder(function(result, word, index) {
  25285. return result + (index ? '-' : '') + word.toLowerCase();
  25286. });
  25287. /**
  25288. * Converts `string`, as space separated words, to lower case.
  25289. *
  25290. * @static
  25291. * @memberOf _
  25292. * @since 4.0.0
  25293. * @category String
  25294. * @param {string} [string=''] The string to convert.
  25295. * @returns {string} Returns the lower cased string.
  25296. * @example
  25297. *
  25298. * _.lowerCase('--Foo-Bar--');
  25299. * // => 'foo bar'
  25300. *
  25301. * _.lowerCase('fooBar');
  25302. * // => 'foo bar'
  25303. *
  25304. * _.lowerCase('__FOO_BAR__');
  25305. * // => 'foo bar'
  25306. */
  25307. var lowerCase = createCompounder(function(result, word, index) {
  25308. return result + (index ? ' ' : '') + word.toLowerCase();
  25309. });
  25310. /**
  25311. * Converts the first character of `string` to lower case.
  25312. *
  25313. * @static
  25314. * @memberOf _
  25315. * @since 4.0.0
  25316. * @category String
  25317. * @param {string} [string=''] The string to convert.
  25318. * @returns {string} Returns the converted string.
  25319. * @example
  25320. *
  25321. * _.lowerFirst('Fred');
  25322. * // => 'fred'
  25323. *
  25324. * _.lowerFirst('FRED');
  25325. * // => 'fRED'
  25326. */
  25327. var lowerFirst = createCaseFirst('toLowerCase');
  25328. /**
  25329. * Pads `string` on the left and right sides if it's shorter than `length`.
  25330. * Padding characters are truncated if they can't be evenly divided by `length`.
  25331. *
  25332. * @static
  25333. * @memberOf _
  25334. * @since 3.0.0
  25335. * @category String
  25336. * @param {string} [string=''] The string to pad.
  25337. * @param {number} [length=0] The padding length.
  25338. * @param {string} [chars=' '] The string used as padding.
  25339. * @returns {string} Returns the padded string.
  25340. * @example
  25341. *
  25342. * _.pad('abc', 8);
  25343. * // => ' abc '
  25344. *
  25345. * _.pad('abc', 8, '_-');
  25346. * // => '_-abc_-_'
  25347. *
  25348. * _.pad('abc', 3);
  25349. * // => 'abc'
  25350. */
  25351. function pad(string, length, chars) {
  25352. string = toString(string);
  25353. length = toInteger(length);
  25354. var strLength = length ? stringSize(string) : 0;
  25355. if (!length || strLength >= length) {
  25356. return string;
  25357. }
  25358. var mid = (length - strLength) / 2;
  25359. return (
  25360. createPadding(nativeFloor(mid), chars) +
  25361. string +
  25362. createPadding(nativeCeil(mid), chars)
  25363. );
  25364. }
  25365. /**
  25366. * Pads `string` on the right side if it's shorter than `length`. Padding
  25367. * characters are truncated if they exceed `length`.
  25368. *
  25369. * @static
  25370. * @memberOf _
  25371. * @since 4.0.0
  25372. * @category String
  25373. * @param {string} [string=''] The string to pad.
  25374. * @param {number} [length=0] The padding length.
  25375. * @param {string} [chars=' '] The string used as padding.
  25376. * @returns {string} Returns the padded string.
  25377. * @example
  25378. *
  25379. * _.padEnd('abc', 6);
  25380. * // => 'abc '
  25381. *
  25382. * _.padEnd('abc', 6, '_-');
  25383. * // => 'abc_-_'
  25384. *
  25385. * _.padEnd('abc', 3);
  25386. * // => 'abc'
  25387. */
  25388. function padEnd(string, length, chars) {
  25389. string = toString(string);
  25390. length = toInteger(length);
  25391. var strLength = length ? stringSize(string) : 0;
  25392. return (length && strLength < length)
  25393. ? (string + createPadding(length - strLength, chars))
  25394. : string;
  25395. }
  25396. /**
  25397. * Pads `string` on the left side if it's shorter than `length`. Padding
  25398. * characters are truncated if they exceed `length`.
  25399. *
  25400. * @static
  25401. * @memberOf _
  25402. * @since 4.0.0
  25403. * @category String
  25404. * @param {string} [string=''] The string to pad.
  25405. * @param {number} [length=0] The padding length.
  25406. * @param {string} [chars=' '] The string used as padding.
  25407. * @returns {string} Returns the padded string.
  25408. * @example
  25409. *
  25410. * _.padStart('abc', 6);
  25411. * // => ' abc'
  25412. *
  25413. * _.padStart('abc', 6, '_-');
  25414. * // => '_-_abc'
  25415. *
  25416. * _.padStart('abc', 3);
  25417. * // => 'abc'
  25418. */
  25419. function padStart(string, length, chars) {
  25420. string = toString(string);
  25421. length = toInteger(length);
  25422. var strLength = length ? stringSize(string) : 0;
  25423. return (length && strLength < length)
  25424. ? (createPadding(length - strLength, chars) + string)
  25425. : string;
  25426. }
  25427. /**
  25428. * Converts `string` to an integer of the specified radix. If `radix` is
  25429. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  25430. * hexadecimal, in which case a `radix` of `16` is used.
  25431. *
  25432. * **Note:** This method aligns with the
  25433. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  25434. *
  25435. * @static
  25436. * @memberOf _
  25437. * @since 1.1.0
  25438. * @category String
  25439. * @param {string} string The string to convert.
  25440. * @param {number} [radix=10] The radix to interpret `value` by.
  25441. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25442. * @returns {number} Returns the converted integer.
  25443. * @example
  25444. *
  25445. * _.parseInt('08');
  25446. * // => 8
  25447. *
  25448. * _.map(['6', '08', '10'], _.parseInt);
  25449. * // => [6, 8, 10]
  25450. */
  25451. function parseInt(string, radix, guard) {
  25452. if (guard || radix == null) {
  25453. radix = 0;
  25454. } else if (radix) {
  25455. radix = +radix;
  25456. }
  25457. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  25458. }
  25459. /**
  25460. * Repeats the given string `n` times.
  25461. *
  25462. * @static
  25463. * @memberOf _
  25464. * @since 3.0.0
  25465. * @category String
  25466. * @param {string} [string=''] The string to repeat.
  25467. * @param {number} [n=1] The number of times to repeat the string.
  25468. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25469. * @returns {string} Returns the repeated string.
  25470. * @example
  25471. *
  25472. * _.repeat('*', 3);
  25473. * // => '***'
  25474. *
  25475. * _.repeat('abc', 2);
  25476. * // => 'abcabc'
  25477. *
  25478. * _.repeat('abc', 0);
  25479. * // => ''
  25480. */
  25481. function repeat(string, n, guard) {
  25482. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  25483. n = 1;
  25484. } else {
  25485. n = toInteger(n);
  25486. }
  25487. return baseRepeat(toString(string), n);
  25488. }
  25489. /**
  25490. * Replaces matches for `pattern` in `string` with `replacement`.
  25491. *
  25492. * **Note:** This method is based on
  25493. * [`String#replace`](https://mdn.io/String/replace).
  25494. *
  25495. * @static
  25496. * @memberOf _
  25497. * @since 4.0.0
  25498. * @category String
  25499. * @param {string} [string=''] The string to modify.
  25500. * @param {RegExp|string} pattern The pattern to replace.
  25501. * @param {Function|string} replacement The match replacement.
  25502. * @returns {string} Returns the modified string.
  25503. * @example
  25504. *
  25505. * _.replace('Hi Fred', 'Fred', 'Barney');
  25506. * // => 'Hi Barney'
  25507. */
  25508. function replace() {
  25509. var args = arguments,
  25510. string = toString(args[0]);
  25511. return args.length < 3 ? string : string.replace(args[1], args[2]);
  25512. }
  25513. /**
  25514. * Converts `string` to
  25515. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  25516. *
  25517. * @static
  25518. * @memberOf _
  25519. * @since 3.0.0
  25520. * @category String
  25521. * @param {string} [string=''] The string to convert.
  25522. * @returns {string} Returns the snake cased string.
  25523. * @example
  25524. *
  25525. * _.snakeCase('Foo Bar');
  25526. * // => 'foo_bar'
  25527. *
  25528. * _.snakeCase('fooBar');
  25529. * // => 'foo_bar'
  25530. *
  25531. * _.snakeCase('--FOO-BAR--');
  25532. * // => 'foo_bar'
  25533. */
  25534. var snakeCase = createCompounder(function(result, word, index) {
  25535. return result + (index ? '_' : '') + word.toLowerCase();
  25536. });
  25537. /**
  25538. * Splits `string` by `separator`.
  25539. *
  25540. * **Note:** This method is based on
  25541. * [`String#split`](https://mdn.io/String/split).
  25542. *
  25543. * @static
  25544. * @memberOf _
  25545. * @since 4.0.0
  25546. * @category String
  25547. * @param {string} [string=''] The string to split.
  25548. * @param {RegExp|string} separator The separator pattern to split by.
  25549. * @param {number} [limit] The length to truncate results to.
  25550. * @returns {Array} Returns the string segments.
  25551. * @example
  25552. *
  25553. * _.split('a-b-c', '-', 2);
  25554. * // => ['a', 'b']
  25555. */
  25556. function split(string, separator, limit) {
  25557. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  25558. separator = limit = undefined;
  25559. }
  25560. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  25561. if (!limit) {
  25562. return [];
  25563. }
  25564. string = toString(string);
  25565. if (string && (
  25566. typeof separator == 'string' ||
  25567. (separator != null && !isRegExp(separator))
  25568. )) {
  25569. separator = baseToString(separator);
  25570. if (!separator && hasUnicode(string)) {
  25571. return castSlice(stringToArray(string), 0, limit);
  25572. }
  25573. }
  25574. return string.split(separator, limit);
  25575. }
  25576. /**
  25577. * Converts `string` to
  25578. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  25579. *
  25580. * @static
  25581. * @memberOf _
  25582. * @since 3.1.0
  25583. * @category String
  25584. * @param {string} [string=''] The string to convert.
  25585. * @returns {string} Returns the start cased string.
  25586. * @example
  25587. *
  25588. * _.startCase('--foo-bar--');
  25589. * // => 'Foo Bar'
  25590. *
  25591. * _.startCase('fooBar');
  25592. * // => 'Foo Bar'
  25593. *
  25594. * _.startCase('__FOO_BAR__');
  25595. * // => 'FOO BAR'
  25596. */
  25597. var startCase = createCompounder(function(result, word, index) {
  25598. return result + (index ? ' ' : '') + upperFirst(word);
  25599. });
  25600. /**
  25601. * Checks if `string` starts with the given target string.
  25602. *
  25603. * @static
  25604. * @memberOf _
  25605. * @since 3.0.0
  25606. * @category String
  25607. * @param {string} [string=''] The string to inspect.
  25608. * @param {string} [target] The string to search for.
  25609. * @param {number} [position=0] The position to search from.
  25610. * @returns {boolean} Returns `true` if `string` starts with `target`,
  25611. * else `false`.
  25612. * @example
  25613. *
  25614. * _.startsWith('abc', 'a');
  25615. * // => true
  25616. *
  25617. * _.startsWith('abc', 'b');
  25618. * // => false
  25619. *
  25620. * _.startsWith('abc', 'b', 1);
  25621. * // => true
  25622. */
  25623. function startsWith(string, target, position) {
  25624. string = toString(string);
  25625. position = position == null
  25626. ? 0
  25627. : baseClamp(toInteger(position), 0, string.length);
  25628. target = baseToString(target);
  25629. return string.slice(position, position + target.length) == target;
  25630. }
  25631. /**
  25632. * Creates a compiled template function that can interpolate data properties
  25633. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  25634. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  25635. * properties may be accessed as free variables in the template. If a setting
  25636. * object is given, it takes precedence over `_.templateSettings` values.
  25637. *
  25638. * **Note:** In the development build `_.template` utilizes
  25639. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  25640. * for easier debugging.
  25641. *
  25642. * For more information on precompiling templates see
  25643. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  25644. *
  25645. * For more information on Chrome extension sandboxes see
  25646. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  25647. *
  25648. * @static
  25649. * @since 0.1.0
  25650. * @memberOf _
  25651. * @category String
  25652. * @param {string} [string=''] The template string.
  25653. * @param {Object} [options={}] The options object.
  25654. * @param {RegExp} [options.escape=_.templateSettings.escape]
  25655. * The HTML "escape" delimiter.
  25656. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  25657. * The "evaluate" delimiter.
  25658. * @param {Object} [options.imports=_.templateSettings.imports]
  25659. * An object to import into the template as free variables.
  25660. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  25661. * The "interpolate" delimiter.
  25662. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  25663. * The sourceURL of the compiled template.
  25664. * @param {string} [options.variable='obj']
  25665. * The data object variable name.
  25666. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25667. * @returns {Function} Returns the compiled template function.
  25668. * @example
  25669. *
  25670. * // Use the "interpolate" delimiter to create a compiled template.
  25671. * var compiled = _.template('hello <%= user %>!');
  25672. * compiled({ 'user': 'fred' });
  25673. * // => 'hello fred!'
  25674. *
  25675. * // Use the HTML "escape" delimiter to escape data property values.
  25676. * var compiled = _.template('<b><%- value %></b>');
  25677. * compiled({ 'value': '<script>' });
  25678. * // => '<b>&lt;script&gt;</b>'
  25679. *
  25680. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  25681. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  25682. * compiled({ 'users': ['fred', 'barney'] });
  25683. * // => '<li>fred</li><li>barney</li>'
  25684. *
  25685. * // Use the internal `print` function in "evaluate" delimiters.
  25686. * var compiled = _.template('<% print("hello " + user); %>!');
  25687. * compiled({ 'user': 'barney' });
  25688. * // => 'hello barney!'
  25689. *
  25690. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  25691. * // Disable support by replacing the "interpolate" delimiter.
  25692. * var compiled = _.template('hello ${ user }!');
  25693. * compiled({ 'user': 'pebbles' });
  25694. * // => 'hello pebbles!'
  25695. *
  25696. * // Use backslashes to treat delimiters as plain text.
  25697. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  25698. * compiled({ 'value': 'ignored' });
  25699. * // => '<%- value %>'
  25700. *
  25701. * // Use the `imports` option to import `jQuery` as `jq`.
  25702. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  25703. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  25704. * compiled({ 'users': ['fred', 'barney'] });
  25705. * // => '<li>fred</li><li>barney</li>'
  25706. *
  25707. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  25708. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  25709. * compiled(data);
  25710. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  25711. *
  25712. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  25713. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  25714. * compiled.source;
  25715. * // => function(data) {
  25716. * // var __t, __p = '';
  25717. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  25718. * // return __p;
  25719. * // }
  25720. *
  25721. * // Use custom template delimiters.
  25722. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  25723. * var compiled = _.template('hello {{ user }}!');
  25724. * compiled({ 'user': 'mustache' });
  25725. * // => 'hello mustache!'
  25726. *
  25727. * // Use the `source` property to inline compiled templates for meaningful
  25728. * // line numbers in error messages and stack traces.
  25729. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  25730. * var JST = {\
  25731. * "main": ' + _.template(mainText).source + '\
  25732. * };\
  25733. * ');
  25734. */
  25735. function template(string, options, guard) {
  25736. // Based on John Resig's `tmpl` implementation
  25737. // (http://ejohn.org/blog/javascript-micro-templating/)
  25738. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  25739. var settings = lodash.templateSettings;
  25740. if (guard && isIterateeCall(string, options, guard)) {
  25741. options = undefined;
  25742. }
  25743. string = toString(string);
  25744. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  25745. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  25746. importsKeys = keys(imports),
  25747. importsValues = baseValues(imports, importsKeys);
  25748. var isEscaping,
  25749. isEvaluating,
  25750. index = 0,
  25751. interpolate = options.interpolate || reNoMatch,
  25752. source = "__p += '";
  25753. // Compile the regexp to match each delimiter.
  25754. var reDelimiters = RegExp(
  25755. (options.escape || reNoMatch).source + '|' +
  25756. interpolate.source + '|' +
  25757. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  25758. (options.evaluate || reNoMatch).source + '|$'
  25759. , 'g');
  25760. // Use a sourceURL for easier debugging.
  25761. var sourceURL = '//# sourceURL=' +
  25762. ('sourceURL' in options
  25763. ? options.sourceURL
  25764. : ('lodash.templateSources[' + (++templateCounter) + ']')
  25765. ) + '\n';
  25766. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  25767. interpolateValue || (interpolateValue = esTemplateValue);
  25768. // Escape characters that can't be included in string literals.
  25769. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  25770. // Replace delimiters with snippets.
  25771. if (escapeValue) {
  25772. isEscaping = true;
  25773. source += "' +\n__e(" + escapeValue + ") +\n'";
  25774. }
  25775. if (evaluateValue) {
  25776. isEvaluating = true;
  25777. source += "';\n" + evaluateValue + ";\n__p += '";
  25778. }
  25779. if (interpolateValue) {
  25780. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  25781. }
  25782. index = offset + match.length;
  25783. // The JS engine embedded in Adobe products needs `match` returned in
  25784. // order to produce the correct `offset` value.
  25785. return match;
  25786. });
  25787. source += "';\n";
  25788. // If `variable` is not specified wrap a with-statement around the generated
  25789. // code to add the data object to the top of the scope chain.
  25790. var variable = options.variable;
  25791. if (!variable) {
  25792. source = 'with (obj) {\n' + source + '\n}\n';
  25793. }
  25794. // Cleanup code by stripping empty strings.
  25795. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  25796. .replace(reEmptyStringMiddle, '$1')
  25797. .replace(reEmptyStringTrailing, '$1;');
  25798. // Frame code as the function body.
  25799. source = 'function(' + (variable || 'obj') + ') {\n' +
  25800. (variable
  25801. ? ''
  25802. : 'obj || (obj = {});\n'
  25803. ) +
  25804. "var __t, __p = ''" +
  25805. (isEscaping
  25806. ? ', __e = _.escape'
  25807. : ''
  25808. ) +
  25809. (isEvaluating
  25810. ? ', __j = Array.prototype.join;\n' +
  25811. "function print() { __p += __j.call(arguments, '') }\n"
  25812. : ';\n'
  25813. ) +
  25814. source +
  25815. 'return __p\n}';
  25816. var result = attempt(function() {
  25817. return Function(importsKeys, sourceURL + 'return ' + source)
  25818. .apply(undefined, importsValues);
  25819. });
  25820. // Provide the compiled function's source by its `toString` method or
  25821. // the `source` property as a convenience for inlining compiled templates.
  25822. result.source = source;
  25823. if (isError(result)) {
  25824. throw result;
  25825. }
  25826. return result;
  25827. }
  25828. /**
  25829. * Converts `string`, as a whole, to lower case just like
  25830. * [String#toLowerCase](https://mdn.io/toLowerCase).
  25831. *
  25832. * @static
  25833. * @memberOf _
  25834. * @since 4.0.0
  25835. * @category String
  25836. * @param {string} [string=''] The string to convert.
  25837. * @returns {string} Returns the lower cased string.
  25838. * @example
  25839. *
  25840. * _.toLower('--Foo-Bar--');
  25841. * // => '--foo-bar--'
  25842. *
  25843. * _.toLower('fooBar');
  25844. * // => 'foobar'
  25845. *
  25846. * _.toLower('__FOO_BAR__');
  25847. * // => '__foo_bar__'
  25848. */
  25849. function toLower(value) {
  25850. return toString(value).toLowerCase();
  25851. }
  25852. /**
  25853. * Converts `string`, as a whole, to upper case just like
  25854. * [String#toUpperCase](https://mdn.io/toUpperCase).
  25855. *
  25856. * @static
  25857. * @memberOf _
  25858. * @since 4.0.0
  25859. * @category String
  25860. * @param {string} [string=''] The string to convert.
  25861. * @returns {string} Returns the upper cased string.
  25862. * @example
  25863. *
  25864. * _.toUpper('--foo-bar--');
  25865. * // => '--FOO-BAR--'
  25866. *
  25867. * _.toUpper('fooBar');
  25868. * // => 'FOOBAR'
  25869. *
  25870. * _.toUpper('__foo_bar__');
  25871. * // => '__FOO_BAR__'
  25872. */
  25873. function toUpper(value) {
  25874. return toString(value).toUpperCase();
  25875. }
  25876. /**
  25877. * Removes leading and trailing whitespace or specified characters from `string`.
  25878. *
  25879. * @static
  25880. * @memberOf _
  25881. * @since 3.0.0
  25882. * @category String
  25883. * @param {string} [string=''] The string to trim.
  25884. * @param {string} [chars=whitespace] The characters to trim.
  25885. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25886. * @returns {string} Returns the trimmed string.
  25887. * @example
  25888. *
  25889. * _.trim(' abc ');
  25890. * // => 'abc'
  25891. *
  25892. * _.trim('-_-abc-_-', '_-');
  25893. * // => 'abc'
  25894. *
  25895. * _.map([' foo ', ' bar '], _.trim);
  25896. * // => ['foo', 'bar']
  25897. */
  25898. function trim(string, chars, guard) {
  25899. string = toString(string);
  25900. if (string && (guard || chars === undefined)) {
  25901. return string.replace(reTrim, '');
  25902. }
  25903. if (!string || !(chars = baseToString(chars))) {
  25904. return string;
  25905. }
  25906. var strSymbols = stringToArray(string),
  25907. chrSymbols = stringToArray(chars),
  25908. start = charsStartIndex(strSymbols, chrSymbols),
  25909. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  25910. return castSlice(strSymbols, start, end).join('');
  25911. }
  25912. /**
  25913. * Removes trailing whitespace or specified characters from `string`.
  25914. *
  25915. * @static
  25916. * @memberOf _
  25917. * @since 4.0.0
  25918. * @category String
  25919. * @param {string} [string=''] The string to trim.
  25920. * @param {string} [chars=whitespace] The characters to trim.
  25921. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25922. * @returns {string} Returns the trimmed string.
  25923. * @example
  25924. *
  25925. * _.trimEnd(' abc ');
  25926. * // => ' abc'
  25927. *
  25928. * _.trimEnd('-_-abc-_-', '_-');
  25929. * // => '-_-abc'
  25930. */
  25931. function trimEnd(string, chars, guard) {
  25932. string = toString(string);
  25933. if (string && (guard || chars === undefined)) {
  25934. return string.replace(reTrimEnd, '');
  25935. }
  25936. if (!string || !(chars = baseToString(chars))) {
  25937. return string;
  25938. }
  25939. var strSymbols = stringToArray(string),
  25940. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  25941. return castSlice(strSymbols, 0, end).join('');
  25942. }
  25943. /**
  25944. * Removes leading whitespace or specified characters from `string`.
  25945. *
  25946. * @static
  25947. * @memberOf _
  25948. * @since 4.0.0
  25949. * @category String
  25950. * @param {string} [string=''] The string to trim.
  25951. * @param {string} [chars=whitespace] The characters to trim.
  25952. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25953. * @returns {string} Returns the trimmed string.
  25954. * @example
  25955. *
  25956. * _.trimStart(' abc ');
  25957. * // => 'abc '
  25958. *
  25959. * _.trimStart('-_-abc-_-', '_-');
  25960. * // => 'abc-_-'
  25961. */
  25962. function trimStart(string, chars, guard) {
  25963. string = toString(string);
  25964. if (string && (guard || chars === undefined)) {
  25965. return string.replace(reTrimStart, '');
  25966. }
  25967. if (!string || !(chars = baseToString(chars))) {
  25968. return string;
  25969. }
  25970. var strSymbols = stringToArray(string),
  25971. start = charsStartIndex(strSymbols, stringToArray(chars));
  25972. return castSlice(strSymbols, start).join('');
  25973. }
  25974. /**
  25975. * Truncates `string` if it's longer than the given maximum string length.
  25976. * The last characters of the truncated string are replaced with the omission
  25977. * string which defaults to "...".
  25978. *
  25979. * @static
  25980. * @memberOf _
  25981. * @since 4.0.0
  25982. * @category String
  25983. * @param {string} [string=''] The string to truncate.
  25984. * @param {Object} [options={}] The options object.
  25985. * @param {number} [options.length=30] The maximum string length.
  25986. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  25987. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  25988. * @returns {string} Returns the truncated string.
  25989. * @example
  25990. *
  25991. * _.truncate('hi-diddly-ho there, neighborino');
  25992. * // => 'hi-diddly-ho there, neighbo...'
  25993. *
  25994. * _.truncate('hi-diddly-ho there, neighborino', {
  25995. * 'length': 24,
  25996. * 'separator': ' '
  25997. * });
  25998. * // => 'hi-diddly-ho there,...'
  25999. *
  26000. * _.truncate('hi-diddly-ho there, neighborino', {
  26001. * 'length': 24,
  26002. * 'separator': /,? +/
  26003. * });
  26004. * // => 'hi-diddly-ho there...'
  26005. *
  26006. * _.truncate('hi-diddly-ho there, neighborino', {
  26007. * 'omission': ' [...]'
  26008. * });
  26009. * // => 'hi-diddly-ho there, neig [...]'
  26010. */
  26011. function truncate(string, options) {
  26012. var length = DEFAULT_TRUNC_LENGTH,
  26013. omission = DEFAULT_TRUNC_OMISSION;
  26014. if (isObject(options)) {
  26015. var separator = 'separator' in options ? options.separator : separator;
  26016. length = 'length' in options ? toInteger(options.length) : length;
  26017. omission = 'omission' in options ? baseToString(options.omission) : omission;
  26018. }
  26019. string = toString(string);
  26020. var strLength = string.length;
  26021. if (hasUnicode(string)) {
  26022. var strSymbols = stringToArray(string);
  26023. strLength = strSymbols.length;
  26024. }
  26025. if (length >= strLength) {
  26026. return string;
  26027. }
  26028. var end = length - stringSize(omission);
  26029. if (end < 1) {
  26030. return omission;
  26031. }
  26032. var result = strSymbols
  26033. ? castSlice(strSymbols, 0, end).join('')
  26034. : string.slice(0, end);
  26035. if (separator === undefined) {
  26036. return result + omission;
  26037. }
  26038. if (strSymbols) {
  26039. end += (result.length - end);
  26040. }
  26041. if (isRegExp(separator)) {
  26042. if (string.slice(end).search(separator)) {
  26043. var match,
  26044. substring = result;
  26045. if (!separator.global) {
  26046. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  26047. }
  26048. separator.lastIndex = 0;
  26049. while ((match = separator.exec(substring))) {
  26050. var newEnd = match.index;
  26051. }
  26052. result = result.slice(0, newEnd === undefined ? end : newEnd);
  26053. }
  26054. } else if (string.indexOf(baseToString(separator), end) != end) {
  26055. var index = result.lastIndexOf(separator);
  26056. if (index > -1) {
  26057. result = result.slice(0, index);
  26058. }
  26059. }
  26060. return result + omission;
  26061. }
  26062. /**
  26063. * The inverse of `_.escape`; this method converts the HTML entities
  26064. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  26065. * their corresponding characters.
  26066. *
  26067. * **Note:** No other HTML entities are unescaped. To unescape additional
  26068. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  26069. *
  26070. * @static
  26071. * @memberOf _
  26072. * @since 0.6.0
  26073. * @category String
  26074. * @param {string} [string=''] The string to unescape.
  26075. * @returns {string} Returns the unescaped string.
  26076. * @example
  26077. *
  26078. * _.unescape('fred, barney, &amp; pebbles');
  26079. * // => 'fred, barney, & pebbles'
  26080. */
  26081. function unescape(string) {
  26082. string = toString(string);
  26083. return (string && reHasEscapedHtml.test(string))
  26084. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  26085. : string;
  26086. }
  26087. /**
  26088. * Converts `string`, as space separated words, to upper case.
  26089. *
  26090. * @static
  26091. * @memberOf _
  26092. * @since 4.0.0
  26093. * @category String
  26094. * @param {string} [string=''] The string to convert.
  26095. * @returns {string} Returns the upper cased string.
  26096. * @example
  26097. *
  26098. * _.upperCase('--foo-bar');
  26099. * // => 'FOO BAR'
  26100. *
  26101. * _.upperCase('fooBar');
  26102. * // => 'FOO BAR'
  26103. *
  26104. * _.upperCase('__foo_bar__');
  26105. * // => 'FOO BAR'
  26106. */
  26107. var upperCase = createCompounder(function(result, word, index) {
  26108. return result + (index ? ' ' : '') + word.toUpperCase();
  26109. });
  26110. /**
  26111. * Converts the first character of `string` to upper case.
  26112. *
  26113. * @static
  26114. * @memberOf _
  26115. * @since 4.0.0
  26116. * @category String
  26117. * @param {string} [string=''] The string to convert.
  26118. * @returns {string} Returns the converted string.
  26119. * @example
  26120. *
  26121. * _.upperFirst('fred');
  26122. * // => 'Fred'
  26123. *
  26124. * _.upperFirst('FRED');
  26125. * // => 'FRED'
  26126. */
  26127. var upperFirst = createCaseFirst('toUpperCase');
  26128. /**
  26129. * Splits `string` into an array of its words.
  26130. *
  26131. * @static
  26132. * @memberOf _
  26133. * @since 3.0.0
  26134. * @category String
  26135. * @param {string} [string=''] The string to inspect.
  26136. * @param {RegExp|string} [pattern] The pattern to match words.
  26137. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26138. * @returns {Array} Returns the words of `string`.
  26139. * @example
  26140. *
  26141. * _.words('fred, barney, & pebbles');
  26142. * // => ['fred', 'barney', 'pebbles']
  26143. *
  26144. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  26145. * // => ['fred', 'barney', '&', 'pebbles']
  26146. */
  26147. function words(string, pattern, guard) {
  26148. string = toString(string);
  26149. pattern = guard ? undefined : pattern;
  26150. if (pattern === undefined) {
  26151. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  26152. }
  26153. return string.match(pattern) || [];
  26154. }
  26155. /*------------------------------------------------------------------------*/
  26156. /**
  26157. * Attempts to invoke `func`, returning either the result or the caught error
  26158. * object. Any additional arguments are provided to `func` when it's invoked.
  26159. *
  26160. * @static
  26161. * @memberOf _
  26162. * @since 3.0.0
  26163. * @category Util
  26164. * @param {Function} func The function to attempt.
  26165. * @param {...*} [args] The arguments to invoke `func` with.
  26166. * @returns {*} Returns the `func` result or error object.
  26167. * @example
  26168. *
  26169. * // Avoid throwing errors for invalid selectors.
  26170. * var elements = _.attempt(function(selector) {
  26171. * return document.querySelectorAll(selector);
  26172. * }, '>_>');
  26173. *
  26174. * if (_.isError(elements)) {
  26175. * elements = [];
  26176. * }
  26177. */
  26178. var attempt = baseRest(function(func, args) {
  26179. try {
  26180. return apply(func, undefined, args);
  26181. } catch (e) {
  26182. return isError(e) ? e : new Error(e);
  26183. }
  26184. });
  26185. /**
  26186. * Binds methods of an object to the object itself, overwriting the existing
  26187. * method.
  26188. *
  26189. * **Note:** This method doesn't set the "length" property of bound functions.
  26190. *
  26191. * @static
  26192. * @since 0.1.0
  26193. * @memberOf _
  26194. * @category Util
  26195. * @param {Object} object The object to bind and assign the bound methods to.
  26196. * @param {...(string|string[])} methodNames The object method names to bind.
  26197. * @returns {Object} Returns `object`.
  26198. * @example
  26199. *
  26200. * var view = {
  26201. * 'label': 'docs',
  26202. * 'click': function() {
  26203. * console.log('clicked ' + this.label);
  26204. * }
  26205. * };
  26206. *
  26207. * _.bindAll(view, ['click']);
  26208. * jQuery(element).on('click', view.click);
  26209. * // => Logs 'clicked docs' when clicked.
  26210. */
  26211. var bindAll = flatRest(function(object, methodNames) {
  26212. arrayEach(methodNames, function(key) {
  26213. key = toKey(key);
  26214. baseAssignValue(object, key, bind(object[key], object));
  26215. });
  26216. return object;
  26217. });
  26218. /**
  26219. * Creates a function that iterates over `pairs` and invokes the corresponding
  26220. * function of the first predicate to return truthy. The predicate-function
  26221. * pairs are invoked with the `this` binding and arguments of the created
  26222. * function.
  26223. *
  26224. * @static
  26225. * @memberOf _
  26226. * @since 4.0.0
  26227. * @category Util
  26228. * @param {Array} pairs The predicate-function pairs.
  26229. * @returns {Function} Returns the new composite function.
  26230. * @example
  26231. *
  26232. * var func = _.cond([
  26233. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  26234. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  26235. * [_.stubTrue, _.constant('no match')]
  26236. * ]);
  26237. *
  26238. * func({ 'a': 1, 'b': 2 });
  26239. * // => 'matches A'
  26240. *
  26241. * func({ 'a': 0, 'b': 1 });
  26242. * // => 'matches B'
  26243. *
  26244. * func({ 'a': '1', 'b': '2' });
  26245. * // => 'no match'
  26246. */
  26247. function cond(pairs) {
  26248. var length = pairs == null ? 0 : pairs.length,
  26249. toIteratee = getIteratee();
  26250. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  26251. if (typeof pair[1] != 'function') {
  26252. throw new TypeError(FUNC_ERROR_TEXT);
  26253. }
  26254. return [toIteratee(pair[0]), pair[1]];
  26255. });
  26256. return baseRest(function(args) {
  26257. var index = -1;
  26258. while (++index < length) {
  26259. var pair = pairs[index];
  26260. if (apply(pair[0], this, args)) {
  26261. return apply(pair[1], this, args);
  26262. }
  26263. }
  26264. });
  26265. }
  26266. /**
  26267. * Creates a function that invokes the predicate properties of `source` with
  26268. * the corresponding property values of a given object, returning `true` if
  26269. * all predicates return truthy, else `false`.
  26270. *
  26271. * **Note:** The created function is equivalent to `_.conformsTo` with
  26272. * `source` partially applied.
  26273. *
  26274. * @static
  26275. * @memberOf _
  26276. * @since 4.0.0
  26277. * @category Util
  26278. * @param {Object} source The object of property predicates to conform to.
  26279. * @returns {Function} Returns the new spec function.
  26280. * @example
  26281. *
  26282. * var objects = [
  26283. * { 'a': 2, 'b': 1 },
  26284. * { 'a': 1, 'b': 2 }
  26285. * ];
  26286. *
  26287. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  26288. * // => [{ 'a': 1, 'b': 2 }]
  26289. */
  26290. function conforms(source) {
  26291. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  26292. }
  26293. /**
  26294. * Creates a function that returns `value`.
  26295. *
  26296. * @static
  26297. * @memberOf _
  26298. * @since 2.4.0
  26299. * @category Util
  26300. * @param {*} value The value to return from the new function.
  26301. * @returns {Function} Returns the new constant function.
  26302. * @example
  26303. *
  26304. * var objects = _.times(2, _.constant({ 'a': 1 }));
  26305. *
  26306. * console.log(objects);
  26307. * // => [{ 'a': 1 }, { 'a': 1 }]
  26308. *
  26309. * console.log(objects[0] === objects[1]);
  26310. * // => true
  26311. */
  26312. function constant(value) {
  26313. return function() {
  26314. return value;
  26315. };
  26316. }
  26317. /**
  26318. * Checks `value` to determine whether a default value should be returned in
  26319. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  26320. * or `undefined`.
  26321. *
  26322. * @static
  26323. * @memberOf _
  26324. * @since 4.14.0
  26325. * @category Util
  26326. * @param {*} value The value to check.
  26327. * @param {*} defaultValue The default value.
  26328. * @returns {*} Returns the resolved value.
  26329. * @example
  26330. *
  26331. * _.defaultTo(1, 10);
  26332. * // => 1
  26333. *
  26334. * _.defaultTo(undefined, 10);
  26335. * // => 10
  26336. */
  26337. function defaultTo(value, defaultValue) {
  26338. return (value == null || value !== value) ? defaultValue : value;
  26339. }
  26340. /**
  26341. * Creates a function that returns the result of invoking the given functions
  26342. * with the `this` binding of the created function, where each successive
  26343. * invocation is supplied the return value of the previous.
  26344. *
  26345. * @static
  26346. * @memberOf _
  26347. * @since 3.0.0
  26348. * @category Util
  26349. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  26350. * @returns {Function} Returns the new composite function.
  26351. * @see _.flowRight
  26352. * @example
  26353. *
  26354. * function square(n) {
  26355. * return n * n;
  26356. * }
  26357. *
  26358. * var addSquare = _.flow([_.add, square]);
  26359. * addSquare(1, 2);
  26360. * // => 9
  26361. */
  26362. var flow = createFlow();
  26363. /**
  26364. * This method is like `_.flow` except that it creates a function that
  26365. * invokes the given functions from right to left.
  26366. *
  26367. * @static
  26368. * @since 3.0.0
  26369. * @memberOf _
  26370. * @category Util
  26371. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  26372. * @returns {Function} Returns the new composite function.
  26373. * @see _.flow
  26374. * @example
  26375. *
  26376. * function square(n) {
  26377. * return n * n;
  26378. * }
  26379. *
  26380. * var addSquare = _.flowRight([square, _.add]);
  26381. * addSquare(1, 2);
  26382. * // => 9
  26383. */
  26384. var flowRight = createFlow(true);
  26385. /**
  26386. * This method returns the first argument it receives.
  26387. *
  26388. * @static
  26389. * @since 0.1.0
  26390. * @memberOf _
  26391. * @category Util
  26392. * @param {*} value Any value.
  26393. * @returns {*} Returns `value`.
  26394. * @example
  26395. *
  26396. * var object = { 'a': 1 };
  26397. *
  26398. * console.log(_.identity(object) === object);
  26399. * // => true
  26400. */
  26401. function identity(value) {
  26402. return value;
  26403. }
  26404. /**
  26405. * Creates a function that invokes `func` with the arguments of the created
  26406. * function. If `func` is a property name, the created function returns the
  26407. * property value for a given element. If `func` is an array or object, the
  26408. * created function returns `true` for elements that contain the equivalent
  26409. * source properties, otherwise it returns `false`.
  26410. *
  26411. * @static
  26412. * @since 4.0.0
  26413. * @memberOf _
  26414. * @category Util
  26415. * @param {*} [func=_.identity] The value to convert to a callback.
  26416. * @returns {Function} Returns the callback.
  26417. * @example
  26418. *
  26419. * var users = [
  26420. * { 'user': 'barney', 'age': 36, 'active': true },
  26421. * { 'user': 'fred', 'age': 40, 'active': false }
  26422. * ];
  26423. *
  26424. * // The `_.matches` iteratee shorthand.
  26425. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  26426. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  26427. *
  26428. * // The `_.matchesProperty` iteratee shorthand.
  26429. * _.filter(users, _.iteratee(['user', 'fred']));
  26430. * // => [{ 'user': 'fred', 'age': 40 }]
  26431. *
  26432. * // The `_.property` iteratee shorthand.
  26433. * _.map(users, _.iteratee('user'));
  26434. * // => ['barney', 'fred']
  26435. *
  26436. * // Create custom iteratee shorthands.
  26437. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  26438. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  26439. * return func.test(string);
  26440. * };
  26441. * });
  26442. *
  26443. * _.filter(['abc', 'def'], /ef/);
  26444. * // => ['def']
  26445. */
  26446. function iteratee(func) {
  26447. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  26448. }
  26449. /**
  26450. * Creates a function that performs a partial deep comparison between a given
  26451. * object and `source`, returning `true` if the given object has equivalent
  26452. * property values, else `false`.
  26453. *
  26454. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  26455. * partially applied.
  26456. *
  26457. * Partial comparisons will match empty array and empty object `source`
  26458. * values against any array or object value, respectively. See `_.isEqual`
  26459. * for a list of supported value comparisons.
  26460. *
  26461. * @static
  26462. * @memberOf _
  26463. * @since 3.0.0
  26464. * @category Util
  26465. * @param {Object} source The object of property values to match.
  26466. * @returns {Function} Returns the new spec function.
  26467. * @example
  26468. *
  26469. * var objects = [
  26470. * { 'a': 1, 'b': 2, 'c': 3 },
  26471. * { 'a': 4, 'b': 5, 'c': 6 }
  26472. * ];
  26473. *
  26474. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  26475. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  26476. */
  26477. function matches(source) {
  26478. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  26479. }
  26480. /**
  26481. * Creates a function that performs a partial deep comparison between the
  26482. * value at `path` of a given object to `srcValue`, returning `true` if the
  26483. * object value is equivalent, else `false`.
  26484. *
  26485. * **Note:** Partial comparisons will match empty array and empty object
  26486. * `srcValue` values against any array or object value, respectively. See
  26487. * `_.isEqual` for a list of supported value comparisons.
  26488. *
  26489. * @static
  26490. * @memberOf _
  26491. * @since 3.2.0
  26492. * @category Util
  26493. * @param {Array|string} path The path of the property to get.
  26494. * @param {*} srcValue The value to match.
  26495. * @returns {Function} Returns the new spec function.
  26496. * @example
  26497. *
  26498. * var objects = [
  26499. * { 'a': 1, 'b': 2, 'c': 3 },
  26500. * { 'a': 4, 'b': 5, 'c': 6 }
  26501. * ];
  26502. *
  26503. * _.find(objects, _.matchesProperty('a', 4));
  26504. * // => { 'a': 4, 'b': 5, 'c': 6 }
  26505. */
  26506. function matchesProperty(path, srcValue) {
  26507. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  26508. }
  26509. /**
  26510. * Creates a function that invokes the method at `path` of a given object.
  26511. * Any additional arguments are provided to the invoked method.
  26512. *
  26513. * @static
  26514. * @memberOf _
  26515. * @since 3.7.0
  26516. * @category Util
  26517. * @param {Array|string} path The path of the method to invoke.
  26518. * @param {...*} [args] The arguments to invoke the method with.
  26519. * @returns {Function} Returns the new invoker function.
  26520. * @example
  26521. *
  26522. * var objects = [
  26523. * { 'a': { 'b': _.constant(2) } },
  26524. * { 'a': { 'b': _.constant(1) } }
  26525. * ];
  26526. *
  26527. * _.map(objects, _.method('a.b'));
  26528. * // => [2, 1]
  26529. *
  26530. * _.map(objects, _.method(['a', 'b']));
  26531. * // => [2, 1]
  26532. */
  26533. var method = baseRest(function(path, args) {
  26534. return function(object) {
  26535. return baseInvoke(object, path, args);
  26536. };
  26537. });
  26538. /**
  26539. * The opposite of `_.method`; this method creates a function that invokes
  26540. * the method at a given path of `object`. Any additional arguments are
  26541. * provided to the invoked method.
  26542. *
  26543. * @static
  26544. * @memberOf _
  26545. * @since 3.7.0
  26546. * @category Util
  26547. * @param {Object} object The object to query.
  26548. * @param {...*} [args] The arguments to invoke the method with.
  26549. * @returns {Function} Returns the new invoker function.
  26550. * @example
  26551. *
  26552. * var array = _.times(3, _.constant),
  26553. * object = { 'a': array, 'b': array, 'c': array };
  26554. *
  26555. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  26556. * // => [2, 0]
  26557. *
  26558. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  26559. * // => [2, 0]
  26560. */
  26561. var methodOf = baseRest(function(object, args) {
  26562. return function(path) {
  26563. return baseInvoke(object, path, args);
  26564. };
  26565. });
  26566. /**
  26567. * Adds all own enumerable string keyed function properties of a source
  26568. * object to the destination object. If `object` is a function, then methods
  26569. * are added to its prototype as well.
  26570. *
  26571. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  26572. * avoid conflicts caused by modifying the original.
  26573. *
  26574. * @static
  26575. * @since 0.1.0
  26576. * @memberOf _
  26577. * @category Util
  26578. * @param {Function|Object} [object=lodash] The destination object.
  26579. * @param {Object} source The object of functions to add.
  26580. * @param {Object} [options={}] The options object.
  26581. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  26582. * @returns {Function|Object} Returns `object`.
  26583. * @example
  26584. *
  26585. * function vowels(string) {
  26586. * return _.filter(string, function(v) {
  26587. * return /[aeiou]/i.test(v);
  26588. * });
  26589. * }
  26590. *
  26591. * _.mixin({ 'vowels': vowels });
  26592. * _.vowels('fred');
  26593. * // => ['e']
  26594. *
  26595. * _('fred').vowels().value();
  26596. * // => ['e']
  26597. *
  26598. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  26599. * _('fred').vowels();
  26600. * // => ['e']
  26601. */
  26602. function mixin(object, source, options) {
  26603. var props = keys(source),
  26604. methodNames = baseFunctions(source, props);
  26605. if (options == null &&
  26606. !(isObject(source) && (methodNames.length || !props.length))) {
  26607. options = source;
  26608. source = object;
  26609. object = this;
  26610. methodNames = baseFunctions(source, keys(source));
  26611. }
  26612. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  26613. isFunc = isFunction(object);
  26614. arrayEach(methodNames, function(methodName) {
  26615. var func = source[methodName];
  26616. object[methodName] = func;
  26617. if (isFunc) {
  26618. object.prototype[methodName] = function() {
  26619. var chainAll = this.__chain__;
  26620. if (chain || chainAll) {
  26621. var result = object(this.__wrapped__),
  26622. actions = result.__actions__ = copyArray(this.__actions__);
  26623. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  26624. result.__chain__ = chainAll;
  26625. return result;
  26626. }
  26627. return func.apply(object, arrayPush([this.value()], arguments));
  26628. };
  26629. }
  26630. });
  26631. return object;
  26632. }
  26633. /**
  26634. * Reverts the `_` variable to its previous value and returns a reference to
  26635. * the `lodash` function.
  26636. *
  26637. * @static
  26638. * @since 0.1.0
  26639. * @memberOf _
  26640. * @category Util
  26641. * @returns {Function} Returns the `lodash` function.
  26642. * @example
  26643. *
  26644. * var lodash = _.noConflict();
  26645. */
  26646. function noConflict() {
  26647. if (root._ === this) {
  26648. root._ = oldDash;
  26649. }
  26650. return this;
  26651. }
  26652. /**
  26653. * This method returns `undefined`.
  26654. *
  26655. * @static
  26656. * @memberOf _
  26657. * @since 2.3.0
  26658. * @category Util
  26659. * @example
  26660. *
  26661. * _.times(2, _.noop);
  26662. * // => [undefined, undefined]
  26663. */
  26664. function noop() {
  26665. // No operation performed.
  26666. }
  26667. /**
  26668. * Creates a function that gets the argument at index `n`. If `n` is negative,
  26669. * the nth argument from the end is returned.
  26670. *
  26671. * @static
  26672. * @memberOf _
  26673. * @since 4.0.0
  26674. * @category Util
  26675. * @param {number} [n=0] The index of the argument to return.
  26676. * @returns {Function} Returns the new pass-thru function.
  26677. * @example
  26678. *
  26679. * var func = _.nthArg(1);
  26680. * func('a', 'b', 'c', 'd');
  26681. * // => 'b'
  26682. *
  26683. * var func = _.nthArg(-2);
  26684. * func('a', 'b', 'c', 'd');
  26685. * // => 'c'
  26686. */
  26687. function nthArg(n) {
  26688. n = toInteger(n);
  26689. return baseRest(function(args) {
  26690. return baseNth(args, n);
  26691. });
  26692. }
  26693. /**
  26694. * Creates a function that invokes `iteratees` with the arguments it receives
  26695. * and returns their results.
  26696. *
  26697. * @static
  26698. * @memberOf _
  26699. * @since 4.0.0
  26700. * @category Util
  26701. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  26702. * The iteratees to invoke.
  26703. * @returns {Function} Returns the new function.
  26704. * @example
  26705. *
  26706. * var func = _.over([Math.max, Math.min]);
  26707. *
  26708. * func(1, 2, 3, 4);
  26709. * // => [4, 1]
  26710. */
  26711. var over = createOver(arrayMap);
  26712. /**
  26713. * Creates a function that checks if **all** of the `predicates` return
  26714. * truthy when invoked with the arguments it receives.
  26715. *
  26716. * @static
  26717. * @memberOf _
  26718. * @since 4.0.0
  26719. * @category Util
  26720. * @param {...(Function|Function[])} [predicates=[_.identity]]
  26721. * The predicates to check.
  26722. * @returns {Function} Returns the new function.
  26723. * @example
  26724. *
  26725. * var func = _.overEvery([Boolean, isFinite]);
  26726. *
  26727. * func('1');
  26728. * // => true
  26729. *
  26730. * func(null);
  26731. * // => false
  26732. *
  26733. * func(NaN);
  26734. * // => false
  26735. */
  26736. var overEvery = createOver(arrayEvery);
  26737. /**
  26738. * Creates a function that checks if **any** of the `predicates` return
  26739. * truthy when invoked with the arguments it receives.
  26740. *
  26741. * @static
  26742. * @memberOf _
  26743. * @since 4.0.0
  26744. * @category Util
  26745. * @param {...(Function|Function[])} [predicates=[_.identity]]
  26746. * The predicates to check.
  26747. * @returns {Function} Returns the new function.
  26748. * @example
  26749. *
  26750. * var func = _.overSome([Boolean, isFinite]);
  26751. *
  26752. * func('1');
  26753. * // => true
  26754. *
  26755. * func(null);
  26756. * // => true
  26757. *
  26758. * func(NaN);
  26759. * // => false
  26760. */
  26761. var overSome = createOver(arraySome);
  26762. /**
  26763. * Creates a function that returns the value at `path` of a given object.
  26764. *
  26765. * @static
  26766. * @memberOf _
  26767. * @since 2.4.0
  26768. * @category Util
  26769. * @param {Array|string} path The path of the property to get.
  26770. * @returns {Function} Returns the new accessor function.
  26771. * @example
  26772. *
  26773. * var objects = [
  26774. * { 'a': { 'b': 2 } },
  26775. * { 'a': { 'b': 1 } }
  26776. * ];
  26777. *
  26778. * _.map(objects, _.property('a.b'));
  26779. * // => [2, 1]
  26780. *
  26781. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  26782. * // => [1, 2]
  26783. */
  26784. function property(path) {
  26785. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  26786. }
  26787. /**
  26788. * The opposite of `_.property`; this method creates a function that returns
  26789. * the value at a given path of `object`.
  26790. *
  26791. * @static
  26792. * @memberOf _
  26793. * @since 3.0.0
  26794. * @category Util
  26795. * @param {Object} object The object to query.
  26796. * @returns {Function} Returns the new accessor function.
  26797. * @example
  26798. *
  26799. * var array = [0, 1, 2],
  26800. * object = { 'a': array, 'b': array, 'c': array };
  26801. *
  26802. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  26803. * // => [2, 0]
  26804. *
  26805. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  26806. * // => [2, 0]
  26807. */
  26808. function propertyOf(object) {
  26809. return function(path) {
  26810. return object == null ? undefined : baseGet(object, path);
  26811. };
  26812. }
  26813. /**
  26814. * Creates an array of numbers (positive and/or negative) progressing from
  26815. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  26816. * `start` is specified without an `end` or `step`. If `end` is not specified,
  26817. * it's set to `start` with `start` then set to `0`.
  26818. *
  26819. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  26820. * floating-point values which can produce unexpected results.
  26821. *
  26822. * @static
  26823. * @since 0.1.0
  26824. * @memberOf _
  26825. * @category Util
  26826. * @param {number} [start=0] The start of the range.
  26827. * @param {number} end The end of the range.
  26828. * @param {number} [step=1] The value to increment or decrement by.
  26829. * @returns {Array} Returns the range of numbers.
  26830. * @see _.inRange, _.rangeRight
  26831. * @example
  26832. *
  26833. * _.range(4);
  26834. * // => [0, 1, 2, 3]
  26835. *
  26836. * _.range(-4);
  26837. * // => [0, -1, -2, -3]
  26838. *
  26839. * _.range(1, 5);
  26840. * // => [1, 2, 3, 4]
  26841. *
  26842. * _.range(0, 20, 5);
  26843. * // => [0, 5, 10, 15]
  26844. *
  26845. * _.range(0, -4, -1);
  26846. * // => [0, -1, -2, -3]
  26847. *
  26848. * _.range(1, 4, 0);
  26849. * // => [1, 1, 1]
  26850. *
  26851. * _.range(0);
  26852. * // => []
  26853. */
  26854. var range = createRange();
  26855. /**
  26856. * This method is like `_.range` except that it populates values in
  26857. * descending order.
  26858. *
  26859. * @static
  26860. * @memberOf _
  26861. * @since 4.0.0
  26862. * @category Util
  26863. * @param {number} [start=0] The start of the range.
  26864. * @param {number} end The end of the range.
  26865. * @param {number} [step=1] The value to increment or decrement by.
  26866. * @returns {Array} Returns the range of numbers.
  26867. * @see _.inRange, _.range
  26868. * @example
  26869. *
  26870. * _.rangeRight(4);
  26871. * // => [3, 2, 1, 0]
  26872. *
  26873. * _.rangeRight(-4);
  26874. * // => [-3, -2, -1, 0]
  26875. *
  26876. * _.rangeRight(1, 5);
  26877. * // => [4, 3, 2, 1]
  26878. *
  26879. * _.rangeRight(0, 20, 5);
  26880. * // => [15, 10, 5, 0]
  26881. *
  26882. * _.rangeRight(0, -4, -1);
  26883. * // => [-3, -2, -1, 0]
  26884. *
  26885. * _.rangeRight(1, 4, 0);
  26886. * // => [1, 1, 1]
  26887. *
  26888. * _.rangeRight(0);
  26889. * // => []
  26890. */
  26891. var rangeRight = createRange(true);
  26892. /**
  26893. * This method returns a new empty array.
  26894. *
  26895. * @static
  26896. * @memberOf _
  26897. * @since 4.13.0
  26898. * @category Util
  26899. * @returns {Array} Returns the new empty array.
  26900. * @example
  26901. *
  26902. * var arrays = _.times(2, _.stubArray);
  26903. *
  26904. * console.log(arrays);
  26905. * // => [[], []]
  26906. *
  26907. * console.log(arrays[0] === arrays[1]);
  26908. * // => false
  26909. */
  26910. function stubArray() {
  26911. return [];
  26912. }
  26913. /**
  26914. * This method returns `false`.
  26915. *
  26916. * @static
  26917. * @memberOf _
  26918. * @since 4.13.0
  26919. * @category Util
  26920. * @returns {boolean} Returns `false`.
  26921. * @example
  26922. *
  26923. * _.times(2, _.stubFalse);
  26924. * // => [false, false]
  26925. */
  26926. function stubFalse() {
  26927. return false;
  26928. }
  26929. /**
  26930. * This method returns a new empty object.
  26931. *
  26932. * @static
  26933. * @memberOf _
  26934. * @since 4.13.0
  26935. * @category Util
  26936. * @returns {Object} Returns the new empty object.
  26937. * @example
  26938. *
  26939. * var objects = _.times(2, _.stubObject);
  26940. *
  26941. * console.log(objects);
  26942. * // => [{}, {}]
  26943. *
  26944. * console.log(objects[0] === objects[1]);
  26945. * // => false
  26946. */
  26947. function stubObject() {
  26948. return {};
  26949. }
  26950. /**
  26951. * This method returns an empty string.
  26952. *
  26953. * @static
  26954. * @memberOf _
  26955. * @since 4.13.0
  26956. * @category Util
  26957. * @returns {string} Returns the empty string.
  26958. * @example
  26959. *
  26960. * _.times(2, _.stubString);
  26961. * // => ['', '']
  26962. */
  26963. function stubString() {
  26964. return '';
  26965. }
  26966. /**
  26967. * This method returns `true`.
  26968. *
  26969. * @static
  26970. * @memberOf _
  26971. * @since 4.13.0
  26972. * @category Util
  26973. * @returns {boolean} Returns `true`.
  26974. * @example
  26975. *
  26976. * _.times(2, _.stubTrue);
  26977. * // => [true, true]
  26978. */
  26979. function stubTrue() {
  26980. return true;
  26981. }
  26982. /**
  26983. * Invokes the iteratee `n` times, returning an array of the results of
  26984. * each invocation. The iteratee is invoked with one argument; (index).
  26985. *
  26986. * @static
  26987. * @since 0.1.0
  26988. * @memberOf _
  26989. * @category Util
  26990. * @param {number} n The number of times to invoke `iteratee`.
  26991. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26992. * @returns {Array} Returns the array of results.
  26993. * @example
  26994. *
  26995. * _.times(3, String);
  26996. * // => ['0', '1', '2']
  26997. *
  26998. * _.times(4, _.constant(0));
  26999. * // => [0, 0, 0, 0]
  27000. */
  27001. function times(n, iteratee) {
  27002. n = toInteger(n);
  27003. if (n < 1 || n > MAX_SAFE_INTEGER) {
  27004. return [];
  27005. }
  27006. var index = MAX_ARRAY_LENGTH,
  27007. length = nativeMin(n, MAX_ARRAY_LENGTH);
  27008. iteratee = getIteratee(iteratee);
  27009. n -= MAX_ARRAY_LENGTH;
  27010. var result = baseTimes(length, iteratee);
  27011. while (++index < n) {
  27012. iteratee(index);
  27013. }
  27014. return result;
  27015. }
  27016. /**
  27017. * Converts `value` to a property path array.
  27018. *
  27019. * @static
  27020. * @memberOf _
  27021. * @since 4.0.0
  27022. * @category Util
  27023. * @param {*} value The value to convert.
  27024. * @returns {Array} Returns the new property path array.
  27025. * @example
  27026. *
  27027. * _.toPath('a.b.c');
  27028. * // => ['a', 'b', 'c']
  27029. *
  27030. * _.toPath('a[0].b.c');
  27031. * // => ['a', '0', 'b', 'c']
  27032. */
  27033. function toPath(value) {
  27034. if (isArray(value)) {
  27035. return arrayMap(value, toKey);
  27036. }
  27037. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  27038. }
  27039. /**
  27040. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  27041. *
  27042. * @static
  27043. * @since 0.1.0
  27044. * @memberOf _
  27045. * @category Util
  27046. * @param {string} [prefix=''] The value to prefix the ID with.
  27047. * @returns {string} Returns the unique ID.
  27048. * @example
  27049. *
  27050. * _.uniqueId('contact_');
  27051. * // => 'contact_104'
  27052. *
  27053. * _.uniqueId();
  27054. * // => '105'
  27055. */
  27056. function uniqueId(prefix) {
  27057. var id = ++idCounter;
  27058. return toString(prefix) + id;
  27059. }
  27060. /*------------------------------------------------------------------------*/
  27061. /**
  27062. * Adds two numbers.
  27063. *
  27064. * @static
  27065. * @memberOf _
  27066. * @since 3.4.0
  27067. * @category Math
  27068. * @param {number} augend The first number in an addition.
  27069. * @param {number} addend The second number in an addition.
  27070. * @returns {number} Returns the total.
  27071. * @example
  27072. *
  27073. * _.add(6, 4);
  27074. * // => 10
  27075. */
  27076. var add = createMathOperation(function(augend, addend) {
  27077. return augend + addend;
  27078. }, 0);
  27079. /**
  27080. * Computes `number` rounded up to `precision`.
  27081. *
  27082. * @static
  27083. * @memberOf _
  27084. * @since 3.10.0
  27085. * @category Math
  27086. * @param {number} number The number to round up.
  27087. * @param {number} [precision=0] The precision to round up to.
  27088. * @returns {number} Returns the rounded up number.
  27089. * @example
  27090. *
  27091. * _.ceil(4.006);
  27092. * // => 5
  27093. *
  27094. * _.ceil(6.004, 2);
  27095. * // => 6.01
  27096. *
  27097. * _.ceil(6040, -2);
  27098. * // => 6100
  27099. */
  27100. var ceil = createRound('ceil');
  27101. /**
  27102. * Divide two numbers.
  27103. *
  27104. * @static
  27105. * @memberOf _
  27106. * @since 4.7.0
  27107. * @category Math
  27108. * @param {number} dividend The first number in a division.
  27109. * @param {number} divisor The second number in a division.
  27110. * @returns {number} Returns the quotient.
  27111. * @example
  27112. *
  27113. * _.divide(6, 4);
  27114. * // => 1.5
  27115. */
  27116. var divide = createMathOperation(function(dividend, divisor) {
  27117. return dividend / divisor;
  27118. }, 1);
  27119. /**
  27120. * Computes `number` rounded down to `precision`.
  27121. *
  27122. * @static
  27123. * @memberOf _
  27124. * @since 3.10.0
  27125. * @category Math
  27126. * @param {number} number The number to round down.
  27127. * @param {number} [precision=0] The precision to round down to.
  27128. * @returns {number} Returns the rounded down number.
  27129. * @example
  27130. *
  27131. * _.floor(4.006);
  27132. * // => 4
  27133. *
  27134. * _.floor(0.046, 2);
  27135. * // => 0.04
  27136. *
  27137. * _.floor(4060, -2);
  27138. * // => 4000
  27139. */
  27140. var floor = createRound('floor');
  27141. /**
  27142. * Computes the maximum value of `array`. If `array` is empty or falsey,
  27143. * `undefined` is returned.
  27144. *
  27145. * @static
  27146. * @since 0.1.0
  27147. * @memberOf _
  27148. * @category Math
  27149. * @param {Array} array The array to iterate over.
  27150. * @returns {*} Returns the maximum value.
  27151. * @example
  27152. *
  27153. * _.max([4, 2, 8, 6]);
  27154. * // => 8
  27155. *
  27156. * _.max([]);
  27157. * // => undefined
  27158. */
  27159. function max(array) {
  27160. return (array && array.length)
  27161. ? baseExtremum(array, identity, baseGt)
  27162. : undefined;
  27163. }
  27164. /**
  27165. * This method is like `_.max` except that it accepts `iteratee` which is
  27166. * invoked for each element in `array` to generate the criterion by which
  27167. * the value is ranked. The iteratee is invoked with one argument: (value).
  27168. *
  27169. * @static
  27170. * @memberOf _
  27171. * @since 4.0.0
  27172. * @category Math
  27173. * @param {Array} array The array to iterate over.
  27174. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27175. * @returns {*} Returns the maximum value.
  27176. * @example
  27177. *
  27178. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  27179. *
  27180. * _.maxBy(objects, function(o) { return o.n; });
  27181. * // => { 'n': 2 }
  27182. *
  27183. * // The `_.property` iteratee shorthand.
  27184. * _.maxBy(objects, 'n');
  27185. * // => { 'n': 2 }
  27186. */
  27187. function maxBy(array, iteratee) {
  27188. return (array && array.length)
  27189. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  27190. : undefined;
  27191. }
  27192. /**
  27193. * Computes the mean of the values in `array`.
  27194. *
  27195. * @static
  27196. * @memberOf _
  27197. * @since 4.0.0
  27198. * @category Math
  27199. * @param {Array} array The array to iterate over.
  27200. * @returns {number} Returns the mean.
  27201. * @example
  27202. *
  27203. * _.mean([4, 2, 8, 6]);
  27204. * // => 5
  27205. */
  27206. function mean(array) {
  27207. return baseMean(array, identity);
  27208. }
  27209. /**
  27210. * This method is like `_.mean` except that it accepts `iteratee` which is
  27211. * invoked for each element in `array` to generate the value to be averaged.
  27212. * The iteratee is invoked with one argument: (value).
  27213. *
  27214. * @static
  27215. * @memberOf _
  27216. * @since 4.7.0
  27217. * @category Math
  27218. * @param {Array} array The array to iterate over.
  27219. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27220. * @returns {number} Returns the mean.
  27221. * @example
  27222. *
  27223. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  27224. *
  27225. * _.meanBy(objects, function(o) { return o.n; });
  27226. * // => 5
  27227. *
  27228. * // The `_.property` iteratee shorthand.
  27229. * _.meanBy(objects, 'n');
  27230. * // => 5
  27231. */
  27232. function meanBy(array, iteratee) {
  27233. return baseMean(array, getIteratee(iteratee, 2));
  27234. }
  27235. /**
  27236. * Computes the minimum value of `array`. If `array` is empty or falsey,
  27237. * `undefined` is returned.
  27238. *
  27239. * @static
  27240. * @since 0.1.0
  27241. * @memberOf _
  27242. * @category Math
  27243. * @param {Array} array The array to iterate over.
  27244. * @returns {*} Returns the minimum value.
  27245. * @example
  27246. *
  27247. * _.min([4, 2, 8, 6]);
  27248. * // => 2
  27249. *
  27250. * _.min([]);
  27251. * // => undefined
  27252. */
  27253. function min(array) {
  27254. return (array && array.length)
  27255. ? baseExtremum(array, identity, baseLt)
  27256. : undefined;
  27257. }
  27258. /**
  27259. * This method is like `_.min` except that it accepts `iteratee` which is
  27260. * invoked for each element in `array` to generate the criterion by which
  27261. * the value is ranked. The iteratee is invoked with one argument: (value).
  27262. *
  27263. * @static
  27264. * @memberOf _
  27265. * @since 4.0.0
  27266. * @category Math
  27267. * @param {Array} array The array to iterate over.
  27268. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27269. * @returns {*} Returns the minimum value.
  27270. * @example
  27271. *
  27272. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  27273. *
  27274. * _.minBy(objects, function(o) { return o.n; });
  27275. * // => { 'n': 1 }
  27276. *
  27277. * // The `_.property` iteratee shorthand.
  27278. * _.minBy(objects, 'n');
  27279. * // => { 'n': 1 }
  27280. */
  27281. function minBy(array, iteratee) {
  27282. return (array && array.length)
  27283. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  27284. : undefined;
  27285. }
  27286. /**
  27287. * Multiply two numbers.
  27288. *
  27289. * @static
  27290. * @memberOf _
  27291. * @since 4.7.0
  27292. * @category Math
  27293. * @param {number} multiplier The first number in a multiplication.
  27294. * @param {number} multiplicand The second number in a multiplication.
  27295. * @returns {number} Returns the product.
  27296. * @example
  27297. *
  27298. * _.multiply(6, 4);
  27299. * // => 24
  27300. */
  27301. var multiply = createMathOperation(function(multiplier, multiplicand) {
  27302. return multiplier * multiplicand;
  27303. }, 1);
  27304. /**
  27305. * Computes `number` rounded to `precision`.
  27306. *
  27307. * @static
  27308. * @memberOf _
  27309. * @since 3.10.0
  27310. * @category Math
  27311. * @param {number} number The number to round.
  27312. * @param {number} [precision=0] The precision to round to.
  27313. * @returns {number} Returns the rounded number.
  27314. * @example
  27315. *
  27316. * _.round(4.006);
  27317. * // => 4
  27318. *
  27319. * _.round(4.006, 2);
  27320. * // => 4.01
  27321. *
  27322. * _.round(4060, -2);
  27323. * // => 4100
  27324. */
  27325. var round = createRound('round');
  27326. /**
  27327. * Subtract two numbers.
  27328. *
  27329. * @static
  27330. * @memberOf _
  27331. * @since 4.0.0
  27332. * @category Math
  27333. * @param {number} minuend The first number in a subtraction.
  27334. * @param {number} subtrahend The second number in a subtraction.
  27335. * @returns {number} Returns the difference.
  27336. * @example
  27337. *
  27338. * _.subtract(6, 4);
  27339. * // => 2
  27340. */
  27341. var subtract = createMathOperation(function(minuend, subtrahend) {
  27342. return minuend - subtrahend;
  27343. }, 0);
  27344. /**
  27345. * Computes the sum of the values in `array`.
  27346. *
  27347. * @static
  27348. * @memberOf _
  27349. * @since 3.4.0
  27350. * @category Math
  27351. * @param {Array} array The array to iterate over.
  27352. * @returns {number} Returns the sum.
  27353. * @example
  27354. *
  27355. * _.sum([4, 2, 8, 6]);
  27356. * // => 20
  27357. */
  27358. function sum(array) {
  27359. return (array && array.length)
  27360. ? baseSum(array, identity)
  27361. : 0;
  27362. }
  27363. /**
  27364. * This method is like `_.sum` except that it accepts `iteratee` which is
  27365. * invoked for each element in `array` to generate the value to be summed.
  27366. * The iteratee is invoked with one argument: (value).
  27367. *
  27368. * @static
  27369. * @memberOf _
  27370. * @since 4.0.0
  27371. * @category Math
  27372. * @param {Array} array The array to iterate over.
  27373. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27374. * @returns {number} Returns the sum.
  27375. * @example
  27376. *
  27377. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  27378. *
  27379. * _.sumBy(objects, function(o) { return o.n; });
  27380. * // => 20
  27381. *
  27382. * // The `_.property` iteratee shorthand.
  27383. * _.sumBy(objects, 'n');
  27384. * // => 20
  27385. */
  27386. function sumBy(array, iteratee) {
  27387. return (array && array.length)
  27388. ? baseSum(array, getIteratee(iteratee, 2))
  27389. : 0;
  27390. }
  27391. /*------------------------------------------------------------------------*/
  27392. // Add methods that return wrapped values in chain sequences.
  27393. lodash.after = after;
  27394. lodash.ary = ary;
  27395. lodash.assign = assign;
  27396. lodash.assignIn = assignIn;
  27397. lodash.assignInWith = assignInWith;
  27398. lodash.assignWith = assignWith;
  27399. lodash.at = at;
  27400. lodash.before = before;
  27401. lodash.bind = bind;
  27402. lodash.bindAll = bindAll;
  27403. lodash.bindKey = bindKey;
  27404. lodash.castArray = castArray;
  27405. lodash.chain = chain;
  27406. lodash.chunk = chunk;
  27407. lodash.compact = compact;
  27408. lodash.concat = concat;
  27409. lodash.cond = cond;
  27410. lodash.conforms = conforms;
  27411. lodash.constant = constant;
  27412. lodash.countBy = countBy;
  27413. lodash.create = create;
  27414. lodash.curry = curry;
  27415. lodash.curryRight = curryRight;
  27416. lodash.debounce = debounce;
  27417. lodash.defaults = defaults;
  27418. lodash.defaultsDeep = defaultsDeep;
  27419. lodash.defer = defer;
  27420. lodash.delay = delay;
  27421. lodash.difference = difference;
  27422. lodash.differenceBy = differenceBy;
  27423. lodash.differenceWith = differenceWith;
  27424. lodash.drop = drop;
  27425. lodash.dropRight = dropRight;
  27426. lodash.dropRightWhile = dropRightWhile;
  27427. lodash.dropWhile = dropWhile;
  27428. lodash.fill = fill;
  27429. lodash.filter = filter;
  27430. lodash.flatMap = flatMap;
  27431. lodash.flatMapDeep = flatMapDeep;
  27432. lodash.flatMapDepth = flatMapDepth;
  27433. lodash.flatten = flatten;
  27434. lodash.flattenDeep = flattenDeep;
  27435. lodash.flattenDepth = flattenDepth;
  27436. lodash.flip = flip;
  27437. lodash.flow = flow;
  27438. lodash.flowRight = flowRight;
  27439. lodash.fromPairs = fromPairs;
  27440. lodash.functions = functions;
  27441. lodash.functionsIn = functionsIn;
  27442. lodash.groupBy = groupBy;
  27443. lodash.initial = initial;
  27444. lodash.intersection = intersection;
  27445. lodash.intersectionBy = intersectionBy;
  27446. lodash.intersectionWith = intersectionWith;
  27447. lodash.invert = invert;
  27448. lodash.invertBy = invertBy;
  27449. lodash.invokeMap = invokeMap;
  27450. lodash.iteratee = iteratee;
  27451. lodash.keyBy = keyBy;
  27452. lodash.keys = keys;
  27453. lodash.keysIn = keysIn;
  27454. lodash.map = map;
  27455. lodash.mapKeys = mapKeys;
  27456. lodash.mapValues = mapValues;
  27457. lodash.matches = matches;
  27458. lodash.matchesProperty = matchesProperty;
  27459. lodash.memoize = memoize;
  27460. lodash.merge = merge;
  27461. lodash.mergeWith = mergeWith;
  27462. lodash.method = method;
  27463. lodash.methodOf = methodOf;
  27464. lodash.mixin = mixin;
  27465. lodash.negate = negate;
  27466. lodash.nthArg = nthArg;
  27467. lodash.omit = omit;
  27468. lodash.omitBy = omitBy;
  27469. lodash.once = once;
  27470. lodash.orderBy = orderBy;
  27471. lodash.over = over;
  27472. lodash.overArgs = overArgs;
  27473. lodash.overEvery = overEvery;
  27474. lodash.overSome = overSome;
  27475. lodash.partial = partial;
  27476. lodash.partialRight = partialRight;
  27477. lodash.partition = partition;
  27478. lodash.pick = pick;
  27479. lodash.pickBy = pickBy;
  27480. lodash.property = property;
  27481. lodash.propertyOf = propertyOf;
  27482. lodash.pull = pull;
  27483. lodash.pullAll = pullAll;
  27484. lodash.pullAllBy = pullAllBy;
  27485. lodash.pullAllWith = pullAllWith;
  27486. lodash.pullAt = pullAt;
  27487. lodash.range = range;
  27488. lodash.rangeRight = rangeRight;
  27489. lodash.rearg = rearg;
  27490. lodash.reject = reject;
  27491. lodash.remove = remove;
  27492. lodash.rest = rest;
  27493. lodash.reverse = reverse;
  27494. lodash.sampleSize = sampleSize;
  27495. lodash.set = set;
  27496. lodash.setWith = setWith;
  27497. lodash.shuffle = shuffle;
  27498. lodash.slice = slice;
  27499. lodash.sortBy = sortBy;
  27500. lodash.sortedUniq = sortedUniq;
  27501. lodash.sortedUniqBy = sortedUniqBy;
  27502. lodash.split = split;
  27503. lodash.spread = spread;
  27504. lodash.tail = tail;
  27505. lodash.take = take;
  27506. lodash.takeRight = takeRight;
  27507. lodash.takeRightWhile = takeRightWhile;
  27508. lodash.takeWhile = takeWhile;
  27509. lodash.tap = tap;
  27510. lodash.throttle = throttle;
  27511. lodash.thru = thru;
  27512. lodash.toArray = toArray;
  27513. lodash.toPairs = toPairs;
  27514. lodash.toPairsIn = toPairsIn;
  27515. lodash.toPath = toPath;
  27516. lodash.toPlainObject = toPlainObject;
  27517. lodash.transform = transform;
  27518. lodash.unary = unary;
  27519. lodash.union = union;
  27520. lodash.unionBy = unionBy;
  27521. lodash.unionWith = unionWith;
  27522. lodash.uniq = uniq;
  27523. lodash.uniqBy = uniqBy;
  27524. lodash.uniqWith = uniqWith;
  27525. lodash.unset = unset;
  27526. lodash.unzip = unzip;
  27527. lodash.unzipWith = unzipWith;
  27528. lodash.update = update;
  27529. lodash.updateWith = updateWith;
  27530. lodash.values = values;
  27531. lodash.valuesIn = valuesIn;
  27532. lodash.without = without;
  27533. lodash.words = words;
  27534. lodash.wrap = wrap;
  27535. lodash.xor = xor;
  27536. lodash.xorBy = xorBy;
  27537. lodash.xorWith = xorWith;
  27538. lodash.zip = zip;
  27539. lodash.zipObject = zipObject;
  27540. lodash.zipObjectDeep = zipObjectDeep;
  27541. lodash.zipWith = zipWith;
  27542. // Add aliases.
  27543. lodash.entries = toPairs;
  27544. lodash.entriesIn = toPairsIn;
  27545. lodash.extend = assignIn;
  27546. lodash.extendWith = assignInWith;
  27547. // Add methods to `lodash.prototype`.
  27548. mixin(lodash, lodash);
  27549. /*------------------------------------------------------------------------*/
  27550. // Add methods that return unwrapped values in chain sequences.
  27551. lodash.add = add;
  27552. lodash.attempt = attempt;
  27553. lodash.camelCase = camelCase;
  27554. lodash.capitalize = capitalize;
  27555. lodash.ceil = ceil;
  27556. lodash.clamp = clamp;
  27557. lodash.clone = clone;
  27558. lodash.cloneDeep = cloneDeep;
  27559. lodash.cloneDeepWith = cloneDeepWith;
  27560. lodash.cloneWith = cloneWith;
  27561. lodash.conformsTo = conformsTo;
  27562. lodash.deburr = deburr;
  27563. lodash.defaultTo = defaultTo;
  27564. lodash.divide = divide;
  27565. lodash.endsWith = endsWith;
  27566. lodash.eq = eq;
  27567. lodash.escape = escape;
  27568. lodash.escapeRegExp = escapeRegExp;
  27569. lodash.every = every;
  27570. lodash.find = find;
  27571. lodash.findIndex = findIndex;
  27572. lodash.findKey = findKey;
  27573. lodash.findLast = findLast;
  27574. lodash.findLastIndex = findLastIndex;
  27575. lodash.findLastKey = findLastKey;
  27576. lodash.floor = floor;
  27577. lodash.forEach = forEach;
  27578. lodash.forEachRight = forEachRight;
  27579. lodash.forIn = forIn;
  27580. lodash.forInRight = forInRight;
  27581. lodash.forOwn = forOwn;
  27582. lodash.forOwnRight = forOwnRight;
  27583. lodash.get = get;
  27584. lodash.gt = gt;
  27585. lodash.gte = gte;
  27586. lodash.has = has;
  27587. lodash.hasIn = hasIn;
  27588. lodash.head = head;
  27589. lodash.identity = identity;
  27590. lodash.includes = includes;
  27591. lodash.indexOf = indexOf;
  27592. lodash.inRange = inRange;
  27593. lodash.invoke = invoke;
  27594. lodash.isArguments = isArguments;
  27595. lodash.isArray = isArray;
  27596. lodash.isArrayBuffer = isArrayBuffer;
  27597. lodash.isArrayLike = isArrayLike;
  27598. lodash.isArrayLikeObject = isArrayLikeObject;
  27599. lodash.isBoolean = isBoolean;
  27600. lodash.isBuffer = isBuffer;
  27601. lodash.isDate = isDate;
  27602. lodash.isElement = isElement;
  27603. lodash.isEmpty = isEmpty;
  27604. lodash.isEqual = isEqual;
  27605. lodash.isEqualWith = isEqualWith;
  27606. lodash.isError = isError;
  27607. lodash.isFinite = isFinite;
  27608. lodash.isFunction = isFunction;
  27609. lodash.isInteger = isInteger;
  27610. lodash.isLength = isLength;
  27611. lodash.isMap = isMap;
  27612. lodash.isMatch = isMatch;
  27613. lodash.isMatchWith = isMatchWith;
  27614. lodash.isNaN = isNaN;
  27615. lodash.isNative = isNative;
  27616. lodash.isNil = isNil;
  27617. lodash.isNull = isNull;
  27618. lodash.isNumber = isNumber;
  27619. lodash.isObject = isObject;
  27620. lodash.isObjectLike = isObjectLike;
  27621. lodash.isPlainObject = isPlainObject;
  27622. lodash.isRegExp = isRegExp;
  27623. lodash.isSafeInteger = isSafeInteger;
  27624. lodash.isSet = isSet;
  27625. lodash.isString = isString;
  27626. lodash.isSymbol = isSymbol;
  27627. lodash.isTypedArray = isTypedArray;
  27628. lodash.isUndefined = isUndefined;
  27629. lodash.isWeakMap = isWeakMap;
  27630. lodash.isWeakSet = isWeakSet;
  27631. lodash.join = join;
  27632. lodash.kebabCase = kebabCase;
  27633. lodash.last = last;
  27634. lodash.lastIndexOf = lastIndexOf;
  27635. lodash.lowerCase = lowerCase;
  27636. lodash.lowerFirst = lowerFirst;
  27637. lodash.lt = lt;
  27638. lodash.lte = lte;
  27639. lodash.max = max;
  27640. lodash.maxBy = maxBy;
  27641. lodash.mean = mean;
  27642. lodash.meanBy = meanBy;
  27643. lodash.min = min;
  27644. lodash.minBy = minBy;
  27645. lodash.stubArray = stubArray;
  27646. lodash.stubFalse = stubFalse;
  27647. lodash.stubObject = stubObject;
  27648. lodash.stubString = stubString;
  27649. lodash.stubTrue = stubTrue;
  27650. lodash.multiply = multiply;
  27651. lodash.nth = nth;
  27652. lodash.noConflict = noConflict;
  27653. lodash.noop = noop;
  27654. lodash.now = now;
  27655. lodash.pad = pad;
  27656. lodash.padEnd = padEnd;
  27657. lodash.padStart = padStart;
  27658. lodash.parseInt = parseInt;
  27659. lodash.random = random;
  27660. lodash.reduce = reduce;
  27661. lodash.reduceRight = reduceRight;
  27662. lodash.repeat = repeat;
  27663. lodash.replace = replace;
  27664. lodash.result = result;
  27665. lodash.round = round;
  27666. lodash.runInContext = runInContext;
  27667. lodash.sample = sample;
  27668. lodash.size = size;
  27669. lodash.snakeCase = snakeCase;
  27670. lodash.some = some;
  27671. lodash.sortedIndex = sortedIndex;
  27672. lodash.sortedIndexBy = sortedIndexBy;
  27673. lodash.sortedIndexOf = sortedIndexOf;
  27674. lodash.sortedLastIndex = sortedLastIndex;
  27675. lodash.sortedLastIndexBy = sortedLastIndexBy;
  27676. lodash.sortedLastIndexOf = sortedLastIndexOf;
  27677. lodash.startCase = startCase;
  27678. lodash.startsWith = startsWith;
  27679. lodash.subtract = subtract;
  27680. lodash.sum = sum;
  27681. lodash.sumBy = sumBy;
  27682. lodash.template = template;
  27683. lodash.times = times;
  27684. lodash.toFinite = toFinite;
  27685. lodash.toInteger = toInteger;
  27686. lodash.toLength = toLength;
  27687. lodash.toLower = toLower;
  27688. lodash.toNumber = toNumber;
  27689. lodash.toSafeInteger = toSafeInteger;
  27690. lodash.toString = toString;
  27691. lodash.toUpper = toUpper;
  27692. lodash.trim = trim;
  27693. lodash.trimEnd = trimEnd;
  27694. lodash.trimStart = trimStart;
  27695. lodash.truncate = truncate;
  27696. lodash.unescape = unescape;
  27697. lodash.uniqueId = uniqueId;
  27698. lodash.upperCase = upperCase;
  27699. lodash.upperFirst = upperFirst;
  27700. // Add aliases.
  27701. lodash.each = forEach;
  27702. lodash.eachRight = forEachRight;
  27703. lodash.first = head;
  27704. mixin(lodash, (function() {
  27705. var source = {};
  27706. baseForOwn(lodash, function(func, methodName) {
  27707. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  27708. source[methodName] = func;
  27709. }
  27710. });
  27711. return source;
  27712. }()), { 'chain': false });
  27713. /*------------------------------------------------------------------------*/
  27714. /**
  27715. * The semantic version number.
  27716. *
  27717. * @static
  27718. * @memberOf _
  27719. * @type {string}
  27720. */
  27721. lodash.VERSION = VERSION;
  27722. // Assign default placeholders.
  27723. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  27724. lodash[methodName].placeholder = lodash;
  27725. });
  27726. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  27727. arrayEach(['drop', 'take'], function(methodName, index) {
  27728. LazyWrapper.prototype[methodName] = function(n) {
  27729. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  27730. var result = (this.__filtered__ && !index)
  27731. ? new LazyWrapper(this)
  27732. : this.clone();
  27733. if (result.__filtered__) {
  27734. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  27735. } else {
  27736. result.__views__.push({
  27737. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  27738. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  27739. });
  27740. }
  27741. return result;
  27742. };
  27743. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  27744. return this.reverse()[methodName](n).reverse();
  27745. };
  27746. });
  27747. // Add `LazyWrapper` methods that accept an `iteratee` value.
  27748. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  27749. var type = index + 1,
  27750. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  27751. LazyWrapper.prototype[methodName] = function(iteratee) {
  27752. var result = this.clone();
  27753. result.__iteratees__.push({
  27754. 'iteratee': getIteratee(iteratee, 3),
  27755. 'type': type
  27756. });
  27757. result.__filtered__ = result.__filtered__ || isFilter;
  27758. return result;
  27759. };
  27760. });
  27761. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  27762. arrayEach(['head', 'last'], function(methodName, index) {
  27763. var takeName = 'take' + (index ? 'Right' : '');
  27764. LazyWrapper.prototype[methodName] = function() {
  27765. return this[takeName](1).value()[0];
  27766. };
  27767. });
  27768. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  27769. arrayEach(['initial', 'tail'], function(methodName, index) {
  27770. var dropName = 'drop' + (index ? '' : 'Right');
  27771. LazyWrapper.prototype[methodName] = function() {
  27772. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  27773. };
  27774. });
  27775. LazyWrapper.prototype.compact = function() {
  27776. return this.filter(identity);
  27777. };
  27778. LazyWrapper.prototype.find = function(predicate) {
  27779. return this.filter(predicate).head();
  27780. };
  27781. LazyWrapper.prototype.findLast = function(predicate) {
  27782. return this.reverse().find(predicate);
  27783. };
  27784. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  27785. if (typeof path == 'function') {
  27786. return new LazyWrapper(this);
  27787. }
  27788. return this.map(function(value) {
  27789. return baseInvoke(value, path, args);
  27790. });
  27791. });
  27792. LazyWrapper.prototype.reject = function(predicate) {
  27793. return this.filter(negate(getIteratee(predicate)));
  27794. };
  27795. LazyWrapper.prototype.slice = function(start, end) {
  27796. start = toInteger(start);
  27797. var result = this;
  27798. if (result.__filtered__ && (start > 0 || end < 0)) {
  27799. return new LazyWrapper(result);
  27800. }
  27801. if (start < 0) {
  27802. result = result.takeRight(-start);
  27803. } else if (start) {
  27804. result = result.drop(start);
  27805. }
  27806. if (end !== undefined) {
  27807. end = toInteger(end);
  27808. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  27809. }
  27810. return result;
  27811. };
  27812. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  27813. return this.reverse().takeWhile(predicate).reverse();
  27814. };
  27815. LazyWrapper.prototype.toArray = function() {
  27816. return this.take(MAX_ARRAY_LENGTH);
  27817. };
  27818. // Add `LazyWrapper` methods to `lodash.prototype`.
  27819. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  27820. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  27821. isTaker = /^(?:head|last)$/.test(methodName),
  27822. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  27823. retUnwrapped = isTaker || /^find/.test(methodName);
  27824. if (!lodashFunc) {
  27825. return;
  27826. }
  27827. lodash.prototype[methodName] = function() {
  27828. var value = this.__wrapped__,
  27829. args = isTaker ? [1] : arguments,
  27830. isLazy = value instanceof LazyWrapper,
  27831. iteratee = args[0],
  27832. useLazy = isLazy || isArray(value);
  27833. var interceptor = function(value) {
  27834. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  27835. return (isTaker && chainAll) ? result[0] : result;
  27836. };
  27837. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  27838. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  27839. isLazy = useLazy = false;
  27840. }
  27841. var chainAll = this.__chain__,
  27842. isHybrid = !!this.__actions__.length,
  27843. isUnwrapped = retUnwrapped && !chainAll,
  27844. onlyLazy = isLazy && !isHybrid;
  27845. if (!retUnwrapped && useLazy) {
  27846. value = onlyLazy ? value : new LazyWrapper(this);
  27847. var result = func.apply(value, args);
  27848. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  27849. return new LodashWrapper(result, chainAll);
  27850. }
  27851. if (isUnwrapped && onlyLazy) {
  27852. return func.apply(this, args);
  27853. }
  27854. result = this.thru(interceptor);
  27855. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  27856. };
  27857. });
  27858. // Add `Array` methods to `lodash.prototype`.
  27859. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  27860. var func = arrayProto[methodName],
  27861. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  27862. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  27863. lodash.prototype[methodName] = function() {
  27864. var args = arguments;
  27865. if (retUnwrapped && !this.__chain__) {
  27866. var value = this.value();
  27867. return func.apply(isArray(value) ? value : [], args);
  27868. }
  27869. return this[chainName](function(value) {
  27870. return func.apply(isArray(value) ? value : [], args);
  27871. });
  27872. };
  27873. });
  27874. // Map minified method names to their real names.
  27875. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  27876. var lodashFunc = lodash[methodName];
  27877. if (lodashFunc) {
  27878. var key = (lodashFunc.name + ''),
  27879. names = realNames[key] || (realNames[key] = []);
  27880. names.push({ 'name': methodName, 'func': lodashFunc });
  27881. }
  27882. });
  27883. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  27884. 'name': 'wrapper',
  27885. 'func': undefined
  27886. }];
  27887. // Add methods to `LazyWrapper`.
  27888. LazyWrapper.prototype.clone = lazyClone;
  27889. LazyWrapper.prototype.reverse = lazyReverse;
  27890. LazyWrapper.prototype.value = lazyValue;
  27891. // Add chain sequence methods to the `lodash` wrapper.
  27892. lodash.prototype.at = wrapperAt;
  27893. lodash.prototype.chain = wrapperChain;
  27894. lodash.prototype.commit = wrapperCommit;
  27895. lodash.prototype.next = wrapperNext;
  27896. lodash.prototype.plant = wrapperPlant;
  27897. lodash.prototype.reverse = wrapperReverse;
  27898. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  27899. // Add lazy aliases.
  27900. lodash.prototype.first = lodash.prototype.head;
  27901. if (symIterator) {
  27902. lodash.prototype[symIterator] = wrapperToIterator;
  27903. }
  27904. return lodash;
  27905. });
  27906. /*--------------------------------------------------------------------------*/
  27907. // Export lodash.
  27908. var _ = runInContext();
  27909. // Some AMD build optimizers, like r.js, check for condition patterns like:
  27910. if (true) {
  27911. // Expose Lodash on the global object to prevent errors when Lodash is
  27912. // loaded by a script tag in the presence of an AMD loader.
  27913. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  27914. // Use `_.noConflict` to remove Lodash from the global object.
  27915. root._ = _;
  27916. // Define as an anonymous module so, through path mapping, it can be
  27917. // referenced as the "underscore" module.
  27918. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  27919. return _;
  27920. }).call(exports, __webpack_require__, exports, module),
  27921. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  27922. }
  27923. // Check for `exports` after `define` in case a build optimizer adds it.
  27924. else if (freeModule) {
  27925. // Export for Node.js.
  27926. (freeModule.exports = _)._ = _;
  27927. // Export for CommonJS support.
  27928. freeExports._ = _;
  27929. }
  27930. else {
  27931. // Export to the global object.
  27932. root._ = _;
  27933. }
  27934. }.call(this));
  27935. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(17)(module)))
  27936. /***/ }),
  27937. /* 17 */
  27938. /***/ (function(module, exports) {
  27939. module.exports = function(module) {
  27940. if(!module.webpackPolyfill) {
  27941. module.deprecate = function() {};
  27942. module.paths = [];
  27943. // module.parent = undefined by default
  27944. if(!module.children) module.children = [];
  27945. Object.defineProperty(module, "loaded", {
  27946. enumerable: true,
  27947. get: function() {
  27948. return module.l;
  27949. }
  27950. });
  27951. Object.defineProperty(module, "id", {
  27952. enumerable: true,
  27953. get: function() {
  27954. return module.i;
  27955. }
  27956. });
  27957. module.webpackPolyfill = 1;
  27958. }
  27959. return module;
  27960. };
  27961. /***/ }),
  27962. /* 18 */
  27963. /***/ (function(module, exports, __webpack_require__) {
  27964. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  27965. * jQuery JavaScript Library v3.3.1
  27966. * https://jquery.com/
  27967. *
  27968. * Includes Sizzle.js
  27969. * https://sizzlejs.com/
  27970. *
  27971. * Copyright JS Foundation and other contributors
  27972. * Released under the MIT license
  27973. * https://jquery.org/license
  27974. *
  27975. * Date: 2018-01-20T17:24Z
  27976. */
  27977. ( function( global, factory ) {
  27978. "use strict";
  27979. if ( typeof module === "object" && typeof module.exports === "object" ) {
  27980. // For CommonJS and CommonJS-like environments where a proper `window`
  27981. // is present, execute the factory and get jQuery.
  27982. // For environments that do not have a `window` with a `document`
  27983. // (such as Node.js), expose a factory as module.exports.
  27984. // This accentuates the need for the creation of a real `window`.
  27985. // e.g. var jQuery = require("jquery")(window);
  27986. // See ticket #14549 for more info.
  27987. module.exports = global.document ?
  27988. factory( global, true ) :
  27989. function( w ) {
  27990. if ( !w.document ) {
  27991. throw new Error( "jQuery requires a window with a document" );
  27992. }
  27993. return factory( w );
  27994. };
  27995. } else {
  27996. factory( global );
  27997. }
  27998. // Pass this if window is not defined yet
  27999. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  28000. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  28001. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  28002. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  28003. // enough that all such attempts are guarded in a try block.
  28004. "use strict";
  28005. var arr = [];
  28006. var document = window.document;
  28007. var getProto = Object.getPrototypeOf;
  28008. var slice = arr.slice;
  28009. var concat = arr.concat;
  28010. var push = arr.push;
  28011. var indexOf = arr.indexOf;
  28012. var class2type = {};
  28013. var toString = class2type.toString;
  28014. var hasOwn = class2type.hasOwnProperty;
  28015. var fnToString = hasOwn.toString;
  28016. var ObjectFunctionString = fnToString.call( Object );
  28017. var support = {};
  28018. var isFunction = function isFunction( obj ) {
  28019. // Support: Chrome <=57, Firefox <=52
  28020. // In some browsers, typeof returns "function" for HTML <object> elements
  28021. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  28022. // We don't want to classify *any* DOM node as a function.
  28023. return typeof obj === "function" && typeof obj.nodeType !== "number";
  28024. };
  28025. var isWindow = function isWindow( obj ) {
  28026. return obj != null && obj === obj.window;
  28027. };
  28028. var preservedScriptAttributes = {
  28029. type: true,
  28030. src: true,
  28031. noModule: true
  28032. };
  28033. function DOMEval( code, doc, node ) {
  28034. doc = doc || document;
  28035. var i,
  28036. script = doc.createElement( "script" );
  28037. script.text = code;
  28038. if ( node ) {
  28039. for ( i in preservedScriptAttributes ) {
  28040. if ( node[ i ] ) {
  28041. script[ i ] = node[ i ];
  28042. }
  28043. }
  28044. }
  28045. doc.head.appendChild( script ).parentNode.removeChild( script );
  28046. }
  28047. function toType( obj ) {
  28048. if ( obj == null ) {
  28049. return obj + "";
  28050. }
  28051. // Support: Android <=2.3 only (functionish RegExp)
  28052. return typeof obj === "object" || typeof obj === "function" ?
  28053. class2type[ toString.call( obj ) ] || "object" :
  28054. typeof obj;
  28055. }
  28056. /* global Symbol */
  28057. // Defining this global in .eslintrc.json would create a danger of using the global
  28058. // unguarded in another place, it seems safer to define global only for this module
  28059. var
  28060. version = "3.3.1",
  28061. // Define a local copy of jQuery
  28062. jQuery = function( selector, context ) {
  28063. // The jQuery object is actually just the init constructor 'enhanced'
  28064. // Need init if jQuery is called (just allow error to be thrown if not included)
  28065. return new jQuery.fn.init( selector, context );
  28066. },
  28067. // Support: Android <=4.0 only
  28068. // Make sure we trim BOM and NBSP
  28069. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  28070. jQuery.fn = jQuery.prototype = {
  28071. // The current version of jQuery being used
  28072. jquery: version,
  28073. constructor: jQuery,
  28074. // The default length of a jQuery object is 0
  28075. length: 0,
  28076. toArray: function() {
  28077. return slice.call( this );
  28078. },
  28079. // Get the Nth element in the matched element set OR
  28080. // Get the whole matched element set as a clean array
  28081. get: function( num ) {
  28082. // Return all the elements in a clean array
  28083. if ( num == null ) {
  28084. return slice.call( this );
  28085. }
  28086. // Return just the one element from the set
  28087. return num < 0 ? this[ num + this.length ] : this[ num ];
  28088. },
  28089. // Take an array of elements and push it onto the stack
  28090. // (returning the new matched element set)
  28091. pushStack: function( elems ) {
  28092. // Build a new jQuery matched element set
  28093. var ret = jQuery.merge( this.constructor(), elems );
  28094. // Add the old object onto the stack (as a reference)
  28095. ret.prevObject = this;
  28096. // Return the newly-formed element set
  28097. return ret;
  28098. },
  28099. // Execute a callback for every element in the matched set.
  28100. each: function( callback ) {
  28101. return jQuery.each( this, callback );
  28102. },
  28103. map: function( callback ) {
  28104. return this.pushStack( jQuery.map( this, function( elem, i ) {
  28105. return callback.call( elem, i, elem );
  28106. } ) );
  28107. },
  28108. slice: function() {
  28109. return this.pushStack( slice.apply( this, arguments ) );
  28110. },
  28111. first: function() {
  28112. return this.eq( 0 );
  28113. },
  28114. last: function() {
  28115. return this.eq( -1 );
  28116. },
  28117. eq: function( i ) {
  28118. var len = this.length,
  28119. j = +i + ( i < 0 ? len : 0 );
  28120. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  28121. },
  28122. end: function() {
  28123. return this.prevObject || this.constructor();
  28124. },
  28125. // For internal use only.
  28126. // Behaves like an Array's method, not like a jQuery method.
  28127. push: push,
  28128. sort: arr.sort,
  28129. splice: arr.splice
  28130. };
  28131. jQuery.extend = jQuery.fn.extend = function() {
  28132. var options, name, src, copy, copyIsArray, clone,
  28133. target = arguments[ 0 ] || {},
  28134. i = 1,
  28135. length = arguments.length,
  28136. deep = false;
  28137. // Handle a deep copy situation
  28138. if ( typeof target === "boolean" ) {
  28139. deep = target;
  28140. // Skip the boolean and the target
  28141. target = arguments[ i ] || {};
  28142. i++;
  28143. }
  28144. // Handle case when target is a string or something (possible in deep copy)
  28145. if ( typeof target !== "object" && !isFunction( target ) ) {
  28146. target = {};
  28147. }
  28148. // Extend jQuery itself if only one argument is passed
  28149. if ( i === length ) {
  28150. target = this;
  28151. i--;
  28152. }
  28153. for ( ; i < length; i++ ) {
  28154. // Only deal with non-null/undefined values
  28155. if ( ( options = arguments[ i ] ) != null ) {
  28156. // Extend the base object
  28157. for ( name in options ) {
  28158. src = target[ name ];
  28159. copy = options[ name ];
  28160. // Prevent never-ending loop
  28161. if ( target === copy ) {
  28162. continue;
  28163. }
  28164. // Recurse if we're merging plain objects or arrays
  28165. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  28166. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  28167. if ( copyIsArray ) {
  28168. copyIsArray = false;
  28169. clone = src && Array.isArray( src ) ? src : [];
  28170. } else {
  28171. clone = src && jQuery.isPlainObject( src ) ? src : {};
  28172. }
  28173. // Never move original objects, clone them
  28174. target[ name ] = jQuery.extend( deep, clone, copy );
  28175. // Don't bring in undefined values
  28176. } else if ( copy !== undefined ) {
  28177. target[ name ] = copy;
  28178. }
  28179. }
  28180. }
  28181. }
  28182. // Return the modified object
  28183. return target;
  28184. };
  28185. jQuery.extend( {
  28186. // Unique for each copy of jQuery on the page
  28187. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  28188. // Assume jQuery is ready without the ready module
  28189. isReady: true,
  28190. error: function( msg ) {
  28191. throw new Error( msg );
  28192. },
  28193. noop: function() {},
  28194. isPlainObject: function( obj ) {
  28195. var proto, Ctor;
  28196. // Detect obvious negatives
  28197. // Use toString instead of jQuery.type to catch host objects
  28198. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  28199. return false;
  28200. }
  28201. proto = getProto( obj );
  28202. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  28203. if ( !proto ) {
  28204. return true;
  28205. }
  28206. // Objects with prototype are plain iff they were constructed by a global Object function
  28207. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  28208. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  28209. },
  28210. isEmptyObject: function( obj ) {
  28211. /* eslint-disable no-unused-vars */
  28212. // See https://github.com/eslint/eslint/issues/6125
  28213. var name;
  28214. for ( name in obj ) {
  28215. return false;
  28216. }
  28217. return true;
  28218. },
  28219. // Evaluates a script in a global context
  28220. globalEval: function( code ) {
  28221. DOMEval( code );
  28222. },
  28223. each: function( obj, callback ) {
  28224. var length, i = 0;
  28225. if ( isArrayLike( obj ) ) {
  28226. length = obj.length;
  28227. for ( ; i < length; i++ ) {
  28228. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  28229. break;
  28230. }
  28231. }
  28232. } else {
  28233. for ( i in obj ) {
  28234. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  28235. break;
  28236. }
  28237. }
  28238. }
  28239. return obj;
  28240. },
  28241. // Support: Android <=4.0 only
  28242. trim: function( text ) {
  28243. return text == null ?
  28244. "" :
  28245. ( text + "" ).replace( rtrim, "" );
  28246. },
  28247. // results is for internal usage only
  28248. makeArray: function( arr, results ) {
  28249. var ret = results || [];
  28250. if ( arr != null ) {
  28251. if ( isArrayLike( Object( arr ) ) ) {
  28252. jQuery.merge( ret,
  28253. typeof arr === "string" ?
  28254. [ arr ] : arr
  28255. );
  28256. } else {
  28257. push.call( ret, arr );
  28258. }
  28259. }
  28260. return ret;
  28261. },
  28262. inArray: function( elem, arr, i ) {
  28263. return arr == null ? -1 : indexOf.call( arr, elem, i );
  28264. },
  28265. // Support: Android <=4.0 only, PhantomJS 1 only
  28266. // push.apply(_, arraylike) throws on ancient WebKit
  28267. merge: function( first, second ) {
  28268. var len = +second.length,
  28269. j = 0,
  28270. i = first.length;
  28271. for ( ; j < len; j++ ) {
  28272. first[ i++ ] = second[ j ];
  28273. }
  28274. first.length = i;
  28275. return first;
  28276. },
  28277. grep: function( elems, callback, invert ) {
  28278. var callbackInverse,
  28279. matches = [],
  28280. i = 0,
  28281. length = elems.length,
  28282. callbackExpect = !invert;
  28283. // Go through the array, only saving the items
  28284. // that pass the validator function
  28285. for ( ; i < length; i++ ) {
  28286. callbackInverse = !callback( elems[ i ], i );
  28287. if ( callbackInverse !== callbackExpect ) {
  28288. matches.push( elems[ i ] );
  28289. }
  28290. }
  28291. return matches;
  28292. },
  28293. // arg is for internal usage only
  28294. map: function( elems, callback, arg ) {
  28295. var length, value,
  28296. i = 0,
  28297. ret = [];
  28298. // Go through the array, translating each of the items to their new values
  28299. if ( isArrayLike( elems ) ) {
  28300. length = elems.length;
  28301. for ( ; i < length; i++ ) {
  28302. value = callback( elems[ i ], i, arg );
  28303. if ( value != null ) {
  28304. ret.push( value );
  28305. }
  28306. }
  28307. // Go through every key on the object,
  28308. } else {
  28309. for ( i in elems ) {
  28310. value = callback( elems[ i ], i, arg );
  28311. if ( value != null ) {
  28312. ret.push( value );
  28313. }
  28314. }
  28315. }
  28316. // Flatten any nested arrays
  28317. return concat.apply( [], ret );
  28318. },
  28319. // A global GUID counter for objects
  28320. guid: 1,
  28321. // jQuery.support is not used in Core but other projects attach their
  28322. // properties to it so it needs to exist.
  28323. support: support
  28324. } );
  28325. if ( typeof Symbol === "function" ) {
  28326. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  28327. }
  28328. // Populate the class2type map
  28329. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  28330. function( i, name ) {
  28331. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  28332. } );
  28333. function isArrayLike( obj ) {
  28334. // Support: real iOS 8.2 only (not reproducible in simulator)
  28335. // `in` check used to prevent JIT error (gh-2145)
  28336. // hasOwn isn't used here due to false negatives
  28337. // regarding Nodelist length in IE
  28338. var length = !!obj && "length" in obj && obj.length,
  28339. type = toType( obj );
  28340. if ( isFunction( obj ) || isWindow( obj ) ) {
  28341. return false;
  28342. }
  28343. return type === "array" || length === 0 ||
  28344. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  28345. }
  28346. var Sizzle =
  28347. /*!
  28348. * Sizzle CSS Selector Engine v2.3.3
  28349. * https://sizzlejs.com/
  28350. *
  28351. * Copyright jQuery Foundation and other contributors
  28352. * Released under the MIT license
  28353. * http://jquery.org/license
  28354. *
  28355. * Date: 2016-08-08
  28356. */
  28357. (function( window ) {
  28358. var i,
  28359. support,
  28360. Expr,
  28361. getText,
  28362. isXML,
  28363. tokenize,
  28364. compile,
  28365. select,
  28366. outermostContext,
  28367. sortInput,
  28368. hasDuplicate,
  28369. // Local document vars
  28370. setDocument,
  28371. document,
  28372. docElem,
  28373. documentIsHTML,
  28374. rbuggyQSA,
  28375. rbuggyMatches,
  28376. matches,
  28377. contains,
  28378. // Instance-specific data
  28379. expando = "sizzle" + 1 * new Date(),
  28380. preferredDoc = window.document,
  28381. dirruns = 0,
  28382. done = 0,
  28383. classCache = createCache(),
  28384. tokenCache = createCache(),
  28385. compilerCache = createCache(),
  28386. sortOrder = function( a, b ) {
  28387. if ( a === b ) {
  28388. hasDuplicate = true;
  28389. }
  28390. return 0;
  28391. },
  28392. // Instance methods
  28393. hasOwn = ({}).hasOwnProperty,
  28394. arr = [],
  28395. pop = arr.pop,
  28396. push_native = arr.push,
  28397. push = arr.push,
  28398. slice = arr.slice,
  28399. // Use a stripped-down indexOf as it's faster than native
  28400. // https://jsperf.com/thor-indexof-vs-for/5
  28401. indexOf = function( list, elem ) {
  28402. var i = 0,
  28403. len = list.length;
  28404. for ( ; i < len; i++ ) {
  28405. if ( list[i] === elem ) {
  28406. return i;
  28407. }
  28408. }
  28409. return -1;
  28410. },
  28411. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  28412. // Regular expressions
  28413. // http://www.w3.org/TR/css3-selectors/#whitespace
  28414. whitespace = "[\\x20\\t\\r\\n\\f]",
  28415. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  28416. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  28417. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  28418. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  28419. // Operator (capture 2)
  28420. "*([*^$|!~]?=)" + whitespace +
  28421. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  28422. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  28423. "*\\]",
  28424. pseudos = ":(" + identifier + ")(?:\\((" +
  28425. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  28426. // 1. quoted (capture 3; capture 4 or capture 5)
  28427. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  28428. // 2. simple (capture 6)
  28429. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  28430. // 3. anything else (capture 2)
  28431. ".*" +
  28432. ")\\)|)",
  28433. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  28434. rwhitespace = new RegExp( whitespace + "+", "g" ),
  28435. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  28436. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  28437. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  28438. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  28439. rpseudo = new RegExp( pseudos ),
  28440. ridentifier = new RegExp( "^" + identifier + "$" ),
  28441. matchExpr = {
  28442. "ID": new RegExp( "^#(" + identifier + ")" ),
  28443. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  28444. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  28445. "ATTR": new RegExp( "^" + attributes ),
  28446. "PSEUDO": new RegExp( "^" + pseudos ),
  28447. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  28448. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  28449. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  28450. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  28451. // For use in libraries implementing .is()
  28452. // We use this for POS matching in `select`
  28453. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  28454. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  28455. },
  28456. rinputs = /^(?:input|select|textarea|button)$/i,
  28457. rheader = /^h\d$/i,
  28458. rnative = /^[^{]+\{\s*\[native \w/,
  28459. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  28460. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  28461. rsibling = /[+~]/,
  28462. // CSS escapes
  28463. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  28464. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  28465. funescape = function( _, escaped, escapedWhitespace ) {
  28466. var high = "0x" + escaped - 0x10000;
  28467. // NaN means non-codepoint
  28468. // Support: Firefox<24
  28469. // Workaround erroneous numeric interpretation of +"0x"
  28470. return high !== high || escapedWhitespace ?
  28471. escaped :
  28472. high < 0 ?
  28473. // BMP codepoint
  28474. String.fromCharCode( high + 0x10000 ) :
  28475. // Supplemental Plane codepoint (surrogate pair)
  28476. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  28477. },
  28478. // CSS string/identifier serialization
  28479. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  28480. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  28481. fcssescape = function( ch, asCodePoint ) {
  28482. if ( asCodePoint ) {
  28483. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  28484. if ( ch === "\0" ) {
  28485. return "\uFFFD";
  28486. }
  28487. // Control characters and (dependent upon position) numbers get escaped as code points
  28488. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  28489. }
  28490. // Other potentially-special ASCII characters get backslash-escaped
  28491. return "\\" + ch;
  28492. },
  28493. // Used for iframes
  28494. // See setDocument()
  28495. // Removing the function wrapper causes a "Permission Denied"
  28496. // error in IE
  28497. unloadHandler = function() {
  28498. setDocument();
  28499. },
  28500. disabledAncestor = addCombinator(
  28501. function( elem ) {
  28502. return elem.disabled === true && ("form" in elem || "label" in elem);
  28503. },
  28504. { dir: "parentNode", next: "legend" }
  28505. );
  28506. // Optimize for push.apply( _, NodeList )
  28507. try {
  28508. push.apply(
  28509. (arr = slice.call( preferredDoc.childNodes )),
  28510. preferredDoc.childNodes
  28511. );
  28512. // Support: Android<4.0
  28513. // Detect silently failing push.apply
  28514. arr[ preferredDoc.childNodes.length ].nodeType;
  28515. } catch ( e ) {
  28516. push = { apply: arr.length ?
  28517. // Leverage slice if possible
  28518. function( target, els ) {
  28519. push_native.apply( target, slice.call(els) );
  28520. } :
  28521. // Support: IE<9
  28522. // Otherwise append directly
  28523. function( target, els ) {
  28524. var j = target.length,
  28525. i = 0;
  28526. // Can't trust NodeList.length
  28527. while ( (target[j++] = els[i++]) ) {}
  28528. target.length = j - 1;
  28529. }
  28530. };
  28531. }
  28532. function Sizzle( selector, context, results, seed ) {
  28533. var m, i, elem, nid, match, groups, newSelector,
  28534. newContext = context && context.ownerDocument,
  28535. // nodeType defaults to 9, since context defaults to document
  28536. nodeType = context ? context.nodeType : 9;
  28537. results = results || [];
  28538. // Return early from calls with invalid selector or context
  28539. if ( typeof selector !== "string" || !selector ||
  28540. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  28541. return results;
  28542. }
  28543. // Try to shortcut find operations (as opposed to filters) in HTML documents
  28544. if ( !seed ) {
  28545. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  28546. setDocument( context );
  28547. }
  28548. context = context || document;
  28549. if ( documentIsHTML ) {
  28550. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  28551. // (excepting DocumentFragment context, where the methods don't exist)
  28552. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  28553. // ID selector
  28554. if ( (m = match[1]) ) {
  28555. // Document context
  28556. if ( nodeType === 9 ) {
  28557. if ( (elem = context.getElementById( m )) ) {
  28558. // Support: IE, Opera, Webkit
  28559. // TODO: identify versions
  28560. // getElementById can match elements by name instead of ID
  28561. if ( elem.id === m ) {
  28562. results.push( elem );
  28563. return results;
  28564. }
  28565. } else {
  28566. return results;
  28567. }
  28568. // Element context
  28569. } else {
  28570. // Support: IE, Opera, Webkit
  28571. // TODO: identify versions
  28572. // getElementById can match elements by name instead of ID
  28573. if ( newContext && (elem = newContext.getElementById( m )) &&
  28574. contains( context, elem ) &&
  28575. elem.id === m ) {
  28576. results.push( elem );
  28577. return results;
  28578. }
  28579. }
  28580. // Type selector
  28581. } else if ( match[2] ) {
  28582. push.apply( results, context.getElementsByTagName( selector ) );
  28583. return results;
  28584. // Class selector
  28585. } else if ( (m = match[3]) && support.getElementsByClassName &&
  28586. context.getElementsByClassName ) {
  28587. push.apply( results, context.getElementsByClassName( m ) );
  28588. return results;
  28589. }
  28590. }
  28591. // Take advantage of querySelectorAll
  28592. if ( support.qsa &&
  28593. !compilerCache[ selector + " " ] &&
  28594. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  28595. if ( nodeType !== 1 ) {
  28596. newContext = context;
  28597. newSelector = selector;
  28598. // qSA looks outside Element context, which is not what we want
  28599. // Thanks to Andrew Dupont for this workaround technique
  28600. // Support: IE <=8
  28601. // Exclude object elements
  28602. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  28603. // Capture the context ID, setting it first if necessary
  28604. if ( (nid = context.getAttribute( "id" )) ) {
  28605. nid = nid.replace( rcssescape, fcssescape );
  28606. } else {
  28607. context.setAttribute( "id", (nid = expando) );
  28608. }
  28609. // Prefix every selector in the list
  28610. groups = tokenize( selector );
  28611. i = groups.length;
  28612. while ( i-- ) {
  28613. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  28614. }
  28615. newSelector = groups.join( "," );
  28616. // Expand context for sibling selectors
  28617. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  28618. context;
  28619. }
  28620. if ( newSelector ) {
  28621. try {
  28622. push.apply( results,
  28623. newContext.querySelectorAll( newSelector )
  28624. );
  28625. return results;
  28626. } catch ( qsaError ) {
  28627. } finally {
  28628. if ( nid === expando ) {
  28629. context.removeAttribute( "id" );
  28630. }
  28631. }
  28632. }
  28633. }
  28634. }
  28635. }
  28636. // All others
  28637. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  28638. }
  28639. /**
  28640. * Create key-value caches of limited size
  28641. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  28642. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  28643. * deleting the oldest entry
  28644. */
  28645. function createCache() {
  28646. var keys = [];
  28647. function cache( key, value ) {
  28648. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  28649. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  28650. // Only keep the most recent entries
  28651. delete cache[ keys.shift() ];
  28652. }
  28653. return (cache[ key + " " ] = value);
  28654. }
  28655. return cache;
  28656. }
  28657. /**
  28658. * Mark a function for special use by Sizzle
  28659. * @param {Function} fn The function to mark
  28660. */
  28661. function markFunction( fn ) {
  28662. fn[ expando ] = true;
  28663. return fn;
  28664. }
  28665. /**
  28666. * Support testing using an element
  28667. * @param {Function} fn Passed the created element and returns a boolean result
  28668. */
  28669. function assert( fn ) {
  28670. var el = document.createElement("fieldset");
  28671. try {
  28672. return !!fn( el );
  28673. } catch (e) {
  28674. return false;
  28675. } finally {
  28676. // Remove from its parent by default
  28677. if ( el.parentNode ) {
  28678. el.parentNode.removeChild( el );
  28679. }
  28680. // release memory in IE
  28681. el = null;
  28682. }
  28683. }
  28684. /**
  28685. * Adds the same handler for all of the specified attrs
  28686. * @param {String} attrs Pipe-separated list of attributes
  28687. * @param {Function} handler The method that will be applied
  28688. */
  28689. function addHandle( attrs, handler ) {
  28690. var arr = attrs.split("|"),
  28691. i = arr.length;
  28692. while ( i-- ) {
  28693. Expr.attrHandle[ arr[i] ] = handler;
  28694. }
  28695. }
  28696. /**
  28697. * Checks document order of two siblings
  28698. * @param {Element} a
  28699. * @param {Element} b
  28700. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  28701. */
  28702. function siblingCheck( a, b ) {
  28703. var cur = b && a,
  28704. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  28705. a.sourceIndex - b.sourceIndex;
  28706. // Use IE sourceIndex if available on both nodes
  28707. if ( diff ) {
  28708. return diff;
  28709. }
  28710. // Check if b follows a
  28711. if ( cur ) {
  28712. while ( (cur = cur.nextSibling) ) {
  28713. if ( cur === b ) {
  28714. return -1;
  28715. }
  28716. }
  28717. }
  28718. return a ? 1 : -1;
  28719. }
  28720. /**
  28721. * Returns a function to use in pseudos for input types
  28722. * @param {String} type
  28723. */
  28724. function createInputPseudo( type ) {
  28725. return function( elem ) {
  28726. var name = elem.nodeName.toLowerCase();
  28727. return name === "input" && elem.type === type;
  28728. };
  28729. }
  28730. /**
  28731. * Returns a function to use in pseudos for buttons
  28732. * @param {String} type
  28733. */
  28734. function createButtonPseudo( type ) {
  28735. return function( elem ) {
  28736. var name = elem.nodeName.toLowerCase();
  28737. return (name === "input" || name === "button") && elem.type === type;
  28738. };
  28739. }
  28740. /**
  28741. * Returns a function to use in pseudos for :enabled/:disabled
  28742. * @param {Boolean} disabled true for :disabled; false for :enabled
  28743. */
  28744. function createDisabledPseudo( disabled ) {
  28745. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  28746. return function( elem ) {
  28747. // Only certain elements can match :enabled or :disabled
  28748. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  28749. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  28750. if ( "form" in elem ) {
  28751. // Check for inherited disabledness on relevant non-disabled elements:
  28752. // * listed form-associated elements in a disabled fieldset
  28753. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  28754. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  28755. // * option elements in a disabled optgroup
  28756. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  28757. // All such elements have a "form" property.
  28758. if ( elem.parentNode && elem.disabled === false ) {
  28759. // Option elements defer to a parent optgroup if present
  28760. if ( "label" in elem ) {
  28761. if ( "label" in elem.parentNode ) {
  28762. return elem.parentNode.disabled === disabled;
  28763. } else {
  28764. return elem.disabled === disabled;
  28765. }
  28766. }
  28767. // Support: IE 6 - 11
  28768. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  28769. return elem.isDisabled === disabled ||
  28770. // Where there is no isDisabled, check manually
  28771. /* jshint -W018 */
  28772. elem.isDisabled !== !disabled &&
  28773. disabledAncestor( elem ) === disabled;
  28774. }
  28775. return elem.disabled === disabled;
  28776. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  28777. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  28778. // even exist on them, let alone have a boolean value.
  28779. } else if ( "label" in elem ) {
  28780. return elem.disabled === disabled;
  28781. }
  28782. // Remaining elements are neither :enabled nor :disabled
  28783. return false;
  28784. };
  28785. }
  28786. /**
  28787. * Returns a function to use in pseudos for positionals
  28788. * @param {Function} fn
  28789. */
  28790. function createPositionalPseudo( fn ) {
  28791. return markFunction(function( argument ) {
  28792. argument = +argument;
  28793. return markFunction(function( seed, matches ) {
  28794. var j,
  28795. matchIndexes = fn( [], seed.length, argument ),
  28796. i = matchIndexes.length;
  28797. // Match elements found at the specified indexes
  28798. while ( i-- ) {
  28799. if ( seed[ (j = matchIndexes[i]) ] ) {
  28800. seed[j] = !(matches[j] = seed[j]);
  28801. }
  28802. }
  28803. });
  28804. });
  28805. }
  28806. /**
  28807. * Checks a node for validity as a Sizzle context
  28808. * @param {Element|Object=} context
  28809. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  28810. */
  28811. function testContext( context ) {
  28812. return context && typeof context.getElementsByTagName !== "undefined" && context;
  28813. }
  28814. // Expose support vars for convenience
  28815. support = Sizzle.support = {};
  28816. /**
  28817. * Detects XML nodes
  28818. * @param {Element|Object} elem An element or a document
  28819. * @returns {Boolean} True iff elem is a non-HTML XML node
  28820. */
  28821. isXML = Sizzle.isXML = function( elem ) {
  28822. // documentElement is verified for cases where it doesn't yet exist
  28823. // (such as loading iframes in IE - #4833)
  28824. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  28825. return documentElement ? documentElement.nodeName !== "HTML" : false;
  28826. };
  28827. /**
  28828. * Sets document-related variables once based on the current document
  28829. * @param {Element|Object} [doc] An element or document object to use to set the document
  28830. * @returns {Object} Returns the current document
  28831. */
  28832. setDocument = Sizzle.setDocument = function( node ) {
  28833. var hasCompare, subWindow,
  28834. doc = node ? node.ownerDocument || node : preferredDoc;
  28835. // Return early if doc is invalid or already selected
  28836. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  28837. return document;
  28838. }
  28839. // Update global variables
  28840. document = doc;
  28841. docElem = document.documentElement;
  28842. documentIsHTML = !isXML( document );
  28843. // Support: IE 9-11, Edge
  28844. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  28845. if ( preferredDoc !== document &&
  28846. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  28847. // Support: IE 11, Edge
  28848. if ( subWindow.addEventListener ) {
  28849. subWindow.addEventListener( "unload", unloadHandler, false );
  28850. // Support: IE 9 - 10 only
  28851. } else if ( subWindow.attachEvent ) {
  28852. subWindow.attachEvent( "onunload", unloadHandler );
  28853. }
  28854. }
  28855. /* Attributes
  28856. ---------------------------------------------------------------------- */
  28857. // Support: IE<8
  28858. // Verify that getAttribute really returns attributes and not properties
  28859. // (excepting IE8 booleans)
  28860. support.attributes = assert(function( el ) {
  28861. el.className = "i";
  28862. return !el.getAttribute("className");
  28863. });
  28864. /* getElement(s)By*
  28865. ---------------------------------------------------------------------- */
  28866. // Check if getElementsByTagName("*") returns only elements
  28867. support.getElementsByTagName = assert(function( el ) {
  28868. el.appendChild( document.createComment("") );
  28869. return !el.getElementsByTagName("*").length;
  28870. });
  28871. // Support: IE<9
  28872. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  28873. // Support: IE<10
  28874. // Check if getElementById returns elements by name
  28875. // The broken getElementById methods don't pick up programmatically-set names,
  28876. // so use a roundabout getElementsByName test
  28877. support.getById = assert(function( el ) {
  28878. docElem.appendChild( el ).id = expando;
  28879. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  28880. });
  28881. // ID filter and find
  28882. if ( support.getById ) {
  28883. Expr.filter["ID"] = function( id ) {
  28884. var attrId = id.replace( runescape, funescape );
  28885. return function( elem ) {
  28886. return elem.getAttribute("id") === attrId;
  28887. };
  28888. };
  28889. Expr.find["ID"] = function( id, context ) {
  28890. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  28891. var elem = context.getElementById( id );
  28892. return elem ? [ elem ] : [];
  28893. }
  28894. };
  28895. } else {
  28896. Expr.filter["ID"] = function( id ) {
  28897. var attrId = id.replace( runescape, funescape );
  28898. return function( elem ) {
  28899. var node = typeof elem.getAttributeNode !== "undefined" &&
  28900. elem.getAttributeNode("id");
  28901. return node && node.value === attrId;
  28902. };
  28903. };
  28904. // Support: IE 6 - 7 only
  28905. // getElementById is not reliable as a find shortcut
  28906. Expr.find["ID"] = function( id, context ) {
  28907. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  28908. var node, i, elems,
  28909. elem = context.getElementById( id );
  28910. if ( elem ) {
  28911. // Verify the id attribute
  28912. node = elem.getAttributeNode("id");
  28913. if ( node && node.value === id ) {
  28914. return [ elem ];
  28915. }
  28916. // Fall back on getElementsByName
  28917. elems = context.getElementsByName( id );
  28918. i = 0;
  28919. while ( (elem = elems[i++]) ) {
  28920. node = elem.getAttributeNode("id");
  28921. if ( node && node.value === id ) {
  28922. return [ elem ];
  28923. }
  28924. }
  28925. }
  28926. return [];
  28927. }
  28928. };
  28929. }
  28930. // Tag
  28931. Expr.find["TAG"] = support.getElementsByTagName ?
  28932. function( tag, context ) {
  28933. if ( typeof context.getElementsByTagName !== "undefined" ) {
  28934. return context.getElementsByTagName( tag );
  28935. // DocumentFragment nodes don't have gEBTN
  28936. } else if ( support.qsa ) {
  28937. return context.querySelectorAll( tag );
  28938. }
  28939. } :
  28940. function( tag, context ) {
  28941. var elem,
  28942. tmp = [],
  28943. i = 0,
  28944. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  28945. results = context.getElementsByTagName( tag );
  28946. // Filter out possible comments
  28947. if ( tag === "*" ) {
  28948. while ( (elem = results[i++]) ) {
  28949. if ( elem.nodeType === 1 ) {
  28950. tmp.push( elem );
  28951. }
  28952. }
  28953. return tmp;
  28954. }
  28955. return results;
  28956. };
  28957. // Class
  28958. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  28959. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  28960. return context.getElementsByClassName( className );
  28961. }
  28962. };
  28963. /* QSA/matchesSelector
  28964. ---------------------------------------------------------------------- */
  28965. // QSA and matchesSelector support
  28966. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  28967. rbuggyMatches = [];
  28968. // qSa(:focus) reports false when true (Chrome 21)
  28969. // We allow this because of a bug in IE8/9 that throws an error
  28970. // whenever `document.activeElement` is accessed on an iframe
  28971. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  28972. // See https://bugs.jquery.com/ticket/13378
  28973. rbuggyQSA = [];
  28974. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  28975. // Build QSA regex
  28976. // Regex strategy adopted from Diego Perini
  28977. assert(function( el ) {
  28978. // Select is set to empty string on purpose
  28979. // This is to test IE's treatment of not explicitly
  28980. // setting a boolean content attribute,
  28981. // since its presence should be enough
  28982. // https://bugs.jquery.com/ticket/12359
  28983. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  28984. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  28985. "<option selected=''></option></select>";
  28986. // Support: IE8, Opera 11-12.16
  28987. // Nothing should be selected when empty strings follow ^= or $= or *=
  28988. // The test attribute must be unknown in Opera but "safe" for WinRT
  28989. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  28990. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  28991. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  28992. }
  28993. // Support: IE8
  28994. // Boolean attributes and "value" are not treated correctly
  28995. if ( !el.querySelectorAll("[selected]").length ) {
  28996. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  28997. }
  28998. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  28999. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  29000. rbuggyQSA.push("~=");
  29001. }
  29002. // Webkit/Opera - :checked should return selected option elements
  29003. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  29004. // IE8 throws error here and will not see later tests
  29005. if ( !el.querySelectorAll(":checked").length ) {
  29006. rbuggyQSA.push(":checked");
  29007. }
  29008. // Support: Safari 8+, iOS 8+
  29009. // https://bugs.webkit.org/show_bug.cgi?id=136851
  29010. // In-page `selector#id sibling-combinator selector` fails
  29011. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  29012. rbuggyQSA.push(".#.+[+~]");
  29013. }
  29014. });
  29015. assert(function( el ) {
  29016. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  29017. "<select disabled='disabled'><option/></select>";
  29018. // Support: Windows 8 Native Apps
  29019. // The type and name attributes are restricted during .innerHTML assignment
  29020. var input = document.createElement("input");
  29021. input.setAttribute( "type", "hidden" );
  29022. el.appendChild( input ).setAttribute( "name", "D" );
  29023. // Support: IE8
  29024. // Enforce case-sensitivity of name attribute
  29025. if ( el.querySelectorAll("[name=d]").length ) {
  29026. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  29027. }
  29028. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  29029. // IE8 throws error here and will not see later tests
  29030. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  29031. rbuggyQSA.push( ":enabled", ":disabled" );
  29032. }
  29033. // Support: IE9-11+
  29034. // IE's :disabled selector does not pick up the children of disabled fieldsets
  29035. docElem.appendChild( el ).disabled = true;
  29036. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  29037. rbuggyQSA.push( ":enabled", ":disabled" );
  29038. }
  29039. // Opera 10-11 does not throw on post-comma invalid pseudos
  29040. el.querySelectorAll("*,:x");
  29041. rbuggyQSA.push(",.*:");
  29042. });
  29043. }
  29044. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  29045. docElem.webkitMatchesSelector ||
  29046. docElem.mozMatchesSelector ||
  29047. docElem.oMatchesSelector ||
  29048. docElem.msMatchesSelector) )) ) {
  29049. assert(function( el ) {
  29050. // Check to see if it's possible to do matchesSelector
  29051. // on a disconnected node (IE 9)
  29052. support.disconnectedMatch = matches.call( el, "*" );
  29053. // This should fail with an exception
  29054. // Gecko does not error, returns false instead
  29055. matches.call( el, "[s!='']:x" );
  29056. rbuggyMatches.push( "!=", pseudos );
  29057. });
  29058. }
  29059. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  29060. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  29061. /* Contains
  29062. ---------------------------------------------------------------------- */
  29063. hasCompare = rnative.test( docElem.compareDocumentPosition );
  29064. // Element contains another
  29065. // Purposefully self-exclusive
  29066. // As in, an element does not contain itself
  29067. contains = hasCompare || rnative.test( docElem.contains ) ?
  29068. function( a, b ) {
  29069. var adown = a.nodeType === 9 ? a.documentElement : a,
  29070. bup = b && b.parentNode;
  29071. return a === bup || !!( bup && bup.nodeType === 1 && (
  29072. adown.contains ?
  29073. adown.contains( bup ) :
  29074. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  29075. ));
  29076. } :
  29077. function( a, b ) {
  29078. if ( b ) {
  29079. while ( (b = b.parentNode) ) {
  29080. if ( b === a ) {
  29081. return true;
  29082. }
  29083. }
  29084. }
  29085. return false;
  29086. };
  29087. /* Sorting
  29088. ---------------------------------------------------------------------- */
  29089. // Document order sorting
  29090. sortOrder = hasCompare ?
  29091. function( a, b ) {
  29092. // Flag for duplicate removal
  29093. if ( a === b ) {
  29094. hasDuplicate = true;
  29095. return 0;
  29096. }
  29097. // Sort on method existence if only one input has compareDocumentPosition
  29098. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  29099. if ( compare ) {
  29100. return compare;
  29101. }
  29102. // Calculate position if both inputs belong to the same document
  29103. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  29104. a.compareDocumentPosition( b ) :
  29105. // Otherwise we know they are disconnected
  29106. 1;
  29107. // Disconnected nodes
  29108. if ( compare & 1 ||
  29109. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  29110. // Choose the first element that is related to our preferred document
  29111. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  29112. return -1;
  29113. }
  29114. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  29115. return 1;
  29116. }
  29117. // Maintain original order
  29118. return sortInput ?
  29119. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  29120. 0;
  29121. }
  29122. return compare & 4 ? -1 : 1;
  29123. } :
  29124. function( a, b ) {
  29125. // Exit early if the nodes are identical
  29126. if ( a === b ) {
  29127. hasDuplicate = true;
  29128. return 0;
  29129. }
  29130. var cur,
  29131. i = 0,
  29132. aup = a.parentNode,
  29133. bup = b.parentNode,
  29134. ap = [ a ],
  29135. bp = [ b ];
  29136. // Parentless nodes are either documents or disconnected
  29137. if ( !aup || !bup ) {
  29138. return a === document ? -1 :
  29139. b === document ? 1 :
  29140. aup ? -1 :
  29141. bup ? 1 :
  29142. sortInput ?
  29143. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  29144. 0;
  29145. // If the nodes are siblings, we can do a quick check
  29146. } else if ( aup === bup ) {
  29147. return siblingCheck( a, b );
  29148. }
  29149. // Otherwise we need full lists of their ancestors for comparison
  29150. cur = a;
  29151. while ( (cur = cur.parentNode) ) {
  29152. ap.unshift( cur );
  29153. }
  29154. cur = b;
  29155. while ( (cur = cur.parentNode) ) {
  29156. bp.unshift( cur );
  29157. }
  29158. // Walk down the tree looking for a discrepancy
  29159. while ( ap[i] === bp[i] ) {
  29160. i++;
  29161. }
  29162. return i ?
  29163. // Do a sibling check if the nodes have a common ancestor
  29164. siblingCheck( ap[i], bp[i] ) :
  29165. // Otherwise nodes in our document sort first
  29166. ap[i] === preferredDoc ? -1 :
  29167. bp[i] === preferredDoc ? 1 :
  29168. 0;
  29169. };
  29170. return document;
  29171. };
  29172. Sizzle.matches = function( expr, elements ) {
  29173. return Sizzle( expr, null, null, elements );
  29174. };
  29175. Sizzle.matchesSelector = function( elem, expr ) {
  29176. // Set document vars if needed
  29177. if ( ( elem.ownerDocument || elem ) !== document ) {
  29178. setDocument( elem );
  29179. }
  29180. // Make sure that attribute selectors are quoted
  29181. expr = expr.replace( rattributeQuotes, "='$1']" );
  29182. if ( support.matchesSelector && documentIsHTML &&
  29183. !compilerCache[ expr + " " ] &&
  29184. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  29185. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  29186. try {
  29187. var ret = matches.call( elem, expr );
  29188. // IE 9's matchesSelector returns false on disconnected nodes
  29189. if ( ret || support.disconnectedMatch ||
  29190. // As well, disconnected nodes are said to be in a document
  29191. // fragment in IE 9
  29192. elem.document && elem.document.nodeType !== 11 ) {
  29193. return ret;
  29194. }
  29195. } catch (e) {}
  29196. }
  29197. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  29198. };
  29199. Sizzle.contains = function( context, elem ) {
  29200. // Set document vars if needed
  29201. if ( ( context.ownerDocument || context ) !== document ) {
  29202. setDocument( context );
  29203. }
  29204. return contains( context, elem );
  29205. };
  29206. Sizzle.attr = function( elem, name ) {
  29207. // Set document vars if needed
  29208. if ( ( elem.ownerDocument || elem ) !== document ) {
  29209. setDocument( elem );
  29210. }
  29211. var fn = Expr.attrHandle[ name.toLowerCase() ],
  29212. // Don't get fooled by Object.prototype properties (jQuery #13807)
  29213. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  29214. fn( elem, name, !documentIsHTML ) :
  29215. undefined;
  29216. return val !== undefined ?
  29217. val :
  29218. support.attributes || !documentIsHTML ?
  29219. elem.getAttribute( name ) :
  29220. (val = elem.getAttributeNode(name)) && val.specified ?
  29221. val.value :
  29222. null;
  29223. };
  29224. Sizzle.escape = function( sel ) {
  29225. return (sel + "").replace( rcssescape, fcssescape );
  29226. };
  29227. Sizzle.error = function( msg ) {
  29228. throw new Error( "Syntax error, unrecognized expression: " + msg );
  29229. };
  29230. /**
  29231. * Document sorting and removing duplicates
  29232. * @param {ArrayLike} results
  29233. */
  29234. Sizzle.uniqueSort = function( results ) {
  29235. var elem,
  29236. duplicates = [],
  29237. j = 0,
  29238. i = 0;
  29239. // Unless we *know* we can detect duplicates, assume their presence
  29240. hasDuplicate = !support.detectDuplicates;
  29241. sortInput = !support.sortStable && results.slice( 0 );
  29242. results.sort( sortOrder );
  29243. if ( hasDuplicate ) {
  29244. while ( (elem = results[i++]) ) {
  29245. if ( elem === results[ i ] ) {
  29246. j = duplicates.push( i );
  29247. }
  29248. }
  29249. while ( j-- ) {
  29250. results.splice( duplicates[ j ], 1 );
  29251. }
  29252. }
  29253. // Clear input after sorting to release objects
  29254. // See https://github.com/jquery/sizzle/pull/225
  29255. sortInput = null;
  29256. return results;
  29257. };
  29258. /**
  29259. * Utility function for retrieving the text value of an array of DOM nodes
  29260. * @param {Array|Element} elem
  29261. */
  29262. getText = Sizzle.getText = function( elem ) {
  29263. var node,
  29264. ret = "",
  29265. i = 0,
  29266. nodeType = elem.nodeType;
  29267. if ( !nodeType ) {
  29268. // If no nodeType, this is expected to be an array
  29269. while ( (node = elem[i++]) ) {
  29270. // Do not traverse comment nodes
  29271. ret += getText( node );
  29272. }
  29273. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  29274. // Use textContent for elements
  29275. // innerText usage removed for consistency of new lines (jQuery #11153)
  29276. if ( typeof elem.textContent === "string" ) {
  29277. return elem.textContent;
  29278. } else {
  29279. // Traverse its children
  29280. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  29281. ret += getText( elem );
  29282. }
  29283. }
  29284. } else if ( nodeType === 3 || nodeType === 4 ) {
  29285. return elem.nodeValue;
  29286. }
  29287. // Do not include comment or processing instruction nodes
  29288. return ret;
  29289. };
  29290. Expr = Sizzle.selectors = {
  29291. // Can be adjusted by the user
  29292. cacheLength: 50,
  29293. createPseudo: markFunction,
  29294. match: matchExpr,
  29295. attrHandle: {},
  29296. find: {},
  29297. relative: {
  29298. ">": { dir: "parentNode", first: true },
  29299. " ": { dir: "parentNode" },
  29300. "+": { dir: "previousSibling", first: true },
  29301. "~": { dir: "previousSibling" }
  29302. },
  29303. preFilter: {
  29304. "ATTR": function( match ) {
  29305. match[1] = match[1].replace( runescape, funescape );
  29306. // Move the given value to match[3] whether quoted or unquoted
  29307. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  29308. if ( match[2] === "~=" ) {
  29309. match[3] = " " + match[3] + " ";
  29310. }
  29311. return match.slice( 0, 4 );
  29312. },
  29313. "CHILD": function( match ) {
  29314. /* matches from matchExpr["CHILD"]
  29315. 1 type (only|nth|...)
  29316. 2 what (child|of-type)
  29317. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  29318. 4 xn-component of xn+y argument ([+-]?\d*n|)
  29319. 5 sign of xn-component
  29320. 6 x of xn-component
  29321. 7 sign of y-component
  29322. 8 y of y-component
  29323. */
  29324. match[1] = match[1].toLowerCase();
  29325. if ( match[1].slice( 0, 3 ) === "nth" ) {
  29326. // nth-* requires argument
  29327. if ( !match[3] ) {
  29328. Sizzle.error( match[0] );
  29329. }
  29330. // numeric x and y parameters for Expr.filter.CHILD
  29331. // remember that false/true cast respectively to 0/1
  29332. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  29333. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  29334. // other types prohibit arguments
  29335. } else if ( match[3] ) {
  29336. Sizzle.error( match[0] );
  29337. }
  29338. return match;
  29339. },
  29340. "PSEUDO": function( match ) {
  29341. var excess,
  29342. unquoted = !match[6] && match[2];
  29343. if ( matchExpr["CHILD"].test( match[0] ) ) {
  29344. return null;
  29345. }
  29346. // Accept quoted arguments as-is
  29347. if ( match[3] ) {
  29348. match[2] = match[4] || match[5] || "";
  29349. // Strip excess characters from unquoted arguments
  29350. } else if ( unquoted && rpseudo.test( unquoted ) &&
  29351. // Get excess from tokenize (recursively)
  29352. (excess = tokenize( unquoted, true )) &&
  29353. // advance to the next closing parenthesis
  29354. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  29355. // excess is a negative index
  29356. match[0] = match[0].slice( 0, excess );
  29357. match[2] = unquoted.slice( 0, excess );
  29358. }
  29359. // Return only captures needed by the pseudo filter method (type and argument)
  29360. return match.slice( 0, 3 );
  29361. }
  29362. },
  29363. filter: {
  29364. "TAG": function( nodeNameSelector ) {
  29365. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  29366. return nodeNameSelector === "*" ?
  29367. function() { return true; } :
  29368. function( elem ) {
  29369. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  29370. };
  29371. },
  29372. "CLASS": function( className ) {
  29373. var pattern = classCache[ className + " " ];
  29374. return pattern ||
  29375. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  29376. classCache( className, function( elem ) {
  29377. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  29378. });
  29379. },
  29380. "ATTR": function( name, operator, check ) {
  29381. return function( elem ) {
  29382. var result = Sizzle.attr( elem, name );
  29383. if ( result == null ) {
  29384. return operator === "!=";
  29385. }
  29386. if ( !operator ) {
  29387. return true;
  29388. }
  29389. result += "";
  29390. return operator === "=" ? result === check :
  29391. operator === "!=" ? result !== check :
  29392. operator === "^=" ? check && result.indexOf( check ) === 0 :
  29393. operator === "*=" ? check && result.indexOf( check ) > -1 :
  29394. operator === "$=" ? check && result.slice( -check.length ) === check :
  29395. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  29396. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  29397. false;
  29398. };
  29399. },
  29400. "CHILD": function( type, what, argument, first, last ) {
  29401. var simple = type.slice( 0, 3 ) !== "nth",
  29402. forward = type.slice( -4 ) !== "last",
  29403. ofType = what === "of-type";
  29404. return first === 1 && last === 0 ?
  29405. // Shortcut for :nth-*(n)
  29406. function( elem ) {
  29407. return !!elem.parentNode;
  29408. } :
  29409. function( elem, context, xml ) {
  29410. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  29411. dir = simple !== forward ? "nextSibling" : "previousSibling",
  29412. parent = elem.parentNode,
  29413. name = ofType && elem.nodeName.toLowerCase(),
  29414. useCache = !xml && !ofType,
  29415. diff = false;
  29416. if ( parent ) {
  29417. // :(first|last|only)-(child|of-type)
  29418. if ( simple ) {
  29419. while ( dir ) {
  29420. node = elem;
  29421. while ( (node = node[ dir ]) ) {
  29422. if ( ofType ?
  29423. node.nodeName.toLowerCase() === name :
  29424. node.nodeType === 1 ) {
  29425. return false;
  29426. }
  29427. }
  29428. // Reverse direction for :only-* (if we haven't yet done so)
  29429. start = dir = type === "only" && !start && "nextSibling";
  29430. }
  29431. return true;
  29432. }
  29433. start = [ forward ? parent.firstChild : parent.lastChild ];
  29434. // non-xml :nth-child(...) stores cache data on `parent`
  29435. if ( forward && useCache ) {
  29436. // Seek `elem` from a previously-cached index
  29437. // ...in a gzip-friendly way
  29438. node = parent;
  29439. outerCache = node[ expando ] || (node[ expando ] = {});
  29440. // Support: IE <9 only
  29441. // Defend against cloned attroperties (jQuery gh-1709)
  29442. uniqueCache = outerCache[ node.uniqueID ] ||
  29443. (outerCache[ node.uniqueID ] = {});
  29444. cache = uniqueCache[ type ] || [];
  29445. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  29446. diff = nodeIndex && cache[ 2 ];
  29447. node = nodeIndex && parent.childNodes[ nodeIndex ];
  29448. while ( (node = ++nodeIndex && node && node[ dir ] ||
  29449. // Fallback to seeking `elem` from the start
  29450. (diff = nodeIndex = 0) || start.pop()) ) {
  29451. // When found, cache indexes on `parent` and break
  29452. if ( node.nodeType === 1 && ++diff && node === elem ) {
  29453. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  29454. break;
  29455. }
  29456. }
  29457. } else {
  29458. // Use previously-cached element index if available
  29459. if ( useCache ) {
  29460. // ...in a gzip-friendly way
  29461. node = elem;
  29462. outerCache = node[ expando ] || (node[ expando ] = {});
  29463. // Support: IE <9 only
  29464. // Defend against cloned attroperties (jQuery gh-1709)
  29465. uniqueCache = outerCache[ node.uniqueID ] ||
  29466. (outerCache[ node.uniqueID ] = {});
  29467. cache = uniqueCache[ type ] || [];
  29468. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  29469. diff = nodeIndex;
  29470. }
  29471. // xml :nth-child(...)
  29472. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  29473. if ( diff === false ) {
  29474. // Use the same loop as above to seek `elem` from the start
  29475. while ( (node = ++nodeIndex && node && node[ dir ] ||
  29476. (diff = nodeIndex = 0) || start.pop()) ) {
  29477. if ( ( ofType ?
  29478. node.nodeName.toLowerCase() === name :
  29479. node.nodeType === 1 ) &&
  29480. ++diff ) {
  29481. // Cache the index of each encountered element
  29482. if ( useCache ) {
  29483. outerCache = node[ expando ] || (node[ expando ] = {});
  29484. // Support: IE <9 only
  29485. // Defend against cloned attroperties (jQuery gh-1709)
  29486. uniqueCache = outerCache[ node.uniqueID ] ||
  29487. (outerCache[ node.uniqueID ] = {});
  29488. uniqueCache[ type ] = [ dirruns, diff ];
  29489. }
  29490. if ( node === elem ) {
  29491. break;
  29492. }
  29493. }
  29494. }
  29495. }
  29496. }
  29497. // Incorporate the offset, then check against cycle size
  29498. diff -= last;
  29499. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  29500. }
  29501. };
  29502. },
  29503. "PSEUDO": function( pseudo, argument ) {
  29504. // pseudo-class names are case-insensitive
  29505. // http://www.w3.org/TR/selectors/#pseudo-classes
  29506. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  29507. // Remember that setFilters inherits from pseudos
  29508. var args,
  29509. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  29510. Sizzle.error( "unsupported pseudo: " + pseudo );
  29511. // The user may use createPseudo to indicate that
  29512. // arguments are needed to create the filter function
  29513. // just as Sizzle does
  29514. if ( fn[ expando ] ) {
  29515. return fn( argument );
  29516. }
  29517. // But maintain support for old signatures
  29518. if ( fn.length > 1 ) {
  29519. args = [ pseudo, pseudo, "", argument ];
  29520. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  29521. markFunction(function( seed, matches ) {
  29522. var idx,
  29523. matched = fn( seed, argument ),
  29524. i = matched.length;
  29525. while ( i-- ) {
  29526. idx = indexOf( seed, matched[i] );
  29527. seed[ idx ] = !( matches[ idx ] = matched[i] );
  29528. }
  29529. }) :
  29530. function( elem ) {
  29531. return fn( elem, 0, args );
  29532. };
  29533. }
  29534. return fn;
  29535. }
  29536. },
  29537. pseudos: {
  29538. // Potentially complex pseudos
  29539. "not": markFunction(function( selector ) {
  29540. // Trim the selector passed to compile
  29541. // to avoid treating leading and trailing
  29542. // spaces as combinators
  29543. var input = [],
  29544. results = [],
  29545. matcher = compile( selector.replace( rtrim, "$1" ) );
  29546. return matcher[ expando ] ?
  29547. markFunction(function( seed, matches, context, xml ) {
  29548. var elem,
  29549. unmatched = matcher( seed, null, xml, [] ),
  29550. i = seed.length;
  29551. // Match elements unmatched by `matcher`
  29552. while ( i-- ) {
  29553. if ( (elem = unmatched[i]) ) {
  29554. seed[i] = !(matches[i] = elem);
  29555. }
  29556. }
  29557. }) :
  29558. function( elem, context, xml ) {
  29559. input[0] = elem;
  29560. matcher( input, null, xml, results );
  29561. // Don't keep the element (issue #299)
  29562. input[0] = null;
  29563. return !results.pop();
  29564. };
  29565. }),
  29566. "has": markFunction(function( selector ) {
  29567. return function( elem ) {
  29568. return Sizzle( selector, elem ).length > 0;
  29569. };
  29570. }),
  29571. "contains": markFunction(function( text ) {
  29572. text = text.replace( runescape, funescape );
  29573. return function( elem ) {
  29574. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  29575. };
  29576. }),
  29577. // "Whether an element is represented by a :lang() selector
  29578. // is based solely on the element's language value
  29579. // being equal to the identifier C,
  29580. // or beginning with the identifier C immediately followed by "-".
  29581. // The matching of C against the element's language value is performed case-insensitively.
  29582. // The identifier C does not have to be a valid language name."
  29583. // http://www.w3.org/TR/selectors/#lang-pseudo
  29584. "lang": markFunction( function( lang ) {
  29585. // lang value must be a valid identifier
  29586. if ( !ridentifier.test(lang || "") ) {
  29587. Sizzle.error( "unsupported lang: " + lang );
  29588. }
  29589. lang = lang.replace( runescape, funescape ).toLowerCase();
  29590. return function( elem ) {
  29591. var elemLang;
  29592. do {
  29593. if ( (elemLang = documentIsHTML ?
  29594. elem.lang :
  29595. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  29596. elemLang = elemLang.toLowerCase();
  29597. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  29598. }
  29599. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  29600. return false;
  29601. };
  29602. }),
  29603. // Miscellaneous
  29604. "target": function( elem ) {
  29605. var hash = window.location && window.location.hash;
  29606. return hash && hash.slice( 1 ) === elem.id;
  29607. },
  29608. "root": function( elem ) {
  29609. return elem === docElem;
  29610. },
  29611. "focus": function( elem ) {
  29612. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  29613. },
  29614. // Boolean properties
  29615. "enabled": createDisabledPseudo( false ),
  29616. "disabled": createDisabledPseudo( true ),
  29617. "checked": function( elem ) {
  29618. // In CSS3, :checked should return both checked and selected elements
  29619. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  29620. var nodeName = elem.nodeName.toLowerCase();
  29621. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  29622. },
  29623. "selected": function( elem ) {
  29624. // Accessing this property makes selected-by-default
  29625. // options in Safari work properly
  29626. if ( elem.parentNode ) {
  29627. elem.parentNode.selectedIndex;
  29628. }
  29629. return elem.selected === true;
  29630. },
  29631. // Contents
  29632. "empty": function( elem ) {
  29633. // http://www.w3.org/TR/selectors/#empty-pseudo
  29634. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  29635. // but not by others (comment: 8; processing instruction: 7; etc.)
  29636. // nodeType < 6 works because attributes (2) do not appear as children
  29637. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  29638. if ( elem.nodeType < 6 ) {
  29639. return false;
  29640. }
  29641. }
  29642. return true;
  29643. },
  29644. "parent": function( elem ) {
  29645. return !Expr.pseudos["empty"]( elem );
  29646. },
  29647. // Element/input types
  29648. "header": function( elem ) {
  29649. return rheader.test( elem.nodeName );
  29650. },
  29651. "input": function( elem ) {
  29652. return rinputs.test( elem.nodeName );
  29653. },
  29654. "button": function( elem ) {
  29655. var name = elem.nodeName.toLowerCase();
  29656. return name === "input" && elem.type === "button" || name === "button";
  29657. },
  29658. "text": function( elem ) {
  29659. var attr;
  29660. return elem.nodeName.toLowerCase() === "input" &&
  29661. elem.type === "text" &&
  29662. // Support: IE<8
  29663. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  29664. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  29665. },
  29666. // Position-in-collection
  29667. "first": createPositionalPseudo(function() {
  29668. return [ 0 ];
  29669. }),
  29670. "last": createPositionalPseudo(function( matchIndexes, length ) {
  29671. return [ length - 1 ];
  29672. }),
  29673. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  29674. return [ argument < 0 ? argument + length : argument ];
  29675. }),
  29676. "even": createPositionalPseudo(function( matchIndexes, length ) {
  29677. var i = 0;
  29678. for ( ; i < length; i += 2 ) {
  29679. matchIndexes.push( i );
  29680. }
  29681. return matchIndexes;
  29682. }),
  29683. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  29684. var i = 1;
  29685. for ( ; i < length; i += 2 ) {
  29686. matchIndexes.push( i );
  29687. }
  29688. return matchIndexes;
  29689. }),
  29690. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  29691. var i = argument < 0 ? argument + length : argument;
  29692. for ( ; --i >= 0; ) {
  29693. matchIndexes.push( i );
  29694. }
  29695. return matchIndexes;
  29696. }),
  29697. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  29698. var i = argument < 0 ? argument + length : argument;
  29699. for ( ; ++i < length; ) {
  29700. matchIndexes.push( i );
  29701. }
  29702. return matchIndexes;
  29703. })
  29704. }
  29705. };
  29706. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  29707. // Add button/input type pseudos
  29708. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  29709. Expr.pseudos[ i ] = createInputPseudo( i );
  29710. }
  29711. for ( i in { submit: true, reset: true } ) {
  29712. Expr.pseudos[ i ] = createButtonPseudo( i );
  29713. }
  29714. // Easy API for creating new setFilters
  29715. function setFilters() {}
  29716. setFilters.prototype = Expr.filters = Expr.pseudos;
  29717. Expr.setFilters = new setFilters();
  29718. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  29719. var matched, match, tokens, type,
  29720. soFar, groups, preFilters,
  29721. cached = tokenCache[ selector + " " ];
  29722. if ( cached ) {
  29723. return parseOnly ? 0 : cached.slice( 0 );
  29724. }
  29725. soFar = selector;
  29726. groups = [];
  29727. preFilters = Expr.preFilter;
  29728. while ( soFar ) {
  29729. // Comma and first run
  29730. if ( !matched || (match = rcomma.exec( soFar )) ) {
  29731. if ( match ) {
  29732. // Don't consume trailing commas as valid
  29733. soFar = soFar.slice( match[0].length ) || soFar;
  29734. }
  29735. groups.push( (tokens = []) );
  29736. }
  29737. matched = false;
  29738. // Combinators
  29739. if ( (match = rcombinators.exec( soFar )) ) {
  29740. matched = match.shift();
  29741. tokens.push({
  29742. value: matched,
  29743. // Cast descendant combinators to space
  29744. type: match[0].replace( rtrim, " " )
  29745. });
  29746. soFar = soFar.slice( matched.length );
  29747. }
  29748. // Filters
  29749. for ( type in Expr.filter ) {
  29750. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  29751. (match = preFilters[ type ]( match ))) ) {
  29752. matched = match.shift();
  29753. tokens.push({
  29754. value: matched,
  29755. type: type,
  29756. matches: match
  29757. });
  29758. soFar = soFar.slice( matched.length );
  29759. }
  29760. }
  29761. if ( !matched ) {
  29762. break;
  29763. }
  29764. }
  29765. // Return the length of the invalid excess
  29766. // if we're just parsing
  29767. // Otherwise, throw an error or return tokens
  29768. return parseOnly ?
  29769. soFar.length :
  29770. soFar ?
  29771. Sizzle.error( selector ) :
  29772. // Cache the tokens
  29773. tokenCache( selector, groups ).slice( 0 );
  29774. };
  29775. function toSelector( tokens ) {
  29776. var i = 0,
  29777. len = tokens.length,
  29778. selector = "";
  29779. for ( ; i < len; i++ ) {
  29780. selector += tokens[i].value;
  29781. }
  29782. return selector;
  29783. }
  29784. function addCombinator( matcher, combinator, base ) {
  29785. var dir = combinator.dir,
  29786. skip = combinator.next,
  29787. key = skip || dir,
  29788. checkNonElements = base && key === "parentNode",
  29789. doneName = done++;
  29790. return combinator.first ?
  29791. // Check against closest ancestor/preceding element
  29792. function( elem, context, xml ) {
  29793. while ( (elem = elem[ dir ]) ) {
  29794. if ( elem.nodeType === 1 || checkNonElements ) {
  29795. return matcher( elem, context, xml );
  29796. }
  29797. }
  29798. return false;
  29799. } :
  29800. // Check against all ancestor/preceding elements
  29801. function( elem, context, xml ) {
  29802. var oldCache, uniqueCache, outerCache,
  29803. newCache = [ dirruns, doneName ];
  29804. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  29805. if ( xml ) {
  29806. while ( (elem = elem[ dir ]) ) {
  29807. if ( elem.nodeType === 1 || checkNonElements ) {
  29808. if ( matcher( elem, context, xml ) ) {
  29809. return true;
  29810. }
  29811. }
  29812. }
  29813. } else {
  29814. while ( (elem = elem[ dir ]) ) {
  29815. if ( elem.nodeType === 1 || checkNonElements ) {
  29816. outerCache = elem[ expando ] || (elem[ expando ] = {});
  29817. // Support: IE <9 only
  29818. // Defend against cloned attroperties (jQuery gh-1709)
  29819. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  29820. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  29821. elem = elem[ dir ] || elem;
  29822. } else if ( (oldCache = uniqueCache[ key ]) &&
  29823. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  29824. // Assign to newCache so results back-propagate to previous elements
  29825. return (newCache[ 2 ] = oldCache[ 2 ]);
  29826. } else {
  29827. // Reuse newcache so results back-propagate to previous elements
  29828. uniqueCache[ key ] = newCache;
  29829. // A match means we're done; a fail means we have to keep checking
  29830. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  29831. return true;
  29832. }
  29833. }
  29834. }
  29835. }
  29836. }
  29837. return false;
  29838. };
  29839. }
  29840. function elementMatcher( matchers ) {
  29841. return matchers.length > 1 ?
  29842. function( elem, context, xml ) {
  29843. var i = matchers.length;
  29844. while ( i-- ) {
  29845. if ( !matchers[i]( elem, context, xml ) ) {
  29846. return false;
  29847. }
  29848. }
  29849. return true;
  29850. } :
  29851. matchers[0];
  29852. }
  29853. function multipleContexts( selector, contexts, results ) {
  29854. var i = 0,
  29855. len = contexts.length;
  29856. for ( ; i < len; i++ ) {
  29857. Sizzle( selector, contexts[i], results );
  29858. }
  29859. return results;
  29860. }
  29861. function condense( unmatched, map, filter, context, xml ) {
  29862. var elem,
  29863. newUnmatched = [],
  29864. i = 0,
  29865. len = unmatched.length,
  29866. mapped = map != null;
  29867. for ( ; i < len; i++ ) {
  29868. if ( (elem = unmatched[i]) ) {
  29869. if ( !filter || filter( elem, context, xml ) ) {
  29870. newUnmatched.push( elem );
  29871. if ( mapped ) {
  29872. map.push( i );
  29873. }
  29874. }
  29875. }
  29876. }
  29877. return newUnmatched;
  29878. }
  29879. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  29880. if ( postFilter && !postFilter[ expando ] ) {
  29881. postFilter = setMatcher( postFilter );
  29882. }
  29883. if ( postFinder && !postFinder[ expando ] ) {
  29884. postFinder = setMatcher( postFinder, postSelector );
  29885. }
  29886. return markFunction(function( seed, results, context, xml ) {
  29887. var temp, i, elem,
  29888. preMap = [],
  29889. postMap = [],
  29890. preexisting = results.length,
  29891. // Get initial elements from seed or context
  29892. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  29893. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  29894. matcherIn = preFilter && ( seed || !selector ) ?
  29895. condense( elems, preMap, preFilter, context, xml ) :
  29896. elems,
  29897. matcherOut = matcher ?
  29898. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  29899. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  29900. // ...intermediate processing is necessary
  29901. [] :
  29902. // ...otherwise use results directly
  29903. results :
  29904. matcherIn;
  29905. // Find primary matches
  29906. if ( matcher ) {
  29907. matcher( matcherIn, matcherOut, context, xml );
  29908. }
  29909. // Apply postFilter
  29910. if ( postFilter ) {
  29911. temp = condense( matcherOut, postMap );
  29912. postFilter( temp, [], context, xml );
  29913. // Un-match failing elements by moving them back to matcherIn
  29914. i = temp.length;
  29915. while ( i-- ) {
  29916. if ( (elem = temp[i]) ) {
  29917. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  29918. }
  29919. }
  29920. }
  29921. if ( seed ) {
  29922. if ( postFinder || preFilter ) {
  29923. if ( postFinder ) {
  29924. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  29925. temp = [];
  29926. i = matcherOut.length;
  29927. while ( i-- ) {
  29928. if ( (elem = matcherOut[i]) ) {
  29929. // Restore matcherIn since elem is not yet a final match
  29930. temp.push( (matcherIn[i] = elem) );
  29931. }
  29932. }
  29933. postFinder( null, (matcherOut = []), temp, xml );
  29934. }
  29935. // Move matched elements from seed to results to keep them synchronized
  29936. i = matcherOut.length;
  29937. while ( i-- ) {
  29938. if ( (elem = matcherOut[i]) &&
  29939. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  29940. seed[temp] = !(results[temp] = elem);
  29941. }
  29942. }
  29943. }
  29944. // Add elements to results, through postFinder if defined
  29945. } else {
  29946. matcherOut = condense(
  29947. matcherOut === results ?
  29948. matcherOut.splice( preexisting, matcherOut.length ) :
  29949. matcherOut
  29950. );
  29951. if ( postFinder ) {
  29952. postFinder( null, results, matcherOut, xml );
  29953. } else {
  29954. push.apply( results, matcherOut );
  29955. }
  29956. }
  29957. });
  29958. }
  29959. function matcherFromTokens( tokens ) {
  29960. var checkContext, matcher, j,
  29961. len = tokens.length,
  29962. leadingRelative = Expr.relative[ tokens[0].type ],
  29963. implicitRelative = leadingRelative || Expr.relative[" "],
  29964. i = leadingRelative ? 1 : 0,
  29965. // The foundational matcher ensures that elements are reachable from top-level context(s)
  29966. matchContext = addCombinator( function( elem ) {
  29967. return elem === checkContext;
  29968. }, implicitRelative, true ),
  29969. matchAnyContext = addCombinator( function( elem ) {
  29970. return indexOf( checkContext, elem ) > -1;
  29971. }, implicitRelative, true ),
  29972. matchers = [ function( elem, context, xml ) {
  29973. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  29974. (checkContext = context).nodeType ?
  29975. matchContext( elem, context, xml ) :
  29976. matchAnyContext( elem, context, xml ) );
  29977. // Avoid hanging onto element (issue #299)
  29978. checkContext = null;
  29979. return ret;
  29980. } ];
  29981. for ( ; i < len; i++ ) {
  29982. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  29983. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  29984. } else {
  29985. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  29986. // Return special upon seeing a positional matcher
  29987. if ( matcher[ expando ] ) {
  29988. // Find the next relative operator (if any) for proper handling
  29989. j = ++i;
  29990. for ( ; j < len; j++ ) {
  29991. if ( Expr.relative[ tokens[j].type ] ) {
  29992. break;
  29993. }
  29994. }
  29995. return setMatcher(
  29996. i > 1 && elementMatcher( matchers ),
  29997. i > 1 && toSelector(
  29998. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  29999. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  30000. ).replace( rtrim, "$1" ),
  30001. matcher,
  30002. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  30003. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  30004. j < len && toSelector( tokens )
  30005. );
  30006. }
  30007. matchers.push( matcher );
  30008. }
  30009. }
  30010. return elementMatcher( matchers );
  30011. }
  30012. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  30013. var bySet = setMatchers.length > 0,
  30014. byElement = elementMatchers.length > 0,
  30015. superMatcher = function( seed, context, xml, results, outermost ) {
  30016. var elem, j, matcher,
  30017. matchedCount = 0,
  30018. i = "0",
  30019. unmatched = seed && [],
  30020. setMatched = [],
  30021. contextBackup = outermostContext,
  30022. // We must always have either seed elements or outermost context
  30023. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  30024. // Use integer dirruns iff this is the outermost matcher
  30025. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  30026. len = elems.length;
  30027. if ( outermost ) {
  30028. outermostContext = context === document || context || outermost;
  30029. }
  30030. // Add elements passing elementMatchers directly to results
  30031. // Support: IE<9, Safari
  30032. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  30033. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  30034. if ( byElement && elem ) {
  30035. j = 0;
  30036. if ( !context && elem.ownerDocument !== document ) {
  30037. setDocument( elem );
  30038. xml = !documentIsHTML;
  30039. }
  30040. while ( (matcher = elementMatchers[j++]) ) {
  30041. if ( matcher( elem, context || document, xml) ) {
  30042. results.push( elem );
  30043. break;
  30044. }
  30045. }
  30046. if ( outermost ) {
  30047. dirruns = dirrunsUnique;
  30048. }
  30049. }
  30050. // Track unmatched elements for set filters
  30051. if ( bySet ) {
  30052. // They will have gone through all possible matchers
  30053. if ( (elem = !matcher && elem) ) {
  30054. matchedCount--;
  30055. }
  30056. // Lengthen the array for every element, matched or not
  30057. if ( seed ) {
  30058. unmatched.push( elem );
  30059. }
  30060. }
  30061. }
  30062. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  30063. // makes the latter nonnegative.
  30064. matchedCount += i;
  30065. // Apply set filters to unmatched elements
  30066. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  30067. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  30068. // no element matchers and no seed.
  30069. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  30070. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  30071. // numerically zero.
  30072. if ( bySet && i !== matchedCount ) {
  30073. j = 0;
  30074. while ( (matcher = setMatchers[j++]) ) {
  30075. matcher( unmatched, setMatched, context, xml );
  30076. }
  30077. if ( seed ) {
  30078. // Reintegrate element matches to eliminate the need for sorting
  30079. if ( matchedCount > 0 ) {
  30080. while ( i-- ) {
  30081. if ( !(unmatched[i] || setMatched[i]) ) {
  30082. setMatched[i] = pop.call( results );
  30083. }
  30084. }
  30085. }
  30086. // Discard index placeholder values to get only actual matches
  30087. setMatched = condense( setMatched );
  30088. }
  30089. // Add matches to results
  30090. push.apply( results, setMatched );
  30091. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  30092. if ( outermost && !seed && setMatched.length > 0 &&
  30093. ( matchedCount + setMatchers.length ) > 1 ) {
  30094. Sizzle.uniqueSort( results );
  30095. }
  30096. }
  30097. // Override manipulation of globals by nested matchers
  30098. if ( outermost ) {
  30099. dirruns = dirrunsUnique;
  30100. outermostContext = contextBackup;
  30101. }
  30102. return unmatched;
  30103. };
  30104. return bySet ?
  30105. markFunction( superMatcher ) :
  30106. superMatcher;
  30107. }
  30108. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  30109. var i,
  30110. setMatchers = [],
  30111. elementMatchers = [],
  30112. cached = compilerCache[ selector + " " ];
  30113. if ( !cached ) {
  30114. // Generate a function of recursive functions that can be used to check each element
  30115. if ( !match ) {
  30116. match = tokenize( selector );
  30117. }
  30118. i = match.length;
  30119. while ( i-- ) {
  30120. cached = matcherFromTokens( match[i] );
  30121. if ( cached[ expando ] ) {
  30122. setMatchers.push( cached );
  30123. } else {
  30124. elementMatchers.push( cached );
  30125. }
  30126. }
  30127. // Cache the compiled function
  30128. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  30129. // Save selector and tokenization
  30130. cached.selector = selector;
  30131. }
  30132. return cached;
  30133. };
  30134. /**
  30135. * A low-level selection function that works with Sizzle's compiled
  30136. * selector functions
  30137. * @param {String|Function} selector A selector or a pre-compiled
  30138. * selector function built with Sizzle.compile
  30139. * @param {Element} context
  30140. * @param {Array} [results]
  30141. * @param {Array} [seed] A set of elements to match against
  30142. */
  30143. select = Sizzle.select = function( selector, context, results, seed ) {
  30144. var i, tokens, token, type, find,
  30145. compiled = typeof selector === "function" && selector,
  30146. match = !seed && tokenize( (selector = compiled.selector || selector) );
  30147. results = results || [];
  30148. // Try to minimize operations if there is only one selector in the list and no seed
  30149. // (the latter of which guarantees us context)
  30150. if ( match.length === 1 ) {
  30151. // Reduce context if the leading compound selector is an ID
  30152. tokens = match[0] = match[0].slice( 0 );
  30153. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  30154. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  30155. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  30156. if ( !context ) {
  30157. return results;
  30158. // Precompiled matchers will still verify ancestry, so step up a level
  30159. } else if ( compiled ) {
  30160. context = context.parentNode;
  30161. }
  30162. selector = selector.slice( tokens.shift().value.length );
  30163. }
  30164. // Fetch a seed set for right-to-left matching
  30165. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  30166. while ( i-- ) {
  30167. token = tokens[i];
  30168. // Abort if we hit a combinator
  30169. if ( Expr.relative[ (type = token.type) ] ) {
  30170. break;
  30171. }
  30172. if ( (find = Expr.find[ type ]) ) {
  30173. // Search, expanding context for leading sibling combinators
  30174. if ( (seed = find(
  30175. token.matches[0].replace( runescape, funescape ),
  30176. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  30177. )) ) {
  30178. // If seed is empty or no tokens remain, we can return early
  30179. tokens.splice( i, 1 );
  30180. selector = seed.length && toSelector( tokens );
  30181. if ( !selector ) {
  30182. push.apply( results, seed );
  30183. return results;
  30184. }
  30185. break;
  30186. }
  30187. }
  30188. }
  30189. }
  30190. // Compile and execute a filtering function if one is not provided
  30191. // Provide `match` to avoid retokenization if we modified the selector above
  30192. ( compiled || compile( selector, match ) )(
  30193. seed,
  30194. context,
  30195. !documentIsHTML,
  30196. results,
  30197. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  30198. );
  30199. return results;
  30200. };
  30201. // One-time assignments
  30202. // Sort stability
  30203. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  30204. // Support: Chrome 14-35+
  30205. // Always assume duplicates if they aren't passed to the comparison function
  30206. support.detectDuplicates = !!hasDuplicate;
  30207. // Initialize against the default document
  30208. setDocument();
  30209. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  30210. // Detached nodes confoundingly follow *each other*
  30211. support.sortDetached = assert(function( el ) {
  30212. // Should return 1, but returns 4 (following)
  30213. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  30214. });
  30215. // Support: IE<8
  30216. // Prevent attribute/property "interpolation"
  30217. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  30218. if ( !assert(function( el ) {
  30219. el.innerHTML = "<a href='#'></a>";
  30220. return el.firstChild.getAttribute("href") === "#" ;
  30221. }) ) {
  30222. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  30223. if ( !isXML ) {
  30224. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  30225. }
  30226. });
  30227. }
  30228. // Support: IE<9
  30229. // Use defaultValue in place of getAttribute("value")
  30230. if ( !support.attributes || !assert(function( el ) {
  30231. el.innerHTML = "<input/>";
  30232. el.firstChild.setAttribute( "value", "" );
  30233. return el.firstChild.getAttribute( "value" ) === "";
  30234. }) ) {
  30235. addHandle( "value", function( elem, name, isXML ) {
  30236. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  30237. return elem.defaultValue;
  30238. }
  30239. });
  30240. }
  30241. // Support: IE<9
  30242. // Use getAttributeNode to fetch booleans when getAttribute lies
  30243. if ( !assert(function( el ) {
  30244. return el.getAttribute("disabled") == null;
  30245. }) ) {
  30246. addHandle( booleans, function( elem, name, isXML ) {
  30247. var val;
  30248. if ( !isXML ) {
  30249. return elem[ name ] === true ? name.toLowerCase() :
  30250. (val = elem.getAttributeNode( name )) && val.specified ?
  30251. val.value :
  30252. null;
  30253. }
  30254. });
  30255. }
  30256. return Sizzle;
  30257. })( window );
  30258. jQuery.find = Sizzle;
  30259. jQuery.expr = Sizzle.selectors;
  30260. // Deprecated
  30261. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  30262. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  30263. jQuery.text = Sizzle.getText;
  30264. jQuery.isXMLDoc = Sizzle.isXML;
  30265. jQuery.contains = Sizzle.contains;
  30266. jQuery.escapeSelector = Sizzle.escape;
  30267. var dir = function( elem, dir, until ) {
  30268. var matched = [],
  30269. truncate = until !== undefined;
  30270. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  30271. if ( elem.nodeType === 1 ) {
  30272. if ( truncate && jQuery( elem ).is( until ) ) {
  30273. break;
  30274. }
  30275. matched.push( elem );
  30276. }
  30277. }
  30278. return matched;
  30279. };
  30280. var siblings = function( n, elem ) {
  30281. var matched = [];
  30282. for ( ; n; n = n.nextSibling ) {
  30283. if ( n.nodeType === 1 && n !== elem ) {
  30284. matched.push( n );
  30285. }
  30286. }
  30287. return matched;
  30288. };
  30289. var rneedsContext = jQuery.expr.match.needsContext;
  30290. function nodeName( elem, name ) {
  30291. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  30292. };
  30293. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  30294. // Implement the identical functionality for filter and not
  30295. function winnow( elements, qualifier, not ) {
  30296. if ( isFunction( qualifier ) ) {
  30297. return jQuery.grep( elements, function( elem, i ) {
  30298. return !!qualifier.call( elem, i, elem ) !== not;
  30299. } );
  30300. }
  30301. // Single element
  30302. if ( qualifier.nodeType ) {
  30303. return jQuery.grep( elements, function( elem ) {
  30304. return ( elem === qualifier ) !== not;
  30305. } );
  30306. }
  30307. // Arraylike of elements (jQuery, arguments, Array)
  30308. if ( typeof qualifier !== "string" ) {
  30309. return jQuery.grep( elements, function( elem ) {
  30310. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  30311. } );
  30312. }
  30313. // Filtered directly for both simple and complex selectors
  30314. return jQuery.filter( qualifier, elements, not );
  30315. }
  30316. jQuery.filter = function( expr, elems, not ) {
  30317. var elem = elems[ 0 ];
  30318. if ( not ) {
  30319. expr = ":not(" + expr + ")";
  30320. }
  30321. if ( elems.length === 1 && elem.nodeType === 1 ) {
  30322. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  30323. }
  30324. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  30325. return elem.nodeType === 1;
  30326. } ) );
  30327. };
  30328. jQuery.fn.extend( {
  30329. find: function( selector ) {
  30330. var i, ret,
  30331. len = this.length,
  30332. self = this;
  30333. if ( typeof selector !== "string" ) {
  30334. return this.pushStack( jQuery( selector ).filter( function() {
  30335. for ( i = 0; i < len; i++ ) {
  30336. if ( jQuery.contains( self[ i ], this ) ) {
  30337. return true;
  30338. }
  30339. }
  30340. } ) );
  30341. }
  30342. ret = this.pushStack( [] );
  30343. for ( i = 0; i < len; i++ ) {
  30344. jQuery.find( selector, self[ i ], ret );
  30345. }
  30346. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  30347. },
  30348. filter: function( selector ) {
  30349. return this.pushStack( winnow( this, selector || [], false ) );
  30350. },
  30351. not: function( selector ) {
  30352. return this.pushStack( winnow( this, selector || [], true ) );
  30353. },
  30354. is: function( selector ) {
  30355. return !!winnow(
  30356. this,
  30357. // If this is a positional/relative selector, check membership in the returned set
  30358. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  30359. typeof selector === "string" && rneedsContext.test( selector ) ?
  30360. jQuery( selector ) :
  30361. selector || [],
  30362. false
  30363. ).length;
  30364. }
  30365. } );
  30366. // Initialize a jQuery object
  30367. // A central reference to the root jQuery(document)
  30368. var rootjQuery,
  30369. // A simple way to check for HTML strings
  30370. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  30371. // Strict HTML recognition (#11290: must start with <)
  30372. // Shortcut simple #id case for speed
  30373. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  30374. init = jQuery.fn.init = function( selector, context, root ) {
  30375. var match, elem;
  30376. // HANDLE: $(""), $(null), $(undefined), $(false)
  30377. if ( !selector ) {
  30378. return this;
  30379. }
  30380. // Method init() accepts an alternate rootjQuery
  30381. // so migrate can support jQuery.sub (gh-2101)
  30382. root = root || rootjQuery;
  30383. // Handle HTML strings
  30384. if ( typeof selector === "string" ) {
  30385. if ( selector[ 0 ] === "<" &&
  30386. selector[ selector.length - 1 ] === ">" &&
  30387. selector.length >= 3 ) {
  30388. // Assume that strings that start and end with <> are HTML and skip the regex check
  30389. match = [ null, selector, null ];
  30390. } else {
  30391. match = rquickExpr.exec( selector );
  30392. }
  30393. // Match html or make sure no context is specified for #id
  30394. if ( match && ( match[ 1 ] || !context ) ) {
  30395. // HANDLE: $(html) -> $(array)
  30396. if ( match[ 1 ] ) {
  30397. context = context instanceof jQuery ? context[ 0 ] : context;
  30398. // Option to run scripts is true for back-compat
  30399. // Intentionally let the error be thrown if parseHTML is not present
  30400. jQuery.merge( this, jQuery.parseHTML(
  30401. match[ 1 ],
  30402. context && context.nodeType ? context.ownerDocument || context : document,
  30403. true
  30404. ) );
  30405. // HANDLE: $(html, props)
  30406. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  30407. for ( match in context ) {
  30408. // Properties of context are called as methods if possible
  30409. if ( isFunction( this[ match ] ) ) {
  30410. this[ match ]( context[ match ] );
  30411. // ...and otherwise set as attributes
  30412. } else {
  30413. this.attr( match, context[ match ] );
  30414. }
  30415. }
  30416. }
  30417. return this;
  30418. // HANDLE: $(#id)
  30419. } else {
  30420. elem = document.getElementById( match[ 2 ] );
  30421. if ( elem ) {
  30422. // Inject the element directly into the jQuery object
  30423. this[ 0 ] = elem;
  30424. this.length = 1;
  30425. }
  30426. return this;
  30427. }
  30428. // HANDLE: $(expr, $(...))
  30429. } else if ( !context || context.jquery ) {
  30430. return ( context || root ).find( selector );
  30431. // HANDLE: $(expr, context)
  30432. // (which is just equivalent to: $(context).find(expr)
  30433. } else {
  30434. return this.constructor( context ).find( selector );
  30435. }
  30436. // HANDLE: $(DOMElement)
  30437. } else if ( selector.nodeType ) {
  30438. this[ 0 ] = selector;
  30439. this.length = 1;
  30440. return this;
  30441. // HANDLE: $(function)
  30442. // Shortcut for document ready
  30443. } else if ( isFunction( selector ) ) {
  30444. return root.ready !== undefined ?
  30445. root.ready( selector ) :
  30446. // Execute immediately if ready is not present
  30447. selector( jQuery );
  30448. }
  30449. return jQuery.makeArray( selector, this );
  30450. };
  30451. // Give the init function the jQuery prototype for later instantiation
  30452. init.prototype = jQuery.fn;
  30453. // Initialize central reference
  30454. rootjQuery = jQuery( document );
  30455. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  30456. // Methods guaranteed to produce a unique set when starting from a unique set
  30457. guaranteedUnique = {
  30458. children: true,
  30459. contents: true,
  30460. next: true,
  30461. prev: true
  30462. };
  30463. jQuery.fn.extend( {
  30464. has: function( target ) {
  30465. var targets = jQuery( target, this ),
  30466. l = targets.length;
  30467. return this.filter( function() {
  30468. var i = 0;
  30469. for ( ; i < l; i++ ) {
  30470. if ( jQuery.contains( this, targets[ i ] ) ) {
  30471. return true;
  30472. }
  30473. }
  30474. } );
  30475. },
  30476. closest: function( selectors, context ) {
  30477. var cur,
  30478. i = 0,
  30479. l = this.length,
  30480. matched = [],
  30481. targets = typeof selectors !== "string" && jQuery( selectors );
  30482. // Positional selectors never match, since there's no _selection_ context
  30483. if ( !rneedsContext.test( selectors ) ) {
  30484. for ( ; i < l; i++ ) {
  30485. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  30486. // Always skip document fragments
  30487. if ( cur.nodeType < 11 && ( targets ?
  30488. targets.index( cur ) > -1 :
  30489. // Don't pass non-elements to Sizzle
  30490. cur.nodeType === 1 &&
  30491. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  30492. matched.push( cur );
  30493. break;
  30494. }
  30495. }
  30496. }
  30497. }
  30498. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  30499. },
  30500. // Determine the position of an element within the set
  30501. index: function( elem ) {
  30502. // No argument, return index in parent
  30503. if ( !elem ) {
  30504. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  30505. }
  30506. // Index in selector
  30507. if ( typeof elem === "string" ) {
  30508. return indexOf.call( jQuery( elem ), this[ 0 ] );
  30509. }
  30510. // Locate the position of the desired element
  30511. return indexOf.call( this,
  30512. // If it receives a jQuery object, the first element is used
  30513. elem.jquery ? elem[ 0 ] : elem
  30514. );
  30515. },
  30516. add: function( selector, context ) {
  30517. return this.pushStack(
  30518. jQuery.uniqueSort(
  30519. jQuery.merge( this.get(), jQuery( selector, context ) )
  30520. )
  30521. );
  30522. },
  30523. addBack: function( selector ) {
  30524. return this.add( selector == null ?
  30525. this.prevObject : this.prevObject.filter( selector )
  30526. );
  30527. }
  30528. } );
  30529. function sibling( cur, dir ) {
  30530. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  30531. return cur;
  30532. }
  30533. jQuery.each( {
  30534. parent: function( elem ) {
  30535. var parent = elem.parentNode;
  30536. return parent && parent.nodeType !== 11 ? parent : null;
  30537. },
  30538. parents: function( elem ) {
  30539. return dir( elem, "parentNode" );
  30540. },
  30541. parentsUntil: function( elem, i, until ) {
  30542. return dir( elem, "parentNode", until );
  30543. },
  30544. next: function( elem ) {
  30545. return sibling( elem, "nextSibling" );
  30546. },
  30547. prev: function( elem ) {
  30548. return sibling( elem, "previousSibling" );
  30549. },
  30550. nextAll: function( elem ) {
  30551. return dir( elem, "nextSibling" );
  30552. },
  30553. prevAll: function( elem ) {
  30554. return dir( elem, "previousSibling" );
  30555. },
  30556. nextUntil: function( elem, i, until ) {
  30557. return dir( elem, "nextSibling", until );
  30558. },
  30559. prevUntil: function( elem, i, until ) {
  30560. return dir( elem, "previousSibling", until );
  30561. },
  30562. siblings: function( elem ) {
  30563. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  30564. },
  30565. children: function( elem ) {
  30566. return siblings( elem.firstChild );
  30567. },
  30568. contents: function( elem ) {
  30569. if ( nodeName( elem, "iframe" ) ) {
  30570. return elem.contentDocument;
  30571. }
  30572. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  30573. // Treat the template element as a regular one in browsers that
  30574. // don't support it.
  30575. if ( nodeName( elem, "template" ) ) {
  30576. elem = elem.content || elem;
  30577. }
  30578. return jQuery.merge( [], elem.childNodes );
  30579. }
  30580. }, function( name, fn ) {
  30581. jQuery.fn[ name ] = function( until, selector ) {
  30582. var matched = jQuery.map( this, fn, until );
  30583. if ( name.slice( -5 ) !== "Until" ) {
  30584. selector = until;
  30585. }
  30586. if ( selector && typeof selector === "string" ) {
  30587. matched = jQuery.filter( selector, matched );
  30588. }
  30589. if ( this.length > 1 ) {
  30590. // Remove duplicates
  30591. if ( !guaranteedUnique[ name ] ) {
  30592. jQuery.uniqueSort( matched );
  30593. }
  30594. // Reverse order for parents* and prev-derivatives
  30595. if ( rparentsprev.test( name ) ) {
  30596. matched.reverse();
  30597. }
  30598. }
  30599. return this.pushStack( matched );
  30600. };
  30601. } );
  30602. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  30603. // Convert String-formatted options into Object-formatted ones
  30604. function createOptions( options ) {
  30605. var object = {};
  30606. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  30607. object[ flag ] = true;
  30608. } );
  30609. return object;
  30610. }
  30611. /*
  30612. * Create a callback list using the following parameters:
  30613. *
  30614. * options: an optional list of space-separated options that will change how
  30615. * the callback list behaves or a more traditional option object
  30616. *
  30617. * By default a callback list will act like an event callback list and can be
  30618. * "fired" multiple times.
  30619. *
  30620. * Possible options:
  30621. *
  30622. * once: will ensure the callback list can only be fired once (like a Deferred)
  30623. *
  30624. * memory: will keep track of previous values and will call any callback added
  30625. * after the list has been fired right away with the latest "memorized"
  30626. * values (like a Deferred)
  30627. *
  30628. * unique: will ensure a callback can only be added once (no duplicate in the list)
  30629. *
  30630. * stopOnFalse: interrupt callings when a callback returns false
  30631. *
  30632. */
  30633. jQuery.Callbacks = function( options ) {
  30634. // Convert options from String-formatted to Object-formatted if needed
  30635. // (we check in cache first)
  30636. options = typeof options === "string" ?
  30637. createOptions( options ) :
  30638. jQuery.extend( {}, options );
  30639. var // Flag to know if list is currently firing
  30640. firing,
  30641. // Last fire value for non-forgettable lists
  30642. memory,
  30643. // Flag to know if list was already fired
  30644. fired,
  30645. // Flag to prevent firing
  30646. locked,
  30647. // Actual callback list
  30648. list = [],
  30649. // Queue of execution data for repeatable lists
  30650. queue = [],
  30651. // Index of currently firing callback (modified by add/remove as needed)
  30652. firingIndex = -1,
  30653. // Fire callbacks
  30654. fire = function() {
  30655. // Enforce single-firing
  30656. locked = locked || options.once;
  30657. // Execute callbacks for all pending executions,
  30658. // respecting firingIndex overrides and runtime changes
  30659. fired = firing = true;
  30660. for ( ; queue.length; firingIndex = -1 ) {
  30661. memory = queue.shift();
  30662. while ( ++firingIndex < list.length ) {
  30663. // Run callback and check for early termination
  30664. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  30665. options.stopOnFalse ) {
  30666. // Jump to end and forget the data so .add doesn't re-fire
  30667. firingIndex = list.length;
  30668. memory = false;
  30669. }
  30670. }
  30671. }
  30672. // Forget the data if we're done with it
  30673. if ( !options.memory ) {
  30674. memory = false;
  30675. }
  30676. firing = false;
  30677. // Clean up if we're done firing for good
  30678. if ( locked ) {
  30679. // Keep an empty list if we have data for future add calls
  30680. if ( memory ) {
  30681. list = [];
  30682. // Otherwise, this object is spent
  30683. } else {
  30684. list = "";
  30685. }
  30686. }
  30687. },
  30688. // Actual Callbacks object
  30689. self = {
  30690. // Add a callback or a collection of callbacks to the list
  30691. add: function() {
  30692. if ( list ) {
  30693. // If we have memory from a past run, we should fire after adding
  30694. if ( memory && !firing ) {
  30695. firingIndex = list.length - 1;
  30696. queue.push( memory );
  30697. }
  30698. ( function add( args ) {
  30699. jQuery.each( args, function( _, arg ) {
  30700. if ( isFunction( arg ) ) {
  30701. if ( !options.unique || !self.has( arg ) ) {
  30702. list.push( arg );
  30703. }
  30704. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  30705. // Inspect recursively
  30706. add( arg );
  30707. }
  30708. } );
  30709. } )( arguments );
  30710. if ( memory && !firing ) {
  30711. fire();
  30712. }
  30713. }
  30714. return this;
  30715. },
  30716. // Remove a callback from the list
  30717. remove: function() {
  30718. jQuery.each( arguments, function( _, arg ) {
  30719. var index;
  30720. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  30721. list.splice( index, 1 );
  30722. // Handle firing indexes
  30723. if ( index <= firingIndex ) {
  30724. firingIndex--;
  30725. }
  30726. }
  30727. } );
  30728. return this;
  30729. },
  30730. // Check if a given callback is in the list.
  30731. // If no argument is given, return whether or not list has callbacks attached.
  30732. has: function( fn ) {
  30733. return fn ?
  30734. jQuery.inArray( fn, list ) > -1 :
  30735. list.length > 0;
  30736. },
  30737. // Remove all callbacks from the list
  30738. empty: function() {
  30739. if ( list ) {
  30740. list = [];
  30741. }
  30742. return this;
  30743. },
  30744. // Disable .fire and .add
  30745. // Abort any current/pending executions
  30746. // Clear all callbacks and values
  30747. disable: function() {
  30748. locked = queue = [];
  30749. list = memory = "";
  30750. return this;
  30751. },
  30752. disabled: function() {
  30753. return !list;
  30754. },
  30755. // Disable .fire
  30756. // Also disable .add unless we have memory (since it would have no effect)
  30757. // Abort any pending executions
  30758. lock: function() {
  30759. locked = queue = [];
  30760. if ( !memory && !firing ) {
  30761. list = memory = "";
  30762. }
  30763. return this;
  30764. },
  30765. locked: function() {
  30766. return !!locked;
  30767. },
  30768. // Call all callbacks with the given context and arguments
  30769. fireWith: function( context, args ) {
  30770. if ( !locked ) {
  30771. args = args || [];
  30772. args = [ context, args.slice ? args.slice() : args ];
  30773. queue.push( args );
  30774. if ( !firing ) {
  30775. fire();
  30776. }
  30777. }
  30778. return this;
  30779. },
  30780. // Call all the callbacks with the given arguments
  30781. fire: function() {
  30782. self.fireWith( this, arguments );
  30783. return this;
  30784. },
  30785. // To know if the callbacks have already been called at least once
  30786. fired: function() {
  30787. return !!fired;
  30788. }
  30789. };
  30790. return self;
  30791. };
  30792. function Identity( v ) {
  30793. return v;
  30794. }
  30795. function Thrower( ex ) {
  30796. throw ex;
  30797. }
  30798. function adoptValue( value, resolve, reject, noValue ) {
  30799. var method;
  30800. try {
  30801. // Check for promise aspect first to privilege synchronous behavior
  30802. if ( value && isFunction( ( method = value.promise ) ) ) {
  30803. method.call( value ).done( resolve ).fail( reject );
  30804. // Other thenables
  30805. } else if ( value && isFunction( ( method = value.then ) ) ) {
  30806. method.call( value, resolve, reject );
  30807. // Other non-thenables
  30808. } else {
  30809. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  30810. // * false: [ value ].slice( 0 ) => resolve( value )
  30811. // * true: [ value ].slice( 1 ) => resolve()
  30812. resolve.apply( undefined, [ value ].slice( noValue ) );
  30813. }
  30814. // For Promises/A+, convert exceptions into rejections
  30815. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  30816. // Deferred#then to conditionally suppress rejection.
  30817. } catch ( value ) {
  30818. // Support: Android 4.0 only
  30819. // Strict mode functions invoked without .call/.apply get global-object context
  30820. reject.apply( undefined, [ value ] );
  30821. }
  30822. }
  30823. jQuery.extend( {
  30824. Deferred: function( func ) {
  30825. var tuples = [
  30826. // action, add listener, callbacks,
  30827. // ... .then handlers, argument index, [final state]
  30828. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  30829. jQuery.Callbacks( "memory" ), 2 ],
  30830. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  30831. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  30832. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  30833. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  30834. ],
  30835. state = "pending",
  30836. promise = {
  30837. state: function() {
  30838. return state;
  30839. },
  30840. always: function() {
  30841. deferred.done( arguments ).fail( arguments );
  30842. return this;
  30843. },
  30844. "catch": function( fn ) {
  30845. return promise.then( null, fn );
  30846. },
  30847. // Keep pipe for back-compat
  30848. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  30849. var fns = arguments;
  30850. return jQuery.Deferred( function( newDefer ) {
  30851. jQuery.each( tuples, function( i, tuple ) {
  30852. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  30853. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  30854. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  30855. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  30856. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  30857. deferred[ tuple[ 1 ] ]( function() {
  30858. var returned = fn && fn.apply( this, arguments );
  30859. if ( returned && isFunction( returned.promise ) ) {
  30860. returned.promise()
  30861. .progress( newDefer.notify )
  30862. .done( newDefer.resolve )
  30863. .fail( newDefer.reject );
  30864. } else {
  30865. newDefer[ tuple[ 0 ] + "With" ](
  30866. this,
  30867. fn ? [ returned ] : arguments
  30868. );
  30869. }
  30870. } );
  30871. } );
  30872. fns = null;
  30873. } ).promise();
  30874. },
  30875. then: function( onFulfilled, onRejected, onProgress ) {
  30876. var maxDepth = 0;
  30877. function resolve( depth, deferred, handler, special ) {
  30878. return function() {
  30879. var that = this,
  30880. args = arguments,
  30881. mightThrow = function() {
  30882. var returned, then;
  30883. // Support: Promises/A+ section 2.3.3.3.3
  30884. // https://promisesaplus.com/#point-59
  30885. // Ignore double-resolution attempts
  30886. if ( depth < maxDepth ) {
  30887. return;
  30888. }
  30889. returned = handler.apply( that, args );
  30890. // Support: Promises/A+ section 2.3.1
  30891. // https://promisesaplus.com/#point-48
  30892. if ( returned === deferred.promise() ) {
  30893. throw new TypeError( "Thenable self-resolution" );
  30894. }
  30895. // Support: Promises/A+ sections 2.3.3.1, 3.5
  30896. // https://promisesaplus.com/#point-54
  30897. // https://promisesaplus.com/#point-75
  30898. // Retrieve `then` only once
  30899. then = returned &&
  30900. // Support: Promises/A+ section 2.3.4
  30901. // https://promisesaplus.com/#point-64
  30902. // Only check objects and functions for thenability
  30903. ( typeof returned === "object" ||
  30904. typeof returned === "function" ) &&
  30905. returned.then;
  30906. // Handle a returned thenable
  30907. if ( isFunction( then ) ) {
  30908. // Special processors (notify) just wait for resolution
  30909. if ( special ) {
  30910. then.call(
  30911. returned,
  30912. resolve( maxDepth, deferred, Identity, special ),
  30913. resolve( maxDepth, deferred, Thrower, special )
  30914. );
  30915. // Normal processors (resolve) also hook into progress
  30916. } else {
  30917. // ...and disregard older resolution values
  30918. maxDepth++;
  30919. then.call(
  30920. returned,
  30921. resolve( maxDepth, deferred, Identity, special ),
  30922. resolve( maxDepth, deferred, Thrower, special ),
  30923. resolve( maxDepth, deferred, Identity,
  30924. deferred.notifyWith )
  30925. );
  30926. }
  30927. // Handle all other returned values
  30928. } else {
  30929. // Only substitute handlers pass on context
  30930. // and multiple values (non-spec behavior)
  30931. if ( handler !== Identity ) {
  30932. that = undefined;
  30933. args = [ returned ];
  30934. }
  30935. // Process the value(s)
  30936. // Default process is resolve
  30937. ( special || deferred.resolveWith )( that, args );
  30938. }
  30939. },
  30940. // Only normal processors (resolve) catch and reject exceptions
  30941. process = special ?
  30942. mightThrow :
  30943. function() {
  30944. try {
  30945. mightThrow();
  30946. } catch ( e ) {
  30947. if ( jQuery.Deferred.exceptionHook ) {
  30948. jQuery.Deferred.exceptionHook( e,
  30949. process.stackTrace );
  30950. }
  30951. // Support: Promises/A+ section 2.3.3.3.4.1
  30952. // https://promisesaplus.com/#point-61
  30953. // Ignore post-resolution exceptions
  30954. if ( depth + 1 >= maxDepth ) {
  30955. // Only substitute handlers pass on context
  30956. // and multiple values (non-spec behavior)
  30957. if ( handler !== Thrower ) {
  30958. that = undefined;
  30959. args = [ e ];
  30960. }
  30961. deferred.rejectWith( that, args );
  30962. }
  30963. }
  30964. };
  30965. // Support: Promises/A+ section 2.3.3.3.1
  30966. // https://promisesaplus.com/#point-57
  30967. // Re-resolve promises immediately to dodge false rejection from
  30968. // subsequent errors
  30969. if ( depth ) {
  30970. process();
  30971. } else {
  30972. // Call an optional hook to record the stack, in case of exception
  30973. // since it's otherwise lost when execution goes async
  30974. if ( jQuery.Deferred.getStackHook ) {
  30975. process.stackTrace = jQuery.Deferred.getStackHook();
  30976. }
  30977. window.setTimeout( process );
  30978. }
  30979. };
  30980. }
  30981. return jQuery.Deferred( function( newDefer ) {
  30982. // progress_handlers.add( ... )
  30983. tuples[ 0 ][ 3 ].add(
  30984. resolve(
  30985. 0,
  30986. newDefer,
  30987. isFunction( onProgress ) ?
  30988. onProgress :
  30989. Identity,
  30990. newDefer.notifyWith
  30991. )
  30992. );
  30993. // fulfilled_handlers.add( ... )
  30994. tuples[ 1 ][ 3 ].add(
  30995. resolve(
  30996. 0,
  30997. newDefer,
  30998. isFunction( onFulfilled ) ?
  30999. onFulfilled :
  31000. Identity
  31001. )
  31002. );
  31003. // rejected_handlers.add( ... )
  31004. tuples[ 2 ][ 3 ].add(
  31005. resolve(
  31006. 0,
  31007. newDefer,
  31008. isFunction( onRejected ) ?
  31009. onRejected :
  31010. Thrower
  31011. )
  31012. );
  31013. } ).promise();
  31014. },
  31015. // Get a promise for this deferred
  31016. // If obj is provided, the promise aspect is added to the object
  31017. promise: function( obj ) {
  31018. return obj != null ? jQuery.extend( obj, promise ) : promise;
  31019. }
  31020. },
  31021. deferred = {};
  31022. // Add list-specific methods
  31023. jQuery.each( tuples, function( i, tuple ) {
  31024. var list = tuple[ 2 ],
  31025. stateString = tuple[ 5 ];
  31026. // promise.progress = list.add
  31027. // promise.done = list.add
  31028. // promise.fail = list.add
  31029. promise[ tuple[ 1 ] ] = list.add;
  31030. // Handle state
  31031. if ( stateString ) {
  31032. list.add(
  31033. function() {
  31034. // state = "resolved" (i.e., fulfilled)
  31035. // state = "rejected"
  31036. state = stateString;
  31037. },
  31038. // rejected_callbacks.disable
  31039. // fulfilled_callbacks.disable
  31040. tuples[ 3 - i ][ 2 ].disable,
  31041. // rejected_handlers.disable
  31042. // fulfilled_handlers.disable
  31043. tuples[ 3 - i ][ 3 ].disable,
  31044. // progress_callbacks.lock
  31045. tuples[ 0 ][ 2 ].lock,
  31046. // progress_handlers.lock
  31047. tuples[ 0 ][ 3 ].lock
  31048. );
  31049. }
  31050. // progress_handlers.fire
  31051. // fulfilled_handlers.fire
  31052. // rejected_handlers.fire
  31053. list.add( tuple[ 3 ].fire );
  31054. // deferred.notify = function() { deferred.notifyWith(...) }
  31055. // deferred.resolve = function() { deferred.resolveWith(...) }
  31056. // deferred.reject = function() { deferred.rejectWith(...) }
  31057. deferred[ tuple[ 0 ] ] = function() {
  31058. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  31059. return this;
  31060. };
  31061. // deferred.notifyWith = list.fireWith
  31062. // deferred.resolveWith = list.fireWith
  31063. // deferred.rejectWith = list.fireWith
  31064. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  31065. } );
  31066. // Make the deferred a promise
  31067. promise.promise( deferred );
  31068. // Call given func if any
  31069. if ( func ) {
  31070. func.call( deferred, deferred );
  31071. }
  31072. // All done!
  31073. return deferred;
  31074. },
  31075. // Deferred helper
  31076. when: function( singleValue ) {
  31077. var
  31078. // count of uncompleted subordinates
  31079. remaining = arguments.length,
  31080. // count of unprocessed arguments
  31081. i = remaining,
  31082. // subordinate fulfillment data
  31083. resolveContexts = Array( i ),
  31084. resolveValues = slice.call( arguments ),
  31085. // the master Deferred
  31086. master = jQuery.Deferred(),
  31087. // subordinate callback factory
  31088. updateFunc = function( i ) {
  31089. return function( value ) {
  31090. resolveContexts[ i ] = this;
  31091. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  31092. if ( !( --remaining ) ) {
  31093. master.resolveWith( resolveContexts, resolveValues );
  31094. }
  31095. };
  31096. };
  31097. // Single- and empty arguments are adopted like Promise.resolve
  31098. if ( remaining <= 1 ) {
  31099. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  31100. !remaining );
  31101. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  31102. if ( master.state() === "pending" ||
  31103. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  31104. return master.then();
  31105. }
  31106. }
  31107. // Multiple arguments are aggregated like Promise.all array elements
  31108. while ( i-- ) {
  31109. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  31110. }
  31111. return master.promise();
  31112. }
  31113. } );
  31114. // These usually indicate a programmer mistake during development,
  31115. // warn about them ASAP rather than swallowing them by default.
  31116. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  31117. jQuery.Deferred.exceptionHook = function( error, stack ) {
  31118. // Support: IE 8 - 9 only
  31119. // Console exists when dev tools are open, which can happen at any time
  31120. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  31121. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  31122. }
  31123. };
  31124. jQuery.readyException = function( error ) {
  31125. window.setTimeout( function() {
  31126. throw error;
  31127. } );
  31128. };
  31129. // The deferred used on DOM ready
  31130. var readyList = jQuery.Deferred();
  31131. jQuery.fn.ready = function( fn ) {
  31132. readyList
  31133. .then( fn )
  31134. // Wrap jQuery.readyException in a function so that the lookup
  31135. // happens at the time of error handling instead of callback
  31136. // registration.
  31137. .catch( function( error ) {
  31138. jQuery.readyException( error );
  31139. } );
  31140. return this;
  31141. };
  31142. jQuery.extend( {
  31143. // Is the DOM ready to be used? Set to true once it occurs.
  31144. isReady: false,
  31145. // A counter to track how many items to wait for before
  31146. // the ready event fires. See #6781
  31147. readyWait: 1,
  31148. // Handle when the DOM is ready
  31149. ready: function( wait ) {
  31150. // Abort if there are pending holds or we're already ready
  31151. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  31152. return;
  31153. }
  31154. // Remember that the DOM is ready
  31155. jQuery.isReady = true;
  31156. // If a normal DOM Ready event fired, decrement, and wait if need be
  31157. if ( wait !== true && --jQuery.readyWait > 0 ) {
  31158. return;
  31159. }
  31160. // If there are functions bound, to execute
  31161. readyList.resolveWith( document, [ jQuery ] );
  31162. }
  31163. } );
  31164. jQuery.ready.then = readyList.then;
  31165. // The ready event handler and self cleanup method
  31166. function completed() {
  31167. document.removeEventListener( "DOMContentLoaded", completed );
  31168. window.removeEventListener( "load", completed );
  31169. jQuery.ready();
  31170. }
  31171. // Catch cases where $(document).ready() is called
  31172. // after the browser event has already occurred.
  31173. // Support: IE <=9 - 10 only
  31174. // Older IE sometimes signals "interactive" too soon
  31175. if ( document.readyState === "complete" ||
  31176. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  31177. // Handle it asynchronously to allow scripts the opportunity to delay ready
  31178. window.setTimeout( jQuery.ready );
  31179. } else {
  31180. // Use the handy event callback
  31181. document.addEventListener( "DOMContentLoaded", completed );
  31182. // A fallback to window.onload, that will always work
  31183. window.addEventListener( "load", completed );
  31184. }
  31185. // Multifunctional method to get and set values of a collection
  31186. // The value/s can optionally be executed if it's a function
  31187. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  31188. var i = 0,
  31189. len = elems.length,
  31190. bulk = key == null;
  31191. // Sets many values
  31192. if ( toType( key ) === "object" ) {
  31193. chainable = true;
  31194. for ( i in key ) {
  31195. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  31196. }
  31197. // Sets one value
  31198. } else if ( value !== undefined ) {
  31199. chainable = true;
  31200. if ( !isFunction( value ) ) {
  31201. raw = true;
  31202. }
  31203. if ( bulk ) {
  31204. // Bulk operations run against the entire set
  31205. if ( raw ) {
  31206. fn.call( elems, value );
  31207. fn = null;
  31208. // ...except when executing function values
  31209. } else {
  31210. bulk = fn;
  31211. fn = function( elem, key, value ) {
  31212. return bulk.call( jQuery( elem ), value );
  31213. };
  31214. }
  31215. }
  31216. if ( fn ) {
  31217. for ( ; i < len; i++ ) {
  31218. fn(
  31219. elems[ i ], key, raw ?
  31220. value :
  31221. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  31222. );
  31223. }
  31224. }
  31225. }
  31226. if ( chainable ) {
  31227. return elems;
  31228. }
  31229. // Gets
  31230. if ( bulk ) {
  31231. return fn.call( elems );
  31232. }
  31233. return len ? fn( elems[ 0 ], key ) : emptyGet;
  31234. };
  31235. // Matches dashed string for camelizing
  31236. var rmsPrefix = /^-ms-/,
  31237. rdashAlpha = /-([a-z])/g;
  31238. // Used by camelCase as callback to replace()
  31239. function fcamelCase( all, letter ) {
  31240. return letter.toUpperCase();
  31241. }
  31242. // Convert dashed to camelCase; used by the css and data modules
  31243. // Support: IE <=9 - 11, Edge 12 - 15
  31244. // Microsoft forgot to hump their vendor prefix (#9572)
  31245. function camelCase( string ) {
  31246. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  31247. }
  31248. var acceptData = function( owner ) {
  31249. // Accepts only:
  31250. // - Node
  31251. // - Node.ELEMENT_NODE
  31252. // - Node.DOCUMENT_NODE
  31253. // - Object
  31254. // - Any
  31255. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  31256. };
  31257. function Data() {
  31258. this.expando = jQuery.expando + Data.uid++;
  31259. }
  31260. Data.uid = 1;
  31261. Data.prototype = {
  31262. cache: function( owner ) {
  31263. // Check if the owner object already has a cache
  31264. var value = owner[ this.expando ];
  31265. // If not, create one
  31266. if ( !value ) {
  31267. value = {};
  31268. // We can accept data for non-element nodes in modern browsers,
  31269. // but we should not, see #8335.
  31270. // Always return an empty object.
  31271. if ( acceptData( owner ) ) {
  31272. // If it is a node unlikely to be stringify-ed or looped over
  31273. // use plain assignment
  31274. if ( owner.nodeType ) {
  31275. owner[ this.expando ] = value;
  31276. // Otherwise secure it in a non-enumerable property
  31277. // configurable must be true to allow the property to be
  31278. // deleted when data is removed
  31279. } else {
  31280. Object.defineProperty( owner, this.expando, {
  31281. value: value,
  31282. configurable: true
  31283. } );
  31284. }
  31285. }
  31286. }
  31287. return value;
  31288. },
  31289. set: function( owner, data, value ) {
  31290. var prop,
  31291. cache = this.cache( owner );
  31292. // Handle: [ owner, key, value ] args
  31293. // Always use camelCase key (gh-2257)
  31294. if ( typeof data === "string" ) {
  31295. cache[ camelCase( data ) ] = value;
  31296. // Handle: [ owner, { properties } ] args
  31297. } else {
  31298. // Copy the properties one-by-one to the cache object
  31299. for ( prop in data ) {
  31300. cache[ camelCase( prop ) ] = data[ prop ];
  31301. }
  31302. }
  31303. return cache;
  31304. },
  31305. get: function( owner, key ) {
  31306. return key === undefined ?
  31307. this.cache( owner ) :
  31308. // Always use camelCase key (gh-2257)
  31309. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  31310. },
  31311. access: function( owner, key, value ) {
  31312. // In cases where either:
  31313. //
  31314. // 1. No key was specified
  31315. // 2. A string key was specified, but no value provided
  31316. //
  31317. // Take the "read" path and allow the get method to determine
  31318. // which value to return, respectively either:
  31319. //
  31320. // 1. The entire cache object
  31321. // 2. The data stored at the key
  31322. //
  31323. if ( key === undefined ||
  31324. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  31325. return this.get( owner, key );
  31326. }
  31327. // When the key is not a string, or both a key and value
  31328. // are specified, set or extend (existing objects) with either:
  31329. //
  31330. // 1. An object of properties
  31331. // 2. A key and value
  31332. //
  31333. this.set( owner, key, value );
  31334. // Since the "set" path can have two possible entry points
  31335. // return the expected data based on which path was taken[*]
  31336. return value !== undefined ? value : key;
  31337. },
  31338. remove: function( owner, key ) {
  31339. var i,
  31340. cache = owner[ this.expando ];
  31341. if ( cache === undefined ) {
  31342. return;
  31343. }
  31344. if ( key !== undefined ) {
  31345. // Support array or space separated string of keys
  31346. if ( Array.isArray( key ) ) {
  31347. // If key is an array of keys...
  31348. // We always set camelCase keys, so remove that.
  31349. key = key.map( camelCase );
  31350. } else {
  31351. key = camelCase( key );
  31352. // If a key with the spaces exists, use it.
  31353. // Otherwise, create an array by matching non-whitespace
  31354. key = key in cache ?
  31355. [ key ] :
  31356. ( key.match( rnothtmlwhite ) || [] );
  31357. }
  31358. i = key.length;
  31359. while ( i-- ) {
  31360. delete cache[ key[ i ] ];
  31361. }
  31362. }
  31363. // Remove the expando if there's no more data
  31364. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  31365. // Support: Chrome <=35 - 45
  31366. // Webkit & Blink performance suffers when deleting properties
  31367. // from DOM nodes, so set to undefined instead
  31368. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  31369. if ( owner.nodeType ) {
  31370. owner[ this.expando ] = undefined;
  31371. } else {
  31372. delete owner[ this.expando ];
  31373. }
  31374. }
  31375. },
  31376. hasData: function( owner ) {
  31377. var cache = owner[ this.expando ];
  31378. return cache !== undefined && !jQuery.isEmptyObject( cache );
  31379. }
  31380. };
  31381. var dataPriv = new Data();
  31382. var dataUser = new Data();
  31383. // Implementation Summary
  31384. //
  31385. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  31386. // 2. Improve the module's maintainability by reducing the storage
  31387. // paths to a single mechanism.
  31388. // 3. Use the same single mechanism to support "private" and "user" data.
  31389. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  31390. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  31391. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  31392. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  31393. rmultiDash = /[A-Z]/g;
  31394. function getData( data ) {
  31395. if ( data === "true" ) {
  31396. return true;
  31397. }
  31398. if ( data === "false" ) {
  31399. return false;
  31400. }
  31401. if ( data === "null" ) {
  31402. return null;
  31403. }
  31404. // Only convert to a number if it doesn't change the string
  31405. if ( data === +data + "" ) {
  31406. return +data;
  31407. }
  31408. if ( rbrace.test( data ) ) {
  31409. return JSON.parse( data );
  31410. }
  31411. return data;
  31412. }
  31413. function dataAttr( elem, key, data ) {
  31414. var name;
  31415. // If nothing was found internally, try to fetch any
  31416. // data from the HTML5 data-* attribute
  31417. if ( data === undefined && elem.nodeType === 1 ) {
  31418. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  31419. data = elem.getAttribute( name );
  31420. if ( typeof data === "string" ) {
  31421. try {
  31422. data = getData( data );
  31423. } catch ( e ) {}
  31424. // Make sure we set the data so it isn't changed later
  31425. dataUser.set( elem, key, data );
  31426. } else {
  31427. data = undefined;
  31428. }
  31429. }
  31430. return data;
  31431. }
  31432. jQuery.extend( {
  31433. hasData: function( elem ) {
  31434. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  31435. },
  31436. data: function( elem, name, data ) {
  31437. return dataUser.access( elem, name, data );
  31438. },
  31439. removeData: function( elem, name ) {
  31440. dataUser.remove( elem, name );
  31441. },
  31442. // TODO: Now that all calls to _data and _removeData have been replaced
  31443. // with direct calls to dataPriv methods, these can be deprecated.
  31444. _data: function( elem, name, data ) {
  31445. return dataPriv.access( elem, name, data );
  31446. },
  31447. _removeData: function( elem, name ) {
  31448. dataPriv.remove( elem, name );
  31449. }
  31450. } );
  31451. jQuery.fn.extend( {
  31452. data: function( key, value ) {
  31453. var i, name, data,
  31454. elem = this[ 0 ],
  31455. attrs = elem && elem.attributes;
  31456. // Gets all values
  31457. if ( key === undefined ) {
  31458. if ( this.length ) {
  31459. data = dataUser.get( elem );
  31460. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  31461. i = attrs.length;
  31462. while ( i-- ) {
  31463. // Support: IE 11 only
  31464. // The attrs elements can be null (#14894)
  31465. if ( attrs[ i ] ) {
  31466. name = attrs[ i ].name;
  31467. if ( name.indexOf( "data-" ) === 0 ) {
  31468. name = camelCase( name.slice( 5 ) );
  31469. dataAttr( elem, name, data[ name ] );
  31470. }
  31471. }
  31472. }
  31473. dataPriv.set( elem, "hasDataAttrs", true );
  31474. }
  31475. }
  31476. return data;
  31477. }
  31478. // Sets multiple values
  31479. if ( typeof key === "object" ) {
  31480. return this.each( function() {
  31481. dataUser.set( this, key );
  31482. } );
  31483. }
  31484. return access( this, function( value ) {
  31485. var data;
  31486. // The calling jQuery object (element matches) is not empty
  31487. // (and therefore has an element appears at this[ 0 ]) and the
  31488. // `value` parameter was not undefined. An empty jQuery object
  31489. // will result in `undefined` for elem = this[ 0 ] which will
  31490. // throw an exception if an attempt to read a data cache is made.
  31491. if ( elem && value === undefined ) {
  31492. // Attempt to get data from the cache
  31493. // The key will always be camelCased in Data
  31494. data = dataUser.get( elem, key );
  31495. if ( data !== undefined ) {
  31496. return data;
  31497. }
  31498. // Attempt to "discover" the data in
  31499. // HTML5 custom data-* attrs
  31500. data = dataAttr( elem, key );
  31501. if ( data !== undefined ) {
  31502. return data;
  31503. }
  31504. // We tried really hard, but the data doesn't exist.
  31505. return;
  31506. }
  31507. // Set the data...
  31508. this.each( function() {
  31509. // We always store the camelCased key
  31510. dataUser.set( this, key, value );
  31511. } );
  31512. }, null, value, arguments.length > 1, null, true );
  31513. },
  31514. removeData: function( key ) {
  31515. return this.each( function() {
  31516. dataUser.remove( this, key );
  31517. } );
  31518. }
  31519. } );
  31520. jQuery.extend( {
  31521. queue: function( elem, type, data ) {
  31522. var queue;
  31523. if ( elem ) {
  31524. type = ( type || "fx" ) + "queue";
  31525. queue = dataPriv.get( elem, type );
  31526. // Speed up dequeue by getting out quickly if this is just a lookup
  31527. if ( data ) {
  31528. if ( !queue || Array.isArray( data ) ) {
  31529. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  31530. } else {
  31531. queue.push( data );
  31532. }
  31533. }
  31534. return queue || [];
  31535. }
  31536. },
  31537. dequeue: function( elem, type ) {
  31538. type = type || "fx";
  31539. var queue = jQuery.queue( elem, type ),
  31540. startLength = queue.length,
  31541. fn = queue.shift(),
  31542. hooks = jQuery._queueHooks( elem, type ),
  31543. next = function() {
  31544. jQuery.dequeue( elem, type );
  31545. };
  31546. // If the fx queue is dequeued, always remove the progress sentinel
  31547. if ( fn === "inprogress" ) {
  31548. fn = queue.shift();
  31549. startLength--;
  31550. }
  31551. if ( fn ) {
  31552. // Add a progress sentinel to prevent the fx queue from being
  31553. // automatically dequeued
  31554. if ( type === "fx" ) {
  31555. queue.unshift( "inprogress" );
  31556. }
  31557. // Clear up the last queue stop function
  31558. delete hooks.stop;
  31559. fn.call( elem, next, hooks );
  31560. }
  31561. if ( !startLength && hooks ) {
  31562. hooks.empty.fire();
  31563. }
  31564. },
  31565. // Not public - generate a queueHooks object, or return the current one
  31566. _queueHooks: function( elem, type ) {
  31567. var key = type + "queueHooks";
  31568. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  31569. empty: jQuery.Callbacks( "once memory" ).add( function() {
  31570. dataPriv.remove( elem, [ type + "queue", key ] );
  31571. } )
  31572. } );
  31573. }
  31574. } );
  31575. jQuery.fn.extend( {
  31576. queue: function( type, data ) {
  31577. var setter = 2;
  31578. if ( typeof type !== "string" ) {
  31579. data = type;
  31580. type = "fx";
  31581. setter--;
  31582. }
  31583. if ( arguments.length < setter ) {
  31584. return jQuery.queue( this[ 0 ], type );
  31585. }
  31586. return data === undefined ?
  31587. this :
  31588. this.each( function() {
  31589. var queue = jQuery.queue( this, type, data );
  31590. // Ensure a hooks for this queue
  31591. jQuery._queueHooks( this, type );
  31592. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  31593. jQuery.dequeue( this, type );
  31594. }
  31595. } );
  31596. },
  31597. dequeue: function( type ) {
  31598. return this.each( function() {
  31599. jQuery.dequeue( this, type );
  31600. } );
  31601. },
  31602. clearQueue: function( type ) {
  31603. return this.queue( type || "fx", [] );
  31604. },
  31605. // Get a promise resolved when queues of a certain type
  31606. // are emptied (fx is the type by default)
  31607. promise: function( type, obj ) {
  31608. var tmp,
  31609. count = 1,
  31610. defer = jQuery.Deferred(),
  31611. elements = this,
  31612. i = this.length,
  31613. resolve = function() {
  31614. if ( !( --count ) ) {
  31615. defer.resolveWith( elements, [ elements ] );
  31616. }
  31617. };
  31618. if ( typeof type !== "string" ) {
  31619. obj = type;
  31620. type = undefined;
  31621. }
  31622. type = type || "fx";
  31623. while ( i-- ) {
  31624. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  31625. if ( tmp && tmp.empty ) {
  31626. count++;
  31627. tmp.empty.add( resolve );
  31628. }
  31629. }
  31630. resolve();
  31631. return defer.promise( obj );
  31632. }
  31633. } );
  31634. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  31635. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  31636. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  31637. var isHiddenWithinTree = function( elem, el ) {
  31638. // isHiddenWithinTree might be called from jQuery#filter function;
  31639. // in that case, element will be second argument
  31640. elem = el || elem;
  31641. // Inline style trumps all
  31642. return elem.style.display === "none" ||
  31643. elem.style.display === "" &&
  31644. // Otherwise, check computed style
  31645. // Support: Firefox <=43 - 45
  31646. // Disconnected elements can have computed display: none, so first confirm that elem is
  31647. // in the document.
  31648. jQuery.contains( elem.ownerDocument, elem ) &&
  31649. jQuery.css( elem, "display" ) === "none";
  31650. };
  31651. var swap = function( elem, options, callback, args ) {
  31652. var ret, name,
  31653. old = {};
  31654. // Remember the old values, and insert the new ones
  31655. for ( name in options ) {
  31656. old[ name ] = elem.style[ name ];
  31657. elem.style[ name ] = options[ name ];
  31658. }
  31659. ret = callback.apply( elem, args || [] );
  31660. // Revert the old values
  31661. for ( name in options ) {
  31662. elem.style[ name ] = old[ name ];
  31663. }
  31664. return ret;
  31665. };
  31666. function adjustCSS( elem, prop, valueParts, tween ) {
  31667. var adjusted, scale,
  31668. maxIterations = 20,
  31669. currentValue = tween ?
  31670. function() {
  31671. return tween.cur();
  31672. } :
  31673. function() {
  31674. return jQuery.css( elem, prop, "" );
  31675. },
  31676. initial = currentValue(),
  31677. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  31678. // Starting value computation is required for potential unit mismatches
  31679. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  31680. rcssNum.exec( jQuery.css( elem, prop ) );
  31681. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  31682. // Support: Firefox <=54
  31683. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  31684. initial = initial / 2;
  31685. // Trust units reported by jQuery.css
  31686. unit = unit || initialInUnit[ 3 ];
  31687. // Iteratively approximate from a nonzero starting point
  31688. initialInUnit = +initial || 1;
  31689. while ( maxIterations-- ) {
  31690. // Evaluate and update our best guess (doubling guesses that zero out).
  31691. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  31692. jQuery.style( elem, prop, initialInUnit + unit );
  31693. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  31694. maxIterations = 0;
  31695. }
  31696. initialInUnit = initialInUnit / scale;
  31697. }
  31698. initialInUnit = initialInUnit * 2;
  31699. jQuery.style( elem, prop, initialInUnit + unit );
  31700. // Make sure we update the tween properties later on
  31701. valueParts = valueParts || [];
  31702. }
  31703. if ( valueParts ) {
  31704. initialInUnit = +initialInUnit || +initial || 0;
  31705. // Apply relative offset (+=/-=) if specified
  31706. adjusted = valueParts[ 1 ] ?
  31707. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  31708. +valueParts[ 2 ];
  31709. if ( tween ) {
  31710. tween.unit = unit;
  31711. tween.start = initialInUnit;
  31712. tween.end = adjusted;
  31713. }
  31714. }
  31715. return adjusted;
  31716. }
  31717. var defaultDisplayMap = {};
  31718. function getDefaultDisplay( elem ) {
  31719. var temp,
  31720. doc = elem.ownerDocument,
  31721. nodeName = elem.nodeName,
  31722. display = defaultDisplayMap[ nodeName ];
  31723. if ( display ) {
  31724. return display;
  31725. }
  31726. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  31727. display = jQuery.css( temp, "display" );
  31728. temp.parentNode.removeChild( temp );
  31729. if ( display === "none" ) {
  31730. display = "block";
  31731. }
  31732. defaultDisplayMap[ nodeName ] = display;
  31733. return display;
  31734. }
  31735. function showHide( elements, show ) {
  31736. var display, elem,
  31737. values = [],
  31738. index = 0,
  31739. length = elements.length;
  31740. // Determine new display value for elements that need to change
  31741. for ( ; index < length; index++ ) {
  31742. elem = elements[ index ];
  31743. if ( !elem.style ) {
  31744. continue;
  31745. }
  31746. display = elem.style.display;
  31747. if ( show ) {
  31748. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  31749. // check is required in this first loop unless we have a nonempty display value (either
  31750. // inline or about-to-be-restored)
  31751. if ( display === "none" ) {
  31752. values[ index ] = dataPriv.get( elem, "display" ) || null;
  31753. if ( !values[ index ] ) {
  31754. elem.style.display = "";
  31755. }
  31756. }
  31757. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  31758. values[ index ] = getDefaultDisplay( elem );
  31759. }
  31760. } else {
  31761. if ( display !== "none" ) {
  31762. values[ index ] = "none";
  31763. // Remember what we're overwriting
  31764. dataPriv.set( elem, "display", display );
  31765. }
  31766. }
  31767. }
  31768. // Set the display of the elements in a second loop to avoid constant reflow
  31769. for ( index = 0; index < length; index++ ) {
  31770. if ( values[ index ] != null ) {
  31771. elements[ index ].style.display = values[ index ];
  31772. }
  31773. }
  31774. return elements;
  31775. }
  31776. jQuery.fn.extend( {
  31777. show: function() {
  31778. return showHide( this, true );
  31779. },
  31780. hide: function() {
  31781. return showHide( this );
  31782. },
  31783. toggle: function( state ) {
  31784. if ( typeof state === "boolean" ) {
  31785. return state ? this.show() : this.hide();
  31786. }
  31787. return this.each( function() {
  31788. if ( isHiddenWithinTree( this ) ) {
  31789. jQuery( this ).show();
  31790. } else {
  31791. jQuery( this ).hide();
  31792. }
  31793. } );
  31794. }
  31795. } );
  31796. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  31797. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  31798. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  31799. // We have to close these tags to support XHTML (#13200)
  31800. var wrapMap = {
  31801. // Support: IE <=9 only
  31802. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  31803. // XHTML parsers do not magically insert elements in the
  31804. // same way that tag soup parsers do. So we cannot shorten
  31805. // this by omitting <tbody> or other required elements.
  31806. thead: [ 1, "<table>", "</table>" ],
  31807. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  31808. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  31809. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  31810. _default: [ 0, "", "" ]
  31811. };
  31812. // Support: IE <=9 only
  31813. wrapMap.optgroup = wrapMap.option;
  31814. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  31815. wrapMap.th = wrapMap.td;
  31816. function getAll( context, tag ) {
  31817. // Support: IE <=9 - 11 only
  31818. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  31819. var ret;
  31820. if ( typeof context.getElementsByTagName !== "undefined" ) {
  31821. ret = context.getElementsByTagName( tag || "*" );
  31822. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  31823. ret = context.querySelectorAll( tag || "*" );
  31824. } else {
  31825. ret = [];
  31826. }
  31827. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  31828. return jQuery.merge( [ context ], ret );
  31829. }
  31830. return ret;
  31831. }
  31832. // Mark scripts as having already been evaluated
  31833. function setGlobalEval( elems, refElements ) {
  31834. var i = 0,
  31835. l = elems.length;
  31836. for ( ; i < l; i++ ) {
  31837. dataPriv.set(
  31838. elems[ i ],
  31839. "globalEval",
  31840. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  31841. );
  31842. }
  31843. }
  31844. var rhtml = /<|&#?\w+;/;
  31845. function buildFragment( elems, context, scripts, selection, ignored ) {
  31846. var elem, tmp, tag, wrap, contains, j,
  31847. fragment = context.createDocumentFragment(),
  31848. nodes = [],
  31849. i = 0,
  31850. l = elems.length;
  31851. for ( ; i < l; i++ ) {
  31852. elem = elems[ i ];
  31853. if ( elem || elem === 0 ) {
  31854. // Add nodes directly
  31855. if ( toType( elem ) === "object" ) {
  31856. // Support: Android <=4.0 only, PhantomJS 1 only
  31857. // push.apply(_, arraylike) throws on ancient WebKit
  31858. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  31859. // Convert non-html into a text node
  31860. } else if ( !rhtml.test( elem ) ) {
  31861. nodes.push( context.createTextNode( elem ) );
  31862. // Convert html into DOM nodes
  31863. } else {
  31864. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  31865. // Deserialize a standard representation
  31866. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  31867. wrap = wrapMap[ tag ] || wrapMap._default;
  31868. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  31869. // Descend through wrappers to the right content
  31870. j = wrap[ 0 ];
  31871. while ( j-- ) {
  31872. tmp = tmp.lastChild;
  31873. }
  31874. // Support: Android <=4.0 only, PhantomJS 1 only
  31875. // push.apply(_, arraylike) throws on ancient WebKit
  31876. jQuery.merge( nodes, tmp.childNodes );
  31877. // Remember the top-level container
  31878. tmp = fragment.firstChild;
  31879. // Ensure the created nodes are orphaned (#12392)
  31880. tmp.textContent = "";
  31881. }
  31882. }
  31883. }
  31884. // Remove wrapper from fragment
  31885. fragment.textContent = "";
  31886. i = 0;
  31887. while ( ( elem = nodes[ i++ ] ) ) {
  31888. // Skip elements already in the context collection (trac-4087)
  31889. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  31890. if ( ignored ) {
  31891. ignored.push( elem );
  31892. }
  31893. continue;
  31894. }
  31895. contains = jQuery.contains( elem.ownerDocument, elem );
  31896. // Append to fragment
  31897. tmp = getAll( fragment.appendChild( elem ), "script" );
  31898. // Preserve script evaluation history
  31899. if ( contains ) {
  31900. setGlobalEval( tmp );
  31901. }
  31902. // Capture executables
  31903. if ( scripts ) {
  31904. j = 0;
  31905. while ( ( elem = tmp[ j++ ] ) ) {
  31906. if ( rscriptType.test( elem.type || "" ) ) {
  31907. scripts.push( elem );
  31908. }
  31909. }
  31910. }
  31911. }
  31912. return fragment;
  31913. }
  31914. ( function() {
  31915. var fragment = document.createDocumentFragment(),
  31916. div = fragment.appendChild( document.createElement( "div" ) ),
  31917. input = document.createElement( "input" );
  31918. // Support: Android 4.0 - 4.3 only
  31919. // Check state lost if the name is set (#11217)
  31920. // Support: Windows Web Apps (WWA)
  31921. // `name` and `type` must use .setAttribute for WWA (#14901)
  31922. input.setAttribute( "type", "radio" );
  31923. input.setAttribute( "checked", "checked" );
  31924. input.setAttribute( "name", "t" );
  31925. div.appendChild( input );
  31926. // Support: Android <=4.1 only
  31927. // Older WebKit doesn't clone checked state correctly in fragments
  31928. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  31929. // Support: IE <=11 only
  31930. // Make sure textarea (and checkbox) defaultValue is properly cloned
  31931. div.innerHTML = "<textarea>x</textarea>";
  31932. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  31933. } )();
  31934. var documentElement = document.documentElement;
  31935. var
  31936. rkeyEvent = /^key/,
  31937. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  31938. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  31939. function returnTrue() {
  31940. return true;
  31941. }
  31942. function returnFalse() {
  31943. return false;
  31944. }
  31945. // Support: IE <=9 only
  31946. // See #13393 for more info
  31947. function safeActiveElement() {
  31948. try {
  31949. return document.activeElement;
  31950. } catch ( err ) { }
  31951. }
  31952. function on( elem, types, selector, data, fn, one ) {
  31953. var origFn, type;
  31954. // Types can be a map of types/handlers
  31955. if ( typeof types === "object" ) {
  31956. // ( types-Object, selector, data )
  31957. if ( typeof selector !== "string" ) {
  31958. // ( types-Object, data )
  31959. data = data || selector;
  31960. selector = undefined;
  31961. }
  31962. for ( type in types ) {
  31963. on( elem, type, selector, data, types[ type ], one );
  31964. }
  31965. return elem;
  31966. }
  31967. if ( data == null && fn == null ) {
  31968. // ( types, fn )
  31969. fn = selector;
  31970. data = selector = undefined;
  31971. } else if ( fn == null ) {
  31972. if ( typeof selector === "string" ) {
  31973. // ( types, selector, fn )
  31974. fn = data;
  31975. data = undefined;
  31976. } else {
  31977. // ( types, data, fn )
  31978. fn = data;
  31979. data = selector;
  31980. selector = undefined;
  31981. }
  31982. }
  31983. if ( fn === false ) {
  31984. fn = returnFalse;
  31985. } else if ( !fn ) {
  31986. return elem;
  31987. }
  31988. if ( one === 1 ) {
  31989. origFn = fn;
  31990. fn = function( event ) {
  31991. // Can use an empty set, since event contains the info
  31992. jQuery().off( event );
  31993. return origFn.apply( this, arguments );
  31994. };
  31995. // Use same guid so caller can remove using origFn
  31996. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  31997. }
  31998. return elem.each( function() {
  31999. jQuery.event.add( this, types, fn, data, selector );
  32000. } );
  32001. }
  32002. /*
  32003. * Helper functions for managing events -- not part of the public interface.
  32004. * Props to Dean Edwards' addEvent library for many of the ideas.
  32005. */
  32006. jQuery.event = {
  32007. global: {},
  32008. add: function( elem, types, handler, data, selector ) {
  32009. var handleObjIn, eventHandle, tmp,
  32010. events, t, handleObj,
  32011. special, handlers, type, namespaces, origType,
  32012. elemData = dataPriv.get( elem );
  32013. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  32014. if ( !elemData ) {
  32015. return;
  32016. }
  32017. // Caller can pass in an object of custom data in lieu of the handler
  32018. if ( handler.handler ) {
  32019. handleObjIn = handler;
  32020. handler = handleObjIn.handler;
  32021. selector = handleObjIn.selector;
  32022. }
  32023. // Ensure that invalid selectors throw exceptions at attach time
  32024. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  32025. if ( selector ) {
  32026. jQuery.find.matchesSelector( documentElement, selector );
  32027. }
  32028. // Make sure that the handler has a unique ID, used to find/remove it later
  32029. if ( !handler.guid ) {
  32030. handler.guid = jQuery.guid++;
  32031. }
  32032. // Init the element's event structure and main handler, if this is the first
  32033. if ( !( events = elemData.events ) ) {
  32034. events = elemData.events = {};
  32035. }
  32036. if ( !( eventHandle = elemData.handle ) ) {
  32037. eventHandle = elemData.handle = function( e ) {
  32038. // Discard the second event of a jQuery.event.trigger() and
  32039. // when an event is called after a page has unloaded
  32040. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  32041. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  32042. };
  32043. }
  32044. // Handle multiple events separated by a space
  32045. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  32046. t = types.length;
  32047. while ( t-- ) {
  32048. tmp = rtypenamespace.exec( types[ t ] ) || [];
  32049. type = origType = tmp[ 1 ];
  32050. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  32051. // There *must* be a type, no attaching namespace-only handlers
  32052. if ( !type ) {
  32053. continue;
  32054. }
  32055. // If event changes its type, use the special event handlers for the changed type
  32056. special = jQuery.event.special[ type ] || {};
  32057. // If selector defined, determine special event api type, otherwise given type
  32058. type = ( selector ? special.delegateType : special.bindType ) || type;
  32059. // Update special based on newly reset type
  32060. special = jQuery.event.special[ type ] || {};
  32061. // handleObj is passed to all event handlers
  32062. handleObj = jQuery.extend( {
  32063. type: type,
  32064. origType: origType,
  32065. data: data,
  32066. handler: handler,
  32067. guid: handler.guid,
  32068. selector: selector,
  32069. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  32070. namespace: namespaces.join( "." )
  32071. }, handleObjIn );
  32072. // Init the event handler queue if we're the first
  32073. if ( !( handlers = events[ type ] ) ) {
  32074. handlers = events[ type ] = [];
  32075. handlers.delegateCount = 0;
  32076. // Only use addEventListener if the special events handler returns false
  32077. if ( !special.setup ||
  32078. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  32079. if ( elem.addEventListener ) {
  32080. elem.addEventListener( type, eventHandle );
  32081. }
  32082. }
  32083. }
  32084. if ( special.add ) {
  32085. special.add.call( elem, handleObj );
  32086. if ( !handleObj.handler.guid ) {
  32087. handleObj.handler.guid = handler.guid;
  32088. }
  32089. }
  32090. // Add to the element's handler list, delegates in front
  32091. if ( selector ) {
  32092. handlers.splice( handlers.delegateCount++, 0, handleObj );
  32093. } else {
  32094. handlers.push( handleObj );
  32095. }
  32096. // Keep track of which events have ever been used, for event optimization
  32097. jQuery.event.global[ type ] = true;
  32098. }
  32099. },
  32100. // Detach an event or set of events from an element
  32101. remove: function( elem, types, handler, selector, mappedTypes ) {
  32102. var j, origCount, tmp,
  32103. events, t, handleObj,
  32104. special, handlers, type, namespaces, origType,
  32105. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  32106. if ( !elemData || !( events = elemData.events ) ) {
  32107. return;
  32108. }
  32109. // Once for each type.namespace in types; type may be omitted
  32110. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  32111. t = types.length;
  32112. while ( t-- ) {
  32113. tmp = rtypenamespace.exec( types[ t ] ) || [];
  32114. type = origType = tmp[ 1 ];
  32115. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  32116. // Unbind all events (on this namespace, if provided) for the element
  32117. if ( !type ) {
  32118. for ( type in events ) {
  32119. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  32120. }
  32121. continue;
  32122. }
  32123. special = jQuery.event.special[ type ] || {};
  32124. type = ( selector ? special.delegateType : special.bindType ) || type;
  32125. handlers = events[ type ] || [];
  32126. tmp = tmp[ 2 ] &&
  32127. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  32128. // Remove matching events
  32129. origCount = j = handlers.length;
  32130. while ( j-- ) {
  32131. handleObj = handlers[ j ];
  32132. if ( ( mappedTypes || origType === handleObj.origType ) &&
  32133. ( !handler || handler.guid === handleObj.guid ) &&
  32134. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  32135. ( !selector || selector === handleObj.selector ||
  32136. selector === "**" && handleObj.selector ) ) {
  32137. handlers.splice( j, 1 );
  32138. if ( handleObj.selector ) {
  32139. handlers.delegateCount--;
  32140. }
  32141. if ( special.remove ) {
  32142. special.remove.call( elem, handleObj );
  32143. }
  32144. }
  32145. }
  32146. // Remove generic event handler if we removed something and no more handlers exist
  32147. // (avoids potential for endless recursion during removal of special event handlers)
  32148. if ( origCount && !handlers.length ) {
  32149. if ( !special.teardown ||
  32150. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  32151. jQuery.removeEvent( elem, type, elemData.handle );
  32152. }
  32153. delete events[ type ];
  32154. }
  32155. }
  32156. // Remove data and the expando if it's no longer used
  32157. if ( jQuery.isEmptyObject( events ) ) {
  32158. dataPriv.remove( elem, "handle events" );
  32159. }
  32160. },
  32161. dispatch: function( nativeEvent ) {
  32162. // Make a writable jQuery.Event from the native event object
  32163. var event = jQuery.event.fix( nativeEvent );
  32164. var i, j, ret, matched, handleObj, handlerQueue,
  32165. args = new Array( arguments.length ),
  32166. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  32167. special = jQuery.event.special[ event.type ] || {};
  32168. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  32169. args[ 0 ] = event;
  32170. for ( i = 1; i < arguments.length; i++ ) {
  32171. args[ i ] = arguments[ i ];
  32172. }
  32173. event.delegateTarget = this;
  32174. // Call the preDispatch hook for the mapped type, and let it bail if desired
  32175. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  32176. return;
  32177. }
  32178. // Determine handlers
  32179. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  32180. // Run delegates first; they may want to stop propagation beneath us
  32181. i = 0;
  32182. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  32183. event.currentTarget = matched.elem;
  32184. j = 0;
  32185. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  32186. !event.isImmediatePropagationStopped() ) {
  32187. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  32188. // a subset or equal to those in the bound event (both can have no namespace).
  32189. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  32190. event.handleObj = handleObj;
  32191. event.data = handleObj.data;
  32192. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  32193. handleObj.handler ).apply( matched.elem, args );
  32194. if ( ret !== undefined ) {
  32195. if ( ( event.result = ret ) === false ) {
  32196. event.preventDefault();
  32197. event.stopPropagation();
  32198. }
  32199. }
  32200. }
  32201. }
  32202. }
  32203. // Call the postDispatch hook for the mapped type
  32204. if ( special.postDispatch ) {
  32205. special.postDispatch.call( this, event );
  32206. }
  32207. return event.result;
  32208. },
  32209. handlers: function( event, handlers ) {
  32210. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  32211. handlerQueue = [],
  32212. delegateCount = handlers.delegateCount,
  32213. cur = event.target;
  32214. // Find delegate handlers
  32215. if ( delegateCount &&
  32216. // Support: IE <=9
  32217. // Black-hole SVG <use> instance trees (trac-13180)
  32218. cur.nodeType &&
  32219. // Support: Firefox <=42
  32220. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  32221. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  32222. // Support: IE 11 only
  32223. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  32224. !( event.type === "click" && event.button >= 1 ) ) {
  32225. for ( ; cur !== this; cur = cur.parentNode || this ) {
  32226. // Don't check non-elements (#13208)
  32227. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  32228. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  32229. matchedHandlers = [];
  32230. matchedSelectors = {};
  32231. for ( i = 0; i < delegateCount; i++ ) {
  32232. handleObj = handlers[ i ];
  32233. // Don't conflict with Object.prototype properties (#13203)
  32234. sel = handleObj.selector + " ";
  32235. if ( matchedSelectors[ sel ] === undefined ) {
  32236. matchedSelectors[ sel ] = handleObj.needsContext ?
  32237. jQuery( sel, this ).index( cur ) > -1 :
  32238. jQuery.find( sel, this, null, [ cur ] ).length;
  32239. }
  32240. if ( matchedSelectors[ sel ] ) {
  32241. matchedHandlers.push( handleObj );
  32242. }
  32243. }
  32244. if ( matchedHandlers.length ) {
  32245. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  32246. }
  32247. }
  32248. }
  32249. }
  32250. // Add the remaining (directly-bound) handlers
  32251. cur = this;
  32252. if ( delegateCount < handlers.length ) {
  32253. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  32254. }
  32255. return handlerQueue;
  32256. },
  32257. addProp: function( name, hook ) {
  32258. Object.defineProperty( jQuery.Event.prototype, name, {
  32259. enumerable: true,
  32260. configurable: true,
  32261. get: isFunction( hook ) ?
  32262. function() {
  32263. if ( this.originalEvent ) {
  32264. return hook( this.originalEvent );
  32265. }
  32266. } :
  32267. function() {
  32268. if ( this.originalEvent ) {
  32269. return this.originalEvent[ name ];
  32270. }
  32271. },
  32272. set: function( value ) {
  32273. Object.defineProperty( this, name, {
  32274. enumerable: true,
  32275. configurable: true,
  32276. writable: true,
  32277. value: value
  32278. } );
  32279. }
  32280. } );
  32281. },
  32282. fix: function( originalEvent ) {
  32283. return originalEvent[ jQuery.expando ] ?
  32284. originalEvent :
  32285. new jQuery.Event( originalEvent );
  32286. },
  32287. special: {
  32288. load: {
  32289. // Prevent triggered image.load events from bubbling to window.load
  32290. noBubble: true
  32291. },
  32292. focus: {
  32293. // Fire native event if possible so blur/focus sequence is correct
  32294. trigger: function() {
  32295. if ( this !== safeActiveElement() && this.focus ) {
  32296. this.focus();
  32297. return false;
  32298. }
  32299. },
  32300. delegateType: "focusin"
  32301. },
  32302. blur: {
  32303. trigger: function() {
  32304. if ( this === safeActiveElement() && this.blur ) {
  32305. this.blur();
  32306. return false;
  32307. }
  32308. },
  32309. delegateType: "focusout"
  32310. },
  32311. click: {
  32312. // For checkbox, fire native event so checked state will be right
  32313. trigger: function() {
  32314. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  32315. this.click();
  32316. return false;
  32317. }
  32318. },
  32319. // For cross-browser consistency, don't fire native .click() on links
  32320. _default: function( event ) {
  32321. return nodeName( event.target, "a" );
  32322. }
  32323. },
  32324. beforeunload: {
  32325. postDispatch: function( event ) {
  32326. // Support: Firefox 20+
  32327. // Firefox doesn't alert if the returnValue field is not set.
  32328. if ( event.result !== undefined && event.originalEvent ) {
  32329. event.originalEvent.returnValue = event.result;
  32330. }
  32331. }
  32332. }
  32333. }
  32334. };
  32335. jQuery.removeEvent = function( elem, type, handle ) {
  32336. // This "if" is needed for plain objects
  32337. if ( elem.removeEventListener ) {
  32338. elem.removeEventListener( type, handle );
  32339. }
  32340. };
  32341. jQuery.Event = function( src, props ) {
  32342. // Allow instantiation without the 'new' keyword
  32343. if ( !( this instanceof jQuery.Event ) ) {
  32344. return new jQuery.Event( src, props );
  32345. }
  32346. // Event object
  32347. if ( src && src.type ) {
  32348. this.originalEvent = src;
  32349. this.type = src.type;
  32350. // Events bubbling up the document may have been marked as prevented
  32351. // by a handler lower down the tree; reflect the correct value.
  32352. this.isDefaultPrevented = src.defaultPrevented ||
  32353. src.defaultPrevented === undefined &&
  32354. // Support: Android <=2.3 only
  32355. src.returnValue === false ?
  32356. returnTrue :
  32357. returnFalse;
  32358. // Create target properties
  32359. // Support: Safari <=6 - 7 only
  32360. // Target should not be a text node (#504, #13143)
  32361. this.target = ( src.target && src.target.nodeType === 3 ) ?
  32362. src.target.parentNode :
  32363. src.target;
  32364. this.currentTarget = src.currentTarget;
  32365. this.relatedTarget = src.relatedTarget;
  32366. // Event type
  32367. } else {
  32368. this.type = src;
  32369. }
  32370. // Put explicitly provided properties onto the event object
  32371. if ( props ) {
  32372. jQuery.extend( this, props );
  32373. }
  32374. // Create a timestamp if incoming event doesn't have one
  32375. this.timeStamp = src && src.timeStamp || Date.now();
  32376. // Mark it as fixed
  32377. this[ jQuery.expando ] = true;
  32378. };
  32379. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  32380. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  32381. jQuery.Event.prototype = {
  32382. constructor: jQuery.Event,
  32383. isDefaultPrevented: returnFalse,
  32384. isPropagationStopped: returnFalse,
  32385. isImmediatePropagationStopped: returnFalse,
  32386. isSimulated: false,
  32387. preventDefault: function() {
  32388. var e = this.originalEvent;
  32389. this.isDefaultPrevented = returnTrue;
  32390. if ( e && !this.isSimulated ) {
  32391. e.preventDefault();
  32392. }
  32393. },
  32394. stopPropagation: function() {
  32395. var e = this.originalEvent;
  32396. this.isPropagationStopped = returnTrue;
  32397. if ( e && !this.isSimulated ) {
  32398. e.stopPropagation();
  32399. }
  32400. },
  32401. stopImmediatePropagation: function() {
  32402. var e = this.originalEvent;
  32403. this.isImmediatePropagationStopped = returnTrue;
  32404. if ( e && !this.isSimulated ) {
  32405. e.stopImmediatePropagation();
  32406. }
  32407. this.stopPropagation();
  32408. }
  32409. };
  32410. // Includes all common event props including KeyEvent and MouseEvent specific props
  32411. jQuery.each( {
  32412. altKey: true,
  32413. bubbles: true,
  32414. cancelable: true,
  32415. changedTouches: true,
  32416. ctrlKey: true,
  32417. detail: true,
  32418. eventPhase: true,
  32419. metaKey: true,
  32420. pageX: true,
  32421. pageY: true,
  32422. shiftKey: true,
  32423. view: true,
  32424. "char": true,
  32425. charCode: true,
  32426. key: true,
  32427. keyCode: true,
  32428. button: true,
  32429. buttons: true,
  32430. clientX: true,
  32431. clientY: true,
  32432. offsetX: true,
  32433. offsetY: true,
  32434. pointerId: true,
  32435. pointerType: true,
  32436. screenX: true,
  32437. screenY: true,
  32438. targetTouches: true,
  32439. toElement: true,
  32440. touches: true,
  32441. which: function( event ) {
  32442. var button = event.button;
  32443. // Add which for key events
  32444. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  32445. return event.charCode != null ? event.charCode : event.keyCode;
  32446. }
  32447. // Add which for click: 1 === left; 2 === middle; 3 === right
  32448. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  32449. if ( button & 1 ) {
  32450. return 1;
  32451. }
  32452. if ( button & 2 ) {
  32453. return 3;
  32454. }
  32455. if ( button & 4 ) {
  32456. return 2;
  32457. }
  32458. return 0;
  32459. }
  32460. return event.which;
  32461. }
  32462. }, jQuery.event.addProp );
  32463. // Create mouseenter/leave events using mouseover/out and event-time checks
  32464. // so that event delegation works in jQuery.
  32465. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  32466. //
  32467. // Support: Safari 7 only
  32468. // Safari sends mouseenter too often; see:
  32469. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  32470. // for the description of the bug (it existed in older Chrome versions as well).
  32471. jQuery.each( {
  32472. mouseenter: "mouseover",
  32473. mouseleave: "mouseout",
  32474. pointerenter: "pointerover",
  32475. pointerleave: "pointerout"
  32476. }, function( orig, fix ) {
  32477. jQuery.event.special[ orig ] = {
  32478. delegateType: fix,
  32479. bindType: fix,
  32480. handle: function( event ) {
  32481. var ret,
  32482. target = this,
  32483. related = event.relatedTarget,
  32484. handleObj = event.handleObj;
  32485. // For mouseenter/leave call the handler if related is outside the target.
  32486. // NB: No relatedTarget if the mouse left/entered the browser window
  32487. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  32488. event.type = handleObj.origType;
  32489. ret = handleObj.handler.apply( this, arguments );
  32490. event.type = fix;
  32491. }
  32492. return ret;
  32493. }
  32494. };
  32495. } );
  32496. jQuery.fn.extend( {
  32497. on: function( types, selector, data, fn ) {
  32498. return on( this, types, selector, data, fn );
  32499. },
  32500. one: function( types, selector, data, fn ) {
  32501. return on( this, types, selector, data, fn, 1 );
  32502. },
  32503. off: function( types, selector, fn ) {
  32504. var handleObj, type;
  32505. if ( types && types.preventDefault && types.handleObj ) {
  32506. // ( event ) dispatched jQuery.Event
  32507. handleObj = types.handleObj;
  32508. jQuery( types.delegateTarget ).off(
  32509. handleObj.namespace ?
  32510. handleObj.origType + "." + handleObj.namespace :
  32511. handleObj.origType,
  32512. handleObj.selector,
  32513. handleObj.handler
  32514. );
  32515. return this;
  32516. }
  32517. if ( typeof types === "object" ) {
  32518. // ( types-object [, selector] )
  32519. for ( type in types ) {
  32520. this.off( type, selector, types[ type ] );
  32521. }
  32522. return this;
  32523. }
  32524. if ( selector === false || typeof selector === "function" ) {
  32525. // ( types [, fn] )
  32526. fn = selector;
  32527. selector = undefined;
  32528. }
  32529. if ( fn === false ) {
  32530. fn = returnFalse;
  32531. }
  32532. return this.each( function() {
  32533. jQuery.event.remove( this, types, fn, selector );
  32534. } );
  32535. }
  32536. } );
  32537. var
  32538. /* eslint-disable max-len */
  32539. // See https://github.com/eslint/eslint/issues/3229
  32540. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  32541. /* eslint-enable */
  32542. // Support: IE <=10 - 11, Edge 12 - 13 only
  32543. // In IE/Edge using regex groups here causes severe slowdowns.
  32544. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  32545. rnoInnerhtml = /<script|<style|<link/i,
  32546. // checked="checked" or checked
  32547. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  32548. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  32549. // Prefer a tbody over its parent table for containing new rows
  32550. function manipulationTarget( elem, content ) {
  32551. if ( nodeName( elem, "table" ) &&
  32552. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  32553. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  32554. }
  32555. return elem;
  32556. }
  32557. // Replace/restore the type attribute of script elements for safe DOM manipulation
  32558. function disableScript( elem ) {
  32559. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  32560. return elem;
  32561. }
  32562. function restoreScript( elem ) {
  32563. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  32564. elem.type = elem.type.slice( 5 );
  32565. } else {
  32566. elem.removeAttribute( "type" );
  32567. }
  32568. return elem;
  32569. }
  32570. function cloneCopyEvent( src, dest ) {
  32571. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  32572. if ( dest.nodeType !== 1 ) {
  32573. return;
  32574. }
  32575. // 1. Copy private data: events, handlers, etc.
  32576. if ( dataPriv.hasData( src ) ) {
  32577. pdataOld = dataPriv.access( src );
  32578. pdataCur = dataPriv.set( dest, pdataOld );
  32579. events = pdataOld.events;
  32580. if ( events ) {
  32581. delete pdataCur.handle;
  32582. pdataCur.events = {};
  32583. for ( type in events ) {
  32584. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  32585. jQuery.event.add( dest, type, events[ type ][ i ] );
  32586. }
  32587. }
  32588. }
  32589. }
  32590. // 2. Copy user data
  32591. if ( dataUser.hasData( src ) ) {
  32592. udataOld = dataUser.access( src );
  32593. udataCur = jQuery.extend( {}, udataOld );
  32594. dataUser.set( dest, udataCur );
  32595. }
  32596. }
  32597. // Fix IE bugs, see support tests
  32598. function fixInput( src, dest ) {
  32599. var nodeName = dest.nodeName.toLowerCase();
  32600. // Fails to persist the checked state of a cloned checkbox or radio button.
  32601. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  32602. dest.checked = src.checked;
  32603. // Fails to return the selected option to the default selected state when cloning options
  32604. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  32605. dest.defaultValue = src.defaultValue;
  32606. }
  32607. }
  32608. function domManip( collection, args, callback, ignored ) {
  32609. // Flatten any nested arrays
  32610. args = concat.apply( [], args );
  32611. var fragment, first, scripts, hasScripts, node, doc,
  32612. i = 0,
  32613. l = collection.length,
  32614. iNoClone = l - 1,
  32615. value = args[ 0 ],
  32616. valueIsFunction = isFunction( value );
  32617. // We can't cloneNode fragments that contain checked, in WebKit
  32618. if ( valueIsFunction ||
  32619. ( l > 1 && typeof value === "string" &&
  32620. !support.checkClone && rchecked.test( value ) ) ) {
  32621. return collection.each( function( index ) {
  32622. var self = collection.eq( index );
  32623. if ( valueIsFunction ) {
  32624. args[ 0 ] = value.call( this, index, self.html() );
  32625. }
  32626. domManip( self, args, callback, ignored );
  32627. } );
  32628. }
  32629. if ( l ) {
  32630. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  32631. first = fragment.firstChild;
  32632. if ( fragment.childNodes.length === 1 ) {
  32633. fragment = first;
  32634. }
  32635. // Require either new content or an interest in ignored elements to invoke the callback
  32636. if ( first || ignored ) {
  32637. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  32638. hasScripts = scripts.length;
  32639. // Use the original fragment for the last item
  32640. // instead of the first because it can end up
  32641. // being emptied incorrectly in certain situations (#8070).
  32642. for ( ; i < l; i++ ) {
  32643. node = fragment;
  32644. if ( i !== iNoClone ) {
  32645. node = jQuery.clone( node, true, true );
  32646. // Keep references to cloned scripts for later restoration
  32647. if ( hasScripts ) {
  32648. // Support: Android <=4.0 only, PhantomJS 1 only
  32649. // push.apply(_, arraylike) throws on ancient WebKit
  32650. jQuery.merge( scripts, getAll( node, "script" ) );
  32651. }
  32652. }
  32653. callback.call( collection[ i ], node, i );
  32654. }
  32655. if ( hasScripts ) {
  32656. doc = scripts[ scripts.length - 1 ].ownerDocument;
  32657. // Reenable scripts
  32658. jQuery.map( scripts, restoreScript );
  32659. // Evaluate executable scripts on first document insertion
  32660. for ( i = 0; i < hasScripts; i++ ) {
  32661. node = scripts[ i ];
  32662. if ( rscriptType.test( node.type || "" ) &&
  32663. !dataPriv.access( node, "globalEval" ) &&
  32664. jQuery.contains( doc, node ) ) {
  32665. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  32666. // Optional AJAX dependency, but won't run scripts if not present
  32667. if ( jQuery._evalUrl ) {
  32668. jQuery._evalUrl( node.src );
  32669. }
  32670. } else {
  32671. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  32672. }
  32673. }
  32674. }
  32675. }
  32676. }
  32677. }
  32678. return collection;
  32679. }
  32680. function remove( elem, selector, keepData ) {
  32681. var node,
  32682. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  32683. i = 0;
  32684. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  32685. if ( !keepData && node.nodeType === 1 ) {
  32686. jQuery.cleanData( getAll( node ) );
  32687. }
  32688. if ( node.parentNode ) {
  32689. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  32690. setGlobalEval( getAll( node, "script" ) );
  32691. }
  32692. node.parentNode.removeChild( node );
  32693. }
  32694. }
  32695. return elem;
  32696. }
  32697. jQuery.extend( {
  32698. htmlPrefilter: function( html ) {
  32699. return html.replace( rxhtmlTag, "<$1></$2>" );
  32700. },
  32701. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  32702. var i, l, srcElements, destElements,
  32703. clone = elem.cloneNode( true ),
  32704. inPage = jQuery.contains( elem.ownerDocument, elem );
  32705. // Fix IE cloning issues
  32706. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  32707. !jQuery.isXMLDoc( elem ) ) {
  32708. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  32709. destElements = getAll( clone );
  32710. srcElements = getAll( elem );
  32711. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  32712. fixInput( srcElements[ i ], destElements[ i ] );
  32713. }
  32714. }
  32715. // Copy the events from the original to the clone
  32716. if ( dataAndEvents ) {
  32717. if ( deepDataAndEvents ) {
  32718. srcElements = srcElements || getAll( elem );
  32719. destElements = destElements || getAll( clone );
  32720. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  32721. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  32722. }
  32723. } else {
  32724. cloneCopyEvent( elem, clone );
  32725. }
  32726. }
  32727. // Preserve script evaluation history
  32728. destElements = getAll( clone, "script" );
  32729. if ( destElements.length > 0 ) {
  32730. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  32731. }
  32732. // Return the cloned set
  32733. return clone;
  32734. },
  32735. cleanData: function( elems ) {
  32736. var data, elem, type,
  32737. special = jQuery.event.special,
  32738. i = 0;
  32739. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  32740. if ( acceptData( elem ) ) {
  32741. if ( ( data = elem[ dataPriv.expando ] ) ) {
  32742. if ( data.events ) {
  32743. for ( type in data.events ) {
  32744. if ( special[ type ] ) {
  32745. jQuery.event.remove( elem, type );
  32746. // This is a shortcut to avoid jQuery.event.remove's overhead
  32747. } else {
  32748. jQuery.removeEvent( elem, type, data.handle );
  32749. }
  32750. }
  32751. }
  32752. // Support: Chrome <=35 - 45+
  32753. // Assign undefined instead of using delete, see Data#remove
  32754. elem[ dataPriv.expando ] = undefined;
  32755. }
  32756. if ( elem[ dataUser.expando ] ) {
  32757. // Support: Chrome <=35 - 45+
  32758. // Assign undefined instead of using delete, see Data#remove
  32759. elem[ dataUser.expando ] = undefined;
  32760. }
  32761. }
  32762. }
  32763. }
  32764. } );
  32765. jQuery.fn.extend( {
  32766. detach: function( selector ) {
  32767. return remove( this, selector, true );
  32768. },
  32769. remove: function( selector ) {
  32770. return remove( this, selector );
  32771. },
  32772. text: function( value ) {
  32773. return access( this, function( value ) {
  32774. return value === undefined ?
  32775. jQuery.text( this ) :
  32776. this.empty().each( function() {
  32777. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  32778. this.textContent = value;
  32779. }
  32780. } );
  32781. }, null, value, arguments.length );
  32782. },
  32783. append: function() {
  32784. return domManip( this, arguments, function( elem ) {
  32785. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  32786. var target = manipulationTarget( this, elem );
  32787. target.appendChild( elem );
  32788. }
  32789. } );
  32790. },
  32791. prepend: function() {
  32792. return domManip( this, arguments, function( elem ) {
  32793. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  32794. var target = manipulationTarget( this, elem );
  32795. target.insertBefore( elem, target.firstChild );
  32796. }
  32797. } );
  32798. },
  32799. before: function() {
  32800. return domManip( this, arguments, function( elem ) {
  32801. if ( this.parentNode ) {
  32802. this.parentNode.insertBefore( elem, this );
  32803. }
  32804. } );
  32805. },
  32806. after: function() {
  32807. return domManip( this, arguments, function( elem ) {
  32808. if ( this.parentNode ) {
  32809. this.parentNode.insertBefore( elem, this.nextSibling );
  32810. }
  32811. } );
  32812. },
  32813. empty: function() {
  32814. var elem,
  32815. i = 0;
  32816. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  32817. if ( elem.nodeType === 1 ) {
  32818. // Prevent memory leaks
  32819. jQuery.cleanData( getAll( elem, false ) );
  32820. // Remove any remaining nodes
  32821. elem.textContent = "";
  32822. }
  32823. }
  32824. return this;
  32825. },
  32826. clone: function( dataAndEvents, deepDataAndEvents ) {
  32827. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  32828. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  32829. return this.map( function() {
  32830. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  32831. } );
  32832. },
  32833. html: function( value ) {
  32834. return access( this, function( value ) {
  32835. var elem = this[ 0 ] || {},
  32836. i = 0,
  32837. l = this.length;
  32838. if ( value === undefined && elem.nodeType === 1 ) {
  32839. return elem.innerHTML;
  32840. }
  32841. // See if we can take a shortcut and just use innerHTML
  32842. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  32843. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  32844. value = jQuery.htmlPrefilter( value );
  32845. try {
  32846. for ( ; i < l; i++ ) {
  32847. elem = this[ i ] || {};
  32848. // Remove element nodes and prevent memory leaks
  32849. if ( elem.nodeType === 1 ) {
  32850. jQuery.cleanData( getAll( elem, false ) );
  32851. elem.innerHTML = value;
  32852. }
  32853. }
  32854. elem = 0;
  32855. // If using innerHTML throws an exception, use the fallback method
  32856. } catch ( e ) {}
  32857. }
  32858. if ( elem ) {
  32859. this.empty().append( value );
  32860. }
  32861. }, null, value, arguments.length );
  32862. },
  32863. replaceWith: function() {
  32864. var ignored = [];
  32865. // Make the changes, replacing each non-ignored context element with the new content
  32866. return domManip( this, arguments, function( elem ) {
  32867. var parent = this.parentNode;
  32868. if ( jQuery.inArray( this, ignored ) < 0 ) {
  32869. jQuery.cleanData( getAll( this ) );
  32870. if ( parent ) {
  32871. parent.replaceChild( elem, this );
  32872. }
  32873. }
  32874. // Force callback invocation
  32875. }, ignored );
  32876. }
  32877. } );
  32878. jQuery.each( {
  32879. appendTo: "append",
  32880. prependTo: "prepend",
  32881. insertBefore: "before",
  32882. insertAfter: "after",
  32883. replaceAll: "replaceWith"
  32884. }, function( name, original ) {
  32885. jQuery.fn[ name ] = function( selector ) {
  32886. var elems,
  32887. ret = [],
  32888. insert = jQuery( selector ),
  32889. last = insert.length - 1,
  32890. i = 0;
  32891. for ( ; i <= last; i++ ) {
  32892. elems = i === last ? this : this.clone( true );
  32893. jQuery( insert[ i ] )[ original ]( elems );
  32894. // Support: Android <=4.0 only, PhantomJS 1 only
  32895. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  32896. push.apply( ret, elems.get() );
  32897. }
  32898. return this.pushStack( ret );
  32899. };
  32900. } );
  32901. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  32902. var getStyles = function( elem ) {
  32903. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  32904. // IE throws on elements created in popups
  32905. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  32906. var view = elem.ownerDocument.defaultView;
  32907. if ( !view || !view.opener ) {
  32908. view = window;
  32909. }
  32910. return view.getComputedStyle( elem );
  32911. };
  32912. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  32913. ( function() {
  32914. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  32915. // so they're executed at the same time to save the second computation.
  32916. function computeStyleTests() {
  32917. // This is a singleton, we need to execute it only once
  32918. if ( !div ) {
  32919. return;
  32920. }
  32921. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  32922. "margin-top:1px;padding:0;border:0";
  32923. div.style.cssText =
  32924. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  32925. "margin:auto;border:1px;padding:1px;" +
  32926. "width:60%;top:1%";
  32927. documentElement.appendChild( container ).appendChild( div );
  32928. var divStyle = window.getComputedStyle( div );
  32929. pixelPositionVal = divStyle.top !== "1%";
  32930. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  32931. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  32932. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  32933. // Some styles come back with percentage values, even though they shouldn't
  32934. div.style.right = "60%";
  32935. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  32936. // Support: IE 9 - 11 only
  32937. // Detect misreporting of content dimensions for box-sizing:border-box elements
  32938. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  32939. // Support: IE 9 only
  32940. // Detect overflow:scroll screwiness (gh-3699)
  32941. div.style.position = "absolute";
  32942. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  32943. documentElement.removeChild( container );
  32944. // Nullify the div so it wouldn't be stored in the memory and
  32945. // it will also be a sign that checks already performed
  32946. div = null;
  32947. }
  32948. function roundPixelMeasures( measure ) {
  32949. return Math.round( parseFloat( measure ) );
  32950. }
  32951. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  32952. reliableMarginLeftVal,
  32953. container = document.createElement( "div" ),
  32954. div = document.createElement( "div" );
  32955. // Finish early in limited (non-browser) environments
  32956. if ( !div.style ) {
  32957. return;
  32958. }
  32959. // Support: IE <=9 - 11 only
  32960. // Style of cloned element affects source element cloned (#8908)
  32961. div.style.backgroundClip = "content-box";
  32962. div.cloneNode( true ).style.backgroundClip = "";
  32963. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  32964. jQuery.extend( support, {
  32965. boxSizingReliable: function() {
  32966. computeStyleTests();
  32967. return boxSizingReliableVal;
  32968. },
  32969. pixelBoxStyles: function() {
  32970. computeStyleTests();
  32971. return pixelBoxStylesVal;
  32972. },
  32973. pixelPosition: function() {
  32974. computeStyleTests();
  32975. return pixelPositionVal;
  32976. },
  32977. reliableMarginLeft: function() {
  32978. computeStyleTests();
  32979. return reliableMarginLeftVal;
  32980. },
  32981. scrollboxSize: function() {
  32982. computeStyleTests();
  32983. return scrollboxSizeVal;
  32984. }
  32985. } );
  32986. } )();
  32987. function curCSS( elem, name, computed ) {
  32988. var width, minWidth, maxWidth, ret,
  32989. // Support: Firefox 51+
  32990. // Retrieving style before computed somehow
  32991. // fixes an issue with getting wrong values
  32992. // on detached elements
  32993. style = elem.style;
  32994. computed = computed || getStyles( elem );
  32995. // getPropertyValue is needed for:
  32996. // .css('filter') (IE 9 only, #12537)
  32997. // .css('--customProperty) (#3144)
  32998. if ( computed ) {
  32999. ret = computed.getPropertyValue( name ) || computed[ name ];
  33000. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  33001. ret = jQuery.style( elem, name );
  33002. }
  33003. // A tribute to the "awesome hack by Dean Edwards"
  33004. // Android Browser returns percentage for some values,
  33005. // but width seems to be reliably pixels.
  33006. // This is against the CSSOM draft spec:
  33007. // https://drafts.csswg.org/cssom/#resolved-values
  33008. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  33009. // Remember the original values
  33010. width = style.width;
  33011. minWidth = style.minWidth;
  33012. maxWidth = style.maxWidth;
  33013. // Put in the new values to get a computed value out
  33014. style.minWidth = style.maxWidth = style.width = ret;
  33015. ret = computed.width;
  33016. // Revert the changed values
  33017. style.width = width;
  33018. style.minWidth = minWidth;
  33019. style.maxWidth = maxWidth;
  33020. }
  33021. }
  33022. return ret !== undefined ?
  33023. // Support: IE <=9 - 11 only
  33024. // IE returns zIndex value as an integer.
  33025. ret + "" :
  33026. ret;
  33027. }
  33028. function addGetHookIf( conditionFn, hookFn ) {
  33029. // Define the hook, we'll check on the first run if it's really needed.
  33030. return {
  33031. get: function() {
  33032. if ( conditionFn() ) {
  33033. // Hook not needed (or it's not possible to use it due
  33034. // to missing dependency), remove it.
  33035. delete this.get;
  33036. return;
  33037. }
  33038. // Hook needed; redefine it so that the support test is not executed again.
  33039. return ( this.get = hookFn ).apply( this, arguments );
  33040. }
  33041. };
  33042. }
  33043. var
  33044. // Swappable if display is none or starts with table
  33045. // except "table", "table-cell", or "table-caption"
  33046. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  33047. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  33048. rcustomProp = /^--/,
  33049. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  33050. cssNormalTransform = {
  33051. letterSpacing: "0",
  33052. fontWeight: "400"
  33053. },
  33054. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  33055. emptyStyle = document.createElement( "div" ).style;
  33056. // Return a css property mapped to a potentially vendor prefixed property
  33057. function vendorPropName( name ) {
  33058. // Shortcut for names that are not vendor prefixed
  33059. if ( name in emptyStyle ) {
  33060. return name;
  33061. }
  33062. // Check for vendor prefixed names
  33063. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  33064. i = cssPrefixes.length;
  33065. while ( i-- ) {
  33066. name = cssPrefixes[ i ] + capName;
  33067. if ( name in emptyStyle ) {
  33068. return name;
  33069. }
  33070. }
  33071. }
  33072. // Return a property mapped along what jQuery.cssProps suggests or to
  33073. // a vendor prefixed property.
  33074. function finalPropName( name ) {
  33075. var ret = jQuery.cssProps[ name ];
  33076. if ( !ret ) {
  33077. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  33078. }
  33079. return ret;
  33080. }
  33081. function setPositiveNumber( elem, value, subtract ) {
  33082. // Any relative (+/-) values have already been
  33083. // normalized at this point
  33084. var matches = rcssNum.exec( value );
  33085. return matches ?
  33086. // Guard against undefined "subtract", e.g., when used as in cssHooks
  33087. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  33088. value;
  33089. }
  33090. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  33091. var i = dimension === "width" ? 1 : 0,
  33092. extra = 0,
  33093. delta = 0;
  33094. // Adjustment may not be necessary
  33095. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  33096. return 0;
  33097. }
  33098. for ( ; i < 4; i += 2 ) {
  33099. // Both box models exclude margin
  33100. if ( box === "margin" ) {
  33101. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  33102. }
  33103. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  33104. if ( !isBorderBox ) {
  33105. // Add padding
  33106. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  33107. // For "border" or "margin", add border
  33108. if ( box !== "padding" ) {
  33109. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  33110. // But still keep track of it otherwise
  33111. } else {
  33112. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  33113. }
  33114. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  33115. // "padding" or "margin"
  33116. } else {
  33117. // For "content", subtract padding
  33118. if ( box === "content" ) {
  33119. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  33120. }
  33121. // For "content" or "padding", subtract border
  33122. if ( box !== "margin" ) {
  33123. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  33124. }
  33125. }
  33126. }
  33127. // Account for positive content-box scroll gutter when requested by providing computedVal
  33128. if ( !isBorderBox && computedVal >= 0 ) {
  33129. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  33130. // Assuming integer scroll gutter, subtract the rest and round down
  33131. delta += Math.max( 0, Math.ceil(
  33132. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  33133. computedVal -
  33134. delta -
  33135. extra -
  33136. 0.5
  33137. ) );
  33138. }
  33139. return delta;
  33140. }
  33141. function getWidthOrHeight( elem, dimension, extra ) {
  33142. // Start with computed style
  33143. var styles = getStyles( elem ),
  33144. val = curCSS( elem, dimension, styles ),
  33145. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  33146. valueIsBorderBox = isBorderBox;
  33147. // Support: Firefox <=54
  33148. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  33149. if ( rnumnonpx.test( val ) ) {
  33150. if ( !extra ) {
  33151. return val;
  33152. }
  33153. val = "auto";
  33154. }
  33155. // Check for style in case a browser which returns unreliable values
  33156. // for getComputedStyle silently falls back to the reliable elem.style
  33157. valueIsBorderBox = valueIsBorderBox &&
  33158. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  33159. // Fall back to offsetWidth/offsetHeight when value is "auto"
  33160. // This happens for inline elements with no explicit setting (gh-3571)
  33161. // Support: Android <=4.1 - 4.3 only
  33162. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  33163. if ( val === "auto" ||
  33164. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  33165. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  33166. // offsetWidth/offsetHeight provide border-box values
  33167. valueIsBorderBox = true;
  33168. }
  33169. // Normalize "" and auto
  33170. val = parseFloat( val ) || 0;
  33171. // Adjust for the element's box model
  33172. return ( val +
  33173. boxModelAdjustment(
  33174. elem,
  33175. dimension,
  33176. extra || ( isBorderBox ? "border" : "content" ),
  33177. valueIsBorderBox,
  33178. styles,
  33179. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  33180. val
  33181. )
  33182. ) + "px";
  33183. }
  33184. jQuery.extend( {
  33185. // Add in style property hooks for overriding the default
  33186. // behavior of getting and setting a style property
  33187. cssHooks: {
  33188. opacity: {
  33189. get: function( elem, computed ) {
  33190. if ( computed ) {
  33191. // We should always get a number back from opacity
  33192. var ret = curCSS( elem, "opacity" );
  33193. return ret === "" ? "1" : ret;
  33194. }
  33195. }
  33196. }
  33197. },
  33198. // Don't automatically add "px" to these possibly-unitless properties
  33199. cssNumber: {
  33200. "animationIterationCount": true,
  33201. "columnCount": true,
  33202. "fillOpacity": true,
  33203. "flexGrow": true,
  33204. "flexShrink": true,
  33205. "fontWeight": true,
  33206. "lineHeight": true,
  33207. "opacity": true,
  33208. "order": true,
  33209. "orphans": true,
  33210. "widows": true,
  33211. "zIndex": true,
  33212. "zoom": true
  33213. },
  33214. // Add in properties whose names you wish to fix before
  33215. // setting or getting the value
  33216. cssProps: {},
  33217. // Get and set the style property on a DOM Node
  33218. style: function( elem, name, value, extra ) {
  33219. // Don't set styles on text and comment nodes
  33220. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  33221. return;
  33222. }
  33223. // Make sure that we're working with the right name
  33224. var ret, type, hooks,
  33225. origName = camelCase( name ),
  33226. isCustomProp = rcustomProp.test( name ),
  33227. style = elem.style;
  33228. // Make sure that we're working with the right name. We don't
  33229. // want to query the value if it is a CSS custom property
  33230. // since they are user-defined.
  33231. if ( !isCustomProp ) {
  33232. name = finalPropName( origName );
  33233. }
  33234. // Gets hook for the prefixed version, then unprefixed version
  33235. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  33236. // Check if we're setting a value
  33237. if ( value !== undefined ) {
  33238. type = typeof value;
  33239. // Convert "+=" or "-=" to relative numbers (#7345)
  33240. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  33241. value = adjustCSS( elem, name, ret );
  33242. // Fixes bug #9237
  33243. type = "number";
  33244. }
  33245. // Make sure that null and NaN values aren't set (#7116)
  33246. if ( value == null || value !== value ) {
  33247. return;
  33248. }
  33249. // If a number was passed in, add the unit (except for certain CSS properties)
  33250. if ( type === "number" ) {
  33251. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  33252. }
  33253. // background-* props affect original clone's values
  33254. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  33255. style[ name ] = "inherit";
  33256. }
  33257. // If a hook was provided, use that value, otherwise just set the specified value
  33258. if ( !hooks || !( "set" in hooks ) ||
  33259. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  33260. if ( isCustomProp ) {
  33261. style.setProperty( name, value );
  33262. } else {
  33263. style[ name ] = value;
  33264. }
  33265. }
  33266. } else {
  33267. // If a hook was provided get the non-computed value from there
  33268. if ( hooks && "get" in hooks &&
  33269. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  33270. return ret;
  33271. }
  33272. // Otherwise just get the value from the style object
  33273. return style[ name ];
  33274. }
  33275. },
  33276. css: function( elem, name, extra, styles ) {
  33277. var val, num, hooks,
  33278. origName = camelCase( name ),
  33279. isCustomProp = rcustomProp.test( name );
  33280. // Make sure that we're working with the right name. We don't
  33281. // want to modify the value if it is a CSS custom property
  33282. // since they are user-defined.
  33283. if ( !isCustomProp ) {
  33284. name = finalPropName( origName );
  33285. }
  33286. // Try prefixed name followed by the unprefixed name
  33287. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  33288. // If a hook was provided get the computed value from there
  33289. if ( hooks && "get" in hooks ) {
  33290. val = hooks.get( elem, true, extra );
  33291. }
  33292. // Otherwise, if a way to get the computed value exists, use that
  33293. if ( val === undefined ) {
  33294. val = curCSS( elem, name, styles );
  33295. }
  33296. // Convert "normal" to computed value
  33297. if ( val === "normal" && name in cssNormalTransform ) {
  33298. val = cssNormalTransform[ name ];
  33299. }
  33300. // Make numeric if forced or a qualifier was provided and val looks numeric
  33301. if ( extra === "" || extra ) {
  33302. num = parseFloat( val );
  33303. return extra === true || isFinite( num ) ? num || 0 : val;
  33304. }
  33305. return val;
  33306. }
  33307. } );
  33308. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  33309. jQuery.cssHooks[ dimension ] = {
  33310. get: function( elem, computed, extra ) {
  33311. if ( computed ) {
  33312. // Certain elements can have dimension info if we invisibly show them
  33313. // but it must have a current display style that would benefit
  33314. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  33315. // Support: Safari 8+
  33316. // Table columns in Safari have non-zero offsetWidth & zero
  33317. // getBoundingClientRect().width unless display is changed.
  33318. // Support: IE <=11 only
  33319. // Running getBoundingClientRect on a disconnected node
  33320. // in IE throws an error.
  33321. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  33322. swap( elem, cssShow, function() {
  33323. return getWidthOrHeight( elem, dimension, extra );
  33324. } ) :
  33325. getWidthOrHeight( elem, dimension, extra );
  33326. }
  33327. },
  33328. set: function( elem, value, extra ) {
  33329. var matches,
  33330. styles = getStyles( elem ),
  33331. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  33332. subtract = extra && boxModelAdjustment(
  33333. elem,
  33334. dimension,
  33335. extra,
  33336. isBorderBox,
  33337. styles
  33338. );
  33339. // Account for unreliable border-box dimensions by comparing offset* to computed and
  33340. // faking a content-box to get border and padding (gh-3699)
  33341. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  33342. subtract -= Math.ceil(
  33343. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  33344. parseFloat( styles[ dimension ] ) -
  33345. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  33346. 0.5
  33347. );
  33348. }
  33349. // Convert to pixels if value adjustment is needed
  33350. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  33351. ( matches[ 3 ] || "px" ) !== "px" ) {
  33352. elem.style[ dimension ] = value;
  33353. value = jQuery.css( elem, dimension );
  33354. }
  33355. return setPositiveNumber( elem, value, subtract );
  33356. }
  33357. };
  33358. } );
  33359. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  33360. function( elem, computed ) {
  33361. if ( computed ) {
  33362. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  33363. elem.getBoundingClientRect().left -
  33364. swap( elem, { marginLeft: 0 }, function() {
  33365. return elem.getBoundingClientRect().left;
  33366. } )
  33367. ) + "px";
  33368. }
  33369. }
  33370. );
  33371. // These hooks are used by animate to expand properties
  33372. jQuery.each( {
  33373. margin: "",
  33374. padding: "",
  33375. border: "Width"
  33376. }, function( prefix, suffix ) {
  33377. jQuery.cssHooks[ prefix + suffix ] = {
  33378. expand: function( value ) {
  33379. var i = 0,
  33380. expanded = {},
  33381. // Assumes a single number if not a string
  33382. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  33383. for ( ; i < 4; i++ ) {
  33384. expanded[ prefix + cssExpand[ i ] + suffix ] =
  33385. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  33386. }
  33387. return expanded;
  33388. }
  33389. };
  33390. if ( prefix !== "margin" ) {
  33391. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  33392. }
  33393. } );
  33394. jQuery.fn.extend( {
  33395. css: function( name, value ) {
  33396. return access( this, function( elem, name, value ) {
  33397. var styles, len,
  33398. map = {},
  33399. i = 0;
  33400. if ( Array.isArray( name ) ) {
  33401. styles = getStyles( elem );
  33402. len = name.length;
  33403. for ( ; i < len; i++ ) {
  33404. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  33405. }
  33406. return map;
  33407. }
  33408. return value !== undefined ?
  33409. jQuery.style( elem, name, value ) :
  33410. jQuery.css( elem, name );
  33411. }, name, value, arguments.length > 1 );
  33412. }
  33413. } );
  33414. function Tween( elem, options, prop, end, easing ) {
  33415. return new Tween.prototype.init( elem, options, prop, end, easing );
  33416. }
  33417. jQuery.Tween = Tween;
  33418. Tween.prototype = {
  33419. constructor: Tween,
  33420. init: function( elem, options, prop, end, easing, unit ) {
  33421. this.elem = elem;
  33422. this.prop = prop;
  33423. this.easing = easing || jQuery.easing._default;
  33424. this.options = options;
  33425. this.start = this.now = this.cur();
  33426. this.end = end;
  33427. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  33428. },
  33429. cur: function() {
  33430. var hooks = Tween.propHooks[ this.prop ];
  33431. return hooks && hooks.get ?
  33432. hooks.get( this ) :
  33433. Tween.propHooks._default.get( this );
  33434. },
  33435. run: function( percent ) {
  33436. var eased,
  33437. hooks = Tween.propHooks[ this.prop ];
  33438. if ( this.options.duration ) {
  33439. this.pos = eased = jQuery.easing[ this.easing ](
  33440. percent, this.options.duration * percent, 0, 1, this.options.duration
  33441. );
  33442. } else {
  33443. this.pos = eased = percent;
  33444. }
  33445. this.now = ( this.end - this.start ) * eased + this.start;
  33446. if ( this.options.step ) {
  33447. this.options.step.call( this.elem, this.now, this );
  33448. }
  33449. if ( hooks && hooks.set ) {
  33450. hooks.set( this );
  33451. } else {
  33452. Tween.propHooks._default.set( this );
  33453. }
  33454. return this;
  33455. }
  33456. };
  33457. Tween.prototype.init.prototype = Tween.prototype;
  33458. Tween.propHooks = {
  33459. _default: {
  33460. get: function( tween ) {
  33461. var result;
  33462. // Use a property on the element directly when it is not a DOM element,
  33463. // or when there is no matching style property that exists.
  33464. if ( tween.elem.nodeType !== 1 ||
  33465. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  33466. return tween.elem[ tween.prop ];
  33467. }
  33468. // Passing an empty string as a 3rd parameter to .css will automatically
  33469. // attempt a parseFloat and fallback to a string if the parse fails.
  33470. // Simple values such as "10px" are parsed to Float;
  33471. // complex values such as "rotate(1rad)" are returned as-is.
  33472. result = jQuery.css( tween.elem, tween.prop, "" );
  33473. // Empty strings, null, undefined and "auto" are converted to 0.
  33474. return !result || result === "auto" ? 0 : result;
  33475. },
  33476. set: function( tween ) {
  33477. // Use step hook for back compat.
  33478. // Use cssHook if its there.
  33479. // Use .style if available and use plain properties where available.
  33480. if ( jQuery.fx.step[ tween.prop ] ) {
  33481. jQuery.fx.step[ tween.prop ]( tween );
  33482. } else if ( tween.elem.nodeType === 1 &&
  33483. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  33484. jQuery.cssHooks[ tween.prop ] ) ) {
  33485. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  33486. } else {
  33487. tween.elem[ tween.prop ] = tween.now;
  33488. }
  33489. }
  33490. }
  33491. };
  33492. // Support: IE <=9 only
  33493. // Panic based approach to setting things on disconnected nodes
  33494. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  33495. set: function( tween ) {
  33496. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  33497. tween.elem[ tween.prop ] = tween.now;
  33498. }
  33499. }
  33500. };
  33501. jQuery.easing = {
  33502. linear: function( p ) {
  33503. return p;
  33504. },
  33505. swing: function( p ) {
  33506. return 0.5 - Math.cos( p * Math.PI ) / 2;
  33507. },
  33508. _default: "swing"
  33509. };
  33510. jQuery.fx = Tween.prototype.init;
  33511. // Back compat <1.8 extension point
  33512. jQuery.fx.step = {};
  33513. var
  33514. fxNow, inProgress,
  33515. rfxtypes = /^(?:toggle|show|hide)$/,
  33516. rrun = /queueHooks$/;
  33517. function schedule() {
  33518. if ( inProgress ) {
  33519. if ( document.hidden === false && window.requestAnimationFrame ) {
  33520. window.requestAnimationFrame( schedule );
  33521. } else {
  33522. window.setTimeout( schedule, jQuery.fx.interval );
  33523. }
  33524. jQuery.fx.tick();
  33525. }
  33526. }
  33527. // Animations created synchronously will run synchronously
  33528. function createFxNow() {
  33529. window.setTimeout( function() {
  33530. fxNow = undefined;
  33531. } );
  33532. return ( fxNow = Date.now() );
  33533. }
  33534. // Generate parameters to create a standard animation
  33535. function genFx( type, includeWidth ) {
  33536. var which,
  33537. i = 0,
  33538. attrs = { height: type };
  33539. // If we include width, step value is 1 to do all cssExpand values,
  33540. // otherwise step value is 2 to skip over Left and Right
  33541. includeWidth = includeWidth ? 1 : 0;
  33542. for ( ; i < 4; i += 2 - includeWidth ) {
  33543. which = cssExpand[ i ];
  33544. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  33545. }
  33546. if ( includeWidth ) {
  33547. attrs.opacity = attrs.width = type;
  33548. }
  33549. return attrs;
  33550. }
  33551. function createTween( value, prop, animation ) {
  33552. var tween,
  33553. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  33554. index = 0,
  33555. length = collection.length;
  33556. for ( ; index < length; index++ ) {
  33557. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  33558. // We're done with this property
  33559. return tween;
  33560. }
  33561. }
  33562. }
  33563. function defaultPrefilter( elem, props, opts ) {
  33564. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  33565. isBox = "width" in props || "height" in props,
  33566. anim = this,
  33567. orig = {},
  33568. style = elem.style,
  33569. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  33570. dataShow = dataPriv.get( elem, "fxshow" );
  33571. // Queue-skipping animations hijack the fx hooks
  33572. if ( !opts.queue ) {
  33573. hooks = jQuery._queueHooks( elem, "fx" );
  33574. if ( hooks.unqueued == null ) {
  33575. hooks.unqueued = 0;
  33576. oldfire = hooks.empty.fire;
  33577. hooks.empty.fire = function() {
  33578. if ( !hooks.unqueued ) {
  33579. oldfire();
  33580. }
  33581. };
  33582. }
  33583. hooks.unqueued++;
  33584. anim.always( function() {
  33585. // Ensure the complete handler is called before this completes
  33586. anim.always( function() {
  33587. hooks.unqueued--;
  33588. if ( !jQuery.queue( elem, "fx" ).length ) {
  33589. hooks.empty.fire();
  33590. }
  33591. } );
  33592. } );
  33593. }
  33594. // Detect show/hide animations
  33595. for ( prop in props ) {
  33596. value = props[ prop ];
  33597. if ( rfxtypes.test( value ) ) {
  33598. delete props[ prop ];
  33599. toggle = toggle || value === "toggle";
  33600. if ( value === ( hidden ? "hide" : "show" ) ) {
  33601. // Pretend to be hidden if this is a "show" and
  33602. // there is still data from a stopped show/hide
  33603. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  33604. hidden = true;
  33605. // Ignore all other no-op show/hide data
  33606. } else {
  33607. continue;
  33608. }
  33609. }
  33610. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  33611. }
  33612. }
  33613. // Bail out if this is a no-op like .hide().hide()
  33614. propTween = !jQuery.isEmptyObject( props );
  33615. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  33616. return;
  33617. }
  33618. // Restrict "overflow" and "display" styles during box animations
  33619. if ( isBox && elem.nodeType === 1 ) {
  33620. // Support: IE <=9 - 11, Edge 12 - 15
  33621. // Record all 3 overflow attributes because IE does not infer the shorthand
  33622. // from identically-valued overflowX and overflowY and Edge just mirrors
  33623. // the overflowX value there.
  33624. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  33625. // Identify a display type, preferring old show/hide data over the CSS cascade
  33626. restoreDisplay = dataShow && dataShow.display;
  33627. if ( restoreDisplay == null ) {
  33628. restoreDisplay = dataPriv.get( elem, "display" );
  33629. }
  33630. display = jQuery.css( elem, "display" );
  33631. if ( display === "none" ) {
  33632. if ( restoreDisplay ) {
  33633. display = restoreDisplay;
  33634. } else {
  33635. // Get nonempty value(s) by temporarily forcing visibility
  33636. showHide( [ elem ], true );
  33637. restoreDisplay = elem.style.display || restoreDisplay;
  33638. display = jQuery.css( elem, "display" );
  33639. showHide( [ elem ] );
  33640. }
  33641. }
  33642. // Animate inline elements as inline-block
  33643. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  33644. if ( jQuery.css( elem, "float" ) === "none" ) {
  33645. // Restore the original display value at the end of pure show/hide animations
  33646. if ( !propTween ) {
  33647. anim.done( function() {
  33648. style.display = restoreDisplay;
  33649. } );
  33650. if ( restoreDisplay == null ) {
  33651. display = style.display;
  33652. restoreDisplay = display === "none" ? "" : display;
  33653. }
  33654. }
  33655. style.display = "inline-block";
  33656. }
  33657. }
  33658. }
  33659. if ( opts.overflow ) {
  33660. style.overflow = "hidden";
  33661. anim.always( function() {
  33662. style.overflow = opts.overflow[ 0 ];
  33663. style.overflowX = opts.overflow[ 1 ];
  33664. style.overflowY = opts.overflow[ 2 ];
  33665. } );
  33666. }
  33667. // Implement show/hide animations
  33668. propTween = false;
  33669. for ( prop in orig ) {
  33670. // General show/hide setup for this element animation
  33671. if ( !propTween ) {
  33672. if ( dataShow ) {
  33673. if ( "hidden" in dataShow ) {
  33674. hidden = dataShow.hidden;
  33675. }
  33676. } else {
  33677. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  33678. }
  33679. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  33680. if ( toggle ) {
  33681. dataShow.hidden = !hidden;
  33682. }
  33683. // Show elements before animating them
  33684. if ( hidden ) {
  33685. showHide( [ elem ], true );
  33686. }
  33687. /* eslint-disable no-loop-func */
  33688. anim.done( function() {
  33689. /* eslint-enable no-loop-func */
  33690. // The final step of a "hide" animation is actually hiding the element
  33691. if ( !hidden ) {
  33692. showHide( [ elem ] );
  33693. }
  33694. dataPriv.remove( elem, "fxshow" );
  33695. for ( prop in orig ) {
  33696. jQuery.style( elem, prop, orig[ prop ] );
  33697. }
  33698. } );
  33699. }
  33700. // Per-property setup
  33701. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  33702. if ( !( prop in dataShow ) ) {
  33703. dataShow[ prop ] = propTween.start;
  33704. if ( hidden ) {
  33705. propTween.end = propTween.start;
  33706. propTween.start = 0;
  33707. }
  33708. }
  33709. }
  33710. }
  33711. function propFilter( props, specialEasing ) {
  33712. var index, name, easing, value, hooks;
  33713. // camelCase, specialEasing and expand cssHook pass
  33714. for ( index in props ) {
  33715. name = camelCase( index );
  33716. easing = specialEasing[ name ];
  33717. value = props[ index ];
  33718. if ( Array.isArray( value ) ) {
  33719. easing = value[ 1 ];
  33720. value = props[ index ] = value[ 0 ];
  33721. }
  33722. if ( index !== name ) {
  33723. props[ name ] = value;
  33724. delete props[ index ];
  33725. }
  33726. hooks = jQuery.cssHooks[ name ];
  33727. if ( hooks && "expand" in hooks ) {
  33728. value = hooks.expand( value );
  33729. delete props[ name ];
  33730. // Not quite $.extend, this won't overwrite existing keys.
  33731. // Reusing 'index' because we have the correct "name"
  33732. for ( index in value ) {
  33733. if ( !( index in props ) ) {
  33734. props[ index ] = value[ index ];
  33735. specialEasing[ index ] = easing;
  33736. }
  33737. }
  33738. } else {
  33739. specialEasing[ name ] = easing;
  33740. }
  33741. }
  33742. }
  33743. function Animation( elem, properties, options ) {
  33744. var result,
  33745. stopped,
  33746. index = 0,
  33747. length = Animation.prefilters.length,
  33748. deferred = jQuery.Deferred().always( function() {
  33749. // Don't match elem in the :animated selector
  33750. delete tick.elem;
  33751. } ),
  33752. tick = function() {
  33753. if ( stopped ) {
  33754. return false;
  33755. }
  33756. var currentTime = fxNow || createFxNow(),
  33757. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  33758. // Support: Android 2.3 only
  33759. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  33760. temp = remaining / animation.duration || 0,
  33761. percent = 1 - temp,
  33762. index = 0,
  33763. length = animation.tweens.length;
  33764. for ( ; index < length; index++ ) {
  33765. animation.tweens[ index ].run( percent );
  33766. }
  33767. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  33768. // If there's more to do, yield
  33769. if ( percent < 1 && length ) {
  33770. return remaining;
  33771. }
  33772. // If this was an empty animation, synthesize a final progress notification
  33773. if ( !length ) {
  33774. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  33775. }
  33776. // Resolve the animation and report its conclusion
  33777. deferred.resolveWith( elem, [ animation ] );
  33778. return false;
  33779. },
  33780. animation = deferred.promise( {
  33781. elem: elem,
  33782. props: jQuery.extend( {}, properties ),
  33783. opts: jQuery.extend( true, {
  33784. specialEasing: {},
  33785. easing: jQuery.easing._default
  33786. }, options ),
  33787. originalProperties: properties,
  33788. originalOptions: options,
  33789. startTime: fxNow || createFxNow(),
  33790. duration: options.duration,
  33791. tweens: [],
  33792. createTween: function( prop, end ) {
  33793. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  33794. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  33795. animation.tweens.push( tween );
  33796. return tween;
  33797. },
  33798. stop: function( gotoEnd ) {
  33799. var index = 0,
  33800. // If we are going to the end, we want to run all the tweens
  33801. // otherwise we skip this part
  33802. length = gotoEnd ? animation.tweens.length : 0;
  33803. if ( stopped ) {
  33804. return this;
  33805. }
  33806. stopped = true;
  33807. for ( ; index < length; index++ ) {
  33808. animation.tweens[ index ].run( 1 );
  33809. }
  33810. // Resolve when we played the last frame; otherwise, reject
  33811. if ( gotoEnd ) {
  33812. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  33813. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  33814. } else {
  33815. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  33816. }
  33817. return this;
  33818. }
  33819. } ),
  33820. props = animation.props;
  33821. propFilter( props, animation.opts.specialEasing );
  33822. for ( ; index < length; index++ ) {
  33823. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  33824. if ( result ) {
  33825. if ( isFunction( result.stop ) ) {
  33826. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  33827. result.stop.bind( result );
  33828. }
  33829. return result;
  33830. }
  33831. }
  33832. jQuery.map( props, createTween, animation );
  33833. if ( isFunction( animation.opts.start ) ) {
  33834. animation.opts.start.call( elem, animation );
  33835. }
  33836. // Attach callbacks from options
  33837. animation
  33838. .progress( animation.opts.progress )
  33839. .done( animation.opts.done, animation.opts.complete )
  33840. .fail( animation.opts.fail )
  33841. .always( animation.opts.always );
  33842. jQuery.fx.timer(
  33843. jQuery.extend( tick, {
  33844. elem: elem,
  33845. anim: animation,
  33846. queue: animation.opts.queue
  33847. } )
  33848. );
  33849. return animation;
  33850. }
  33851. jQuery.Animation = jQuery.extend( Animation, {
  33852. tweeners: {
  33853. "*": [ function( prop, value ) {
  33854. var tween = this.createTween( prop, value );
  33855. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  33856. return tween;
  33857. } ]
  33858. },
  33859. tweener: function( props, callback ) {
  33860. if ( isFunction( props ) ) {
  33861. callback = props;
  33862. props = [ "*" ];
  33863. } else {
  33864. props = props.match( rnothtmlwhite );
  33865. }
  33866. var prop,
  33867. index = 0,
  33868. length = props.length;
  33869. for ( ; index < length; index++ ) {
  33870. prop = props[ index ];
  33871. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  33872. Animation.tweeners[ prop ].unshift( callback );
  33873. }
  33874. },
  33875. prefilters: [ defaultPrefilter ],
  33876. prefilter: function( callback, prepend ) {
  33877. if ( prepend ) {
  33878. Animation.prefilters.unshift( callback );
  33879. } else {
  33880. Animation.prefilters.push( callback );
  33881. }
  33882. }
  33883. } );
  33884. jQuery.speed = function( speed, easing, fn ) {
  33885. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  33886. complete: fn || !fn && easing ||
  33887. isFunction( speed ) && speed,
  33888. duration: speed,
  33889. easing: fn && easing || easing && !isFunction( easing ) && easing
  33890. };
  33891. // Go to the end state if fx are off
  33892. if ( jQuery.fx.off ) {
  33893. opt.duration = 0;
  33894. } else {
  33895. if ( typeof opt.duration !== "number" ) {
  33896. if ( opt.duration in jQuery.fx.speeds ) {
  33897. opt.duration = jQuery.fx.speeds[ opt.duration ];
  33898. } else {
  33899. opt.duration = jQuery.fx.speeds._default;
  33900. }
  33901. }
  33902. }
  33903. // Normalize opt.queue - true/undefined/null -> "fx"
  33904. if ( opt.queue == null || opt.queue === true ) {
  33905. opt.queue = "fx";
  33906. }
  33907. // Queueing
  33908. opt.old = opt.complete;
  33909. opt.complete = function() {
  33910. if ( isFunction( opt.old ) ) {
  33911. opt.old.call( this );
  33912. }
  33913. if ( opt.queue ) {
  33914. jQuery.dequeue( this, opt.queue );
  33915. }
  33916. };
  33917. return opt;
  33918. };
  33919. jQuery.fn.extend( {
  33920. fadeTo: function( speed, to, easing, callback ) {
  33921. // Show any hidden elements after setting opacity to 0
  33922. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  33923. // Animate to the value specified
  33924. .end().animate( { opacity: to }, speed, easing, callback );
  33925. },
  33926. animate: function( prop, speed, easing, callback ) {
  33927. var empty = jQuery.isEmptyObject( prop ),
  33928. optall = jQuery.speed( speed, easing, callback ),
  33929. doAnimation = function() {
  33930. // Operate on a copy of prop so per-property easing won't be lost
  33931. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  33932. // Empty animations, or finishing resolves immediately
  33933. if ( empty || dataPriv.get( this, "finish" ) ) {
  33934. anim.stop( true );
  33935. }
  33936. };
  33937. doAnimation.finish = doAnimation;
  33938. return empty || optall.queue === false ?
  33939. this.each( doAnimation ) :
  33940. this.queue( optall.queue, doAnimation );
  33941. },
  33942. stop: function( type, clearQueue, gotoEnd ) {
  33943. var stopQueue = function( hooks ) {
  33944. var stop = hooks.stop;
  33945. delete hooks.stop;
  33946. stop( gotoEnd );
  33947. };
  33948. if ( typeof type !== "string" ) {
  33949. gotoEnd = clearQueue;
  33950. clearQueue = type;
  33951. type = undefined;
  33952. }
  33953. if ( clearQueue && type !== false ) {
  33954. this.queue( type || "fx", [] );
  33955. }
  33956. return this.each( function() {
  33957. var dequeue = true,
  33958. index = type != null && type + "queueHooks",
  33959. timers = jQuery.timers,
  33960. data = dataPriv.get( this );
  33961. if ( index ) {
  33962. if ( data[ index ] && data[ index ].stop ) {
  33963. stopQueue( data[ index ] );
  33964. }
  33965. } else {
  33966. for ( index in data ) {
  33967. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  33968. stopQueue( data[ index ] );
  33969. }
  33970. }
  33971. }
  33972. for ( index = timers.length; index--; ) {
  33973. if ( timers[ index ].elem === this &&
  33974. ( type == null || timers[ index ].queue === type ) ) {
  33975. timers[ index ].anim.stop( gotoEnd );
  33976. dequeue = false;
  33977. timers.splice( index, 1 );
  33978. }
  33979. }
  33980. // Start the next in the queue if the last step wasn't forced.
  33981. // Timers currently will call their complete callbacks, which
  33982. // will dequeue but only if they were gotoEnd.
  33983. if ( dequeue || !gotoEnd ) {
  33984. jQuery.dequeue( this, type );
  33985. }
  33986. } );
  33987. },
  33988. finish: function( type ) {
  33989. if ( type !== false ) {
  33990. type = type || "fx";
  33991. }
  33992. return this.each( function() {
  33993. var index,
  33994. data = dataPriv.get( this ),
  33995. queue = data[ type + "queue" ],
  33996. hooks = data[ type + "queueHooks" ],
  33997. timers = jQuery.timers,
  33998. length = queue ? queue.length : 0;
  33999. // Enable finishing flag on private data
  34000. data.finish = true;
  34001. // Empty the queue first
  34002. jQuery.queue( this, type, [] );
  34003. if ( hooks && hooks.stop ) {
  34004. hooks.stop.call( this, true );
  34005. }
  34006. // Look for any active animations, and finish them
  34007. for ( index = timers.length; index--; ) {
  34008. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  34009. timers[ index ].anim.stop( true );
  34010. timers.splice( index, 1 );
  34011. }
  34012. }
  34013. // Look for any animations in the old queue and finish them
  34014. for ( index = 0; index < length; index++ ) {
  34015. if ( queue[ index ] && queue[ index ].finish ) {
  34016. queue[ index ].finish.call( this );
  34017. }
  34018. }
  34019. // Turn off finishing flag
  34020. delete data.finish;
  34021. } );
  34022. }
  34023. } );
  34024. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  34025. var cssFn = jQuery.fn[ name ];
  34026. jQuery.fn[ name ] = function( speed, easing, callback ) {
  34027. return speed == null || typeof speed === "boolean" ?
  34028. cssFn.apply( this, arguments ) :
  34029. this.animate( genFx( name, true ), speed, easing, callback );
  34030. };
  34031. } );
  34032. // Generate shortcuts for custom animations
  34033. jQuery.each( {
  34034. slideDown: genFx( "show" ),
  34035. slideUp: genFx( "hide" ),
  34036. slideToggle: genFx( "toggle" ),
  34037. fadeIn: { opacity: "show" },
  34038. fadeOut: { opacity: "hide" },
  34039. fadeToggle: { opacity: "toggle" }
  34040. }, function( name, props ) {
  34041. jQuery.fn[ name ] = function( speed, easing, callback ) {
  34042. return this.animate( props, speed, easing, callback );
  34043. };
  34044. } );
  34045. jQuery.timers = [];
  34046. jQuery.fx.tick = function() {
  34047. var timer,
  34048. i = 0,
  34049. timers = jQuery.timers;
  34050. fxNow = Date.now();
  34051. for ( ; i < timers.length; i++ ) {
  34052. timer = timers[ i ];
  34053. // Run the timer and safely remove it when done (allowing for external removal)
  34054. if ( !timer() && timers[ i ] === timer ) {
  34055. timers.splice( i--, 1 );
  34056. }
  34057. }
  34058. if ( !timers.length ) {
  34059. jQuery.fx.stop();
  34060. }
  34061. fxNow = undefined;
  34062. };
  34063. jQuery.fx.timer = function( timer ) {
  34064. jQuery.timers.push( timer );
  34065. jQuery.fx.start();
  34066. };
  34067. jQuery.fx.interval = 13;
  34068. jQuery.fx.start = function() {
  34069. if ( inProgress ) {
  34070. return;
  34071. }
  34072. inProgress = true;
  34073. schedule();
  34074. };
  34075. jQuery.fx.stop = function() {
  34076. inProgress = null;
  34077. };
  34078. jQuery.fx.speeds = {
  34079. slow: 600,
  34080. fast: 200,
  34081. // Default speed
  34082. _default: 400
  34083. };
  34084. // Based off of the plugin by Clint Helfers, with permission.
  34085. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  34086. jQuery.fn.delay = function( time, type ) {
  34087. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  34088. type = type || "fx";
  34089. return this.queue( type, function( next, hooks ) {
  34090. var timeout = window.setTimeout( next, time );
  34091. hooks.stop = function() {
  34092. window.clearTimeout( timeout );
  34093. };
  34094. } );
  34095. };
  34096. ( function() {
  34097. var input = document.createElement( "input" ),
  34098. select = document.createElement( "select" ),
  34099. opt = select.appendChild( document.createElement( "option" ) );
  34100. input.type = "checkbox";
  34101. // Support: Android <=4.3 only
  34102. // Default value for a checkbox should be "on"
  34103. support.checkOn = input.value !== "";
  34104. // Support: IE <=11 only
  34105. // Must access selectedIndex to make default options select
  34106. support.optSelected = opt.selected;
  34107. // Support: IE <=11 only
  34108. // An input loses its value after becoming a radio
  34109. input = document.createElement( "input" );
  34110. input.value = "t";
  34111. input.type = "radio";
  34112. support.radioValue = input.value === "t";
  34113. } )();
  34114. var boolHook,
  34115. attrHandle = jQuery.expr.attrHandle;
  34116. jQuery.fn.extend( {
  34117. attr: function( name, value ) {
  34118. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  34119. },
  34120. removeAttr: function( name ) {
  34121. return this.each( function() {
  34122. jQuery.removeAttr( this, name );
  34123. } );
  34124. }
  34125. } );
  34126. jQuery.extend( {
  34127. attr: function( elem, name, value ) {
  34128. var ret, hooks,
  34129. nType = elem.nodeType;
  34130. // Don't get/set attributes on text, comment and attribute nodes
  34131. if ( nType === 3 || nType === 8 || nType === 2 ) {
  34132. return;
  34133. }
  34134. // Fallback to prop when attributes are not supported
  34135. if ( typeof elem.getAttribute === "undefined" ) {
  34136. return jQuery.prop( elem, name, value );
  34137. }
  34138. // Attribute hooks are determined by the lowercase version
  34139. // Grab necessary hook if one is defined
  34140. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  34141. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  34142. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  34143. }
  34144. if ( value !== undefined ) {
  34145. if ( value === null ) {
  34146. jQuery.removeAttr( elem, name );
  34147. return;
  34148. }
  34149. if ( hooks && "set" in hooks &&
  34150. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  34151. return ret;
  34152. }
  34153. elem.setAttribute( name, value + "" );
  34154. return value;
  34155. }
  34156. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  34157. return ret;
  34158. }
  34159. ret = jQuery.find.attr( elem, name );
  34160. // Non-existent attributes return null, we normalize to undefined
  34161. return ret == null ? undefined : ret;
  34162. },
  34163. attrHooks: {
  34164. type: {
  34165. set: function( elem, value ) {
  34166. if ( !support.radioValue && value === "radio" &&
  34167. nodeName( elem, "input" ) ) {
  34168. var val = elem.value;
  34169. elem.setAttribute( "type", value );
  34170. if ( val ) {
  34171. elem.value = val;
  34172. }
  34173. return value;
  34174. }
  34175. }
  34176. }
  34177. },
  34178. removeAttr: function( elem, value ) {
  34179. var name,
  34180. i = 0,
  34181. // Attribute names can contain non-HTML whitespace characters
  34182. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  34183. attrNames = value && value.match( rnothtmlwhite );
  34184. if ( attrNames && elem.nodeType === 1 ) {
  34185. while ( ( name = attrNames[ i++ ] ) ) {
  34186. elem.removeAttribute( name );
  34187. }
  34188. }
  34189. }
  34190. } );
  34191. // Hooks for boolean attributes
  34192. boolHook = {
  34193. set: function( elem, value, name ) {
  34194. if ( value === false ) {
  34195. // Remove boolean attributes when set to false
  34196. jQuery.removeAttr( elem, name );
  34197. } else {
  34198. elem.setAttribute( name, name );
  34199. }
  34200. return name;
  34201. }
  34202. };
  34203. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  34204. var getter = attrHandle[ name ] || jQuery.find.attr;
  34205. attrHandle[ name ] = function( elem, name, isXML ) {
  34206. var ret, handle,
  34207. lowercaseName = name.toLowerCase();
  34208. if ( !isXML ) {
  34209. // Avoid an infinite loop by temporarily removing this function from the getter
  34210. handle = attrHandle[ lowercaseName ];
  34211. attrHandle[ lowercaseName ] = ret;
  34212. ret = getter( elem, name, isXML ) != null ?
  34213. lowercaseName :
  34214. null;
  34215. attrHandle[ lowercaseName ] = handle;
  34216. }
  34217. return ret;
  34218. };
  34219. } );
  34220. var rfocusable = /^(?:input|select|textarea|button)$/i,
  34221. rclickable = /^(?:a|area)$/i;
  34222. jQuery.fn.extend( {
  34223. prop: function( name, value ) {
  34224. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  34225. },
  34226. removeProp: function( name ) {
  34227. return this.each( function() {
  34228. delete this[ jQuery.propFix[ name ] || name ];
  34229. } );
  34230. }
  34231. } );
  34232. jQuery.extend( {
  34233. prop: function( elem, name, value ) {
  34234. var ret, hooks,
  34235. nType = elem.nodeType;
  34236. // Don't get/set properties on text, comment and attribute nodes
  34237. if ( nType === 3 || nType === 8 || nType === 2 ) {
  34238. return;
  34239. }
  34240. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  34241. // Fix name and attach hooks
  34242. name = jQuery.propFix[ name ] || name;
  34243. hooks = jQuery.propHooks[ name ];
  34244. }
  34245. if ( value !== undefined ) {
  34246. if ( hooks && "set" in hooks &&
  34247. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  34248. return ret;
  34249. }
  34250. return ( elem[ name ] = value );
  34251. }
  34252. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  34253. return ret;
  34254. }
  34255. return elem[ name ];
  34256. },
  34257. propHooks: {
  34258. tabIndex: {
  34259. get: function( elem ) {
  34260. // Support: IE <=9 - 11 only
  34261. // elem.tabIndex doesn't always return the
  34262. // correct value when it hasn't been explicitly set
  34263. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  34264. // Use proper attribute retrieval(#12072)
  34265. var tabindex = jQuery.find.attr( elem, "tabindex" );
  34266. if ( tabindex ) {
  34267. return parseInt( tabindex, 10 );
  34268. }
  34269. if (
  34270. rfocusable.test( elem.nodeName ) ||
  34271. rclickable.test( elem.nodeName ) &&
  34272. elem.href
  34273. ) {
  34274. return 0;
  34275. }
  34276. return -1;
  34277. }
  34278. }
  34279. },
  34280. propFix: {
  34281. "for": "htmlFor",
  34282. "class": "className"
  34283. }
  34284. } );
  34285. // Support: IE <=11 only
  34286. // Accessing the selectedIndex property
  34287. // forces the browser to respect setting selected
  34288. // on the option
  34289. // The getter ensures a default option is selected
  34290. // when in an optgroup
  34291. // eslint rule "no-unused-expressions" is disabled for this code
  34292. // since it considers such accessions noop
  34293. if ( !support.optSelected ) {
  34294. jQuery.propHooks.selected = {
  34295. get: function( elem ) {
  34296. /* eslint no-unused-expressions: "off" */
  34297. var parent = elem.parentNode;
  34298. if ( parent && parent.parentNode ) {
  34299. parent.parentNode.selectedIndex;
  34300. }
  34301. return null;
  34302. },
  34303. set: function( elem ) {
  34304. /* eslint no-unused-expressions: "off" */
  34305. var parent = elem.parentNode;
  34306. if ( parent ) {
  34307. parent.selectedIndex;
  34308. if ( parent.parentNode ) {
  34309. parent.parentNode.selectedIndex;
  34310. }
  34311. }
  34312. }
  34313. };
  34314. }
  34315. jQuery.each( [
  34316. "tabIndex",
  34317. "readOnly",
  34318. "maxLength",
  34319. "cellSpacing",
  34320. "cellPadding",
  34321. "rowSpan",
  34322. "colSpan",
  34323. "useMap",
  34324. "frameBorder",
  34325. "contentEditable"
  34326. ], function() {
  34327. jQuery.propFix[ this.toLowerCase() ] = this;
  34328. } );
  34329. // Strip and collapse whitespace according to HTML spec
  34330. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  34331. function stripAndCollapse( value ) {
  34332. var tokens = value.match( rnothtmlwhite ) || [];
  34333. return tokens.join( " " );
  34334. }
  34335. function getClass( elem ) {
  34336. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  34337. }
  34338. function classesToArray( value ) {
  34339. if ( Array.isArray( value ) ) {
  34340. return value;
  34341. }
  34342. if ( typeof value === "string" ) {
  34343. return value.match( rnothtmlwhite ) || [];
  34344. }
  34345. return [];
  34346. }
  34347. jQuery.fn.extend( {
  34348. addClass: function( value ) {
  34349. var classes, elem, cur, curValue, clazz, j, finalValue,
  34350. i = 0;
  34351. if ( isFunction( value ) ) {
  34352. return this.each( function( j ) {
  34353. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  34354. } );
  34355. }
  34356. classes = classesToArray( value );
  34357. if ( classes.length ) {
  34358. while ( ( elem = this[ i++ ] ) ) {
  34359. curValue = getClass( elem );
  34360. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  34361. if ( cur ) {
  34362. j = 0;
  34363. while ( ( clazz = classes[ j++ ] ) ) {
  34364. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  34365. cur += clazz + " ";
  34366. }
  34367. }
  34368. // Only assign if different to avoid unneeded rendering.
  34369. finalValue = stripAndCollapse( cur );
  34370. if ( curValue !== finalValue ) {
  34371. elem.setAttribute( "class", finalValue );
  34372. }
  34373. }
  34374. }
  34375. }
  34376. return this;
  34377. },
  34378. removeClass: function( value ) {
  34379. var classes, elem, cur, curValue, clazz, j, finalValue,
  34380. i = 0;
  34381. if ( isFunction( value ) ) {
  34382. return this.each( function( j ) {
  34383. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  34384. } );
  34385. }
  34386. if ( !arguments.length ) {
  34387. return this.attr( "class", "" );
  34388. }
  34389. classes = classesToArray( value );
  34390. if ( classes.length ) {
  34391. while ( ( elem = this[ i++ ] ) ) {
  34392. curValue = getClass( elem );
  34393. // This expression is here for better compressibility (see addClass)
  34394. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  34395. if ( cur ) {
  34396. j = 0;
  34397. while ( ( clazz = classes[ j++ ] ) ) {
  34398. // Remove *all* instances
  34399. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  34400. cur = cur.replace( " " + clazz + " ", " " );
  34401. }
  34402. }
  34403. // Only assign if different to avoid unneeded rendering.
  34404. finalValue = stripAndCollapse( cur );
  34405. if ( curValue !== finalValue ) {
  34406. elem.setAttribute( "class", finalValue );
  34407. }
  34408. }
  34409. }
  34410. }
  34411. return this;
  34412. },
  34413. toggleClass: function( value, stateVal ) {
  34414. var type = typeof value,
  34415. isValidValue = type === "string" || Array.isArray( value );
  34416. if ( typeof stateVal === "boolean" && isValidValue ) {
  34417. return stateVal ? this.addClass( value ) : this.removeClass( value );
  34418. }
  34419. if ( isFunction( value ) ) {
  34420. return this.each( function( i ) {
  34421. jQuery( this ).toggleClass(
  34422. value.call( this, i, getClass( this ), stateVal ),
  34423. stateVal
  34424. );
  34425. } );
  34426. }
  34427. return this.each( function() {
  34428. var className, i, self, classNames;
  34429. if ( isValidValue ) {
  34430. // Toggle individual class names
  34431. i = 0;
  34432. self = jQuery( this );
  34433. classNames = classesToArray( value );
  34434. while ( ( className = classNames[ i++ ] ) ) {
  34435. // Check each className given, space separated list
  34436. if ( self.hasClass( className ) ) {
  34437. self.removeClass( className );
  34438. } else {
  34439. self.addClass( className );
  34440. }
  34441. }
  34442. // Toggle whole class name
  34443. } else if ( value === undefined || type === "boolean" ) {
  34444. className = getClass( this );
  34445. if ( className ) {
  34446. // Store className if set
  34447. dataPriv.set( this, "__className__", className );
  34448. }
  34449. // If the element has a class name or if we're passed `false`,
  34450. // then remove the whole classname (if there was one, the above saved it).
  34451. // Otherwise bring back whatever was previously saved (if anything),
  34452. // falling back to the empty string if nothing was stored.
  34453. if ( this.setAttribute ) {
  34454. this.setAttribute( "class",
  34455. className || value === false ?
  34456. "" :
  34457. dataPriv.get( this, "__className__" ) || ""
  34458. );
  34459. }
  34460. }
  34461. } );
  34462. },
  34463. hasClass: function( selector ) {
  34464. var className, elem,
  34465. i = 0;
  34466. className = " " + selector + " ";
  34467. while ( ( elem = this[ i++ ] ) ) {
  34468. if ( elem.nodeType === 1 &&
  34469. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  34470. return true;
  34471. }
  34472. }
  34473. return false;
  34474. }
  34475. } );
  34476. var rreturn = /\r/g;
  34477. jQuery.fn.extend( {
  34478. val: function( value ) {
  34479. var hooks, ret, valueIsFunction,
  34480. elem = this[ 0 ];
  34481. if ( !arguments.length ) {
  34482. if ( elem ) {
  34483. hooks = jQuery.valHooks[ elem.type ] ||
  34484. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  34485. if ( hooks &&
  34486. "get" in hooks &&
  34487. ( ret = hooks.get( elem, "value" ) ) !== undefined
  34488. ) {
  34489. return ret;
  34490. }
  34491. ret = elem.value;
  34492. // Handle most common string cases
  34493. if ( typeof ret === "string" ) {
  34494. return ret.replace( rreturn, "" );
  34495. }
  34496. // Handle cases where value is null/undef or number
  34497. return ret == null ? "" : ret;
  34498. }
  34499. return;
  34500. }
  34501. valueIsFunction = isFunction( value );
  34502. return this.each( function( i ) {
  34503. var val;
  34504. if ( this.nodeType !== 1 ) {
  34505. return;
  34506. }
  34507. if ( valueIsFunction ) {
  34508. val = value.call( this, i, jQuery( this ).val() );
  34509. } else {
  34510. val = value;
  34511. }
  34512. // Treat null/undefined as ""; convert numbers to string
  34513. if ( val == null ) {
  34514. val = "";
  34515. } else if ( typeof val === "number" ) {
  34516. val += "";
  34517. } else if ( Array.isArray( val ) ) {
  34518. val = jQuery.map( val, function( value ) {
  34519. return value == null ? "" : value + "";
  34520. } );
  34521. }
  34522. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  34523. // If set returns undefined, fall back to normal setting
  34524. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  34525. this.value = val;
  34526. }
  34527. } );
  34528. }
  34529. } );
  34530. jQuery.extend( {
  34531. valHooks: {
  34532. option: {
  34533. get: function( elem ) {
  34534. var val = jQuery.find.attr( elem, "value" );
  34535. return val != null ?
  34536. val :
  34537. // Support: IE <=10 - 11 only
  34538. // option.text throws exceptions (#14686, #14858)
  34539. // Strip and collapse whitespace
  34540. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  34541. stripAndCollapse( jQuery.text( elem ) );
  34542. }
  34543. },
  34544. select: {
  34545. get: function( elem ) {
  34546. var value, option, i,
  34547. options = elem.options,
  34548. index = elem.selectedIndex,
  34549. one = elem.type === "select-one",
  34550. values = one ? null : [],
  34551. max = one ? index + 1 : options.length;
  34552. if ( index < 0 ) {
  34553. i = max;
  34554. } else {
  34555. i = one ? index : 0;
  34556. }
  34557. // Loop through all the selected options
  34558. for ( ; i < max; i++ ) {
  34559. option = options[ i ];
  34560. // Support: IE <=9 only
  34561. // IE8-9 doesn't update selected after form reset (#2551)
  34562. if ( ( option.selected || i === index ) &&
  34563. // Don't return options that are disabled or in a disabled optgroup
  34564. !option.disabled &&
  34565. ( !option.parentNode.disabled ||
  34566. !nodeName( option.parentNode, "optgroup" ) ) ) {
  34567. // Get the specific value for the option
  34568. value = jQuery( option ).val();
  34569. // We don't need an array for one selects
  34570. if ( one ) {
  34571. return value;
  34572. }
  34573. // Multi-Selects return an array
  34574. values.push( value );
  34575. }
  34576. }
  34577. return values;
  34578. },
  34579. set: function( elem, value ) {
  34580. var optionSet, option,
  34581. options = elem.options,
  34582. values = jQuery.makeArray( value ),
  34583. i = options.length;
  34584. while ( i-- ) {
  34585. option = options[ i ];
  34586. /* eslint-disable no-cond-assign */
  34587. if ( option.selected =
  34588. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  34589. ) {
  34590. optionSet = true;
  34591. }
  34592. /* eslint-enable no-cond-assign */
  34593. }
  34594. // Force browsers to behave consistently when non-matching value is set
  34595. if ( !optionSet ) {
  34596. elem.selectedIndex = -1;
  34597. }
  34598. return values;
  34599. }
  34600. }
  34601. }
  34602. } );
  34603. // Radios and checkboxes getter/setter
  34604. jQuery.each( [ "radio", "checkbox" ], function() {
  34605. jQuery.valHooks[ this ] = {
  34606. set: function( elem, value ) {
  34607. if ( Array.isArray( value ) ) {
  34608. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  34609. }
  34610. }
  34611. };
  34612. if ( !support.checkOn ) {
  34613. jQuery.valHooks[ this ].get = function( elem ) {
  34614. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  34615. };
  34616. }
  34617. } );
  34618. // Return jQuery for attributes-only inclusion
  34619. support.focusin = "onfocusin" in window;
  34620. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  34621. stopPropagationCallback = function( e ) {
  34622. e.stopPropagation();
  34623. };
  34624. jQuery.extend( jQuery.event, {
  34625. trigger: function( event, data, elem, onlyHandlers ) {
  34626. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  34627. eventPath = [ elem || document ],
  34628. type = hasOwn.call( event, "type" ) ? event.type : event,
  34629. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  34630. cur = lastElement = tmp = elem = elem || document;
  34631. // Don't do events on text and comment nodes
  34632. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  34633. return;
  34634. }
  34635. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  34636. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  34637. return;
  34638. }
  34639. if ( type.indexOf( "." ) > -1 ) {
  34640. // Namespaced trigger; create a regexp to match event type in handle()
  34641. namespaces = type.split( "." );
  34642. type = namespaces.shift();
  34643. namespaces.sort();
  34644. }
  34645. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  34646. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  34647. event = event[ jQuery.expando ] ?
  34648. event :
  34649. new jQuery.Event( type, typeof event === "object" && event );
  34650. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  34651. event.isTrigger = onlyHandlers ? 2 : 3;
  34652. event.namespace = namespaces.join( "." );
  34653. event.rnamespace = event.namespace ?
  34654. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  34655. null;
  34656. // Clean up the event in case it is being reused
  34657. event.result = undefined;
  34658. if ( !event.target ) {
  34659. event.target = elem;
  34660. }
  34661. // Clone any incoming data and prepend the event, creating the handler arg list
  34662. data = data == null ?
  34663. [ event ] :
  34664. jQuery.makeArray( data, [ event ] );
  34665. // Allow special events to draw outside the lines
  34666. special = jQuery.event.special[ type ] || {};
  34667. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  34668. return;
  34669. }
  34670. // Determine event propagation path in advance, per W3C events spec (#9951)
  34671. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  34672. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  34673. bubbleType = special.delegateType || type;
  34674. if ( !rfocusMorph.test( bubbleType + type ) ) {
  34675. cur = cur.parentNode;
  34676. }
  34677. for ( ; cur; cur = cur.parentNode ) {
  34678. eventPath.push( cur );
  34679. tmp = cur;
  34680. }
  34681. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  34682. if ( tmp === ( elem.ownerDocument || document ) ) {
  34683. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  34684. }
  34685. }
  34686. // Fire handlers on the event path
  34687. i = 0;
  34688. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  34689. lastElement = cur;
  34690. event.type = i > 1 ?
  34691. bubbleType :
  34692. special.bindType || type;
  34693. // jQuery handler
  34694. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  34695. dataPriv.get( cur, "handle" );
  34696. if ( handle ) {
  34697. handle.apply( cur, data );
  34698. }
  34699. // Native handler
  34700. handle = ontype && cur[ ontype ];
  34701. if ( handle && handle.apply && acceptData( cur ) ) {
  34702. event.result = handle.apply( cur, data );
  34703. if ( event.result === false ) {
  34704. event.preventDefault();
  34705. }
  34706. }
  34707. }
  34708. event.type = type;
  34709. // If nobody prevented the default action, do it now
  34710. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  34711. if ( ( !special._default ||
  34712. special._default.apply( eventPath.pop(), data ) === false ) &&
  34713. acceptData( elem ) ) {
  34714. // Call a native DOM method on the target with the same name as the event.
  34715. // Don't do default actions on window, that's where global variables be (#6170)
  34716. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  34717. // Don't re-trigger an onFOO event when we call its FOO() method
  34718. tmp = elem[ ontype ];
  34719. if ( tmp ) {
  34720. elem[ ontype ] = null;
  34721. }
  34722. // Prevent re-triggering of the same event, since we already bubbled it above
  34723. jQuery.event.triggered = type;
  34724. if ( event.isPropagationStopped() ) {
  34725. lastElement.addEventListener( type, stopPropagationCallback );
  34726. }
  34727. elem[ type ]();
  34728. if ( event.isPropagationStopped() ) {
  34729. lastElement.removeEventListener( type, stopPropagationCallback );
  34730. }
  34731. jQuery.event.triggered = undefined;
  34732. if ( tmp ) {
  34733. elem[ ontype ] = tmp;
  34734. }
  34735. }
  34736. }
  34737. }
  34738. return event.result;
  34739. },
  34740. // Piggyback on a donor event to simulate a different one
  34741. // Used only for `focus(in | out)` events
  34742. simulate: function( type, elem, event ) {
  34743. var e = jQuery.extend(
  34744. new jQuery.Event(),
  34745. event,
  34746. {
  34747. type: type,
  34748. isSimulated: true
  34749. }
  34750. );
  34751. jQuery.event.trigger( e, null, elem );
  34752. }
  34753. } );
  34754. jQuery.fn.extend( {
  34755. trigger: function( type, data ) {
  34756. return this.each( function() {
  34757. jQuery.event.trigger( type, data, this );
  34758. } );
  34759. },
  34760. triggerHandler: function( type, data ) {
  34761. var elem = this[ 0 ];
  34762. if ( elem ) {
  34763. return jQuery.event.trigger( type, data, elem, true );
  34764. }
  34765. }
  34766. } );
  34767. // Support: Firefox <=44
  34768. // Firefox doesn't have focus(in | out) events
  34769. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  34770. //
  34771. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  34772. // focus(in | out) events fire after focus & blur events,
  34773. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  34774. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  34775. if ( !support.focusin ) {
  34776. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  34777. // Attach a single capturing handler on the document while someone wants focusin/focusout
  34778. var handler = function( event ) {
  34779. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  34780. };
  34781. jQuery.event.special[ fix ] = {
  34782. setup: function() {
  34783. var doc = this.ownerDocument || this,
  34784. attaches = dataPriv.access( doc, fix );
  34785. if ( !attaches ) {
  34786. doc.addEventListener( orig, handler, true );
  34787. }
  34788. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  34789. },
  34790. teardown: function() {
  34791. var doc = this.ownerDocument || this,
  34792. attaches = dataPriv.access( doc, fix ) - 1;
  34793. if ( !attaches ) {
  34794. doc.removeEventListener( orig, handler, true );
  34795. dataPriv.remove( doc, fix );
  34796. } else {
  34797. dataPriv.access( doc, fix, attaches );
  34798. }
  34799. }
  34800. };
  34801. } );
  34802. }
  34803. var location = window.location;
  34804. var nonce = Date.now();
  34805. var rquery = ( /\?/ );
  34806. // Cross-browser xml parsing
  34807. jQuery.parseXML = function( data ) {
  34808. var xml;
  34809. if ( !data || typeof data !== "string" ) {
  34810. return null;
  34811. }
  34812. // Support: IE 9 - 11 only
  34813. // IE throws on parseFromString with invalid input.
  34814. try {
  34815. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  34816. } catch ( e ) {
  34817. xml = undefined;
  34818. }
  34819. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  34820. jQuery.error( "Invalid XML: " + data );
  34821. }
  34822. return xml;
  34823. };
  34824. var
  34825. rbracket = /\[\]$/,
  34826. rCRLF = /\r?\n/g,
  34827. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  34828. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  34829. function buildParams( prefix, obj, traditional, add ) {
  34830. var name;
  34831. if ( Array.isArray( obj ) ) {
  34832. // Serialize array item.
  34833. jQuery.each( obj, function( i, v ) {
  34834. if ( traditional || rbracket.test( prefix ) ) {
  34835. // Treat each array item as a scalar.
  34836. add( prefix, v );
  34837. } else {
  34838. // Item is non-scalar (array or object), encode its numeric index.
  34839. buildParams(
  34840. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  34841. v,
  34842. traditional,
  34843. add
  34844. );
  34845. }
  34846. } );
  34847. } else if ( !traditional && toType( obj ) === "object" ) {
  34848. // Serialize object item.
  34849. for ( name in obj ) {
  34850. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  34851. }
  34852. } else {
  34853. // Serialize scalar item.
  34854. add( prefix, obj );
  34855. }
  34856. }
  34857. // Serialize an array of form elements or a set of
  34858. // key/values into a query string
  34859. jQuery.param = function( a, traditional ) {
  34860. var prefix,
  34861. s = [],
  34862. add = function( key, valueOrFunction ) {
  34863. // If value is a function, invoke it and use its return value
  34864. var value = isFunction( valueOrFunction ) ?
  34865. valueOrFunction() :
  34866. valueOrFunction;
  34867. s[ s.length ] = encodeURIComponent( key ) + "=" +
  34868. encodeURIComponent( value == null ? "" : value );
  34869. };
  34870. // If an array was passed in, assume that it is an array of form elements.
  34871. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  34872. // Serialize the form elements
  34873. jQuery.each( a, function() {
  34874. add( this.name, this.value );
  34875. } );
  34876. } else {
  34877. // If traditional, encode the "old" way (the way 1.3.2 or older
  34878. // did it), otherwise encode params recursively.
  34879. for ( prefix in a ) {
  34880. buildParams( prefix, a[ prefix ], traditional, add );
  34881. }
  34882. }
  34883. // Return the resulting serialization
  34884. return s.join( "&" );
  34885. };
  34886. jQuery.fn.extend( {
  34887. serialize: function() {
  34888. return jQuery.param( this.serializeArray() );
  34889. },
  34890. serializeArray: function() {
  34891. return this.map( function() {
  34892. // Can add propHook for "elements" to filter or add form elements
  34893. var elements = jQuery.prop( this, "elements" );
  34894. return elements ? jQuery.makeArray( elements ) : this;
  34895. } )
  34896. .filter( function() {
  34897. var type = this.type;
  34898. // Use .is( ":disabled" ) so that fieldset[disabled] works
  34899. return this.name && !jQuery( this ).is( ":disabled" ) &&
  34900. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  34901. ( this.checked || !rcheckableType.test( type ) );
  34902. } )
  34903. .map( function( i, elem ) {
  34904. var val = jQuery( this ).val();
  34905. if ( val == null ) {
  34906. return null;
  34907. }
  34908. if ( Array.isArray( val ) ) {
  34909. return jQuery.map( val, function( val ) {
  34910. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  34911. } );
  34912. }
  34913. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  34914. } ).get();
  34915. }
  34916. } );
  34917. var
  34918. r20 = /%20/g,
  34919. rhash = /#.*$/,
  34920. rantiCache = /([?&])_=[^&]*/,
  34921. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  34922. // #7653, #8125, #8152: local protocol detection
  34923. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  34924. rnoContent = /^(?:GET|HEAD)$/,
  34925. rprotocol = /^\/\//,
  34926. /* Prefilters
  34927. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  34928. * 2) These are called:
  34929. * - BEFORE asking for a transport
  34930. * - AFTER param serialization (s.data is a string if s.processData is true)
  34931. * 3) key is the dataType
  34932. * 4) the catchall symbol "*" can be used
  34933. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  34934. */
  34935. prefilters = {},
  34936. /* Transports bindings
  34937. * 1) key is the dataType
  34938. * 2) the catchall symbol "*" can be used
  34939. * 3) selection will start with transport dataType and THEN go to "*" if needed
  34940. */
  34941. transports = {},
  34942. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  34943. allTypes = "*/".concat( "*" ),
  34944. // Anchor tag for parsing the document origin
  34945. originAnchor = document.createElement( "a" );
  34946. originAnchor.href = location.href;
  34947. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  34948. function addToPrefiltersOrTransports( structure ) {
  34949. // dataTypeExpression is optional and defaults to "*"
  34950. return function( dataTypeExpression, func ) {
  34951. if ( typeof dataTypeExpression !== "string" ) {
  34952. func = dataTypeExpression;
  34953. dataTypeExpression = "*";
  34954. }
  34955. var dataType,
  34956. i = 0,
  34957. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  34958. if ( isFunction( func ) ) {
  34959. // For each dataType in the dataTypeExpression
  34960. while ( ( dataType = dataTypes[ i++ ] ) ) {
  34961. // Prepend if requested
  34962. if ( dataType[ 0 ] === "+" ) {
  34963. dataType = dataType.slice( 1 ) || "*";
  34964. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  34965. // Otherwise append
  34966. } else {
  34967. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  34968. }
  34969. }
  34970. }
  34971. };
  34972. }
  34973. // Base inspection function for prefilters and transports
  34974. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  34975. var inspected = {},
  34976. seekingTransport = ( structure === transports );
  34977. function inspect( dataType ) {
  34978. var selected;
  34979. inspected[ dataType ] = true;
  34980. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  34981. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  34982. if ( typeof dataTypeOrTransport === "string" &&
  34983. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  34984. options.dataTypes.unshift( dataTypeOrTransport );
  34985. inspect( dataTypeOrTransport );
  34986. return false;
  34987. } else if ( seekingTransport ) {
  34988. return !( selected = dataTypeOrTransport );
  34989. }
  34990. } );
  34991. return selected;
  34992. }
  34993. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  34994. }
  34995. // A special extend for ajax options
  34996. // that takes "flat" options (not to be deep extended)
  34997. // Fixes #9887
  34998. function ajaxExtend( target, src ) {
  34999. var key, deep,
  35000. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  35001. for ( key in src ) {
  35002. if ( src[ key ] !== undefined ) {
  35003. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  35004. }
  35005. }
  35006. if ( deep ) {
  35007. jQuery.extend( true, target, deep );
  35008. }
  35009. return target;
  35010. }
  35011. /* Handles responses to an ajax request:
  35012. * - finds the right dataType (mediates between content-type and expected dataType)
  35013. * - returns the corresponding response
  35014. */
  35015. function ajaxHandleResponses( s, jqXHR, responses ) {
  35016. var ct, type, finalDataType, firstDataType,
  35017. contents = s.contents,
  35018. dataTypes = s.dataTypes;
  35019. // Remove auto dataType and get content-type in the process
  35020. while ( dataTypes[ 0 ] === "*" ) {
  35021. dataTypes.shift();
  35022. if ( ct === undefined ) {
  35023. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  35024. }
  35025. }
  35026. // Check if we're dealing with a known content-type
  35027. if ( ct ) {
  35028. for ( type in contents ) {
  35029. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  35030. dataTypes.unshift( type );
  35031. break;
  35032. }
  35033. }
  35034. }
  35035. // Check to see if we have a response for the expected dataType
  35036. if ( dataTypes[ 0 ] in responses ) {
  35037. finalDataType = dataTypes[ 0 ];
  35038. } else {
  35039. // Try convertible dataTypes
  35040. for ( type in responses ) {
  35041. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  35042. finalDataType = type;
  35043. break;
  35044. }
  35045. if ( !firstDataType ) {
  35046. firstDataType = type;
  35047. }
  35048. }
  35049. // Or just use first one
  35050. finalDataType = finalDataType || firstDataType;
  35051. }
  35052. // If we found a dataType
  35053. // We add the dataType to the list if needed
  35054. // and return the corresponding response
  35055. if ( finalDataType ) {
  35056. if ( finalDataType !== dataTypes[ 0 ] ) {
  35057. dataTypes.unshift( finalDataType );
  35058. }
  35059. return responses[ finalDataType ];
  35060. }
  35061. }
  35062. /* Chain conversions given the request and the original response
  35063. * Also sets the responseXXX fields on the jqXHR instance
  35064. */
  35065. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  35066. var conv2, current, conv, tmp, prev,
  35067. converters = {},
  35068. // Work with a copy of dataTypes in case we need to modify it for conversion
  35069. dataTypes = s.dataTypes.slice();
  35070. // Create converters map with lowercased keys
  35071. if ( dataTypes[ 1 ] ) {
  35072. for ( conv in s.converters ) {
  35073. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  35074. }
  35075. }
  35076. current = dataTypes.shift();
  35077. // Convert to each sequential dataType
  35078. while ( current ) {
  35079. if ( s.responseFields[ current ] ) {
  35080. jqXHR[ s.responseFields[ current ] ] = response;
  35081. }
  35082. // Apply the dataFilter if provided
  35083. if ( !prev && isSuccess && s.dataFilter ) {
  35084. response = s.dataFilter( response, s.dataType );
  35085. }
  35086. prev = current;
  35087. current = dataTypes.shift();
  35088. if ( current ) {
  35089. // There's only work to do if current dataType is non-auto
  35090. if ( current === "*" ) {
  35091. current = prev;
  35092. // Convert response if prev dataType is non-auto and differs from current
  35093. } else if ( prev !== "*" && prev !== current ) {
  35094. // Seek a direct converter
  35095. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  35096. // If none found, seek a pair
  35097. if ( !conv ) {
  35098. for ( conv2 in converters ) {
  35099. // If conv2 outputs current
  35100. tmp = conv2.split( " " );
  35101. if ( tmp[ 1 ] === current ) {
  35102. // If prev can be converted to accepted input
  35103. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  35104. converters[ "* " + tmp[ 0 ] ];
  35105. if ( conv ) {
  35106. // Condense equivalence converters
  35107. if ( conv === true ) {
  35108. conv = converters[ conv2 ];
  35109. // Otherwise, insert the intermediate dataType
  35110. } else if ( converters[ conv2 ] !== true ) {
  35111. current = tmp[ 0 ];
  35112. dataTypes.unshift( tmp[ 1 ] );
  35113. }
  35114. break;
  35115. }
  35116. }
  35117. }
  35118. }
  35119. // Apply converter (if not an equivalence)
  35120. if ( conv !== true ) {
  35121. // Unless errors are allowed to bubble, catch and return them
  35122. if ( conv && s.throws ) {
  35123. response = conv( response );
  35124. } else {
  35125. try {
  35126. response = conv( response );
  35127. } catch ( e ) {
  35128. return {
  35129. state: "parsererror",
  35130. error: conv ? e : "No conversion from " + prev + " to " + current
  35131. };
  35132. }
  35133. }
  35134. }
  35135. }
  35136. }
  35137. }
  35138. return { state: "success", data: response };
  35139. }
  35140. jQuery.extend( {
  35141. // Counter for holding the number of active queries
  35142. active: 0,
  35143. // Last-Modified header cache for next request
  35144. lastModified: {},
  35145. etag: {},
  35146. ajaxSettings: {
  35147. url: location.href,
  35148. type: "GET",
  35149. isLocal: rlocalProtocol.test( location.protocol ),
  35150. global: true,
  35151. processData: true,
  35152. async: true,
  35153. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  35154. /*
  35155. timeout: 0,
  35156. data: null,
  35157. dataType: null,
  35158. username: null,
  35159. password: null,
  35160. cache: null,
  35161. throws: false,
  35162. traditional: false,
  35163. headers: {},
  35164. */
  35165. accepts: {
  35166. "*": allTypes,
  35167. text: "text/plain",
  35168. html: "text/html",
  35169. xml: "application/xml, text/xml",
  35170. json: "application/json, text/javascript"
  35171. },
  35172. contents: {
  35173. xml: /\bxml\b/,
  35174. html: /\bhtml/,
  35175. json: /\bjson\b/
  35176. },
  35177. responseFields: {
  35178. xml: "responseXML",
  35179. text: "responseText",
  35180. json: "responseJSON"
  35181. },
  35182. // Data converters
  35183. // Keys separate source (or catchall "*") and destination types with a single space
  35184. converters: {
  35185. // Convert anything to text
  35186. "* text": String,
  35187. // Text to html (true = no transformation)
  35188. "text html": true,
  35189. // Evaluate text as a json expression
  35190. "text json": JSON.parse,
  35191. // Parse text as xml
  35192. "text xml": jQuery.parseXML
  35193. },
  35194. // For options that shouldn't be deep extended:
  35195. // you can add your own custom options here if
  35196. // and when you create one that shouldn't be
  35197. // deep extended (see ajaxExtend)
  35198. flatOptions: {
  35199. url: true,
  35200. context: true
  35201. }
  35202. },
  35203. // Creates a full fledged settings object into target
  35204. // with both ajaxSettings and settings fields.
  35205. // If target is omitted, writes into ajaxSettings.
  35206. ajaxSetup: function( target, settings ) {
  35207. return settings ?
  35208. // Building a settings object
  35209. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  35210. // Extending ajaxSettings
  35211. ajaxExtend( jQuery.ajaxSettings, target );
  35212. },
  35213. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  35214. ajaxTransport: addToPrefiltersOrTransports( transports ),
  35215. // Main method
  35216. ajax: function( url, options ) {
  35217. // If url is an object, simulate pre-1.5 signature
  35218. if ( typeof url === "object" ) {
  35219. options = url;
  35220. url = undefined;
  35221. }
  35222. // Force options to be an object
  35223. options = options || {};
  35224. var transport,
  35225. // URL without anti-cache param
  35226. cacheURL,
  35227. // Response headers
  35228. responseHeadersString,
  35229. responseHeaders,
  35230. // timeout handle
  35231. timeoutTimer,
  35232. // Url cleanup var
  35233. urlAnchor,
  35234. // Request state (becomes false upon send and true upon completion)
  35235. completed,
  35236. // To know if global events are to be dispatched
  35237. fireGlobals,
  35238. // Loop variable
  35239. i,
  35240. // uncached part of the url
  35241. uncached,
  35242. // Create the final options object
  35243. s = jQuery.ajaxSetup( {}, options ),
  35244. // Callbacks context
  35245. callbackContext = s.context || s,
  35246. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  35247. globalEventContext = s.context &&
  35248. ( callbackContext.nodeType || callbackContext.jquery ) ?
  35249. jQuery( callbackContext ) :
  35250. jQuery.event,
  35251. // Deferreds
  35252. deferred = jQuery.Deferred(),
  35253. completeDeferred = jQuery.Callbacks( "once memory" ),
  35254. // Status-dependent callbacks
  35255. statusCode = s.statusCode || {},
  35256. // Headers (they are sent all at once)
  35257. requestHeaders = {},
  35258. requestHeadersNames = {},
  35259. // Default abort message
  35260. strAbort = "canceled",
  35261. // Fake xhr
  35262. jqXHR = {
  35263. readyState: 0,
  35264. // Builds headers hashtable if needed
  35265. getResponseHeader: function( key ) {
  35266. var match;
  35267. if ( completed ) {
  35268. if ( !responseHeaders ) {
  35269. responseHeaders = {};
  35270. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  35271. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  35272. }
  35273. }
  35274. match = responseHeaders[ key.toLowerCase() ];
  35275. }
  35276. return match == null ? null : match;
  35277. },
  35278. // Raw string
  35279. getAllResponseHeaders: function() {
  35280. return completed ? responseHeadersString : null;
  35281. },
  35282. // Caches the header
  35283. setRequestHeader: function( name, value ) {
  35284. if ( completed == null ) {
  35285. name = requestHeadersNames[ name.toLowerCase() ] =
  35286. requestHeadersNames[ name.toLowerCase() ] || name;
  35287. requestHeaders[ name ] = value;
  35288. }
  35289. return this;
  35290. },
  35291. // Overrides response content-type header
  35292. overrideMimeType: function( type ) {
  35293. if ( completed == null ) {
  35294. s.mimeType = type;
  35295. }
  35296. return this;
  35297. },
  35298. // Status-dependent callbacks
  35299. statusCode: function( map ) {
  35300. var code;
  35301. if ( map ) {
  35302. if ( completed ) {
  35303. // Execute the appropriate callbacks
  35304. jqXHR.always( map[ jqXHR.status ] );
  35305. } else {
  35306. // Lazy-add the new callbacks in a way that preserves old ones
  35307. for ( code in map ) {
  35308. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  35309. }
  35310. }
  35311. }
  35312. return this;
  35313. },
  35314. // Cancel the request
  35315. abort: function( statusText ) {
  35316. var finalText = statusText || strAbort;
  35317. if ( transport ) {
  35318. transport.abort( finalText );
  35319. }
  35320. done( 0, finalText );
  35321. return this;
  35322. }
  35323. };
  35324. // Attach deferreds
  35325. deferred.promise( jqXHR );
  35326. // Add protocol if not provided (prefilters might expect it)
  35327. // Handle falsy url in the settings object (#10093: consistency with old signature)
  35328. // We also use the url parameter if available
  35329. s.url = ( ( url || s.url || location.href ) + "" )
  35330. .replace( rprotocol, location.protocol + "//" );
  35331. // Alias method option to type as per ticket #12004
  35332. s.type = options.method || options.type || s.method || s.type;
  35333. // Extract dataTypes list
  35334. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  35335. // A cross-domain request is in order when the origin doesn't match the current origin.
  35336. if ( s.crossDomain == null ) {
  35337. urlAnchor = document.createElement( "a" );
  35338. // Support: IE <=8 - 11, Edge 12 - 15
  35339. // IE throws exception on accessing the href property if url is malformed,
  35340. // e.g. http://example.com:80x/
  35341. try {
  35342. urlAnchor.href = s.url;
  35343. // Support: IE <=8 - 11 only
  35344. // Anchor's host property isn't correctly set when s.url is relative
  35345. urlAnchor.href = urlAnchor.href;
  35346. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  35347. urlAnchor.protocol + "//" + urlAnchor.host;
  35348. } catch ( e ) {
  35349. // If there is an error parsing the URL, assume it is crossDomain,
  35350. // it can be rejected by the transport if it is invalid
  35351. s.crossDomain = true;
  35352. }
  35353. }
  35354. // Convert data if not already a string
  35355. if ( s.data && s.processData && typeof s.data !== "string" ) {
  35356. s.data = jQuery.param( s.data, s.traditional );
  35357. }
  35358. // Apply prefilters
  35359. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  35360. // If request was aborted inside a prefilter, stop there
  35361. if ( completed ) {
  35362. return jqXHR;
  35363. }
  35364. // We can fire global events as of now if asked to
  35365. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  35366. fireGlobals = jQuery.event && s.global;
  35367. // Watch for a new set of requests
  35368. if ( fireGlobals && jQuery.active++ === 0 ) {
  35369. jQuery.event.trigger( "ajaxStart" );
  35370. }
  35371. // Uppercase the type
  35372. s.type = s.type.toUpperCase();
  35373. // Determine if request has content
  35374. s.hasContent = !rnoContent.test( s.type );
  35375. // Save the URL in case we're toying with the If-Modified-Since
  35376. // and/or If-None-Match header later on
  35377. // Remove hash to simplify url manipulation
  35378. cacheURL = s.url.replace( rhash, "" );
  35379. // More options handling for requests with no content
  35380. if ( !s.hasContent ) {
  35381. // Remember the hash so we can put it back
  35382. uncached = s.url.slice( cacheURL.length );
  35383. // If data is available and should be processed, append data to url
  35384. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  35385. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  35386. // #9682: remove data so that it's not used in an eventual retry
  35387. delete s.data;
  35388. }
  35389. // Add or update anti-cache param if needed
  35390. if ( s.cache === false ) {
  35391. cacheURL = cacheURL.replace( rantiCache, "$1" );
  35392. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  35393. }
  35394. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  35395. s.url = cacheURL + uncached;
  35396. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  35397. } else if ( s.data && s.processData &&
  35398. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  35399. s.data = s.data.replace( r20, "+" );
  35400. }
  35401. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  35402. if ( s.ifModified ) {
  35403. if ( jQuery.lastModified[ cacheURL ] ) {
  35404. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  35405. }
  35406. if ( jQuery.etag[ cacheURL ] ) {
  35407. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  35408. }
  35409. }
  35410. // Set the correct header, if data is being sent
  35411. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  35412. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  35413. }
  35414. // Set the Accepts header for the server, depending on the dataType
  35415. jqXHR.setRequestHeader(
  35416. "Accept",
  35417. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  35418. s.accepts[ s.dataTypes[ 0 ] ] +
  35419. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  35420. s.accepts[ "*" ]
  35421. );
  35422. // Check for headers option
  35423. for ( i in s.headers ) {
  35424. jqXHR.setRequestHeader( i, s.headers[ i ] );
  35425. }
  35426. // Allow custom headers/mimetypes and early abort
  35427. if ( s.beforeSend &&
  35428. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  35429. // Abort if not done already and return
  35430. return jqXHR.abort();
  35431. }
  35432. // Aborting is no longer a cancellation
  35433. strAbort = "abort";
  35434. // Install callbacks on deferreds
  35435. completeDeferred.add( s.complete );
  35436. jqXHR.done( s.success );
  35437. jqXHR.fail( s.error );
  35438. // Get transport
  35439. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  35440. // If no transport, we auto-abort
  35441. if ( !transport ) {
  35442. done( -1, "No Transport" );
  35443. } else {
  35444. jqXHR.readyState = 1;
  35445. // Send global event
  35446. if ( fireGlobals ) {
  35447. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  35448. }
  35449. // If request was aborted inside ajaxSend, stop there
  35450. if ( completed ) {
  35451. return jqXHR;
  35452. }
  35453. // Timeout
  35454. if ( s.async && s.timeout > 0 ) {
  35455. timeoutTimer = window.setTimeout( function() {
  35456. jqXHR.abort( "timeout" );
  35457. }, s.timeout );
  35458. }
  35459. try {
  35460. completed = false;
  35461. transport.send( requestHeaders, done );
  35462. } catch ( e ) {
  35463. // Rethrow post-completion exceptions
  35464. if ( completed ) {
  35465. throw e;
  35466. }
  35467. // Propagate others as results
  35468. done( -1, e );
  35469. }
  35470. }
  35471. // Callback for when everything is done
  35472. function done( status, nativeStatusText, responses, headers ) {
  35473. var isSuccess, success, error, response, modified,
  35474. statusText = nativeStatusText;
  35475. // Ignore repeat invocations
  35476. if ( completed ) {
  35477. return;
  35478. }
  35479. completed = true;
  35480. // Clear timeout if it exists
  35481. if ( timeoutTimer ) {
  35482. window.clearTimeout( timeoutTimer );
  35483. }
  35484. // Dereference transport for early garbage collection
  35485. // (no matter how long the jqXHR object will be used)
  35486. transport = undefined;
  35487. // Cache response headers
  35488. responseHeadersString = headers || "";
  35489. // Set readyState
  35490. jqXHR.readyState = status > 0 ? 4 : 0;
  35491. // Determine if successful
  35492. isSuccess = status >= 200 && status < 300 || status === 304;
  35493. // Get response data
  35494. if ( responses ) {
  35495. response = ajaxHandleResponses( s, jqXHR, responses );
  35496. }
  35497. // Convert no matter what (that way responseXXX fields are always set)
  35498. response = ajaxConvert( s, response, jqXHR, isSuccess );
  35499. // If successful, handle type chaining
  35500. if ( isSuccess ) {
  35501. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  35502. if ( s.ifModified ) {
  35503. modified = jqXHR.getResponseHeader( "Last-Modified" );
  35504. if ( modified ) {
  35505. jQuery.lastModified[ cacheURL ] = modified;
  35506. }
  35507. modified = jqXHR.getResponseHeader( "etag" );
  35508. if ( modified ) {
  35509. jQuery.etag[ cacheURL ] = modified;
  35510. }
  35511. }
  35512. // if no content
  35513. if ( status === 204 || s.type === "HEAD" ) {
  35514. statusText = "nocontent";
  35515. // if not modified
  35516. } else if ( status === 304 ) {
  35517. statusText = "notmodified";
  35518. // If we have data, let's convert it
  35519. } else {
  35520. statusText = response.state;
  35521. success = response.data;
  35522. error = response.error;
  35523. isSuccess = !error;
  35524. }
  35525. } else {
  35526. // Extract error from statusText and normalize for non-aborts
  35527. error = statusText;
  35528. if ( status || !statusText ) {
  35529. statusText = "error";
  35530. if ( status < 0 ) {
  35531. status = 0;
  35532. }
  35533. }
  35534. }
  35535. // Set data for the fake xhr object
  35536. jqXHR.status = status;
  35537. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  35538. // Success/Error
  35539. if ( isSuccess ) {
  35540. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  35541. } else {
  35542. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  35543. }
  35544. // Status-dependent callbacks
  35545. jqXHR.statusCode( statusCode );
  35546. statusCode = undefined;
  35547. if ( fireGlobals ) {
  35548. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  35549. [ jqXHR, s, isSuccess ? success : error ] );
  35550. }
  35551. // Complete
  35552. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  35553. if ( fireGlobals ) {
  35554. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  35555. // Handle the global AJAX counter
  35556. if ( !( --jQuery.active ) ) {
  35557. jQuery.event.trigger( "ajaxStop" );
  35558. }
  35559. }
  35560. }
  35561. return jqXHR;
  35562. },
  35563. getJSON: function( url, data, callback ) {
  35564. return jQuery.get( url, data, callback, "json" );
  35565. },
  35566. getScript: function( url, callback ) {
  35567. return jQuery.get( url, undefined, callback, "script" );
  35568. }
  35569. } );
  35570. jQuery.each( [ "get", "post" ], function( i, method ) {
  35571. jQuery[ method ] = function( url, data, callback, type ) {
  35572. // Shift arguments if data argument was omitted
  35573. if ( isFunction( data ) ) {
  35574. type = type || callback;
  35575. callback = data;
  35576. data = undefined;
  35577. }
  35578. // The url can be an options object (which then must have .url)
  35579. return jQuery.ajax( jQuery.extend( {
  35580. url: url,
  35581. type: method,
  35582. dataType: type,
  35583. data: data,
  35584. success: callback
  35585. }, jQuery.isPlainObject( url ) && url ) );
  35586. };
  35587. } );
  35588. jQuery._evalUrl = function( url ) {
  35589. return jQuery.ajax( {
  35590. url: url,
  35591. // Make this explicit, since user can override this through ajaxSetup (#11264)
  35592. type: "GET",
  35593. dataType: "script",
  35594. cache: true,
  35595. async: false,
  35596. global: false,
  35597. "throws": true
  35598. } );
  35599. };
  35600. jQuery.fn.extend( {
  35601. wrapAll: function( html ) {
  35602. var wrap;
  35603. if ( this[ 0 ] ) {
  35604. if ( isFunction( html ) ) {
  35605. html = html.call( this[ 0 ] );
  35606. }
  35607. // The elements to wrap the target around
  35608. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  35609. if ( this[ 0 ].parentNode ) {
  35610. wrap.insertBefore( this[ 0 ] );
  35611. }
  35612. wrap.map( function() {
  35613. var elem = this;
  35614. while ( elem.firstElementChild ) {
  35615. elem = elem.firstElementChild;
  35616. }
  35617. return elem;
  35618. } ).append( this );
  35619. }
  35620. return this;
  35621. },
  35622. wrapInner: function( html ) {
  35623. if ( isFunction( html ) ) {
  35624. return this.each( function( i ) {
  35625. jQuery( this ).wrapInner( html.call( this, i ) );
  35626. } );
  35627. }
  35628. return this.each( function() {
  35629. var self = jQuery( this ),
  35630. contents = self.contents();
  35631. if ( contents.length ) {
  35632. contents.wrapAll( html );
  35633. } else {
  35634. self.append( html );
  35635. }
  35636. } );
  35637. },
  35638. wrap: function( html ) {
  35639. var htmlIsFunction = isFunction( html );
  35640. return this.each( function( i ) {
  35641. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  35642. } );
  35643. },
  35644. unwrap: function( selector ) {
  35645. this.parent( selector ).not( "body" ).each( function() {
  35646. jQuery( this ).replaceWith( this.childNodes );
  35647. } );
  35648. return this;
  35649. }
  35650. } );
  35651. jQuery.expr.pseudos.hidden = function( elem ) {
  35652. return !jQuery.expr.pseudos.visible( elem );
  35653. };
  35654. jQuery.expr.pseudos.visible = function( elem ) {
  35655. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  35656. };
  35657. jQuery.ajaxSettings.xhr = function() {
  35658. try {
  35659. return new window.XMLHttpRequest();
  35660. } catch ( e ) {}
  35661. };
  35662. var xhrSuccessStatus = {
  35663. // File protocol always yields status code 0, assume 200
  35664. 0: 200,
  35665. // Support: IE <=9 only
  35666. // #1450: sometimes IE returns 1223 when it should be 204
  35667. 1223: 204
  35668. },
  35669. xhrSupported = jQuery.ajaxSettings.xhr();
  35670. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  35671. support.ajax = xhrSupported = !!xhrSupported;
  35672. jQuery.ajaxTransport( function( options ) {
  35673. var callback, errorCallback;
  35674. // Cross domain only allowed if supported through XMLHttpRequest
  35675. if ( support.cors || xhrSupported && !options.crossDomain ) {
  35676. return {
  35677. send: function( headers, complete ) {
  35678. var i,
  35679. xhr = options.xhr();
  35680. xhr.open(
  35681. options.type,
  35682. options.url,
  35683. options.async,
  35684. options.username,
  35685. options.password
  35686. );
  35687. // Apply custom fields if provided
  35688. if ( options.xhrFields ) {
  35689. for ( i in options.xhrFields ) {
  35690. xhr[ i ] = options.xhrFields[ i ];
  35691. }
  35692. }
  35693. // Override mime type if needed
  35694. if ( options.mimeType && xhr.overrideMimeType ) {
  35695. xhr.overrideMimeType( options.mimeType );
  35696. }
  35697. // X-Requested-With header
  35698. // For cross-domain requests, seeing as conditions for a preflight are
  35699. // akin to a jigsaw puzzle, we simply never set it to be sure.
  35700. // (it can always be set on a per-request basis or even using ajaxSetup)
  35701. // For same-domain requests, won't change header if already provided.
  35702. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  35703. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  35704. }
  35705. // Set headers
  35706. for ( i in headers ) {
  35707. xhr.setRequestHeader( i, headers[ i ] );
  35708. }
  35709. // Callback
  35710. callback = function( type ) {
  35711. return function() {
  35712. if ( callback ) {
  35713. callback = errorCallback = xhr.onload =
  35714. xhr.onerror = xhr.onabort = xhr.ontimeout =
  35715. xhr.onreadystatechange = null;
  35716. if ( type === "abort" ) {
  35717. xhr.abort();
  35718. } else if ( type === "error" ) {
  35719. // Support: IE <=9 only
  35720. // On a manual native abort, IE9 throws
  35721. // errors on any property access that is not readyState
  35722. if ( typeof xhr.status !== "number" ) {
  35723. complete( 0, "error" );
  35724. } else {
  35725. complete(
  35726. // File: protocol always yields status 0; see #8605, #14207
  35727. xhr.status,
  35728. xhr.statusText
  35729. );
  35730. }
  35731. } else {
  35732. complete(
  35733. xhrSuccessStatus[ xhr.status ] || xhr.status,
  35734. xhr.statusText,
  35735. // Support: IE <=9 only
  35736. // IE9 has no XHR2 but throws on binary (trac-11426)
  35737. // For XHR2 non-text, let the caller handle it (gh-2498)
  35738. ( xhr.responseType || "text" ) !== "text" ||
  35739. typeof xhr.responseText !== "string" ?
  35740. { binary: xhr.response } :
  35741. { text: xhr.responseText },
  35742. xhr.getAllResponseHeaders()
  35743. );
  35744. }
  35745. }
  35746. };
  35747. };
  35748. // Listen to events
  35749. xhr.onload = callback();
  35750. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  35751. // Support: IE 9 only
  35752. // Use onreadystatechange to replace onabort
  35753. // to handle uncaught aborts
  35754. if ( xhr.onabort !== undefined ) {
  35755. xhr.onabort = errorCallback;
  35756. } else {
  35757. xhr.onreadystatechange = function() {
  35758. // Check readyState before timeout as it changes
  35759. if ( xhr.readyState === 4 ) {
  35760. // Allow onerror to be called first,
  35761. // but that will not handle a native abort
  35762. // Also, save errorCallback to a variable
  35763. // as xhr.onerror cannot be accessed
  35764. window.setTimeout( function() {
  35765. if ( callback ) {
  35766. errorCallback();
  35767. }
  35768. } );
  35769. }
  35770. };
  35771. }
  35772. // Create the abort callback
  35773. callback = callback( "abort" );
  35774. try {
  35775. // Do send the request (this may raise an exception)
  35776. xhr.send( options.hasContent && options.data || null );
  35777. } catch ( e ) {
  35778. // #14683: Only rethrow if this hasn't been notified as an error yet
  35779. if ( callback ) {
  35780. throw e;
  35781. }
  35782. }
  35783. },
  35784. abort: function() {
  35785. if ( callback ) {
  35786. callback();
  35787. }
  35788. }
  35789. };
  35790. }
  35791. } );
  35792. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  35793. jQuery.ajaxPrefilter( function( s ) {
  35794. if ( s.crossDomain ) {
  35795. s.contents.script = false;
  35796. }
  35797. } );
  35798. // Install script dataType
  35799. jQuery.ajaxSetup( {
  35800. accepts: {
  35801. script: "text/javascript, application/javascript, " +
  35802. "application/ecmascript, application/x-ecmascript"
  35803. },
  35804. contents: {
  35805. script: /\b(?:java|ecma)script\b/
  35806. },
  35807. converters: {
  35808. "text script": function( text ) {
  35809. jQuery.globalEval( text );
  35810. return text;
  35811. }
  35812. }
  35813. } );
  35814. // Handle cache's special case and crossDomain
  35815. jQuery.ajaxPrefilter( "script", function( s ) {
  35816. if ( s.cache === undefined ) {
  35817. s.cache = false;
  35818. }
  35819. if ( s.crossDomain ) {
  35820. s.type = "GET";
  35821. }
  35822. } );
  35823. // Bind script tag hack transport
  35824. jQuery.ajaxTransport( "script", function( s ) {
  35825. // This transport only deals with cross domain requests
  35826. if ( s.crossDomain ) {
  35827. var script, callback;
  35828. return {
  35829. send: function( _, complete ) {
  35830. script = jQuery( "<script>" ).prop( {
  35831. charset: s.scriptCharset,
  35832. src: s.url
  35833. } ).on(
  35834. "load error",
  35835. callback = function( evt ) {
  35836. script.remove();
  35837. callback = null;
  35838. if ( evt ) {
  35839. complete( evt.type === "error" ? 404 : 200, evt.type );
  35840. }
  35841. }
  35842. );
  35843. // Use native DOM manipulation to avoid our domManip AJAX trickery
  35844. document.head.appendChild( script[ 0 ] );
  35845. },
  35846. abort: function() {
  35847. if ( callback ) {
  35848. callback();
  35849. }
  35850. }
  35851. };
  35852. }
  35853. } );
  35854. var oldCallbacks = [],
  35855. rjsonp = /(=)\?(?=&|$)|\?\?/;
  35856. // Default jsonp settings
  35857. jQuery.ajaxSetup( {
  35858. jsonp: "callback",
  35859. jsonpCallback: function() {
  35860. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  35861. this[ callback ] = true;
  35862. return callback;
  35863. }
  35864. } );
  35865. // Detect, normalize options and install callbacks for jsonp requests
  35866. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  35867. var callbackName, overwritten, responseContainer,
  35868. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  35869. "url" :
  35870. typeof s.data === "string" &&
  35871. ( s.contentType || "" )
  35872. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  35873. rjsonp.test( s.data ) && "data"
  35874. );
  35875. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  35876. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  35877. // Get callback name, remembering preexisting value associated with it
  35878. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  35879. s.jsonpCallback() :
  35880. s.jsonpCallback;
  35881. // Insert callback into url or form data
  35882. if ( jsonProp ) {
  35883. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  35884. } else if ( s.jsonp !== false ) {
  35885. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  35886. }
  35887. // Use data converter to retrieve json after script execution
  35888. s.converters[ "script json" ] = function() {
  35889. if ( !responseContainer ) {
  35890. jQuery.error( callbackName + " was not called" );
  35891. }
  35892. return responseContainer[ 0 ];
  35893. };
  35894. // Force json dataType
  35895. s.dataTypes[ 0 ] = "json";
  35896. // Install callback
  35897. overwritten = window[ callbackName ];
  35898. window[ callbackName ] = function() {
  35899. responseContainer = arguments;
  35900. };
  35901. // Clean-up function (fires after converters)
  35902. jqXHR.always( function() {
  35903. // If previous value didn't exist - remove it
  35904. if ( overwritten === undefined ) {
  35905. jQuery( window ).removeProp( callbackName );
  35906. // Otherwise restore preexisting value
  35907. } else {
  35908. window[ callbackName ] = overwritten;
  35909. }
  35910. // Save back as free
  35911. if ( s[ callbackName ] ) {
  35912. // Make sure that re-using the options doesn't screw things around
  35913. s.jsonpCallback = originalSettings.jsonpCallback;
  35914. // Save the callback name for future use
  35915. oldCallbacks.push( callbackName );
  35916. }
  35917. // Call if it was a function and we have a response
  35918. if ( responseContainer && isFunction( overwritten ) ) {
  35919. overwritten( responseContainer[ 0 ] );
  35920. }
  35921. responseContainer = overwritten = undefined;
  35922. } );
  35923. // Delegate to script
  35924. return "script";
  35925. }
  35926. } );
  35927. // Support: Safari 8 only
  35928. // In Safari 8 documents created via document.implementation.createHTMLDocument
  35929. // collapse sibling forms: the second one becomes a child of the first one.
  35930. // Because of that, this security measure has to be disabled in Safari 8.
  35931. // https://bugs.webkit.org/show_bug.cgi?id=137337
  35932. support.createHTMLDocument = ( function() {
  35933. var body = document.implementation.createHTMLDocument( "" ).body;
  35934. body.innerHTML = "<form></form><form></form>";
  35935. return body.childNodes.length === 2;
  35936. } )();
  35937. // Argument "data" should be string of html
  35938. // context (optional): If specified, the fragment will be created in this context,
  35939. // defaults to document
  35940. // keepScripts (optional): If true, will include scripts passed in the html string
  35941. jQuery.parseHTML = function( data, context, keepScripts ) {
  35942. if ( typeof data !== "string" ) {
  35943. return [];
  35944. }
  35945. if ( typeof context === "boolean" ) {
  35946. keepScripts = context;
  35947. context = false;
  35948. }
  35949. var base, parsed, scripts;
  35950. if ( !context ) {
  35951. // Stop scripts or inline event handlers from being executed immediately
  35952. // by using document.implementation
  35953. if ( support.createHTMLDocument ) {
  35954. context = document.implementation.createHTMLDocument( "" );
  35955. // Set the base href for the created document
  35956. // so any parsed elements with URLs
  35957. // are based on the document's URL (gh-2965)
  35958. base = context.createElement( "base" );
  35959. base.href = document.location.href;
  35960. context.head.appendChild( base );
  35961. } else {
  35962. context = document;
  35963. }
  35964. }
  35965. parsed = rsingleTag.exec( data );
  35966. scripts = !keepScripts && [];
  35967. // Single tag
  35968. if ( parsed ) {
  35969. return [ context.createElement( parsed[ 1 ] ) ];
  35970. }
  35971. parsed = buildFragment( [ data ], context, scripts );
  35972. if ( scripts && scripts.length ) {
  35973. jQuery( scripts ).remove();
  35974. }
  35975. return jQuery.merge( [], parsed.childNodes );
  35976. };
  35977. /**
  35978. * Load a url into a page
  35979. */
  35980. jQuery.fn.load = function( url, params, callback ) {
  35981. var selector, type, response,
  35982. self = this,
  35983. off = url.indexOf( " " );
  35984. if ( off > -1 ) {
  35985. selector = stripAndCollapse( url.slice( off ) );
  35986. url = url.slice( 0, off );
  35987. }
  35988. // If it's a function
  35989. if ( isFunction( params ) ) {
  35990. // We assume that it's the callback
  35991. callback = params;
  35992. params = undefined;
  35993. // Otherwise, build a param string
  35994. } else if ( params && typeof params === "object" ) {
  35995. type = "POST";
  35996. }
  35997. // If we have elements to modify, make the request
  35998. if ( self.length > 0 ) {
  35999. jQuery.ajax( {
  36000. url: url,
  36001. // If "type" variable is undefined, then "GET" method will be used.
  36002. // Make value of this field explicit since
  36003. // user can override it through ajaxSetup method
  36004. type: type || "GET",
  36005. dataType: "html",
  36006. data: params
  36007. } ).done( function( responseText ) {
  36008. // Save response for use in complete callback
  36009. response = arguments;
  36010. self.html( selector ?
  36011. // If a selector was specified, locate the right elements in a dummy div
  36012. // Exclude scripts to avoid IE 'Permission Denied' errors
  36013. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  36014. // Otherwise use the full result
  36015. responseText );
  36016. // If the request succeeds, this function gets "data", "status", "jqXHR"
  36017. // but they are ignored because response was set above.
  36018. // If it fails, this function gets "jqXHR", "status", "error"
  36019. } ).always( callback && function( jqXHR, status ) {
  36020. self.each( function() {
  36021. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  36022. } );
  36023. } );
  36024. }
  36025. return this;
  36026. };
  36027. // Attach a bunch of functions for handling common AJAX events
  36028. jQuery.each( [
  36029. "ajaxStart",
  36030. "ajaxStop",
  36031. "ajaxComplete",
  36032. "ajaxError",
  36033. "ajaxSuccess",
  36034. "ajaxSend"
  36035. ], function( i, type ) {
  36036. jQuery.fn[ type ] = function( fn ) {
  36037. return this.on( type, fn );
  36038. };
  36039. } );
  36040. jQuery.expr.pseudos.animated = function( elem ) {
  36041. return jQuery.grep( jQuery.timers, function( fn ) {
  36042. return elem === fn.elem;
  36043. } ).length;
  36044. };
  36045. jQuery.offset = {
  36046. setOffset: function( elem, options, i ) {
  36047. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  36048. position = jQuery.css( elem, "position" ),
  36049. curElem = jQuery( elem ),
  36050. props = {};
  36051. // Set position first, in-case top/left are set even on static elem
  36052. if ( position === "static" ) {
  36053. elem.style.position = "relative";
  36054. }
  36055. curOffset = curElem.offset();
  36056. curCSSTop = jQuery.css( elem, "top" );
  36057. curCSSLeft = jQuery.css( elem, "left" );
  36058. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  36059. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  36060. // Need to be able to calculate position if either
  36061. // top or left is auto and position is either absolute or fixed
  36062. if ( calculatePosition ) {
  36063. curPosition = curElem.position();
  36064. curTop = curPosition.top;
  36065. curLeft = curPosition.left;
  36066. } else {
  36067. curTop = parseFloat( curCSSTop ) || 0;
  36068. curLeft = parseFloat( curCSSLeft ) || 0;
  36069. }
  36070. if ( isFunction( options ) ) {
  36071. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  36072. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  36073. }
  36074. if ( options.top != null ) {
  36075. props.top = ( options.top - curOffset.top ) + curTop;
  36076. }
  36077. if ( options.left != null ) {
  36078. props.left = ( options.left - curOffset.left ) + curLeft;
  36079. }
  36080. if ( "using" in options ) {
  36081. options.using.call( elem, props );
  36082. } else {
  36083. curElem.css( props );
  36084. }
  36085. }
  36086. };
  36087. jQuery.fn.extend( {
  36088. // offset() relates an element's border box to the document origin
  36089. offset: function( options ) {
  36090. // Preserve chaining for setter
  36091. if ( arguments.length ) {
  36092. return options === undefined ?
  36093. this :
  36094. this.each( function( i ) {
  36095. jQuery.offset.setOffset( this, options, i );
  36096. } );
  36097. }
  36098. var rect, win,
  36099. elem = this[ 0 ];
  36100. if ( !elem ) {
  36101. return;
  36102. }
  36103. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  36104. // Support: IE <=11 only
  36105. // Running getBoundingClientRect on a
  36106. // disconnected node in IE throws an error
  36107. if ( !elem.getClientRects().length ) {
  36108. return { top: 0, left: 0 };
  36109. }
  36110. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  36111. rect = elem.getBoundingClientRect();
  36112. win = elem.ownerDocument.defaultView;
  36113. return {
  36114. top: rect.top + win.pageYOffset,
  36115. left: rect.left + win.pageXOffset
  36116. };
  36117. },
  36118. // position() relates an element's margin box to its offset parent's padding box
  36119. // This corresponds to the behavior of CSS absolute positioning
  36120. position: function() {
  36121. if ( !this[ 0 ] ) {
  36122. return;
  36123. }
  36124. var offsetParent, offset, doc,
  36125. elem = this[ 0 ],
  36126. parentOffset = { top: 0, left: 0 };
  36127. // position:fixed elements are offset from the viewport, which itself always has zero offset
  36128. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  36129. // Assume position:fixed implies availability of getBoundingClientRect
  36130. offset = elem.getBoundingClientRect();
  36131. } else {
  36132. offset = this.offset();
  36133. // Account for the *real* offset parent, which can be the document or its root element
  36134. // when a statically positioned element is identified
  36135. doc = elem.ownerDocument;
  36136. offsetParent = elem.offsetParent || doc.documentElement;
  36137. while ( offsetParent &&
  36138. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  36139. jQuery.css( offsetParent, "position" ) === "static" ) {
  36140. offsetParent = offsetParent.parentNode;
  36141. }
  36142. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  36143. // Incorporate borders into its offset, since they are outside its content origin
  36144. parentOffset = jQuery( offsetParent ).offset();
  36145. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  36146. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  36147. }
  36148. }
  36149. // Subtract parent offsets and element margins
  36150. return {
  36151. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  36152. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  36153. };
  36154. },
  36155. // This method will return documentElement in the following cases:
  36156. // 1) For the element inside the iframe without offsetParent, this method will return
  36157. // documentElement of the parent window
  36158. // 2) For the hidden or detached element
  36159. // 3) For body or html element, i.e. in case of the html node - it will return itself
  36160. //
  36161. // but those exceptions were never presented as a real life use-cases
  36162. // and might be considered as more preferable results.
  36163. //
  36164. // This logic, however, is not guaranteed and can change at any point in the future
  36165. offsetParent: function() {
  36166. return this.map( function() {
  36167. var offsetParent = this.offsetParent;
  36168. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  36169. offsetParent = offsetParent.offsetParent;
  36170. }
  36171. return offsetParent || documentElement;
  36172. } );
  36173. }
  36174. } );
  36175. // Create scrollLeft and scrollTop methods
  36176. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  36177. var top = "pageYOffset" === prop;
  36178. jQuery.fn[ method ] = function( val ) {
  36179. return access( this, function( elem, method, val ) {
  36180. // Coalesce documents and windows
  36181. var win;
  36182. if ( isWindow( elem ) ) {
  36183. win = elem;
  36184. } else if ( elem.nodeType === 9 ) {
  36185. win = elem.defaultView;
  36186. }
  36187. if ( val === undefined ) {
  36188. return win ? win[ prop ] : elem[ method ];
  36189. }
  36190. if ( win ) {
  36191. win.scrollTo(
  36192. !top ? val : win.pageXOffset,
  36193. top ? val : win.pageYOffset
  36194. );
  36195. } else {
  36196. elem[ method ] = val;
  36197. }
  36198. }, method, val, arguments.length );
  36199. };
  36200. } );
  36201. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  36202. // Add the top/left cssHooks using jQuery.fn.position
  36203. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  36204. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  36205. // getComputedStyle returns percent when specified for top/left/bottom/right;
  36206. // rather than make the css module depend on the offset module, just check for it here
  36207. jQuery.each( [ "top", "left" ], function( i, prop ) {
  36208. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  36209. function( elem, computed ) {
  36210. if ( computed ) {
  36211. computed = curCSS( elem, prop );
  36212. // If curCSS returns percentage, fallback to offset
  36213. return rnumnonpx.test( computed ) ?
  36214. jQuery( elem ).position()[ prop ] + "px" :
  36215. computed;
  36216. }
  36217. }
  36218. );
  36219. } );
  36220. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  36221. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  36222. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  36223. function( defaultExtra, funcName ) {
  36224. // Margin is only for outerHeight, outerWidth
  36225. jQuery.fn[ funcName ] = function( margin, value ) {
  36226. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  36227. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  36228. return access( this, function( elem, type, value ) {
  36229. var doc;
  36230. if ( isWindow( elem ) ) {
  36231. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  36232. return funcName.indexOf( "outer" ) === 0 ?
  36233. elem[ "inner" + name ] :
  36234. elem.document.documentElement[ "client" + name ];
  36235. }
  36236. // Get document width or height
  36237. if ( elem.nodeType === 9 ) {
  36238. doc = elem.documentElement;
  36239. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  36240. // whichever is greatest
  36241. return Math.max(
  36242. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  36243. elem.body[ "offset" + name ], doc[ "offset" + name ],
  36244. doc[ "client" + name ]
  36245. );
  36246. }
  36247. return value === undefined ?
  36248. // Get width or height on the element, requesting but not forcing parseFloat
  36249. jQuery.css( elem, type, extra ) :
  36250. // Set width or height on the element
  36251. jQuery.style( elem, type, value, extra );
  36252. }, type, chainable ? margin : undefined, chainable );
  36253. };
  36254. } );
  36255. } );
  36256. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  36257. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  36258. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  36259. function( i, name ) {
  36260. // Handle event binding
  36261. jQuery.fn[ name ] = function( data, fn ) {
  36262. return arguments.length > 0 ?
  36263. this.on( name, null, data, fn ) :
  36264. this.trigger( name );
  36265. };
  36266. } );
  36267. jQuery.fn.extend( {
  36268. hover: function( fnOver, fnOut ) {
  36269. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  36270. }
  36271. } );
  36272. jQuery.fn.extend( {
  36273. bind: function( types, data, fn ) {
  36274. return this.on( types, null, data, fn );
  36275. },
  36276. unbind: function( types, fn ) {
  36277. return this.off( types, null, fn );
  36278. },
  36279. delegate: function( selector, types, data, fn ) {
  36280. return this.on( types, selector, data, fn );
  36281. },
  36282. undelegate: function( selector, types, fn ) {
  36283. // ( namespace ) or ( selector, types [, fn] )
  36284. return arguments.length === 1 ?
  36285. this.off( selector, "**" ) :
  36286. this.off( types, selector || "**", fn );
  36287. }
  36288. } );
  36289. // Bind a function to a context, optionally partially applying any
  36290. // arguments.
  36291. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  36292. // However, it is not slated for removal any time soon
  36293. jQuery.proxy = function( fn, context ) {
  36294. var tmp, args, proxy;
  36295. if ( typeof context === "string" ) {
  36296. tmp = fn[ context ];
  36297. context = fn;
  36298. fn = tmp;
  36299. }
  36300. // Quick check to determine if target is callable, in the spec
  36301. // this throws a TypeError, but we will just return undefined.
  36302. if ( !isFunction( fn ) ) {
  36303. return undefined;
  36304. }
  36305. // Simulated bind
  36306. args = slice.call( arguments, 2 );
  36307. proxy = function() {
  36308. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  36309. };
  36310. // Set the guid of unique handler to the same of original handler, so it can be removed
  36311. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  36312. return proxy;
  36313. };
  36314. jQuery.holdReady = function( hold ) {
  36315. if ( hold ) {
  36316. jQuery.readyWait++;
  36317. } else {
  36318. jQuery.ready( true );
  36319. }
  36320. };
  36321. jQuery.isArray = Array.isArray;
  36322. jQuery.parseJSON = JSON.parse;
  36323. jQuery.nodeName = nodeName;
  36324. jQuery.isFunction = isFunction;
  36325. jQuery.isWindow = isWindow;
  36326. jQuery.camelCase = camelCase;
  36327. jQuery.type = toType;
  36328. jQuery.now = Date.now;
  36329. jQuery.isNumeric = function( obj ) {
  36330. // As of jQuery 3.0, isNumeric is limited to
  36331. // strings and numbers (primitives or objects)
  36332. // that can be coerced to finite numbers (gh-2662)
  36333. var type = jQuery.type( obj );
  36334. return ( type === "number" || type === "string" ) &&
  36335. // parseFloat NaNs numeric-cast false positives ("")
  36336. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  36337. // subtraction forces infinities to NaN
  36338. !isNaN( obj - parseFloat( obj ) );
  36339. };
  36340. // Register as a named AMD module, since jQuery can be concatenated with other
  36341. // files that may use define, but not via a proper concatenation script that
  36342. // understands anonymous AMD modules. A named AMD is safest and most robust
  36343. // way to register. Lowercase jquery is used because AMD module names are
  36344. // derived from file names, and jQuery is normally delivered in a lowercase
  36345. // file name. Do this after creating the global so that if an AMD module wants
  36346. // to call noConflict to hide this version of jQuery, it will work.
  36347. // Note that for maximum portability, libraries that are not jQuery should
  36348. // declare themselves as anonymous modules, and avoid setting a global if an
  36349. // AMD loader is present. jQuery is a special case. For more information, see
  36350. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  36351. if ( true ) {
  36352. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  36353. return jQuery;
  36354. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  36355. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  36356. }
  36357. var
  36358. // Map over jQuery in case of overwrite
  36359. _jQuery = window.jQuery,
  36360. // Map over the $ in case of overwrite
  36361. _$ = window.$;
  36362. jQuery.noConflict = function( deep ) {
  36363. if ( window.$ === jQuery ) {
  36364. window.$ = _$;
  36365. }
  36366. if ( deep && window.jQuery === jQuery ) {
  36367. window.jQuery = _jQuery;
  36368. }
  36369. return jQuery;
  36370. };
  36371. // Expose jQuery and $ identifiers, even in AMD
  36372. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  36373. // and CommonJS for browser emulators (#13566)
  36374. if ( !noGlobal ) {
  36375. window.jQuery = window.$ = jQuery;
  36376. }
  36377. return jQuery;
  36378. } );
  36379. /***/ }),
  36380. /* 19 */
  36381. /***/ (function(module, exports) {
  36382. /*!
  36383. * Bootstrap v3.4.0 (https://getbootstrap.com/)
  36384. * Copyright 2011-2018 Twitter, Inc.
  36385. * Licensed under the MIT license
  36386. */
  36387. if (typeof jQuery === 'undefined') {
  36388. throw new Error('Bootstrap\'s JavaScript requires jQuery')
  36389. }
  36390. +function ($) {
  36391. 'use strict';
  36392. var version = $.fn.jquery.split(' ')[0].split('.')
  36393. if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
  36394. throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  36395. }
  36396. }(jQuery);
  36397. /* ========================================================================
  36398. * Bootstrap: transition.js v3.4.0
  36399. * https://getbootstrap.com/docs/3.4/javascript/#transitions
  36400. * ========================================================================
  36401. * Copyright 2011-2018 Twitter, Inc.
  36402. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  36403. * ======================================================================== */
  36404. +function ($) {
  36405. 'use strict';
  36406. // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/)
  36407. // ============================================================
  36408. function transitionEnd() {
  36409. var el = document.createElement('bootstrap')
  36410. var transEndEventNames = {
  36411. WebkitTransition : 'webkitTransitionEnd',
  36412. MozTransition : 'transitionend',
  36413. OTransition : 'oTransitionEnd otransitionend',
  36414. transition : 'transitionend'
  36415. }
  36416. for (var name in transEndEventNames) {
  36417. if (el.style[name] !== undefined) {
  36418. return { end: transEndEventNames[name] }
  36419. }
  36420. }
  36421. return false // explicit for ie8 ( ._.)
  36422. }
  36423. // https://blog.alexmaccaw.com/css-transitions
  36424. $.fn.emulateTransitionEnd = function (duration) {
  36425. var called = false
  36426. var $el = this
  36427. $(this).one('bsTransitionEnd', function () { called = true })
  36428. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  36429. setTimeout(callback, duration)
  36430. return this
  36431. }
  36432. $(function () {
  36433. $.support.transition = transitionEnd()
  36434. if (!$.support.transition) return
  36435. $.event.special.bsTransitionEnd = {
  36436. bindType: $.support.transition.end,
  36437. delegateType: $.support.transition.end,
  36438. handle: function (e) {
  36439. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  36440. }
  36441. }
  36442. })
  36443. }(jQuery);
  36444. /* ========================================================================
  36445. * Bootstrap: alert.js v3.4.0
  36446. * https://getbootstrap.com/docs/3.4/javascript/#alerts
  36447. * ========================================================================
  36448. * Copyright 2011-2018 Twitter, Inc.
  36449. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  36450. * ======================================================================== */
  36451. +function ($) {
  36452. 'use strict';
  36453. // ALERT CLASS DEFINITION
  36454. // ======================
  36455. var dismiss = '[data-dismiss="alert"]'
  36456. var Alert = function (el) {
  36457. $(el).on('click', dismiss, this.close)
  36458. }
  36459. Alert.VERSION = '3.4.0'
  36460. Alert.TRANSITION_DURATION = 150
  36461. Alert.prototype.close = function (e) {
  36462. var $this = $(this)
  36463. var selector = $this.attr('data-target')
  36464. if (!selector) {
  36465. selector = $this.attr('href')
  36466. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  36467. }
  36468. selector = selector === '#' ? [] : selector
  36469. var $parent = $(document).find(selector)
  36470. if (e) e.preventDefault()
  36471. if (!$parent.length) {
  36472. $parent = $this.closest('.alert')
  36473. }
  36474. $parent.trigger(e = $.Event('close.bs.alert'))
  36475. if (e.isDefaultPrevented()) return
  36476. $parent.removeClass('in')
  36477. function removeElement() {
  36478. // detach from parent, fire event then clean up data
  36479. $parent.detach().trigger('closed.bs.alert').remove()
  36480. }
  36481. $.support.transition && $parent.hasClass('fade') ?
  36482. $parent
  36483. .one('bsTransitionEnd', removeElement)
  36484. .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
  36485. removeElement()
  36486. }
  36487. // ALERT PLUGIN DEFINITION
  36488. // =======================
  36489. function Plugin(option) {
  36490. return this.each(function () {
  36491. var $this = $(this)
  36492. var data = $this.data('bs.alert')
  36493. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  36494. if (typeof option == 'string') data[option].call($this)
  36495. })
  36496. }
  36497. var old = $.fn.alert
  36498. $.fn.alert = Plugin
  36499. $.fn.alert.Constructor = Alert
  36500. // ALERT NO CONFLICT
  36501. // =================
  36502. $.fn.alert.noConflict = function () {
  36503. $.fn.alert = old
  36504. return this
  36505. }
  36506. // ALERT DATA-API
  36507. // ==============
  36508. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  36509. }(jQuery);
  36510. /* ========================================================================
  36511. * Bootstrap: button.js v3.4.0
  36512. * https://getbootstrap.com/docs/3.4/javascript/#buttons
  36513. * ========================================================================
  36514. * Copyright 2011-2018 Twitter, Inc.
  36515. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  36516. * ======================================================================== */
  36517. +function ($) {
  36518. 'use strict';
  36519. // BUTTON PUBLIC CLASS DEFINITION
  36520. // ==============================
  36521. var Button = function (element, options) {
  36522. this.$element = $(element)
  36523. this.options = $.extend({}, Button.DEFAULTS, options)
  36524. this.isLoading = false
  36525. }
  36526. Button.VERSION = '3.4.0'
  36527. Button.DEFAULTS = {
  36528. loadingText: 'loading...'
  36529. }
  36530. Button.prototype.setState = function (state) {
  36531. var d = 'disabled'
  36532. var $el = this.$element
  36533. var val = $el.is('input') ? 'val' : 'html'
  36534. var data = $el.data()
  36535. state += 'Text'
  36536. if (data.resetText == null) $el.data('resetText', $el[val]())
  36537. // push to event loop to allow forms to submit
  36538. setTimeout($.proxy(function () {
  36539. $el[val](data[state] == null ? this.options[state] : data[state])
  36540. if (state == 'loadingText') {
  36541. this.isLoading = true
  36542. $el.addClass(d).attr(d, d).prop(d, true)
  36543. } else if (this.isLoading) {
  36544. this.isLoading = false
  36545. $el.removeClass(d).removeAttr(d).prop(d, false)
  36546. }
  36547. }, this), 0)
  36548. }
  36549. Button.prototype.toggle = function () {
  36550. var changed = true
  36551. var $parent = this.$element.closest('[data-toggle="buttons"]')
  36552. if ($parent.length) {
  36553. var $input = this.$element.find('input')
  36554. if ($input.prop('type') == 'radio') {
  36555. if ($input.prop('checked')) changed = false
  36556. $parent.find('.active').removeClass('active')
  36557. this.$element.addClass('active')
  36558. } else if ($input.prop('type') == 'checkbox') {
  36559. if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
  36560. this.$element.toggleClass('active')
  36561. }
  36562. $input.prop('checked', this.$element.hasClass('active'))
  36563. if (changed) $input.trigger('change')
  36564. } else {
  36565. this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
  36566. this.$element.toggleClass('active')
  36567. }
  36568. }
  36569. // BUTTON PLUGIN DEFINITION
  36570. // ========================
  36571. function Plugin(option) {
  36572. return this.each(function () {
  36573. var $this = $(this)
  36574. var data = $this.data('bs.button')
  36575. var options = typeof option == 'object' && option
  36576. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  36577. if (option == 'toggle') data.toggle()
  36578. else if (option) data.setState(option)
  36579. })
  36580. }
  36581. var old = $.fn.button
  36582. $.fn.button = Plugin
  36583. $.fn.button.Constructor = Button
  36584. // BUTTON NO CONFLICT
  36585. // ==================
  36586. $.fn.button.noConflict = function () {
  36587. $.fn.button = old
  36588. return this
  36589. }
  36590. // BUTTON DATA-API
  36591. // ===============
  36592. $(document)
  36593. .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  36594. var $btn = $(e.target).closest('.btn')
  36595. Plugin.call($btn, 'toggle')
  36596. if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
  36597. // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
  36598. e.preventDefault()
  36599. // The target component still receive the focus
  36600. if ($btn.is('input,button')) $btn.trigger('focus')
  36601. else $btn.find('input:visible,button:visible').first().trigger('focus')
  36602. }
  36603. })
  36604. .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  36605. $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
  36606. })
  36607. }(jQuery);
  36608. /* ========================================================================
  36609. * Bootstrap: carousel.js v3.4.0
  36610. * https://getbootstrap.com/docs/3.4/javascript/#carousel
  36611. * ========================================================================
  36612. * Copyright 2011-2018 Twitter, Inc.
  36613. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  36614. * ======================================================================== */
  36615. +function ($) {
  36616. 'use strict';
  36617. // CAROUSEL CLASS DEFINITION
  36618. // =========================
  36619. var Carousel = function (element, options) {
  36620. this.$element = $(element)
  36621. this.$indicators = this.$element.find('.carousel-indicators')
  36622. this.options = options
  36623. this.paused = null
  36624. this.sliding = null
  36625. this.interval = null
  36626. this.$active = null
  36627. this.$items = null
  36628. this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
  36629. this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
  36630. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  36631. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  36632. }
  36633. Carousel.VERSION = '3.4.0'
  36634. Carousel.TRANSITION_DURATION = 600
  36635. Carousel.DEFAULTS = {
  36636. interval: 5000,
  36637. pause: 'hover',
  36638. wrap: true,
  36639. keyboard: true
  36640. }
  36641. Carousel.prototype.keydown = function (e) {
  36642. if (/input|textarea/i.test(e.target.tagName)) return
  36643. switch (e.which) {
  36644. case 37: this.prev(); break
  36645. case 39: this.next(); break
  36646. default: return
  36647. }
  36648. e.preventDefault()
  36649. }
  36650. Carousel.prototype.cycle = function (e) {
  36651. e || (this.paused = false)
  36652. this.interval && clearInterval(this.interval)
  36653. this.options.interval
  36654. && !this.paused
  36655. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  36656. return this
  36657. }
  36658. Carousel.prototype.getItemIndex = function (item) {
  36659. this.$items = item.parent().children('.item')
  36660. return this.$items.index(item || this.$active)
  36661. }
  36662. Carousel.prototype.getItemForDirection = function (direction, active) {
  36663. var activeIndex = this.getItemIndex(active)
  36664. var willWrap = (direction == 'prev' && activeIndex === 0)
  36665. || (direction == 'next' && activeIndex == (this.$items.length - 1))
  36666. if (willWrap && !this.options.wrap) return active
  36667. var delta = direction == 'prev' ? -1 : 1
  36668. var itemIndex = (activeIndex + delta) % this.$items.length
  36669. return this.$items.eq(itemIndex)
  36670. }
  36671. Carousel.prototype.to = function (pos) {
  36672. var that = this
  36673. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  36674. if (pos > (this.$items.length - 1) || pos < 0) return
  36675. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  36676. if (activeIndex == pos) return this.pause().cycle()
  36677. return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  36678. }
  36679. Carousel.prototype.pause = function (e) {
  36680. e || (this.paused = true)
  36681. if (this.$element.find('.next, .prev').length && $.support.transition) {
  36682. this.$element.trigger($.support.transition.end)
  36683. this.cycle(true)
  36684. }
  36685. this.interval = clearInterval(this.interval)
  36686. return this
  36687. }
  36688. Carousel.prototype.next = function () {
  36689. if (this.sliding) return
  36690. return this.slide('next')
  36691. }
  36692. Carousel.prototype.prev = function () {
  36693. if (this.sliding) return
  36694. return this.slide('prev')
  36695. }
  36696. Carousel.prototype.slide = function (type, next) {
  36697. var $active = this.$element.find('.item.active')
  36698. var $next = next || this.getItemForDirection(type, $active)
  36699. var isCycling = this.interval
  36700. var direction = type == 'next' ? 'left' : 'right'
  36701. var that = this
  36702. if ($next.hasClass('active')) return (this.sliding = false)
  36703. var relatedTarget = $next[0]
  36704. var slideEvent = $.Event('slide.bs.carousel', {
  36705. relatedTarget: relatedTarget,
  36706. direction: direction
  36707. })
  36708. this.$element.trigger(slideEvent)
  36709. if (slideEvent.isDefaultPrevented()) return
  36710. this.sliding = true
  36711. isCycling && this.pause()
  36712. if (this.$indicators.length) {
  36713. this.$indicators.find('.active').removeClass('active')
  36714. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  36715. $nextIndicator && $nextIndicator.addClass('active')
  36716. }
  36717. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  36718. if ($.support.transition && this.$element.hasClass('slide')) {
  36719. $next.addClass(type)
  36720. if (typeof $next === 'object' && $next.length) {
  36721. $next[0].offsetWidth // force reflow
  36722. }
  36723. $active.addClass(direction)
  36724. $next.addClass(direction)
  36725. $active
  36726. .one('bsTransitionEnd', function () {
  36727. $next.removeClass([type, direction].join(' ')).addClass('active')
  36728. $active.removeClass(['active', direction].join(' '))
  36729. that.sliding = false
  36730. setTimeout(function () {
  36731. that.$element.trigger(slidEvent)
  36732. }, 0)
  36733. })
  36734. .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
  36735. } else {
  36736. $active.removeClass('active')
  36737. $next.addClass('active')
  36738. this.sliding = false
  36739. this.$element.trigger(slidEvent)
  36740. }
  36741. isCycling && this.cycle()
  36742. return this
  36743. }
  36744. // CAROUSEL PLUGIN DEFINITION
  36745. // ==========================
  36746. function Plugin(option) {
  36747. return this.each(function () {
  36748. var $this = $(this)
  36749. var data = $this.data('bs.carousel')
  36750. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  36751. var action = typeof option == 'string' ? option : options.slide
  36752. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  36753. if (typeof option == 'number') data.to(option)
  36754. else if (action) data[action]()
  36755. else if (options.interval) data.pause().cycle()
  36756. })
  36757. }
  36758. var old = $.fn.carousel
  36759. $.fn.carousel = Plugin
  36760. $.fn.carousel.Constructor = Carousel
  36761. // CAROUSEL NO CONFLICT
  36762. // ====================
  36763. $.fn.carousel.noConflict = function () {
  36764. $.fn.carousel = old
  36765. return this
  36766. }
  36767. // CAROUSEL DATA-API
  36768. // =================
  36769. var clickHandler = function (e) {
  36770. var $this = $(this)
  36771. var href = $this.attr('href')
  36772. if (href) {
  36773. href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  36774. }
  36775. var target = $this.attr('data-target') || href
  36776. var $target = $(document).find(target)
  36777. if (!$target.hasClass('carousel')) return
  36778. var options = $.extend({}, $target.data(), $this.data())
  36779. var slideIndex = $this.attr('data-slide-to')
  36780. if (slideIndex) options.interval = false
  36781. Plugin.call($target, options)
  36782. if (slideIndex) {
  36783. $target.data('bs.carousel').to(slideIndex)
  36784. }
  36785. e.preventDefault()
  36786. }
  36787. $(document)
  36788. .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
  36789. .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
  36790. $(window).on('load', function () {
  36791. $('[data-ride="carousel"]').each(function () {
  36792. var $carousel = $(this)
  36793. Plugin.call($carousel, $carousel.data())
  36794. })
  36795. })
  36796. }(jQuery);
  36797. /* ========================================================================
  36798. * Bootstrap: collapse.js v3.4.0
  36799. * https://getbootstrap.com/docs/3.4/javascript/#collapse
  36800. * ========================================================================
  36801. * Copyright 2011-2018 Twitter, Inc.
  36802. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  36803. * ======================================================================== */
  36804. /* jshint latedef: false */
  36805. +function ($) {
  36806. 'use strict';
  36807. // COLLAPSE PUBLIC CLASS DEFINITION
  36808. // ================================
  36809. var Collapse = function (element, options) {
  36810. this.$element = $(element)
  36811. this.options = $.extend({}, Collapse.DEFAULTS, options)
  36812. this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
  36813. '[data-toggle="collapse"][data-target="#' + element.id + '"]')
  36814. this.transitioning = null
  36815. if (this.options.parent) {
  36816. this.$parent = this.getParent()
  36817. } else {
  36818. this.addAriaAndCollapsedClass(this.$element, this.$trigger)
  36819. }
  36820. if (this.options.toggle) this.toggle()
  36821. }
  36822. Collapse.VERSION = '3.4.0'
  36823. Collapse.TRANSITION_DURATION = 350
  36824. Collapse.DEFAULTS = {
  36825. toggle: true
  36826. }
  36827. Collapse.prototype.dimension = function () {
  36828. var hasWidth = this.$element.hasClass('width')
  36829. return hasWidth ? 'width' : 'height'
  36830. }
  36831. Collapse.prototype.show = function () {
  36832. if (this.transitioning || this.$element.hasClass('in')) return
  36833. var activesData
  36834. var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
  36835. if (actives && actives.length) {
  36836. activesData = actives.data('bs.collapse')
  36837. if (activesData && activesData.transitioning) return
  36838. }
  36839. var startEvent = $.Event('show.bs.collapse')
  36840. this.$element.trigger(startEvent)
  36841. if (startEvent.isDefaultPrevented()) return
  36842. if (actives && actives.length) {
  36843. Plugin.call(actives, 'hide')
  36844. activesData || actives.data('bs.collapse', null)
  36845. }
  36846. var dimension = this.dimension()
  36847. this.$element
  36848. .removeClass('collapse')
  36849. .addClass('collapsing')[dimension](0)
  36850. .attr('aria-expanded', true)
  36851. this.$trigger
  36852. .removeClass('collapsed')
  36853. .attr('aria-expanded', true)
  36854. this.transitioning = 1
  36855. var complete = function () {
  36856. this.$element
  36857. .removeClass('collapsing')
  36858. .addClass('collapse in')[dimension]('')
  36859. this.transitioning = 0
  36860. this.$element
  36861. .trigger('shown.bs.collapse')
  36862. }
  36863. if (!$.support.transition) return complete.call(this)
  36864. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  36865. this.$element
  36866. .one('bsTransitionEnd', $.proxy(complete, this))
  36867. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  36868. }
  36869. Collapse.prototype.hide = function () {
  36870. if (this.transitioning || !this.$element.hasClass('in')) return
  36871. var startEvent = $.Event('hide.bs.collapse')
  36872. this.$element.trigger(startEvent)
  36873. if (startEvent.isDefaultPrevented()) return
  36874. var dimension = this.dimension()
  36875. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  36876. this.$element
  36877. .addClass('collapsing')
  36878. .removeClass('collapse in')
  36879. .attr('aria-expanded', false)
  36880. this.$trigger
  36881. .addClass('collapsed')
  36882. .attr('aria-expanded', false)
  36883. this.transitioning = 1
  36884. var complete = function () {
  36885. this.transitioning = 0
  36886. this.$element
  36887. .removeClass('collapsing')
  36888. .addClass('collapse')
  36889. .trigger('hidden.bs.collapse')
  36890. }
  36891. if (!$.support.transition) return complete.call(this)
  36892. this.$element
  36893. [dimension](0)
  36894. .one('bsTransitionEnd', $.proxy(complete, this))
  36895. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  36896. }
  36897. Collapse.prototype.toggle = function () {
  36898. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  36899. }
  36900. Collapse.prototype.getParent = function () {
  36901. return $(document).find(this.options.parent)
  36902. .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
  36903. .each($.proxy(function (i, element) {
  36904. var $element = $(element)
  36905. this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
  36906. }, this))
  36907. .end()
  36908. }
  36909. Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
  36910. var isOpen = $element.hasClass('in')
  36911. $element.attr('aria-expanded', isOpen)
  36912. $trigger
  36913. .toggleClass('collapsed', !isOpen)
  36914. .attr('aria-expanded', isOpen)
  36915. }
  36916. function getTargetFromTrigger($trigger) {
  36917. var href
  36918. var target = $trigger.attr('data-target')
  36919. || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  36920. return $(document).find(target)
  36921. }
  36922. // COLLAPSE PLUGIN DEFINITION
  36923. // ==========================
  36924. function Plugin(option) {
  36925. return this.each(function () {
  36926. var $this = $(this)
  36927. var data = $this.data('bs.collapse')
  36928. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  36929. if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
  36930. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  36931. if (typeof option == 'string') data[option]()
  36932. })
  36933. }
  36934. var old = $.fn.collapse
  36935. $.fn.collapse = Plugin
  36936. $.fn.collapse.Constructor = Collapse
  36937. // COLLAPSE NO CONFLICT
  36938. // ====================
  36939. $.fn.collapse.noConflict = function () {
  36940. $.fn.collapse = old
  36941. return this
  36942. }
  36943. // COLLAPSE DATA-API
  36944. // =================
  36945. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  36946. var $this = $(this)
  36947. if (!$this.attr('data-target')) e.preventDefault()
  36948. var $target = getTargetFromTrigger($this)
  36949. var data = $target.data('bs.collapse')
  36950. var option = data ? 'toggle' : $this.data()
  36951. Plugin.call($target, option)
  36952. })
  36953. }(jQuery);
  36954. /* ========================================================================
  36955. * Bootstrap: dropdown.js v3.4.0
  36956. * https://getbootstrap.com/docs/3.4/javascript/#dropdowns
  36957. * ========================================================================
  36958. * Copyright 2011-2018 Twitter, Inc.
  36959. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  36960. * ======================================================================== */
  36961. +function ($) {
  36962. 'use strict';
  36963. // DROPDOWN CLASS DEFINITION
  36964. // =========================
  36965. var backdrop = '.dropdown-backdrop'
  36966. var toggle = '[data-toggle="dropdown"]'
  36967. var Dropdown = function (element) {
  36968. $(element).on('click.bs.dropdown', this.toggle)
  36969. }
  36970. Dropdown.VERSION = '3.4.0'
  36971. function getParent($this) {
  36972. var selector = $this.attr('data-target')
  36973. if (!selector) {
  36974. selector = $this.attr('href')
  36975. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  36976. }
  36977. var $parent = selector && $(document).find(selector)
  36978. return $parent && $parent.length ? $parent : $this.parent()
  36979. }
  36980. function clearMenus(e) {
  36981. if (e && e.which === 3) return
  36982. $(backdrop).remove()
  36983. $(toggle).each(function () {
  36984. var $this = $(this)
  36985. var $parent = getParent($this)
  36986. var relatedTarget = { relatedTarget: this }
  36987. if (!$parent.hasClass('open')) return
  36988. if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
  36989. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  36990. if (e.isDefaultPrevented()) return
  36991. $this.attr('aria-expanded', 'false')
  36992. $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
  36993. })
  36994. }
  36995. Dropdown.prototype.toggle = function (e) {
  36996. var $this = $(this)
  36997. if ($this.is('.disabled, :disabled')) return
  36998. var $parent = getParent($this)
  36999. var isActive = $parent.hasClass('open')
  37000. clearMenus()
  37001. if (!isActive) {
  37002. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  37003. // if mobile we use a backdrop because click events don't delegate
  37004. $(document.createElement('div'))
  37005. .addClass('dropdown-backdrop')
  37006. .insertAfter($(this))
  37007. .on('click', clearMenus)
  37008. }
  37009. var relatedTarget = { relatedTarget: this }
  37010. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  37011. if (e.isDefaultPrevented()) return
  37012. $this
  37013. .trigger('focus')
  37014. .attr('aria-expanded', 'true')
  37015. $parent
  37016. .toggleClass('open')
  37017. .trigger($.Event('shown.bs.dropdown', relatedTarget))
  37018. }
  37019. return false
  37020. }
  37021. Dropdown.prototype.keydown = function (e) {
  37022. if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
  37023. var $this = $(this)
  37024. e.preventDefault()
  37025. e.stopPropagation()
  37026. if ($this.is('.disabled, :disabled')) return
  37027. var $parent = getParent($this)
  37028. var isActive = $parent.hasClass('open')
  37029. if (!isActive && e.which != 27 || isActive && e.which == 27) {
  37030. if (e.which == 27) $parent.find(toggle).trigger('focus')
  37031. return $this.trigger('click')
  37032. }
  37033. var desc = ' li:not(.disabled):visible a'
  37034. var $items = $parent.find('.dropdown-menu' + desc)
  37035. if (!$items.length) return
  37036. var index = $items.index(e.target)
  37037. if (e.which == 38 && index > 0) index-- // up
  37038. if (e.which == 40 && index < $items.length - 1) index++ // down
  37039. if (!~index) index = 0
  37040. $items.eq(index).trigger('focus')
  37041. }
  37042. // DROPDOWN PLUGIN DEFINITION
  37043. // ==========================
  37044. function Plugin(option) {
  37045. return this.each(function () {
  37046. var $this = $(this)
  37047. var data = $this.data('bs.dropdown')
  37048. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  37049. if (typeof option == 'string') data[option].call($this)
  37050. })
  37051. }
  37052. var old = $.fn.dropdown
  37053. $.fn.dropdown = Plugin
  37054. $.fn.dropdown.Constructor = Dropdown
  37055. // DROPDOWN NO CONFLICT
  37056. // ====================
  37057. $.fn.dropdown.noConflict = function () {
  37058. $.fn.dropdown = old
  37059. return this
  37060. }
  37061. // APPLY TO STANDARD DROPDOWN ELEMENTS
  37062. // ===================================
  37063. $(document)
  37064. .on('click.bs.dropdown.data-api', clearMenus)
  37065. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  37066. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  37067. .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
  37068. .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
  37069. }(jQuery);
  37070. /* ========================================================================
  37071. * Bootstrap: modal.js v3.4.0
  37072. * https://getbootstrap.com/docs/3.4/javascript/#modals
  37073. * ========================================================================
  37074. * Copyright 2011-2018 Twitter, Inc.
  37075. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  37076. * ======================================================================== */
  37077. +function ($) {
  37078. 'use strict';
  37079. // MODAL CLASS DEFINITION
  37080. // ======================
  37081. var Modal = function (element, options) {
  37082. this.options = options
  37083. this.$body = $(document.body)
  37084. this.$element = $(element)
  37085. this.$dialog = this.$element.find('.modal-dialog')
  37086. this.$backdrop = null
  37087. this.isShown = null
  37088. this.originalBodyPad = null
  37089. this.scrollbarWidth = 0
  37090. this.ignoreBackdropClick = false
  37091. this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom'
  37092. if (this.options.remote) {
  37093. this.$element
  37094. .find('.modal-content')
  37095. .load(this.options.remote, $.proxy(function () {
  37096. this.$element.trigger('loaded.bs.modal')
  37097. }, this))
  37098. }
  37099. }
  37100. Modal.VERSION = '3.4.0'
  37101. Modal.TRANSITION_DURATION = 300
  37102. Modal.BACKDROP_TRANSITION_DURATION = 150
  37103. Modal.DEFAULTS = {
  37104. backdrop: true,
  37105. keyboard: true,
  37106. show: true
  37107. }
  37108. Modal.prototype.toggle = function (_relatedTarget) {
  37109. return this.isShown ? this.hide() : this.show(_relatedTarget)
  37110. }
  37111. Modal.prototype.show = function (_relatedTarget) {
  37112. var that = this
  37113. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  37114. this.$element.trigger(e)
  37115. if (this.isShown || e.isDefaultPrevented()) return
  37116. this.isShown = true
  37117. this.checkScrollbar()
  37118. this.setScrollbar()
  37119. this.$body.addClass('modal-open')
  37120. this.escape()
  37121. this.resize()
  37122. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  37123. this.$dialog.on('mousedown.dismiss.bs.modal', function () {
  37124. that.$element.one('mouseup.dismiss.bs.modal', function (e) {
  37125. if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
  37126. })
  37127. })
  37128. this.backdrop(function () {
  37129. var transition = $.support.transition && that.$element.hasClass('fade')
  37130. if (!that.$element.parent().length) {
  37131. that.$element.appendTo(that.$body) // don't move modals dom position
  37132. }
  37133. that.$element
  37134. .show()
  37135. .scrollTop(0)
  37136. that.adjustDialog()
  37137. if (transition) {
  37138. that.$element[0].offsetWidth // force reflow
  37139. }
  37140. that.$element.addClass('in')
  37141. that.enforceFocus()
  37142. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  37143. transition ?
  37144. that.$dialog // wait for modal to slide in
  37145. .one('bsTransitionEnd', function () {
  37146. that.$element.trigger('focus').trigger(e)
  37147. })
  37148. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  37149. that.$element.trigger('focus').trigger(e)
  37150. })
  37151. }
  37152. Modal.prototype.hide = function (e) {
  37153. if (e) e.preventDefault()
  37154. e = $.Event('hide.bs.modal')
  37155. this.$element.trigger(e)
  37156. if (!this.isShown || e.isDefaultPrevented()) return
  37157. this.isShown = false
  37158. this.escape()
  37159. this.resize()
  37160. $(document).off('focusin.bs.modal')
  37161. this.$element
  37162. .removeClass('in')
  37163. .off('click.dismiss.bs.modal')
  37164. .off('mouseup.dismiss.bs.modal')
  37165. this.$dialog.off('mousedown.dismiss.bs.modal')
  37166. $.support.transition && this.$element.hasClass('fade') ?
  37167. this.$element
  37168. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  37169. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  37170. this.hideModal()
  37171. }
  37172. Modal.prototype.enforceFocus = function () {
  37173. $(document)
  37174. .off('focusin.bs.modal') // guard against infinite focus loop
  37175. .on('focusin.bs.modal', $.proxy(function (e) {
  37176. if (document !== e.target &&
  37177. this.$element[0] !== e.target &&
  37178. !this.$element.has(e.target).length) {
  37179. this.$element.trigger('focus')
  37180. }
  37181. }, this))
  37182. }
  37183. Modal.prototype.escape = function () {
  37184. if (this.isShown && this.options.keyboard) {
  37185. this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
  37186. e.which == 27 && this.hide()
  37187. }, this))
  37188. } else if (!this.isShown) {
  37189. this.$element.off('keydown.dismiss.bs.modal')
  37190. }
  37191. }
  37192. Modal.prototype.resize = function () {
  37193. if (this.isShown) {
  37194. $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
  37195. } else {
  37196. $(window).off('resize.bs.modal')
  37197. }
  37198. }
  37199. Modal.prototype.hideModal = function () {
  37200. var that = this
  37201. this.$element.hide()
  37202. this.backdrop(function () {
  37203. that.$body.removeClass('modal-open')
  37204. that.resetAdjustments()
  37205. that.resetScrollbar()
  37206. that.$element.trigger('hidden.bs.modal')
  37207. })
  37208. }
  37209. Modal.prototype.removeBackdrop = function () {
  37210. this.$backdrop && this.$backdrop.remove()
  37211. this.$backdrop = null
  37212. }
  37213. Modal.prototype.backdrop = function (callback) {
  37214. var that = this
  37215. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  37216. if (this.isShown && this.options.backdrop) {
  37217. var doAnimate = $.support.transition && animate
  37218. this.$backdrop = $(document.createElement('div'))
  37219. .addClass('modal-backdrop ' + animate)
  37220. .appendTo(this.$body)
  37221. this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
  37222. if (this.ignoreBackdropClick) {
  37223. this.ignoreBackdropClick = false
  37224. return
  37225. }
  37226. if (e.target !== e.currentTarget) return
  37227. this.options.backdrop == 'static'
  37228. ? this.$element[0].focus()
  37229. : this.hide()
  37230. }, this))
  37231. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  37232. this.$backdrop.addClass('in')
  37233. if (!callback) return
  37234. doAnimate ?
  37235. this.$backdrop
  37236. .one('bsTransitionEnd', callback)
  37237. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  37238. callback()
  37239. } else if (!this.isShown && this.$backdrop) {
  37240. this.$backdrop.removeClass('in')
  37241. var callbackRemove = function () {
  37242. that.removeBackdrop()
  37243. callback && callback()
  37244. }
  37245. $.support.transition && this.$element.hasClass('fade') ?
  37246. this.$backdrop
  37247. .one('bsTransitionEnd', callbackRemove)
  37248. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  37249. callbackRemove()
  37250. } else if (callback) {
  37251. callback()
  37252. }
  37253. }
  37254. // these following methods are used to handle overflowing modals
  37255. Modal.prototype.handleUpdate = function () {
  37256. this.adjustDialog()
  37257. }
  37258. Modal.prototype.adjustDialog = function () {
  37259. var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
  37260. this.$element.css({
  37261. paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
  37262. paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
  37263. })
  37264. }
  37265. Modal.prototype.resetAdjustments = function () {
  37266. this.$element.css({
  37267. paddingLeft: '',
  37268. paddingRight: ''
  37269. })
  37270. }
  37271. Modal.prototype.checkScrollbar = function () {
  37272. var fullWindowWidth = window.innerWidth
  37273. if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
  37274. var documentElementRect = document.documentElement.getBoundingClientRect()
  37275. fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
  37276. }
  37277. this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
  37278. this.scrollbarWidth = this.measureScrollbar()
  37279. }
  37280. Modal.prototype.setScrollbar = function () {
  37281. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  37282. this.originalBodyPad = document.body.style.paddingRight || ''
  37283. var scrollbarWidth = this.scrollbarWidth
  37284. if (this.bodyIsOverflowing) {
  37285. this.$body.css('padding-right', bodyPad + scrollbarWidth)
  37286. $(this.fixedContent).each(function (index, element) {
  37287. var actualPadding = element.style.paddingRight
  37288. var calculatedPadding = $(element).css('padding-right')
  37289. $(element)
  37290. .data('padding-right', actualPadding)
  37291. .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px')
  37292. })
  37293. }
  37294. }
  37295. Modal.prototype.resetScrollbar = function () {
  37296. this.$body.css('padding-right', this.originalBodyPad)
  37297. $(this.fixedContent).each(function (index, element) {
  37298. var padding = $(element).data('padding-right')
  37299. $(element).removeData('padding-right')
  37300. element.style.paddingRight = padding ? padding : ''
  37301. })
  37302. }
  37303. Modal.prototype.measureScrollbar = function () { // thx walsh
  37304. var scrollDiv = document.createElement('div')
  37305. scrollDiv.className = 'modal-scrollbar-measure'
  37306. this.$body.append(scrollDiv)
  37307. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  37308. this.$body[0].removeChild(scrollDiv)
  37309. return scrollbarWidth
  37310. }
  37311. // MODAL PLUGIN DEFINITION
  37312. // =======================
  37313. function Plugin(option, _relatedTarget) {
  37314. return this.each(function () {
  37315. var $this = $(this)
  37316. var data = $this.data('bs.modal')
  37317. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  37318. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  37319. if (typeof option == 'string') data[option](_relatedTarget)
  37320. else if (options.show) data.show(_relatedTarget)
  37321. })
  37322. }
  37323. var old = $.fn.modal
  37324. $.fn.modal = Plugin
  37325. $.fn.modal.Constructor = Modal
  37326. // MODAL NO CONFLICT
  37327. // =================
  37328. $.fn.modal.noConflict = function () {
  37329. $.fn.modal = old
  37330. return this
  37331. }
  37332. // MODAL DATA-API
  37333. // ==============
  37334. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  37335. var $this = $(this)
  37336. var href = $this.attr('href')
  37337. var target = $this.attr('data-target') ||
  37338. (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  37339. var $target = $(document).find(target)
  37340. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  37341. if ($this.is('a')) e.preventDefault()
  37342. $target.one('show.bs.modal', function (showEvent) {
  37343. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  37344. $target.one('hidden.bs.modal', function () {
  37345. $this.is(':visible') && $this.trigger('focus')
  37346. })
  37347. })
  37348. Plugin.call($target, option, this)
  37349. })
  37350. }(jQuery);
  37351. /* ========================================================================
  37352. * Bootstrap: tooltip.js v3.4.0
  37353. * https://getbootstrap.com/docs/3.4/javascript/#tooltip
  37354. * Inspired by the original jQuery.tipsy by Jason Frame
  37355. * ========================================================================
  37356. * Copyright 2011-2018 Twitter, Inc.
  37357. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  37358. * ======================================================================== */
  37359. +function ($) {
  37360. 'use strict';
  37361. // TOOLTIP PUBLIC CLASS DEFINITION
  37362. // ===============================
  37363. var Tooltip = function (element, options) {
  37364. this.type = null
  37365. this.options = null
  37366. this.enabled = null
  37367. this.timeout = null
  37368. this.hoverState = null
  37369. this.$element = null
  37370. this.inState = null
  37371. this.init('tooltip', element, options)
  37372. }
  37373. Tooltip.VERSION = '3.4.0'
  37374. Tooltip.TRANSITION_DURATION = 150
  37375. Tooltip.DEFAULTS = {
  37376. animation: true,
  37377. placement: 'top',
  37378. selector: false,
  37379. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  37380. trigger: 'hover focus',
  37381. title: '',
  37382. delay: 0,
  37383. html: false,
  37384. container: false,
  37385. viewport: {
  37386. selector: 'body',
  37387. padding: 0
  37388. }
  37389. }
  37390. Tooltip.prototype.init = function (type, element, options) {
  37391. this.enabled = true
  37392. this.type = type
  37393. this.$element = $(element)
  37394. this.options = this.getOptions(options)
  37395. this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
  37396. this.inState = { click: false, hover: false, focus: false }
  37397. if (this.$element[0] instanceof document.constructor && !this.options.selector) {
  37398. throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
  37399. }
  37400. var triggers = this.options.trigger.split(' ')
  37401. for (var i = triggers.length; i--;) {
  37402. var trigger = triggers[i]
  37403. if (trigger == 'click') {
  37404. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  37405. } else if (trigger != 'manual') {
  37406. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  37407. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  37408. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  37409. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  37410. }
  37411. }
  37412. this.options.selector ?
  37413. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  37414. this.fixTitle()
  37415. }
  37416. Tooltip.prototype.getDefaults = function () {
  37417. return Tooltip.DEFAULTS
  37418. }
  37419. Tooltip.prototype.getOptions = function (options) {
  37420. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  37421. if (options.delay && typeof options.delay == 'number') {
  37422. options.delay = {
  37423. show: options.delay,
  37424. hide: options.delay
  37425. }
  37426. }
  37427. return options
  37428. }
  37429. Tooltip.prototype.getDelegateOptions = function () {
  37430. var options = {}
  37431. var defaults = this.getDefaults()
  37432. this._options && $.each(this._options, function (key, value) {
  37433. if (defaults[key] != value) options[key] = value
  37434. })
  37435. return options
  37436. }
  37437. Tooltip.prototype.enter = function (obj) {
  37438. var self = obj instanceof this.constructor ?
  37439. obj : $(obj.currentTarget).data('bs.' + this.type)
  37440. if (!self) {
  37441. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  37442. $(obj.currentTarget).data('bs.' + this.type, self)
  37443. }
  37444. if (obj instanceof $.Event) {
  37445. self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
  37446. }
  37447. if (self.tip().hasClass('in') || self.hoverState == 'in') {
  37448. self.hoverState = 'in'
  37449. return
  37450. }
  37451. clearTimeout(self.timeout)
  37452. self.hoverState = 'in'
  37453. if (!self.options.delay || !self.options.delay.show) return self.show()
  37454. self.timeout = setTimeout(function () {
  37455. if (self.hoverState == 'in') self.show()
  37456. }, self.options.delay.show)
  37457. }
  37458. Tooltip.prototype.isInStateTrue = function () {
  37459. for (var key in this.inState) {
  37460. if (this.inState[key]) return true
  37461. }
  37462. return false
  37463. }
  37464. Tooltip.prototype.leave = function (obj) {
  37465. var self = obj instanceof this.constructor ?
  37466. obj : $(obj.currentTarget).data('bs.' + this.type)
  37467. if (!self) {
  37468. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  37469. $(obj.currentTarget).data('bs.' + this.type, self)
  37470. }
  37471. if (obj instanceof $.Event) {
  37472. self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
  37473. }
  37474. if (self.isInStateTrue()) return
  37475. clearTimeout(self.timeout)
  37476. self.hoverState = 'out'
  37477. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  37478. self.timeout = setTimeout(function () {
  37479. if (self.hoverState == 'out') self.hide()
  37480. }, self.options.delay.hide)
  37481. }
  37482. Tooltip.prototype.show = function () {
  37483. var e = $.Event('show.bs.' + this.type)
  37484. if (this.hasContent() && this.enabled) {
  37485. this.$element.trigger(e)
  37486. var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
  37487. if (e.isDefaultPrevented() || !inDom) return
  37488. var that = this
  37489. var $tip = this.tip()
  37490. var tipId = this.getUID(this.type)
  37491. this.setContent()
  37492. $tip.attr('id', tipId)
  37493. this.$element.attr('aria-describedby', tipId)
  37494. if (this.options.animation) $tip.addClass('fade')
  37495. var placement = typeof this.options.placement == 'function' ?
  37496. this.options.placement.call(this, $tip[0], this.$element[0]) :
  37497. this.options.placement
  37498. var autoToken = /\s?auto?\s?/i
  37499. var autoPlace = autoToken.test(placement)
  37500. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  37501. $tip
  37502. .detach()
  37503. .css({ top: 0, left: 0, display: 'block' })
  37504. .addClass(placement)
  37505. .data('bs.' + this.type, this)
  37506. this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
  37507. this.$element.trigger('inserted.bs.' + this.type)
  37508. var pos = this.getPosition()
  37509. var actualWidth = $tip[0].offsetWidth
  37510. var actualHeight = $tip[0].offsetHeight
  37511. if (autoPlace) {
  37512. var orgPlacement = placement
  37513. var viewportDim = this.getPosition(this.$viewport)
  37514. placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
  37515. placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
  37516. placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
  37517. placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
  37518. placement
  37519. $tip
  37520. .removeClass(orgPlacement)
  37521. .addClass(placement)
  37522. }
  37523. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  37524. this.applyPlacement(calculatedOffset, placement)
  37525. var complete = function () {
  37526. var prevHoverState = that.hoverState
  37527. that.$element.trigger('shown.bs.' + that.type)
  37528. that.hoverState = null
  37529. if (prevHoverState == 'out') that.leave(that)
  37530. }
  37531. $.support.transition && this.$tip.hasClass('fade') ?
  37532. $tip
  37533. .one('bsTransitionEnd', complete)
  37534. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  37535. complete()
  37536. }
  37537. }
  37538. Tooltip.prototype.applyPlacement = function (offset, placement) {
  37539. var $tip = this.tip()
  37540. var width = $tip[0].offsetWidth
  37541. var height = $tip[0].offsetHeight
  37542. // manually read margins because getBoundingClientRect includes difference
  37543. var marginTop = parseInt($tip.css('margin-top'), 10)
  37544. var marginLeft = parseInt($tip.css('margin-left'), 10)
  37545. // we must check for NaN for ie 8/9
  37546. if (isNaN(marginTop)) marginTop = 0
  37547. if (isNaN(marginLeft)) marginLeft = 0
  37548. offset.top += marginTop
  37549. offset.left += marginLeft
  37550. // $.fn.offset doesn't round pixel values
  37551. // so we use setOffset directly with our own function B-0
  37552. $.offset.setOffset($tip[0], $.extend({
  37553. using: function (props) {
  37554. $tip.css({
  37555. top: Math.round(props.top),
  37556. left: Math.round(props.left)
  37557. })
  37558. }
  37559. }, offset), 0)
  37560. $tip.addClass('in')
  37561. // check to see if placing tip in new offset caused the tip to resize itself
  37562. var actualWidth = $tip[0].offsetWidth
  37563. var actualHeight = $tip[0].offsetHeight
  37564. if (placement == 'top' && actualHeight != height) {
  37565. offset.top = offset.top + height - actualHeight
  37566. }
  37567. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  37568. if (delta.left) offset.left += delta.left
  37569. else offset.top += delta.top
  37570. var isVertical = /top|bottom/.test(placement)
  37571. var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  37572. var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
  37573. $tip.offset(offset)
  37574. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  37575. }
  37576. Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
  37577. this.arrow()
  37578. .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
  37579. .css(isVertical ? 'top' : 'left', '')
  37580. }
  37581. Tooltip.prototype.setContent = function () {
  37582. var $tip = this.tip()
  37583. var title = this.getTitle()
  37584. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  37585. $tip.removeClass('fade in top bottom left right')
  37586. }
  37587. Tooltip.prototype.hide = function (callback) {
  37588. var that = this
  37589. var $tip = $(this.$tip)
  37590. var e = $.Event('hide.bs.' + this.type)
  37591. function complete() {
  37592. if (that.hoverState != 'in') $tip.detach()
  37593. if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
  37594. that.$element
  37595. .removeAttr('aria-describedby')
  37596. .trigger('hidden.bs.' + that.type)
  37597. }
  37598. callback && callback()
  37599. }
  37600. this.$element.trigger(e)
  37601. if (e.isDefaultPrevented()) return
  37602. $tip.removeClass('in')
  37603. $.support.transition && $tip.hasClass('fade') ?
  37604. $tip
  37605. .one('bsTransitionEnd', complete)
  37606. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  37607. complete()
  37608. this.hoverState = null
  37609. return this
  37610. }
  37611. Tooltip.prototype.fixTitle = function () {
  37612. var $e = this.$element
  37613. if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
  37614. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  37615. }
  37616. }
  37617. Tooltip.prototype.hasContent = function () {
  37618. return this.getTitle()
  37619. }
  37620. Tooltip.prototype.getPosition = function ($element) {
  37621. $element = $element || this.$element
  37622. var el = $element[0]
  37623. var isBody = el.tagName == 'BODY'
  37624. var elRect = el.getBoundingClientRect()
  37625. if (elRect.width == null) {
  37626. // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
  37627. elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
  37628. }
  37629. var isSvg = window.SVGElement && el instanceof window.SVGElement
  37630. // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
  37631. // See https://github.com/twbs/bootstrap/issues/20280
  37632. var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
  37633. var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
  37634. var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
  37635. return $.extend({}, elRect, scroll, outerDims, elOffset)
  37636. }
  37637. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  37638. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  37639. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  37640. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  37641. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  37642. }
  37643. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  37644. var delta = { top: 0, left: 0 }
  37645. if (!this.$viewport) return delta
  37646. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  37647. var viewportDimensions = this.getPosition(this.$viewport)
  37648. if (/right|left/.test(placement)) {
  37649. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  37650. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  37651. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  37652. delta.top = viewportDimensions.top - topEdgeOffset
  37653. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  37654. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  37655. }
  37656. } else {
  37657. var leftEdgeOffset = pos.left - viewportPadding
  37658. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  37659. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  37660. delta.left = viewportDimensions.left - leftEdgeOffset
  37661. } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
  37662. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  37663. }
  37664. }
  37665. return delta
  37666. }
  37667. Tooltip.prototype.getTitle = function () {
  37668. var title
  37669. var $e = this.$element
  37670. var o = this.options
  37671. title = $e.attr('data-original-title')
  37672. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  37673. return title
  37674. }
  37675. Tooltip.prototype.getUID = function (prefix) {
  37676. do prefix += ~~(Math.random() * 1000000)
  37677. while (document.getElementById(prefix))
  37678. return prefix
  37679. }
  37680. Tooltip.prototype.tip = function () {
  37681. if (!this.$tip) {
  37682. this.$tip = $(this.options.template)
  37683. if (this.$tip.length != 1) {
  37684. throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
  37685. }
  37686. }
  37687. return this.$tip
  37688. }
  37689. Tooltip.prototype.arrow = function () {
  37690. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  37691. }
  37692. Tooltip.prototype.enable = function () {
  37693. this.enabled = true
  37694. }
  37695. Tooltip.prototype.disable = function () {
  37696. this.enabled = false
  37697. }
  37698. Tooltip.prototype.toggleEnabled = function () {
  37699. this.enabled = !this.enabled
  37700. }
  37701. Tooltip.prototype.toggle = function (e) {
  37702. var self = this
  37703. if (e) {
  37704. self = $(e.currentTarget).data('bs.' + this.type)
  37705. if (!self) {
  37706. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  37707. $(e.currentTarget).data('bs.' + this.type, self)
  37708. }
  37709. }
  37710. if (e) {
  37711. self.inState.click = !self.inState.click
  37712. if (self.isInStateTrue()) self.enter(self)
  37713. else self.leave(self)
  37714. } else {
  37715. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  37716. }
  37717. }
  37718. Tooltip.prototype.destroy = function () {
  37719. var that = this
  37720. clearTimeout(this.timeout)
  37721. this.hide(function () {
  37722. that.$element.off('.' + that.type).removeData('bs.' + that.type)
  37723. if (that.$tip) {
  37724. that.$tip.detach()
  37725. }
  37726. that.$tip = null
  37727. that.$arrow = null
  37728. that.$viewport = null
  37729. that.$element = null
  37730. })
  37731. }
  37732. // TOOLTIP PLUGIN DEFINITION
  37733. // =========================
  37734. function Plugin(option) {
  37735. return this.each(function () {
  37736. var $this = $(this)
  37737. var data = $this.data('bs.tooltip')
  37738. var options = typeof option == 'object' && option
  37739. if (!data && /destroy|hide/.test(option)) return
  37740. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  37741. if (typeof option == 'string') data[option]()
  37742. })
  37743. }
  37744. var old = $.fn.tooltip
  37745. $.fn.tooltip = Plugin
  37746. $.fn.tooltip.Constructor = Tooltip
  37747. // TOOLTIP NO CONFLICT
  37748. // ===================
  37749. $.fn.tooltip.noConflict = function () {
  37750. $.fn.tooltip = old
  37751. return this
  37752. }
  37753. }(jQuery);
  37754. /* ========================================================================
  37755. * Bootstrap: popover.js v3.4.0
  37756. * https://getbootstrap.com/docs/3.4/javascript/#popovers
  37757. * ========================================================================
  37758. * Copyright 2011-2018 Twitter, Inc.
  37759. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  37760. * ======================================================================== */
  37761. +function ($) {
  37762. 'use strict';
  37763. // POPOVER PUBLIC CLASS DEFINITION
  37764. // ===============================
  37765. var Popover = function (element, options) {
  37766. this.init('popover', element, options)
  37767. }
  37768. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  37769. Popover.VERSION = '3.4.0'
  37770. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  37771. placement: 'right',
  37772. trigger: 'click',
  37773. content: '',
  37774. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  37775. })
  37776. // NOTE: POPOVER EXTENDS tooltip.js
  37777. // ================================
  37778. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  37779. Popover.prototype.constructor = Popover
  37780. Popover.prototype.getDefaults = function () {
  37781. return Popover.DEFAULTS
  37782. }
  37783. Popover.prototype.setContent = function () {
  37784. var $tip = this.tip()
  37785. var title = this.getTitle()
  37786. var content = this.getContent()
  37787. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  37788. $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
  37789. this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
  37790. ](content)
  37791. $tip.removeClass('fade top bottom left right in')
  37792. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  37793. // this manually by checking the contents.
  37794. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  37795. }
  37796. Popover.prototype.hasContent = function () {
  37797. return this.getTitle() || this.getContent()
  37798. }
  37799. Popover.prototype.getContent = function () {
  37800. var $e = this.$element
  37801. var o = this.options
  37802. return $e.attr('data-content')
  37803. || (typeof o.content == 'function' ?
  37804. o.content.call($e[0]) :
  37805. o.content)
  37806. }
  37807. Popover.prototype.arrow = function () {
  37808. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  37809. }
  37810. // POPOVER PLUGIN DEFINITION
  37811. // =========================
  37812. function Plugin(option) {
  37813. return this.each(function () {
  37814. var $this = $(this)
  37815. var data = $this.data('bs.popover')
  37816. var options = typeof option == 'object' && option
  37817. if (!data && /destroy|hide/.test(option)) return
  37818. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  37819. if (typeof option == 'string') data[option]()
  37820. })
  37821. }
  37822. var old = $.fn.popover
  37823. $.fn.popover = Plugin
  37824. $.fn.popover.Constructor = Popover
  37825. // POPOVER NO CONFLICT
  37826. // ===================
  37827. $.fn.popover.noConflict = function () {
  37828. $.fn.popover = old
  37829. return this
  37830. }
  37831. }(jQuery);
  37832. /* ========================================================================
  37833. * Bootstrap: scrollspy.js v3.4.0
  37834. * https://getbootstrap.com/docs/3.4/javascript/#scrollspy
  37835. * ========================================================================
  37836. * Copyright 2011-2018 Twitter, Inc.
  37837. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  37838. * ======================================================================== */
  37839. +function ($) {
  37840. 'use strict';
  37841. // SCROLLSPY CLASS DEFINITION
  37842. // ==========================
  37843. function ScrollSpy(element, options) {
  37844. this.$body = $(document.body)
  37845. this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
  37846. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  37847. this.selector = (this.options.target || '') + ' .nav li > a'
  37848. this.offsets = []
  37849. this.targets = []
  37850. this.activeTarget = null
  37851. this.scrollHeight = 0
  37852. this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
  37853. this.refresh()
  37854. this.process()
  37855. }
  37856. ScrollSpy.VERSION = '3.4.0'
  37857. ScrollSpy.DEFAULTS = {
  37858. offset: 10
  37859. }
  37860. ScrollSpy.prototype.getScrollHeight = function () {
  37861. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  37862. }
  37863. ScrollSpy.prototype.refresh = function () {
  37864. var that = this
  37865. var offsetMethod = 'offset'
  37866. var offsetBase = 0
  37867. this.offsets = []
  37868. this.targets = []
  37869. this.scrollHeight = this.getScrollHeight()
  37870. if (!$.isWindow(this.$scrollElement[0])) {
  37871. offsetMethod = 'position'
  37872. offsetBase = this.$scrollElement.scrollTop()
  37873. }
  37874. this.$body
  37875. .find(this.selector)
  37876. .map(function () {
  37877. var $el = $(this)
  37878. var href = $el.data('target') || $el.attr('href')
  37879. var $href = /^#./.test(href) && $(href)
  37880. return ($href
  37881. && $href.length
  37882. && $href.is(':visible')
  37883. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  37884. })
  37885. .sort(function (a, b) { return a[0] - b[0] })
  37886. .each(function () {
  37887. that.offsets.push(this[0])
  37888. that.targets.push(this[1])
  37889. })
  37890. }
  37891. ScrollSpy.prototype.process = function () {
  37892. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  37893. var scrollHeight = this.getScrollHeight()
  37894. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  37895. var offsets = this.offsets
  37896. var targets = this.targets
  37897. var activeTarget = this.activeTarget
  37898. var i
  37899. if (this.scrollHeight != scrollHeight) {
  37900. this.refresh()
  37901. }
  37902. if (scrollTop >= maxScroll) {
  37903. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  37904. }
  37905. if (activeTarget && scrollTop < offsets[0]) {
  37906. this.activeTarget = null
  37907. return this.clear()
  37908. }
  37909. for (i = offsets.length; i--;) {
  37910. activeTarget != targets[i]
  37911. && scrollTop >= offsets[i]
  37912. && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
  37913. && this.activate(targets[i])
  37914. }
  37915. }
  37916. ScrollSpy.prototype.activate = function (target) {
  37917. this.activeTarget = target
  37918. this.clear()
  37919. var selector = this.selector +
  37920. '[data-target="' + target + '"],' +
  37921. this.selector + '[href="' + target + '"]'
  37922. var active = $(selector)
  37923. .parents('li')
  37924. .addClass('active')
  37925. if (active.parent('.dropdown-menu').length) {
  37926. active = active
  37927. .closest('li.dropdown')
  37928. .addClass('active')
  37929. }
  37930. active.trigger('activate.bs.scrollspy')
  37931. }
  37932. ScrollSpy.prototype.clear = function () {
  37933. $(this.selector)
  37934. .parentsUntil(this.options.target, '.active')
  37935. .removeClass('active')
  37936. }
  37937. // SCROLLSPY PLUGIN DEFINITION
  37938. // ===========================
  37939. function Plugin(option) {
  37940. return this.each(function () {
  37941. var $this = $(this)
  37942. var data = $this.data('bs.scrollspy')
  37943. var options = typeof option == 'object' && option
  37944. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  37945. if (typeof option == 'string') data[option]()
  37946. })
  37947. }
  37948. var old = $.fn.scrollspy
  37949. $.fn.scrollspy = Plugin
  37950. $.fn.scrollspy.Constructor = ScrollSpy
  37951. // SCROLLSPY NO CONFLICT
  37952. // =====================
  37953. $.fn.scrollspy.noConflict = function () {
  37954. $.fn.scrollspy = old
  37955. return this
  37956. }
  37957. // SCROLLSPY DATA-API
  37958. // ==================
  37959. $(window).on('load.bs.scrollspy.data-api', function () {
  37960. $('[data-spy="scroll"]').each(function () {
  37961. var $spy = $(this)
  37962. Plugin.call($spy, $spy.data())
  37963. })
  37964. })
  37965. }(jQuery);
  37966. /* ========================================================================
  37967. * Bootstrap: tab.js v3.4.0
  37968. * https://getbootstrap.com/docs/3.4/javascript/#tabs
  37969. * ========================================================================
  37970. * Copyright 2011-2018 Twitter, Inc.
  37971. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  37972. * ======================================================================== */
  37973. +function ($) {
  37974. 'use strict';
  37975. // TAB CLASS DEFINITION
  37976. // ====================
  37977. var Tab = function (element) {
  37978. // jscs:disable requireDollarBeforejQueryAssignment
  37979. this.element = $(element)
  37980. // jscs:enable requireDollarBeforejQueryAssignment
  37981. }
  37982. Tab.VERSION = '3.4.0'
  37983. Tab.TRANSITION_DURATION = 150
  37984. Tab.prototype.show = function () {
  37985. var $this = this.element
  37986. var $ul = $this.closest('ul:not(.dropdown-menu)')
  37987. var selector = $this.data('target')
  37988. if (!selector) {
  37989. selector = $this.attr('href')
  37990. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  37991. }
  37992. if ($this.parent('li').hasClass('active')) return
  37993. var $previous = $ul.find('.active:last a')
  37994. var hideEvent = $.Event('hide.bs.tab', {
  37995. relatedTarget: $this[0]
  37996. })
  37997. var showEvent = $.Event('show.bs.tab', {
  37998. relatedTarget: $previous[0]
  37999. })
  38000. $previous.trigger(hideEvent)
  38001. $this.trigger(showEvent)
  38002. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
  38003. var $target = $(document).find(selector)
  38004. this.activate($this.closest('li'), $ul)
  38005. this.activate($target, $target.parent(), function () {
  38006. $previous.trigger({
  38007. type: 'hidden.bs.tab',
  38008. relatedTarget: $this[0]
  38009. })
  38010. $this.trigger({
  38011. type: 'shown.bs.tab',
  38012. relatedTarget: $previous[0]
  38013. })
  38014. })
  38015. }
  38016. Tab.prototype.activate = function (element, container, callback) {
  38017. var $active = container.find('> .active')
  38018. var transition = callback
  38019. && $.support.transition
  38020. && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
  38021. function next() {
  38022. $active
  38023. .removeClass('active')
  38024. .find('> .dropdown-menu > .active')
  38025. .removeClass('active')
  38026. .end()
  38027. .find('[data-toggle="tab"]')
  38028. .attr('aria-expanded', false)
  38029. element
  38030. .addClass('active')
  38031. .find('[data-toggle="tab"]')
  38032. .attr('aria-expanded', true)
  38033. if (transition) {
  38034. element[0].offsetWidth // reflow for transition
  38035. element.addClass('in')
  38036. } else {
  38037. element.removeClass('fade')
  38038. }
  38039. if (element.parent('.dropdown-menu').length) {
  38040. element
  38041. .closest('li.dropdown')
  38042. .addClass('active')
  38043. .end()
  38044. .find('[data-toggle="tab"]')
  38045. .attr('aria-expanded', true)
  38046. }
  38047. callback && callback()
  38048. }
  38049. $active.length && transition ?
  38050. $active
  38051. .one('bsTransitionEnd', next)
  38052. .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
  38053. next()
  38054. $active.removeClass('in')
  38055. }
  38056. // TAB PLUGIN DEFINITION
  38057. // =====================
  38058. function Plugin(option) {
  38059. return this.each(function () {
  38060. var $this = $(this)
  38061. var data = $this.data('bs.tab')
  38062. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  38063. if (typeof option == 'string') data[option]()
  38064. })
  38065. }
  38066. var old = $.fn.tab
  38067. $.fn.tab = Plugin
  38068. $.fn.tab.Constructor = Tab
  38069. // TAB NO CONFLICT
  38070. // ===============
  38071. $.fn.tab.noConflict = function () {
  38072. $.fn.tab = old
  38073. return this
  38074. }
  38075. // TAB DATA-API
  38076. // ============
  38077. var clickHandler = function (e) {
  38078. e.preventDefault()
  38079. Plugin.call($(this), 'show')
  38080. }
  38081. $(document)
  38082. .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
  38083. .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
  38084. }(jQuery);
  38085. /* ========================================================================
  38086. * Bootstrap: affix.js v3.4.0
  38087. * https://getbootstrap.com/docs/3.4/javascript/#affix
  38088. * ========================================================================
  38089. * Copyright 2011-2018 Twitter, Inc.
  38090. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  38091. * ======================================================================== */
  38092. +function ($) {
  38093. 'use strict';
  38094. // AFFIX CLASS DEFINITION
  38095. // ======================
  38096. var Affix = function (element, options) {
  38097. this.options = $.extend({}, Affix.DEFAULTS, options)
  38098. var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target)
  38099. this.$target = target
  38100. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  38101. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  38102. this.$element = $(element)
  38103. this.affixed = null
  38104. this.unpin = null
  38105. this.pinnedOffset = null
  38106. this.checkPosition()
  38107. }
  38108. Affix.VERSION = '3.4.0'
  38109. Affix.RESET = 'affix affix-top affix-bottom'
  38110. Affix.DEFAULTS = {
  38111. offset: 0,
  38112. target: window
  38113. }
  38114. Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  38115. var scrollTop = this.$target.scrollTop()
  38116. var position = this.$element.offset()
  38117. var targetHeight = this.$target.height()
  38118. if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  38119. if (this.affixed == 'bottom') {
  38120. if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  38121. return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  38122. }
  38123. var initializing = this.affixed == null
  38124. var colliderTop = initializing ? scrollTop : position.top
  38125. var colliderHeight = initializing ? targetHeight : height
  38126. if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  38127. if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  38128. return false
  38129. }
  38130. Affix.prototype.getPinnedOffset = function () {
  38131. if (this.pinnedOffset) return this.pinnedOffset
  38132. this.$element.removeClass(Affix.RESET).addClass('affix')
  38133. var scrollTop = this.$target.scrollTop()
  38134. var position = this.$element.offset()
  38135. return (this.pinnedOffset = position.top - scrollTop)
  38136. }
  38137. Affix.prototype.checkPositionWithEventLoop = function () {
  38138. setTimeout($.proxy(this.checkPosition, this), 1)
  38139. }
  38140. Affix.prototype.checkPosition = function () {
  38141. if (!this.$element.is(':visible')) return
  38142. var height = this.$element.height()
  38143. var offset = this.options.offset
  38144. var offsetTop = offset.top
  38145. var offsetBottom = offset.bottom
  38146. var scrollHeight = Math.max($(document).height(), $(document.body).height())
  38147. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  38148. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  38149. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  38150. var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  38151. if (this.affixed != affix) {
  38152. if (this.unpin != null) this.$element.css('top', '')
  38153. var affixType = 'affix' + (affix ? '-' + affix : '')
  38154. var e = $.Event(affixType + '.bs.affix')
  38155. this.$element.trigger(e)
  38156. if (e.isDefaultPrevented()) return
  38157. this.affixed = affix
  38158. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  38159. this.$element
  38160. .removeClass(Affix.RESET)
  38161. .addClass(affixType)
  38162. .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  38163. }
  38164. if (affix == 'bottom') {
  38165. this.$element.offset({
  38166. top: scrollHeight - height - offsetBottom
  38167. })
  38168. }
  38169. }
  38170. // AFFIX PLUGIN DEFINITION
  38171. // =======================
  38172. function Plugin(option) {
  38173. return this.each(function () {
  38174. var $this = $(this)
  38175. var data = $this.data('bs.affix')
  38176. var options = typeof option == 'object' && option
  38177. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  38178. if (typeof option == 'string') data[option]()
  38179. })
  38180. }
  38181. var old = $.fn.affix
  38182. $.fn.affix = Plugin
  38183. $.fn.affix.Constructor = Affix
  38184. // AFFIX NO CONFLICT
  38185. // =================
  38186. $.fn.affix.noConflict = function () {
  38187. $.fn.affix = old
  38188. return this
  38189. }
  38190. // AFFIX DATA-API
  38191. // ==============
  38192. $(window).on('load', function () {
  38193. $('[data-spy="affix"]').each(function () {
  38194. var $spy = $(this)
  38195. var data = $spy.data()
  38196. data.offset = data.offset || {}
  38197. if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  38198. if (data.offsetTop != null) data.offset.top = data.offsetTop
  38199. Plugin.call($spy, data)
  38200. })
  38201. })
  38202. }(jQuery);
  38203. /***/ }),
  38204. /* 20 */
  38205. /***/ (function(module, exports, __webpack_require__) {
  38206. "use strict";
  38207. var utils = __webpack_require__(0);
  38208. var bind = __webpack_require__(7);
  38209. var Axios = __webpack_require__(22);
  38210. var defaults = __webpack_require__(4);
  38211. /**
  38212. * Create an instance of Axios
  38213. *
  38214. * @param {Object} defaultConfig The default config for the instance
  38215. * @return {Axios} A new instance of Axios
  38216. */
  38217. function createInstance(defaultConfig) {
  38218. var context = new Axios(defaultConfig);
  38219. var instance = bind(Axios.prototype.request, context);
  38220. // Copy axios.prototype to instance
  38221. utils.extend(instance, Axios.prototype, context);
  38222. // Copy context to instance
  38223. utils.extend(instance, context);
  38224. return instance;
  38225. }
  38226. // Create the default instance to be exported
  38227. var axios = createInstance(defaults);
  38228. // Expose Axios class to allow class inheritance
  38229. axios.Axios = Axios;
  38230. // Factory for creating new instances
  38231. axios.create = function create(instanceConfig) {
  38232. return createInstance(utils.merge(defaults, instanceConfig));
  38233. };
  38234. // Expose Cancel & CancelToken
  38235. axios.Cancel = __webpack_require__(12);
  38236. axios.CancelToken = __webpack_require__(36);
  38237. axios.isCancel = __webpack_require__(11);
  38238. // Expose all/spread
  38239. axios.all = function all(promises) {
  38240. return Promise.all(promises);
  38241. };
  38242. axios.spread = __webpack_require__(37);
  38243. module.exports = axios;
  38244. // Allow use of default import syntax in TypeScript
  38245. module.exports.default = axios;
  38246. /***/ }),
  38247. /* 21 */
  38248. /***/ (function(module, exports) {
  38249. /*!
  38250. * Determine if an object is a Buffer
  38251. *
  38252. * @author Feross Aboukhadijeh <https://feross.org>
  38253. * @license MIT
  38254. */
  38255. // The _isBuffer check is for Safari 5-7 support, because it's missing
  38256. // Object.prototype.constructor. Remove this eventually
  38257. module.exports = function (obj) {
  38258. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  38259. }
  38260. function isBuffer (obj) {
  38261. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  38262. }
  38263. // For Node v0.10 support. Remove this eventually.
  38264. function isSlowBuffer (obj) {
  38265. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  38266. }
  38267. /***/ }),
  38268. /* 22 */
  38269. /***/ (function(module, exports, __webpack_require__) {
  38270. "use strict";
  38271. var defaults = __webpack_require__(4);
  38272. var utils = __webpack_require__(0);
  38273. var InterceptorManager = __webpack_require__(31);
  38274. var dispatchRequest = __webpack_require__(32);
  38275. /**
  38276. * Create a new instance of Axios
  38277. *
  38278. * @param {Object} instanceConfig The default config for the instance
  38279. */
  38280. function Axios(instanceConfig) {
  38281. this.defaults = instanceConfig;
  38282. this.interceptors = {
  38283. request: new InterceptorManager(),
  38284. response: new InterceptorManager()
  38285. };
  38286. }
  38287. /**
  38288. * Dispatch a request
  38289. *
  38290. * @param {Object} config The config specific for this request (merged with this.defaults)
  38291. */
  38292. Axios.prototype.request = function request(config) {
  38293. /*eslint no-param-reassign:0*/
  38294. // Allow for axios('example/url'[, config]) a la fetch API
  38295. if (typeof config === 'string') {
  38296. config = utils.merge({
  38297. url: arguments[0]
  38298. }, arguments[1]);
  38299. }
  38300. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  38301. config.method = config.method.toLowerCase();
  38302. // Hook up interceptors middleware
  38303. var chain = [dispatchRequest, undefined];
  38304. var promise = Promise.resolve(config);
  38305. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  38306. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  38307. });
  38308. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  38309. chain.push(interceptor.fulfilled, interceptor.rejected);
  38310. });
  38311. while (chain.length) {
  38312. promise = promise.then(chain.shift(), chain.shift());
  38313. }
  38314. return promise;
  38315. };
  38316. // Provide aliases for supported request methods
  38317. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  38318. /*eslint func-names:0*/
  38319. Axios.prototype[method] = function(url, config) {
  38320. return this.request(utils.merge(config || {}, {
  38321. method: method,
  38322. url: url
  38323. }));
  38324. };
  38325. });
  38326. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  38327. /*eslint func-names:0*/
  38328. Axios.prototype[method] = function(url, data, config) {
  38329. return this.request(utils.merge(config || {}, {
  38330. method: method,
  38331. url: url,
  38332. data: data
  38333. }));
  38334. };
  38335. });
  38336. module.exports = Axios;
  38337. /***/ }),
  38338. /* 23 */
  38339. /***/ (function(module, exports, __webpack_require__) {
  38340. "use strict";
  38341. var utils = __webpack_require__(0);
  38342. module.exports = function normalizeHeaderName(headers, normalizedName) {
  38343. utils.forEach(headers, function processHeader(value, name) {
  38344. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  38345. headers[normalizedName] = value;
  38346. delete headers[name];
  38347. }
  38348. });
  38349. };
  38350. /***/ }),
  38351. /* 24 */
  38352. /***/ (function(module, exports, __webpack_require__) {
  38353. "use strict";
  38354. var createError = __webpack_require__(10);
  38355. /**
  38356. * Resolve or reject a Promise based on response status.
  38357. *
  38358. * @param {Function} resolve A function that resolves the promise.
  38359. * @param {Function} reject A function that rejects the promise.
  38360. * @param {object} response The response.
  38361. */
  38362. module.exports = function settle(resolve, reject, response) {
  38363. var validateStatus = response.config.validateStatus;
  38364. // Note: status is not exposed by XDomainRequest
  38365. if (!response.status || !validateStatus || validateStatus(response.status)) {
  38366. resolve(response);
  38367. } else {
  38368. reject(createError(
  38369. 'Request failed with status code ' + response.status,
  38370. response.config,
  38371. null,
  38372. response.request,
  38373. response
  38374. ));
  38375. }
  38376. };
  38377. /***/ }),
  38378. /* 25 */
  38379. /***/ (function(module, exports, __webpack_require__) {
  38380. "use strict";
  38381. /**
  38382. * Update an Error with the specified config, error code, and response.
  38383. *
  38384. * @param {Error} error The error to update.
  38385. * @param {Object} config The config.
  38386. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  38387. * @param {Object} [request] The request.
  38388. * @param {Object} [response] The response.
  38389. * @returns {Error} The error.
  38390. */
  38391. module.exports = function enhanceError(error, config, code, request, response) {
  38392. error.config = config;
  38393. if (code) {
  38394. error.code = code;
  38395. }
  38396. error.request = request;
  38397. error.response = response;
  38398. return error;
  38399. };
  38400. /***/ }),
  38401. /* 26 */
  38402. /***/ (function(module, exports, __webpack_require__) {
  38403. "use strict";
  38404. var utils = __webpack_require__(0);
  38405. function encode(val) {
  38406. return encodeURIComponent(val).
  38407. replace(/%40/gi, '@').
  38408. replace(/%3A/gi, ':').
  38409. replace(/%24/g, '$').
  38410. replace(/%2C/gi, ',').
  38411. replace(/%20/g, '+').
  38412. replace(/%5B/gi, '[').
  38413. replace(/%5D/gi, ']');
  38414. }
  38415. /**
  38416. * Build a URL by appending params to the end
  38417. *
  38418. * @param {string} url The base of the url (e.g., http://www.google.com)
  38419. * @param {object} [params] The params to be appended
  38420. * @returns {string} The formatted url
  38421. */
  38422. module.exports = function buildURL(url, params, paramsSerializer) {
  38423. /*eslint no-param-reassign:0*/
  38424. if (!params) {
  38425. return url;
  38426. }
  38427. var serializedParams;
  38428. if (paramsSerializer) {
  38429. serializedParams = paramsSerializer(params);
  38430. } else if (utils.isURLSearchParams(params)) {
  38431. serializedParams = params.toString();
  38432. } else {
  38433. var parts = [];
  38434. utils.forEach(params, function serialize(val, key) {
  38435. if (val === null || typeof val === 'undefined') {
  38436. return;
  38437. }
  38438. if (utils.isArray(val)) {
  38439. key = key + '[]';
  38440. }
  38441. if (!utils.isArray(val)) {
  38442. val = [val];
  38443. }
  38444. utils.forEach(val, function parseValue(v) {
  38445. if (utils.isDate(v)) {
  38446. v = v.toISOString();
  38447. } else if (utils.isObject(v)) {
  38448. v = JSON.stringify(v);
  38449. }
  38450. parts.push(encode(key) + '=' + encode(v));
  38451. });
  38452. });
  38453. serializedParams = parts.join('&');
  38454. }
  38455. if (serializedParams) {
  38456. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  38457. }
  38458. return url;
  38459. };
  38460. /***/ }),
  38461. /* 27 */
  38462. /***/ (function(module, exports, __webpack_require__) {
  38463. "use strict";
  38464. var utils = __webpack_require__(0);
  38465. // Headers whose duplicates are ignored by node
  38466. // c.f. https://nodejs.org/api/http.html#http_message_headers
  38467. var ignoreDuplicateOf = [
  38468. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  38469. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  38470. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  38471. 'referer', 'retry-after', 'user-agent'
  38472. ];
  38473. /**
  38474. * Parse headers into an object
  38475. *
  38476. * ```
  38477. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  38478. * Content-Type: application/json
  38479. * Connection: keep-alive
  38480. * Transfer-Encoding: chunked
  38481. * ```
  38482. *
  38483. * @param {String} headers Headers needing to be parsed
  38484. * @returns {Object} Headers parsed into an object
  38485. */
  38486. module.exports = function parseHeaders(headers) {
  38487. var parsed = {};
  38488. var key;
  38489. var val;
  38490. var i;
  38491. if (!headers) { return parsed; }
  38492. utils.forEach(headers.split('\n'), function parser(line) {
  38493. i = line.indexOf(':');
  38494. key = utils.trim(line.substr(0, i)).toLowerCase();
  38495. val = utils.trim(line.substr(i + 1));
  38496. if (key) {
  38497. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  38498. return;
  38499. }
  38500. if (key === 'set-cookie') {
  38501. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  38502. } else {
  38503. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  38504. }
  38505. }
  38506. });
  38507. return parsed;
  38508. };
  38509. /***/ }),
  38510. /* 28 */
  38511. /***/ (function(module, exports, __webpack_require__) {
  38512. "use strict";
  38513. var utils = __webpack_require__(0);
  38514. module.exports = (
  38515. utils.isStandardBrowserEnv() ?
  38516. // Standard browser envs have full support of the APIs needed to test
  38517. // whether the request URL is of the same origin as current location.
  38518. (function standardBrowserEnv() {
  38519. var msie = /(msie|trident)/i.test(navigator.userAgent);
  38520. var urlParsingNode = document.createElement('a');
  38521. var originURL;
  38522. /**
  38523. * Parse a URL to discover it's components
  38524. *
  38525. * @param {String} url The URL to be parsed
  38526. * @returns {Object}
  38527. */
  38528. function resolveURL(url) {
  38529. var href = url;
  38530. if (msie) {
  38531. // IE needs attribute set twice to normalize properties
  38532. urlParsingNode.setAttribute('href', href);
  38533. href = urlParsingNode.href;
  38534. }
  38535. urlParsingNode.setAttribute('href', href);
  38536. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  38537. return {
  38538. href: urlParsingNode.href,
  38539. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  38540. host: urlParsingNode.host,
  38541. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  38542. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  38543. hostname: urlParsingNode.hostname,
  38544. port: urlParsingNode.port,
  38545. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  38546. urlParsingNode.pathname :
  38547. '/' + urlParsingNode.pathname
  38548. };
  38549. }
  38550. originURL = resolveURL(window.location.href);
  38551. /**
  38552. * Determine if a URL shares the same origin as the current location
  38553. *
  38554. * @param {String} requestURL The URL to test
  38555. * @returns {boolean} True if URL shares the same origin, otherwise false
  38556. */
  38557. return function isURLSameOrigin(requestURL) {
  38558. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  38559. return (parsed.protocol === originURL.protocol &&
  38560. parsed.host === originURL.host);
  38561. };
  38562. })() :
  38563. // Non standard browser envs (web workers, react-native) lack needed support.
  38564. (function nonStandardBrowserEnv() {
  38565. return function isURLSameOrigin() {
  38566. return true;
  38567. };
  38568. })()
  38569. );
  38570. /***/ }),
  38571. /* 29 */
  38572. /***/ (function(module, exports, __webpack_require__) {
  38573. "use strict";
  38574. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  38575. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  38576. function E() {
  38577. this.message = 'String contains an invalid character';
  38578. }
  38579. E.prototype = new Error;
  38580. E.prototype.code = 5;
  38581. E.prototype.name = 'InvalidCharacterError';
  38582. function btoa(input) {
  38583. var str = String(input);
  38584. var output = '';
  38585. for (
  38586. // initialize result and counter
  38587. var block, charCode, idx = 0, map = chars;
  38588. // if the next str index does not exist:
  38589. // change the mapping table to "="
  38590. // check if d has no fractional digits
  38591. str.charAt(idx | 0) || (map = '=', idx % 1);
  38592. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  38593. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  38594. ) {
  38595. charCode = str.charCodeAt(idx += 3 / 4);
  38596. if (charCode > 0xFF) {
  38597. throw new E();
  38598. }
  38599. block = block << 8 | charCode;
  38600. }
  38601. return output;
  38602. }
  38603. module.exports = btoa;
  38604. /***/ }),
  38605. /* 30 */
  38606. /***/ (function(module, exports, __webpack_require__) {
  38607. "use strict";
  38608. var utils = __webpack_require__(0);
  38609. module.exports = (
  38610. utils.isStandardBrowserEnv() ?
  38611. // Standard browser envs support document.cookie
  38612. (function standardBrowserEnv() {
  38613. return {
  38614. write: function write(name, value, expires, path, domain, secure) {
  38615. var cookie = [];
  38616. cookie.push(name + '=' + encodeURIComponent(value));
  38617. if (utils.isNumber(expires)) {
  38618. cookie.push('expires=' + new Date(expires).toGMTString());
  38619. }
  38620. if (utils.isString(path)) {
  38621. cookie.push('path=' + path);
  38622. }
  38623. if (utils.isString(domain)) {
  38624. cookie.push('domain=' + domain);
  38625. }
  38626. if (secure === true) {
  38627. cookie.push('secure');
  38628. }
  38629. document.cookie = cookie.join('; ');
  38630. },
  38631. read: function read(name) {
  38632. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  38633. return (match ? decodeURIComponent(match[3]) : null);
  38634. },
  38635. remove: function remove(name) {
  38636. this.write(name, '', Date.now() - 86400000);
  38637. }
  38638. };
  38639. })() :
  38640. // Non standard browser env (web workers, react-native) lack needed support.
  38641. (function nonStandardBrowserEnv() {
  38642. return {
  38643. write: function write() {},
  38644. read: function read() { return null; },
  38645. remove: function remove() {}
  38646. };
  38647. })()
  38648. );
  38649. /***/ }),
  38650. /* 31 */
  38651. /***/ (function(module, exports, __webpack_require__) {
  38652. "use strict";
  38653. var utils = __webpack_require__(0);
  38654. function InterceptorManager() {
  38655. this.handlers = [];
  38656. }
  38657. /**
  38658. * Add a new interceptor to the stack
  38659. *
  38660. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  38661. * @param {Function} rejected The function to handle `reject` for a `Promise`
  38662. *
  38663. * @return {Number} An ID used to remove interceptor later
  38664. */
  38665. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  38666. this.handlers.push({
  38667. fulfilled: fulfilled,
  38668. rejected: rejected
  38669. });
  38670. return this.handlers.length - 1;
  38671. };
  38672. /**
  38673. * Remove an interceptor from the stack
  38674. *
  38675. * @param {Number} id The ID that was returned by `use`
  38676. */
  38677. InterceptorManager.prototype.eject = function eject(id) {
  38678. if (this.handlers[id]) {
  38679. this.handlers[id] = null;
  38680. }
  38681. };
  38682. /**
  38683. * Iterate over all the registered interceptors
  38684. *
  38685. * This method is particularly useful for skipping over any
  38686. * interceptors that may have become `null` calling `eject`.
  38687. *
  38688. * @param {Function} fn The function to call for each interceptor
  38689. */
  38690. InterceptorManager.prototype.forEach = function forEach(fn) {
  38691. utils.forEach(this.handlers, function forEachHandler(h) {
  38692. if (h !== null) {
  38693. fn(h);
  38694. }
  38695. });
  38696. };
  38697. module.exports = InterceptorManager;
  38698. /***/ }),
  38699. /* 32 */
  38700. /***/ (function(module, exports, __webpack_require__) {
  38701. "use strict";
  38702. var utils = __webpack_require__(0);
  38703. var transformData = __webpack_require__(33);
  38704. var isCancel = __webpack_require__(11);
  38705. var defaults = __webpack_require__(4);
  38706. var isAbsoluteURL = __webpack_require__(34);
  38707. var combineURLs = __webpack_require__(35);
  38708. /**
  38709. * Throws a `Cancel` if cancellation has been requested.
  38710. */
  38711. function throwIfCancellationRequested(config) {
  38712. if (config.cancelToken) {
  38713. config.cancelToken.throwIfRequested();
  38714. }
  38715. }
  38716. /**
  38717. * Dispatch a request to the server using the configured adapter.
  38718. *
  38719. * @param {object} config The config that is to be used for the request
  38720. * @returns {Promise} The Promise to be fulfilled
  38721. */
  38722. module.exports = function dispatchRequest(config) {
  38723. throwIfCancellationRequested(config);
  38724. // Support baseURL config
  38725. if (config.baseURL && !isAbsoluteURL(config.url)) {
  38726. config.url = combineURLs(config.baseURL, config.url);
  38727. }
  38728. // Ensure headers exist
  38729. config.headers = config.headers || {};
  38730. // Transform request data
  38731. config.data = transformData(
  38732. config.data,
  38733. config.headers,
  38734. config.transformRequest
  38735. );
  38736. // Flatten headers
  38737. config.headers = utils.merge(
  38738. config.headers.common || {},
  38739. config.headers[config.method] || {},
  38740. config.headers || {}
  38741. );
  38742. utils.forEach(
  38743. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  38744. function cleanHeaderConfig(method) {
  38745. delete config.headers[method];
  38746. }
  38747. );
  38748. var adapter = config.adapter || defaults.adapter;
  38749. return adapter(config).then(function onAdapterResolution(response) {
  38750. throwIfCancellationRequested(config);
  38751. // Transform response data
  38752. response.data = transformData(
  38753. response.data,
  38754. response.headers,
  38755. config.transformResponse
  38756. );
  38757. return response;
  38758. }, function onAdapterRejection(reason) {
  38759. if (!isCancel(reason)) {
  38760. throwIfCancellationRequested(config);
  38761. // Transform response data
  38762. if (reason && reason.response) {
  38763. reason.response.data = transformData(
  38764. reason.response.data,
  38765. reason.response.headers,
  38766. config.transformResponse
  38767. );
  38768. }
  38769. }
  38770. return Promise.reject(reason);
  38771. });
  38772. };
  38773. /***/ }),
  38774. /* 33 */
  38775. /***/ (function(module, exports, __webpack_require__) {
  38776. "use strict";
  38777. var utils = __webpack_require__(0);
  38778. /**
  38779. * Transform the data for a request or a response
  38780. *
  38781. * @param {Object|String} data The data to be transformed
  38782. * @param {Array} headers The headers for the request or response
  38783. * @param {Array|Function} fns A single function or Array of functions
  38784. * @returns {*} The resulting transformed data
  38785. */
  38786. module.exports = function transformData(data, headers, fns) {
  38787. /*eslint no-param-reassign:0*/
  38788. utils.forEach(fns, function transform(fn) {
  38789. data = fn(data, headers);
  38790. });
  38791. return data;
  38792. };
  38793. /***/ }),
  38794. /* 34 */
  38795. /***/ (function(module, exports, __webpack_require__) {
  38796. "use strict";
  38797. /**
  38798. * Determines whether the specified URL is absolute
  38799. *
  38800. * @param {string} url The URL to test
  38801. * @returns {boolean} True if the specified URL is absolute, otherwise false
  38802. */
  38803. module.exports = function isAbsoluteURL(url) {
  38804. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  38805. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  38806. // by any combination of letters, digits, plus, period, or hyphen.
  38807. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  38808. };
  38809. /***/ }),
  38810. /* 35 */
  38811. /***/ (function(module, exports, __webpack_require__) {
  38812. "use strict";
  38813. /**
  38814. * Creates a new URL by combining the specified URLs
  38815. *
  38816. * @param {string} baseURL The base URL
  38817. * @param {string} relativeURL The relative URL
  38818. * @returns {string} The combined URL
  38819. */
  38820. module.exports = function combineURLs(baseURL, relativeURL) {
  38821. return relativeURL
  38822. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  38823. : baseURL;
  38824. };
  38825. /***/ }),
  38826. /* 36 */
  38827. /***/ (function(module, exports, __webpack_require__) {
  38828. "use strict";
  38829. var Cancel = __webpack_require__(12);
  38830. /**
  38831. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  38832. *
  38833. * @class
  38834. * @param {Function} executor The executor function.
  38835. */
  38836. function CancelToken(executor) {
  38837. if (typeof executor !== 'function') {
  38838. throw new TypeError('executor must be a function.');
  38839. }
  38840. var resolvePromise;
  38841. this.promise = new Promise(function promiseExecutor(resolve) {
  38842. resolvePromise = resolve;
  38843. });
  38844. var token = this;
  38845. executor(function cancel(message) {
  38846. if (token.reason) {
  38847. // Cancellation has already been requested
  38848. return;
  38849. }
  38850. token.reason = new Cancel(message);
  38851. resolvePromise(token.reason);
  38852. });
  38853. }
  38854. /**
  38855. * Throws a `Cancel` if cancellation has been requested.
  38856. */
  38857. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  38858. if (this.reason) {
  38859. throw this.reason;
  38860. }
  38861. };
  38862. /**
  38863. * Returns an object that contains a new `CancelToken` and a function that, when called,
  38864. * cancels the `CancelToken`.
  38865. */
  38866. CancelToken.source = function source() {
  38867. var cancel;
  38868. var token = new CancelToken(function executor(c) {
  38869. cancel = c;
  38870. });
  38871. return {
  38872. token: token,
  38873. cancel: cancel
  38874. };
  38875. };
  38876. module.exports = CancelToken;
  38877. /***/ }),
  38878. /* 37 */
  38879. /***/ (function(module, exports, __webpack_require__) {
  38880. "use strict";
  38881. /**
  38882. * Syntactic sugar for invoking a function and expanding an array for arguments.
  38883. *
  38884. * Common use case would be to use `Function.prototype.apply`.
  38885. *
  38886. * ```js
  38887. * function f(x, y, z) {}
  38888. * var args = [1, 2, 3];
  38889. * f.apply(null, args);
  38890. * ```
  38891. *
  38892. * With `spread` this example can be re-written.
  38893. *
  38894. * ```js
  38895. * spread(function(x, y, z) {})([1, 2, 3]);
  38896. * ```
  38897. *
  38898. * @param {Function} callback
  38899. * @returns {Function}
  38900. */
  38901. module.exports = function spread(callback) {
  38902. return function wrap(arr) {
  38903. return callback.apply(null, arr);
  38904. };
  38905. };
  38906. /***/ }),
  38907. /* 38 */
  38908. /***/ (function(module, exports, __webpack_require__) {
  38909. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  38910. (typeof self !== "undefined" && self) ||
  38911. window;
  38912. var apply = Function.prototype.apply;
  38913. // DOM APIs, for completeness
  38914. exports.setTimeout = function() {
  38915. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  38916. };
  38917. exports.setInterval = function() {
  38918. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  38919. };
  38920. exports.clearTimeout =
  38921. exports.clearInterval = function(timeout) {
  38922. if (timeout) {
  38923. timeout.close();
  38924. }
  38925. };
  38926. function Timeout(id, clearFn) {
  38927. this._id = id;
  38928. this._clearFn = clearFn;
  38929. }
  38930. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  38931. Timeout.prototype.close = function() {
  38932. this._clearFn.call(scope, this._id);
  38933. };
  38934. // Does not start the time, just sets up the members needed.
  38935. exports.enroll = function(item, msecs) {
  38936. clearTimeout(item._idleTimeoutId);
  38937. item._idleTimeout = msecs;
  38938. };
  38939. exports.unenroll = function(item) {
  38940. clearTimeout(item._idleTimeoutId);
  38941. item._idleTimeout = -1;
  38942. };
  38943. exports._unrefActive = exports.active = function(item) {
  38944. clearTimeout(item._idleTimeoutId);
  38945. var msecs = item._idleTimeout;
  38946. if (msecs >= 0) {
  38947. item._idleTimeoutId = setTimeout(function onTimeout() {
  38948. if (item._onTimeout)
  38949. item._onTimeout();
  38950. }, msecs);
  38951. }
  38952. };
  38953. // setimmediate attaches itself to the global object
  38954. __webpack_require__(39);
  38955. // On some exotic environments, it's not clear which object `setimmediate` was
  38956. // able to install onto. Search each possibility in the same order as the
  38957. // `setimmediate` library.
  38958. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  38959. (typeof global !== "undefined" && global.setImmediate) ||
  38960. (this && this.setImmediate);
  38961. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  38962. (typeof global !== "undefined" && global.clearImmediate) ||
  38963. (this && this.clearImmediate);
  38964. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
  38965. /***/ }),
  38966. /* 39 */
  38967. /***/ (function(module, exports, __webpack_require__) {
  38968. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  38969. "use strict";
  38970. if (global.setImmediate) {
  38971. return;
  38972. }
  38973. var nextHandle = 1; // Spec says greater than zero
  38974. var tasksByHandle = {};
  38975. var currentlyRunningATask = false;
  38976. var doc = global.document;
  38977. var registerImmediate;
  38978. function setImmediate(callback) {
  38979. // Callback can either be a function or a string
  38980. if (typeof callback !== "function") {
  38981. callback = new Function("" + callback);
  38982. }
  38983. // Copy function arguments
  38984. var args = new Array(arguments.length - 1);
  38985. for (var i = 0; i < args.length; i++) {
  38986. args[i] = arguments[i + 1];
  38987. }
  38988. // Store and register the task
  38989. var task = { callback: callback, args: args };
  38990. tasksByHandle[nextHandle] = task;
  38991. registerImmediate(nextHandle);
  38992. return nextHandle++;
  38993. }
  38994. function clearImmediate(handle) {
  38995. delete tasksByHandle[handle];
  38996. }
  38997. function run(task) {
  38998. var callback = task.callback;
  38999. var args = task.args;
  39000. switch (args.length) {
  39001. case 0:
  39002. callback();
  39003. break;
  39004. case 1:
  39005. callback(args[0]);
  39006. break;
  39007. case 2:
  39008. callback(args[0], args[1]);
  39009. break;
  39010. case 3:
  39011. callback(args[0], args[1], args[2]);
  39012. break;
  39013. default:
  39014. callback.apply(undefined, args);
  39015. break;
  39016. }
  39017. }
  39018. function runIfPresent(handle) {
  39019. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  39020. // So if we're currently running a task, we'll need to delay this invocation.
  39021. if (currentlyRunningATask) {
  39022. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  39023. // "too much recursion" error.
  39024. setTimeout(runIfPresent, 0, handle);
  39025. } else {
  39026. var task = tasksByHandle[handle];
  39027. if (task) {
  39028. currentlyRunningATask = true;
  39029. try {
  39030. run(task);
  39031. } finally {
  39032. clearImmediate(handle);
  39033. currentlyRunningATask = false;
  39034. }
  39035. }
  39036. }
  39037. }
  39038. function installNextTickImplementation() {
  39039. registerImmediate = function(handle) {
  39040. process.nextTick(function () { runIfPresent(handle); });
  39041. };
  39042. }
  39043. function canUsePostMessage() {
  39044. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  39045. // where `global.postMessage` means something completely different and can't be used for this purpose.
  39046. if (global.postMessage && !global.importScripts) {
  39047. var postMessageIsAsynchronous = true;
  39048. var oldOnMessage = global.onmessage;
  39049. global.onmessage = function() {
  39050. postMessageIsAsynchronous = false;
  39051. };
  39052. global.postMessage("", "*");
  39053. global.onmessage = oldOnMessage;
  39054. return postMessageIsAsynchronous;
  39055. }
  39056. }
  39057. function installPostMessageImplementation() {
  39058. // Installs an event handler on `global` for the `message` event: see
  39059. // * https://developer.mozilla.org/en/DOM/window.postMessage
  39060. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  39061. var messagePrefix = "setImmediate$" + Math.random() + "$";
  39062. var onGlobalMessage = function(event) {
  39063. if (event.source === global &&
  39064. typeof event.data === "string" &&
  39065. event.data.indexOf(messagePrefix) === 0) {
  39066. runIfPresent(+event.data.slice(messagePrefix.length));
  39067. }
  39068. };
  39069. if (global.addEventListener) {
  39070. global.addEventListener("message", onGlobalMessage, false);
  39071. } else {
  39072. global.attachEvent("onmessage", onGlobalMessage);
  39073. }
  39074. registerImmediate = function(handle) {
  39075. global.postMessage(messagePrefix + handle, "*");
  39076. };
  39077. }
  39078. function installMessageChannelImplementation() {
  39079. var channel = new MessageChannel();
  39080. channel.port1.onmessage = function(event) {
  39081. var handle = event.data;
  39082. runIfPresent(handle);
  39083. };
  39084. registerImmediate = function(handle) {
  39085. channel.port2.postMessage(handle);
  39086. };
  39087. }
  39088. function installReadyStateChangeImplementation() {
  39089. var html = doc.documentElement;
  39090. registerImmediate = function(handle) {
  39091. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  39092. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  39093. var script = doc.createElement("script");
  39094. script.onreadystatechange = function () {
  39095. runIfPresent(handle);
  39096. script.onreadystatechange = null;
  39097. html.removeChild(script);
  39098. script = null;
  39099. };
  39100. html.appendChild(script);
  39101. };
  39102. }
  39103. function installSetTimeoutImplementation() {
  39104. registerImmediate = function(handle) {
  39105. setTimeout(runIfPresent, 0, handle);
  39106. };
  39107. }
  39108. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  39109. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  39110. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  39111. // Don't get fooled by e.g. browserify environments.
  39112. if ({}.toString.call(global.process) === "[object process]") {
  39113. // For Node.js before 0.9
  39114. installNextTickImplementation();
  39115. } else if (canUsePostMessage()) {
  39116. // For non-IE10 modern browsers
  39117. installPostMessageImplementation();
  39118. } else if (global.MessageChannel) {
  39119. // For web workers, where supported
  39120. installMessageChannelImplementation();
  39121. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  39122. // For IE 6–8
  39123. installReadyStateChangeImplementation();
  39124. } else {
  39125. // For older browsers
  39126. installSetTimeoutImplementation();
  39127. }
  39128. attachTo.setImmediate = setImmediate;
  39129. attachTo.clearImmediate = clearImmediate;
  39130. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  39131. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(8)))
  39132. /***/ }),
  39133. /* 40 */
  39134. /***/ (function(module, exports, __webpack_require__) {
  39135. !function(t,e){if(true)module.exports=e(__webpack_require__(5));else if("function"==typeof define&&define.amd)define(["vue"],e);else{var n="object"==typeof exports?e(require("vue")):e(t.Vue);for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(window,function(t){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=253)}([function(t,e,n){"use strict";var i=n(2),r=n.n(i),s=n(17),o=function(t){return t.changedTouches[0]||t.touches[0]};n.d(e,"c",function(){return a}),n.d(e,"a",function(){return s.a}),n.d(e,"b",function(){return o});var a=r.a.prototype.$isServer},function(t,e,n){"use strict";e.__esModule=!0;var i,r=(i=n(8))&&i.__esModule?i:{default:i};e.default=r.default||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}},function(e,n){e.exports=t},function(t,e){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){var i=n(81)("wks"),r=n(27),s=n(4).Symbol,o="function"==typeof s;(t.exports=function(t){return i[t]||(i[t]=o&&s[t]||(o?s:r)("Symbol."+t))}).store=i},function(t,e,n){"use strict";e.__esModule=!0;var i,r=(i=n(125))&&i.__esModule?i:{default:i};e.default=function(t,e,n){return e in t?(0,r.default)(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},function(t,e,n){var i=n(13);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){t.exports={default:n(110),__esModule:!0}},function(t,e,n){var i=n(4),r=n(3),s=n(23),o=n(12),a=n(14),u=function(t,e,n){var c,l,f,d=t&u.F,h=t&u.G,p=t&u.S,v=t&u.P,m=t&u.B,b=t&u.W,_=h?r:r[e]||(r[e]={}),y=_.prototype,g=h?i:p?i[e]:(i[e]||{}).prototype;for(c in h&&(n=e),n)(l=!d&&g&&void 0!==g[c])&&a(_,c)||(f=l?g[c]:n[c],_[c]=h&&"function"!=typeof g[c]?n[c]:m&&l?s(f,i):b&&g[c]==f?function(t){var e=function(e,n,i){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,i)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(f):v&&"function"==typeof f?s(Function.call,f):f,v&&((_.virtual||(_.virtual={}))[c]=f,t&u.R&&y&&!y[c]&&o(y,c,f)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,n){var i=n(7),r=n(88),s=n(77),o=Object.defineProperty;e.f=n(11)?Object.defineProperty:function(t,e,n){if(i(t),e=s(e,!0),i(n),r)try{return o(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){t.exports=!n(19)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){var i=n(10),r=n(25);t.exports=n(11)?function(t,e,n){return i.f(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var i=n(90),r=n(78);t.exports=function(t){return i(r(t))}},function(t,e){t.exports={}},function(t,e,n){"use strict";var i=function(t){t.component(this.name,this)};e.a=function(t){return t.name="wv-"+t.name,t.mixins=t.mixins||[],t.components=t.components||{},t.install=t.install||i,t.methods=t.methods||{},t}},function(t,e,n){t.exports={default:n(132),__esModule:!0}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=!0},function(t,e,n){"use strict";e.__esModule=!0;var i=o(n(150)),r=o(n(152)),s="function"==typeof r.default&&"symbol"==typeof i.default?function(t){return typeof t}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":typeof t};function o(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof r.default&&"symbol"===s(i.default)?function(t){return void 0===t?"undefined":s(t)}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":void 0===t?"undefined":s(t)}},function(t,e,n){var i=n(24);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var i=n(89),r=n(82);t.exports=Object.keys||function(t){return i(t,r)}},function(t,e){var n=0,i=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+i).toString(36))}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){n(139);for(var i=n(4),r=n(12),s=n(16),o=n(5)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<a.length;u++){var c=a[u],l=i[c],f=l&&l.prototype;f&&!f[o]&&r(f,o,c),s[c]=s.Array}},function(t,e,n){var i=n(10).f,r=n(14),s=n(5)("toStringTag");t.exports=function(t,e,n){t&&!r(t=n?t:t.prototype,s)&&i(t,s,{configurable:!0,value:e})}},function(t,e,n){"use strict";var i=n(145)(!0);n(93)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){var i=n(13),r=n(4).document,s=i(r)&&i(r.createElement);t.exports=function(t){return s?r.createElement(t):{}}},function(t,e,n){var i=n(13);t.exports=function(t,e){if(!i(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!i(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},function(t,e,n){var i=n(81)("keys"),r=n(27);t.exports=function(t){return i[t]||(i[t]=r(t))}},function(t,e,n){var i=n(3),r=n(4),s=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(t.exports=function(t,e){return s[t]||(s[t]=void 0!==e?e:{})})("versions",[]).push({version:i.version,mode:n(21)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var i=n(20),r=n(5)("toStringTag"),s="Arguments"==i(function(){return arguments}());t.exports=function(t){var e,n,o;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),r))?n:s?i(e):"Object"==(o=i(e))&&"function"==typeof e.callee?"Arguments":o}},function(t,e,n){e.f=n(5)},function(t,e,n){var i=n(4),r=n(3),s=n(21),o=n(85),a=n(10).f;t.exports=function(t){var e=r.Symbol||(r.Symbol=s?{}:i.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:o.f(t)})}},function(t,e,n){"use strict";var i=n(24);t.exports.f=function(t){return new function(t){var e,n;this.promise=new t(function(t,i){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=i}),this.resolve=i(e),this.reject=i(n)}(t)}},function(t,e,n){t.exports=!n(11)&&!n(19)(function(){return 7!=Object.defineProperty(n(76)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var i=n(14),r=n(15),s=n(113)(!1),o=n(80)("IE_PROTO");t.exports=function(t,e){var n,a=r(t),u=0,c=[];for(n in a)n!=o&&i(a,n)&&c.push(n);for(;e.length>u;)i(a,n=e[u++])&&(~s(c,n)||c.push(n));return c}},function(t,e,n){var i=n(20);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==i(t)?t.split(""):Object(t)}},function(t,e,n){var i=n(79),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e,n){var i=n(78);t.exports=function(t){return Object(i(t))}},function(t,e,n){"use strict";var i=n(21),r=n(9),s=n(94),o=n(12),a=n(16),u=n(142),c=n(30),l=n(144),f=n(5)("iterator"),d=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,p,v,m,b){u(n,e,p);var _,y,g,w=function(t){if(!d&&t in S)return S[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},x=e+" Iterator",C="values"==v,k=!1,S=t.prototype,T=S[f]||S["@@iterator"]||v&&S[v],$=T||w(v),O=v?C?w("entries"):$:void 0,E="Array"==e&&S.entries||T;if(E&&(g=l(E.call(new t)))!==Object.prototype&&g.next&&(c(g,x,!0),i||"function"==typeof g[f]||o(g,f,h)),C&&T&&"values"!==T.name&&(k=!0,$=function(){return T.call(this)}),i&&!b||!d&&!k&&S[f]||o(S,f,$),a[e]=$,a[x]=h,v)if(_={values:C?$:w("values"),keys:m?$:w("keys"),entries:O},b)for(y in _)y in S||s(S,y,_[y]);else r(r.P+r.F*(d||k),e,_);return _}},function(t,e,n){t.exports=n(12)},function(t,e,n){var i=n(7),r=n(143),s=n(82),o=n(80)("IE_PROTO"),a=function(){},u=function(){var t,e=n(76)("iframe"),i=s.length;for(e.style.display="none",n(96).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;i--;)delete u.prototype[s[i]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(a.prototype=i(t),n=new a,a.prototype=null,n[o]=t):n=u(),void 0===e?n:r(n,e)}},function(t,e,n){var i=n(4).document;t.exports=i&&i.documentElement},function(t,e,n){var i=n(84),r=n(5)("iterator"),s=n(16);t.exports=n(3).getIteratorMethod=function(t){if(void 0!=t)return t[r]||t["@@iterator"]||s[i(t)]}},function(t,e,n){var i=n(89),r=n(82).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return i(t,r)}},function(t,e){},function(t,e,n){var i=n(7),r=n(24),s=n(5)("species");t.exports=function(t,e){var n,o=i(t).constructor;return void 0===o||void 0==(n=i(o)[s])?e:r(n)}},function(t,e,n){var i,r,s,o=n(23),a=n(174),u=n(96),c=n(76),l=n(4),f=l.process,d=l.setImmediate,h=l.clearImmediate,p=l.MessageChannel,v=l.Dispatch,m=0,b={},_=function(){var t=+this;if(b.hasOwnProperty(t)){var e=b[t];delete b[t],e()}},y=function(t){_.call(t.data)};d&&h||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return b[++m]=function(){a("function"==typeof t?t:Function(t),e)},i(m),m},h=function(t){delete b[t]},"process"==n(20)(f)?i=function(t){f.nextTick(o(_,t,1))}:v&&v.now?i=function(t){v.now(o(_,t,1))}:p?(s=(r=new p).port2,r.port1.onmessage=y,i=o(s.postMessage,s,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(i=function(t){l.postMessage(t+"","*")},l.addEventListener("message",y,!1)):i="onreadystatechange"in c("script")?function(t){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),_.call(t)}}:function(t){setTimeout(o(_,t,1),0)}),t.exports={set:d,clear:h}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){var i=n(7),r=n(13),s=n(87);t.exports=function(t,e){if(i(t),r(e)&&e.constructor===t)return e;var n=s.f(t);return(0,n.resolve)(e),n.promise}},function(t,e,n){},function(t,e,n){"use strict";e.__esModule=!0;var i=s(n(137)),r=s(n(147));function s(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if(Array.isArray(t))return t;if((0,i.default)(Object(t)))return function(t,e){var n=[],i=!0,s=!1,o=void 0;try{for(var a,u=(0,r.default)(t);!(i=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){s=!0,o=t}finally{try{!i&&u.return&&u.return()}finally{if(s)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,n){t.exports={default:n(168),__esModule:!0}},function(t,e,n){
  39136. /*!
  39137. * Vue-Lazyload.js v1.2.6
  39138. * (c) 2018 Awe <hilongjw@gmail.com>
  39139. * Released under the MIT License.
  39140. */
  39141. t.exports=function(){"use strict";function t(t){t=t||{};var i=arguments.length,r=0;if(1===i)return t;for(;++r<i;){var s=arguments[r];f(t)&&(t=s),n(s)&&e(t,s)}return t}function e(e,r){for(var s in d(e,r),r)if("__proto__"!==s&&i(r,s)){var o=r[s];n(o)?("undefined"===p(e[s])&&"function"===p(o)&&(e[s]=o),e[s]=t(e[s]||{},o)):e[s]=o}return e}function n(t){return"object"===p(t)||"function"===p(t)}function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function r(t,e){if(t.length){var n=t.indexOf(e);return n>-1?t.splice(n,1):void 0}}function s(t,e){if("IMG"===t.tagName&&t.getAttribute("data-srcset")){var n=t.getAttribute("data-srcset"),i=[],r=t.parentNode.offsetWidth*e,s=void 0,o=void 0,a=void 0;(n=n.trim().split(",")).map(function(t){t=t.trim(),-1===(s=t.lastIndexOf(" "))?(o=t,a=999998):(o=t.substr(0,s),a=parseInt(t.substr(s+1,t.length-s-2),10)),i.push([a,o])}),i.sort(function(t,e){if(t[0]<e[0])return-1;if(t[0]>e[0])return 1;if(t[0]===e[0]){if(-1!==e[1].indexOf(".webp",e[1].length-5))return 1;if(-1!==t[1].indexOf(".webp",t[1].length-5))return-1}return 0});for(var u="",c=void 0,l=i.length,f=0;f<l;f++)if((c=i[f])[0]>=r){u=c[1];break}return u}}function o(t,e){for(var n=void 0,i=0,r=t.length;i<r;i++)if(e(t[i])){n=t[i];break}return n}function a(){}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),f=function(t){return null==t||"function"!=typeof t&&"object"!==(void 0===t?"undefined":u(t))},d=function(t,e){if(null===t||void 0===t)throw new TypeError("expected first argument to be an object.");if(void 0===e||"undefined"==typeof Symbol)return t;if("function"!=typeof Object.getOwnPropertySymbols)return t;for(var n=Object.prototype.propertyIsEnumerable,i=Object(t),r=arguments.length,s=0;++s<r;)for(var o=Object(arguments[s]),a=Object.getOwnPropertySymbols(o),u=0;u<a.length;u++){var c=a[u];n.call(o,c)&&(i[c]=o[c])}return i},h=Object.prototype.toString,p=function(t){var e=void 0===t?"undefined":u(t);return"undefined"===e?"undefined":null===t?"null":!0===t||!1===t||t instanceof Boolean?"boolean":"string"===e||t instanceof String?"string":"number"===e||t instanceof Number?"number":"function"===e||t instanceof Function?void 0!==t.constructor.name&&"Generator"===t.constructor.name.slice(0,9)?"generatorfunction":"function":void 0!==Array.isArray&&Array.isArray(t)?"array":t instanceof RegExp?"regexp":t instanceof Date?"date":"[object RegExp]"===(e=h.call(t))?"regexp":"[object Date]"===e?"date":"[object Arguments]"===e?"arguments":"[object Error]"===e?"error":"[object Promise]"===e?"promise":function(t){return t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}(t)?"buffer":"[object Set]"===e?"set":"[object WeakSet]"===e?"weakset":"[object Map]"===e?"map":"[object WeakMap]"===e?"weakmap":"[object Symbol]"===e?"symbol":"[object Map Iterator]"===e?"mapiterator":"[object Set Iterator]"===e?"setiterator":"[object String Iterator]"===e?"stringiterator":"[object Array Iterator]"===e?"arrayiterator":"[object Int8Array]"===e?"int8array":"[object Uint8Array]"===e?"uint8array":"[object Uint8ClampedArray]"===e?"uint8clampedarray":"[object Int16Array]"===e?"int16array":"[object Uint16Array]"===e?"uint16array":"[object Int32Array]"===e?"int32array":"[object Uint32Array]"===e?"uint32array":"[object Float32Array]"===e?"float32array":"[object Float64Array]"===e?"float64array":"object"},v=t,m="undefined"!=typeof window,b=m&&"IntersectionObserver"in window,_={event:"event",observer:"observer"},y=function(){function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}if(m)return"function"==typeof window.CustomEvent?window.CustomEvent:(t.prototype=window.Event.prototype,t)}(),g=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return m&&window.devicePixelRatio||t},w=function(){if(m){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e)}catch(t){}return t}}(),x={on:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];w?t.addEventListener(e,n,{capture:i,passive:!0}):t.addEventListener(e,n,i)},off:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t.removeEventListener(e,n,i)}},C=function(t,e,n){var i=new Image;i.src=t.src,i.onload=function(){e({naturalHeight:i.naturalHeight,naturalWidth:i.naturalWidth,src:i.src})},i.onerror=function(t){n(t)}},k=function(t,e){return"undefined"!=typeof getComputedStyle?getComputedStyle(t,null).getPropertyValue(e):t.style[e]},S=function(t){return k(t,"overflow")+k(t,"overflow-y")+k(t,"overflow-x")},T={},$=function(){function t(e){var n=e.el,i=e.src,r=e.error,s=e.loading,o=e.bindType,a=e.$parent,u=e.options,l=e.elRenderer;c(this,t),this.el=n,this.src=i,this.error=r,this.loading=s,this.bindType=o,this.attempt=0,this.naturalHeight=0,this.naturalWidth=0,this.options=u,this.rect=null,this.$parent=a,this.elRenderer=l,this.performanceData={init:Date.now(),loadStart:0,loadEnd:0},this.filter(),this.initState(),this.render("loading",!1)}return l(t,[{key:"initState",value:function(){"dataset"in this.el?this.el.dataset.src=this.src:this.el.setAttribute("data-src",this.src),this.state={error:!1,loaded:!1,rendered:!1}}},{key:"record",value:function(t){this.performanceData[t]=Date.now()}},{key:"update",value:function(t){var e=t.src,n=t.loading,i=t.error,r=this.src;this.src=e,this.loading=n,this.error=i,this.filter(),r!==this.src&&(this.attempt=0,this.initState())}},{key:"getRect",value:function(){this.rect=this.el.getBoundingClientRect()}},{key:"checkInView",value:function(){return this.getRect(),this.rect.top<window.innerHeight*this.options.preLoad&&this.rect.bottom>this.options.preLoadTop&&this.rect.left<window.innerWidth*this.options.preLoad&&this.rect.right>0}},{key:"filter",value:function(){var t=this;(function(t){if(!(t instanceof Object))return[];if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e})(this.options.filter).map(function(e){t.options.filter[e](t,t.options)})}},{key:"renderLoading",value:function(t){var e=this;C({src:this.loading},function(n){e.render("loading",!1),t()},function(){t(),e.options.silent||console.warn("VueLazyload log: load failed with loading image("+e.loading+")")})}},{key:"load",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;return this.attempt>this.options.attempt-1&&this.state.error?(this.options.silent||console.log("VueLazyload log: "+this.src+" tried too more than "+this.options.attempt+" times"),void e()):this.state.loaded||T[this.src]?(this.state.loaded=!0,e(),this.render("loaded",!0)):void this.renderLoading(function(){t.attempt++,t.record("loadStart"),C({src:t.src},function(n){t.naturalHeight=n.naturalHeight,t.naturalWidth=n.naturalWidth,t.state.loaded=!0,t.state.error=!1,t.record("loadEnd"),t.render("loaded",!1),T[t.src]=1,e()},function(e){!t.options.silent&&console.error(e),t.state.error=!0,t.state.loaded=!1,t.render("error",!1)})})}},{key:"render",value:function(t,e){this.elRenderer(this,t,e)}},{key:"performance",value:function(){var t="loading",e=0;return this.state.loaded&&(t="loaded",e=(this.performanceData.loadEnd-this.performanceData.loadStart)/1e3),this.state.error&&(t="error"),{src:this.src,state:t,time:e}}},{key:"destroy",value:function(){this.el=null,this.src=null,this.error=null,this.loading=null,this.bindType=null,this.attempt=0}}]),t}(),O="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",E=["scroll","wheel","mousewheel","resize","animationend","transitionend","touchmove"],V={rootMargin:"0px",threshold:0},I=function(t){return function(){function e(t){var n=t.preLoad,i=t.error,r=t.throttleWait,s=t.preLoadTop,o=t.dispatchEvent,a=t.loading,u=t.attempt,l=t.silent,f=void 0===l||l,d=t.scale,h=t.listenEvents,p=(t.hasbind,t.filter),v=t.adapter,b=t.observer,y=t.observerOptions;c(this,e),this.version="1.2.6",this.mode=_.event,this.ListenerQueue=[],this.TargetIndex=0,this.TargetQueue=[],this.options={silent:f,dispatchEvent:!!o,throttleWait:r||200,preLoad:n||1.3,preLoadTop:s||0,error:i||O,loading:a||O,attempt:u||3,scale:d||g(d),ListenEvents:h||E,hasbind:!1,supportWebp:function(){if(!m)return!1;var t=!0,e=document;try{var n=e.createElement("object");n.type="image/webp",n.style.visibility="hidden",n.innerHTML="!",e.body.appendChild(n),t=!n.offsetWidth,e.body.removeChild(n)}catch(e){t=!1}return t}(),filter:p||{},adapter:v||{},observer:!!b,observerOptions:y||V},this._initEvent(),this.lazyLoadHandler=function(t,e){var n=null,i=0;return function(){if(!n){var r=this,s=arguments,o=function(){i=Date.now(),n=!1,t.apply(r,s)};Date.now()-i>=e?o():n=setTimeout(o,e)}}}(this._lazyLoadHandler.bind(this),this.options.throttleWait),this.setMode(this.options.observer?_.observer:_.event)}return l(e,[{key:"config",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};v(this.options,t)}},{key:"performance",value:function(){var t=[];return this.ListenerQueue.map(function(e){t.push(e.performance())}),t}},{key:"addLazyBox",value:function(t){this.ListenerQueue.push(t),m&&(this._addListenerTarget(window),this._observer&&this._observer.observe(t.el),t.$el&&t.$el.parentNode&&this._addListenerTarget(t.$el.parentNode))}},{key:"add",value:function(e,n,i){var r=this;if(function(t,e){for(var n=!1,i=0,r=t.length;i<r;i++)if(e(t[i])){n=!0;break}return n}(this.ListenerQueue,function(t){return t.el===e}))return this.update(e,n),t.nextTick(this.lazyLoadHandler);var o=this._valueFormatter(n.value),a=o.src,u=o.loading,c=o.error;t.nextTick(function(){a=s(e,r.options.scale)||a,r._observer&&r._observer.observe(e);var o=Object.keys(n.modifiers)[0],l=void 0;o&&(l=(l=i.context.$refs[o])?l.$el||l:document.getElementById(o)),l||(l=function(t){if(m){if(!(t instanceof HTMLElement))return window;for(var e=t;e&&e!==document.body&&e!==document.documentElement&&e.parentNode;){if(/(scroll|auto)/.test(S(e)))return e;e=e.parentNode}return window}}(e));var f=new $({bindType:n.arg,$parent:l,el:e,loading:u,error:c,src:a,elRenderer:r._elRenderer.bind(r),options:r.options});r.ListenerQueue.push(f),m&&(r._addListenerTarget(window),r._addListenerTarget(l)),r.lazyLoadHandler(),t.nextTick(function(){return r.lazyLoadHandler()})})}},{key:"update",value:function(e,n){var i=this,r=this._valueFormatter(n.value),a=r.src,u=r.loading,c=r.error;a=s(e,this.options.scale)||a;var l=o(this.ListenerQueue,function(t){return t.el===e});l&&l.update({src:a,loading:u,error:c}),this._observer&&(this._observer.unobserve(e),this._observer.observe(e)),this.lazyLoadHandler(),t.nextTick(function(){return i.lazyLoadHandler()})}},{key:"remove",value:function(t){if(t){this._observer&&this._observer.unobserve(t);var e=o(this.ListenerQueue,function(e){return e.el===t});e&&(this._removeListenerTarget(e.$parent),this._removeListenerTarget(window),r(this.ListenerQueue,e)&&e.destroy())}}},{key:"removeComponent",value:function(t){t&&(r(this.ListenerQueue,t),this._observer&&this._observer.unobserve(t.el),t.$parent&&t.$el.parentNode&&this._removeListenerTarget(t.$el.parentNode),this._removeListenerTarget(window))}},{key:"setMode",value:function(t){var e=this;b||t!==_.observer||(t=_.event),this.mode=t,t===_.event?(this._observer&&(this.ListenerQueue.forEach(function(t){e._observer.unobserve(t.el)}),this._observer=null),this.TargetQueue.forEach(function(t){e._initListen(t.el,!0)})):(this.TargetQueue.forEach(function(t){e._initListen(t.el,!1)}),this._initIntersectionObserver())}},{key:"_addListenerTarget",value:function(t){if(t){var e=o(this.TargetQueue,function(e){return e.el===t});return e?e.childrenCount++:(e={el:t,id:++this.TargetIndex,childrenCount:1,listened:!0},this.mode===_.event&&this._initListen(e.el,!0),this.TargetQueue.push(e)),this.TargetIndex}}},{key:"_removeListenerTarget",value:function(t){var e=this;this.TargetQueue.forEach(function(n,i){n.el===t&&(--n.childrenCount||(e._initListen(n.el,!1),e.TargetQueue.splice(i,1),n=null))})}},{key:"_initListen",value:function(t,e){var n=this;this.options.ListenEvents.forEach(function(i){return x[e?"on":"off"](t,i,n.lazyLoadHandler)})}},{key:"_initEvent",value:function(){var t=this;this.Event={listeners:{loading:[],loaded:[],error:[]}},this.$on=function(e,n){t.Event.listeners[e]||(t.Event.listeners[e]=[]),t.Event.listeners[e].push(n)},this.$once=function(e,n){var i=t;t.$on(e,function t(){i.$off(e,t),n.apply(i,arguments)})},this.$off=function(e,n){if(n)r(t.Event.listeners[e],n);else{if(!t.Event.listeners[e])return;t.Event.listeners[e].length=0}},this.$emit=function(e,n,i){t.Event.listeners[e]&&t.Event.listeners[e].forEach(function(t){return t(n,i)})}}},{key:"_lazyLoadHandler",value:function(){var t=this,e=[];this.ListenerQueue.forEach(function(t,n){if(!t.state.error&&t.state.loaded)return e.push(t);t.checkInView()&&t.load()}),e.forEach(function(e){return r(t.ListenerQueue,e)})}},{key:"_initIntersectionObserver",value:function(){var t=this;b&&(this._observer=new IntersectionObserver(this._observerHandler.bind(this),this.options.observerOptions),this.ListenerQueue.length&&this.ListenerQueue.forEach(function(e){t._observer.observe(e.el)}))}},{key:"_observerHandler",value:function(t,e){var n=this;t.forEach(function(t){t.isIntersecting&&n.ListenerQueue.forEach(function(e){if(e.el===t.target){if(e.state.loaded)return n._observer.unobserve(e.el);e.load()}})})}},{key:"_elRenderer",value:function(t,e,n){if(t.el){var i=t.el,r=t.bindType,s=void 0;switch(e){case"loading":s=t.loading;break;case"error":s=t.error;break;default:s=t.src}if(r?i.style[r]='url("'+s+'")':i.getAttribute("src")!==s&&i.setAttribute("src",s),i.setAttribute("lazy",e),this.$emit(e,t,n),this.options.adapter[e]&&this.options.adapter[e](t,this.options),this.options.dispatchEvent){var o=new y(e,{detail:t});i.dispatchEvent(o)}}}},{key:"_valueFormatter",value:function(t){var e=t,n=this.options.loading,i=this.options.error;return function(t){return null!==t&&"object"===(void 0===t?"undefined":u(t))}(t)&&(t.src||this.options.silent||console.error("Vue Lazyload warning: miss src with "+t),e=t.src,n=t.loading||this.options.loading,i=t.error||this.options.error),{src:e,loading:n,error:i}}}]),e}()},j=function(){function t(e){var n=e.lazy;c(this,t),this.lazy=n,n.lazyContainerMananger=this,this._queue=[]}return l(t,[{key:"bind",value:function(t,e,n){var i=new M({el:t,binding:e,vnode:n,lazy:this.lazy});this._queue.push(i)}},{key:"update",value:function(t,e,n){var i=o(this._queue,function(e){return e.el===t});i&&i.update({el:t,binding:e,vnode:n})}},{key:"unbind",value:function(t,e,n){var i=o(this._queue,function(e){return e.el===t});i&&(i.clear(),r(this._queue,i))}}]),t}(),L={selector:"img"},M=function(){function t(e){var n=e.el,i=e.binding,r=e.vnode,s=e.lazy;c(this,t),this.el=null,this.vnode=r,this.binding=i,this.options={},this.lazy=s,this._queue=[],this.update({el:n,binding:i})}return l(t,[{key:"update",value:function(t){var e=this,n=t.el,i=t.binding;this.el=n,this.options=v({},L,i.value),this.getImgs().forEach(function(t){e.lazy.add(t,v({},e.binding,{value:{src:"dataset"in t?t.dataset.src:t.getAttribute("data-src"),error:"dataset"in t?t.dataset.error:t.getAttribute("data-error"),loading:"dataset"in t?t.dataset.loading:t.getAttribute("data-loading")}}),e.vnode)})}},{key:"getImgs",value:function(){return function(t){for(var e=t.length,n=[],i=0;i<e;i++)n.push(t[i]);return n}(this.el.querySelectorAll(this.options.selector))}},{key:"clear",value:function(){var t=this;this.getImgs().forEach(function(e){return t.lazy.remove(e)}),this.vnode=null,this.binding=null,this.lazy=null}}]),t}();return{install:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new(I(t))(e),i=new j({lazy:n}),r="2"===t.version.split(".")[0];t.prototype.$Lazyload=n,e.lazyComponent&&t.component("lazy-component",function(t){return{props:{tag:{type:String,default:"div"}},render:function(t){return!1===this.show?t(this.tag):t(this.tag,null,this.$slots.default)},data:function(){return{el:null,state:{loaded:!1},rect:{},show:!1}},mounted:function(){this.el=this.$el,t.addLazyBox(this),t.lazyLoadHandler()},beforeDestroy:function(){t.removeComponent(this)},methods:{getRect:function(){this.rect=this.$el.getBoundingClientRect()},checkInView:function(){return this.getRect(),m&&this.rect.top<window.innerHeight*t.options.preLoad&&this.rect.bottom>0&&this.rect.left<window.innerWidth*t.options.preLoad&&this.rect.right>0},load:function(){this.show=!0,this.state.loaded=!0,this.$emit("show",this)}}}}(n)),e.lazyImage&&t.component("lazy-image",function(t){return{props:{src:[String,Object],tag:{type:String,default:"img"}},render:function(t){return t(this.tag,{attrs:{src:this.renderSrc}},this.$slots.default)},data:function(){return{el:null,options:{src:"",error:"",loading:"",attempt:t.options.attempt},state:{loaded:!1,error:!1,attempt:0},rect:{},renderSrc:""}},watch:{src:function(){this.init(),t.addLazyBox(this),t.lazyLoadHandler()}},created:function(){this.init(),this.renderSrc=this.options.loading},mounted:function(){this.el=this.$el,t.addLazyBox(this),t.lazyLoadHandler()},beforeDestroy:function(){t.removeComponent(this)},methods:{init:function(){var e=t._valueFormatter(this.src),n=e.src,i=e.loading,r=e.error;this.state.loaded=!1,this.options.src=n,this.options.error=r,this.options.loading=i,this.renderSrc=this.options.loading},getRect:function(){this.rect=this.$el.getBoundingClientRect()},checkInView:function(){return this.getRect(),m&&this.rect.top<window.innerHeight*t.options.preLoad&&this.rect.bottom>0&&this.rect.left<window.innerWidth*t.options.preLoad&&this.rect.right>0},load:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;if(this.state.attempt>this.options.attempt-1&&this.state.error)return t.options.silent||console.log("VueLazyload log: "+this.options.src+" tried too more than "+this.options.attempt+" times"),void n();var i=this.options.src;C({src:i},function(t){var n=t.src;e.renderSrc=n,e.state.loaded=!0},function(t){e.state.attempt++,e.renderSrc=e.options.error,e.state.error=!0})}}}}(n)),r?(t.directive("lazy",{bind:n.add.bind(n),update:n.update.bind(n),componentUpdated:n.lazyLoadHandler.bind(n),unbind:n.remove.bind(n)}),t.directive("lazy-container",{bind:i.bind.bind(i),update:i.update.bind(i),unbind:i.unbind.bind(i)})):(t.directive("lazy",{bind:n.lazyLoadHandler.bind(n),update:function(t,e){v(this.vm.$refs,this.vm.$els),n.add(this.el,{modifiers:this.modifiers||{},arg:this.arg,value:t,oldValue:e},{context:this.vm})},unbind:function(){n.remove(this.el)}}),t.directive("lazy-container",{update:function(t,e){i.update(this.el,{modifiers:this.modifiers||{},arg:this.arg,value:t,oldValue:e},{context:this.vm})},unbind:function(){i.unbind(this.el)}}))}}}()},function(t,e,n){t.exports={default:n(213),__esModule:!0}},function(t,e,n){"use strict";(function(t){n.d(e,"a",function(){return a});var i=n(0),r=Date.now(),s=i.c?t:window,o=s.requestAnimationFrame||s.webkitRequestAnimationFrame||function(t){var e=Date.now(),n=Math.max(0,16-(e-r)),i=setTimeout(t,n);return r=e+n,i};function a(t){return o.call(s,t)}s.cancelAnimationFrame||s.webkitCancelAnimationFrame||s.clearTimeout}).call(this,n(243))},function(t,e,n){n(111),t.exports=n(3).Object.assign},function(t,e,n){var i=n(9);i(i.S+i.F,"Object",{assign:n(112)})},function(t,e,n){"use strict";var i=n(26),r=n(83),s=n(28),o=n(92),a=n(90),u=Object.assign;t.exports=!u||n(19)(function(){var t={},e={},n=Symbol(),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach(function(t){e[t]=t}),7!=u({},t)[n]||Object.keys(u({},e)).join("")!=i})?function(t,e){for(var n=o(t),u=arguments.length,c=1,l=r.f,f=s.f;u>c;)for(var d,h=a(arguments[c++]),p=l?i(h).concat(l(h)):i(h),v=p.length,m=0;v>m;)f.call(h,d=p[m++])&&(n[d]=h[d]);return n}:u},function(t,e,n){var i=n(15),r=n(91),s=n(114);t.exports=function(t){return function(e,n,o){var a,u=i(e),c=r(u.length),l=s(o,c);if(t&&n!=n){for(;c>l;)if((a=u[l++])!=a)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var i=n(79),r=Math.max,s=Math.min;t.exports=function(t,e){return(t=i(t))<0?r(t+e,0):s(t,e)}},function(t,e,n){},,function(t,e,n){"use strict";var i=n(32);n.n(i).a},,function(t,e,n){"use strict";var i=n(33);n.n(i).a},,function(t,e,n){"use strict";var i=n(34);n.n(i).a},,function(t,e,n){"use strict";var i=n(35);n.n(i).a},,function(t,e,n){t.exports={default:n(126),__esModule:!0}},function(t,e,n){n(127);var i=n(3).Object;t.exports=function(t,e,n){return i.defineProperty(t,e,n)}},function(t,e,n){var i=n(9);i(i.S+i.F*!n(11),"Object",{defineProperty:n(10).f})},function(t,e,n){"use strict";var i=n(36);n.n(i).a},,function(t,e,n){"use strict";var i=n(37);n.n(i).a},,function(t,e,n){var i=n(3),r=i.JSON||(i.JSON={stringify:JSON.stringify});t.exports=function(t){return r.stringify.apply(r,arguments)}},function(t,e,n){"use strict";var i=n(38);n.n(i).a},,function(t,e,n){"use strict";var i=n(39);n.n(i).a},,function(t,e,n){t.exports={default:n(138),__esModule:!0}},function(t,e,n){n(29),n(31),t.exports=n(146)},function(t,e,n){"use strict";var i=n(140),r=n(141),s=n(16),o=n(15);t.exports=n(93)(Array,"Array",function(t,e){this._t=o(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,r(1)):r(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values"),s.Arguments=s.Array,i("keys"),i("values"),i("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){"use strict";var i=n(95),r=n(25),s=n(30),o={};n(12)(o,n(5)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=i(o,{next:r(1,n)}),s(t,e+" Iterator")}},function(t,e,n){var i=n(10),r=n(7),s=n(26);t.exports=n(11)?Object.defineProperties:function(t,e){r(t);for(var n,o=s(e),a=o.length,u=0;a>u;)i.f(t,n=o[u++],e[n]);return t}},function(t,e,n){var i=n(14),r=n(92),s=n(80)("IE_PROTO"),o=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=r(t),i(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?o:null}},function(t,e,n){var i=n(79),r=n(78);t.exports=function(t){return function(e,n){var s,o,a=String(r(e)),u=i(n),c=a.length;return u<0||u>=c?t?"":void 0:(s=a.charCodeAt(u))<55296||s>56319||u+1===c||(o=a.charCodeAt(u+1))<56320||o>57343?t?a.charAt(u):s:t?a.slice(u,u+2):o-56320+(s-55296<<10)+65536}}},function(t,e,n){var i=n(84),r=n(5)("iterator"),s=n(16);t.exports=n(3).isIterable=function(t){var e=Object(t);return void 0!==e[r]||"@@iterator"in e||s.hasOwnProperty(i(e))}},function(t,e,n){t.exports={default:n(148),__esModule:!0}},function(t,e,n){n(29),n(31),t.exports=n(149)},function(t,e,n){var i=n(7),r=n(97);t.exports=n(3).getIterator=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return i(e.call(t))}},function(t,e,n){t.exports={default:n(151),__esModule:!0}},function(t,e,n){n(31),n(29),t.exports=n(85).f("iterator")},function(t,e,n){t.exports={default:n(153),__esModule:!0}},function(t,e,n){n(154),n(99),n(160),n(161),t.exports=n(3).Symbol},function(t,e,n){"use strict";var i=n(4),r=n(14),s=n(11),o=n(9),a=n(94),u=n(155).KEY,c=n(19),l=n(81),f=n(30),d=n(27),h=n(5),p=n(85),v=n(86),m=n(156),b=n(157),_=n(7),y=n(13),g=n(15),w=n(77),x=n(25),C=n(95),k=n(158),S=n(159),T=n(10),$=n(26),O=S.f,E=T.f,V=k.f,I=i.Symbol,j=i.JSON,L=j&&j.stringify,M=h("_hidden"),A=h("toPrimitive"),N={}.propertyIsEnumerable,P=l("symbol-registry"),B=l("symbols"),D=l("op-symbols"),z=Object.prototype,H="function"==typeof I,F=i.QObject,R=!F||!F.prototype||!F.prototype.findChild,W=s&&c(function(){return 7!=C(E({},"a",{get:function(){return E(this,"a",{value:7}).a}})).a})?function(t,e,n){var i=O(z,e);i&&delete z[e],E(t,e,n),i&&t!==z&&E(z,e,i)}:E,Y=function(t){var e=B[t]=C(I.prototype);return e._k=t,e},X=H&&"symbol"==typeof I.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof I},Q=function(t,e,n){return t===z&&Q(D,e,n),_(t),e=w(e,!0),_(n),r(B,e)?(n.enumerable?(r(t,M)&&t[M][e]&&(t[M][e]=!1),n=C(n,{enumerable:x(0,!1)})):(r(t,M)||E(t,M,x(1,{})),t[M][e]=!0),W(t,e,n)):E(t,e,n)},G=function(t,e){_(t);for(var n,i=m(e=g(e)),r=0,s=i.length;s>r;)Q(t,n=i[r++],e[n]);return t},q=function(t){var e=N.call(this,t=w(t,!0));return!(this===z&&r(B,t)&&!r(D,t))&&(!(e||!r(this,t)||!r(B,t)||r(this,M)&&this[M][t])||e)},K=function(t,e){if(t=g(t),e=w(e,!0),t!==z||!r(B,e)||r(D,e)){var n=O(t,e);return!n||!r(B,e)||r(t,M)&&t[M][e]||(n.enumerable=!0),n}},Z=function(t){for(var e,n=V(g(t)),i=[],s=0;n.length>s;)r(B,e=n[s++])||e==M||e==u||i.push(e);return i},J=function(t){for(var e,n=t===z,i=V(n?D:g(t)),s=[],o=0;i.length>o;)!r(B,e=i[o++])||n&&!r(z,e)||s.push(B[e]);return s};H||(a((I=function(){if(this instanceof I)throw TypeError("Symbol is not a constructor!");var t=d(arguments.length>0?arguments[0]:void 0),e=function(n){this===z&&e.call(D,n),r(this,M)&&r(this[M],t)&&(this[M][t]=!1),W(this,t,x(1,n))};return s&&R&&W(z,t,{configurable:!0,set:e}),Y(t)}).prototype,"toString",function(){return this._k}),S.f=K,T.f=Q,n(98).f=k.f=Z,n(28).f=q,n(83).f=J,s&&!n(21)&&a(z,"propertyIsEnumerable",q,!0),p.f=function(t){return Y(h(t))}),o(o.G+o.W+o.F*!H,{Symbol:I});for(var U="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;U.length>tt;)h(U[tt++]);for(var et=$(h.store),nt=0;et.length>nt;)v(et[nt++]);o(o.S+o.F*!H,"Symbol",{for:function(t){return r(P,t+="")?P[t]:P[t]=I(t)},keyFor:function(t){if(!X(t))throw TypeError(t+" is not a symbol!");for(var e in P)if(P[e]===t)return e},useSetter:function(){R=!0},useSimple:function(){R=!1}}),o(o.S+o.F*!H,"Object",{create:function(t,e){return void 0===e?C(t):G(C(t),e)},defineProperty:Q,defineProperties:G,getOwnPropertyDescriptor:K,getOwnPropertyNames:Z,getOwnPropertySymbols:J}),j&&o(o.S+o.F*(!H||c(function(){var t=I();return"[null]"!=L([t])||"{}"!=L({a:t})||"{}"!=L(Object(t))})),"JSON",{stringify:function(t){for(var e,n,i=[t],r=1;arguments.length>r;)i.push(arguments[r++]);if(n=e=i[1],(y(e)||void 0!==t)&&!X(t))return b(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!X(e))return e}),i[1]=e,L.apply(j,i)}}),I.prototype[A]||n(12)(I.prototype,A,I.prototype.valueOf),f(I,"Symbol"),f(Math,"Math",!0),f(i.JSON,"JSON",!0)},function(t,e,n){var i=n(27)("meta"),r=n(13),s=n(14),o=n(10).f,a=0,u=Object.isExtensible||function(){return!0},c=!n(19)(function(){return u(Object.preventExtensions({}))}),l=function(t){o(t,i,{value:{i:"O"+ ++a,w:{}}})},f=t.exports={KEY:i,NEED:!1,fastKey:function(t,e){if(!r(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!s(t,i)){if(!u(t))return"F";if(!e)return"E";l(t)}return t[i].i},getWeak:function(t,e){if(!s(t,i)){if(!u(t))return!0;if(!e)return!1;l(t)}return t[i].w},onFreeze:function(t){return c&&f.NEED&&u(t)&&!s(t,i)&&l(t),t}}},function(t,e,n){var i=n(26),r=n(83),s=n(28);t.exports=function(t){var e=i(t),n=r.f;if(n)for(var o,a=n(t),u=s.f,c=0;a.length>c;)u.call(t,o=a[c++])&&e.push(o);return e}},function(t,e,n){var i=n(20);t.exports=Array.isArray||function(t){return"Array"==i(t)}},function(t,e,n){var i=n(15),r=n(98).f,s={}.toString,o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return o&&"[object Window]"==s.call(t)?function(t){try{return r(t)}catch(t){return o.slice()}}(t):r(i(t))}},function(t,e,n){var i=n(28),r=n(25),s=n(15),o=n(77),a=n(14),u=n(88),c=Object.getOwnPropertyDescriptor;e.f=n(11)?c:function(t,e){if(t=s(t),e=o(e,!0),u)try{return c(t,e)}catch(t){}if(a(t,e))return r(!i.f.call(t,e),t[e])}},function(t,e,n){n(86)("asyncIterator")},function(t,e,n){n(86)("observable")},function(t,e,n){"use strict";var i=n(40);n.n(i).a},,function(t,e,n){"use strict";var i=n(41);n.n(i).a},,function(t,e,n){"use strict";var i=n(42);n.n(i).a},,function(t,e,n){n(99),n(31),n(29),n(169),n(180),n(181),t.exports=n(3).Promise},function(t,e,n){"use strict";var i,r,s,o,a=n(21),u=n(4),c=n(23),l=n(84),f=n(9),d=n(13),h=n(24),p=n(170),v=n(171),m=n(100),b=n(101).set,_=n(175)(),y=n(87),g=n(102),w=n(176),x=n(103),C=u.TypeError,k=u.process,S=k&&k.versions,T=S&&S.v8||"",$=u.Promise,O="process"==l(k),E=function(){},V=r=y.f,I=!!function(){try{var t=$.resolve(1),e=(t.constructor={})[n(5)("species")]=function(t){t(E,E)};return(O||"function"==typeof PromiseRejectionEvent)&&t.then(E)instanceof e&&0!==T.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(t){}}(),j=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},L=function(t,e){if(!t._n){t._n=!0;var n=t._c;_(function(){for(var i=t._v,r=1==t._s,s=0,o=function(e){var n,s,o,a=r?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{a?(r||(2==t._h&&N(t),t._h=1),!0===a?n=i:(l&&l.enter(),n=a(i),l&&(l.exit(),o=!0)),n===e.promise?c(C("Promise-chain cycle")):(s=j(n))?s.call(n,u,c):u(n)):c(i)}catch(t){l&&!o&&l.exit(),c(t)}};n.length>s;)o(n[s++]);t._c=[],t._n=!1,e&&!t._h&&M(t)})}},M=function(t){b.call(u,function(){var e,n,i,r=t._v,s=A(t);if(s&&(e=g(function(){O?k.emit("unhandledRejection",r,t):(n=u.onunhandledrejection)?n({promise:t,reason:r}):(i=u.console)&&i.error&&i.error("Unhandled promise rejection",r)}),t._h=O||A(t)?2:1),t._a=void 0,s&&e.e)throw e.v})},A=function(t){return 1!==t._h&&0===(t._a||t._c).length},N=function(t){b.call(u,function(){var e;O?k.emit("rejectionHandled",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})})},P=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),L(e,!0))},B=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw C("Promise can't be resolved itself");(e=j(t))?_(function(){var i={_w:n,_d:!1};try{e.call(t,c(B,i,1),c(P,i,1))}catch(t){P.call(i,t)}}):(n._v=t,n._s=1,L(n,!1))}catch(t){P.call({_w:n,_d:!1},t)}}};I||($=function(t){p(this,$,"Promise","_h"),h(t),i.call(this);try{t(c(B,this,1),c(P,this,1))}catch(t){P.call(this,t)}},(i=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(177)($.prototype,{then:function(t,e){var n=V(m(this,$));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=O?k.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&L(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),s=function(){var t=new i;this.promise=t,this.resolve=c(B,t,1),this.reject=c(P,t,1)},y.f=V=function(t){return t===$||t===o?new s(t):r(t)}),f(f.G+f.W+f.F*!I,{Promise:$}),n(30)($,"Promise"),n(178)("Promise"),o=n(3).Promise,f(f.S+f.F*!I,"Promise",{reject:function(t){var e=V(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(a||!I),"Promise",{resolve:function(t){return x(a&&this===o?$:this,t)}}),f(f.S+f.F*!(I&&n(179)(function(t){$.all(t).catch(E)})),"Promise",{all:function(t){var e=this,n=V(e),i=n.resolve,r=n.reject,s=g(function(){var n=[],s=0,o=1;v(t,!1,function(t){var a=s++,u=!1;n.push(void 0),o++,e.resolve(t).then(function(t){u||(u=!0,n[a]=t,--o||i(n))},r)}),--o||i(n)});return s.e&&r(s.v),n.promise},race:function(t){var e=this,n=V(e),i=n.reject,r=g(function(){v(t,!1,function(t){e.resolve(t).then(n.resolve,i)})});return r.e&&i(r.v),n.promise}})},function(t,e){t.exports=function(t,e,n,i){if(!(t instanceof e)||void 0!==i&&i in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e,n){var i=n(23),r=n(172),s=n(173),o=n(7),a=n(91),u=n(97),c={},l={};(e=t.exports=function(t,e,n,f,d){var h,p,v,m,b=d?function(){return t}:u(t),_=i(n,f,e?2:1),y=0;if("function"!=typeof b)throw TypeError(t+" is not iterable!");if(s(b)){for(h=a(t.length);h>y;y++)if((m=e?_(o(p=t[y])[0],p[1]):_(t[y]))===c||m===l)return m}else for(v=b.call(t);!(p=v.next()).done;)if((m=r(v,_,p.value,e))===c||m===l)return m}).BREAK=c,e.RETURN=l},function(t,e,n){var i=n(7);t.exports=function(t,e,n,r){try{return r?e(i(n)[0],n[1]):e(n)}catch(e){var s=t.return;throw void 0!==s&&i(s.call(t)),e}}},function(t,e,n){var i=n(16),r=n(5)("iterator"),s=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||s[r]===t)}},function(t,e){t.exports=function(t,e,n){var i=void 0===n;switch(e.length){case 0:return i?t():t.call(n);case 1:return i?t(e[0]):t.call(n,e[0]);case 2:return i?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){var i=n(4),r=n(101).set,s=i.MutationObserver||i.WebKitMutationObserver,o=i.process,a=i.Promise,u="process"==n(20)(o);t.exports=function(){var t,e,n,c=function(){var i,r;for(u&&(i=o.domain)&&i.exit();t;){r=t.fn,t=t.next;try{r()}catch(i){throw t?n():e=void 0,i}}e=void 0,i&&i.enter()};if(u)n=function(){o.nextTick(c)};else if(!s||i.navigator&&i.navigator.standalone)if(a&&a.resolve){var l=a.resolve(void 0);n=function(){l.then(c)}}else n=function(){r.call(i,c)};else{var f=!0,d=document.createTextNode("");new s(c).observe(d,{characterData:!0}),n=function(){d.data=f=!f}}return function(i){var r={fn:i,next:void 0};e&&(e.next=r),t||(t=r,n()),e=r}}},function(t,e,n){var i=n(4).navigator;t.exports=i&&i.userAgent||""},function(t,e,n){var i=n(12);t.exports=function(t,e,n){for(var r in e)n&&t[r]?t[r]=e[r]:i(t,r,e[r]);return t}},function(t,e,n){"use strict";var i=n(4),r=n(3),s=n(10),o=n(11),a=n(5)("species");t.exports=function(t){var e="function"==typeof r[t]?r[t]:i[t];o&&e&&!e[a]&&s.f(e,a,{configurable:!0,get:function(){return this}})}},function(t,e,n){var i=n(5)("iterator"),r=!1;try{var s=[7][i]();s.return=function(){r=!0},Array.from(s,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!r)return!1;var n=!1;try{var s=[7],o=s[i]();o.next=function(){return{done:n=!0}},s[i]=function(){return o},t(s)}catch(t){}return n}},function(t,e,n){"use strict";var i=n(9),r=n(3),s=n(4),o=n(100),a=n(103);i(i.P+i.R,"Promise",{finally:function(t){var e=o(this,r.Promise||s.Promise),n="function"==typeof t;return this.then(n?function(n){return a(e,t()).then(function(){return n})}:t,n?function(n){return a(e,t()).then(function(){throw n})}:t)}})},function(t,e,n){"use strict";var i=n(9),r=n(87),s=n(102);i(i.S,"Promise",{try:function(t){var e=r.f(this),n=s(t);return(n.e?e.reject:e.resolve)(n.v),e.promise}})},function(t,e,n){"use strict";var i=n(43);n.n(i).a},,function(t,e,n){"use strict";var i=n(44);n.n(i).a},,function(t,e,n){"use strict";var i=n(45);n.n(i).a},,function(t,e,n){"use strict";var i=n(46);n.n(i).a},,function(t,e,n){"use strict";var i=n(47);n.n(i).a},,function(t,e,n){"use strict";var i=n(48);n.n(i).a},,function(t,e,n){"use strict";var i=n(49);n.n(i).a},,function(t,e,n){"use strict";var i=n(50);n.n(i).a},,function(t,e,n){"use strict";var i=n(51);n.n(i).a},,function(t,e,n){"use strict";var i=n(52);n.n(i).a},,,function(t,e,n){"use strict";var i=n(53);n.n(i).a},,function(t,e,n){"use strict";var i=n(54);n.n(i).a},,function(t,e,n){"use strict";var i=n(55);n.n(i).a},,function(t,e,n){"use strict";var i=n(56);n.n(i).a},,function(t,e,n){"use strict";var i=n(57);n.n(i).a},,function(t,e,n){n(214),t.exports=n(3).Number.isNaN},function(t,e,n){var i=n(9);i(i.S,"Number",{isNaN:function(t){return t!=t}})},function(t,e,n){"use strict";var i=n(58);n.n(i).a},,function(t,e,n){"use strict";var i=n(59);n.n(i).a},,function(t,e,n){"use strict";var i=n(60);n.n(i).a},,function(t,e,n){"use strict";var i=n(61);n.n(i).a},,function(t,e,n){"use strict";var i=n(62);n.n(i).a},,function(t,e,n){"use strict";var i=n(63);n.n(i).a},,function(t,e,n){"use strict";var i=n(64);n.n(i).a},,function(t,e,n){"use strict";var i=n(65);n.n(i).a},,function(t,e,n){"use strict";var i=n(66);n.n(i).a},,function(t,e,n){"use strict";var i=n(67);n.n(i).a},,function(t,e,n){"use strict";var i=n(68);n.n(i).a},,function(t,e,n){"use strict";var i=n(69);n.n(i).a},,function(t,e,n){"use strict";var i=n(70);n.n(i).a},,function(t,e,n){"use strict";var i=n(71);n.n(i).a},,function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";var i=n(72);n.n(i).a},,function(t,e,n){"use strict";var i=n(73);n.n(i).a},,function(t,e,n){"use strict";var i=n(74);n.n(i).a},,function(t,e,n){"use strict";var i=n(75);n.n(i).a},,function(t,e){t.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiBmaWxsPSJncmF5Ij4NCiAgPHBhdGggb3BhY2l0eT0iLjI1IiBkPSJNMTYgMCBBMTYgMTYgMCAwIDAgMTYgMzIgQTE2IDE2IDAgMCAwIDE2IDAgTTE2IDQgQTEyIDEyIDAgMCAxIDE2IDI4IEExMiAxMiAwIDAgMSAxNiA0Ii8+DQogIDxwYXRoIGQ9Ik0xNiAwIEExNiAxNiAwIDAgMSAzMiAxNiBMMjggMTYgQTEyIDEyIDAgMCAwIDE2IDR6Ij4NCiAgICA8YW5pbWF0ZVRyYW5zZm9ybSBhdHRyaWJ1dGVOYW1lPSJ0cmFuc2Zvcm0iIHR5cGU9InJvdGF0ZSIgZnJvbT0iMCAxNiAxNiIgdG89IjM2MCAxNiAxNiIgZHVyPSIwLjhzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4NCiAgPC9wYXRoPg0KPC9zdmc+DQo="},function(t,e,n){"use strict";n.r(e);var i=n(1),r=n.n(i),s=(n(115),n(0)),o=Object(s.a)({name:"actionsheet",props:{type:{type:String,default:"ios"},title:String,actions:{type:Array,default:function(){return[]}},cancelText:{type:String,default:"Cancel"},value:Boolean},data:function(){return{currentValue:this.value}},watch:{currentValue:function(t){this.$emit("input",t)},value:function(t){this.currentValue=t}},methods:{itemClick:function(t){t.method&&"function"==typeof t.method&&t.method(),this.currentValue=!1}}});function a(t,e,n,i,r,s,o,a){var u,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),i&&(c.functional=!0),s&&(c._scopeId="data-v-"+s),o?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=u):r&&(u=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),u)if(c.functional){c._injectStyles=u;var l=c.render;c.render=function(t,e){return u.call(e),l(t,e)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,u):[u]}return{exports:t,options:c}}n(117);var u=a(o,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("transition",{attrs:{"enter-active-class":"weui-animate-fade-in","leave-active-class":"weui-animate-fade-out"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.currentValue&&"ios"===t.type,expression:"currentValue && type === 'ios'"}],staticClass:"weui-mask weui-animate-fade-in",on:{click:function(e){t.currentValue=!1}}})]),t._v(" "),n("transition",{attrs:{"enter-active-class":"weui-animate-slide-up","leave-active-class":"weui-animate-slide-down"}},["ios"===t.type?n("div",{directives:[{name:"show",rawName:"v-show",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-actionsheet weui-actionsheet_toggle"},[t.title?n("div",{staticClass:"weui-actionsheet__title"},[n("p",{staticClass:"weui-actionsheet__title-text",domProps:{innerHTML:t._s(t.title)}})]):t._e(),t._v(" "),n("div",{staticClass:"weui-actionsheet__menu"},t._l(t.actions,function(e){return n("div",{key:e.name,staticClass:"weui-actionsheet__cell",domProps:{textContent:t._s(e.name)},on:{click:function(n){t.itemClick(e)}}})})),t._v(" "),t.cancelText?n("div",{staticClass:"weui-actionsheet__action"},[n("div",{staticClass:"weui-actionsheet__cell",domProps:{innerHTML:t._s(t.cancelText)},on:{click:function(e){t.currentValue=!1}}})]):t._e()]):t._e()]),t._v(" "),n("transition",{attrs:{"enter-active-class":"weui-animate-fade-in","leave-active-class":"weui-animate-fade-out"}},["android"===t.type?n("div",{directives:[{name:"show",rawName:"v-show",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-skin_android"},[n("div",{staticClass:"weui-mask",on:{click:function(e){t.currentValue=!1}}}),t._v(" "),n("div",{staticClass:"weui-actionsheet"},[n("div",{staticClass:"weui-actionsheet__menu"},t._l(t.actions,function(e){return n("div",{key:e.name,staticClass:"weui-actionsheet__cell",domProps:{textContent:t._s(e.name)},on:{click:function(n){t.itemClick(e)}}})}))])]):t._e()])],1)},[],!1,null,"d8fc1fbc",null);u.options.__file="index.vue";var c=u.exports,l=Object(s.a)({name:"badge",props:{color:String,isDot:Boolean}}),f=(n(119),a(l,function(){var t=this.$createElement;return(this._self._c||t)("span",{staticClass:"weui-badge",class:{"weui-badge_dot":this.isDot},style:{"background-color":this.color}},[this.isDot?this._e():this._t("default")],2)},[],!1,null,"0cf54735",null));f.options.__file="index.vue";var d=f.exports,h=Object(s.a)({name:"button",props:{type:{type:String,default:"default"},isLoading:Boolean,disabled:Boolean,mini:Boolean,plain:Boolean},methods:{handleClick:function(t){this.$emit("click",t)}},computed:{classObject:function(){var t={},e=this.plain?"weui-btn_plain-"+this.type:"weui-btn_"+this.type,n=this.plain?"weui-btn_plain-disabled":"weui-btn_disabled";return t[e]=!0,t[n]=this.disabled,t["weui-btn_loading"]=this.isLoading,t["weui-btn_mini"]=this.mini,t}}}),p=(n(121),a(h,function(){var t=this.$createElement,e=this._self._c||t;return e("button",{staticClass:"weui-btn",class:this.classObject,attrs:{disabled:this.disabled},on:{click:this.handleClick}},[this.isLoading?e("i",{staticClass:"weui-loading"}):this._e(),this._v(" "),this._t("default")],2)},[],!1,null,"2e4c96b5",null));p.options.__file="index.vue";var v=p.exports,m={props:{url:String,replace:Boolean,to:[String,Object]},methods:{routerLink:function(){var t=this.to,e=this.url,n=this.$router,i=this.replace;t&&n?n[i?"replace":"push"](t):e&&(i?location.replace(e):location.href=e)}}},b=Object(s.a)({name:"cell",mixins:[m],props:{title:{type:[String,Number]},value:{type:[String,Number]},isLink:Boolean},methods:{onClick:function(){this.$emit("click"),this.routerLink()}}}),_=(n(123),a(b,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"weui-cell",class:{"weui-cell_access":t.isLink},on:{click:t.onClick}},[n("div",{staticClass:"weui-cell_hd"},[t._t("icon")],2),t._v(" "),n("div",{staticClass:"weui-cell__bd"},[t._t("bd",[n("p",{domProps:{innerHTML:t._s(t.title)}})])],2),t._v(" "),n("div",{staticClass:"weui-cell__ft"},[t._t("ft",[t._v(t._s(t.value))])],2)])},[],!1,null,"11228d86",null));_.options.__file="index.vue";var y=_.exports,g=n(6),w=n.n(g),x={bind:function(t,e){var n=function(e){t.contains(e.target)||t["@@clickoutsideContext"].callback()};t["@@clickoutsideContext"]={handler:n,callback:e.value,arg:e.arg||"click"},!s.c&&document.addEventListener(t["@@clickoutsideContext"].arg,n)},update:function(t,e){t["@@clickoutsideContext"].callback=e.value},unbind:function(t){!s.c&&document.removeEventListener(t["@@clickoutsideContext"].arg,t["@@clickoutsideContext"].handler)},install:function(t){t.directive("clickoutside",{bind:this.bind,unbind:this.unbind})}},C=Object(s.a)({name:"cell-swipe",components:w()({},y.name,y),directives:{Clickoutside:x},mixins:[m],props:{title:[String,Number],value:[String,Number],isLink:Boolean},data:function(){return{startPosX:0,rightWidth:0,offset:0,startOffset:0,deltaX:0,transition:""}},computed:{style:function(){return{transition:this.transition,transform:"translate3d("+this.offset+"px, 0px, 0px)"}}},mounted:function(){this.rightWidth=this.$refs.rightBtns.clientWidth},methods:{onTouchstart:function(t){var e=Object(s.b)(t);this.startPosX=e.clientX,this.startOffset=this.offset,this.transition=""},onTouchmove:function(t){var e=Object(s.b)(t);this.deltaX=e.clientX-this.startPosX;var n=this.startOffset+this.deltaX;this.offset=n>0?0:n<-this.rightWidth?-this.rightWidth:n},onTouchend:function(){this.transition="all 200ms ease",Math.abs(this.deltaX)<20?this.offset=this.startOffset:this.startOffset<0&&this.deltaX>0?this.offset=0:0===this.startOffset&&this.deltaX<0&&(this.offset=-this.rightWidth)},onClickoutside:function(){this.offset=0}}}),k=(n(128),a(C,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside:touchstart",value:t.onClickoutside,expression:"onClickoutside",arg:"touchstart"}],staticClass:"weui-cell weui-cell_swiped"},[n("div",{ref:"cellBd",staticClass:"weui-cell__bd",style:t.style,on:{touchstart:t.onTouchstart,touchmove:t.onTouchmove,touchend:t.onTouchend,touchcancel:t.onTouchend}},[n("wv-cell",{ref:"cell",attrs:{title:t.title,value:t.value,"is-link":t.isLink,to:t.to,url:t.url}},[n("template",{slot:"icon"},[t._t("icon")],2),t._v(" "),t.title?t._e():n("template",{slot:"bd"},[t._t("bd")],2),t._v(" "),void 0===t.value?n("template",{slot:"ft"},[t._t("ft")],2):t._e()],2)],1),t._v(" "),n("div",{ref:"rightBtns",staticClass:"weui-cell__ft"},[t._t("right")],2)])},[],!1,null,"0bfb2fc6",null));k.options.__file="index.vue";var S=k.exports,T=Object(s.a)({name:"cell-swipe-button",props:{type:{type:String,default:"default"}}}),$=(n(130),a(T,function(){var t=this.$createElement;return(this._self._c||t)("div",{class:"weui-swiped-btn weui-swiped-btn_"+this.type},[this._t("default")],2)},[],!1,null,"b16770f6",null));$.options.__file="index.vue";var O=$.exports,E=n(18),V=n.n(E),I=Object(s.a)({name:"checklist",props:{max:{type:Number,validator:function(t){return t>=0}},title:String,align:{type:String,default:"left",validator:function(t){return"left"===t||"right"===t}},options:{type:Array,required:!0},value:{type:Array,default:function(){return[]}}},computed:{currentValue:{get:function(){return this.value},set:function(t){this.max&&t.length>this.max&&(t=t.slice(0,this.max)),this.$emit("input",t)}}},created:function(){this.currentValue=this.value},watch:{value:function(t,e){V()(t)!==V()(e)&&this.$emit("change",t)}}}),j=(n(133),a(I,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t.title?n("div",{staticClass:"weui-cells__title",domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),n("div",{staticClass:"weui-cells weui-cells_checkbox"},t._l(t.options,function(e){return n("label",{key:e.label||e,staticClass:"weui-cell weui-check__label",class:{"weui-check__label-disabled":e.disabled}},["left"===t.align?n("div",{staticClass:"weui-cell__hd"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-check",attrs:{type:"checkbox",disabled:e.disabled},domProps:{value:e.value||e,checked:Array.isArray(t.currentValue)?t._i(t.currentValue,e.value||e)>-1:t.currentValue},on:{change:function(n){var i=t.currentValue,r=n.target,s=!!r.checked;if(Array.isArray(i)){var o=e.value||e,a=t._i(i,o);r.checked?a<0&&(t.currentValue=i.concat([o])):a>-1&&(t.currentValue=i.slice(0,a).concat(i.slice(a+1)))}else t.currentValue=s}}}),t._v(" "),n("i",{staticClass:"weui-icon-checked"})]):t._e(),t._v(" "),n("div",{staticClass:"weui-cell__bd"},[n("p",{domProps:{textContent:t._s(e.label||e)}})]),t._v(" "),"right"===t.align?n("div",{staticClass:"weui-cell__hd"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-check",attrs:{type:"checkbox",disabled:e.disabled},domProps:{value:e.value||e,checked:Array.isArray(t.currentValue)?t._i(t.currentValue,e.value||e)>-1:t.currentValue},on:{change:function(n){var i=t.currentValue,r=n.target,s=!!r.checked;if(Array.isArray(i)){var o=e.value||e,a=t._i(i,o);r.checked?a<0&&(t.currentValue=i.concat([o])):a>-1&&(t.currentValue=i.slice(0,a).concat(i.slice(a+1)))}else t.currentValue=s}}}),t._v(" "),n("i",{staticClass:"weui-icon-checked"})]):t._e()])}))])},[],!1,null,"09c6ec0a",null));j.options.__file="index.vue";var L=j.exports,M=Object(s.a)({name:"circle",props:{diameter:{type:Number,default:100},lineWidth:{type:Number,default:4},strokeColor:{type:String,default:"#3FC7FA"},trailColor:{type:String,default:"#D9D9D9"},fillColor:{type:String,default:"transparent"},speed:{type:Number,default:500},value:{type:Number,default:0}},data:function(){return{currentValue:this.value}},computed:{style:function(){return{width:this.diameter+"px",height:this.diameter+"px"}},pathRadius:function(){return(this.diameter-this.lineWidth)/2},radius:function(){return this.diameter/2},pathString:function(){return"M "+this.radius+","+this.radius+" m 0,-"+this.pathRadius+"\n a "+this.pathRadius+","+this.pathRadius+" 0 1 1 0,"+2*this.pathRadius+"\n a "+this.pathRadius+","+this.pathRadius+" 0 1 1 0,-"+2*this.pathRadius},len:function(){return 2*Math.PI*this.pathRadius},pathStyle:function(){return{"stroke-dasharray":this.len+"px "+this.len+"px","stroke-dashoffset":(100-this.currentValue)/100*this.len+"px",transition:"stroke-dashoffset "+this.speed+"ms ease 0s, stroke "+this.speed+"ms ease"}}},watch:{currentValue:function(t){this.$emit("input",t)},value:function(t){this.currentValue=t}}}),A=(n(135),a(M,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"wv-circle",style:t.style},[n("svg",{attrs:{width:t.diameter,height:t.diameter,viewBox:"0 0 "+t.diameter+" "+t.diameter}},[n("path",{attrs:{d:t.pathString,stroke:t.trailColor,"stroke-width":t.lineWidth,fill:"none"}}),t._v(" "),n("path",{style:t.pathStyle,attrs:{d:t.pathString,"stroke-linecap":"round",stroke:t.strokeColor,"stroke-width":t.lineWidth,fill:t.fillColor}}),t._v(" "),n("text",{staticClass:"wv-circle-content",attrs:{"text-anchor":"middle","dominant-baseline":"middle",x:"50%",y:"50%"}},[t._t("default")],2)])])},[],!1,null,"68030b2a",null));A.options.__file="index.vue";var N=A.exports,P=n(105),B=n.n(P),D=n(22),z=n.n(D),H=function(t,e,n){return Math.min(Math.max(t,e),n)},F=Object(s.a)({name:"picker-column",props:{options:{type:Array,default:function(){return[]}},value:{},valueKey:String,visibleItemCount:{type:Number,default:7,validator:function(t){return[3,5,7].indexOf(t)>-1}},defaultIndex:{type:Number,default:0},divider:{type:Boolean,default:!1},content:{type:String,default:""}},data:function(){return{startY:0,startOffset:0,offset:0,prevY:0,prevTime:null,velocity:0,transition:"",currentIndex:this.defaultIndex}},computed:{minTranslateY:function(){return 34*(Math.ceil(this.visibleItemCount/2)-this.options.length)},maxTranslateY:function(){return 34*Math.floor(this.visibleItemCount/2)},wrapperStyle:function(){return{transition:this.transition,transform:"translate3d(0, "+this.offset+"px, 0)"}},pickerIndicatorStyle:function(){return{top:34*Math.floor(this.visibleItemCount/2)+"px"}},pickerMaskStyle:function(){return{backgroundSize:"100% "+34*Math.floor(this.visibleItemCount/2)+"px"}},count:function(){return this.options.length},currentValue:function(){return this.options[this.currentIndex]}},created:function(){this.$parent&&this.$parent.children.push(this)},mounted:function(){this.setIndex(this.currentIndex)},destroyed:function(){this.$parent&&this.$parent.children.splice(this.$parent.children.indexOf(this),1)},methods:{getOptionText:function(t){return"object"===(void 0===t?"undefined":z()(t))?t[this.valueKey]:t},isDisabled:function(t){return"object"===(void 0===t?"undefined":z()(t))&&t.disabled},indexToOffset:function(t){return-34*(t-Math.floor(this.visibleItemCount/2))},offsetToIndex:function(t){return-((t=34*Math.round(t/34))-34*Math.floor(this.visibleItemCount/2))/34},onTouchstart:function(t){this.startOffset=this.offset,this.startY=t.touches[0].clientY,this.prevY=t.touches[0].clientY,this.prevTime=new Date,this.transition=""},onTouchmove:function(t){var e=+new Date,n=t.touches[0].clientY,i=n-this.startY;this.offset=this.startOffset+i,this.velocity=(t.touches[0].clientY-this.prevY)/(e-this.prevTime),this.prevY=n,this.prevTime=e},onTouchend:function(){this.transition="all 150ms ease";var t=this.offset+150*this.velocity,e=this.offsetToIndex(t);this.setIndex(e,!0)},onClick:function(t){var e=this.$refs.indicator;this.transition="all 150ms ease";var n=e.getBoundingClientRect(),i=34*Math.floor((t.clientY-n.top)/34),r=this.offset-i;this.offset=H(r,this.minTranslateY,this.maxTranslateY);var s=this.offsetToIndex(this.offset);this.setIndex(s,!0)},adjustIndex:function(t){for(var e=t=H(t,0,this.count);e<this.count;e++)if(!this.isDisabled(this.options[e]))return e;for(var n=t-1;n>=0;n--)if(!this.isDisabled(this.options[n]))return n},setIndex:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t=this.adjustIndex(t),this.offset=this.indexToOffset(t),t!==this.currentIndex&&(this.currentIndex=t,e&&this.$emit("change",t))},setValue:function(t){var e=this,n=this.options.findIndex(function(n){return e.getOptionText(n)===t});n>-1&&this.setIndex(n)}},watch:{defaultIndex:function(t){this.setIndex(t)},options:function(t,e){V()(t)!==V()(e)&&this.setIndex(0)}}}),R=(n(162),a(F,function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.divider?n("div",{staticClass:"wv-picker-column-divider",domProps:{innerHTML:t._s(t.content)}}):n("div",{staticClass:"weui-picker__group",on:{touchstart:t.onTouchstart,touchmove:function(e){return e.preventDefault(),t.onTouchmove(e)},touchend:t.onTouchend,touchcancel:t.onTouchend,click:t.onClick}},[n("div",{staticClass:"weui-picker__mask",style:t.pickerMaskStyle}),t._v(" "),n("div",{ref:"indicator",staticClass:"weui-picker__indicator",style:t.pickerIndicatorStyle}),t._v(" "),n("div",{staticClass:"weui-picker__content",style:t.wrapperStyle},t._l(t.options,function(e,i){return n("div",{key:i,staticClass:"weui-picker__item",class:{"weui-picker__item_disabled":t.isDisabled(e)},domProps:{textContent:t._s(t.getOptionText(e))}})}))])},[],!1,null,"0bca5b1f",null));R.options.__file="picker-column.vue";var W=R.exports,Y=Object(s.a)({name:"picker",components:{PickerColumn:W},props:{visible:Boolean,confirmText:{type:String,default:"确定"},cancelText:{type:String,default:"取消"},columns:{type:Array,default:function(){return[]}},valueKey:String,visibleItemCount:{type:Number,default:7,validator:function(t){return[3,5,7].indexOf(t)>-1}},value:{type:Array,default:function(){return[]}}},data:function(){return{children:[],currentColumns:[],currentValue:this.value}},computed:{columnCount:function(){return this.columns.filter(function(t){return!t.divider}).length},pickerBodyStyle:function(){return{height:34*this.visibleItemCount+"px"}}},created:function(){this.initialize()},methods:{initialize:function(){this.currentColumns=this.columns},columnValueChange:function(t){this.currentValue=this.getValues(),this.$emit("change",this,this.getValues(),t)},getColumn:function(t){return this.children.find(function(e,n){return"wv-picker-column"===e.$options.name&&!e.divider&&n===t})},getColumnValue:function(t){return(this.getColumn(t)||{}).currentValue},setColumnValue:function(t,e){var n=this.getColumn(t);n&&n.setValue(e)},getColumnValues:function(t){return(this.currentColumns[t]||{}).values},setColumnValues:function(t,e){var n=this.currentColumns[t];n&&(n.values=e)},getValues:function(){return this.children.map(function(t){return t.currentValue})},setValues:function(t){var e=this;if(this.columnCount!==t.length)throw new Error("Length values is not equal to columns count.");t.forEach(function(t,n){e.setColumnValue(n,t)})},getColumnIndex:function(t){return(this.getColumn(t)||{}).currentIndex},setColumnIndex:function(t,e){var n=this.getColumn(t);n&&n.setIndex(e)},getIndexes:function(){return this.children.map(function(t){return t.currentIndex})},setIndexes:function(t){var e=this;t.forEach(function(t,n){e.setColumnIndex(n,t)})},onCancel:function(){this.$emit("cancel",this),this.$emit("update:visible",!1)},onConfirm:function(){this.$emit("confirm",this),this.$emit("update:visible",!1)}},watch:{value:function(t){this.setValues(t),this.currentValue=t},currentValue:function(t){this.$emit("input",t)}}}),X=(n(164),a(Y,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("transition",{attrs:{"enter-active-class":"weui-animate-fade-in","leave-active-class":"weui-animate-fade-out"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"weui-mask"})]),t._v(" "),n("transition",{attrs:{"enter-active-class":"weui-animate-slide-up","leave-active-class":"weui-animate-slide-down"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"weui-picker"},[n("div",{staticClass:"weui-picker__hd"},[n("div",{staticClass:"weui-picker__action",domProps:{textContent:t._s(t.cancelText)},on:{click:t.onCancel}}),t._v(" "),n("div",{staticClass:"weui-picker__action",domProps:{textContent:t._s(t.confirmText)},on:{click:t.onConfirm}})]),t._v(" "),n("div",{staticClass:"weui-picker__bd",style:t.pickerBodyStyle},t._l(t.columns,function(e,i){return n("picker-column",{key:i,attrs:{options:e.values||[],"value-key":t.valueKey,divider:e.divider,content:e.content,"default-index":e.defaultIndex,"visible-item-count":t.visibleItemCount},on:{change:function(e){t.columnValueChange(i)}}})}))])])],1)},[],!1,null,"5c745e2d",null));X.options.__file="index.vue";var Q=X.exports,G=function(t){return"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(t.getTime())},q=Object(s.a)({name:"datetime-picker",components:{WvPicker:Q},props:{visible:Boolean,confirmText:{type:String,default:"确定"},cancelText:{type:String,default:"取消"},type:{type:String,default:"datetime"},startDate:{type:Date,default:function(){return new Date((new Date).getFullYear()-10,0,1)},validator:G},endDate:{type:Date,default:function(){return new Date((new Date).getFullYear()+10,11,31)},validator:G},startHour:{type:Number,default:0},endHour:{type:Number,default:23},yearFormat:{type:String,default:"{value}"},monthFormat:{type:String,default:"{value}"},dateFormat:{type:String,default:"{value}"},hourFormat:{type:String,default:"{value}"},minuteFormat:{type:String,default:"{value}"},visibleItemCount:{type:Number,default:7},value:{}},data:function(){return{currentVisible:this.visible,currentValue:this.correctValue(this.value)}},computed:{ranges:function(){if("time"===this.type)return{hour:[this.startHour,this.endHour],minute:[0,59]};var t=this.getBoundary("start",this.currentValue),e=t.startYear,n=t.startMonth,i=t.startDate,r=t.startHour,s=t.startMinute,o=this.getBoundary("end",this.currentValue),a=o.endYear,u=o.endMonth,c=o.endDate,l=o.endHour,f=o.endMinute;return"datetime"===this.type?{year:[e,a],month:[n,u],date:[i,c],hour:[r,l],minute:[s,f]}:{year:[e,a],month:[n,u],date:[i,c]}},pickerColumns:function(){var t=[];for(var e in this.ranges)t.push({values:this.fillColumnValues(e,this.ranges[e][0],this.ranges[e][1])});return t}},methods:{open:function(){this.currentVisible=!0},close:function(){this.currentVisible=!1},isLeapYear:function(t){return t%400==0||t%100!=0&&t%4==0},isShortMonth:function(t){return[4,6,9,11].indexOf(t)>-1},getMonthEndDay:function(t,e){return this.isShortMonth(e)?30:2===e?this.isLeapYear(t)?29:28:31},getTrueValue:function(t){if(t){for(;isNaN(parseInt(t,10));)t=t.slice(1);return parseInt(t,10)}},correctValue:function(t){var e=this.type.indexOf("date")>-1;if(e&&!G(t))t=this.startDate;else if(!t){var n=this.startHour;t=(n>10?n:"0"+n)+":00"}if(!e){var i=t.split(":"),r=B()(i,2),s=r[0],o=r[1],a=Math.max(s,this.startHour);return(a=Math.min(a,this.endHour))+":"+o}var u=this.getBoundary("end",t),c=u.endYear,l=u.endDate,f=u.endMonth,d=u.endHour,h=u.endMinute,p=this.getBoundary("start",t),v=p.startYear,m=p.startDate,b=p.startMonth,_=p.startHour,y=p.startMinute,g=new Date(v,b-1,m,_,y),w=new Date(c,f-1,l,d,h);return t=Math.max(t,g),t=Math.min(t,w),new Date(t)},onChange:function(t){var e=t.getValues(),n=void 0;if("time"===this.type)n=e.join(":");else{var i=this.getTrueValue(e[0]),r=this.getTrueValue(e[1]),s=this.getTrueValue(e[2]),o=this.getMonthEndDay(i,r);s=s>o?o:s;var a=0,u=0;"datetime"===this.type&&(a=this.getTrueValue(e[3]),u=this.getTrueValue(e[4])),n=new Date(i,r-1,s,a,u)}n=this.correctValue(n),this.currentValue=n,this.$emit("change",t),this.$emit("input",n)},fillColumnValues:function(t,e,n){for(var i=[],r=e;r<=n;r++)r<10?i.push(this[t+"Format"].replace("{value}",("0"+r).slice(-2))):i.push(this[t+"Format"].replace("{value}",r));return i},getBoundary:function(t,e){var n,i=this[t+"Date"],r=i.getFullYear(),s=1,o=1,a=0,u=0;return"end"===t&&(s=12,o=this.getMonthEndDay(e.getFullYear(),e.getMonth()+1),a=23,u=59),e.getFullYear()===r&&(s=i.getMonth()+1,e.getMonth()+1===s&&(o=i.getDate(),e.getDate()===o&&(a=i.getHours(),e.getHours()===a&&(u=i.getMinutes())))),n={},w()(n,t+"Year",r),w()(n,t+"Month",s),w()(n,t+"Date",o),w()(n,t+"Hour",a),w()(n,t+"Minute",u),n},updateColumnValue:function(t){var e=this,n=[];if("time"===this.type){var i=t.split(":");n=[this.hourFormat.replace("{value}",("0"+i[0]).slice(-2)),this.minuteFormat.replace("{value}",("0"+i[1]).slice(-2))]}else n=[this.yearFormat.replace("{value}",""+t.getFullYear()),this.monthFormat.replace("{value}",("0"+(t.getMonth()+1)).slice(-2)),this.dateFormat.replace("{value}",("0"+t.getDate()).slice(-2))],"datetime"===this.type&&n.push(this.hourFormat.replace("{value}",("0"+t.getHours()).slice(-2)),this.minuteFormat.replace("{value}",("0"+t.getMinutes()).slice(-2)));this.$nextTick(function(){e.setColumnByValues(n)})},setColumnByValues:function(t){this.$refs.picker.setValues(t)},onConfirm:function(){this.visible=!1,this.$emit("confirm",this.currentValue)},onCancel:function(){this.visible=!1,this.$emit("cancel")}},mounted:function(){this.value?this.currentValue=this.value:this.currentValue=this.type.indexOf("date")>-1?this.startDate:("0"+this.startHour).slice(-2)+":00",this.updateColumnValue(this.currentValue)},watch:{value:function(t){t=this.correctValue(t),("time"===this.type?t===this.currentValue:t.valueOf()===this.currentValue.valueOf())||(this.currentValue=t)},currentValue:function(t){this.updateColumnValue(t),this.$emit("input",t)}}}),K=(n(166),a(q,function(){var t=this,e=t.$createElement;return(t._self._c||e)("wv-picker",{ref:"picker",attrs:{visible:t.currentVisible,columns:t.pickerColumns,"confirm-text":t.confirmText,"cancel-text":t.cancelText,"visible-item-count":t.visibleItemCount},on:{"update:visible":function(e){t.currentVisible=e},change:t.onChange,confirm:t.onConfirm,cancel:t.onCancel}})},[],!1,null,"238bb984",null));K.options.__file="index.vue";var Z=K.exports,J=n(8),U=n.n(J),tt=n(106),et=n.n(tt),nt=n(2),it=n.n(nt),rt=a({name:"modal",props:{visible:Boolean,zIndex:Number,className:String,customStyle:Object},computed:{style:function(){return r()({zIndex:this.zIndex},this.customStyle)}}},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"wv-fade"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"wv-modal",class:t.className,style:t.style,on:{touchmove:function(t){t.preventDefault(),t.stopPropagation()},click:function(e){t.$emit("click",e)}}})])},[],!1,null,null,null);rt.options.__file="Modal.vue";var st=rt.exports,ot={idSeed:1,zIndex:2e3,stack:[],plusKey:function(t){return this[t]++},get top(){return this.stack[this.stack.length-1]}},at={className:"",customStyle:{}},ut={open:function(t,e){if(!ot.stack.some(function(e){return e.vm._popupId===t.popupId})){var n=t.$el,i=n&&n.parentNode&&11!==n.parentNode.nodeType?n.parentNode:document.body;ot.stack.push({vm:t,config:e,targetNode:i}),this.update()}},close:function(t){var e=ot.stack;e.length&&(ot.top.vm._popupId===t?(e.pop(),this.update()):ot.stack=e.filter(function(e){return e.vm._popupId!==t}))},update:function(){var t=ot.modal;if(t||((t=new(it.a.extend(st))({el:document.createElement("div")})).$on("click",this.onClick),ot.modal=t),t.$el.parentNode&&(t.visible=!1),ot.top){var e=ot.top,n=e.targetNode,i=e.config;n.appendChild(t.$el),U()(t,r()({},at,i,{visible:!0}))}},onClick:function(){if(ot.top){var t=ot.top.vm;t.$emit("click-mask"),t.closeOnClickMask&&t.close()}}},ct={debounce:function(t,e,n){var i=void 0,r=void 0,s=void 0,o=void 0,a=void 0;return function(){return s=this,r=arguments,o=new Date,i||(i=setTimeout(function n(){var u=new Date-o;u<e?i=setTimeout(n,e-u):(i=null,a=t.apply(s,r))},e)),a}},getScrollEventTarget:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window,n=t;n&&"HTML"!==n.tagName&&"BODY"!==n.tagName&&1===n.nodeType&&n!==e;){var i=this.getComputedStyle(n).overflowY;if("scroll"===i||"auto"===i)return n;n=n.parentNode}return e},isAttached:function(t){for(var e=t.parentNode;e;){if("HTML"===e.tagName)return!0;if(11===e.nodeType)return!1;e=e.parentNode}return!1},getScrollTop:function(t){return"scrollTop"in t?t.scrollTop:t.pageYOffset},setScrollTop:function(t,e){"scrollTop"in t?t.scrollTop=e:t.scrollTo(t.scrollX,e)},getElementTop:function(t){return(t===window?0:t.getBoundingClientRect().top)+this.getScrollTop(window)},getVisibleHeight:function(t){return t===window?t.innerHeight:t.getBoundingClientRect().height},getComputedStyle:!s.c&&document.defaultView.getComputedStyle.bind(document.defaultView)},lt=!1;if(!s.c)try{var ft={};Object.defineProperty(ft,"passive",{get:function(){lt=!0}}),window.addEventListener("test-passive",null,ft)}catch(t){}function dt(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];!s.c&&t.addEventListener(e,n,!!lt&&{capture:!1,passive:i})}function ht(t,e,n){!s.c&&t.removeEventListener(e,n)}var pt={props:{visible:Boolean,mask:Boolean,maskStyle:Object,maskClass:String,closeOnClickMask:Boolean,zIndex:[String,Number],getContainer:Function,lockOnScroll:{type:Boolean,default:!0}},watch:{visible:function(t){this[t?"open":"close"]()},getContainer:function(){this.move()},mask:function(){this.renderMask()}},created:function(){this._popupId="popup-"+ot.plusKey("idSeed"),this.pos={x:0,y:0}},mounted:function(){this.getContainer&&this.move(),this.visible&&this.open()},methods:{move:function(){this.getContainer?this.getContainer().appendChild(this.$el):this.$parent&&this.$parent.$el.appendChild(this.$el)},onTouchstart:function(t){this.pos={x:t.touches[0].clientX,y:t.touches[0].clientY}},onTouchmove:function(t){var e=this.pos,n=t.touches[0].clientX-e.x,i=t.touches[0].clientY-e.y,r=i>0?"10":"01",s=ct.getScrollEventTarget(t.target,this.$el),o=s.scrollHeight,a=s.offsetHeight,u=s.scrollTop,c=Math.abs(n)<Math.abs(i),l="11";0===u?l=a>=o?"00":"01":u+a>=o&&(l="10"),"11"===l||!c||parseInt(l,2)&parseInt(r,2)||(t.preventDefault(),t.stopPropagation())},open:function(){this.$isServer||(void 0!==this.zIndex&&(ot.zIndex=this.zIndex),this.lockOnScroll&&(document.body.classList.add("wv-overflow-hidden"),dt(document,"touchstart",this.onTouchstart),dt(document,"touchmove",this.onTouchmove)),this.renderMask(),this.$emit("update:visible",!0))},close:function(){this.lockOnScroll&&(document.body.classList.remove("wv-overflow-hidden"),ht(document,"touchstart",this.onTouchstart),ht(document,"touchmove",this.onTouchmove)),ut.close(this._popupId),this.$emit("update:visible",!1)},renderMask:function(){this.mask?ut.open(this,{zIndex:ot.plusKey("zIndex"),className:this.maskClass,customStyle:this.maskStyle}):ut.close(this._popupId),this.$el.style.zIndex=ot.plusKey("zIndex")}},beforeDestroy:function(){this.close()}},vt=Object(s.a)({name:"dialog",mixins:[pt],props:{skin:{type:String,default:"ios"},title:String,message:String,confirmButtonText:{type:String,default:"确定"},cancelButtonText:{type:String,default:"取消"},showConfirmButton:{type:Boolean,default:!0},showCancelButton:{type:Boolean,default:!0},callback:Function},methods:{handleAction:function(t){this.visible=!1,this.$emit(t),this.callback&&this.callback(t)}}}),mt=(n(182),a(vt,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition-group",{attrs:{"enter-active-class":"weui-animate-fade-in","leave-active-class":"weui-animate-fade-out"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],key:"mask",staticClass:"weui-mask"}),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],key:"dialog",staticClass:"weui-dialog",class:{"weui-skin_android":"android"===t.skin}},[t.title?n("div",{staticClass:"weui-dialog__hd"},[n("strong",{staticClass:"weui-dialog__title",domProps:{innerHTML:t._s(t.title)}})]):t._e(),t._v(" "),n("div",{staticClass:"weui-dialog__bd",domProps:{innerHTML:t._s(t.message)}}),t._v(" "),n("div",{staticClass:"weui-dialog__ft"},[t.showCancelButton?n("div",{staticClass:"weui-dialog__btn weui-dialog__btn_default",domProps:{textContent:t._s(t.cancelButtonText)},on:{click:function(e){t.handleAction("cancel")}}}):t._e(),t._v(" "),t.showConfirmButton?n("div",{staticClass:"weui-dialog__btn weui-dialog__btn_primary",domProps:{textContent:t._s(t.confirmButtonText)},on:{click:function(e){t.handleAction("confirm")}}}):t._e()])])])},[],!1,null,"7bbce0b6",null));mt.options.__file="dialog.vue";var bt=mt.exports,_t=void 0,yt={visible:!0,title:"提示",message:"",type:"",modalFade:!1,lockScroll:!1,closeOnClickModal:!0,showConfirmButton:!0,showCancelButton:!1,confirmButtonText:"确定",cancelButtonText:"取消",callback:function(t){_t["confirm"===t?"resolve":"reject"](t)}},gt=function(t){return new et.a(function(e,n){var i;_t||(i=it.a.extend(bt),_t=new i({el:document.createElement("div")}),document.body.appendChild(_t.$el)),U()(_t,r()({resolve:e,reject:n},yt,t))})};gt.alert=function(t){return gt(r()({},yt,t))},gt.confirm=function(t){return gt(r()({},yt,{showCancelButton:!0},t))},gt.close=function(){_t.visible=!1},it.a.prototype.$dialog=gt;var wt=gt,xt=Object(s.a)({name:"flex",props:{gutter:{type:[Number,String],default:0,validator:function(t){return Number(t)>=0}}},computed:{style:function(){var t="-"+Number(this.gutter)/2+"px";return this.gutter?{marginLeft:t,marginRight:t}:{}}}}),Ct=(n(184),a(xt,function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"weui-flex",style:this.style},[this._t("default")],2)},[],!1,null,"4dbea254",null));Ct.options.__file="index.vue";var kt=Ct.exports,St=Object(s.a)({name:"flex-item",props:{flex:{type:[Number,String],default:1},offset:{type:String,default:""}},computed:{gutter:function(){return this.$parent&&Number(this.$parent.gutter)||0},style:function(){var t=Number(this.gutter)/2+"px",e=this.gutter?{paddingLeft:t,paddingRight:t}:{};return r()({},e,{flex:Number(this.flex),marginLeft:this.offset})}}}),Tt=(n(186),a(St,function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"weui-flex__item",style:this.style},[this._t("default")],2)},[],!1,null,"33e54a14",null));Tt.options.__file="index.vue";var $t=Tt.exports,Ot=a(Object(s.a)({name:"footer-link",mixins:[m],props:{text:String},methods:{onClick:function(){this.$emit("click"),this.routerLink()}}}),function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"weui-footer__link",domProps:{textContent:this._s(this.text)},on:{click:this.onClick}})},[],!1,null,null,null);Ot.options.__file="footer-link.vue";var Et=Ot.exports,Vt=Object(s.a)({name:"footer",components:{FooterLink:Et},props:{text:String,links:{type:Array,default:function(){return[]}}}}),It=(n(188),a(Vt,function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"weui-footer"},[this.links.length>0?e("p",{staticClass:"weui-footer__links"},this._l(this.links,function(t){return e("FooterLink",{key:t.text,attrs:{text:t.text,to:t.link}})})):this._e(),this._v(" "),e("p",{staticClass:"weui-footer__text",domProps:{innerHTML:this._s(this.text)}})])},[],!1,null,"cdd51218",null));It.options.__file="index.vue";var jt=It.exports,Lt=Object(s.a)({name:"form-preview",props:{title:String,value:String,dataItems:{type:Array,default:function(){return[]}},buttons:{type:Array,default:function(){return[]}}}}),Mt=(n(190),a(Lt,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"weui-form-preview"},[n("div",{staticClass:"weui-form-preview__hd"},[n("label",{staticClass:"weui-form-preview__label",domProps:{innerHTML:t._s(t.title)}}),t._v(" "),n("em",{staticClass:"weui-form-preview__value",domProps:{innerHTML:t._s(t.value)}})]),t._v(" "),n("div",{staticClass:"weui-form-preview__bd"},t._l(t.dataItems,function(e,i,r){return n("div",{key:i,staticClass:"weui-form-preview__item"},[n("label",{staticClass:"weui-form-preview__label"},[t._v(t._s(e.label))]),t._v(" "),n("span",{staticClass:"weui-form-preview__value"},[t._v(t._s(e.value))])])})),t._v(" "),n("div",{staticClass:"weui-form-preview__ft"},t._l(t.buttons,function(e,i){return n("div",{key:i,staticClass:"weui-form-preview__btn",class:"primary"===e.type?"weui-form-preview__btn_primary":"weui-form-preview__btn_default",domProps:{textContent:t._s(e.text)},on:{click:e.action}})}))])},[],!1,null,"cf72f6ae",null));Mt.options.__file="index.vue";var At=Mt.exports,Nt=Object(s.a)({name:"grid"}),Pt=(n(192),a(Nt,function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"weui-grids"},[this._t("default")],2)},[],!1,null,"49b17865",null));Pt.options.__file="index.vue";var Bt=Pt.exports,Dt=Object(s.a)({name:"grid-item",mixins:[m],methods:{onClick:function(){this.$emit("click"),this.routerLink()}}}),zt=(n(194),a(Dt,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"weui-grid",on:{click:t.onClick}},[t.$slots.icon?n("div",{staticClass:"weui-grid__icon"},[t._t("icon")],2):t._e(),t._v(" "),t.$slots.label?n("p",{staticClass:"weui-grid__label"},[t._t("label")],2):t._e(),t._v(" "),t._t("default")],2)},[],!1,null,"349a74e9",null));zt.options.__file="index.vue";var Ht=zt.exports,Ft=Object(s.a)({name:"group",props:{title:String,titleColor:String}}),Rt=(n(196),a(Ft,function(){var t=this.$createElement,e=this._self._c||t;return e("div",[this.title?e("div",{staticClass:"weui-cells__title",style:{color:this.titleColor},domProps:{innerHTML:this._s(this.title)}}):this._e(),this._v(" "),e("div",{staticClass:"weui-cells"},[this._t("default")],2)])},[],!1,null,"54e9624a",null));Rt.options.__file="index.vue";var Wt=Rt.exports,Yt=Object(s.a)({name:"header",props:{title:String,fixed:{type:Boolean,default:!0},backgroundColor:{type:String,default:"#21292c"}}}),Xt=(n(198),a(Yt,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("header",{staticClass:"wv-header",class:{"is-fixed":t.fixed},style:{"background-color":t.backgroundColor},on:{click:function(e){e.stopPropagation(),t.$emit("headerClick")}}},[n("div",{staticClass:"wv-header-btn left"},[t._t("left")],2),t._v(" "),n("div",{staticClass:"wv-header-title",domProps:{textContent:t._s(t.title)}}),t._v(" "),n("div",{staticClass:"wv-header-btn right"},[t._t("right")],2)])},[],!1,null,"4dfc0ef2",null));Xt.options.__file="index.vue";var Qt=Xt.exports,Gt=Object(s.a)({name:"icon",props:{type:{type:String,required:!0},large:Boolean},computed:{classObject:function(){var t,e="weui-icon-"+this.type;return t={},w()(t,e,!0),w()(t,"weui-icon_msg",this.large),t}}}),qt=(n(200),a(Gt,function(){var t=this.$createElement;return(this._self._c||t)("i",{class:this.classObject})},[],!1,null,"5c55cccb",null));qt.options.__file="index.vue";var Kt=qt.exports,Zt=(n(104),"@@InfiniteScroll"),Jt=300;function Ut(t){t[Zt].vm.$nextTick(function(){ct.isAttached(t)&&function(){var t=this;if(!this.el[Zt].binded){this.el[Zt].binded=!0,this.scrollEventListener=ct.debounce(function(){var t=this.scrollEventTarget,e=this.el;if(!this.disabled){var n=ct.getScrollTop(t)+ct.getVisibleHeight(t),i=ct.getVisibleHeight(t);if(i){(t===e?t.scrollHeight-n<this.distance:ct.getElementTop(e)-ct.getElementTop(t)+ct.getVisibleHeight(e)-i<this.distance)&&this.expression&&this.expression()}}}.bind(this),200),this.scrollEventTarget=ct.getScrollEventTarget(this.el);var e=this.el.getAttribute("infinite-scroll-disabled"),n=!1;e&&(this.vm.$watch(e,function(e){t.disabled=e,t.scrollEventListener()}),n=Boolean(this.vm[e])),this.disabled=n;var i=this.el.getAttribute("infinite-scroll-distance");this.distance=Number(i)||Jt,dt(this.scrollEventTarget,"scroll",this.scrollEventListener,!0);var r=this.el.getAttribute("infinite-scroll-immediate-check");(!r||Boolean(this.vm[r]))&&this.scrollEventListener()}}.call(t[Zt])})}var te={bind:function(t,e,n){t[Zt]||(t[Zt]={el:t,vm:n.context,expression:e.value}),t[Zt].expression=e.value,function(t){var e=t[Zt];e.vm._isMounted?Ut(t):e.vm.$on("hook:mounted",function(){Ut(t)})}(t)},update:function(t){var e=t[Zt];e.scrollEventListener&&e.scrollEventListener()},unbind:function(t){var e=t[Zt];e.scrollEventTarget&&ht(e.scrollEventTarget,"scroll",e.scrollEventListener)}},ee=function(t){t.directive("InfiniteScroll",te)};!it.a.prototype.$isServer&&window.Vue&&(window.infiniteScroll=te,it.a.use(ee)),te.install=ee;var ne=te,ie=Object(s.a)({components:w()({},Kt.name,Kt),name:"input",props:{type:{type:String,default:"text"},label:String,labelWidth:{type:Number,default:105},placeholder:String,value:String,name:String,autoComplete:{type:String,default:"off"},maxlength:Number,minlength:Number,autofocus:Boolean,readonly:Boolean,disabled:Boolean,required:{type:Boolean,default:!1},pattern:String,validateMode:{type:Object,default:function(){return{onFocus:!0,onBlur:!0,onChange:!0,onInput:!0}}}},data:function(){return{active:!1,valid:!0,currentValue:this.value}},methods:{handleInput:function(t){this.maxlength&&t.target.value.length>=this.maxlength?(this.currentValue="",this.currentValue=t.target.value.substr(0,this.maxlength)):this.currentValue=t.target.value,void 0!==this.validateMode&&!1===this.validateMode.onInput||this.validate()},focus:function(){this.$refs.input.focus()},onFocus:function(){this.active=!0,this.$emit("focus"),void 0!==this.validateMode&&!1===this.validateMode.onFocus||this.validate()},onBlur:function(){this.active=!1,this.$emit("blur"),void 0!==this.validateMode&&!1===this.validateMode.onBlur||this.validate()},onChange:function(){this.$emit("change",this.currentValue),void 0!==this.validateMode&&!1===this.validateMode.onChange||this.validate()},validate:function(){!this.pattern||new RegExp(this.pattern).test(this.currentValue)?this.required&&""===this.currentValue?this.valid=!1:this.minlength&&this.currentValue.length<this.minlength?this.valid=!1:this.valid=!0:this.valid=!1}},watch:{currentValue:function(t){this.$emit("input",t)},value:function(t){this.currentValue=t}}}),re=(n(203),a(ie,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"weui-cell",class:{"weui-cell_warn":!t.valid}},[n("div",{staticClass:"weui-cell__hd"},[t.label?n("label",{staticClass:"weui-label",style:{width:t.labelWidth+"px"},domProps:{innerHTML:t._s(t.label)}}):t._e()]),t._v(" "),n("div",{staticClass:"weui-cell__bd"},[n("input",{ref:"input",staticClass:"weui-input",attrs:{type:t.type,"auto-complete":t.autoComplete,autofocus:t.autofocus,placeholder:t.placeholder,readonly:t.readonly,number:"number"===t.type,maxlength:t.maxlength,minlength:t.minlength},domProps:{value:t.currentValue},on:{focus:t.onFocus,blur:t.onBlur,change:t.onChange,input:t.handleInput}})]),t._v(" "),n("div",{staticClass:"weui-cell__ft"},[t.valid?t._e():n("wv-icon",{attrs:{type:"warn"}}),t._v(" "),t._t("ft")],2)])},[],!1,null,"55da79da",null));re.options.__file="index.vue";var se=re.exports,oe=n(107),ae=n.n(oe).a,ue=Object(s.a)({name:"loadmore",props:{type:{type:String,default:"default"},text:{type:String,default:"正在加载"}}}),ce=(n(205),a(ue,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"weui-loadmore",class:{"weui-loadmore_line":"line"===t.type||"lineDot"===t.type,"weui-loadmore_dot":"lineDot"===t.type}},["default"===t.type?n("i",{staticClass:"weui-loading"}):t._e(),t._v(" "),n("span",{staticClass:"weui-loadmore__tips",domProps:{textContent:t._s("lineDot"===t.type?"":t.text)}})])},[],!1,null,"0ee7c172",null));ce.options.__file="index.vue";var le=ce.exports,fe=Object(s.a)({name:"media-box",mixins:[m],props:{type:{type:String,default:"appmsg"},thumb:String,title:String,description:String},methods:{onClick:function(){this.$emit("click"),this.routerLink()}}}),de=(n(207),a(fe,function(){var t=this,e=t.$createElement,n=t._self._c||e;return"appmsg"===t.type?n("div",{staticClass:"weui-media-box",class:"weui-media-box_"+t.type,on:{click:t.onClick}},["text"!==t.type?n("div",{staticClass:"weui-media-box__hd"},[n("img",{staticClass:"weui-media-box__thumb",attrs:{src:t.thumb,alt:""}})]):t._e(),t._v(" "),n("div",{staticClass:"weui-media-box__bd"},[n("h4",{staticClass:"weui-media-box__title",domProps:{textContent:t._s(t.title)}}),t._v(" "),n("p",{staticClass:"weui-media-box__desc",domProps:{textContent:t._s(t.description)}})])]):n("div",{staticClass:"weui-media-box",class:"weui-media-box_"+t.type,on:{click:t.onClick}},[n("h4",{staticClass:"weui-media-box__title",domProps:{textContent:t._s(t.title)}}),t._v(" "),n("p",{staticClass:"weui-media-box__desc",domProps:{textContent:t._s(t.description)}}),t._v(" "),t._t("box_ft")],2)},[],!1,null,"5aa6c407",null));de.options.__file="index.vue";var he=de.exports,pe=Object(s.a)({name:"navbar",props:{fixed:Boolean,color:{type:String,default:"#333"},backgroundColor:{type:String,default:"#fff"},activeColor:{type:String,default:"#2196f3"},disabledColor:{type:String,default:"#cfcfcf"},lineWidth:{type:Number,default:2},animate:{type:Boolean,default:!0},value:{}},data:function(){return{childrenCount:0,currentIndex:0}},computed:{style:function(){var t={position:this.fixed?"fixed":"absolute",backgroundColor:this.backgroundColor};return this.fixed&&(t.top=0,t.left=0,t.right=0),t},lineStyle:function(){var t=1/this.childrenCount*100;return{backgroundColor:this.activeColor,left:t*this.currentIndex+"%",width:t+"%",height:this.lineWidth+"px"}}},mounted:function(){var t=this;this.$nextTick(function(){t.childrenCount=t.$children.length,t.updateCurrentIndex()})},methods:{updateCurrentIndex:function(){var t=this;this.$children.forEach(function(e,n){e.id===t.value&&(t.currentIndex=n)})}},watch:{value:function(t){this.$emit("change",t),this.updateCurrentIndex()}}}),ve=(n(209),a(pe,function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"wv-navbar",style:this.style},[this._t("default"),this._v(" "),this.animate?e("div",{staticClass:"wv-navbar-underline",style:this.lineStyle}):this._e()],2)},[],!1,null,"09bd1f5e",null));ve.options.__file="index.vue";var me=ve.exports,be=Object(s.a)({name:"navbar-item",props:{id:String,disabled:Boolean},computed:{isSelected:function(){return this.id===this.$parent.value},style:function(){return{borderWidth:this.$parent.lineWidth+"px",borderColor:this.$parent.activeColor,color:this.isSelected?this.$parent.activeColor:this.$parent.color}}},methods:{onClick:function(){this.disabled||this.$parent.$emit("input",this.id)}}}),_e=(n(211),a(be,function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"wv-navbar__item",class:{"wv-navbar__item_on":!this.$parent.animate&&this.$parent.value===this.id,disabled:this.disabled},style:this.style,on:{click:this.onClick}},[this._t("default")],2)},[],!1,null,"46704e66",null));_e.options.__file="index.vue";var ye=_e.exports,ge=n(108),we=n.n(ge).a||window.isNaN,xe=Object(s.a)({name:"number-spinner",props:{min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},inputWidth:{type:String,default:"3em"},readonly:Boolean,disabled:Boolean,align:{type:String,default:"center"},fillable:{type:Boolean,default:!0},value:{type:Number,default:0}},data:function(){return{currentValue:this.value}},inheritAttrs:!1,model:{event:"change"},computed:{increasable:function(){var t=this.currentValue;return we(t)||t<this.max},decreasable:function(){var t=this.currentValue;return we(t)||t>this.min},inputStyle:function(){return{width:this.inputWidth,textAlign:this.align}},listeners:function(){var t=r()({},this.$listeners);return delete t.change,t}},created:function(){this.min<this.max&&(this.currentValue=Math.min(this.max,Math.max(this.min,this.value)))},methods:{decrease:function(){if(this.decreasable){var t=this.currentValue;we(t)&&(t=0),this.setValue(Math.min(this.max,Math.max(this.min,t-this.step)))}},increase:function(){if(this.increasable){var t=this.currentValue;we(t)&&(t=0),this.setValue(Math.min(this.max,Math.max(this.min,t+this.step)))}},onChange:function(t){this.setValue(Math.min(this.max,Math.max(this.min,t.target.value)))},onPaste:function(t){this.fillable&&/^-?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?$/.test(t.clipboardData.getData("text"))||t.preventDefault()},onKeypress:function(t){this.fillable||t.preventDefault()},setValue:function(t){var e=this.currentValue;this.currentValue=t,this.$emit("change",t,e),this.$refs.input.value=t}},watch:{currentValue:function(t){this.$emit("input",t),this.$emit("change",t)},value:function(t){"number"==typeof t?t<=this.min?this.currentValue=this.min:t>=this.max?this.currentValue=this.max:this.currentValue=t:""===t&&(this.currentValue="")}}}),Ce=(n(215),a(xe,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",t._g({staticClass:"wv-number-spinner"},t.listeners),[n("button",{staticClass:"spinner-btn btn-minus",attrs:{disabled:t.disabled||t.readonly||!t.decreasable},on:{click:t.decrease}}),t._v(" "),n("input",t._b({ref:"input",style:t.inputStyle,attrs:{type:"number",min:t.min,max:t.max,step:t.step,disabled:t.disabled||!t.decreasable&&!t.increasable,readonly:t.readonly},domProps:{value:t.currentValue},on:{change:t.onChange,paste:t.onPaste,keypress:t.onKeypress}},"input",t.$attrs,!1)),t._v(" "),n("button",{staticClass:"spinner-btn btn-plus",attrs:{disabled:t.disabled||t.readonly||!t.increasable},on:{click:t.increase}})])},[],!1,null,"188fd71e",null));Ce.options.__file="index.vue";var ke=Ce.exports,Se=Object(s.a)({name:"panel",props:{title:String}}),Te=(n(217),a(Se,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"weui-panel weui-panel_access"},[t.title?n("div",{staticClass:"weui-panel__hd",domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),n("div",{staticClass:"weui-panel__bd"},[t._t("default")],2),t._v(" "),n("div",{staticClass:"weui-panel__ft"},[t._t("ft")],2)])},[],!1,null,"4bd2a58c",null));Te.options.__file="index.vue";var $e=Te.exports,Oe=Object(s.a)({name:"popup",mixins:[pt],props:{height:{type:[String,Number],default:"auto",validator:function(t){return/^(auto)|(\d+(px|vh|%)?)$/.test(t)}},mask:{default:!0},lockOnScroll:{default:!0},closeOnClickMask:{default:!0},maskClass:{default:"weui-mask"}},computed:{style:function(){var t={};return/^\d+$/.test(this.height)?t.height=parseInt(this.height)+"px":t.height=this.height,t}},mounted:function(){this.visible&&this.open()}}),Ee=(n(219),a(Oe,function(){var t=this.$createElement,e=this._self._c||t;return e("transition",{attrs:{"enter-active-class":"weui-animate-slide-up","leave-active-class":"weui-animate-slide-down"}},[e("div",{directives:[{name:"show",rawName:"v-show",value:this.visible,expression:"visible"}],staticClass:"wv-popup",style:this.style},[this._t("default")],2)])},[],!1,null,"f3183a8e",null));Ee.options.__file="index.vue";var Ve=Ee.exports,Ie=Object(s.a)({name:"progress",props:{percent:{type:[Number,String]},showClear:{type:Boolean,default:!0}},methods:{onCancelClick:function(t){t.preventDefault(),this.$emit("cancel",this)}}}),je=(n(221),a(Ie,function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"weui-progress"},[e("div",{staticClass:"weui-progress__bar"},[e("div",{staticClass:"weui-progress__inner-bar js_progress",style:{width:this.percent+"%"}})]),this._v(" "),this.showClear?e("span",{staticClass:"weui-progress__opr"},[e("i",{staticClass:"weui-icon-cancel",on:{click:this.onCancelClick}})]):this._e()])},[],!1,null,"94e8f1f0",null));je.options.__file="index.vue";var Le=je.exports,Me=Object(s.a)({name:"radio",props:{title:String,align:{type:String,default:"left"},options:{type:Array,required:!0},value:{}},data:function(){return{currentValue:this.value}},watch:{currentValue:function(t){this.$emit("input",t),this.$emit("change",t)},value:function(t){this.currentValue=t}}}),Ae=(n(223),a(Me,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t.title?n("div",{staticClass:"weui-cells__title",domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),n("div",{staticClass:"weui-cells weui-cells_radio"},t._l(t.options,function(e){return n("label",{key:e.label||e,staticClass:"weui-cell weui-check__label",class:{"weui-check__label-disabled":e.disabled}},[n("div",{staticClass:"weui-cell__bd"},[n("p",{domProps:{textContent:t._s(e.label||e)}})]),t._v(" "),n("div",{staticClass:"weui-cell__ft"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-check",attrs:{type:"radio",disabled:e.disabled},domProps:{value:e.value||e,checked:t._q(t.currentValue,e.value||e)},on:{change:function(n){t.currentValue=e.value||e}}}),t._v(" "),n("span",{staticClass:"weui-icon-checked"})])])}))])},[],!1,null,"8f0f9528",null));Ae.options.__file="index.vue";var Ne=Ae.exports,Pe=Object(s.a)({name:"search-bar",components:{WvCell:y},props:{value:String,autofocus:Boolean,show:Boolean,placeholder:{type:String,default:"搜索"},cancelText:{type:String,default:"取消"},resultTextKey:String,result:Array},data:function(){return{isActive:!1,currentValue:this.value}},mounted:function(){this.autofocus&&(this.isActive=!0)},methods:{textClick:function(){this.$refs.input.focus(),this.isActive=!0},clear:function(){this.currentValue=""},cancel:function(){this.$emit("cancel"),this.clear(),this.isActive=!1}},watch:{currentValue:function(t){this.$emit("input",t)},value:function(t){this.currentValue=t}}}),Be=(n(225),a(Pe,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"weui-search-bar"},[n("div",{staticClass:"weui-search-bar__form"},[n("div",{staticClass:"weui-search-bar__box"},[n("i",{staticClass:"weui-icon-search"}),t._v(" "),n("form",{attrs:{action:"javascript:"},on:{submit:function(e){t.$emit("search",t.currentValue)}}},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-search-bar__input",attrs:{type:"search",placeholder:t.placeholder,autofocus:t.autofocus},domProps:{value:t.currentValue},on:{input:function(e){e.target.composing||(t.currentValue=e.target.value)}}})]),t._v(" "),n("div",{staticClass:"weui-icon-clear",on:{click:t.clear}})]),t._v(" "),n("label",{directives:[{name:"show",rawName:"v-show",value:!t.isActive,expression:"!isActive"}],staticClass:"weui-search-bar__label",on:{click:t.textClick}},[n("i",{staticClass:"weui-icon-search"}),t._v(" "),n("span",{domProps:{textContent:t._s(t.placeholder)}})])]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.isActive,expression:"isActive"}],staticClass:"weui-search-bar__cancel-btn",domProps:{textContent:t._s(t.cancelText)},on:{click:t.cancel}})]),t._v(" "),t._t("default",[n("div",{directives:[{name:"show",rawName:"v-show",value:t.show||t.currentValue,expression:"show || currentValue"}],staticClass:"weui-cells searchbar-result"},t._l(t.result,function(e,i){return n("wv-cell",{key:i,attrs:{title:"object"==typeof e?e[t.resultTextKey]:e},on:{click:function(n){t.$emit("click-result",e)}}})}))])],2)},[],!1,null,"1c40d218",null));Be.options.__file="index.vue";var De=Be.exports,ze=Object(s.a)({name:"slider",props:{min:{type:Number,default:0,validator:function(t){return t>=0}},max:{type:Number,default:100},step:{type:Number,default:1,validator:function(t){return t>0}},value:{type:Number},showValue:{type:Boolean,default:!0},enableClick:{type:Boolean,default:!0},disabled:Boolean},data:function(){return{handlerStartPos:0,sliderLeft:0,sliderLength:0}},computed:{percent:function(){return void 0===this.value||null===this.value?0:Math.floor((this.value-this.min)/(this.max-this.min)*100)},stepWidth:function(){return this.sliderLength*this.step/(this.max-this.min)}},created:function(){if(this.min>=this.max)throw new Error("property:max must be bigger than property:min")},mounted:function(){this.sliderLeft=this.$refs.inner.offsetLeft,this.sliderLength=this.$refs.inner.getBoundingClientRect().width},methods:{getHandlerStartPos:function(){var t=this.$refs.inner.getBoundingClientRect();return this.$refs.handler.getBoundingClientRect().left-t.left},onClick:function(t){if(!this.disabled&&this.enableClick){var e=Math.round((t.clientX-this.sliderLeft)/this.stepWidth),n=this.min+this.step*e;this.$emit("input",n),this.$emit("change",n)}},onTouchstart:function(){this.disabled||(this.handlerStartPos=this.getHandlerStartPos())},onTouchmove:function(t){if(!this.disabled){var e=Object(s.b)(t),n=Math.round((e.clientX-this.sliderLeft)/this.stepWidth),i=this.min+this.step*n;i=i<this.min?this.min:i>this.max?this.max:i,this.$emit("input",i),this.$emit("change",i)}}}}),He=(n(227),a(ze,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"weui-slider-box"},[n("div",{staticClass:"weui-slider",class:{"wv-slider--disabled":t.disabled}},[n("div",{ref:"inner",staticClass:"weui-slider__inner",on:{click:function(e){return e.preventDefault(),t.onClick(e)}}},[n("div",{staticClass:"weui-slider__track",style:{width:t.percent+"%"}}),t._v(" "),n("div",{ref:"handler",staticClass:"weui-slider__handler",style:{left:t.percent+"%"},on:{touchstart:t.onTouchstart,touchmove:t.onTouchmove}})])]),t._v(" "),t.showValue?n("div",{staticClass:"weui-slider-box__value"},[t._t("value-box",[t._v(t._s(t.value))])],2):t._e()])},[],!1,null,"6fb72636",null));He.options.__file="index.vue";var Fe=He.exports,Re=Object(s.a)({name:"spinner",props:{type:{type:String,default:"default"},size:{type:Number,default:17},color:{type:String,default:"#aaa"}},computed:{fontClassName:function(){switch(this.type){case"snake":return"icon-spinner-1";case"double-snake":return"icon-spinner9";case"bar-circle":return"icon-spinner2";case"dot-circle":return"icon-spinner1";default:return""}},style:function(){return{fontSize:this.size+"px",color:this.color}}}}),We=(n(229),a(Re,function(){var t=this.$createElement,e=this._self._c||t;return"default"===this.type?e("i",{staticClass:"weui-loading",style:this.style}):e("span",{staticClass:"wv-spinner"},[e("i",{staticClass:"iconfont",class:this.fontClassName,style:this.style})])},[],!1,null,"785ed733",null));We.options.__file="index.vue";var Ye=We.exports,Xe=Object(s.a)({name:"swipe",props:{height:Number,autoplay:Number,defaultIndex:{type:Number,default:0},showIndicators:{type:Boolean,default:!0},duration:{type:Number,default:500},prevent:Boolean,noDragWhenSingle:{type:Boolean,default:!0}},data:function(){return{width:0,offset:0,startX:0,startY:0,active:0,deltaX:0,swipes:[],direction:"",currentDuration:0}},mounted:function(){this.initialize()},destroyed:function(){clearTimeout(this.timer)},watch:{swipes:function(){this.initialize()},defaultIndex:function(){this.initialize()}},computed:{count:function(){return this.swipes.length},wrapperStyle:function(){var t={paddingLeft:this.count>1?this.width+"px":0,width:this.count>1?(this.count+2)*this.width+"px":"100%",transitionDuration:this.currentDuration+"ms",transform:"translate3d("+this.offset+"px, 0, 0)"};return this.height&&(t.height=this.height+"px"),t},activeIndicator:function(){return(this.active+this.count)%this.count}},methods:{initialize:function(){clearTimeout(this.timer),this.width=this.$el.getBoundingClientRect().width,this.active=this.defaultIndex,this.currentDuration=0,this.offset=this.count>1?-this.width*(this.active+1):0,this.swipes.forEach(function(t){t.offset=0}),this.autoPlay()},onTouchstart:function(t){if(1!==this.count||!this.noDragWhenSingle){clearTimeout(this.timer);var e=Object(s.b)(t);this.deltaX=0,this.direction="",this.currentDuration=0,this.startX=e.clientX,this.startY=e.clientY,this.active<=-1&&this.move(this.count),this.active>=this.count&&this.move(-this.count)}},onTouchmove:function(t){this.prevent&&t.preventDefault();var e=Object(s.b)(t);this.deltaX=e.clientX-this.startX;var n=e.clientY-this.startY;if(1===this.count){if(this.noDragWhenSingle)return;this.offset=this.range(this.deltaX,[-20,20])}else this.count>1&&Math.abs(this.deltaX)>Math.abs(n)&&this.move(0,this.range(this.deltaX,[-this.width,this.width]))},onTouchend:function(){if(1===this.count){if(this.noDragWhenSingle)return;this.offset=0,this.currentDuration=this.duration}else this.deltaX&&(this.move(Math.abs(this.deltaX)>50?this.deltaX>0?-1:1:0),this.currentDuration=this.duration),this.autoPlay()},move:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.active,i=this.count,r=this.swipes,s=this.deltaX,o=this.width;t?(-1===n&&(r[i-1].offset=0),r[0].offset=n===i-1&&t>0?i*o:0,this.active+=t):0===n?r[i-1].offset=s>0?-i*o:0:n===i-1&&(r[0].offset=s<0?i*o:0),this.offset=e-(this.active+1)*this.width},autoPlay:function(){var t=this,e=this.autoplay;e&&this.count>1&&(clearTimeout(this.timer),this.timer=setTimeout(function(){t.currentDuration=0,t.active>=t.count&&t.move(-t.count),setTimeout(function(){t.currentDuration=t.duration,t.move(1),t.autoPlay()},30)},e))},range:function(t,e){return Math.min(Math.max(t,e[0]),e[1])}}}),Qe=(n(231),a(Xe,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"wv-swipe",on:{touchstart:t.onTouchstart,touchmove:t.onTouchmove,touchend:t.onTouchend,touchcancel:t.onTouchend}},[n("div",{staticClass:"wv-swipe__wrapper",style:t.wrapperStyle,on:{transitionend:function(e){t.$emit("change",t.activeIndicator)}}},[t._t("default")],2),t._v(" "),t.showIndicators&&t.count>1?n("div",{staticClass:"wv-swipe__indicators"},t._l(t.count,function(e){return n("i",{key:e,class:{"wv-swipe__indicator--active":e-1===t.activeIndicator}})})):t._e()])},[],!1,null,"088711cb",null));Qe.options.__file="index.vue";var Ge=Qe.exports,qe=Object(s.a)({name:"swipe-item",data:function(){return{offset:0}},computed:{style:function(){return{width:this.$parent.width+"px",transform:"translate3d("+this.offset+"px, 0, 0)"}}},beforeCreate:function(){this.$parent&&this.$parent.swipes.push(this)},destroyed:function(){this.$parent&&this.$parent.swipes.splice(this.$parent.swipes.indexOf(this),1)}}),Ke=(n(233),a(qe,function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"wv-swipe-item",style:this.style},[this._t("default")],2)},[],!1,null,"ce4e3d68",null));Ke.options.__file="index.vue";var Ze=Ke.exports,Je=Object(s.a)({name:"switch",components:{Cell:y},props:{title:String,disabled:Boolean,isInCell:{type:Boolean,default:!0},value:Boolean},data:function(){return{currentValue:this.value,startX:0,offset:0,startOffset:0,transition:""}},computed:{thumbStyle:function(){return{transition:this.transition,transform:"translate3d("+this.offset+"px, 0, 0)"}}},mounted:function(){this.offset=this.currentValue?20:0},methods:{onClick:function(t){t.preventDefault(),this.disabled||(this.currentValue=!this.currentValue)},onTouchstart:function(t){if(!this.disabled){var e=Object(s.b)(t);this.startX=e.clientX,this.startOffset=this.offset,this.transition=""}},onTouchmove:function(t){if(!this.disabled){var e=Object(s.b)(t).clientX-this.startX,n=this.startOffset+e;n>=0&&n<=20?this.offset=n:n<0?this.offset=0:n>20&&(this.offset=20)}},onTouchend:function(t){if(!this.disabled){var e=Object(s.b)(t).clientX-this.startX;this.transition="-webkit-transform .35s cubic-bezier(0.4, 0.4, 0.25, 1.35)",this.currentValue?e<-10?this.currentValue=!1:this.offset=20:e>10?this.currentValue=!0:this.offset=0}}},watch:{value:function(t){this.currentValue=t},currentValue:function(t){this.$emit("input",t),this.$emit("change",t),this.offset=t?20:0}}}),Ue=(n(235),a(Je,function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.isInCell?n("cell",{attrs:{title:t.title}},[n("wv-switch",{attrs:{slot:"ft","is-in-cell":!1,disabled:t.disabled},slot:"ft",model:{value:t.currentValue,callback:function(e){t.currentValue=e},expression:"currentValue"}})],1):n("div",{staticClass:"wv-switch",class:{"wv-switch-on":t.currentValue,"wv-switch-disabled":t.disabled},on:{click:t.onClick}},[n("div",{staticClass:"background"}),t._v(" "),n("div",{staticClass:"thumb",style:t.thumbStyle,on:{touchstart:t.onTouchstart,touchmove:t.onTouchmove,touchend:t.onTouchend,touchcancel:t.onTouchend}})])},[],!1,null,"7a6cd1bc",null));Ue.options.__file="index.vue";var tn=Ue.exports,en=n(17),nn=Object(en.a)({name:"tab",mixins:[{data:function(){return{parent:null}},methods:{findParent:function(t){for(var e=this.$parent;e;){if(e.$options.name===t){this.parent=e;break}e=e.$parent}}}}],props:{title:String,disabled:Boolean},data:function(){return{inited:!1}},computed:{index:function(){return this.parent.tabs.indexOf(this)},isSelected:function(){return this.index===this.parent.currentActive}},created:function(){this.findParent("wv-tabs")},mounted:function(){var t=this.parent.tabs,e=this.parent.$slots.default.indexOf(this.$vnode);t.splice(-1===e?t.length:e,0,this),this.$slots.title&&this.parent.renderTitle(this.$refs.title,this.index)},beforeDestroy:function(){this.parent.tabs.splice(this.index,1)},watch:{"$parent.currentActive":function(){this.inited=this.inited||this.isSelected},title:function(){this.parent.setLine()}}}),rn=(n(237),a(nn,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"show",rawName:"v-show",value:t.isSelected,expression:"isSelected"}],staticClass:"wv-tab__pane"},[t.inited?t._t("default"):t._e(),t._v(" "),t.$slots.title?n("div",{ref:"title"},[t._t("title")],2):t._e()],2)},[],!1,null,"594439ca",null));rn.options.__file="index.vue";var sn=rn.exports,on=Object(s.a)({name:"tabbar",props:{fixed:Boolean}}),an=(n(239),a(on,function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"weui-tabbar",style:{position:this.fixed?"fixed":"absolute"}},[this._t("default")],2)},[],!1,null,"45454e57",null));an.options.__file="index.vue";var un=an.exports,cn=Object(s.a)({name:"tabbar-item",mixins:[m],props:{isOn:Boolean},methods:{onClick:function(){this.$emit("click"),this.routerLink()}}}),ln=(n(241),a(cn,function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"weui-tabbar__item",class:{"weui-bar__item_on":this.isOn},on:{click:this.onClick}},[this._t("icon"),this._v(" "),e("p",{staticClass:"weui-tabbar__label"},[this._t("default")],2)],2)},[],!1,null,"53f78ad4",null));ln.options.__file="index.vue";var fn=ln.exports,dn=n(109),hn={methods:{touchStart:function(t){this.direction="",this.deltaX=0,this.deltaY=0,this.offsetX=0,this.offsetY=0,this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY},touchMove:function(t){var e=t.touches[0];this.deltaX=e.clientX-this.startX,this.deltaY=e.clientY-this.startY,this.offsetX=Math.abs(this.deltaX),this.offsetY=Math.abs(this.deltaY),this.direction=this.offsetX>this.offsetY?"horizontal":this.offsetX<this.offsetY?"vertical":""}}},pn=Object(en.a)({name:"tabs",mixins:[hn],model:{prop:"active"},props:{sticky:Boolean,lineWidth:Number,swipeable:Boolean,active:{type:[Number,String],default:0},type:{type:String,default:"line"},duration:{type:Number,default:.2},swipeThreshold:{type:Number,default:4},offsetTop:{type:Number,default:0}},data:function(){return{tabs:[],position:"",currentActive:null,lineStyle:{},events:{resize:!1,sticky:!1,swipeable:!1}}},computed:{scrollable:function(){return this.tabs.length>this.swipeThreshold},wrapStyle:function(){switch(this.position){case"top":return{top:this.offsetTop+"px",position:"fixed"};case"bottom":return{top:"auto",bottom:0};default:return null}}},watch:{active:function(t){t!==this.currentActive&&this.correctActive(t)},tabs:function(){this.correctActive(this.currentActive||this.active),this.scrollIntoView(),this.setLine()},currentActive:function(){this.scrollIntoView(),this.setLine(),"page-top"!==this.position&&"content-bottom"!==this.position||ct.setScrollTop(window,ct.getElementTop(this.$el))},sticky:function(){this.handlers(!0)},swipeable:function(){this.handlers(!0)}},mounted:function(){var t=this;this.correctActive(this.active),this.setLine(),this.$nextTick(function(){t.handlers(!0),t.scrollIntoView(!0)})},activated:function(){var t=this;this.$nextTick(function(){t.handlers(!0),t.scrollIntoView(!0)})},deactivated:function(){this.handlers(!1)},beforeDestroy:function(){this.handlers(!1)},methods:{handlers:function(t){var e=this.events,n=this.sticky&&t,i=this.swipeable&&t;if(e.resize!==t&&(e.resize=t,(t?dt:ht)(window,"resize",this.setLine,!0)),e.sticky!==n&&(e.sticky=n,this.scrollEl=this.scrollEl||ct.getScrollEventTarget(this.$el),(n?dt:ht)(this.scrollEl,"scroll",this.onScroll,!0),this.onScroll()),e.swipeable!==i){e.swipeable=i;var r=this.$refs.content,s=i?dt:ht;s(r,"touchstart",this.touchStart),s(r,"touchmove",this.touchMove),s(r,"touchend",this.onTouchEnd),s(r,"touchcancel",this.onTouchEnd)}},onTouchEnd:function(){var t=this.direction,e=this.deltaX,n=this.currentActive;"horizontal"===t&&this.offsetX>=50&&(e>0&&0!==n?this.setCurActive(n-1):e<0&&n!==this.tabs.length-1&&this.setCurActive(n+1))},onScroll:function(){var t=ct.getScrollTop(window)+this.offsetTop,e=ct.getElementTop(this.$el),n=e+this.$el.offsetHeight-this.$refs.wrap.offsetHeight;this.position=t>n?"bottom":t>e?"top":""},setLine:function(){var t=this;this.$nextTick(function(){if(t.$refs.tabs&&"line"===t.type){var e=t.$refs.tabs[t.currentActive],n=t.lineWidth||e.offsetWidth,i=e.offsetLeft+(e.offsetWidth-n)/2;t.lineStyle={width:n+"px",transform:"translateX("+i+"px)",transitionDuration:t.duration+"s"}}})},correctActive:function(t){t=+t;var e=this.tabs.some(function(e){return e.index===t}),n=(this.tabs[0]||{}).index||0;this.setCurActive(e?t:n)},setCurActive:function(t){t!==this.currentActive&&(this.$emit("input",t),null!==this.currentActive&&this.$emit("change",t,this.tabs[t].title),this.currentActive=t)},onClick:function(t){var e=this.tabs[t],n=e.title;e.disabled?this.$emit("disabled",t,n):(this.setCurActive(t),this.$emit("click",t,n))},scrollIntoView:function(t){if(this.scrollable&&this.$refs.tabs){var e=this.$refs.tabs[this.currentActive],n=this.$refs.nav,i=n.scrollLeft,r=n.offsetWidth,s=e.offsetLeft,o=e.offsetWidth;this.scrollTo(n,i,s-(r-o)/2,t)}},scrollTo:function(t,e,n,i){if(i)t.scrollLeft+=n-e;else{var r=0,s=Math.round(1e3*this.duration/16);!function i(){t.scrollLeft+=(n-e)/s,++r<s&&Object(dn.a)(i)}()}},renderTitle:function(t,e){var n=this;this.$nextTick(function(){var i=n.$refs.title[e];i.parentNode.replaceChild(t,i)})}}}),vn=(n(244),a(pn,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"wv-tabs",class:"wv-tabs--"+t.type},[n("div",{ref:"wrap",staticClass:"wv-tabs__wrap",class:[{"wv-tabs__wrap--scrollable":t.scrollable},{"wv-hairline--top-bottom":"line"===t.type}],style:t.wrapStyle},[n("div",{ref:"nav",staticClass:"wv-tabs__nav",class:"wv-tabs__nav--"+t.type},["line"===t.type?n("div",{staticClass:"wv-tabs__line",style:t.lineStyle}):t._e(),t._v(" "),t._l(t.tabs,function(e,i){return n("div",{key:i,ref:"tabs",refInFor:!0,staticClass:"wv-tab",class:{"wv-tab--active":i===t.currentActive,"wv-tab--disabled":e.disabled},on:{click:function(e){t.onClick(i)}}},[n("span",{ref:"title",refInFor:!0,staticClass:"wv-ellipsis"},[t._v(t._s(e.title))])])})],2)]),t._v(" "),n("div",{ref:"content",staticClass:"wv-tabs__content"},[t._t("default")],2)])},[],!1,null,"1ee385f4",null));vn.options.__file="index.vue";var mn=vn.exports,bn=Object(s.a)({name:"textarea",props:{placeholder:String,showCounter:{type:Boolean,default:!0},rows:{type:[Number,String],default:3},maxLength:{type:[Number,String],default:100},disabled:Boolean,readonly:Boolean,value:{type:String,default:""}},data:function(){return{currentValue:this.value}},computed:{length:function(){return this.currentValue?this.currentValue.length:0}},mounted:function(){this.maxLength&&this.length>this.maxLength?this.currentValue=this.value.slice(0,this.maxLength):this.currentValue=this.value},methods:{onFocus:function(){this.$emit("focus")},onBlur:function(){this.$emit("blur")}},watch:{currentValue:function(t){this.$emit("input",t)},value:function(t){this.maxLength&&t.length>this.maxLength&&(t=t.slice(0,this.maxLength)),this.currentValue=t}}}),_n=(n(246),a(bn,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"weui-cell"},[n("div",{staticClass:"weui-cell__bd"},[n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"rextarea",staticClass:"weui-textarea",attrs:{placeholder:t.placeholder,rows:t.rows,disabled:t.disabled,readonly:t.readonly},domProps:{value:t.currentValue},on:{change:function(e){t.$emit("change",t.currentValue)},focus:t.onFocus,blur:t.onBlur,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}),t._v(" "),t.showCounter?n("div",{staticClass:"weui-textarea-counter"},[t._v("\n "+t._s(t.length)+"/"+t._s(t.maxLength)+"\n ")]):t._e()])])},[],!1,null,"b5fed776",null));_n.options.__file="index.vue";var yn=_n.exports,gn=Object(s.a)({name:"toast",components:{WvIcon:Kt,WvSpinner:Ye},mixins:[pt],props:{mask:{default:!0},icon:{type:String,default:"success-no-circle"},type:{type:String,default:"success",validator:function(t){return-1!==["success","fail","loading","text","html"].indexOf(t)}},spinnerType:{type:String,default:"default"},message:{type:String,default:""},maskClass:{default:"weui-mask_transparent"}}}),wn=(n(248),a(gn,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{"enter-active-class":"weui-animate-fade-in","leave-active-class":"weui-animate-fade-out"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],ref:"toast",staticClass:"weui-toast",class:{"weui-toast_text":"text"===t.type}},["text"!==t.type&&"loading"!==t.type?n("wv-icon",{staticClass:"weui-icon_toast",attrs:{type:t.icon}}):t._e(),t._v(" "),"loading"===t.type&&"none"!==t.spinnerType?n("wv-spinner",{staticClass:"weui-icon_toast",attrs:{type:t.spinnerType,size:25}}):t._e(),t._v(" "),n("p",{staticClass:"weui-toast__content",domProps:{textContent:t._s(t.message)}})],1)])},[],!1,null,"1226e435",null));wn.options.__file="toast.vue";var xn=wn.exports,Cn=void 0,kn={visible:!0,duration:2e3,mask:!0,icon:"success-no-circle",type:"success"},Sn=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"string"==typeof e&&(e={message:e}),"fail"===(e=r()({},kn,e)).type&&(e.icon="warn"),Cn||(t=it.a.extend(xn),Cn=new t({el:document.createElement("div")}),document.body.appendChild(Cn.$el)),clearTimeout(Cn.timer),U()(Cn,r()({},e)),e.duration>0&&(Cn.timer=setTimeout(function(){Cn.visible=!1},e.duration)),Cn},Tn=function(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Sn(r()({type:t,message:"object"===(void 0===e?"undefined":z()(e))?e.message:e},e))}};Sn.text=Tn("text"),Sn.success=Tn("success"),Sn.fail=Tn("fail"),Sn.loading=Tn("loading"),Sn.close=function(){Cn.visible=!1},it.a.prototype.$toast=Sn;var $n=Sn,On=Object(s.a)({name:"top-tips",mixins:[pt],props:{message:String}}),En=(n(250),a(On,function(){var t=this.$createElement,e=this._self._c||t;return e("transition",{attrs:{"enter-active-class":"weui-animate-fade-in","leave-active-class":"weui-animate-fade-out"}},[e("div",{directives:[{name:"show",rawName:"v-show",value:this.visible,expression:"visible"}],staticClass:"weui-toptips weui-toptips_warn",domProps:{innerHTML:this._s(this.message)}})])},[],!1,null,"f3923eb4",null));En.options.__file="top-tips.vue";var Vn=En.exports,In=void 0,jn={visible:!0,duration:3e3},Ln=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"string"==typeof e&&(e={message:e}),e=r()({},jn,e),In||(t=it.a.extend(Vn),In=new t({el:document.createElement("div")}),document.body.appendChild(In.$el)),clearTimeout(In.timer),U()(In,r()({},e)),e.duration>0&&(In.timer=setTimeout(function(){In.visible=!1},e.duration)),In};Ln.close=function(){In&&(In.visible=!1)},it.a.prototype.$toptips=Ln;var Mn=Ln;n.d(e,"install",function(){return Pn}),n.d(e,"version",function(){return An}),n.d(e,"Actionsheet",function(){return c}),n.d(e,"Badge",function(){return d}),n.d(e,"Button",function(){return v}),n.d(e,"Cell",function(){return y}),n.d(e,"CellSwipe",function(){return S}),n.d(e,"CellSwipeButton",function(){return O}),n.d(e,"Checklist",function(){return L}),n.d(e,"Circle",function(){return N}),n.d(e,"DatetimePicker",function(){return Z}),n.d(e,"Dialog",function(){return wt}),n.d(e,"Flex",function(){return kt}),n.d(e,"FlexItem",function(){return $t}),n.d(e,"Footer",function(){return jt}),n.d(e,"FormPreview",function(){return At}),n.d(e,"Grid",function(){return Bt}),n.d(e,"GridItem",function(){return Ht}),n.d(e,"Group",function(){return Wt}),n.d(e,"Header",function(){return Qt}),n.d(e,"Icon",function(){return Kt}),n.d(e,"InfiniteScroll",function(){return ne}),n.d(e,"Input",function(){return se}),n.d(e,"Lazyload",function(){return ae}),n.d(e,"Loadmore",function(){return le}),n.d(e,"MediaBox",function(){return he}),n.d(e,"Navbar",function(){return me}),n.d(e,"NavbarItem",function(){return ye}),n.d(e,"NumberSpinner",function(){return ke}),n.d(e,"Panel",function(){return $e}),n.d(e,"Picker",function(){return Q}),n.d(e,"Popup",function(){return Ve}),n.d(e,"Progress",function(){return Le}),n.d(e,"Radio",function(){return Ne}),n.d(e,"SearchBar",function(){return De}),n.d(e,"Slider",function(){return Fe}),n.d(e,"Spinner",function(){return Ye}),n.d(e,"Swipe",function(){return Ge}),n.d(e,"SwipeItem",function(){return Ze}),n.d(e,"Switch",function(){return tn}),n.d(e,"Tab",function(){return sn}),n.d(e,"Tabbar",function(){return un}),n.d(e,"TabbarItem",function(){return fn}),n.d(e,"Tabs",function(){return mn}),n.d(e,"Textarea",function(){return yn}),n.d(e,"Toast",function(){return $n}),n.d(e,"TopTips",function(){return Mn});var An="2.2.5",Nn=[c,d,v,y,S,O,L,N,Z,kt,$t,jt,At,Bt,Ht,Wt,Qt,Kt,se,le,he,me,ye,ke,$e,Q,Ve,Le,Ne,De,Fe,Ye,Ge,Ze,tn,sn,un,fn,mn,yn],Pn=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Nn.forEach(function(e){t.use(e)}),t.use(ne),t.use(ae,r()({loading:n(252),attempt:3},e.lazyload)),t.$dialog=t.prototype.$dialog=wt,t.$toast=t.prototype.$toast=$n,t.$toptips=t.prototype.$toptips=Mn};"undefined"!=typeof window&&window.Vue&&Pn(window.Vue),e.default={install:Pn,version:An}}])});
  39142. /***/ }),
  39143. /* 41 */
  39144. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39145. "use strict";
  39146. /*!
  39147. * vue-router v3.0.2
  39148. * (c) 2018 Evan You
  39149. * @license MIT
  39150. */
  39151. /* */
  39152. function assert (condition, message) {
  39153. if (!condition) {
  39154. throw new Error(("[vue-router] " + message))
  39155. }
  39156. }
  39157. function warn (condition, message) {
  39158. if ("development" !== 'production' && !condition) {
  39159. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  39160. }
  39161. }
  39162. function isError (err) {
  39163. return Object.prototype.toString.call(err).indexOf('Error') > -1
  39164. }
  39165. function extend (a, b) {
  39166. for (var key in b) {
  39167. a[key] = b[key];
  39168. }
  39169. return a
  39170. }
  39171. var View = {
  39172. name: 'RouterView',
  39173. functional: true,
  39174. props: {
  39175. name: {
  39176. type: String,
  39177. default: 'default'
  39178. }
  39179. },
  39180. render: function render (_, ref) {
  39181. var props = ref.props;
  39182. var children = ref.children;
  39183. var parent = ref.parent;
  39184. var data = ref.data;
  39185. // used by devtools to display a router-view badge
  39186. data.routerView = true;
  39187. // directly use parent context's createElement() function
  39188. // so that components rendered by router-view can resolve named slots
  39189. var h = parent.$createElement;
  39190. var name = props.name;
  39191. var route = parent.$route;
  39192. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  39193. // determine current view depth, also check to see if the tree
  39194. // has been toggled inactive but kept-alive.
  39195. var depth = 0;
  39196. var inactive = false;
  39197. while (parent && parent._routerRoot !== parent) {
  39198. if (parent.$vnode && parent.$vnode.data.routerView) {
  39199. depth++;
  39200. }
  39201. if (parent._inactive) {
  39202. inactive = true;
  39203. }
  39204. parent = parent.$parent;
  39205. }
  39206. data.routerViewDepth = depth;
  39207. // render previous view if the tree is inactive and kept-alive
  39208. if (inactive) {
  39209. return h(cache[name], data, children)
  39210. }
  39211. var matched = route.matched[depth];
  39212. // render empty node if no matched route
  39213. if (!matched) {
  39214. cache[name] = null;
  39215. return h()
  39216. }
  39217. var component = cache[name] = matched.components[name];
  39218. // attach instance registration hook
  39219. // this will be called in the instance's injected lifecycle hooks
  39220. data.registerRouteInstance = function (vm, val) {
  39221. // val could be undefined for unregistration
  39222. var current = matched.instances[name];
  39223. if (
  39224. (val && current !== vm) ||
  39225. (!val && current === vm)
  39226. ) {
  39227. matched.instances[name] = val;
  39228. }
  39229. }
  39230. // also register instance in prepatch hook
  39231. // in case the same component instance is reused across different routes
  39232. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  39233. matched.instances[name] = vnode.componentInstance;
  39234. };
  39235. // resolve props
  39236. var propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
  39237. if (propsToPass) {
  39238. // clone to prevent mutation
  39239. propsToPass = data.props = extend({}, propsToPass);
  39240. // pass non-declared props as attrs
  39241. var attrs = data.attrs = data.attrs || {};
  39242. for (var key in propsToPass) {
  39243. if (!component.props || !(key in component.props)) {
  39244. attrs[key] = propsToPass[key];
  39245. delete propsToPass[key];
  39246. }
  39247. }
  39248. }
  39249. return h(component, data, children)
  39250. }
  39251. }
  39252. function resolveProps (route, config) {
  39253. switch (typeof config) {
  39254. case 'undefined':
  39255. return
  39256. case 'object':
  39257. return config
  39258. case 'function':
  39259. return config(route)
  39260. case 'boolean':
  39261. return config ? route.params : undefined
  39262. default:
  39263. if (true) {
  39264. warn(
  39265. false,
  39266. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  39267. "expecting an object, function or boolean."
  39268. );
  39269. }
  39270. }
  39271. }
  39272. /* */
  39273. var encodeReserveRE = /[!'()*]/g;
  39274. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  39275. var commaRE = /%2C/g;
  39276. // fixed encodeURIComponent which is more conformant to RFC3986:
  39277. // - escapes [!'()*]
  39278. // - preserve commas
  39279. var encode = function (str) { return encodeURIComponent(str)
  39280. .replace(encodeReserveRE, encodeReserveReplacer)
  39281. .replace(commaRE, ','); };
  39282. var decode = decodeURIComponent;
  39283. function resolveQuery (
  39284. query,
  39285. extraQuery,
  39286. _parseQuery
  39287. ) {
  39288. if ( extraQuery === void 0 ) extraQuery = {};
  39289. var parse = _parseQuery || parseQuery;
  39290. var parsedQuery;
  39291. try {
  39292. parsedQuery = parse(query || '');
  39293. } catch (e) {
  39294. "development" !== 'production' && warn(false, e.message);
  39295. parsedQuery = {};
  39296. }
  39297. for (var key in extraQuery) {
  39298. parsedQuery[key] = extraQuery[key];
  39299. }
  39300. return parsedQuery
  39301. }
  39302. function parseQuery (query) {
  39303. var res = {};
  39304. query = query.trim().replace(/^(\?|#|&)/, '');
  39305. if (!query) {
  39306. return res
  39307. }
  39308. query.split('&').forEach(function (param) {
  39309. var parts = param.replace(/\+/g, ' ').split('=');
  39310. var key = decode(parts.shift());
  39311. var val = parts.length > 0
  39312. ? decode(parts.join('='))
  39313. : null;
  39314. if (res[key] === undefined) {
  39315. res[key] = val;
  39316. } else if (Array.isArray(res[key])) {
  39317. res[key].push(val);
  39318. } else {
  39319. res[key] = [res[key], val];
  39320. }
  39321. });
  39322. return res
  39323. }
  39324. function stringifyQuery (obj) {
  39325. var res = obj ? Object.keys(obj).map(function (key) {
  39326. var val = obj[key];
  39327. if (val === undefined) {
  39328. return ''
  39329. }
  39330. if (val === null) {
  39331. return encode(key)
  39332. }
  39333. if (Array.isArray(val)) {
  39334. var result = [];
  39335. val.forEach(function (val2) {
  39336. if (val2 === undefined) {
  39337. return
  39338. }
  39339. if (val2 === null) {
  39340. result.push(encode(key));
  39341. } else {
  39342. result.push(encode(key) + '=' + encode(val2));
  39343. }
  39344. });
  39345. return result.join('&')
  39346. }
  39347. return encode(key) + '=' + encode(val)
  39348. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  39349. return res ? ("?" + res) : ''
  39350. }
  39351. /* */
  39352. var trailingSlashRE = /\/?$/;
  39353. function createRoute (
  39354. record,
  39355. location,
  39356. redirectedFrom,
  39357. router
  39358. ) {
  39359. var stringifyQuery$$1 = router && router.options.stringifyQuery;
  39360. var query = location.query || {};
  39361. try {
  39362. query = clone(query);
  39363. } catch (e) {}
  39364. var route = {
  39365. name: location.name || (record && record.name),
  39366. meta: (record && record.meta) || {},
  39367. path: location.path || '/',
  39368. hash: location.hash || '',
  39369. query: query,
  39370. params: location.params || {},
  39371. fullPath: getFullPath(location, stringifyQuery$$1),
  39372. matched: record ? formatMatch(record) : []
  39373. };
  39374. if (redirectedFrom) {
  39375. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery$$1);
  39376. }
  39377. return Object.freeze(route)
  39378. }
  39379. function clone (value) {
  39380. if (Array.isArray(value)) {
  39381. return value.map(clone)
  39382. } else if (value && typeof value === 'object') {
  39383. var res = {};
  39384. for (var key in value) {
  39385. res[key] = clone(value[key]);
  39386. }
  39387. return res
  39388. } else {
  39389. return value
  39390. }
  39391. }
  39392. // the starting route that represents the initial state
  39393. var START = createRoute(null, {
  39394. path: '/'
  39395. });
  39396. function formatMatch (record) {
  39397. var res = [];
  39398. while (record) {
  39399. res.unshift(record);
  39400. record = record.parent;
  39401. }
  39402. return res
  39403. }
  39404. function getFullPath (
  39405. ref,
  39406. _stringifyQuery
  39407. ) {
  39408. var path = ref.path;
  39409. var query = ref.query; if ( query === void 0 ) query = {};
  39410. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  39411. var stringify = _stringifyQuery || stringifyQuery;
  39412. return (path || '/') + stringify(query) + hash
  39413. }
  39414. function isSameRoute (a, b) {
  39415. if (b === START) {
  39416. return a === b
  39417. } else if (!b) {
  39418. return false
  39419. } else if (a.path && b.path) {
  39420. return (
  39421. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  39422. a.hash === b.hash &&
  39423. isObjectEqual(a.query, b.query)
  39424. )
  39425. } else if (a.name && b.name) {
  39426. return (
  39427. a.name === b.name &&
  39428. a.hash === b.hash &&
  39429. isObjectEqual(a.query, b.query) &&
  39430. isObjectEqual(a.params, b.params)
  39431. )
  39432. } else {
  39433. return false
  39434. }
  39435. }
  39436. function isObjectEqual (a, b) {
  39437. if ( a === void 0 ) a = {};
  39438. if ( b === void 0 ) b = {};
  39439. // handle null value #1566
  39440. if (!a || !b) { return a === b }
  39441. var aKeys = Object.keys(a);
  39442. var bKeys = Object.keys(b);
  39443. if (aKeys.length !== bKeys.length) {
  39444. return false
  39445. }
  39446. return aKeys.every(function (key) {
  39447. var aVal = a[key];
  39448. var bVal = b[key];
  39449. // check nested equality
  39450. if (typeof aVal === 'object' && typeof bVal === 'object') {
  39451. return isObjectEqual(aVal, bVal)
  39452. }
  39453. return String(aVal) === String(bVal)
  39454. })
  39455. }
  39456. function isIncludedRoute (current, target) {
  39457. return (
  39458. current.path.replace(trailingSlashRE, '/').indexOf(
  39459. target.path.replace(trailingSlashRE, '/')
  39460. ) === 0 &&
  39461. (!target.hash || current.hash === target.hash) &&
  39462. queryIncludes(current.query, target.query)
  39463. )
  39464. }
  39465. function queryIncludes (current, target) {
  39466. for (var key in target) {
  39467. if (!(key in current)) {
  39468. return false
  39469. }
  39470. }
  39471. return true
  39472. }
  39473. /* */
  39474. // work around weird flow bug
  39475. var toTypes = [String, Object];
  39476. var eventTypes = [String, Array];
  39477. var Link = {
  39478. name: 'RouterLink',
  39479. props: {
  39480. to: {
  39481. type: toTypes,
  39482. required: true
  39483. },
  39484. tag: {
  39485. type: String,
  39486. default: 'a'
  39487. },
  39488. exact: Boolean,
  39489. append: Boolean,
  39490. replace: Boolean,
  39491. activeClass: String,
  39492. exactActiveClass: String,
  39493. event: {
  39494. type: eventTypes,
  39495. default: 'click'
  39496. }
  39497. },
  39498. render: function render (h) {
  39499. var this$1 = this;
  39500. var router = this.$router;
  39501. var current = this.$route;
  39502. var ref = router.resolve(this.to, current, this.append);
  39503. var location = ref.location;
  39504. var route = ref.route;
  39505. var href = ref.href;
  39506. var classes = {};
  39507. var globalActiveClass = router.options.linkActiveClass;
  39508. var globalExactActiveClass = router.options.linkExactActiveClass;
  39509. // Support global empty active class
  39510. var activeClassFallback = globalActiveClass == null
  39511. ? 'router-link-active'
  39512. : globalActiveClass;
  39513. var exactActiveClassFallback = globalExactActiveClass == null
  39514. ? 'router-link-exact-active'
  39515. : globalExactActiveClass;
  39516. var activeClass = this.activeClass == null
  39517. ? activeClassFallback
  39518. : this.activeClass;
  39519. var exactActiveClass = this.exactActiveClass == null
  39520. ? exactActiveClassFallback
  39521. : this.exactActiveClass;
  39522. var compareTarget = location.path
  39523. ? createRoute(null, location, null, router)
  39524. : route;
  39525. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  39526. classes[activeClass] = this.exact
  39527. ? classes[exactActiveClass]
  39528. : isIncludedRoute(current, compareTarget);
  39529. var handler = function (e) {
  39530. if (guardEvent(e)) {
  39531. if (this$1.replace) {
  39532. router.replace(location);
  39533. } else {
  39534. router.push(location);
  39535. }
  39536. }
  39537. };
  39538. var on = { click: guardEvent };
  39539. if (Array.isArray(this.event)) {
  39540. this.event.forEach(function (e) { on[e] = handler; });
  39541. } else {
  39542. on[this.event] = handler;
  39543. }
  39544. var data = {
  39545. class: classes
  39546. };
  39547. if (this.tag === 'a') {
  39548. data.on = on;
  39549. data.attrs = { href: href };
  39550. } else {
  39551. // find the first <a> child and apply listener and href
  39552. var a = findAnchor(this.$slots.default);
  39553. if (a) {
  39554. // in case the <a> is a static node
  39555. a.isStatic = false;
  39556. var aData = a.data = extend({}, a.data);
  39557. aData.on = on;
  39558. var aAttrs = a.data.attrs = extend({}, a.data.attrs);
  39559. aAttrs.href = href;
  39560. } else {
  39561. // doesn't have <a> child, apply listener to self
  39562. data.on = on;
  39563. }
  39564. }
  39565. return h(this.tag, data, this.$slots.default)
  39566. }
  39567. }
  39568. function guardEvent (e) {
  39569. // don't redirect with control keys
  39570. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  39571. // don't redirect when preventDefault called
  39572. if (e.defaultPrevented) { return }
  39573. // don't redirect on right click
  39574. if (e.button !== undefined && e.button !== 0) { return }
  39575. // don't redirect if `target="_blank"`
  39576. if (e.currentTarget && e.currentTarget.getAttribute) {
  39577. var target = e.currentTarget.getAttribute('target');
  39578. if (/\b_blank\b/i.test(target)) { return }
  39579. }
  39580. // this may be a Weex event which doesn't have this method
  39581. if (e.preventDefault) {
  39582. e.preventDefault();
  39583. }
  39584. return true
  39585. }
  39586. function findAnchor (children) {
  39587. if (children) {
  39588. var child;
  39589. for (var i = 0; i < children.length; i++) {
  39590. child = children[i];
  39591. if (child.tag === 'a') {
  39592. return child
  39593. }
  39594. if (child.children && (child = findAnchor(child.children))) {
  39595. return child
  39596. }
  39597. }
  39598. }
  39599. }
  39600. var _Vue;
  39601. function install (Vue) {
  39602. if (install.installed && _Vue === Vue) { return }
  39603. install.installed = true;
  39604. _Vue = Vue;
  39605. var isDef = function (v) { return v !== undefined; };
  39606. var registerInstance = function (vm, callVal) {
  39607. var i = vm.$options._parentVnode;
  39608. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  39609. i(vm, callVal);
  39610. }
  39611. };
  39612. Vue.mixin({
  39613. beforeCreate: function beforeCreate () {
  39614. if (isDef(this.$options.router)) {
  39615. this._routerRoot = this;
  39616. this._router = this.$options.router;
  39617. this._router.init(this);
  39618. Vue.util.defineReactive(this, '_route', this._router.history.current);
  39619. } else {
  39620. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  39621. }
  39622. registerInstance(this, this);
  39623. },
  39624. destroyed: function destroyed () {
  39625. registerInstance(this);
  39626. }
  39627. });
  39628. Object.defineProperty(Vue.prototype, '$router', {
  39629. get: function get () { return this._routerRoot._router }
  39630. });
  39631. Object.defineProperty(Vue.prototype, '$route', {
  39632. get: function get () { return this._routerRoot._route }
  39633. });
  39634. Vue.component('RouterView', View);
  39635. Vue.component('RouterLink', Link);
  39636. var strats = Vue.config.optionMergeStrategies;
  39637. // use the same hook merging strategy for route hooks
  39638. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  39639. }
  39640. /* */
  39641. var inBrowser = typeof window !== 'undefined';
  39642. /* */
  39643. function resolvePath (
  39644. relative,
  39645. base,
  39646. append
  39647. ) {
  39648. var firstChar = relative.charAt(0);
  39649. if (firstChar === '/') {
  39650. return relative
  39651. }
  39652. if (firstChar === '?' || firstChar === '#') {
  39653. return base + relative
  39654. }
  39655. var stack = base.split('/');
  39656. // remove trailing segment if:
  39657. // - not appending
  39658. // - appending to trailing slash (last segment is empty)
  39659. if (!append || !stack[stack.length - 1]) {
  39660. stack.pop();
  39661. }
  39662. // resolve relative path
  39663. var segments = relative.replace(/^\//, '').split('/');
  39664. for (var i = 0; i < segments.length; i++) {
  39665. var segment = segments[i];
  39666. if (segment === '..') {
  39667. stack.pop();
  39668. } else if (segment !== '.') {
  39669. stack.push(segment);
  39670. }
  39671. }
  39672. // ensure leading slash
  39673. if (stack[0] !== '') {
  39674. stack.unshift('');
  39675. }
  39676. return stack.join('/')
  39677. }
  39678. function parsePath (path) {
  39679. var hash = '';
  39680. var query = '';
  39681. var hashIndex = path.indexOf('#');
  39682. if (hashIndex >= 0) {
  39683. hash = path.slice(hashIndex);
  39684. path = path.slice(0, hashIndex);
  39685. }
  39686. var queryIndex = path.indexOf('?');
  39687. if (queryIndex >= 0) {
  39688. query = path.slice(queryIndex + 1);
  39689. path = path.slice(0, queryIndex);
  39690. }
  39691. return {
  39692. path: path,
  39693. query: query,
  39694. hash: hash
  39695. }
  39696. }
  39697. function cleanPath (path) {
  39698. return path.replace(/\/\//g, '/')
  39699. }
  39700. var isarray = Array.isArray || function (arr) {
  39701. return Object.prototype.toString.call(arr) == '[object Array]';
  39702. };
  39703. /**
  39704. * Expose `pathToRegexp`.
  39705. */
  39706. var pathToRegexp_1 = pathToRegexp;
  39707. var parse_1 = parse;
  39708. var compile_1 = compile;
  39709. var tokensToFunction_1 = tokensToFunction;
  39710. var tokensToRegExp_1 = tokensToRegExp;
  39711. /**
  39712. * The main path matching regexp utility.
  39713. *
  39714. * @type {RegExp}
  39715. */
  39716. var PATH_REGEXP = new RegExp([
  39717. // Match escaped characters that would otherwise appear in future matches.
  39718. // This allows the user to escape special characters that won't transform.
  39719. '(\\\\.)',
  39720. // Match Express-style parameters and un-named parameters with a prefix
  39721. // and optional suffixes. Matches appear as:
  39722. //
  39723. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  39724. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  39725. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  39726. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  39727. ].join('|'), 'g');
  39728. /**
  39729. * Parse a string for the raw tokens.
  39730. *
  39731. * @param {string} str
  39732. * @param {Object=} options
  39733. * @return {!Array}
  39734. */
  39735. function parse (str, options) {
  39736. var tokens = [];
  39737. var key = 0;
  39738. var index = 0;
  39739. var path = '';
  39740. var defaultDelimiter = options && options.delimiter || '/';
  39741. var res;
  39742. while ((res = PATH_REGEXP.exec(str)) != null) {
  39743. var m = res[0];
  39744. var escaped = res[1];
  39745. var offset = res.index;
  39746. path += str.slice(index, offset);
  39747. index = offset + m.length;
  39748. // Ignore already escaped sequences.
  39749. if (escaped) {
  39750. path += escaped[1];
  39751. continue
  39752. }
  39753. var next = str[index];
  39754. var prefix = res[2];
  39755. var name = res[3];
  39756. var capture = res[4];
  39757. var group = res[5];
  39758. var modifier = res[6];
  39759. var asterisk = res[7];
  39760. // Push the current path onto the tokens.
  39761. if (path) {
  39762. tokens.push(path);
  39763. path = '';
  39764. }
  39765. var partial = prefix != null && next != null && next !== prefix;
  39766. var repeat = modifier === '+' || modifier === '*';
  39767. var optional = modifier === '?' || modifier === '*';
  39768. var delimiter = res[2] || defaultDelimiter;
  39769. var pattern = capture || group;
  39770. tokens.push({
  39771. name: name || key++,
  39772. prefix: prefix || '',
  39773. delimiter: delimiter,
  39774. optional: optional,
  39775. repeat: repeat,
  39776. partial: partial,
  39777. asterisk: !!asterisk,
  39778. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  39779. });
  39780. }
  39781. // Match any characters still remaining.
  39782. if (index < str.length) {
  39783. path += str.substr(index);
  39784. }
  39785. // If the path exists, push it onto the end.
  39786. if (path) {
  39787. tokens.push(path);
  39788. }
  39789. return tokens
  39790. }
  39791. /**
  39792. * Compile a string to a template function for the path.
  39793. *
  39794. * @param {string} str
  39795. * @param {Object=} options
  39796. * @return {!function(Object=, Object=)}
  39797. */
  39798. function compile (str, options) {
  39799. return tokensToFunction(parse(str, options))
  39800. }
  39801. /**
  39802. * Prettier encoding of URI path segments.
  39803. *
  39804. * @param {string}
  39805. * @return {string}
  39806. */
  39807. function encodeURIComponentPretty (str) {
  39808. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  39809. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  39810. })
  39811. }
  39812. /**
  39813. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  39814. *
  39815. * @param {string}
  39816. * @return {string}
  39817. */
  39818. function encodeAsterisk (str) {
  39819. return encodeURI(str).replace(/[?#]/g, function (c) {
  39820. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  39821. })
  39822. }
  39823. /**
  39824. * Expose a method for transforming tokens into the path function.
  39825. */
  39826. function tokensToFunction (tokens) {
  39827. // Compile all the tokens into regexps.
  39828. var matches = new Array(tokens.length);
  39829. // Compile all the patterns before compilation.
  39830. for (var i = 0; i < tokens.length; i++) {
  39831. if (typeof tokens[i] === 'object') {
  39832. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  39833. }
  39834. }
  39835. return function (obj, opts) {
  39836. var path = '';
  39837. var data = obj || {};
  39838. var options = opts || {};
  39839. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  39840. for (var i = 0; i < tokens.length; i++) {
  39841. var token = tokens[i];
  39842. if (typeof token === 'string') {
  39843. path += token;
  39844. continue
  39845. }
  39846. var value = data[token.name];
  39847. var segment;
  39848. if (value == null) {
  39849. if (token.optional) {
  39850. // Prepend partial segment prefixes.
  39851. if (token.partial) {
  39852. path += token.prefix;
  39853. }
  39854. continue
  39855. } else {
  39856. throw new TypeError('Expected "' + token.name + '" to be defined')
  39857. }
  39858. }
  39859. if (isarray(value)) {
  39860. if (!token.repeat) {
  39861. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  39862. }
  39863. if (value.length === 0) {
  39864. if (token.optional) {
  39865. continue
  39866. } else {
  39867. throw new TypeError('Expected "' + token.name + '" to not be empty')
  39868. }
  39869. }
  39870. for (var j = 0; j < value.length; j++) {
  39871. segment = encode(value[j]);
  39872. if (!matches[i].test(segment)) {
  39873. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  39874. }
  39875. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  39876. }
  39877. continue
  39878. }
  39879. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  39880. if (!matches[i].test(segment)) {
  39881. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  39882. }
  39883. path += token.prefix + segment;
  39884. }
  39885. return path
  39886. }
  39887. }
  39888. /**
  39889. * Escape a regular expression string.
  39890. *
  39891. * @param {string} str
  39892. * @return {string}
  39893. */
  39894. function escapeString (str) {
  39895. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  39896. }
  39897. /**
  39898. * Escape the capturing group by escaping special characters and meaning.
  39899. *
  39900. * @param {string} group
  39901. * @return {string}
  39902. */
  39903. function escapeGroup (group) {
  39904. return group.replace(/([=!:$\/()])/g, '\\$1')
  39905. }
  39906. /**
  39907. * Attach the keys as a property of the regexp.
  39908. *
  39909. * @param {!RegExp} re
  39910. * @param {Array} keys
  39911. * @return {!RegExp}
  39912. */
  39913. function attachKeys (re, keys) {
  39914. re.keys = keys;
  39915. return re
  39916. }
  39917. /**
  39918. * Get the flags for a regexp from the options.
  39919. *
  39920. * @param {Object} options
  39921. * @return {string}
  39922. */
  39923. function flags (options) {
  39924. return options.sensitive ? '' : 'i'
  39925. }
  39926. /**
  39927. * Pull out keys from a regexp.
  39928. *
  39929. * @param {!RegExp} path
  39930. * @param {!Array} keys
  39931. * @return {!RegExp}
  39932. */
  39933. function regexpToRegexp (path, keys) {
  39934. // Use a negative lookahead to match only capturing groups.
  39935. var groups = path.source.match(/\((?!\?)/g);
  39936. if (groups) {
  39937. for (var i = 0; i < groups.length; i++) {
  39938. keys.push({
  39939. name: i,
  39940. prefix: null,
  39941. delimiter: null,
  39942. optional: false,
  39943. repeat: false,
  39944. partial: false,
  39945. asterisk: false,
  39946. pattern: null
  39947. });
  39948. }
  39949. }
  39950. return attachKeys(path, keys)
  39951. }
  39952. /**
  39953. * Transform an array into a regexp.
  39954. *
  39955. * @param {!Array} path
  39956. * @param {Array} keys
  39957. * @param {!Object} options
  39958. * @return {!RegExp}
  39959. */
  39960. function arrayToRegexp (path, keys, options) {
  39961. var parts = [];
  39962. for (var i = 0; i < path.length; i++) {
  39963. parts.push(pathToRegexp(path[i], keys, options).source);
  39964. }
  39965. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  39966. return attachKeys(regexp, keys)
  39967. }
  39968. /**
  39969. * Create a path regexp from string input.
  39970. *
  39971. * @param {string} path
  39972. * @param {!Array} keys
  39973. * @param {!Object} options
  39974. * @return {!RegExp}
  39975. */
  39976. function stringToRegexp (path, keys, options) {
  39977. return tokensToRegExp(parse(path, options), keys, options)
  39978. }
  39979. /**
  39980. * Expose a function for taking tokens and returning a RegExp.
  39981. *
  39982. * @param {!Array} tokens
  39983. * @param {(Array|Object)=} keys
  39984. * @param {Object=} options
  39985. * @return {!RegExp}
  39986. */
  39987. function tokensToRegExp (tokens, keys, options) {
  39988. if (!isarray(keys)) {
  39989. options = /** @type {!Object} */ (keys || options);
  39990. keys = [];
  39991. }
  39992. options = options || {};
  39993. var strict = options.strict;
  39994. var end = options.end !== false;
  39995. var route = '';
  39996. // Iterate over the tokens and create our regexp string.
  39997. for (var i = 0; i < tokens.length; i++) {
  39998. var token = tokens[i];
  39999. if (typeof token === 'string') {
  40000. route += escapeString(token);
  40001. } else {
  40002. var prefix = escapeString(token.prefix);
  40003. var capture = '(?:' + token.pattern + ')';
  40004. keys.push(token);
  40005. if (token.repeat) {
  40006. capture += '(?:' + prefix + capture + ')*';
  40007. }
  40008. if (token.optional) {
  40009. if (!token.partial) {
  40010. capture = '(?:' + prefix + '(' + capture + '))?';
  40011. } else {
  40012. capture = prefix + '(' + capture + ')?';
  40013. }
  40014. } else {
  40015. capture = prefix + '(' + capture + ')';
  40016. }
  40017. route += capture;
  40018. }
  40019. }
  40020. var delimiter = escapeString(options.delimiter || '/');
  40021. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  40022. // In non-strict mode we allow a slash at the end of match. If the path to
  40023. // match already ends with a slash, we remove it for consistency. The slash
  40024. // is valid at the end of a path match, not in the middle. This is important
  40025. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  40026. if (!strict) {
  40027. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  40028. }
  40029. if (end) {
  40030. route += '$';
  40031. } else {
  40032. // In non-ending mode, we need the capturing groups to match as much as
  40033. // possible by using a positive lookahead to the end or next path segment.
  40034. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  40035. }
  40036. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  40037. }
  40038. /**
  40039. * Normalize the given path string, returning a regular expression.
  40040. *
  40041. * An empty array can be passed in for the keys, which will hold the
  40042. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  40043. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  40044. *
  40045. * @param {(string|RegExp|Array)} path
  40046. * @param {(Array|Object)=} keys
  40047. * @param {Object=} options
  40048. * @return {!RegExp}
  40049. */
  40050. function pathToRegexp (path, keys, options) {
  40051. if (!isarray(keys)) {
  40052. options = /** @type {!Object} */ (keys || options);
  40053. keys = [];
  40054. }
  40055. options = options || {};
  40056. if (path instanceof RegExp) {
  40057. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  40058. }
  40059. if (isarray(path)) {
  40060. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  40061. }
  40062. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  40063. }
  40064. pathToRegexp_1.parse = parse_1;
  40065. pathToRegexp_1.compile = compile_1;
  40066. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  40067. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  40068. /* */
  40069. // $flow-disable-line
  40070. var regexpCompileCache = Object.create(null);
  40071. function fillParams (
  40072. path,
  40073. params,
  40074. routeMsg
  40075. ) {
  40076. try {
  40077. var filler =
  40078. regexpCompileCache[path] ||
  40079. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  40080. return filler(params || {}, { pretty: true })
  40081. } catch (e) {
  40082. if (true) {
  40083. warn(false, ("missing param for " + routeMsg + ": " + (e.message)));
  40084. }
  40085. return ''
  40086. }
  40087. }
  40088. /* */
  40089. function createRouteMap (
  40090. routes,
  40091. oldPathList,
  40092. oldPathMap,
  40093. oldNameMap
  40094. ) {
  40095. // the path list is used to control path matching priority
  40096. var pathList = oldPathList || [];
  40097. // $flow-disable-line
  40098. var pathMap = oldPathMap || Object.create(null);
  40099. // $flow-disable-line
  40100. var nameMap = oldNameMap || Object.create(null);
  40101. routes.forEach(function (route) {
  40102. addRouteRecord(pathList, pathMap, nameMap, route);
  40103. });
  40104. // ensure wildcard routes are always at the end
  40105. for (var i = 0, l = pathList.length; i < l; i++) {
  40106. if (pathList[i] === '*') {
  40107. pathList.push(pathList.splice(i, 1)[0]);
  40108. l--;
  40109. i--;
  40110. }
  40111. }
  40112. return {
  40113. pathList: pathList,
  40114. pathMap: pathMap,
  40115. nameMap: nameMap
  40116. }
  40117. }
  40118. function addRouteRecord (
  40119. pathList,
  40120. pathMap,
  40121. nameMap,
  40122. route,
  40123. parent,
  40124. matchAs
  40125. ) {
  40126. var path = route.path;
  40127. var name = route.name;
  40128. if (true) {
  40129. assert(path != null, "\"path\" is required in a route configuration.");
  40130. assert(
  40131. typeof route.component !== 'string',
  40132. "route config \"component\" for path: " + (String(path || name)) + " cannot be a " +
  40133. "string id. Use an actual component instead."
  40134. );
  40135. }
  40136. var pathToRegexpOptions = route.pathToRegexpOptions || {};
  40137. var normalizedPath = normalizePath(
  40138. path,
  40139. parent,
  40140. pathToRegexpOptions.strict
  40141. );
  40142. if (typeof route.caseSensitive === 'boolean') {
  40143. pathToRegexpOptions.sensitive = route.caseSensitive;
  40144. }
  40145. var record = {
  40146. path: normalizedPath,
  40147. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  40148. components: route.components || { default: route.component },
  40149. instances: {},
  40150. name: name,
  40151. parent: parent,
  40152. matchAs: matchAs,
  40153. redirect: route.redirect,
  40154. beforeEnter: route.beforeEnter,
  40155. meta: route.meta || {},
  40156. props: route.props == null
  40157. ? {}
  40158. : route.components
  40159. ? route.props
  40160. : { default: route.props }
  40161. };
  40162. if (route.children) {
  40163. // Warn if route is named, does not redirect and has a default child route.
  40164. // If users navigate to this route by name, the default child will
  40165. // not be rendered (GH Issue #629)
  40166. if (true) {
  40167. if (route.name && !route.redirect && route.children.some(function (child) { return /^\/?$/.test(child.path); })) {
  40168. warn(
  40169. false,
  40170. "Named Route '" + (route.name) + "' has a default child route. " +
  40171. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  40172. "the default child route will not be rendered. Remove the name from " +
  40173. "this route and use the name of the default child route for named " +
  40174. "links instead."
  40175. );
  40176. }
  40177. }
  40178. route.children.forEach(function (child) {
  40179. var childMatchAs = matchAs
  40180. ? cleanPath((matchAs + "/" + (child.path)))
  40181. : undefined;
  40182. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  40183. });
  40184. }
  40185. if (route.alias !== undefined) {
  40186. var aliases = Array.isArray(route.alias)
  40187. ? route.alias
  40188. : [route.alias];
  40189. aliases.forEach(function (alias) {
  40190. var aliasRoute = {
  40191. path: alias,
  40192. children: route.children
  40193. };
  40194. addRouteRecord(
  40195. pathList,
  40196. pathMap,
  40197. nameMap,
  40198. aliasRoute,
  40199. parent,
  40200. record.path || '/' // matchAs
  40201. );
  40202. });
  40203. }
  40204. if (!pathMap[record.path]) {
  40205. pathList.push(record.path);
  40206. pathMap[record.path] = record;
  40207. }
  40208. if (name) {
  40209. if (!nameMap[name]) {
  40210. nameMap[name] = record;
  40211. } else if ("development" !== 'production' && !matchAs) {
  40212. warn(
  40213. false,
  40214. "Duplicate named routes definition: " +
  40215. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  40216. );
  40217. }
  40218. }
  40219. }
  40220. function compileRouteRegex (path, pathToRegexpOptions) {
  40221. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  40222. if (true) {
  40223. var keys = Object.create(null);
  40224. regex.keys.forEach(function (key) {
  40225. warn(!keys[key.name], ("Duplicate param keys in route with path: \"" + path + "\""));
  40226. keys[key.name] = true;
  40227. });
  40228. }
  40229. return regex
  40230. }
  40231. function normalizePath (path, parent, strict) {
  40232. if (!strict) { path = path.replace(/\/$/, ''); }
  40233. if (path[0] === '/') { return path }
  40234. if (parent == null) { return path }
  40235. return cleanPath(((parent.path) + "/" + path))
  40236. }
  40237. /* */
  40238. function normalizeLocation (
  40239. raw,
  40240. current,
  40241. append,
  40242. router
  40243. ) {
  40244. var next = typeof raw === 'string' ? { path: raw } : raw;
  40245. // named target
  40246. if (next.name || next._normalized) {
  40247. return next
  40248. }
  40249. // relative params
  40250. if (!next.path && next.params && current) {
  40251. next = extend({}, next);
  40252. next._normalized = true;
  40253. var params = extend(extend({}, current.params), next.params);
  40254. if (current.name) {
  40255. next.name = current.name;
  40256. next.params = params;
  40257. } else if (current.matched.length) {
  40258. var rawPath = current.matched[current.matched.length - 1].path;
  40259. next.path = fillParams(rawPath, params, ("path " + (current.path)));
  40260. } else if (true) {
  40261. warn(false, "relative params navigation requires a current route.");
  40262. }
  40263. return next
  40264. }
  40265. var parsedPath = parsePath(next.path || '');
  40266. var basePath = (current && current.path) || '/';
  40267. var path = parsedPath.path
  40268. ? resolvePath(parsedPath.path, basePath, append || next.append)
  40269. : basePath;
  40270. var query = resolveQuery(
  40271. parsedPath.query,
  40272. next.query,
  40273. router && router.options.parseQuery
  40274. );
  40275. var hash = next.hash || parsedPath.hash;
  40276. if (hash && hash.charAt(0) !== '#') {
  40277. hash = "#" + hash;
  40278. }
  40279. return {
  40280. _normalized: true,
  40281. path: path,
  40282. query: query,
  40283. hash: hash
  40284. }
  40285. }
  40286. /* */
  40287. function createMatcher (
  40288. routes,
  40289. router
  40290. ) {
  40291. var ref = createRouteMap(routes);
  40292. var pathList = ref.pathList;
  40293. var pathMap = ref.pathMap;
  40294. var nameMap = ref.nameMap;
  40295. function addRoutes (routes) {
  40296. createRouteMap(routes, pathList, pathMap, nameMap);
  40297. }
  40298. function match (
  40299. raw,
  40300. currentRoute,
  40301. redirectedFrom
  40302. ) {
  40303. var location = normalizeLocation(raw, currentRoute, false, router);
  40304. var name = location.name;
  40305. if (name) {
  40306. var record = nameMap[name];
  40307. if (true) {
  40308. warn(record, ("Route with name '" + name + "' does not exist"));
  40309. }
  40310. if (!record) { return _createRoute(null, location) }
  40311. var paramNames = record.regex.keys
  40312. .filter(function (key) { return !key.optional; })
  40313. .map(function (key) { return key.name; });
  40314. if (typeof location.params !== 'object') {
  40315. location.params = {};
  40316. }
  40317. if (currentRoute && typeof currentRoute.params === 'object') {
  40318. for (var key in currentRoute.params) {
  40319. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  40320. location.params[key] = currentRoute.params[key];
  40321. }
  40322. }
  40323. }
  40324. if (record) {
  40325. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  40326. return _createRoute(record, location, redirectedFrom)
  40327. }
  40328. } else if (location.path) {
  40329. location.params = {};
  40330. for (var i = 0; i < pathList.length; i++) {
  40331. var path = pathList[i];
  40332. var record$1 = pathMap[path];
  40333. if (matchRoute(record$1.regex, location.path, location.params)) {
  40334. return _createRoute(record$1, location, redirectedFrom)
  40335. }
  40336. }
  40337. }
  40338. // no match
  40339. return _createRoute(null, location)
  40340. }
  40341. function redirect (
  40342. record,
  40343. location
  40344. ) {
  40345. var originalRedirect = record.redirect;
  40346. var redirect = typeof originalRedirect === 'function'
  40347. ? originalRedirect(createRoute(record, location, null, router))
  40348. : originalRedirect;
  40349. if (typeof redirect === 'string') {
  40350. redirect = { path: redirect };
  40351. }
  40352. if (!redirect || typeof redirect !== 'object') {
  40353. if (true) {
  40354. warn(
  40355. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  40356. );
  40357. }
  40358. return _createRoute(null, location)
  40359. }
  40360. var re = redirect;
  40361. var name = re.name;
  40362. var path = re.path;
  40363. var query = location.query;
  40364. var hash = location.hash;
  40365. var params = location.params;
  40366. query = re.hasOwnProperty('query') ? re.query : query;
  40367. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  40368. params = re.hasOwnProperty('params') ? re.params : params;
  40369. if (name) {
  40370. // resolved named direct
  40371. var targetRecord = nameMap[name];
  40372. if (true) {
  40373. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  40374. }
  40375. return match({
  40376. _normalized: true,
  40377. name: name,
  40378. query: query,
  40379. hash: hash,
  40380. params: params
  40381. }, undefined, location)
  40382. } else if (path) {
  40383. // 1. resolve relative redirect
  40384. var rawPath = resolveRecordPath(path, record);
  40385. // 2. resolve params
  40386. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  40387. // 3. rematch with existing query and hash
  40388. return match({
  40389. _normalized: true,
  40390. path: resolvedPath,
  40391. query: query,
  40392. hash: hash
  40393. }, undefined, location)
  40394. } else {
  40395. if (true) {
  40396. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  40397. }
  40398. return _createRoute(null, location)
  40399. }
  40400. }
  40401. function alias (
  40402. record,
  40403. location,
  40404. matchAs
  40405. ) {
  40406. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  40407. var aliasedMatch = match({
  40408. _normalized: true,
  40409. path: aliasedPath
  40410. });
  40411. if (aliasedMatch) {
  40412. var matched = aliasedMatch.matched;
  40413. var aliasedRecord = matched[matched.length - 1];
  40414. location.params = aliasedMatch.params;
  40415. return _createRoute(aliasedRecord, location)
  40416. }
  40417. return _createRoute(null, location)
  40418. }
  40419. function _createRoute (
  40420. record,
  40421. location,
  40422. redirectedFrom
  40423. ) {
  40424. if (record && record.redirect) {
  40425. return redirect(record, redirectedFrom || location)
  40426. }
  40427. if (record && record.matchAs) {
  40428. return alias(record, location, record.matchAs)
  40429. }
  40430. return createRoute(record, location, redirectedFrom, router)
  40431. }
  40432. return {
  40433. match: match,
  40434. addRoutes: addRoutes
  40435. }
  40436. }
  40437. function matchRoute (
  40438. regex,
  40439. path,
  40440. params
  40441. ) {
  40442. var m = path.match(regex);
  40443. if (!m) {
  40444. return false
  40445. } else if (!params) {
  40446. return true
  40447. }
  40448. for (var i = 1, len = m.length; i < len; ++i) {
  40449. var key = regex.keys[i - 1];
  40450. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  40451. if (key) {
  40452. // Fix #1994: using * with props: true generates a param named 0
  40453. params[key.name || 'pathMatch'] = val;
  40454. }
  40455. }
  40456. return true
  40457. }
  40458. function resolveRecordPath (path, record) {
  40459. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  40460. }
  40461. /* */
  40462. var positionStore = Object.create(null);
  40463. function setupScroll () {
  40464. // Fix for #1585 for Firefox
  40465. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  40466. window.history.replaceState({ key: getStateKey() }, '', window.location.href.replace(window.location.origin, ''));
  40467. window.addEventListener('popstate', function (e) {
  40468. saveScrollPosition();
  40469. if (e.state && e.state.key) {
  40470. setStateKey(e.state.key);
  40471. }
  40472. });
  40473. }
  40474. function handleScroll (
  40475. router,
  40476. to,
  40477. from,
  40478. isPop
  40479. ) {
  40480. if (!router.app) {
  40481. return
  40482. }
  40483. var behavior = router.options.scrollBehavior;
  40484. if (!behavior) {
  40485. return
  40486. }
  40487. if (true) {
  40488. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  40489. }
  40490. // wait until re-render finishes before scrolling
  40491. router.app.$nextTick(function () {
  40492. var position = getScrollPosition();
  40493. var shouldScroll = behavior.call(router, to, from, isPop ? position : null);
  40494. if (!shouldScroll) {
  40495. return
  40496. }
  40497. if (typeof shouldScroll.then === 'function') {
  40498. shouldScroll.then(function (shouldScroll) {
  40499. scrollToPosition((shouldScroll), position);
  40500. }).catch(function (err) {
  40501. if (true) {
  40502. assert(false, err.toString());
  40503. }
  40504. });
  40505. } else {
  40506. scrollToPosition(shouldScroll, position);
  40507. }
  40508. });
  40509. }
  40510. function saveScrollPosition () {
  40511. var key = getStateKey();
  40512. if (key) {
  40513. positionStore[key] = {
  40514. x: window.pageXOffset,
  40515. y: window.pageYOffset
  40516. };
  40517. }
  40518. }
  40519. function getScrollPosition () {
  40520. var key = getStateKey();
  40521. if (key) {
  40522. return positionStore[key]
  40523. }
  40524. }
  40525. function getElementPosition (el, offset) {
  40526. var docEl = document.documentElement;
  40527. var docRect = docEl.getBoundingClientRect();
  40528. var elRect = el.getBoundingClientRect();
  40529. return {
  40530. x: elRect.left - docRect.left - offset.x,
  40531. y: elRect.top - docRect.top - offset.y
  40532. }
  40533. }
  40534. function isValidPosition (obj) {
  40535. return isNumber(obj.x) || isNumber(obj.y)
  40536. }
  40537. function normalizePosition (obj) {
  40538. return {
  40539. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  40540. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  40541. }
  40542. }
  40543. function normalizeOffset (obj) {
  40544. return {
  40545. x: isNumber(obj.x) ? obj.x : 0,
  40546. y: isNumber(obj.y) ? obj.y : 0
  40547. }
  40548. }
  40549. function isNumber (v) {
  40550. return typeof v === 'number'
  40551. }
  40552. function scrollToPosition (shouldScroll, position) {
  40553. var isObject = typeof shouldScroll === 'object';
  40554. if (isObject && typeof shouldScroll.selector === 'string') {
  40555. var el = document.querySelector(shouldScroll.selector);
  40556. if (el) {
  40557. var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
  40558. offset = normalizeOffset(offset);
  40559. position = getElementPosition(el, offset);
  40560. } else if (isValidPosition(shouldScroll)) {
  40561. position = normalizePosition(shouldScroll);
  40562. }
  40563. } else if (isObject && isValidPosition(shouldScroll)) {
  40564. position = normalizePosition(shouldScroll);
  40565. }
  40566. if (position) {
  40567. window.scrollTo(position.x, position.y);
  40568. }
  40569. }
  40570. /* */
  40571. var supportsPushState = inBrowser && (function () {
  40572. var ua = window.navigator.userAgent;
  40573. if (
  40574. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  40575. ua.indexOf('Mobile Safari') !== -1 &&
  40576. ua.indexOf('Chrome') === -1 &&
  40577. ua.indexOf('Windows Phone') === -1
  40578. ) {
  40579. return false
  40580. }
  40581. return window.history && 'pushState' in window.history
  40582. })();
  40583. // use User Timing api (if present) for more accurate key precision
  40584. var Time = inBrowser && window.performance && window.performance.now
  40585. ? window.performance
  40586. : Date;
  40587. var _key = genKey();
  40588. function genKey () {
  40589. return Time.now().toFixed(3)
  40590. }
  40591. function getStateKey () {
  40592. return _key
  40593. }
  40594. function setStateKey (key) {
  40595. _key = key;
  40596. }
  40597. function pushState (url, replace) {
  40598. saveScrollPosition();
  40599. // try...catch the pushState call to get around Safari
  40600. // DOM Exception 18 where it limits to 100 pushState calls
  40601. var history = window.history;
  40602. try {
  40603. if (replace) {
  40604. history.replaceState({ key: _key }, '', url);
  40605. } else {
  40606. _key = genKey();
  40607. history.pushState({ key: _key }, '', url);
  40608. }
  40609. } catch (e) {
  40610. window.location[replace ? 'replace' : 'assign'](url);
  40611. }
  40612. }
  40613. function replaceState (url) {
  40614. pushState(url, true);
  40615. }
  40616. /* */
  40617. function runQueue (queue, fn, cb) {
  40618. var step = function (index) {
  40619. if (index >= queue.length) {
  40620. cb();
  40621. } else {
  40622. if (queue[index]) {
  40623. fn(queue[index], function () {
  40624. step(index + 1);
  40625. });
  40626. } else {
  40627. step(index + 1);
  40628. }
  40629. }
  40630. };
  40631. step(0);
  40632. }
  40633. /* */
  40634. function resolveAsyncComponents (matched) {
  40635. return function (to, from, next) {
  40636. var hasAsync = false;
  40637. var pending = 0;
  40638. var error = null;
  40639. flatMapComponents(matched, function (def, _, match, key) {
  40640. // if it's a function and doesn't have cid attached,
  40641. // assume it's an async component resolve function.
  40642. // we are not using Vue's default async resolving mechanism because
  40643. // we want to halt the navigation until the incoming component has been
  40644. // resolved.
  40645. if (typeof def === 'function' && def.cid === undefined) {
  40646. hasAsync = true;
  40647. pending++;
  40648. var resolve = once(function (resolvedDef) {
  40649. if (isESModule(resolvedDef)) {
  40650. resolvedDef = resolvedDef.default;
  40651. }
  40652. // save resolved on async factory in case it's used elsewhere
  40653. def.resolved = typeof resolvedDef === 'function'
  40654. ? resolvedDef
  40655. : _Vue.extend(resolvedDef);
  40656. match.components[key] = resolvedDef;
  40657. pending--;
  40658. if (pending <= 0) {
  40659. next();
  40660. }
  40661. });
  40662. var reject = once(function (reason) {
  40663. var msg = "Failed to resolve async component " + key + ": " + reason;
  40664. "development" !== 'production' && warn(false, msg);
  40665. if (!error) {
  40666. error = isError(reason)
  40667. ? reason
  40668. : new Error(msg);
  40669. next(error);
  40670. }
  40671. });
  40672. var res;
  40673. try {
  40674. res = def(resolve, reject);
  40675. } catch (e) {
  40676. reject(e);
  40677. }
  40678. if (res) {
  40679. if (typeof res.then === 'function') {
  40680. res.then(resolve, reject);
  40681. } else {
  40682. // new syntax in Vue 2.3
  40683. var comp = res.component;
  40684. if (comp && typeof comp.then === 'function') {
  40685. comp.then(resolve, reject);
  40686. }
  40687. }
  40688. }
  40689. }
  40690. });
  40691. if (!hasAsync) { next(); }
  40692. }
  40693. }
  40694. function flatMapComponents (
  40695. matched,
  40696. fn
  40697. ) {
  40698. return flatten(matched.map(function (m) {
  40699. return Object.keys(m.components).map(function (key) { return fn(
  40700. m.components[key],
  40701. m.instances[key],
  40702. m, key
  40703. ); })
  40704. }))
  40705. }
  40706. function flatten (arr) {
  40707. return Array.prototype.concat.apply([], arr)
  40708. }
  40709. var hasSymbol =
  40710. typeof Symbol === 'function' &&
  40711. typeof Symbol.toStringTag === 'symbol';
  40712. function isESModule (obj) {
  40713. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  40714. }
  40715. // in Webpack 2, require.ensure now also returns a Promise
  40716. // so the resolve/reject functions may get called an extra time
  40717. // if the user uses an arrow function shorthand that happens to
  40718. // return that Promise.
  40719. function once (fn) {
  40720. var called = false;
  40721. return function () {
  40722. var args = [], len = arguments.length;
  40723. while ( len-- ) args[ len ] = arguments[ len ];
  40724. if (called) { return }
  40725. called = true;
  40726. return fn.apply(this, args)
  40727. }
  40728. }
  40729. /* */
  40730. var History = function History (router, base) {
  40731. this.router = router;
  40732. this.base = normalizeBase(base);
  40733. // start with a route object that stands for "nowhere"
  40734. this.current = START;
  40735. this.pending = null;
  40736. this.ready = false;
  40737. this.readyCbs = [];
  40738. this.readyErrorCbs = [];
  40739. this.errorCbs = [];
  40740. };
  40741. History.prototype.listen = function listen (cb) {
  40742. this.cb = cb;
  40743. };
  40744. History.prototype.onReady = function onReady (cb, errorCb) {
  40745. if (this.ready) {
  40746. cb();
  40747. } else {
  40748. this.readyCbs.push(cb);
  40749. if (errorCb) {
  40750. this.readyErrorCbs.push(errorCb);
  40751. }
  40752. }
  40753. };
  40754. History.prototype.onError = function onError (errorCb) {
  40755. this.errorCbs.push(errorCb);
  40756. };
  40757. History.prototype.transitionTo = function transitionTo (location, onComplete, onAbort) {
  40758. var this$1 = this;
  40759. var route = this.router.match(location, this.current);
  40760. this.confirmTransition(route, function () {
  40761. this$1.updateRoute(route);
  40762. onComplete && onComplete(route);
  40763. this$1.ensureURL();
  40764. // fire ready cbs once
  40765. if (!this$1.ready) {
  40766. this$1.ready = true;
  40767. this$1.readyCbs.forEach(function (cb) { cb(route); });
  40768. }
  40769. }, function (err) {
  40770. if (onAbort) {
  40771. onAbort(err);
  40772. }
  40773. if (err && !this$1.ready) {
  40774. this$1.ready = true;
  40775. this$1.readyErrorCbs.forEach(function (cb) { cb(err); });
  40776. }
  40777. });
  40778. };
  40779. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  40780. var this$1 = this;
  40781. var current = this.current;
  40782. var abort = function (err) {
  40783. if (isError(err)) {
  40784. if (this$1.errorCbs.length) {
  40785. this$1.errorCbs.forEach(function (cb) { cb(err); });
  40786. } else {
  40787. warn(false, 'uncaught error during route navigation:');
  40788. console.error(err);
  40789. }
  40790. }
  40791. onAbort && onAbort(err);
  40792. };
  40793. if (
  40794. isSameRoute(route, current) &&
  40795. // in the case the route map has been dynamically appended to
  40796. route.matched.length === current.matched.length
  40797. ) {
  40798. this.ensureURL();
  40799. return abort()
  40800. }
  40801. var ref = resolveQueue(this.current.matched, route.matched);
  40802. var updated = ref.updated;
  40803. var deactivated = ref.deactivated;
  40804. var activated = ref.activated;
  40805. var queue = [].concat(
  40806. // in-component leave guards
  40807. extractLeaveGuards(deactivated),
  40808. // global before hooks
  40809. this.router.beforeHooks,
  40810. // in-component update hooks
  40811. extractUpdateHooks(updated),
  40812. // in-config enter guards
  40813. activated.map(function (m) { return m.beforeEnter; }),
  40814. // async components
  40815. resolveAsyncComponents(activated)
  40816. );
  40817. this.pending = route;
  40818. var iterator = function (hook, next) {
  40819. if (this$1.pending !== route) {
  40820. return abort()
  40821. }
  40822. try {
  40823. hook(route, current, function (to) {
  40824. if (to === false || isError(to)) {
  40825. // next(false) -> abort navigation, ensure current URL
  40826. this$1.ensureURL(true);
  40827. abort(to);
  40828. } else if (
  40829. typeof to === 'string' ||
  40830. (typeof to === 'object' && (
  40831. typeof to.path === 'string' ||
  40832. typeof to.name === 'string'
  40833. ))
  40834. ) {
  40835. // next('/') or next({ path: '/' }) -> redirect
  40836. abort();
  40837. if (typeof to === 'object' && to.replace) {
  40838. this$1.replace(to);
  40839. } else {
  40840. this$1.push(to);
  40841. }
  40842. } else {
  40843. // confirm transition and pass on the value
  40844. next(to);
  40845. }
  40846. });
  40847. } catch (e) {
  40848. abort(e);
  40849. }
  40850. };
  40851. runQueue(queue, iterator, function () {
  40852. var postEnterCbs = [];
  40853. var isValid = function () { return this$1.current === route; };
  40854. // wait until async components are resolved before
  40855. // extracting in-component enter guards
  40856. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  40857. var queue = enterGuards.concat(this$1.router.resolveHooks);
  40858. runQueue(queue, iterator, function () {
  40859. if (this$1.pending !== route) {
  40860. return abort()
  40861. }
  40862. this$1.pending = null;
  40863. onComplete(route);
  40864. if (this$1.router.app) {
  40865. this$1.router.app.$nextTick(function () {
  40866. postEnterCbs.forEach(function (cb) { cb(); });
  40867. });
  40868. }
  40869. });
  40870. });
  40871. };
  40872. History.prototype.updateRoute = function updateRoute (route) {
  40873. var prev = this.current;
  40874. this.current = route;
  40875. this.cb && this.cb(route);
  40876. this.router.afterHooks.forEach(function (hook) {
  40877. hook && hook(route, prev);
  40878. });
  40879. };
  40880. function normalizeBase (base) {
  40881. if (!base) {
  40882. if (inBrowser) {
  40883. // respect <base> tag
  40884. var baseEl = document.querySelector('base');
  40885. base = (baseEl && baseEl.getAttribute('href')) || '/';
  40886. // strip full URL origin
  40887. base = base.replace(/^https?:\/\/[^\/]+/, '');
  40888. } else {
  40889. base = '/';
  40890. }
  40891. }
  40892. // make sure there's the starting slash
  40893. if (base.charAt(0) !== '/') {
  40894. base = '/' + base;
  40895. }
  40896. // remove trailing slash
  40897. return base.replace(/\/$/, '')
  40898. }
  40899. function resolveQueue (
  40900. current,
  40901. next
  40902. ) {
  40903. var i;
  40904. var max = Math.max(current.length, next.length);
  40905. for (i = 0; i < max; i++) {
  40906. if (current[i] !== next[i]) {
  40907. break
  40908. }
  40909. }
  40910. return {
  40911. updated: next.slice(0, i),
  40912. activated: next.slice(i),
  40913. deactivated: current.slice(i)
  40914. }
  40915. }
  40916. function extractGuards (
  40917. records,
  40918. name,
  40919. bind,
  40920. reverse
  40921. ) {
  40922. var guards = flatMapComponents(records, function (def, instance, match, key) {
  40923. var guard = extractGuard(def, name);
  40924. if (guard) {
  40925. return Array.isArray(guard)
  40926. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  40927. : bind(guard, instance, match, key)
  40928. }
  40929. });
  40930. return flatten(reverse ? guards.reverse() : guards)
  40931. }
  40932. function extractGuard (
  40933. def,
  40934. key
  40935. ) {
  40936. if (typeof def !== 'function') {
  40937. // extend now so that global mixins are applied.
  40938. def = _Vue.extend(def);
  40939. }
  40940. return def.options[key]
  40941. }
  40942. function extractLeaveGuards (deactivated) {
  40943. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  40944. }
  40945. function extractUpdateHooks (updated) {
  40946. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  40947. }
  40948. function bindGuard (guard, instance) {
  40949. if (instance) {
  40950. return function boundRouteGuard () {
  40951. return guard.apply(instance, arguments)
  40952. }
  40953. }
  40954. }
  40955. function extractEnterGuards (
  40956. activated,
  40957. cbs,
  40958. isValid
  40959. ) {
  40960. return extractGuards(activated, 'beforeRouteEnter', function (guard, _, match, key) {
  40961. return bindEnterGuard(guard, match, key, cbs, isValid)
  40962. })
  40963. }
  40964. function bindEnterGuard (
  40965. guard,
  40966. match,
  40967. key,
  40968. cbs,
  40969. isValid
  40970. ) {
  40971. return function routeEnterGuard (to, from, next) {
  40972. return guard(to, from, function (cb) {
  40973. next(cb);
  40974. if (typeof cb === 'function') {
  40975. cbs.push(function () {
  40976. // #750
  40977. // if a router-view is wrapped with an out-in transition,
  40978. // the instance may not have been registered at this time.
  40979. // we will need to poll for registration until current route
  40980. // is no longer valid.
  40981. poll(cb, match.instances, key, isValid);
  40982. });
  40983. }
  40984. })
  40985. }
  40986. }
  40987. function poll (
  40988. cb, // somehow flow cannot infer this is a function
  40989. instances,
  40990. key,
  40991. isValid
  40992. ) {
  40993. if (
  40994. instances[key] &&
  40995. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  40996. ) {
  40997. cb(instances[key]);
  40998. } else if (isValid()) {
  40999. setTimeout(function () {
  41000. poll(cb, instances, key, isValid);
  41001. }, 16);
  41002. }
  41003. }
  41004. /* */
  41005. var HTML5History = (function (History$$1) {
  41006. function HTML5History (router, base) {
  41007. var this$1 = this;
  41008. History$$1.call(this, router, base);
  41009. var expectScroll = router.options.scrollBehavior;
  41010. var supportsScroll = supportsPushState && expectScroll;
  41011. if (supportsScroll) {
  41012. setupScroll();
  41013. }
  41014. var initLocation = getLocation(this.base);
  41015. window.addEventListener('popstate', function (e) {
  41016. var current = this$1.current;
  41017. // Avoiding first `popstate` event dispatched in some browsers but first
  41018. // history route not updated since async guard at the same time.
  41019. var location = getLocation(this$1.base);
  41020. if (this$1.current === START && location === initLocation) {
  41021. return
  41022. }
  41023. this$1.transitionTo(location, function (route) {
  41024. if (supportsScroll) {
  41025. handleScroll(router, route, current, true);
  41026. }
  41027. });
  41028. });
  41029. }
  41030. if ( History$$1 ) HTML5History.__proto__ = History$$1;
  41031. HTML5History.prototype = Object.create( History$$1 && History$$1.prototype );
  41032. HTML5History.prototype.constructor = HTML5History;
  41033. HTML5History.prototype.go = function go (n) {
  41034. window.history.go(n);
  41035. };
  41036. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  41037. var this$1 = this;
  41038. var ref = this;
  41039. var fromRoute = ref.current;
  41040. this.transitionTo(location, function (route) {
  41041. pushState(cleanPath(this$1.base + route.fullPath));
  41042. handleScroll(this$1.router, route, fromRoute, false);
  41043. onComplete && onComplete(route);
  41044. }, onAbort);
  41045. };
  41046. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  41047. var this$1 = this;
  41048. var ref = this;
  41049. var fromRoute = ref.current;
  41050. this.transitionTo(location, function (route) {
  41051. replaceState(cleanPath(this$1.base + route.fullPath));
  41052. handleScroll(this$1.router, route, fromRoute, false);
  41053. onComplete && onComplete(route);
  41054. }, onAbort);
  41055. };
  41056. HTML5History.prototype.ensureURL = function ensureURL (push) {
  41057. if (getLocation(this.base) !== this.current.fullPath) {
  41058. var current = cleanPath(this.base + this.current.fullPath);
  41059. push ? pushState(current) : replaceState(current);
  41060. }
  41061. };
  41062. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  41063. return getLocation(this.base)
  41064. };
  41065. return HTML5History;
  41066. }(History));
  41067. function getLocation (base) {
  41068. var path = decodeURI(window.location.pathname);
  41069. if (base && path.indexOf(base) === 0) {
  41070. path = path.slice(base.length);
  41071. }
  41072. return (path || '/') + window.location.search + window.location.hash
  41073. }
  41074. /* */
  41075. var HashHistory = (function (History$$1) {
  41076. function HashHistory (router, base, fallback) {
  41077. History$$1.call(this, router, base);
  41078. // check history fallback deeplinking
  41079. if (fallback && checkFallback(this.base)) {
  41080. return
  41081. }
  41082. ensureSlash();
  41083. }
  41084. if ( History$$1 ) HashHistory.__proto__ = History$$1;
  41085. HashHistory.prototype = Object.create( History$$1 && History$$1.prototype );
  41086. HashHistory.prototype.constructor = HashHistory;
  41087. // this is delayed until the app mounts
  41088. // to avoid the hashchange listener being fired too early
  41089. HashHistory.prototype.setupListeners = function setupListeners () {
  41090. var this$1 = this;
  41091. var router = this.router;
  41092. var expectScroll = router.options.scrollBehavior;
  41093. var supportsScroll = supportsPushState && expectScroll;
  41094. if (supportsScroll) {
  41095. setupScroll();
  41096. }
  41097. window.addEventListener(supportsPushState ? 'popstate' : 'hashchange', function () {
  41098. var current = this$1.current;
  41099. if (!ensureSlash()) {
  41100. return
  41101. }
  41102. this$1.transitionTo(getHash(), function (route) {
  41103. if (supportsScroll) {
  41104. handleScroll(this$1.router, route, current, true);
  41105. }
  41106. if (!supportsPushState) {
  41107. replaceHash(route.fullPath);
  41108. }
  41109. });
  41110. });
  41111. };
  41112. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  41113. var this$1 = this;
  41114. var ref = this;
  41115. var fromRoute = ref.current;
  41116. this.transitionTo(location, function (route) {
  41117. pushHash(route.fullPath);
  41118. handleScroll(this$1.router, route, fromRoute, false);
  41119. onComplete && onComplete(route);
  41120. }, onAbort);
  41121. };
  41122. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  41123. var this$1 = this;
  41124. var ref = this;
  41125. var fromRoute = ref.current;
  41126. this.transitionTo(location, function (route) {
  41127. replaceHash(route.fullPath);
  41128. handleScroll(this$1.router, route, fromRoute, false);
  41129. onComplete && onComplete(route);
  41130. }, onAbort);
  41131. };
  41132. HashHistory.prototype.go = function go (n) {
  41133. window.history.go(n);
  41134. };
  41135. HashHistory.prototype.ensureURL = function ensureURL (push) {
  41136. var current = this.current.fullPath;
  41137. if (getHash() !== current) {
  41138. push ? pushHash(current) : replaceHash(current);
  41139. }
  41140. };
  41141. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  41142. return getHash()
  41143. };
  41144. return HashHistory;
  41145. }(History));
  41146. function checkFallback (base) {
  41147. var location = getLocation(base);
  41148. if (!/^\/#/.test(location)) {
  41149. window.location.replace(
  41150. cleanPath(base + '/#' + location)
  41151. );
  41152. return true
  41153. }
  41154. }
  41155. function ensureSlash () {
  41156. var path = getHash();
  41157. if (path.charAt(0) === '/') {
  41158. return true
  41159. }
  41160. replaceHash('/' + path);
  41161. return false
  41162. }
  41163. function getHash () {
  41164. // We can't use window.location.hash here because it's not
  41165. // consistent across browsers - Firefox will pre-decode it!
  41166. var href = window.location.href;
  41167. var index = href.indexOf('#');
  41168. return index === -1 ? '' : decodeURI(href.slice(index + 1))
  41169. }
  41170. function getUrl (path) {
  41171. var href = window.location.href;
  41172. var i = href.indexOf('#');
  41173. var base = i >= 0 ? href.slice(0, i) : href;
  41174. return (base + "#" + path)
  41175. }
  41176. function pushHash (path) {
  41177. if (supportsPushState) {
  41178. pushState(getUrl(path));
  41179. } else {
  41180. window.location.hash = path;
  41181. }
  41182. }
  41183. function replaceHash (path) {
  41184. if (supportsPushState) {
  41185. replaceState(getUrl(path));
  41186. } else {
  41187. window.location.replace(getUrl(path));
  41188. }
  41189. }
  41190. /* */
  41191. var AbstractHistory = (function (History$$1) {
  41192. function AbstractHistory (router, base) {
  41193. History$$1.call(this, router, base);
  41194. this.stack = [];
  41195. this.index = -1;
  41196. }
  41197. if ( History$$1 ) AbstractHistory.__proto__ = History$$1;
  41198. AbstractHistory.prototype = Object.create( History$$1 && History$$1.prototype );
  41199. AbstractHistory.prototype.constructor = AbstractHistory;
  41200. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  41201. var this$1 = this;
  41202. this.transitionTo(location, function (route) {
  41203. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  41204. this$1.index++;
  41205. onComplete && onComplete(route);
  41206. }, onAbort);
  41207. };
  41208. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  41209. var this$1 = this;
  41210. this.transitionTo(location, function (route) {
  41211. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  41212. onComplete && onComplete(route);
  41213. }, onAbort);
  41214. };
  41215. AbstractHistory.prototype.go = function go (n) {
  41216. var this$1 = this;
  41217. var targetIndex = this.index + n;
  41218. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  41219. return
  41220. }
  41221. var route = this.stack[targetIndex];
  41222. this.confirmTransition(route, function () {
  41223. this$1.index = targetIndex;
  41224. this$1.updateRoute(route);
  41225. });
  41226. };
  41227. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  41228. var current = this.stack[this.stack.length - 1];
  41229. return current ? current.fullPath : '/'
  41230. };
  41231. AbstractHistory.prototype.ensureURL = function ensureURL () {
  41232. // noop
  41233. };
  41234. return AbstractHistory;
  41235. }(History));
  41236. /* */
  41237. var VueRouter = function VueRouter (options) {
  41238. if ( options === void 0 ) options = {};
  41239. this.app = null;
  41240. this.apps = [];
  41241. this.options = options;
  41242. this.beforeHooks = [];
  41243. this.resolveHooks = [];
  41244. this.afterHooks = [];
  41245. this.matcher = createMatcher(options.routes || [], this);
  41246. var mode = options.mode || 'hash';
  41247. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  41248. if (this.fallback) {
  41249. mode = 'hash';
  41250. }
  41251. if (!inBrowser) {
  41252. mode = 'abstract';
  41253. }
  41254. this.mode = mode;
  41255. switch (mode) {
  41256. case 'history':
  41257. this.history = new HTML5History(this, options.base);
  41258. break
  41259. case 'hash':
  41260. this.history = new HashHistory(this, options.base, this.fallback);
  41261. break
  41262. case 'abstract':
  41263. this.history = new AbstractHistory(this, options.base);
  41264. break
  41265. default:
  41266. if (true) {
  41267. assert(false, ("invalid mode: " + mode));
  41268. }
  41269. }
  41270. };
  41271. var prototypeAccessors = { currentRoute: { configurable: true } };
  41272. VueRouter.prototype.match = function match (
  41273. raw,
  41274. current,
  41275. redirectedFrom
  41276. ) {
  41277. return this.matcher.match(raw, current, redirectedFrom)
  41278. };
  41279. prototypeAccessors.currentRoute.get = function () {
  41280. return this.history && this.history.current
  41281. };
  41282. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  41283. var this$1 = this;
  41284. "development" !== 'production' && assert(
  41285. install.installed,
  41286. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  41287. "before creating root instance."
  41288. );
  41289. this.apps.push(app);
  41290. // main app already initialized.
  41291. if (this.app) {
  41292. return
  41293. }
  41294. this.app = app;
  41295. var history = this.history;
  41296. if (history instanceof HTML5History) {
  41297. history.transitionTo(history.getCurrentLocation());
  41298. } else if (history instanceof HashHistory) {
  41299. var setupHashListener = function () {
  41300. history.setupListeners();
  41301. };
  41302. history.transitionTo(
  41303. history.getCurrentLocation(),
  41304. setupHashListener,
  41305. setupHashListener
  41306. );
  41307. }
  41308. history.listen(function (route) {
  41309. this$1.apps.forEach(function (app) {
  41310. app._route = route;
  41311. });
  41312. });
  41313. };
  41314. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  41315. return registerHook(this.beforeHooks, fn)
  41316. };
  41317. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  41318. return registerHook(this.resolveHooks, fn)
  41319. };
  41320. VueRouter.prototype.afterEach = function afterEach (fn) {
  41321. return registerHook(this.afterHooks, fn)
  41322. };
  41323. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  41324. this.history.onReady(cb, errorCb);
  41325. };
  41326. VueRouter.prototype.onError = function onError (errorCb) {
  41327. this.history.onError(errorCb);
  41328. };
  41329. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  41330. this.history.push(location, onComplete, onAbort);
  41331. };
  41332. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  41333. this.history.replace(location, onComplete, onAbort);
  41334. };
  41335. VueRouter.prototype.go = function go (n) {
  41336. this.history.go(n);
  41337. };
  41338. VueRouter.prototype.back = function back () {
  41339. this.go(-1);
  41340. };
  41341. VueRouter.prototype.forward = function forward () {
  41342. this.go(1);
  41343. };
  41344. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  41345. var route = to
  41346. ? to.matched
  41347. ? to
  41348. : this.resolve(to).route
  41349. : this.currentRoute;
  41350. if (!route) {
  41351. return []
  41352. }
  41353. return [].concat.apply([], route.matched.map(function (m) {
  41354. return Object.keys(m.components).map(function (key) {
  41355. return m.components[key]
  41356. })
  41357. }))
  41358. };
  41359. VueRouter.prototype.resolve = function resolve (
  41360. to,
  41361. current,
  41362. append
  41363. ) {
  41364. var location = normalizeLocation(
  41365. to,
  41366. current || this.history.current,
  41367. append,
  41368. this
  41369. );
  41370. var route = this.match(location, current);
  41371. var fullPath = route.redirectedFrom || route.fullPath;
  41372. var base = this.history.base;
  41373. var href = createHref(base, fullPath, this.mode);
  41374. return {
  41375. location: location,
  41376. route: route,
  41377. href: href,
  41378. // for backwards compat
  41379. normalizedTo: location,
  41380. resolved: route
  41381. }
  41382. };
  41383. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  41384. this.matcher.addRoutes(routes);
  41385. if (this.history.current !== START) {
  41386. this.history.transitionTo(this.history.getCurrentLocation());
  41387. }
  41388. };
  41389. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  41390. function registerHook (list, fn) {
  41391. list.push(fn);
  41392. return function () {
  41393. var i = list.indexOf(fn);
  41394. if (i > -1) { list.splice(i, 1); }
  41395. }
  41396. }
  41397. function createHref (base, fullPath, mode) {
  41398. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  41399. return base ? cleanPath(base + '/' + path) : path
  41400. }
  41401. VueRouter.install = install;
  41402. VueRouter.version = '3.0.2';
  41403. if (inBrowser && window.Vue) {
  41404. window.Vue.use(VueRouter);
  41405. }
  41406. /* harmony default export */ __webpack_exports__["a"] = (VueRouter);
  41407. /***/ }),
  41408. /* 42 */
  41409. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  41410. "use strict";
  41411. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(5);
  41412. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
  41413. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vuex__ = __webpack_require__(1);
  41414. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__news__ = __webpack_require__(43);
  41415. __WEBPACK_IMPORTED_MODULE_0_vue___default.a.use(__WEBPACK_IMPORTED_MODULE_1_vuex__["a" /* default */]);
  41416. /* harmony default export */ __webpack_exports__["a"] = (new __WEBPACK_IMPORTED_MODULE_1_vuex__["a" /* default */].Store({
  41417. // 可以设置多个模块
  41418. modules: {
  41419. news: __WEBPACK_IMPORTED_MODULE_2__news__["a" /* default */]
  41420. }
  41421. }));
  41422. /***/ }),
  41423. /* 43 */
  41424. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  41425. "use strict";
  41426. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(44);
  41427. /* harmony default export */ __webpack_exports__["a"] = ({
  41428. state: {
  41429. recommend: [], // 推荐
  41430. lists: [], // 列表
  41431. detail: {} // 详情
  41432. },
  41433. mutations: {
  41434. // 注意,这里可以设置 state 属性,但是不能异步调用,异步操作写到 actions 中
  41435. SETRECOMMEND: function SETRECOMMEND(state, lists) {
  41436. state.recommend = lists;
  41437. },
  41438. SETLISTS: function SETLISTS(state, lists) {
  41439. state.lists = lists;
  41440. },
  41441. SETDETAIL: function SETDETAIL(state, detail) {
  41442. state.detail = detail;
  41443. }
  41444. },
  41445. actions: {
  41446. getNewsDetail: function getNewsDetail(_ref, id) {
  41447. var commit = _ref.commit;
  41448. // 获取详情,并调用 mutations 设置 detail
  41449. __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].getNewsDetail(id).then(function (res) {
  41450. commit('SETDETAIL', res.data);
  41451. document.body.scrollTop = 0;
  41452. });
  41453. },
  41454. getNewsRecommend: function getNewsRecommend(_ref2) {
  41455. var commit = _ref2.commit;
  41456. __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].getNewsRecommend().then(function (res) {
  41457. commit('SETRECOMMEND', res.data);
  41458. });
  41459. },
  41460. getNewsLists: function getNewsLists(_ref3) {
  41461. var commit = _ref3.commit;
  41462. __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].getNewsLists().then(function (res) {
  41463. commit('SETLISTS', res.data);
  41464. });
  41465. }
  41466. }
  41467. });
  41468. /***/ }),
  41469. /* 44 */
  41470. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  41471. "use strict";
  41472. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_axios__ = __webpack_require__(6);
  41473. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_axios__);
  41474. /* harmony default export */ __webpack_exports__["a"] = ({
  41475. // 首页推荐接口
  41476. getNewsRecommend: function getNewsRecommend(params) {
  41477. return __WEBPACK_IMPORTED_MODULE_0_axios___default.a.get('api/article/recommend', {
  41478. params: params
  41479. });
  41480. },
  41481. // 列表接口
  41482. getNewsLists: function getNewsLists(params) {
  41483. return __WEBPACK_IMPORTED_MODULE_0_axios___default.a.get('api/article/index', {
  41484. params: params
  41485. });
  41486. },
  41487. // 详情接口
  41488. getNewsDetail: function getNewsDetail(id) {
  41489. return __WEBPACK_IMPORTED_MODULE_0_axios___default.a.get('api/article/' + id);
  41490. }
  41491. });
  41492. /***/ }),
  41493. /* 45 */
  41494. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  41495. "use strict";
  41496. /* harmony default export */ __webpack_exports__["a"] = ([{ path: '', redirect: '/index' }, { path: '/index', component: __webpack_require__(46) }, { path: '/list', component: __webpack_require__(49) }, { path: '/detail/:id', component: __webpack_require__(52) }]);
  41497. /***/ }),
  41498. /* 46 */
  41499. /***/ (function(module, exports, __webpack_require__) {
  41500. var disposed = false
  41501. var normalizeComponent = __webpack_require__(3)
  41502. /* script */
  41503. var __vue_script__ = __webpack_require__(47)
  41504. /* template */
  41505. var __vue_template__ = __webpack_require__(48)
  41506. /* template functional */
  41507. var __vue_template_functional__ = false
  41508. /* styles */
  41509. var __vue_styles__ = null
  41510. /* scopeId */
  41511. var __vue_scopeId__ = null
  41512. /* moduleIdentifier (server only) */
  41513. var __vue_module_identifier__ = null
  41514. var Component = normalizeComponent(
  41515. __vue_script__,
  41516. __vue_template__,
  41517. __vue_template_functional__,
  41518. __vue_styles__,
  41519. __vue_scopeId__,
  41520. __vue_module_identifier__
  41521. )
  41522. Component.options.__file = "resources/assets/js/pages/App.vue"
  41523. /* hot reload */
  41524. if (false) {(function () {
  41525. var hotAPI = require("vue-hot-reload-api")
  41526. hotAPI.install(require("vue"), false)
  41527. if (!hotAPI.compatible) return
  41528. module.hot.accept()
  41529. if (!module.hot.data) {
  41530. hotAPI.createRecord("data-v-78e75c74", Component.options)
  41531. } else {
  41532. hotAPI.reload("data-v-78e75c74", Component.options)
  41533. }
  41534. module.hot.dispose(function (data) {
  41535. disposed = true
  41536. })
  41537. })()}
  41538. module.exports = Component.exports
  41539. /***/ }),
  41540. /* 47 */
  41541. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  41542. "use strict";
  41543. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  41544. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vuex__ = __webpack_require__(1);
  41545. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  41546. //
  41547. //
  41548. //
  41549. //
  41550. //
  41551. //
  41552. //
  41553. //
  41554. //
  41555. //
  41556. //
  41557. //
  41558. //
  41559. //
  41560. //
  41561. //
  41562. //
  41563. //
  41564. //
  41565. //
  41566. //
  41567. //
  41568. //
  41569. //
  41570. //
  41571. //
  41572. //
  41573. //
  41574. //
  41575. //
  41576. //
  41577. //
  41578. //
  41579. //
  41580. //
  41581. //
  41582. //
  41583. //
  41584. //
  41585. //
  41586. //
  41587. //
  41588. //
  41589. //
  41590. /* harmony default export */ __webpack_exports__["default"] = ({
  41591. // 映射 vuex 上面的属性
  41592. computed: Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["c" /* mapState */])({
  41593. recommend: function recommend(state) {
  41594. return state.news.recommend;
  41595. }
  41596. }),
  41597. created: function created() {
  41598. // 获取推荐列表
  41599. //this.getNewsRecommend();
  41600. },
  41601. methods: _extends({}, Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["b" /* mapActions */])(['getNewsRecommend']))
  41602. });
  41603. /***/ }),
  41604. /* 48 */
  41605. /***/ (function(module, exports, __webpack_require__) {
  41606. var render = function() {
  41607. var _vm = this
  41608. var _h = _vm.$createElement
  41609. var _c = _vm._self._c || _h
  41610. return _c(
  41611. "div",
  41612. [
  41613. _c("wv-search-bar", {
  41614. attrs: { autofocus: false, result: _vm.filterResult },
  41615. model: {
  41616. value: _vm.value,
  41617. callback: function($$v) {
  41618. _vm.value = $$v
  41619. },
  41620. expression: "value"
  41621. }
  41622. }),
  41623. _vm._v(" "),
  41624. _c(
  41625. "wv-swipe",
  41626. { attrs: { height: 130, autoplay: 4000 } },
  41627. [
  41628. _c(
  41629. "wv-swipe-item",
  41630. { staticStyle: { "background-color": "#f44336" } },
  41631. [_vm._v("1")]
  41632. ),
  41633. _vm._v(" "),
  41634. _c(
  41635. "wv-swipe-item",
  41636. { staticStyle: { "background-color": "#ffc107" } },
  41637. [_vm._v("2")]
  41638. ),
  41639. _vm._v(" "),
  41640. _c(
  41641. "wv-swipe-item",
  41642. { staticStyle: { "background-color": "#03a9f4" } },
  41643. [_vm._v("3")]
  41644. )
  41645. ],
  41646. 1
  41647. ),
  41648. _vm._v(" "),
  41649. _c(
  41650. "wv-grid",
  41651. [
  41652. _c("wv-grid-item", { attrs: { to: "/" } }, [
  41653. _c("img", {
  41654. attrs: { slot: "icon", src: _vm.thumbSmall },
  41655. slot: "icon"
  41656. }),
  41657. _vm._v(" "),
  41658. _c("span", { attrs: { slot: "label" }, slot: "label" }, [
  41659. _vm._v("问答")
  41660. ])
  41661. ]),
  41662. _vm._v(" "),
  41663. _c("wv-grid-item", { attrs: { url: "/" } }, [
  41664. _c("img", {
  41665. attrs: { slot: "icon", src: _vm.thumbSmall },
  41666. slot: "icon"
  41667. }),
  41668. _vm._v(" "),
  41669. _c("span", { attrs: { slot: "label" }, slot: "label" }, [
  41670. _vm._v("文章")
  41671. ])
  41672. ]),
  41673. _vm._v(" "),
  41674. _c("wv-grid-item", [
  41675. _c("img", {
  41676. attrs: { slot: "icon", src: _vm.thumbSmall },
  41677. slot: "icon"
  41678. }),
  41679. _vm._v(" "),
  41680. _c("span", { attrs: { slot: "label" }, slot: "label" }, [
  41681. _vm._v("课程")
  41682. ])
  41683. ])
  41684. ],
  41685. 1
  41686. ),
  41687. _vm._v(" "),
  41688. _c(
  41689. "wv-panel",
  41690. { attrs: { title: "推荐问题" } },
  41691. [
  41692. _c(
  41693. "wv-media-box",
  41694. {
  41695. attrs: {
  41696. thumb: _vm.thumb,
  41697. title:
  41698. "首页最佳推荐轮播图,右边的推荐文章列表,是在哪边添加的呢",
  41699. description: _vm.description,
  41700. to: "/",
  41701. type: "text"
  41702. }
  41703. },
  41704. [
  41705. _c(
  41706. "ul",
  41707. {
  41708. staticClass: "weui-media-box__info",
  41709. attrs: { slot: "box_ft" },
  41710. slot: "box_ft"
  41711. },
  41712. [
  41713. _c("li", { staticClass: "weui-media-box__info__meta" }, [
  41714. _vm._v("时间")
  41715. ]),
  41716. _vm._v(" "),
  41717. _c(
  41718. "li",
  41719. {
  41720. staticClass:
  41721. "weui-media-box__info__meta weui-media-box__info__meta_extra"
  41722. },
  41723. [_vm._v("其它信息")]
  41724. )
  41725. ]
  41726. )
  41727. ]
  41728. ),
  41729. _vm._v(" "),
  41730. _c(
  41731. "wv-media-box",
  41732. {
  41733. attrs: {
  41734. thumb: _vm.thumb,
  41735. title:
  41736. "首页最佳推荐轮播图,右边的推荐文章列表,是在哪边添加的呢",
  41737. description: _vm.description,
  41738. to: "/",
  41739. type: "text"
  41740. }
  41741. },
  41742. [
  41743. _c(
  41744. "ul",
  41745. {
  41746. staticClass: "weui-media-box__info",
  41747. attrs: { slot: "box_ft" },
  41748. slot: "box_ft"
  41749. },
  41750. [
  41751. _c("li", { staticClass: "weui-media-box__info__meta" }, [
  41752. _vm._v("时间")
  41753. ]),
  41754. _vm._v(" "),
  41755. _c(
  41756. "li",
  41757. {
  41758. staticClass:
  41759. "weui-media-box__info__meta weui-media-box__info__meta_extra"
  41760. },
  41761. [_vm._v("其它信息")]
  41762. )
  41763. ]
  41764. )
  41765. ]
  41766. )
  41767. ],
  41768. 1
  41769. )
  41770. ],
  41771. 1
  41772. )
  41773. }
  41774. var staticRenderFns = []
  41775. render._withStripped = true
  41776. module.exports = { render: render, staticRenderFns: staticRenderFns }
  41777. if (false) {
  41778. module.hot.accept()
  41779. if (module.hot.data) {
  41780. require("vue-hot-reload-api") .rerender("data-v-78e75c74", module.exports)
  41781. }
  41782. }
  41783. /***/ }),
  41784. /* 49 */
  41785. /***/ (function(module, exports, __webpack_require__) {
  41786. var disposed = false
  41787. var normalizeComponent = __webpack_require__(3)
  41788. /* script */
  41789. var __vue_script__ = __webpack_require__(50)
  41790. /* template */
  41791. var __vue_template__ = __webpack_require__(51)
  41792. /* template functional */
  41793. var __vue_template_functional__ = false
  41794. /* styles */
  41795. var __vue_styles__ = null
  41796. /* scopeId */
  41797. var __vue_scopeId__ = null
  41798. /* moduleIdentifier (server only) */
  41799. var __vue_module_identifier__ = null
  41800. var Component = normalizeComponent(
  41801. __vue_script__,
  41802. __vue_template__,
  41803. __vue_template_functional__,
  41804. __vue_styles__,
  41805. __vue_scopeId__,
  41806. __vue_module_identifier__
  41807. )
  41808. Component.options.__file = "resources/assets/js/pages/List.vue"
  41809. /* hot reload */
  41810. if (false) {(function () {
  41811. var hotAPI = require("vue-hot-reload-api")
  41812. hotAPI.install(require("vue"), false)
  41813. if (!hotAPI.compatible) return
  41814. module.hot.accept()
  41815. if (!module.hot.data) {
  41816. hotAPI.createRecord("data-v-9d84794a", Component.options)
  41817. } else {
  41818. hotAPI.reload("data-v-9d84794a", Component.options)
  41819. }
  41820. module.hot.dispose(function (data) {
  41821. disposed = true
  41822. })
  41823. })()}
  41824. module.exports = Component.exports
  41825. /***/ }),
  41826. /* 50 */
  41827. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  41828. "use strict";
  41829. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  41830. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vuex__ = __webpack_require__(1);
  41831. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  41832. //
  41833. //
  41834. //
  41835. //
  41836. //
  41837. //
  41838. //
  41839. //
  41840. //
  41841. //
  41842. //
  41843. //
  41844. //
  41845. //
  41846. //
  41847. /* harmony default export */ __webpack_exports__["default"] = ({
  41848. computed: Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["c" /* mapState */])({
  41849. lists: function lists(state) {
  41850. return state.news.lists;
  41851. }
  41852. }),
  41853. created: function created() {
  41854. this.getNewsLists();
  41855. },
  41856. methods: _extends({}, Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["b" /* mapActions */])(['getNewsLists']))
  41857. });
  41858. /***/ }),
  41859. /* 51 */
  41860. /***/ (function(module, exports, __webpack_require__) {
  41861. var render = function() {
  41862. var _vm = this
  41863. var _h = _vm.$createElement
  41864. var _c = _vm._self._c || _h
  41865. return _c("div", { staticClass: "panel panel-default" }, [
  41866. _c("div", { staticClass: "panel-heading" }, [_vm._v("新闻列表")]),
  41867. _vm._v(" "),
  41868. _c(
  41869. "ul",
  41870. { staticClass: "list-group" },
  41871. _vm._l(_vm.lists, function(row) {
  41872. return _c(
  41873. "li",
  41874. { staticClass: "list-group-item" },
  41875. [
  41876. _c(
  41877. "router-link",
  41878. { attrs: { to: { path: "/detail/" + row.id } } },
  41879. [
  41880. row.is_recommend
  41881. ? _c("span", { staticClass: "label label-success" }, [
  41882. _vm._v("推荐")
  41883. ])
  41884. : _vm._e(),
  41885. _vm._v(
  41886. "\n " + _vm._s(row.title) + "\n "
  41887. )
  41888. ]
  41889. ),
  41890. _vm._v(" "),
  41891. _c("span", { staticClass: "pull-right" }, [
  41892. _vm._v(_vm._s(row.created))
  41893. ])
  41894. ],
  41895. 1
  41896. )
  41897. }),
  41898. 0
  41899. )
  41900. ])
  41901. }
  41902. var staticRenderFns = []
  41903. render._withStripped = true
  41904. module.exports = { render: render, staticRenderFns: staticRenderFns }
  41905. if (false) {
  41906. module.hot.accept()
  41907. if (module.hot.data) {
  41908. require("vue-hot-reload-api") .rerender("data-v-9d84794a", module.exports)
  41909. }
  41910. }
  41911. /***/ }),
  41912. /* 52 */
  41913. /***/ (function(module, exports, __webpack_require__) {
  41914. var disposed = false
  41915. function injectStyle (ssrContext) {
  41916. if (disposed) return
  41917. __webpack_require__(53)
  41918. }
  41919. var normalizeComponent = __webpack_require__(3)
  41920. /* script */
  41921. var __vue_script__ = __webpack_require__(58)
  41922. /* template */
  41923. var __vue_template__ = __webpack_require__(59)
  41924. /* template functional */
  41925. var __vue_template_functional__ = false
  41926. /* styles */
  41927. var __vue_styles__ = injectStyle
  41928. /* scopeId */
  41929. var __vue_scopeId__ = null
  41930. /* moduleIdentifier (server only) */
  41931. var __vue_module_identifier__ = null
  41932. var Component = normalizeComponent(
  41933. __vue_script__,
  41934. __vue_template__,
  41935. __vue_template_functional__,
  41936. __vue_styles__,
  41937. __vue_scopeId__,
  41938. __vue_module_identifier__
  41939. )
  41940. Component.options.__file = "resources/assets/js/pages/Detail.vue"
  41941. /* hot reload */
  41942. if (false) {(function () {
  41943. var hotAPI = require("vue-hot-reload-api")
  41944. hotAPI.install(require("vue"), false)
  41945. if (!hotAPI.compatible) return
  41946. module.hot.accept()
  41947. if (!module.hot.data) {
  41948. hotAPI.createRecord("data-v-4448e44e", Component.options)
  41949. } else {
  41950. hotAPI.reload("data-v-4448e44e", Component.options)
  41951. }
  41952. module.hot.dispose(function (data) {
  41953. disposed = true
  41954. })
  41955. })()}
  41956. module.exports = Component.exports
  41957. /***/ }),
  41958. /* 53 */
  41959. /***/ (function(module, exports, __webpack_require__) {
  41960. // style-loader: Adds some css to the DOM by adding a <style> tag
  41961. // load the styles
  41962. var content = __webpack_require__(54);
  41963. if(typeof content === 'string') content = [[module.i, content, '']];
  41964. if(content.locals) module.exports = content.locals;
  41965. // add the styles to the DOM
  41966. var update = __webpack_require__(56)("c26b72ba", content, false, {});
  41967. // Hot Module Replacement
  41968. if(false) {
  41969. // When the styles change, update the <style> tags
  41970. if(!content.locals) {
  41971. module.hot.accept("!!../../../../node_modules/css-loader/index.js!../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-4448e44e\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Detail.vue", function() {
  41972. var newContent = require("!!../../../../node_modules/css-loader/index.js!../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-4448e44e\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Detail.vue");
  41973. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  41974. update(newContent);
  41975. });
  41976. }
  41977. // When the module is disposed, remove the <style> tags
  41978. module.hot.dispose(function() { update(); });
  41979. }
  41980. /***/ }),
  41981. /* 54 */
  41982. /***/ (function(module, exports, __webpack_require__) {
  41983. exports = module.exports = __webpack_require__(55)(false);
  41984. // imports
  41985. // module
  41986. exports.push([module.i, "\n.breadcrumb{\n padding: 8px 0;\n}\n", ""]);
  41987. // exports
  41988. /***/ }),
  41989. /* 55 */
  41990. /***/ (function(module, exports) {
  41991. /*
  41992. MIT License http://www.opensource.org/licenses/mit-license.php
  41993. Author Tobias Koppers @sokra
  41994. */
  41995. // css base code, injected by the css-loader
  41996. module.exports = function(useSourceMap) {
  41997. var list = [];
  41998. // return the list of modules as css string
  41999. list.toString = function toString() {
  42000. return this.map(function (item) {
  42001. var content = cssWithMappingToString(item, useSourceMap);
  42002. if(item[2]) {
  42003. return "@media " + item[2] + "{" + content + "}";
  42004. } else {
  42005. return content;
  42006. }
  42007. }).join("");
  42008. };
  42009. // import a list of modules into the list
  42010. list.i = function(modules, mediaQuery) {
  42011. if(typeof modules === "string")
  42012. modules = [[null, modules, ""]];
  42013. var alreadyImportedModules = {};
  42014. for(var i = 0; i < this.length; i++) {
  42015. var id = this[i][0];
  42016. if(typeof id === "number")
  42017. alreadyImportedModules[id] = true;
  42018. }
  42019. for(i = 0; i < modules.length; i++) {
  42020. var item = modules[i];
  42021. // skip already imported module
  42022. // this implementation is not 100% perfect for weird media query combinations
  42023. // when a module is imported multiple times with different media queries.
  42024. // I hope this will never occur (Hey this way we have smaller bundles)
  42025. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  42026. if(mediaQuery && !item[2]) {
  42027. item[2] = mediaQuery;
  42028. } else if(mediaQuery) {
  42029. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  42030. }
  42031. list.push(item);
  42032. }
  42033. }
  42034. };
  42035. return list;
  42036. };
  42037. function cssWithMappingToString(item, useSourceMap) {
  42038. var content = item[1] || '';
  42039. var cssMapping = item[3];
  42040. if (!cssMapping) {
  42041. return content;
  42042. }
  42043. if (useSourceMap && typeof btoa === 'function') {
  42044. var sourceMapping = toComment(cssMapping);
  42045. var sourceURLs = cssMapping.sources.map(function (source) {
  42046. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  42047. });
  42048. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  42049. }
  42050. return [content].join('\n');
  42051. }
  42052. // Adapted from convert-source-map (MIT)
  42053. function toComment(sourceMap) {
  42054. // eslint-disable-next-line no-undef
  42055. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  42056. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  42057. return '/*# ' + data + ' */';
  42058. }
  42059. /***/ }),
  42060. /* 56 */
  42061. /***/ (function(module, exports, __webpack_require__) {
  42062. /*
  42063. MIT License http://www.opensource.org/licenses/mit-license.php
  42064. Author Tobias Koppers @sokra
  42065. Modified by Evan You @yyx990803
  42066. */
  42067. var hasDocument = typeof document !== 'undefined'
  42068. if (typeof DEBUG !== 'undefined' && DEBUG) {
  42069. if (!hasDocument) {
  42070. throw new Error(
  42071. 'vue-style-loader cannot be used in a non-browser environment. ' +
  42072. "Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
  42073. ) }
  42074. }
  42075. var listToStyles = __webpack_require__(57)
  42076. /*
  42077. type StyleObject = {
  42078. id: number;
  42079. parts: Array<StyleObjectPart>
  42080. }
  42081. type StyleObjectPart = {
  42082. css: string;
  42083. media: string;
  42084. sourceMap: ?string
  42085. }
  42086. */
  42087. var stylesInDom = {/*
  42088. [id: number]: {
  42089. id: number,
  42090. refs: number,
  42091. parts: Array<(obj?: StyleObjectPart) => void>
  42092. }
  42093. */}
  42094. var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
  42095. var singletonElement = null
  42096. var singletonCounter = 0
  42097. var isProduction = false
  42098. var noop = function () {}
  42099. var options = null
  42100. var ssrIdKey = 'data-vue-ssr-id'
  42101. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  42102. // tags it will allow on a page
  42103. var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
  42104. module.exports = function (parentId, list, _isProduction, _options) {
  42105. isProduction = _isProduction
  42106. options = _options || {}
  42107. var styles = listToStyles(parentId, list)
  42108. addStylesToDom(styles)
  42109. return function update (newList) {
  42110. var mayRemove = []
  42111. for (var i = 0; i < styles.length; i++) {
  42112. var item = styles[i]
  42113. var domStyle = stylesInDom[item.id]
  42114. domStyle.refs--
  42115. mayRemove.push(domStyle)
  42116. }
  42117. if (newList) {
  42118. styles = listToStyles(parentId, newList)
  42119. addStylesToDom(styles)
  42120. } else {
  42121. styles = []
  42122. }
  42123. for (var i = 0; i < mayRemove.length; i++) {
  42124. var domStyle = mayRemove[i]
  42125. if (domStyle.refs === 0) {
  42126. for (var j = 0; j < domStyle.parts.length; j++) {
  42127. domStyle.parts[j]()
  42128. }
  42129. delete stylesInDom[domStyle.id]
  42130. }
  42131. }
  42132. }
  42133. }
  42134. function addStylesToDom (styles /* Array<StyleObject> */) {
  42135. for (var i = 0; i < styles.length; i++) {
  42136. var item = styles[i]
  42137. var domStyle = stylesInDom[item.id]
  42138. if (domStyle) {
  42139. domStyle.refs++
  42140. for (var j = 0; j < domStyle.parts.length; j++) {
  42141. domStyle.parts[j](item.parts[j])
  42142. }
  42143. for (; j < item.parts.length; j++) {
  42144. domStyle.parts.push(addStyle(item.parts[j]))
  42145. }
  42146. if (domStyle.parts.length > item.parts.length) {
  42147. domStyle.parts.length = item.parts.length
  42148. }
  42149. } else {
  42150. var parts = []
  42151. for (var j = 0; j < item.parts.length; j++) {
  42152. parts.push(addStyle(item.parts[j]))
  42153. }
  42154. stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
  42155. }
  42156. }
  42157. }
  42158. function createStyleElement () {
  42159. var styleElement = document.createElement('style')
  42160. styleElement.type = 'text/css'
  42161. head.appendChild(styleElement)
  42162. return styleElement
  42163. }
  42164. function addStyle (obj /* StyleObjectPart */) {
  42165. var update, remove
  42166. var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
  42167. if (styleElement) {
  42168. if (isProduction) {
  42169. // has SSR styles and in production mode.
  42170. // simply do nothing.
  42171. return noop
  42172. } else {
  42173. // has SSR styles but in dev mode.
  42174. // for some reason Chrome can't handle source map in server-rendered
  42175. // style tags - source maps in <style> only works if the style tag is
  42176. // created and inserted dynamically. So we remove the server rendered
  42177. // styles and inject new ones.
  42178. styleElement.parentNode.removeChild(styleElement)
  42179. }
  42180. }
  42181. if (isOldIE) {
  42182. // use singleton mode for IE9.
  42183. var styleIndex = singletonCounter++
  42184. styleElement = singletonElement || (singletonElement = createStyleElement())
  42185. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
  42186. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
  42187. } else {
  42188. // use multi-style-tag mode in all other cases
  42189. styleElement = createStyleElement()
  42190. update = applyToTag.bind(null, styleElement)
  42191. remove = function () {
  42192. styleElement.parentNode.removeChild(styleElement)
  42193. }
  42194. }
  42195. update(obj)
  42196. return function updateStyle (newObj /* StyleObjectPart */) {
  42197. if (newObj) {
  42198. if (newObj.css === obj.css &&
  42199. newObj.media === obj.media &&
  42200. newObj.sourceMap === obj.sourceMap) {
  42201. return
  42202. }
  42203. update(obj = newObj)
  42204. } else {
  42205. remove()
  42206. }
  42207. }
  42208. }
  42209. var replaceText = (function () {
  42210. var textStore = []
  42211. return function (index, replacement) {
  42212. textStore[index] = replacement
  42213. return textStore.filter(Boolean).join('\n')
  42214. }
  42215. })()
  42216. function applyToSingletonTag (styleElement, index, remove, obj) {
  42217. var css = remove ? '' : obj.css
  42218. if (styleElement.styleSheet) {
  42219. styleElement.styleSheet.cssText = replaceText(index, css)
  42220. } else {
  42221. var cssNode = document.createTextNode(css)
  42222. var childNodes = styleElement.childNodes
  42223. if (childNodes[index]) styleElement.removeChild(childNodes[index])
  42224. if (childNodes.length) {
  42225. styleElement.insertBefore(cssNode, childNodes[index])
  42226. } else {
  42227. styleElement.appendChild(cssNode)
  42228. }
  42229. }
  42230. }
  42231. function applyToTag (styleElement, obj) {
  42232. var css = obj.css
  42233. var media = obj.media
  42234. var sourceMap = obj.sourceMap
  42235. if (media) {
  42236. styleElement.setAttribute('media', media)
  42237. }
  42238. if (options.ssrId) {
  42239. styleElement.setAttribute(ssrIdKey, obj.id)
  42240. }
  42241. if (sourceMap) {
  42242. // https://developer.chrome.com/devtools/docs/javascript-debugging
  42243. // this makes source maps inside style tags work properly in Chrome
  42244. css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
  42245. // http://stackoverflow.com/a/26603875
  42246. css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
  42247. }
  42248. if (styleElement.styleSheet) {
  42249. styleElement.styleSheet.cssText = css
  42250. } else {
  42251. while (styleElement.firstChild) {
  42252. styleElement.removeChild(styleElement.firstChild)
  42253. }
  42254. styleElement.appendChild(document.createTextNode(css))
  42255. }
  42256. }
  42257. /***/ }),
  42258. /* 57 */
  42259. /***/ (function(module, exports) {
  42260. /**
  42261. * Translates the list format produced by css-loader into something
  42262. * easier to manipulate.
  42263. */
  42264. module.exports = function listToStyles (parentId, list) {
  42265. var styles = []
  42266. var newStyles = {}
  42267. for (var i = 0; i < list.length; i++) {
  42268. var item = list[i]
  42269. var id = item[0]
  42270. var css = item[1]
  42271. var media = item[2]
  42272. var sourceMap = item[3]
  42273. var part = {
  42274. id: parentId + ':' + i,
  42275. css: css,
  42276. media: media,
  42277. sourceMap: sourceMap
  42278. }
  42279. if (!newStyles[id]) {
  42280. styles.push(newStyles[id] = { id: id, parts: [part] })
  42281. } else {
  42282. newStyles[id].parts.push(part)
  42283. }
  42284. }
  42285. return styles
  42286. }
  42287. /***/ }),
  42288. /* 58 */
  42289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42290. "use strict";
  42291. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  42292. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vuex__ = __webpack_require__(1);
  42293. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  42294. //
  42295. //
  42296. //
  42297. //
  42298. //
  42299. //
  42300. //
  42301. //
  42302. //
  42303. //
  42304. //
  42305. //
  42306. //
  42307. //
  42308. //
  42309. //
  42310. //
  42311. //
  42312. //
  42313. //
  42314. //
  42315. //
  42316. /* harmony default export */ __webpack_exports__["default"] = ({
  42317. computed: Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["c" /* mapState */])({
  42318. detail: function detail(state) {
  42319. return state.news.detail;
  42320. }
  42321. }),
  42322. created: function created() {
  42323. // 获取路由参数id
  42324. // js 中用 this.$route 获取当前路由,用 this.$router 获路由对象,全部路由信息
  42325. // 在模板中用 $router 和 $router 直接调用
  42326. var id = this.$route.params.id;
  42327. this.getNewsDetail(id);
  42328. },
  42329. methods: _extends({}, Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["b" /* mapActions */])(['getNewsDetail']))
  42330. });
  42331. /***/ }),
  42332. /* 59 */
  42333. /***/ (function(module, exports, __webpack_require__) {
  42334. var render = function() {
  42335. var _vm = this
  42336. var _h = _vm.$createElement
  42337. var _c = _vm._self._c || _h
  42338. return _c("div", [
  42339. _c("ol", { staticClass: "breadcrumb" }, [
  42340. _vm._m(0),
  42341. _vm._v(" "),
  42342. _c(
  42343. "li",
  42344. [
  42345. _c(
  42346. "router-link",
  42347. { staticClass: "pull-right", attrs: { to: "/list" } },
  42348. [_vm._v("新闻")]
  42349. )
  42350. ],
  42351. 1
  42352. ),
  42353. _vm._v(" "),
  42354. _c("li", { staticClass: "active" }, [_vm._v(_vm._s(_vm.detail.title))])
  42355. ]),
  42356. _vm._v(" "),
  42357. _c("h3", [
  42358. _vm.detail.is_recommend
  42359. ? _c("span", { staticClass: "label label-success" }, [_vm._v("推荐")])
  42360. : _vm._e(),
  42361. _vm._v(" " + _vm._s(_vm.detail.title))
  42362. ]),
  42363. _vm._v(" "),
  42364. _c("p", [_vm._v("创建时间ddd:" + _vm._s(_vm.detail.created_at))]),
  42365. _vm._v(" "),
  42366. _c(
  42367. "div",
  42368. [
  42369. _vm._v("\n " + _vm._s(_vm.detail.content) + "\n "),
  42370. _c("wv-button", { attrs: { type: "primary" } }, [
  42371. _vm._v("页面主要操作 Normal")
  42372. ]),
  42373. _vm._v(" "),
  42374. _c("wv-button", { attrs: { type: "default" } }, [
  42375. _vm._v("页面次要操作 Normal")
  42376. ]),
  42377. _vm._v(" "),
  42378. _c("wv-button", { attrs: { type: "warn" } }, [
  42379. _vm._v("警告类操作 Normal")
  42380. ])
  42381. ],
  42382. 1
  42383. )
  42384. ])
  42385. }
  42386. var staticRenderFns = [
  42387. function() {
  42388. var _vm = this
  42389. var _h = _vm.$createElement
  42390. var _c = _vm._self._c || _h
  42391. return _c("li", [_c("a", { attrs: { href: "/" } }, [_vm._v("首页")])])
  42392. }
  42393. ]
  42394. render._withStripped = true
  42395. module.exports = { render: render, staticRenderFns: staticRenderFns }
  42396. if (false) {
  42397. module.hot.accept()
  42398. if (module.hot.data) {
  42399. require("vue-hot-reload-api") .rerender("data-v-4448e44e", module.exports)
  42400. }
  42401. }
  42402. /***/ }),
  42403. /* 60 */
  42404. /***/ (function(module, exports, __webpack_require__) {
  42405. var disposed = false
  42406. var normalizeComponent = __webpack_require__(3)
  42407. /* script */
  42408. var __vue_script__ = __webpack_require__(61)
  42409. /* template */
  42410. var __vue_template__ = __webpack_require__(62)
  42411. /* template functional */
  42412. var __vue_template_functional__ = false
  42413. /* styles */
  42414. var __vue_styles__ = null
  42415. /* scopeId */
  42416. var __vue_scopeId__ = null
  42417. /* moduleIdentifier (server only) */
  42418. var __vue_module_identifier__ = null
  42419. var Component = normalizeComponent(
  42420. __vue_script__,
  42421. __vue_template__,
  42422. __vue_template_functional__,
  42423. __vue_styles__,
  42424. __vue_scopeId__,
  42425. __vue_module_identifier__
  42426. )
  42427. Component.options.__file = "resources/assets/js/components/LayoutComponent.vue"
  42428. /* hot reload */
  42429. if (false) {(function () {
  42430. var hotAPI = require("vue-hot-reload-api")
  42431. hotAPI.install(require("vue"), false)
  42432. if (!hotAPI.compatible) return
  42433. module.hot.accept()
  42434. if (!module.hot.data) {
  42435. hotAPI.createRecord("data-v-21d2eae8", Component.options)
  42436. } else {
  42437. hotAPI.reload("data-v-21d2eae8", Component.options)
  42438. }
  42439. module.hot.dispose(function (data) {
  42440. disposed = true
  42441. })
  42442. })()}
  42443. module.exports = Component.exports
  42444. /***/ }),
  42445. /* 61 */
  42446. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42447. "use strict";
  42448. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  42449. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vuex__ = __webpack_require__(1);
  42450. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  42451. //
  42452. //
  42453. //
  42454. //
  42455. //
  42456. //
  42457. //
  42458. //
  42459. //
  42460. //
  42461. //
  42462. //
  42463. //
  42464. //
  42465. //
  42466. //
  42467. //
  42468. //
  42469. //
  42470. //
  42471. //
  42472. //
  42473. //
  42474. //
  42475. //
  42476. //
  42477. //
  42478. //
  42479. /* harmony default export */ __webpack_exports__["default"] = ({
  42480. // 映射 vuex 上面的属性
  42481. computed: Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["c" /* mapState */])({
  42482. recommend: function recommend(state) {
  42483. return state.news.recommend;
  42484. }
  42485. }),
  42486. created: function created() {
  42487. // 获取推荐列表
  42488. //this.getNewsRecommend();
  42489. },
  42490. methods: _extends({}, Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["b" /* mapActions */])(['getNewsRecommend']))
  42491. });
  42492. /***/ }),
  42493. /* 62 */
  42494. /***/ (function(module, exports, __webpack_require__) {
  42495. var render = function() {
  42496. var _vm = this
  42497. var _h = _vm.$createElement
  42498. var _c = _vm._self._c || _h
  42499. return _c(
  42500. "div",
  42501. [
  42502. _c("keep-alive", [_c("router-view")], 1),
  42503. _vm._v(" "),
  42504. _c(
  42505. "wv-tabbar",
  42506. [
  42507. _c("wv-tabbar-item", { attrs: { to: "/", "is-on": "" } }, [
  42508. _c(
  42509. "span",
  42510. {
  42511. staticStyle: { display: "inline-block", position: "relative" },
  42512. attrs: { slot: "icon" },
  42513. slot: "icon"
  42514. },
  42515. [
  42516. _c("img", {
  42517. staticClass: "weui-tabbar__icon",
  42518. attrs: { slot: "icon", src: "icon.png" },
  42519. slot: "icon"
  42520. }),
  42521. _vm._v(" "),
  42522. _c(
  42523. "wv-badge",
  42524. {
  42525. staticStyle: {
  42526. position: "absolute",
  42527. top: "-2px",
  42528. right: "-13px"
  42529. }
  42530. },
  42531. [_vm._v("8")]
  42532. )
  42533. ],
  42534. 1
  42535. ),
  42536. _vm._v(" 首页\n ")
  42537. ]),
  42538. _vm._v(" "),
  42539. _c("wv-tabbar-item", { attrs: { to: "/tabbar" } }, [
  42540. _c("img", {
  42541. staticClass: "weui-tabbar__icon",
  42542. attrs: { slot: "icon", src: "icon.png" },
  42543. slot: "icon"
  42544. }),
  42545. _vm._v(" 通讯录\n ")
  42546. ]),
  42547. _vm._v(" "),
  42548. _c("wv-tabbar-item", { attrs: { to: "/" } }, [
  42549. _c(
  42550. "span",
  42551. {
  42552. staticStyle: { display: "inline-block", position: "relative" },
  42553. attrs: { slot: "icon" },
  42554. slot: "icon"
  42555. },
  42556. [
  42557. _c("img", {
  42558. staticClass: "weui-tabbar__icon",
  42559. attrs: { slot: "icon", src: "icon.png" },
  42560. slot: "icon"
  42561. }),
  42562. _vm._v(" "),
  42563. _c(
  42564. "wv-badge",
  42565. {
  42566. staticStyle: {
  42567. position: "absolute",
  42568. top: "0",
  42569. right: "-6px"
  42570. },
  42571. attrs: { "is-dot": "" }
  42572. },
  42573. [_vm._v("8")]
  42574. )
  42575. ],
  42576. 1
  42577. ),
  42578. _vm._v("\n 发现\n ")
  42579. ]),
  42580. _vm._v(" "),
  42581. _c("wv-tabbar-item", { attrs: { to: "/profile" } }, [
  42582. _c("img", {
  42583. staticClass: "weui-tabbar__icon",
  42584. attrs: { slot: "icon", src: "icon.png" },
  42585. slot: "icon"
  42586. }),
  42587. _vm._v(" 我\n ")
  42588. ])
  42589. ],
  42590. 1
  42591. )
  42592. ],
  42593. 1
  42594. )
  42595. }
  42596. var staticRenderFns = []
  42597. render._withStripped = true
  42598. module.exports = { render: render, staticRenderFns: staticRenderFns }
  42599. if (false) {
  42600. module.hot.accept()
  42601. if (module.hot.data) {
  42602. require("vue-hot-reload-api") .rerender("data-v-21d2eae8", module.exports)
  42603. }
  42604. }
  42605. /***/ }),
  42606. /* 63 */
  42607. /***/ (function(module, exports) {
  42608. // removed by extract-text-webpack-plugin
  42609. /***/ })
  42610. /******/ ]);