app.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992
  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 = 8);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69. "use strict";
  70. var bind = __webpack_require__(3);
  71. var isBuffer = __webpack_require__(17);
  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' && !isArray(obj)) {
  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, exports, __webpack_require__) {
  348. "use strict";
  349. /* WEBPACK VAR INJECTION */(function(process) {
  350. var utils = __webpack_require__(0);
  351. var normalizeHeaderName = __webpack_require__(20);
  352. var DEFAULT_CONTENT_TYPE = {
  353. 'Content-Type': 'application/x-www-form-urlencoded'
  354. };
  355. function setContentTypeIfUnset(headers, value) {
  356. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  357. headers['Content-Type'] = value;
  358. }
  359. }
  360. function getDefaultAdapter() {
  361. var adapter;
  362. if (typeof XMLHttpRequest !== 'undefined') {
  363. // For browsers use XHR adapter
  364. adapter = __webpack_require__(4);
  365. } else if (typeof process !== 'undefined') {
  366. // For node use HTTP adapter
  367. adapter = __webpack_require__(4);
  368. }
  369. return adapter;
  370. }
  371. var defaults = {
  372. adapter: getDefaultAdapter(),
  373. transformRequest: [function transformRequest(data, headers) {
  374. normalizeHeaderName(headers, 'Content-Type');
  375. if (utils.isFormData(data) ||
  376. utils.isArrayBuffer(data) ||
  377. utils.isBuffer(data) ||
  378. utils.isStream(data) ||
  379. utils.isFile(data) ||
  380. utils.isBlob(data)
  381. ) {
  382. return data;
  383. }
  384. if (utils.isArrayBufferView(data)) {
  385. return data.buffer;
  386. }
  387. if (utils.isURLSearchParams(data)) {
  388. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  389. return data.toString();
  390. }
  391. if (utils.isObject(data)) {
  392. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  393. return JSON.stringify(data);
  394. }
  395. return data;
  396. }],
  397. transformResponse: [function transformResponse(data) {
  398. /*eslint no-param-reassign:0*/
  399. if (typeof data === 'string') {
  400. try {
  401. data = JSON.parse(data);
  402. } catch (e) { /* Ignore */ }
  403. }
  404. return data;
  405. }],
  406. timeout: 0,
  407. xsrfCookieName: 'XSRF-TOKEN',
  408. xsrfHeaderName: 'X-XSRF-TOKEN',
  409. maxContentLength: -1,
  410. validateStatus: function validateStatus(status) {
  411. return status >= 200 && status < 300;
  412. }
  413. };
  414. defaults.headers = {
  415. common: {
  416. 'Accept': 'application/json, text/plain, */*'
  417. }
  418. };
  419. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  420. defaults.headers[method] = {};
  421. });
  422. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  423. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  424. });
  425. module.exports = defaults;
  426. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19)))
  427. /***/ }),
  428. /* 2 */
  429. /***/ (function(module, exports) {
  430. var g;
  431. // This works in non-strict mode
  432. g = (function() {
  433. return this;
  434. })();
  435. try {
  436. // This works if eval is allowed (see CSP)
  437. g = g || Function("return this")() || (1,eval)("this");
  438. } catch(e) {
  439. // This works if the window reference is available
  440. if(typeof window === "object")
  441. g = window;
  442. }
  443. // g can still be undefined, but nothing to do about it...
  444. // We return undefined, instead of nothing here, so it's
  445. // easier to handle this case. if(!global) { ...}
  446. module.exports = g;
  447. /***/ }),
  448. /* 3 */
  449. /***/ (function(module, exports, __webpack_require__) {
  450. "use strict";
  451. module.exports = function bind(fn, thisArg) {
  452. return function wrap() {
  453. var args = new Array(arguments.length);
  454. for (var i = 0; i < args.length; i++) {
  455. args[i] = arguments[i];
  456. }
  457. return fn.apply(thisArg, args);
  458. };
  459. };
  460. /***/ }),
  461. /* 4 */
  462. /***/ (function(module, exports, __webpack_require__) {
  463. "use strict";
  464. var utils = __webpack_require__(0);
  465. var settle = __webpack_require__(21);
  466. var buildURL = __webpack_require__(23);
  467. var parseHeaders = __webpack_require__(24);
  468. var isURLSameOrigin = __webpack_require__(25);
  469. var createError = __webpack_require__(5);
  470. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(26);
  471. module.exports = function xhrAdapter(config) {
  472. return new Promise(function dispatchXhrRequest(resolve, reject) {
  473. var requestData = config.data;
  474. var requestHeaders = config.headers;
  475. if (utils.isFormData(requestData)) {
  476. delete requestHeaders['Content-Type']; // Let the browser set it
  477. }
  478. var request = new XMLHttpRequest();
  479. var loadEvent = 'onreadystatechange';
  480. var xDomain = false;
  481. // For IE 8/9 CORS support
  482. // Only supports POST and GET calls and doesn't returns the response headers.
  483. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  484. if ("development" !== 'test' &&
  485. typeof window !== 'undefined' &&
  486. window.XDomainRequest && !('withCredentials' in request) &&
  487. !isURLSameOrigin(config.url)) {
  488. request = new window.XDomainRequest();
  489. loadEvent = 'onload';
  490. xDomain = true;
  491. request.onprogress = function handleProgress() {};
  492. request.ontimeout = function handleTimeout() {};
  493. }
  494. // HTTP basic authentication
  495. if (config.auth) {
  496. var username = config.auth.username || '';
  497. var password = config.auth.password || '';
  498. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  499. }
  500. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  501. // Set the request timeout in MS
  502. request.timeout = config.timeout;
  503. // Listen for ready state
  504. request[loadEvent] = function handleLoad() {
  505. if (!request || (request.readyState !== 4 && !xDomain)) {
  506. return;
  507. }
  508. // The request errored out and we didn't get a response, this will be
  509. // handled by onerror instead
  510. // With one exception: request that using file: protocol, most browsers
  511. // will return status as 0 even though it's a successful request
  512. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  513. return;
  514. }
  515. // Prepare the response
  516. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  517. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  518. var response = {
  519. data: responseData,
  520. // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  521. status: request.status === 1223 ? 204 : request.status,
  522. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  523. headers: responseHeaders,
  524. config: config,
  525. request: request
  526. };
  527. settle(resolve, reject, response);
  528. // Clean up request
  529. request = null;
  530. };
  531. // Handle low level network errors
  532. request.onerror = function handleError() {
  533. // Real errors are hidden from us by the browser
  534. // onerror should only fire if it's a network error
  535. reject(createError('Network Error', config, null, request));
  536. // Clean up request
  537. request = null;
  538. };
  539. // Handle timeout
  540. request.ontimeout = function handleTimeout() {
  541. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
  542. request));
  543. // Clean up request
  544. request = null;
  545. };
  546. // Add xsrf header
  547. // This is only done if running in a standard browser environment.
  548. // Specifically not if we're in a web worker, or react-native.
  549. if (utils.isStandardBrowserEnv()) {
  550. var cookies = __webpack_require__(27);
  551. // Add xsrf header
  552. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  553. cookies.read(config.xsrfCookieName) :
  554. undefined;
  555. if (xsrfValue) {
  556. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  557. }
  558. }
  559. // Add headers to the request
  560. if ('setRequestHeader' in request) {
  561. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  562. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  563. // Remove Content-Type if data is undefined
  564. delete requestHeaders[key];
  565. } else {
  566. // Otherwise add header to the request
  567. request.setRequestHeader(key, val);
  568. }
  569. });
  570. }
  571. // Add withCredentials to request if needed
  572. if (config.withCredentials) {
  573. request.withCredentials = true;
  574. }
  575. // Add responseType to request if needed
  576. if (config.responseType) {
  577. try {
  578. request.responseType = config.responseType;
  579. } catch (e) {
  580. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  581. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  582. if (config.responseType !== 'json') {
  583. throw e;
  584. }
  585. }
  586. }
  587. // Handle progress if needed
  588. if (typeof config.onDownloadProgress === 'function') {
  589. request.addEventListener('progress', config.onDownloadProgress);
  590. }
  591. // Not all browsers support upload events
  592. if (typeof config.onUploadProgress === 'function' && request.upload) {
  593. request.upload.addEventListener('progress', config.onUploadProgress);
  594. }
  595. if (config.cancelToken) {
  596. // Handle cancellation
  597. config.cancelToken.promise.then(function onCanceled(cancel) {
  598. if (!request) {
  599. return;
  600. }
  601. request.abort();
  602. reject(cancel);
  603. // Clean up request
  604. request = null;
  605. });
  606. }
  607. if (requestData === undefined) {
  608. requestData = null;
  609. }
  610. // Send the request
  611. request.send(requestData);
  612. });
  613. };
  614. /***/ }),
  615. /* 5 */
  616. /***/ (function(module, exports, __webpack_require__) {
  617. "use strict";
  618. var enhanceError = __webpack_require__(22);
  619. /**
  620. * Create an Error with the specified message, config, error code, request and response.
  621. *
  622. * @param {string} message The error message.
  623. * @param {Object} config The config.
  624. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  625. * @param {Object} [request] The request.
  626. * @param {Object} [response] The response.
  627. * @returns {Error} The created error.
  628. */
  629. module.exports = function createError(message, config, code, request, response) {
  630. var error = new Error(message);
  631. return enhanceError(error, config, code, request, response);
  632. };
  633. /***/ }),
  634. /* 6 */
  635. /***/ (function(module, exports, __webpack_require__) {
  636. "use strict";
  637. module.exports = function isCancel(value) {
  638. return !!(value && value.__CANCEL__);
  639. };
  640. /***/ }),
  641. /* 7 */
  642. /***/ (function(module, exports, __webpack_require__) {
  643. "use strict";
  644. /**
  645. * A `Cancel` is an object that is thrown when an operation is canceled.
  646. *
  647. * @class
  648. * @param {string=} message The message.
  649. */
  650. function Cancel(message) {
  651. this.message = message;
  652. }
  653. Cancel.prototype.toString = function toString() {
  654. return 'Cancel' + (this.message ? ': ' + this.message : '');
  655. };
  656. Cancel.prototype.__CANCEL__ = true;
  657. module.exports = Cancel;
  658. /***/ }),
  659. /* 8 */
  660. /***/ (function(module, exports, __webpack_require__) {
  661. __webpack_require__(9);
  662. module.exports = __webpack_require__(40);
  663. /***/ }),
  664. /* 9 */
  665. /***/ (function(module, exports, __webpack_require__) {
  666. /**
  667. * First we will load all of this project's JavaScript dependencies which
  668. * includes Vue and other libraries. It is a great starting point when
  669. * building robust, powerful web applications using Vue and Laravel.
  670. */
  671. __webpack_require__(10);
  672. window.Vue = __webpack_require__(35);
  673. /**
  674. * Next, we will create a fresh Vue application instance and attach it to
  675. * the page. Then, you may begin adding components to this application
  676. * or customize the JavaScript scaffolding to fit your unique needs.
  677. */
  678. Vue.component('example', __webpack_require__(36));
  679. var app = new Vue({
  680. el: '#app'
  681. });
  682. window.setTimeout(function () {
  683. $("#flash-message").fadeTo(500, 0).slideUp(500, function () {
  684. $(this).remove();
  685. });
  686. }, 3000);
  687. /***/ }),
  688. /* 10 */
  689. /***/ (function(module, exports, __webpack_require__) {
  690. window._ = __webpack_require__(11);
  691. /**
  692. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  693. * for JavaScript based Bootstrap features such as modals and tabs. This
  694. * code may be modified to fit the specific needs of your application.
  695. */
  696. try {
  697. window.$ = window.jQuery = __webpack_require__(13);
  698. __webpack_require__(14);
  699. } catch (e) {}
  700. /**
  701. * We'll load the axios HTTP library which allows us to easily issue requests
  702. * to our Laravel back-end. This library automatically handles sending the
  703. * CSRF token as a header based on the value of the "XSRF" token cookie.
  704. */
  705. window.axios = __webpack_require__(15);
  706. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  707. /**
  708. * Next we will register the CSRF Token as a common header with Axios so that
  709. * all outgoing HTTP requests automatically have it attached. This is just
  710. * a simple convenience so we don't have to attach every token manually.
  711. */
  712. var token = document.head.querySelector('meta[name="csrf-token"]');
  713. if (token) {
  714. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  715. } else {
  716. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  717. }
  718. /**
  719. * Echo exposes an expressive API for subscribing to channels and listening
  720. * for events that are broadcast by Laravel. Echo and event broadcasting
  721. * allows your team to easily build robust real-time web applications.
  722. */
  723. // import Echo from 'laravel-echo'
  724. // window.Pusher = require('pusher-js');
  725. // window.Echo = new Echo({
  726. // broadcaster: 'pusher',
  727. // key: 'your-pusher-key'
  728. // });
  729. /***/ }),
  730. /* 11 */
  731. /***/ (function(module, exports, __webpack_require__) {
  732. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  733. * @license
  734. * Lodash <https://lodash.com/>
  735. * Copyright JS Foundation and other contributors <https://js.foundation/>
  736. * Released under MIT license <https://lodash.com/license>
  737. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  738. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  739. */
  740. ;(function() {
  741. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  742. var undefined;
  743. /** Used as the semantic version number. */
  744. var VERSION = '4.17.4';
  745. /** Used as the size to enable large array optimizations. */
  746. var LARGE_ARRAY_SIZE = 200;
  747. /** Error message constants. */
  748. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  749. FUNC_ERROR_TEXT = 'Expected a function';
  750. /** Used to stand-in for `undefined` hash values. */
  751. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  752. /** Used as the maximum memoize cache size. */
  753. var MAX_MEMOIZE_SIZE = 500;
  754. /** Used as the internal argument placeholder. */
  755. var PLACEHOLDER = '__lodash_placeholder__';
  756. /** Used to compose bitmasks for cloning. */
  757. var CLONE_DEEP_FLAG = 1,
  758. CLONE_FLAT_FLAG = 2,
  759. CLONE_SYMBOLS_FLAG = 4;
  760. /** Used to compose bitmasks for value comparisons. */
  761. var COMPARE_PARTIAL_FLAG = 1,
  762. COMPARE_UNORDERED_FLAG = 2;
  763. /** Used to compose bitmasks for function metadata. */
  764. var WRAP_BIND_FLAG = 1,
  765. WRAP_BIND_KEY_FLAG = 2,
  766. WRAP_CURRY_BOUND_FLAG = 4,
  767. WRAP_CURRY_FLAG = 8,
  768. WRAP_CURRY_RIGHT_FLAG = 16,
  769. WRAP_PARTIAL_FLAG = 32,
  770. WRAP_PARTIAL_RIGHT_FLAG = 64,
  771. WRAP_ARY_FLAG = 128,
  772. WRAP_REARG_FLAG = 256,
  773. WRAP_FLIP_FLAG = 512;
  774. /** Used as default options for `_.truncate`. */
  775. var DEFAULT_TRUNC_LENGTH = 30,
  776. DEFAULT_TRUNC_OMISSION = '...';
  777. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  778. var HOT_COUNT = 800,
  779. HOT_SPAN = 16;
  780. /** Used to indicate the type of lazy iteratees. */
  781. var LAZY_FILTER_FLAG = 1,
  782. LAZY_MAP_FLAG = 2,
  783. LAZY_WHILE_FLAG = 3;
  784. /** Used as references for various `Number` constants. */
  785. var INFINITY = 1 / 0,
  786. MAX_SAFE_INTEGER = 9007199254740991,
  787. MAX_INTEGER = 1.7976931348623157e+308,
  788. NAN = 0 / 0;
  789. /** Used as references for the maximum length and index of an array. */
  790. var MAX_ARRAY_LENGTH = 4294967295,
  791. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  792. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  793. /** Used to associate wrap methods with their bit flags. */
  794. var wrapFlags = [
  795. ['ary', WRAP_ARY_FLAG],
  796. ['bind', WRAP_BIND_FLAG],
  797. ['bindKey', WRAP_BIND_KEY_FLAG],
  798. ['curry', WRAP_CURRY_FLAG],
  799. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  800. ['flip', WRAP_FLIP_FLAG],
  801. ['partial', WRAP_PARTIAL_FLAG],
  802. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  803. ['rearg', WRAP_REARG_FLAG]
  804. ];
  805. /** `Object#toString` result references. */
  806. var argsTag = '[object Arguments]',
  807. arrayTag = '[object Array]',
  808. asyncTag = '[object AsyncFunction]',
  809. boolTag = '[object Boolean]',
  810. dateTag = '[object Date]',
  811. domExcTag = '[object DOMException]',
  812. errorTag = '[object Error]',
  813. funcTag = '[object Function]',
  814. genTag = '[object GeneratorFunction]',
  815. mapTag = '[object Map]',
  816. numberTag = '[object Number]',
  817. nullTag = '[object Null]',
  818. objectTag = '[object Object]',
  819. promiseTag = '[object Promise]',
  820. proxyTag = '[object Proxy]',
  821. regexpTag = '[object RegExp]',
  822. setTag = '[object Set]',
  823. stringTag = '[object String]',
  824. symbolTag = '[object Symbol]',
  825. undefinedTag = '[object Undefined]',
  826. weakMapTag = '[object WeakMap]',
  827. weakSetTag = '[object WeakSet]';
  828. var arrayBufferTag = '[object ArrayBuffer]',
  829. dataViewTag = '[object DataView]',
  830. float32Tag = '[object Float32Array]',
  831. float64Tag = '[object Float64Array]',
  832. int8Tag = '[object Int8Array]',
  833. int16Tag = '[object Int16Array]',
  834. int32Tag = '[object Int32Array]',
  835. uint8Tag = '[object Uint8Array]',
  836. uint8ClampedTag = '[object Uint8ClampedArray]',
  837. uint16Tag = '[object Uint16Array]',
  838. uint32Tag = '[object Uint32Array]';
  839. /** Used to match empty string literals in compiled template source. */
  840. var reEmptyStringLeading = /\b__p \+= '';/g,
  841. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  842. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  843. /** Used to match HTML entities and HTML characters. */
  844. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  845. reUnescapedHtml = /[&<>"']/g,
  846. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  847. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  848. /** Used to match template delimiters. */
  849. var reEscape = /<%-([\s\S]+?)%>/g,
  850. reEvaluate = /<%([\s\S]+?)%>/g,
  851. reInterpolate = /<%=([\s\S]+?)%>/g;
  852. /** Used to match property names within property paths. */
  853. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  854. reIsPlainProp = /^\w*$/,
  855. reLeadingDot = /^\./,
  856. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  857. /**
  858. * Used to match `RegExp`
  859. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  860. */
  861. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  862. reHasRegExpChar = RegExp(reRegExpChar.source);
  863. /** Used to match leading and trailing whitespace. */
  864. var reTrim = /^\s+|\s+$/g,
  865. reTrimStart = /^\s+/,
  866. reTrimEnd = /\s+$/;
  867. /** Used to match wrap detail comments. */
  868. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  869. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  870. reSplitDetails = /,? & /;
  871. /** Used to match words composed of alphanumeric characters. */
  872. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  873. /** Used to match backslashes in property paths. */
  874. var reEscapeChar = /\\(\\)?/g;
  875. /**
  876. * Used to match
  877. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  878. */
  879. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  880. /** Used to match `RegExp` flags from their coerced string values. */
  881. var reFlags = /\w*$/;
  882. /** Used to detect bad signed hexadecimal string values. */
  883. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  884. /** Used to detect binary string values. */
  885. var reIsBinary = /^0b[01]+$/i;
  886. /** Used to detect host constructors (Safari). */
  887. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  888. /** Used to detect octal string values. */
  889. var reIsOctal = /^0o[0-7]+$/i;
  890. /** Used to detect unsigned integer values. */
  891. var reIsUint = /^(?:0|[1-9]\d*)$/;
  892. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  893. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  894. /** Used to ensure capturing order of template delimiters. */
  895. var reNoMatch = /($^)/;
  896. /** Used to match unescaped characters in compiled string literals. */
  897. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  898. /** Used to compose unicode character classes. */
  899. var rsAstralRange = '\\ud800-\\udfff',
  900. rsComboMarksRange = '\\u0300-\\u036f',
  901. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  902. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  903. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  904. rsDingbatRange = '\\u2700-\\u27bf',
  905. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  906. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  907. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  908. rsPunctuationRange = '\\u2000-\\u206f',
  909. 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',
  910. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  911. rsVarRange = '\\ufe0e\\ufe0f',
  912. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  913. /** Used to compose unicode capture groups. */
  914. var rsApos = "['\u2019]",
  915. rsAstral = '[' + rsAstralRange + ']',
  916. rsBreak = '[' + rsBreakRange + ']',
  917. rsCombo = '[' + rsComboRange + ']',
  918. rsDigits = '\\d+',
  919. rsDingbat = '[' + rsDingbatRange + ']',
  920. rsLower = '[' + rsLowerRange + ']',
  921. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  922. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  923. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  924. rsNonAstral = '[^' + rsAstralRange + ']',
  925. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  926. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  927. rsUpper = '[' + rsUpperRange + ']',
  928. rsZWJ = '\\u200d';
  929. /** Used to compose unicode regexes. */
  930. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  931. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  932. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  933. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  934. reOptMod = rsModifier + '?',
  935. rsOptVar = '[' + rsVarRange + ']?',
  936. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  937. rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
  938. rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
  939. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  940. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  941. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  942. /** Used to match apostrophes. */
  943. var reApos = RegExp(rsApos, 'g');
  944. /**
  945. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  946. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  947. */
  948. var reComboMark = RegExp(rsCombo, 'g');
  949. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  950. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  951. /** Used to match complex or compound words. */
  952. var reUnicodeWord = RegExp([
  953. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  954. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  955. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  956. rsUpper + '+' + rsOptContrUpper,
  957. rsOrdUpper,
  958. rsOrdLower,
  959. rsDigits,
  960. rsEmoji
  961. ].join('|'), 'g');
  962. /** 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/). */
  963. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  964. /** Used to detect strings that need a more robust regexp to match words. */
  965. 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 ]/;
  966. /** Used to assign default `context` object properties. */
  967. var contextProps = [
  968. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  969. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  970. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  971. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  972. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  973. ];
  974. /** Used to make template sourceURLs easier to identify. */
  975. var templateCounter = -1;
  976. /** Used to identify `toStringTag` values of typed arrays. */
  977. var typedArrayTags = {};
  978. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  979. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  980. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  981. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  982. typedArrayTags[uint32Tag] = true;
  983. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  984. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  985. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  986. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  987. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  988. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  989. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  990. typedArrayTags[weakMapTag] = false;
  991. /** Used to identify `toStringTag` values supported by `_.clone`. */
  992. var cloneableTags = {};
  993. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  994. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  995. cloneableTags[boolTag] = cloneableTags[dateTag] =
  996. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  997. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  998. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  999. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1000. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1001. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1002. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1003. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1004. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1005. cloneableTags[weakMapTag] = false;
  1006. /** Used to map Latin Unicode letters to basic Latin letters. */
  1007. var deburredLetters = {
  1008. // Latin-1 Supplement block.
  1009. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1010. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1011. '\xc7': 'C', '\xe7': 'c',
  1012. '\xd0': 'D', '\xf0': 'd',
  1013. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1014. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1015. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1016. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1017. '\xd1': 'N', '\xf1': 'n',
  1018. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1019. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1020. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1021. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1022. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1023. '\xc6': 'Ae', '\xe6': 'ae',
  1024. '\xde': 'Th', '\xfe': 'th',
  1025. '\xdf': 'ss',
  1026. // Latin Extended-A block.
  1027. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1028. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1029. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1030. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1031. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1032. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1033. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1034. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1035. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1036. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1037. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1038. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1039. '\u0134': 'J', '\u0135': 'j',
  1040. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1041. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1042. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1043. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1044. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1045. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1046. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  1047. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  1048. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  1049. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  1050. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  1051. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  1052. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  1053. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  1054. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  1055. '\u0174': 'W', '\u0175': 'w',
  1056. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  1057. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  1058. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  1059. '\u0132': 'IJ', '\u0133': 'ij',
  1060. '\u0152': 'Oe', '\u0153': 'oe',
  1061. '\u0149': "'n", '\u017f': 's'
  1062. };
  1063. /** Used to map characters to HTML entities. */
  1064. var htmlEscapes = {
  1065. '&': '&amp;',
  1066. '<': '&lt;',
  1067. '>': '&gt;',
  1068. '"': '&quot;',
  1069. "'": '&#39;'
  1070. };
  1071. /** Used to map HTML entities to characters. */
  1072. var htmlUnescapes = {
  1073. '&amp;': '&',
  1074. '&lt;': '<',
  1075. '&gt;': '>',
  1076. '&quot;': '"',
  1077. '&#39;': "'"
  1078. };
  1079. /** Used to escape characters for inclusion in compiled string literals. */
  1080. var stringEscapes = {
  1081. '\\': '\\',
  1082. "'": "'",
  1083. '\n': 'n',
  1084. '\r': 'r',
  1085. '\u2028': 'u2028',
  1086. '\u2029': 'u2029'
  1087. };
  1088. /** Built-in method references without a dependency on `root`. */
  1089. var freeParseFloat = parseFloat,
  1090. freeParseInt = parseInt;
  1091. /** Detect free variable `global` from Node.js. */
  1092. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  1093. /** Detect free variable `self`. */
  1094. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1095. /** Used as a reference to the global object. */
  1096. var root = freeGlobal || freeSelf || Function('return this')();
  1097. /** Detect free variable `exports`. */
  1098. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  1099. /** Detect free variable `module`. */
  1100. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  1101. /** Detect the popular CommonJS extension `module.exports`. */
  1102. var moduleExports = freeModule && freeModule.exports === freeExports;
  1103. /** Detect free variable `process` from Node.js. */
  1104. var freeProcess = moduleExports && freeGlobal.process;
  1105. /** Used to access faster Node.js helpers. */
  1106. var nodeUtil = (function() {
  1107. try {
  1108. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  1109. } catch (e) {}
  1110. }());
  1111. /* Node.js helper references. */
  1112. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  1113. nodeIsDate = nodeUtil && nodeUtil.isDate,
  1114. nodeIsMap = nodeUtil && nodeUtil.isMap,
  1115. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  1116. nodeIsSet = nodeUtil && nodeUtil.isSet,
  1117. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1118. /*--------------------------------------------------------------------------*/
  1119. /**
  1120. * Adds the key-value `pair` to `map`.
  1121. *
  1122. * @private
  1123. * @param {Object} map The map to modify.
  1124. * @param {Array} pair The key-value pair to add.
  1125. * @returns {Object} Returns `map`.
  1126. */
  1127. function addMapEntry(map, pair) {
  1128. // Don't return `map.set` because it's not chainable in IE 11.
  1129. map.set(pair[0], pair[1]);
  1130. return map;
  1131. }
  1132. /**
  1133. * Adds `value` to `set`.
  1134. *
  1135. * @private
  1136. * @param {Object} set The set to modify.
  1137. * @param {*} value The value to add.
  1138. * @returns {Object} Returns `set`.
  1139. */
  1140. function addSetEntry(set, value) {
  1141. // Don't return `set.add` because it's not chainable in IE 11.
  1142. set.add(value);
  1143. return set;
  1144. }
  1145. /**
  1146. * A faster alternative to `Function#apply`, this function invokes `func`
  1147. * with the `this` binding of `thisArg` and the arguments of `args`.
  1148. *
  1149. * @private
  1150. * @param {Function} func The function to invoke.
  1151. * @param {*} thisArg The `this` binding of `func`.
  1152. * @param {Array} args The arguments to invoke `func` with.
  1153. * @returns {*} Returns the result of `func`.
  1154. */
  1155. function apply(func, thisArg, args) {
  1156. switch (args.length) {
  1157. case 0: return func.call(thisArg);
  1158. case 1: return func.call(thisArg, args[0]);
  1159. case 2: return func.call(thisArg, args[0], args[1]);
  1160. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1161. }
  1162. return func.apply(thisArg, args);
  1163. }
  1164. /**
  1165. * A specialized version of `baseAggregator` for arrays.
  1166. *
  1167. * @private
  1168. * @param {Array} [array] The array to iterate over.
  1169. * @param {Function} setter The function to set `accumulator` values.
  1170. * @param {Function} iteratee The iteratee to transform keys.
  1171. * @param {Object} accumulator The initial aggregated object.
  1172. * @returns {Function} Returns `accumulator`.
  1173. */
  1174. function arrayAggregator(array, setter, iteratee, accumulator) {
  1175. var index = -1,
  1176. length = array == null ? 0 : array.length;
  1177. while (++index < length) {
  1178. var value = array[index];
  1179. setter(accumulator, value, iteratee(value), array);
  1180. }
  1181. return accumulator;
  1182. }
  1183. /**
  1184. * A specialized version of `_.forEach` for arrays without support for
  1185. * iteratee shorthands.
  1186. *
  1187. * @private
  1188. * @param {Array} [array] The array to iterate over.
  1189. * @param {Function} iteratee The function invoked per iteration.
  1190. * @returns {Array} Returns `array`.
  1191. */
  1192. function arrayEach(array, iteratee) {
  1193. var index = -1,
  1194. length = array == null ? 0 : array.length;
  1195. while (++index < length) {
  1196. if (iteratee(array[index], index, array) === false) {
  1197. break;
  1198. }
  1199. }
  1200. return array;
  1201. }
  1202. /**
  1203. * A specialized version of `_.forEachRight` for arrays without support for
  1204. * iteratee shorthands.
  1205. *
  1206. * @private
  1207. * @param {Array} [array] The array to iterate over.
  1208. * @param {Function} iteratee The function invoked per iteration.
  1209. * @returns {Array} Returns `array`.
  1210. */
  1211. function arrayEachRight(array, iteratee) {
  1212. var length = array == null ? 0 : array.length;
  1213. while (length--) {
  1214. if (iteratee(array[length], length, array) === false) {
  1215. break;
  1216. }
  1217. }
  1218. return array;
  1219. }
  1220. /**
  1221. * A specialized version of `_.every` for arrays without support for
  1222. * iteratee shorthands.
  1223. *
  1224. * @private
  1225. * @param {Array} [array] The array to iterate over.
  1226. * @param {Function} predicate The function invoked per iteration.
  1227. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1228. * else `false`.
  1229. */
  1230. function arrayEvery(array, predicate) {
  1231. var index = -1,
  1232. length = array == null ? 0 : array.length;
  1233. while (++index < length) {
  1234. if (!predicate(array[index], index, array)) {
  1235. return false;
  1236. }
  1237. }
  1238. return true;
  1239. }
  1240. /**
  1241. * A specialized version of `_.filter` for arrays without support for
  1242. * iteratee shorthands.
  1243. *
  1244. * @private
  1245. * @param {Array} [array] The array to iterate over.
  1246. * @param {Function} predicate The function invoked per iteration.
  1247. * @returns {Array} Returns the new filtered array.
  1248. */
  1249. function arrayFilter(array, predicate) {
  1250. var index = -1,
  1251. length = array == null ? 0 : array.length,
  1252. resIndex = 0,
  1253. result = [];
  1254. while (++index < length) {
  1255. var value = array[index];
  1256. if (predicate(value, index, array)) {
  1257. result[resIndex++] = value;
  1258. }
  1259. }
  1260. return result;
  1261. }
  1262. /**
  1263. * A specialized version of `_.includes` for arrays without support for
  1264. * specifying an index to search from.
  1265. *
  1266. * @private
  1267. * @param {Array} [array] The array to inspect.
  1268. * @param {*} target The value to search for.
  1269. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1270. */
  1271. function arrayIncludes(array, value) {
  1272. var length = array == null ? 0 : array.length;
  1273. return !!length && baseIndexOf(array, value, 0) > -1;
  1274. }
  1275. /**
  1276. * This function is like `arrayIncludes` except that it accepts a comparator.
  1277. *
  1278. * @private
  1279. * @param {Array} [array] The array to inspect.
  1280. * @param {*} target The value to search for.
  1281. * @param {Function} comparator The comparator invoked per element.
  1282. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1283. */
  1284. function arrayIncludesWith(array, value, comparator) {
  1285. var index = -1,
  1286. length = array == null ? 0 : array.length;
  1287. while (++index < length) {
  1288. if (comparator(value, array[index])) {
  1289. return true;
  1290. }
  1291. }
  1292. return false;
  1293. }
  1294. /**
  1295. * A specialized version of `_.map` for arrays without support for iteratee
  1296. * shorthands.
  1297. *
  1298. * @private
  1299. * @param {Array} [array] The array to iterate over.
  1300. * @param {Function} iteratee The function invoked per iteration.
  1301. * @returns {Array} Returns the new mapped array.
  1302. */
  1303. function arrayMap(array, iteratee) {
  1304. var index = -1,
  1305. length = array == null ? 0 : array.length,
  1306. result = Array(length);
  1307. while (++index < length) {
  1308. result[index] = iteratee(array[index], index, array);
  1309. }
  1310. return result;
  1311. }
  1312. /**
  1313. * Appends the elements of `values` to `array`.
  1314. *
  1315. * @private
  1316. * @param {Array} array The array to modify.
  1317. * @param {Array} values The values to append.
  1318. * @returns {Array} Returns `array`.
  1319. */
  1320. function arrayPush(array, values) {
  1321. var index = -1,
  1322. length = values.length,
  1323. offset = array.length;
  1324. while (++index < length) {
  1325. array[offset + index] = values[index];
  1326. }
  1327. return array;
  1328. }
  1329. /**
  1330. * A specialized version of `_.reduce` for arrays without support for
  1331. * iteratee shorthands.
  1332. *
  1333. * @private
  1334. * @param {Array} [array] The array to iterate over.
  1335. * @param {Function} iteratee The function invoked per iteration.
  1336. * @param {*} [accumulator] The initial value.
  1337. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1338. * the initial value.
  1339. * @returns {*} Returns the accumulated value.
  1340. */
  1341. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1342. var index = -1,
  1343. length = array == null ? 0 : array.length;
  1344. if (initAccum && length) {
  1345. accumulator = array[++index];
  1346. }
  1347. while (++index < length) {
  1348. accumulator = iteratee(accumulator, array[index], index, array);
  1349. }
  1350. return accumulator;
  1351. }
  1352. /**
  1353. * A specialized version of `_.reduceRight` for arrays without support for
  1354. * iteratee shorthands.
  1355. *
  1356. * @private
  1357. * @param {Array} [array] The array to iterate over.
  1358. * @param {Function} iteratee The function invoked per iteration.
  1359. * @param {*} [accumulator] The initial value.
  1360. * @param {boolean} [initAccum] Specify using the last element of `array` as
  1361. * the initial value.
  1362. * @returns {*} Returns the accumulated value.
  1363. */
  1364. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  1365. var length = array == null ? 0 : array.length;
  1366. if (initAccum && length) {
  1367. accumulator = array[--length];
  1368. }
  1369. while (length--) {
  1370. accumulator = iteratee(accumulator, array[length], length, array);
  1371. }
  1372. return accumulator;
  1373. }
  1374. /**
  1375. * A specialized version of `_.some` for arrays without support for iteratee
  1376. * shorthands.
  1377. *
  1378. * @private
  1379. * @param {Array} [array] The array to iterate over.
  1380. * @param {Function} predicate The function invoked per iteration.
  1381. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1382. * else `false`.
  1383. */
  1384. function arraySome(array, predicate) {
  1385. var index = -1,
  1386. length = array == null ? 0 : array.length;
  1387. while (++index < length) {
  1388. if (predicate(array[index], index, array)) {
  1389. return true;
  1390. }
  1391. }
  1392. return false;
  1393. }
  1394. /**
  1395. * Gets the size of an ASCII `string`.
  1396. *
  1397. * @private
  1398. * @param {string} string The string inspect.
  1399. * @returns {number} Returns the string size.
  1400. */
  1401. var asciiSize = baseProperty('length');
  1402. /**
  1403. * Converts an ASCII `string` to an array.
  1404. *
  1405. * @private
  1406. * @param {string} string The string to convert.
  1407. * @returns {Array} Returns the converted array.
  1408. */
  1409. function asciiToArray(string) {
  1410. return string.split('');
  1411. }
  1412. /**
  1413. * Splits an ASCII `string` into an array of its words.
  1414. *
  1415. * @private
  1416. * @param {string} The string to inspect.
  1417. * @returns {Array} Returns the words of `string`.
  1418. */
  1419. function asciiWords(string) {
  1420. return string.match(reAsciiWord) || [];
  1421. }
  1422. /**
  1423. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  1424. * without support for iteratee shorthands, which iterates over `collection`
  1425. * using `eachFunc`.
  1426. *
  1427. * @private
  1428. * @param {Array|Object} collection The collection to inspect.
  1429. * @param {Function} predicate The function invoked per iteration.
  1430. * @param {Function} eachFunc The function to iterate over `collection`.
  1431. * @returns {*} Returns the found element or its key, else `undefined`.
  1432. */
  1433. function baseFindKey(collection, predicate, eachFunc) {
  1434. var result;
  1435. eachFunc(collection, function(value, key, collection) {
  1436. if (predicate(value, key, collection)) {
  1437. result = key;
  1438. return false;
  1439. }
  1440. });
  1441. return result;
  1442. }
  1443. /**
  1444. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  1445. * support for iteratee shorthands.
  1446. *
  1447. * @private
  1448. * @param {Array} array The array to inspect.
  1449. * @param {Function} predicate The function invoked per iteration.
  1450. * @param {number} fromIndex The index to search from.
  1451. * @param {boolean} [fromRight] Specify iterating from right to left.
  1452. * @returns {number} Returns the index of the matched value, else `-1`.
  1453. */
  1454. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1455. var length = array.length,
  1456. index = fromIndex + (fromRight ? 1 : -1);
  1457. while ((fromRight ? index-- : ++index < length)) {
  1458. if (predicate(array[index], index, array)) {
  1459. return index;
  1460. }
  1461. }
  1462. return -1;
  1463. }
  1464. /**
  1465. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  1466. *
  1467. * @private
  1468. * @param {Array} array The array to inspect.
  1469. * @param {*} value The value to search for.
  1470. * @param {number} fromIndex The index to search from.
  1471. * @returns {number} Returns the index of the matched value, else `-1`.
  1472. */
  1473. function baseIndexOf(array, value, fromIndex) {
  1474. return value === value
  1475. ? strictIndexOf(array, value, fromIndex)
  1476. : baseFindIndex(array, baseIsNaN, fromIndex);
  1477. }
  1478. /**
  1479. * This function is like `baseIndexOf` except that it accepts a comparator.
  1480. *
  1481. * @private
  1482. * @param {Array} array The array to inspect.
  1483. * @param {*} value The value to search for.
  1484. * @param {number} fromIndex The index to search from.
  1485. * @param {Function} comparator The comparator invoked per element.
  1486. * @returns {number} Returns the index of the matched value, else `-1`.
  1487. */
  1488. function baseIndexOfWith(array, value, fromIndex, comparator) {
  1489. var index = fromIndex - 1,
  1490. length = array.length;
  1491. while (++index < length) {
  1492. if (comparator(array[index], value)) {
  1493. return index;
  1494. }
  1495. }
  1496. return -1;
  1497. }
  1498. /**
  1499. * The base implementation of `_.isNaN` without support for number objects.
  1500. *
  1501. * @private
  1502. * @param {*} value The value to check.
  1503. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  1504. */
  1505. function baseIsNaN(value) {
  1506. return value !== value;
  1507. }
  1508. /**
  1509. * The base implementation of `_.mean` and `_.meanBy` without support for
  1510. * iteratee shorthands.
  1511. *
  1512. * @private
  1513. * @param {Array} array The array to iterate over.
  1514. * @param {Function} iteratee The function invoked per iteration.
  1515. * @returns {number} Returns the mean.
  1516. */
  1517. function baseMean(array, iteratee) {
  1518. var length = array == null ? 0 : array.length;
  1519. return length ? (baseSum(array, iteratee) / length) : NAN;
  1520. }
  1521. /**
  1522. * The base implementation of `_.property` without support for deep paths.
  1523. *
  1524. * @private
  1525. * @param {string} key The key of the property to get.
  1526. * @returns {Function} Returns the new accessor function.
  1527. */
  1528. function baseProperty(key) {
  1529. return function(object) {
  1530. return object == null ? undefined : object[key];
  1531. };
  1532. }
  1533. /**
  1534. * The base implementation of `_.propertyOf` without support for deep paths.
  1535. *
  1536. * @private
  1537. * @param {Object} object The object to query.
  1538. * @returns {Function} Returns the new accessor function.
  1539. */
  1540. function basePropertyOf(object) {
  1541. return function(key) {
  1542. return object == null ? undefined : object[key];
  1543. };
  1544. }
  1545. /**
  1546. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  1547. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  1548. *
  1549. * @private
  1550. * @param {Array|Object} collection The collection to iterate over.
  1551. * @param {Function} iteratee The function invoked per iteration.
  1552. * @param {*} accumulator The initial value.
  1553. * @param {boolean} initAccum Specify using the first or last element of
  1554. * `collection` as the initial value.
  1555. * @param {Function} eachFunc The function to iterate over `collection`.
  1556. * @returns {*} Returns the accumulated value.
  1557. */
  1558. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  1559. eachFunc(collection, function(value, index, collection) {
  1560. accumulator = initAccum
  1561. ? (initAccum = false, value)
  1562. : iteratee(accumulator, value, index, collection);
  1563. });
  1564. return accumulator;
  1565. }
  1566. /**
  1567. * The base implementation of `_.sortBy` which uses `comparer` to define the
  1568. * sort order of `array` and replaces criteria objects with their corresponding
  1569. * values.
  1570. *
  1571. * @private
  1572. * @param {Array} array The array to sort.
  1573. * @param {Function} comparer The function to define sort order.
  1574. * @returns {Array} Returns `array`.
  1575. */
  1576. function baseSortBy(array, comparer) {
  1577. var length = array.length;
  1578. array.sort(comparer);
  1579. while (length--) {
  1580. array[length] = array[length].value;
  1581. }
  1582. return array;
  1583. }
  1584. /**
  1585. * The base implementation of `_.sum` and `_.sumBy` without support for
  1586. * iteratee shorthands.
  1587. *
  1588. * @private
  1589. * @param {Array} array The array to iterate over.
  1590. * @param {Function} iteratee The function invoked per iteration.
  1591. * @returns {number} Returns the sum.
  1592. */
  1593. function baseSum(array, iteratee) {
  1594. var result,
  1595. index = -1,
  1596. length = array.length;
  1597. while (++index < length) {
  1598. var current = iteratee(array[index]);
  1599. if (current !== undefined) {
  1600. result = result === undefined ? current : (result + current);
  1601. }
  1602. }
  1603. return result;
  1604. }
  1605. /**
  1606. * The base implementation of `_.times` without support for iteratee shorthands
  1607. * or max array length checks.
  1608. *
  1609. * @private
  1610. * @param {number} n The number of times to invoke `iteratee`.
  1611. * @param {Function} iteratee The function invoked per iteration.
  1612. * @returns {Array} Returns the array of results.
  1613. */
  1614. function baseTimes(n, iteratee) {
  1615. var index = -1,
  1616. result = Array(n);
  1617. while (++index < n) {
  1618. result[index] = iteratee(index);
  1619. }
  1620. return result;
  1621. }
  1622. /**
  1623. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  1624. * of key-value pairs for `object` corresponding to the property names of `props`.
  1625. *
  1626. * @private
  1627. * @param {Object} object The object to query.
  1628. * @param {Array} props The property names to get values for.
  1629. * @returns {Object} Returns the key-value pairs.
  1630. */
  1631. function baseToPairs(object, props) {
  1632. return arrayMap(props, function(key) {
  1633. return [key, object[key]];
  1634. });
  1635. }
  1636. /**
  1637. * The base implementation of `_.unary` without support for storing metadata.
  1638. *
  1639. * @private
  1640. * @param {Function} func The function to cap arguments for.
  1641. * @returns {Function} Returns the new capped function.
  1642. */
  1643. function baseUnary(func) {
  1644. return function(value) {
  1645. return func(value);
  1646. };
  1647. }
  1648. /**
  1649. * The base implementation of `_.values` and `_.valuesIn` which creates an
  1650. * array of `object` property values corresponding to the property names
  1651. * of `props`.
  1652. *
  1653. * @private
  1654. * @param {Object} object The object to query.
  1655. * @param {Array} props The property names to get values for.
  1656. * @returns {Object} Returns the array of property values.
  1657. */
  1658. function baseValues(object, props) {
  1659. return arrayMap(props, function(key) {
  1660. return object[key];
  1661. });
  1662. }
  1663. /**
  1664. * Checks if a `cache` value for `key` exists.
  1665. *
  1666. * @private
  1667. * @param {Object} cache The cache to query.
  1668. * @param {string} key The key of the entry to check.
  1669. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1670. */
  1671. function cacheHas(cache, key) {
  1672. return cache.has(key);
  1673. }
  1674. /**
  1675. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  1676. * that is not found in the character symbols.
  1677. *
  1678. * @private
  1679. * @param {Array} strSymbols The string symbols to inspect.
  1680. * @param {Array} chrSymbols The character symbols to find.
  1681. * @returns {number} Returns the index of the first unmatched string symbol.
  1682. */
  1683. function charsStartIndex(strSymbols, chrSymbols) {
  1684. var index = -1,
  1685. length = strSymbols.length;
  1686. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1687. return index;
  1688. }
  1689. /**
  1690. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  1691. * that is not found in the character symbols.
  1692. *
  1693. * @private
  1694. * @param {Array} strSymbols The string symbols to inspect.
  1695. * @param {Array} chrSymbols The character symbols to find.
  1696. * @returns {number} Returns the index of the last unmatched string symbol.
  1697. */
  1698. function charsEndIndex(strSymbols, chrSymbols) {
  1699. var index = strSymbols.length;
  1700. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1701. return index;
  1702. }
  1703. /**
  1704. * Gets the number of `placeholder` occurrences in `array`.
  1705. *
  1706. * @private
  1707. * @param {Array} array The array to inspect.
  1708. * @param {*} placeholder The placeholder to search for.
  1709. * @returns {number} Returns the placeholder count.
  1710. */
  1711. function countHolders(array, placeholder) {
  1712. var length = array.length,
  1713. result = 0;
  1714. while (length--) {
  1715. if (array[length] === placeholder) {
  1716. ++result;
  1717. }
  1718. }
  1719. return result;
  1720. }
  1721. /**
  1722. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  1723. * letters to basic Latin letters.
  1724. *
  1725. * @private
  1726. * @param {string} letter The matched letter to deburr.
  1727. * @returns {string} Returns the deburred letter.
  1728. */
  1729. var deburrLetter = basePropertyOf(deburredLetters);
  1730. /**
  1731. * Used by `_.escape` to convert characters to HTML entities.
  1732. *
  1733. * @private
  1734. * @param {string} chr The matched character to escape.
  1735. * @returns {string} Returns the escaped character.
  1736. */
  1737. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  1738. /**
  1739. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  1740. *
  1741. * @private
  1742. * @param {string} chr The matched character to escape.
  1743. * @returns {string} Returns the escaped character.
  1744. */
  1745. function escapeStringChar(chr) {
  1746. return '\\' + stringEscapes[chr];
  1747. }
  1748. /**
  1749. * Gets the value at `key` of `object`.
  1750. *
  1751. * @private
  1752. * @param {Object} [object] The object to query.
  1753. * @param {string} key The key of the property to get.
  1754. * @returns {*} Returns the property value.
  1755. */
  1756. function getValue(object, key) {
  1757. return object == null ? undefined : object[key];
  1758. }
  1759. /**
  1760. * Checks if `string` contains Unicode symbols.
  1761. *
  1762. * @private
  1763. * @param {string} string The string to inspect.
  1764. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  1765. */
  1766. function hasUnicode(string) {
  1767. return reHasUnicode.test(string);
  1768. }
  1769. /**
  1770. * Checks if `string` contains a word composed of Unicode symbols.
  1771. *
  1772. * @private
  1773. * @param {string} string The string to inspect.
  1774. * @returns {boolean} Returns `true` if a word is found, else `false`.
  1775. */
  1776. function hasUnicodeWord(string) {
  1777. return reHasUnicodeWord.test(string);
  1778. }
  1779. /**
  1780. * Converts `iterator` to an array.
  1781. *
  1782. * @private
  1783. * @param {Object} iterator The iterator to convert.
  1784. * @returns {Array} Returns the converted array.
  1785. */
  1786. function iteratorToArray(iterator) {
  1787. var data,
  1788. result = [];
  1789. while (!(data = iterator.next()).done) {
  1790. result.push(data.value);
  1791. }
  1792. return result;
  1793. }
  1794. /**
  1795. * Converts `map` to its key-value pairs.
  1796. *
  1797. * @private
  1798. * @param {Object} map The map to convert.
  1799. * @returns {Array} Returns the key-value pairs.
  1800. */
  1801. function mapToArray(map) {
  1802. var index = -1,
  1803. result = Array(map.size);
  1804. map.forEach(function(value, key) {
  1805. result[++index] = [key, value];
  1806. });
  1807. return result;
  1808. }
  1809. /**
  1810. * Creates a unary function that invokes `func` with its argument transformed.
  1811. *
  1812. * @private
  1813. * @param {Function} func The function to wrap.
  1814. * @param {Function} transform The argument transform.
  1815. * @returns {Function} Returns the new function.
  1816. */
  1817. function overArg(func, transform) {
  1818. return function(arg) {
  1819. return func(transform(arg));
  1820. };
  1821. }
  1822. /**
  1823. * Replaces all `placeholder` elements in `array` with an internal placeholder
  1824. * and returns an array of their indexes.
  1825. *
  1826. * @private
  1827. * @param {Array} array The array to modify.
  1828. * @param {*} placeholder The placeholder to replace.
  1829. * @returns {Array} Returns the new array of placeholder indexes.
  1830. */
  1831. function replaceHolders(array, placeholder) {
  1832. var index = -1,
  1833. length = array.length,
  1834. resIndex = 0,
  1835. result = [];
  1836. while (++index < length) {
  1837. var value = array[index];
  1838. if (value === placeholder || value === PLACEHOLDER) {
  1839. array[index] = PLACEHOLDER;
  1840. result[resIndex++] = index;
  1841. }
  1842. }
  1843. return result;
  1844. }
  1845. /**
  1846. * Converts `set` to an array of its values.
  1847. *
  1848. * @private
  1849. * @param {Object} set The set to convert.
  1850. * @returns {Array} Returns the values.
  1851. */
  1852. function setToArray(set) {
  1853. var index = -1,
  1854. result = Array(set.size);
  1855. set.forEach(function(value) {
  1856. result[++index] = value;
  1857. });
  1858. return result;
  1859. }
  1860. /**
  1861. * Converts `set` to its value-value pairs.
  1862. *
  1863. * @private
  1864. * @param {Object} set The set to convert.
  1865. * @returns {Array} Returns the value-value pairs.
  1866. */
  1867. function setToPairs(set) {
  1868. var index = -1,
  1869. result = Array(set.size);
  1870. set.forEach(function(value) {
  1871. result[++index] = [value, value];
  1872. });
  1873. return result;
  1874. }
  1875. /**
  1876. * A specialized version of `_.indexOf` which performs strict equality
  1877. * comparisons of values, i.e. `===`.
  1878. *
  1879. * @private
  1880. * @param {Array} array The array to inspect.
  1881. * @param {*} value The value to search for.
  1882. * @param {number} fromIndex The index to search from.
  1883. * @returns {number} Returns the index of the matched value, else `-1`.
  1884. */
  1885. function strictIndexOf(array, value, fromIndex) {
  1886. var index = fromIndex - 1,
  1887. length = array.length;
  1888. while (++index < length) {
  1889. if (array[index] === value) {
  1890. return index;
  1891. }
  1892. }
  1893. return -1;
  1894. }
  1895. /**
  1896. * A specialized version of `_.lastIndexOf` which performs strict equality
  1897. * comparisons of values, i.e. `===`.
  1898. *
  1899. * @private
  1900. * @param {Array} array The array to inspect.
  1901. * @param {*} value The value to search for.
  1902. * @param {number} fromIndex The index to search from.
  1903. * @returns {number} Returns the index of the matched value, else `-1`.
  1904. */
  1905. function strictLastIndexOf(array, value, fromIndex) {
  1906. var index = fromIndex + 1;
  1907. while (index--) {
  1908. if (array[index] === value) {
  1909. return index;
  1910. }
  1911. }
  1912. return index;
  1913. }
  1914. /**
  1915. * Gets the number of symbols in `string`.
  1916. *
  1917. * @private
  1918. * @param {string} string The string to inspect.
  1919. * @returns {number} Returns the string size.
  1920. */
  1921. function stringSize(string) {
  1922. return hasUnicode(string)
  1923. ? unicodeSize(string)
  1924. : asciiSize(string);
  1925. }
  1926. /**
  1927. * Converts `string` to an array.
  1928. *
  1929. * @private
  1930. * @param {string} string The string to convert.
  1931. * @returns {Array} Returns the converted array.
  1932. */
  1933. function stringToArray(string) {
  1934. return hasUnicode(string)
  1935. ? unicodeToArray(string)
  1936. : asciiToArray(string);
  1937. }
  1938. /**
  1939. * Used by `_.unescape` to convert HTML entities to characters.
  1940. *
  1941. * @private
  1942. * @param {string} chr The matched character to unescape.
  1943. * @returns {string} Returns the unescaped character.
  1944. */
  1945. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  1946. /**
  1947. * Gets the size of a Unicode `string`.
  1948. *
  1949. * @private
  1950. * @param {string} string The string inspect.
  1951. * @returns {number} Returns the string size.
  1952. */
  1953. function unicodeSize(string) {
  1954. var result = reUnicode.lastIndex = 0;
  1955. while (reUnicode.test(string)) {
  1956. ++result;
  1957. }
  1958. return result;
  1959. }
  1960. /**
  1961. * Converts a Unicode `string` to an array.
  1962. *
  1963. * @private
  1964. * @param {string} string The string to convert.
  1965. * @returns {Array} Returns the converted array.
  1966. */
  1967. function unicodeToArray(string) {
  1968. return string.match(reUnicode) || [];
  1969. }
  1970. /**
  1971. * Splits a Unicode `string` into an array of its words.
  1972. *
  1973. * @private
  1974. * @param {string} The string to inspect.
  1975. * @returns {Array} Returns the words of `string`.
  1976. */
  1977. function unicodeWords(string) {
  1978. return string.match(reUnicodeWord) || [];
  1979. }
  1980. /*--------------------------------------------------------------------------*/
  1981. /**
  1982. * Create a new pristine `lodash` function using the `context` object.
  1983. *
  1984. * @static
  1985. * @memberOf _
  1986. * @since 1.1.0
  1987. * @category Util
  1988. * @param {Object} [context=root] The context object.
  1989. * @returns {Function} Returns a new `lodash` function.
  1990. * @example
  1991. *
  1992. * _.mixin({ 'foo': _.constant('foo') });
  1993. *
  1994. * var lodash = _.runInContext();
  1995. * lodash.mixin({ 'bar': lodash.constant('bar') });
  1996. *
  1997. * _.isFunction(_.foo);
  1998. * // => true
  1999. * _.isFunction(_.bar);
  2000. * // => false
  2001. *
  2002. * lodash.isFunction(lodash.foo);
  2003. * // => false
  2004. * lodash.isFunction(lodash.bar);
  2005. * // => true
  2006. *
  2007. * // Create a suped-up `defer` in Node.js.
  2008. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2009. */
  2010. var runInContext = (function runInContext(context) {
  2011. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2012. /** Built-in constructor references. */
  2013. var Array = context.Array,
  2014. Date = context.Date,
  2015. Error = context.Error,
  2016. Function = context.Function,
  2017. Math = context.Math,
  2018. Object = context.Object,
  2019. RegExp = context.RegExp,
  2020. String = context.String,
  2021. TypeError = context.TypeError;
  2022. /** Used for built-in method references. */
  2023. var arrayProto = Array.prototype,
  2024. funcProto = Function.prototype,
  2025. objectProto = Object.prototype;
  2026. /** Used to detect overreaching core-js shims. */
  2027. var coreJsData = context['__core-js_shared__'];
  2028. /** Used to resolve the decompiled source of functions. */
  2029. var funcToString = funcProto.toString;
  2030. /** Used to check objects for own properties. */
  2031. var hasOwnProperty = objectProto.hasOwnProperty;
  2032. /** Used to generate unique IDs. */
  2033. var idCounter = 0;
  2034. /** Used to detect methods masquerading as native. */
  2035. var maskSrcKey = (function() {
  2036. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2037. return uid ? ('Symbol(src)_1.' + uid) : '';
  2038. }());
  2039. /**
  2040. * Used to resolve the
  2041. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2042. * of values.
  2043. */
  2044. var nativeObjectToString = objectProto.toString;
  2045. /** Used to infer the `Object` constructor. */
  2046. var objectCtorString = funcToString.call(Object);
  2047. /** Used to restore the original `_` reference in `_.noConflict`. */
  2048. var oldDash = root._;
  2049. /** Used to detect if a method is native. */
  2050. var reIsNative = RegExp('^' +
  2051. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2052. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2053. );
  2054. /** Built-in value references. */
  2055. var Buffer = moduleExports ? context.Buffer : undefined,
  2056. Symbol = context.Symbol,
  2057. Uint8Array = context.Uint8Array,
  2058. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  2059. getPrototype = overArg(Object.getPrototypeOf, Object),
  2060. objectCreate = Object.create,
  2061. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  2062. splice = arrayProto.splice,
  2063. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  2064. symIterator = Symbol ? Symbol.iterator : undefined,
  2065. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  2066. var defineProperty = (function() {
  2067. try {
  2068. var func = getNative(Object, 'defineProperty');
  2069. func({}, '', {});
  2070. return func;
  2071. } catch (e) {}
  2072. }());
  2073. /** Mocked built-ins. */
  2074. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  2075. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  2076. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  2077. /* Built-in method references for those with the same name as other `lodash` methods. */
  2078. var nativeCeil = Math.ceil,
  2079. nativeFloor = Math.floor,
  2080. nativeGetSymbols = Object.getOwnPropertySymbols,
  2081. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  2082. nativeIsFinite = context.isFinite,
  2083. nativeJoin = arrayProto.join,
  2084. nativeKeys = overArg(Object.keys, Object),
  2085. nativeMax = Math.max,
  2086. nativeMin = Math.min,
  2087. nativeNow = Date.now,
  2088. nativeParseInt = context.parseInt,
  2089. nativeRandom = Math.random,
  2090. nativeReverse = arrayProto.reverse;
  2091. /* Built-in method references that are verified to be native. */
  2092. var DataView = getNative(context, 'DataView'),
  2093. Map = getNative(context, 'Map'),
  2094. Promise = getNative(context, 'Promise'),
  2095. Set = getNative(context, 'Set'),
  2096. WeakMap = getNative(context, 'WeakMap'),
  2097. nativeCreate = getNative(Object, 'create');
  2098. /** Used to store function metadata. */
  2099. var metaMap = WeakMap && new WeakMap;
  2100. /** Used to lookup unminified function names. */
  2101. var realNames = {};
  2102. /** Used to detect maps, sets, and weakmaps. */
  2103. var dataViewCtorString = toSource(DataView),
  2104. mapCtorString = toSource(Map),
  2105. promiseCtorString = toSource(Promise),
  2106. setCtorString = toSource(Set),
  2107. weakMapCtorString = toSource(WeakMap);
  2108. /** Used to convert symbols to primitives and strings. */
  2109. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2110. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  2111. symbolToString = symbolProto ? symbolProto.toString : undefined;
  2112. /*------------------------------------------------------------------------*/
  2113. /**
  2114. * Creates a `lodash` object which wraps `value` to enable implicit method
  2115. * chain sequences. Methods that operate on and return arrays, collections,
  2116. * and functions can be chained together. Methods that retrieve a single value
  2117. * or may return a primitive value will automatically end the chain sequence
  2118. * and return the unwrapped value. Otherwise, the value must be unwrapped
  2119. * with `_#value`.
  2120. *
  2121. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  2122. * enabled using `_.chain`.
  2123. *
  2124. * The execution of chained methods is lazy, that is, it's deferred until
  2125. * `_#value` is implicitly or explicitly called.
  2126. *
  2127. * Lazy evaluation allows several methods to support shortcut fusion.
  2128. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  2129. * the creation of intermediate arrays and can greatly reduce the number of
  2130. * iteratee executions. Sections of a chain sequence qualify for shortcut
  2131. * fusion if the section is applied to an array and iteratees accept only
  2132. * one argument. The heuristic for whether a section qualifies for shortcut
  2133. * fusion is subject to change.
  2134. *
  2135. * Chaining is supported in custom builds as long as the `_#value` method is
  2136. * directly or indirectly included in the build.
  2137. *
  2138. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  2139. *
  2140. * The wrapper `Array` methods are:
  2141. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  2142. *
  2143. * The wrapper `String` methods are:
  2144. * `replace` and `split`
  2145. *
  2146. * The wrapper methods that support shortcut fusion are:
  2147. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  2148. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  2149. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  2150. *
  2151. * The chainable wrapper methods are:
  2152. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  2153. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  2154. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  2155. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  2156. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  2157. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  2158. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  2159. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  2160. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  2161. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  2162. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  2163. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  2164. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  2165. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  2166. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  2167. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  2168. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  2169. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  2170. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  2171. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  2172. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  2173. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  2174. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  2175. * `zipObject`, `zipObjectDeep`, and `zipWith`
  2176. *
  2177. * The wrapper methods that are **not** chainable by default are:
  2178. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  2179. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  2180. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  2181. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  2182. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  2183. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  2184. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  2185. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  2186. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  2187. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  2188. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  2189. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  2190. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  2191. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  2192. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  2193. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  2194. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  2195. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  2196. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  2197. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  2198. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  2199. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  2200. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  2201. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  2202. * `upperFirst`, `value`, and `words`
  2203. *
  2204. * @name _
  2205. * @constructor
  2206. * @category Seq
  2207. * @param {*} value The value to wrap in a `lodash` instance.
  2208. * @returns {Object} Returns the new `lodash` wrapper instance.
  2209. * @example
  2210. *
  2211. * function square(n) {
  2212. * return n * n;
  2213. * }
  2214. *
  2215. * var wrapped = _([1, 2, 3]);
  2216. *
  2217. * // Returns an unwrapped value.
  2218. * wrapped.reduce(_.add);
  2219. * // => 6
  2220. *
  2221. * // Returns a wrapped value.
  2222. * var squares = wrapped.map(square);
  2223. *
  2224. * _.isArray(squares);
  2225. * // => false
  2226. *
  2227. * _.isArray(squares.value());
  2228. * // => true
  2229. */
  2230. function lodash(value) {
  2231. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  2232. if (value instanceof LodashWrapper) {
  2233. return value;
  2234. }
  2235. if (hasOwnProperty.call(value, '__wrapped__')) {
  2236. return wrapperClone(value);
  2237. }
  2238. }
  2239. return new LodashWrapper(value);
  2240. }
  2241. /**
  2242. * The base implementation of `_.create` without support for assigning
  2243. * properties to the created object.
  2244. *
  2245. * @private
  2246. * @param {Object} proto The object to inherit from.
  2247. * @returns {Object} Returns the new object.
  2248. */
  2249. var baseCreate = (function() {
  2250. function object() {}
  2251. return function(proto) {
  2252. if (!isObject(proto)) {
  2253. return {};
  2254. }
  2255. if (objectCreate) {
  2256. return objectCreate(proto);
  2257. }
  2258. object.prototype = proto;
  2259. var result = new object;
  2260. object.prototype = undefined;
  2261. return result;
  2262. };
  2263. }());
  2264. /**
  2265. * The function whose prototype chain sequence wrappers inherit from.
  2266. *
  2267. * @private
  2268. */
  2269. function baseLodash() {
  2270. // No operation performed.
  2271. }
  2272. /**
  2273. * The base constructor for creating `lodash` wrapper objects.
  2274. *
  2275. * @private
  2276. * @param {*} value The value to wrap.
  2277. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  2278. */
  2279. function LodashWrapper(value, chainAll) {
  2280. this.__wrapped__ = value;
  2281. this.__actions__ = [];
  2282. this.__chain__ = !!chainAll;
  2283. this.__index__ = 0;
  2284. this.__values__ = undefined;
  2285. }
  2286. /**
  2287. * By default, the template delimiters used by lodash are like those in
  2288. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  2289. * following template settings to use alternative delimiters.
  2290. *
  2291. * @static
  2292. * @memberOf _
  2293. * @type {Object}
  2294. */
  2295. lodash.templateSettings = {
  2296. /**
  2297. * Used to detect `data` property values to be HTML-escaped.
  2298. *
  2299. * @memberOf _.templateSettings
  2300. * @type {RegExp}
  2301. */
  2302. 'escape': reEscape,
  2303. /**
  2304. * Used to detect code to be evaluated.
  2305. *
  2306. * @memberOf _.templateSettings
  2307. * @type {RegExp}
  2308. */
  2309. 'evaluate': reEvaluate,
  2310. /**
  2311. * Used to detect `data` property values to inject.
  2312. *
  2313. * @memberOf _.templateSettings
  2314. * @type {RegExp}
  2315. */
  2316. 'interpolate': reInterpolate,
  2317. /**
  2318. * Used to reference the data object in the template text.
  2319. *
  2320. * @memberOf _.templateSettings
  2321. * @type {string}
  2322. */
  2323. 'variable': '',
  2324. /**
  2325. * Used to import variables into the compiled template.
  2326. *
  2327. * @memberOf _.templateSettings
  2328. * @type {Object}
  2329. */
  2330. 'imports': {
  2331. /**
  2332. * A reference to the `lodash` function.
  2333. *
  2334. * @memberOf _.templateSettings.imports
  2335. * @type {Function}
  2336. */
  2337. '_': lodash
  2338. }
  2339. };
  2340. // Ensure wrappers are instances of `baseLodash`.
  2341. lodash.prototype = baseLodash.prototype;
  2342. lodash.prototype.constructor = lodash;
  2343. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  2344. LodashWrapper.prototype.constructor = LodashWrapper;
  2345. /*------------------------------------------------------------------------*/
  2346. /**
  2347. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  2348. *
  2349. * @private
  2350. * @constructor
  2351. * @param {*} value The value to wrap.
  2352. */
  2353. function LazyWrapper(value) {
  2354. this.__wrapped__ = value;
  2355. this.__actions__ = [];
  2356. this.__dir__ = 1;
  2357. this.__filtered__ = false;
  2358. this.__iteratees__ = [];
  2359. this.__takeCount__ = MAX_ARRAY_LENGTH;
  2360. this.__views__ = [];
  2361. }
  2362. /**
  2363. * Creates a clone of the lazy wrapper object.
  2364. *
  2365. * @private
  2366. * @name clone
  2367. * @memberOf LazyWrapper
  2368. * @returns {Object} Returns the cloned `LazyWrapper` object.
  2369. */
  2370. function lazyClone() {
  2371. var result = new LazyWrapper(this.__wrapped__);
  2372. result.__actions__ = copyArray(this.__actions__);
  2373. result.__dir__ = this.__dir__;
  2374. result.__filtered__ = this.__filtered__;
  2375. result.__iteratees__ = copyArray(this.__iteratees__);
  2376. result.__takeCount__ = this.__takeCount__;
  2377. result.__views__ = copyArray(this.__views__);
  2378. return result;
  2379. }
  2380. /**
  2381. * Reverses the direction of lazy iteration.
  2382. *
  2383. * @private
  2384. * @name reverse
  2385. * @memberOf LazyWrapper
  2386. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  2387. */
  2388. function lazyReverse() {
  2389. if (this.__filtered__) {
  2390. var result = new LazyWrapper(this);
  2391. result.__dir__ = -1;
  2392. result.__filtered__ = true;
  2393. } else {
  2394. result = this.clone();
  2395. result.__dir__ *= -1;
  2396. }
  2397. return result;
  2398. }
  2399. /**
  2400. * Extracts the unwrapped value from its lazy wrapper.
  2401. *
  2402. * @private
  2403. * @name value
  2404. * @memberOf LazyWrapper
  2405. * @returns {*} Returns the unwrapped value.
  2406. */
  2407. function lazyValue() {
  2408. var array = this.__wrapped__.value(),
  2409. dir = this.__dir__,
  2410. isArr = isArray(array),
  2411. isRight = dir < 0,
  2412. arrLength = isArr ? array.length : 0,
  2413. view = getView(0, arrLength, this.__views__),
  2414. start = view.start,
  2415. end = view.end,
  2416. length = end - start,
  2417. index = isRight ? end : (start - 1),
  2418. iteratees = this.__iteratees__,
  2419. iterLength = iteratees.length,
  2420. resIndex = 0,
  2421. takeCount = nativeMin(length, this.__takeCount__);
  2422. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  2423. return baseWrapperValue(array, this.__actions__);
  2424. }
  2425. var result = [];
  2426. outer:
  2427. while (length-- && resIndex < takeCount) {
  2428. index += dir;
  2429. var iterIndex = -1,
  2430. value = array[index];
  2431. while (++iterIndex < iterLength) {
  2432. var data = iteratees[iterIndex],
  2433. iteratee = data.iteratee,
  2434. type = data.type,
  2435. computed = iteratee(value);
  2436. if (type == LAZY_MAP_FLAG) {
  2437. value = computed;
  2438. } else if (!computed) {
  2439. if (type == LAZY_FILTER_FLAG) {
  2440. continue outer;
  2441. } else {
  2442. break outer;
  2443. }
  2444. }
  2445. }
  2446. result[resIndex++] = value;
  2447. }
  2448. return result;
  2449. }
  2450. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  2451. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  2452. LazyWrapper.prototype.constructor = LazyWrapper;
  2453. /*------------------------------------------------------------------------*/
  2454. /**
  2455. * Creates a hash object.
  2456. *
  2457. * @private
  2458. * @constructor
  2459. * @param {Array} [entries] The key-value pairs to cache.
  2460. */
  2461. function Hash(entries) {
  2462. var index = -1,
  2463. length = entries == null ? 0 : entries.length;
  2464. this.clear();
  2465. while (++index < length) {
  2466. var entry = entries[index];
  2467. this.set(entry[0], entry[1]);
  2468. }
  2469. }
  2470. /**
  2471. * Removes all key-value entries from the hash.
  2472. *
  2473. * @private
  2474. * @name clear
  2475. * @memberOf Hash
  2476. */
  2477. function hashClear() {
  2478. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2479. this.size = 0;
  2480. }
  2481. /**
  2482. * Removes `key` and its value from the hash.
  2483. *
  2484. * @private
  2485. * @name delete
  2486. * @memberOf Hash
  2487. * @param {Object} hash The hash to modify.
  2488. * @param {string} key The key of the value to remove.
  2489. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2490. */
  2491. function hashDelete(key) {
  2492. var result = this.has(key) && delete this.__data__[key];
  2493. this.size -= result ? 1 : 0;
  2494. return result;
  2495. }
  2496. /**
  2497. * Gets the hash value for `key`.
  2498. *
  2499. * @private
  2500. * @name get
  2501. * @memberOf Hash
  2502. * @param {string} key The key of the value to get.
  2503. * @returns {*} Returns the entry value.
  2504. */
  2505. function hashGet(key) {
  2506. var data = this.__data__;
  2507. if (nativeCreate) {
  2508. var result = data[key];
  2509. return result === HASH_UNDEFINED ? undefined : result;
  2510. }
  2511. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  2512. }
  2513. /**
  2514. * Checks if a hash value for `key` exists.
  2515. *
  2516. * @private
  2517. * @name has
  2518. * @memberOf Hash
  2519. * @param {string} key The key of the entry to check.
  2520. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2521. */
  2522. function hashHas(key) {
  2523. var data = this.__data__;
  2524. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  2525. }
  2526. /**
  2527. * Sets the hash `key` to `value`.
  2528. *
  2529. * @private
  2530. * @name set
  2531. * @memberOf Hash
  2532. * @param {string} key The key of the value to set.
  2533. * @param {*} value The value to set.
  2534. * @returns {Object} Returns the hash instance.
  2535. */
  2536. function hashSet(key, value) {
  2537. var data = this.__data__;
  2538. this.size += this.has(key) ? 0 : 1;
  2539. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  2540. return this;
  2541. }
  2542. // Add methods to `Hash`.
  2543. Hash.prototype.clear = hashClear;
  2544. Hash.prototype['delete'] = hashDelete;
  2545. Hash.prototype.get = hashGet;
  2546. Hash.prototype.has = hashHas;
  2547. Hash.prototype.set = hashSet;
  2548. /*------------------------------------------------------------------------*/
  2549. /**
  2550. * Creates an list cache object.
  2551. *
  2552. * @private
  2553. * @constructor
  2554. * @param {Array} [entries] The key-value pairs to cache.
  2555. */
  2556. function ListCache(entries) {
  2557. var index = -1,
  2558. length = entries == null ? 0 : entries.length;
  2559. this.clear();
  2560. while (++index < length) {
  2561. var entry = entries[index];
  2562. this.set(entry[0], entry[1]);
  2563. }
  2564. }
  2565. /**
  2566. * Removes all key-value entries from the list cache.
  2567. *
  2568. * @private
  2569. * @name clear
  2570. * @memberOf ListCache
  2571. */
  2572. function listCacheClear() {
  2573. this.__data__ = [];
  2574. this.size = 0;
  2575. }
  2576. /**
  2577. * Removes `key` and its value from the list cache.
  2578. *
  2579. * @private
  2580. * @name delete
  2581. * @memberOf ListCache
  2582. * @param {string} key The key of the value to remove.
  2583. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2584. */
  2585. function listCacheDelete(key) {
  2586. var data = this.__data__,
  2587. index = assocIndexOf(data, key);
  2588. if (index < 0) {
  2589. return false;
  2590. }
  2591. var lastIndex = data.length - 1;
  2592. if (index == lastIndex) {
  2593. data.pop();
  2594. } else {
  2595. splice.call(data, index, 1);
  2596. }
  2597. --this.size;
  2598. return true;
  2599. }
  2600. /**
  2601. * Gets the list cache value for `key`.
  2602. *
  2603. * @private
  2604. * @name get
  2605. * @memberOf ListCache
  2606. * @param {string} key The key of the value to get.
  2607. * @returns {*} Returns the entry value.
  2608. */
  2609. function listCacheGet(key) {
  2610. var data = this.__data__,
  2611. index = assocIndexOf(data, key);
  2612. return index < 0 ? undefined : data[index][1];
  2613. }
  2614. /**
  2615. * Checks if a list cache value for `key` exists.
  2616. *
  2617. * @private
  2618. * @name has
  2619. * @memberOf ListCache
  2620. * @param {string} key The key of the entry to check.
  2621. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2622. */
  2623. function listCacheHas(key) {
  2624. return assocIndexOf(this.__data__, key) > -1;
  2625. }
  2626. /**
  2627. * Sets the list cache `key` to `value`.
  2628. *
  2629. * @private
  2630. * @name set
  2631. * @memberOf ListCache
  2632. * @param {string} key The key of the value to set.
  2633. * @param {*} value The value to set.
  2634. * @returns {Object} Returns the list cache instance.
  2635. */
  2636. function listCacheSet(key, value) {
  2637. var data = this.__data__,
  2638. index = assocIndexOf(data, key);
  2639. if (index < 0) {
  2640. ++this.size;
  2641. data.push([key, value]);
  2642. } else {
  2643. data[index][1] = value;
  2644. }
  2645. return this;
  2646. }
  2647. // Add methods to `ListCache`.
  2648. ListCache.prototype.clear = listCacheClear;
  2649. ListCache.prototype['delete'] = listCacheDelete;
  2650. ListCache.prototype.get = listCacheGet;
  2651. ListCache.prototype.has = listCacheHas;
  2652. ListCache.prototype.set = listCacheSet;
  2653. /*------------------------------------------------------------------------*/
  2654. /**
  2655. * Creates a map cache object to store key-value pairs.
  2656. *
  2657. * @private
  2658. * @constructor
  2659. * @param {Array} [entries] The key-value pairs to cache.
  2660. */
  2661. function MapCache(entries) {
  2662. var index = -1,
  2663. length = entries == null ? 0 : entries.length;
  2664. this.clear();
  2665. while (++index < length) {
  2666. var entry = entries[index];
  2667. this.set(entry[0], entry[1]);
  2668. }
  2669. }
  2670. /**
  2671. * Removes all key-value entries from the map.
  2672. *
  2673. * @private
  2674. * @name clear
  2675. * @memberOf MapCache
  2676. */
  2677. function mapCacheClear() {
  2678. this.size = 0;
  2679. this.__data__ = {
  2680. 'hash': new Hash,
  2681. 'map': new (Map || ListCache),
  2682. 'string': new Hash
  2683. };
  2684. }
  2685. /**
  2686. * Removes `key` and its value from the map.
  2687. *
  2688. * @private
  2689. * @name delete
  2690. * @memberOf MapCache
  2691. * @param {string} key The key of the value to remove.
  2692. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2693. */
  2694. function mapCacheDelete(key) {
  2695. var result = getMapData(this, key)['delete'](key);
  2696. this.size -= result ? 1 : 0;
  2697. return result;
  2698. }
  2699. /**
  2700. * Gets the map value for `key`.
  2701. *
  2702. * @private
  2703. * @name get
  2704. * @memberOf MapCache
  2705. * @param {string} key The key of the value to get.
  2706. * @returns {*} Returns the entry value.
  2707. */
  2708. function mapCacheGet(key) {
  2709. return getMapData(this, key).get(key);
  2710. }
  2711. /**
  2712. * Checks if a map value for `key` exists.
  2713. *
  2714. * @private
  2715. * @name has
  2716. * @memberOf MapCache
  2717. * @param {string} key The key of the entry to check.
  2718. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2719. */
  2720. function mapCacheHas(key) {
  2721. return getMapData(this, key).has(key);
  2722. }
  2723. /**
  2724. * Sets the map `key` to `value`.
  2725. *
  2726. * @private
  2727. * @name set
  2728. * @memberOf MapCache
  2729. * @param {string} key The key of the value to set.
  2730. * @param {*} value The value to set.
  2731. * @returns {Object} Returns the map cache instance.
  2732. */
  2733. function mapCacheSet(key, value) {
  2734. var data = getMapData(this, key),
  2735. size = data.size;
  2736. data.set(key, value);
  2737. this.size += data.size == size ? 0 : 1;
  2738. return this;
  2739. }
  2740. // Add methods to `MapCache`.
  2741. MapCache.prototype.clear = mapCacheClear;
  2742. MapCache.prototype['delete'] = mapCacheDelete;
  2743. MapCache.prototype.get = mapCacheGet;
  2744. MapCache.prototype.has = mapCacheHas;
  2745. MapCache.prototype.set = mapCacheSet;
  2746. /*------------------------------------------------------------------------*/
  2747. /**
  2748. *
  2749. * Creates an array cache object to store unique values.
  2750. *
  2751. * @private
  2752. * @constructor
  2753. * @param {Array} [values] The values to cache.
  2754. */
  2755. function SetCache(values) {
  2756. var index = -1,
  2757. length = values == null ? 0 : values.length;
  2758. this.__data__ = new MapCache;
  2759. while (++index < length) {
  2760. this.add(values[index]);
  2761. }
  2762. }
  2763. /**
  2764. * Adds `value` to the array cache.
  2765. *
  2766. * @private
  2767. * @name add
  2768. * @memberOf SetCache
  2769. * @alias push
  2770. * @param {*} value The value to cache.
  2771. * @returns {Object} Returns the cache instance.
  2772. */
  2773. function setCacheAdd(value) {
  2774. this.__data__.set(value, HASH_UNDEFINED);
  2775. return this;
  2776. }
  2777. /**
  2778. * Checks if `value` is in the array cache.
  2779. *
  2780. * @private
  2781. * @name has
  2782. * @memberOf SetCache
  2783. * @param {*} value The value to search for.
  2784. * @returns {number} Returns `true` if `value` is found, else `false`.
  2785. */
  2786. function setCacheHas(value) {
  2787. return this.__data__.has(value);
  2788. }
  2789. // Add methods to `SetCache`.
  2790. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2791. SetCache.prototype.has = setCacheHas;
  2792. /*------------------------------------------------------------------------*/
  2793. /**
  2794. * Creates a stack cache object to store key-value pairs.
  2795. *
  2796. * @private
  2797. * @constructor
  2798. * @param {Array} [entries] The key-value pairs to cache.
  2799. */
  2800. function Stack(entries) {
  2801. var data = this.__data__ = new ListCache(entries);
  2802. this.size = data.size;
  2803. }
  2804. /**
  2805. * Removes all key-value entries from the stack.
  2806. *
  2807. * @private
  2808. * @name clear
  2809. * @memberOf Stack
  2810. */
  2811. function stackClear() {
  2812. this.__data__ = new ListCache;
  2813. this.size = 0;
  2814. }
  2815. /**
  2816. * Removes `key` and its value from the stack.
  2817. *
  2818. * @private
  2819. * @name delete
  2820. * @memberOf Stack
  2821. * @param {string} key The key of the value to remove.
  2822. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2823. */
  2824. function stackDelete(key) {
  2825. var data = this.__data__,
  2826. result = data['delete'](key);
  2827. this.size = data.size;
  2828. return result;
  2829. }
  2830. /**
  2831. * Gets the stack value for `key`.
  2832. *
  2833. * @private
  2834. * @name get
  2835. * @memberOf Stack
  2836. * @param {string} key The key of the value to get.
  2837. * @returns {*} Returns the entry value.
  2838. */
  2839. function stackGet(key) {
  2840. return this.__data__.get(key);
  2841. }
  2842. /**
  2843. * Checks if a stack value for `key` exists.
  2844. *
  2845. * @private
  2846. * @name has
  2847. * @memberOf Stack
  2848. * @param {string} key The key of the entry to check.
  2849. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2850. */
  2851. function stackHas(key) {
  2852. return this.__data__.has(key);
  2853. }
  2854. /**
  2855. * Sets the stack `key` to `value`.
  2856. *
  2857. * @private
  2858. * @name set
  2859. * @memberOf Stack
  2860. * @param {string} key The key of the value to set.
  2861. * @param {*} value The value to set.
  2862. * @returns {Object} Returns the stack cache instance.
  2863. */
  2864. function stackSet(key, value) {
  2865. var data = this.__data__;
  2866. if (data instanceof ListCache) {
  2867. var pairs = data.__data__;
  2868. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  2869. pairs.push([key, value]);
  2870. this.size = ++data.size;
  2871. return this;
  2872. }
  2873. data = this.__data__ = new MapCache(pairs);
  2874. }
  2875. data.set(key, value);
  2876. this.size = data.size;
  2877. return this;
  2878. }
  2879. // Add methods to `Stack`.
  2880. Stack.prototype.clear = stackClear;
  2881. Stack.prototype['delete'] = stackDelete;
  2882. Stack.prototype.get = stackGet;
  2883. Stack.prototype.has = stackHas;
  2884. Stack.prototype.set = stackSet;
  2885. /*------------------------------------------------------------------------*/
  2886. /**
  2887. * Creates an array of the enumerable property names of the array-like `value`.
  2888. *
  2889. * @private
  2890. * @param {*} value The value to query.
  2891. * @param {boolean} inherited Specify returning inherited property names.
  2892. * @returns {Array} Returns the array of property names.
  2893. */
  2894. function arrayLikeKeys(value, inherited) {
  2895. var isArr = isArray(value),
  2896. isArg = !isArr && isArguments(value),
  2897. isBuff = !isArr && !isArg && isBuffer(value),
  2898. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  2899. skipIndexes = isArr || isArg || isBuff || isType,
  2900. result = skipIndexes ? baseTimes(value.length, String) : [],
  2901. length = result.length;
  2902. for (var key in value) {
  2903. if ((inherited || hasOwnProperty.call(value, key)) &&
  2904. !(skipIndexes && (
  2905. // Safari 9 has enumerable `arguments.length` in strict mode.
  2906. key == 'length' ||
  2907. // Node.js 0.10 has enumerable non-index properties on buffers.
  2908. (isBuff && (key == 'offset' || key == 'parent')) ||
  2909. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  2910. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  2911. // Skip index properties.
  2912. isIndex(key, length)
  2913. ))) {
  2914. result.push(key);
  2915. }
  2916. }
  2917. return result;
  2918. }
  2919. /**
  2920. * A specialized version of `_.sample` for arrays.
  2921. *
  2922. * @private
  2923. * @param {Array} array The array to sample.
  2924. * @returns {*} Returns the random element.
  2925. */
  2926. function arraySample(array) {
  2927. var length = array.length;
  2928. return length ? array[baseRandom(0, length - 1)] : undefined;
  2929. }
  2930. /**
  2931. * A specialized version of `_.sampleSize` for arrays.
  2932. *
  2933. * @private
  2934. * @param {Array} array The array to sample.
  2935. * @param {number} n The number of elements to sample.
  2936. * @returns {Array} Returns the random elements.
  2937. */
  2938. function arraySampleSize(array, n) {
  2939. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  2940. }
  2941. /**
  2942. * A specialized version of `_.shuffle` for arrays.
  2943. *
  2944. * @private
  2945. * @param {Array} array The array to shuffle.
  2946. * @returns {Array} Returns the new shuffled array.
  2947. */
  2948. function arrayShuffle(array) {
  2949. return shuffleSelf(copyArray(array));
  2950. }
  2951. /**
  2952. * This function is like `assignValue` except that it doesn't assign
  2953. * `undefined` values.
  2954. *
  2955. * @private
  2956. * @param {Object} object The object to modify.
  2957. * @param {string} key The key of the property to assign.
  2958. * @param {*} value The value to assign.
  2959. */
  2960. function assignMergeValue(object, key, value) {
  2961. if ((value !== undefined && !eq(object[key], value)) ||
  2962. (value === undefined && !(key in object))) {
  2963. baseAssignValue(object, key, value);
  2964. }
  2965. }
  2966. /**
  2967. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  2968. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2969. * for equality comparisons.
  2970. *
  2971. * @private
  2972. * @param {Object} object The object to modify.
  2973. * @param {string} key The key of the property to assign.
  2974. * @param {*} value The value to assign.
  2975. */
  2976. function assignValue(object, key, value) {
  2977. var objValue = object[key];
  2978. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  2979. (value === undefined && !(key in object))) {
  2980. baseAssignValue(object, key, value);
  2981. }
  2982. }
  2983. /**
  2984. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2985. *
  2986. * @private
  2987. * @param {Array} array The array to inspect.
  2988. * @param {*} key The key to search for.
  2989. * @returns {number} Returns the index of the matched value, else `-1`.
  2990. */
  2991. function assocIndexOf(array, key) {
  2992. var length = array.length;
  2993. while (length--) {
  2994. if (eq(array[length][0], key)) {
  2995. return length;
  2996. }
  2997. }
  2998. return -1;
  2999. }
  3000. /**
  3001. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3002. * by `iteratee` and values set by `setter`.
  3003. *
  3004. * @private
  3005. * @param {Array|Object} collection The collection to iterate over.
  3006. * @param {Function} setter The function to set `accumulator` values.
  3007. * @param {Function} iteratee The iteratee to transform keys.
  3008. * @param {Object} accumulator The initial aggregated object.
  3009. * @returns {Function} Returns `accumulator`.
  3010. */
  3011. function baseAggregator(collection, setter, iteratee, accumulator) {
  3012. baseEach(collection, function(value, key, collection) {
  3013. setter(accumulator, value, iteratee(value), collection);
  3014. });
  3015. return accumulator;
  3016. }
  3017. /**
  3018. * The base implementation of `_.assign` without support for multiple sources
  3019. * or `customizer` functions.
  3020. *
  3021. * @private
  3022. * @param {Object} object The destination object.
  3023. * @param {Object} source The source object.
  3024. * @returns {Object} Returns `object`.
  3025. */
  3026. function baseAssign(object, source) {
  3027. return object && copyObject(source, keys(source), object);
  3028. }
  3029. /**
  3030. * The base implementation of `_.assignIn` without support for multiple sources
  3031. * or `customizer` functions.
  3032. *
  3033. * @private
  3034. * @param {Object} object The destination object.
  3035. * @param {Object} source The source object.
  3036. * @returns {Object} Returns `object`.
  3037. */
  3038. function baseAssignIn(object, source) {
  3039. return object && copyObject(source, keysIn(source), object);
  3040. }
  3041. /**
  3042. * The base implementation of `assignValue` and `assignMergeValue` without
  3043. * value checks.
  3044. *
  3045. * @private
  3046. * @param {Object} object The object to modify.
  3047. * @param {string} key The key of the property to assign.
  3048. * @param {*} value The value to assign.
  3049. */
  3050. function baseAssignValue(object, key, value) {
  3051. if (key == '__proto__' && defineProperty) {
  3052. defineProperty(object, key, {
  3053. 'configurable': true,
  3054. 'enumerable': true,
  3055. 'value': value,
  3056. 'writable': true
  3057. });
  3058. } else {
  3059. object[key] = value;
  3060. }
  3061. }
  3062. /**
  3063. * The base implementation of `_.at` without support for individual paths.
  3064. *
  3065. * @private
  3066. * @param {Object} object The object to iterate over.
  3067. * @param {string[]} paths The property paths to pick.
  3068. * @returns {Array} Returns the picked elements.
  3069. */
  3070. function baseAt(object, paths) {
  3071. var index = -1,
  3072. length = paths.length,
  3073. result = Array(length),
  3074. skip = object == null;
  3075. while (++index < length) {
  3076. result[index] = skip ? undefined : get(object, paths[index]);
  3077. }
  3078. return result;
  3079. }
  3080. /**
  3081. * The base implementation of `_.clamp` which doesn't coerce arguments.
  3082. *
  3083. * @private
  3084. * @param {number} number The number to clamp.
  3085. * @param {number} [lower] The lower bound.
  3086. * @param {number} upper The upper bound.
  3087. * @returns {number} Returns the clamped number.
  3088. */
  3089. function baseClamp(number, lower, upper) {
  3090. if (number === number) {
  3091. if (upper !== undefined) {
  3092. number = number <= upper ? number : upper;
  3093. }
  3094. if (lower !== undefined) {
  3095. number = number >= lower ? number : lower;
  3096. }
  3097. }
  3098. return number;
  3099. }
  3100. /**
  3101. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3102. * traversed objects.
  3103. *
  3104. * @private
  3105. * @param {*} value The value to clone.
  3106. * @param {boolean} bitmask The bitmask flags.
  3107. * 1 - Deep clone
  3108. * 2 - Flatten inherited properties
  3109. * 4 - Clone symbols
  3110. * @param {Function} [customizer] The function to customize cloning.
  3111. * @param {string} [key] The key of `value`.
  3112. * @param {Object} [object] The parent object of `value`.
  3113. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3114. * @returns {*} Returns the cloned value.
  3115. */
  3116. function baseClone(value, bitmask, customizer, key, object, stack) {
  3117. var result,
  3118. isDeep = bitmask & CLONE_DEEP_FLAG,
  3119. isFlat = bitmask & CLONE_FLAT_FLAG,
  3120. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  3121. if (customizer) {
  3122. result = object ? customizer(value, key, object, stack) : customizer(value);
  3123. }
  3124. if (result !== undefined) {
  3125. return result;
  3126. }
  3127. if (!isObject(value)) {
  3128. return value;
  3129. }
  3130. var isArr = isArray(value);
  3131. if (isArr) {
  3132. result = initCloneArray(value);
  3133. if (!isDeep) {
  3134. return copyArray(value, result);
  3135. }
  3136. } else {
  3137. var tag = getTag(value),
  3138. isFunc = tag == funcTag || tag == genTag;
  3139. if (isBuffer(value)) {
  3140. return cloneBuffer(value, isDeep);
  3141. }
  3142. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  3143. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  3144. if (!isDeep) {
  3145. return isFlat
  3146. ? copySymbolsIn(value, baseAssignIn(result, value))
  3147. : copySymbols(value, baseAssign(result, value));
  3148. }
  3149. } else {
  3150. if (!cloneableTags[tag]) {
  3151. return object ? value : {};
  3152. }
  3153. result = initCloneByTag(value, tag, baseClone, isDeep);
  3154. }
  3155. }
  3156. // Check for circular references and return its corresponding clone.
  3157. stack || (stack = new Stack);
  3158. var stacked = stack.get(value);
  3159. if (stacked) {
  3160. return stacked;
  3161. }
  3162. stack.set(value, result);
  3163. var keysFunc = isFull
  3164. ? (isFlat ? getAllKeysIn : getAllKeys)
  3165. : (isFlat ? keysIn : keys);
  3166. var props = isArr ? undefined : keysFunc(value);
  3167. arrayEach(props || value, function(subValue, key) {
  3168. if (props) {
  3169. key = subValue;
  3170. subValue = value[key];
  3171. }
  3172. // Recursively populate clone (susceptible to call stack limits).
  3173. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3174. });
  3175. return result;
  3176. }
  3177. /**
  3178. * The base implementation of `_.conforms` which doesn't clone `source`.
  3179. *
  3180. * @private
  3181. * @param {Object} source The object of property predicates to conform to.
  3182. * @returns {Function} Returns the new spec function.
  3183. */
  3184. function baseConforms(source) {
  3185. var props = keys(source);
  3186. return function(object) {
  3187. return baseConformsTo(object, source, props);
  3188. };
  3189. }
  3190. /**
  3191. * The base implementation of `_.conformsTo` which accepts `props` to check.
  3192. *
  3193. * @private
  3194. * @param {Object} object The object to inspect.
  3195. * @param {Object} source The object of property predicates to conform to.
  3196. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  3197. */
  3198. function baseConformsTo(object, source, props) {
  3199. var length = props.length;
  3200. if (object == null) {
  3201. return !length;
  3202. }
  3203. object = Object(object);
  3204. while (length--) {
  3205. var key = props[length],
  3206. predicate = source[key],
  3207. value = object[key];
  3208. if ((value === undefined && !(key in object)) || !predicate(value)) {
  3209. return false;
  3210. }
  3211. }
  3212. return true;
  3213. }
  3214. /**
  3215. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  3216. * to provide to `func`.
  3217. *
  3218. * @private
  3219. * @param {Function} func The function to delay.
  3220. * @param {number} wait The number of milliseconds to delay invocation.
  3221. * @param {Array} args The arguments to provide to `func`.
  3222. * @returns {number|Object} Returns the timer id or timeout object.
  3223. */
  3224. function baseDelay(func, wait, args) {
  3225. if (typeof func != 'function') {
  3226. throw new TypeError(FUNC_ERROR_TEXT);
  3227. }
  3228. return setTimeout(function() { func.apply(undefined, args); }, wait);
  3229. }
  3230. /**
  3231. * The base implementation of methods like `_.difference` without support
  3232. * for excluding multiple arrays or iteratee shorthands.
  3233. *
  3234. * @private
  3235. * @param {Array} array The array to inspect.
  3236. * @param {Array} values The values to exclude.
  3237. * @param {Function} [iteratee] The iteratee invoked per element.
  3238. * @param {Function} [comparator] The comparator invoked per element.
  3239. * @returns {Array} Returns the new array of filtered values.
  3240. */
  3241. function baseDifference(array, values, iteratee, comparator) {
  3242. var index = -1,
  3243. includes = arrayIncludes,
  3244. isCommon = true,
  3245. length = array.length,
  3246. result = [],
  3247. valuesLength = values.length;
  3248. if (!length) {
  3249. return result;
  3250. }
  3251. if (iteratee) {
  3252. values = arrayMap(values, baseUnary(iteratee));
  3253. }
  3254. if (comparator) {
  3255. includes = arrayIncludesWith;
  3256. isCommon = false;
  3257. }
  3258. else if (values.length >= LARGE_ARRAY_SIZE) {
  3259. includes = cacheHas;
  3260. isCommon = false;
  3261. values = new SetCache(values);
  3262. }
  3263. outer:
  3264. while (++index < length) {
  3265. var value = array[index],
  3266. computed = iteratee == null ? value : iteratee(value);
  3267. value = (comparator || value !== 0) ? value : 0;
  3268. if (isCommon && computed === computed) {
  3269. var valuesIndex = valuesLength;
  3270. while (valuesIndex--) {
  3271. if (values[valuesIndex] === computed) {
  3272. continue outer;
  3273. }
  3274. }
  3275. result.push(value);
  3276. }
  3277. else if (!includes(values, computed, comparator)) {
  3278. result.push(value);
  3279. }
  3280. }
  3281. return result;
  3282. }
  3283. /**
  3284. * The base implementation of `_.forEach` without support for iteratee shorthands.
  3285. *
  3286. * @private
  3287. * @param {Array|Object} collection The collection to iterate over.
  3288. * @param {Function} iteratee The function invoked per iteration.
  3289. * @returns {Array|Object} Returns `collection`.
  3290. */
  3291. var baseEach = createBaseEach(baseForOwn);
  3292. /**
  3293. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  3294. *
  3295. * @private
  3296. * @param {Array|Object} collection The collection to iterate over.
  3297. * @param {Function} iteratee The function invoked per iteration.
  3298. * @returns {Array|Object} Returns `collection`.
  3299. */
  3300. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3301. /**
  3302. * The base implementation of `_.every` without support for iteratee shorthands.
  3303. *
  3304. * @private
  3305. * @param {Array|Object} collection The collection to iterate over.
  3306. * @param {Function} predicate The function invoked per iteration.
  3307. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  3308. * else `false`
  3309. */
  3310. function baseEvery(collection, predicate) {
  3311. var result = true;
  3312. baseEach(collection, function(value, index, collection) {
  3313. result = !!predicate(value, index, collection);
  3314. return result;
  3315. });
  3316. return result;
  3317. }
  3318. /**
  3319. * The base implementation of methods like `_.max` and `_.min` which accepts a
  3320. * `comparator` to determine the extremum value.
  3321. *
  3322. * @private
  3323. * @param {Array} array The array to iterate over.
  3324. * @param {Function} iteratee The iteratee invoked per iteration.
  3325. * @param {Function} comparator The comparator used to compare values.
  3326. * @returns {*} Returns the extremum value.
  3327. */
  3328. function baseExtremum(array, iteratee, comparator) {
  3329. var index = -1,
  3330. length = array.length;
  3331. while (++index < length) {
  3332. var value = array[index],
  3333. current = iteratee(value);
  3334. if (current != null && (computed === undefined
  3335. ? (current === current && !isSymbol(current))
  3336. : comparator(current, computed)
  3337. )) {
  3338. var computed = current,
  3339. result = value;
  3340. }
  3341. }
  3342. return result;
  3343. }
  3344. /**
  3345. * The base implementation of `_.fill` without an iteratee call guard.
  3346. *
  3347. * @private
  3348. * @param {Array} array The array to fill.
  3349. * @param {*} value The value to fill `array` with.
  3350. * @param {number} [start=0] The start position.
  3351. * @param {number} [end=array.length] The end position.
  3352. * @returns {Array} Returns `array`.
  3353. */
  3354. function baseFill(array, value, start, end) {
  3355. var length = array.length;
  3356. start = toInteger(start);
  3357. if (start < 0) {
  3358. start = -start > length ? 0 : (length + start);
  3359. }
  3360. end = (end === undefined || end > length) ? length : toInteger(end);
  3361. if (end < 0) {
  3362. end += length;
  3363. }
  3364. end = start > end ? 0 : toLength(end);
  3365. while (start < end) {
  3366. array[start++] = value;
  3367. }
  3368. return array;
  3369. }
  3370. /**
  3371. * The base implementation of `_.filter` without support for iteratee shorthands.
  3372. *
  3373. * @private
  3374. * @param {Array|Object} collection The collection to iterate over.
  3375. * @param {Function} predicate The function invoked per iteration.
  3376. * @returns {Array} Returns the new filtered array.
  3377. */
  3378. function baseFilter(collection, predicate) {
  3379. var result = [];
  3380. baseEach(collection, function(value, index, collection) {
  3381. if (predicate(value, index, collection)) {
  3382. result.push(value);
  3383. }
  3384. });
  3385. return result;
  3386. }
  3387. /**
  3388. * The base implementation of `_.flatten` with support for restricting flattening.
  3389. *
  3390. * @private
  3391. * @param {Array} array The array to flatten.
  3392. * @param {number} depth The maximum recursion depth.
  3393. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  3394. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  3395. * @param {Array} [result=[]] The initial result value.
  3396. * @returns {Array} Returns the new flattened array.
  3397. */
  3398. function baseFlatten(array, depth, predicate, isStrict, result) {
  3399. var index = -1,
  3400. length = array.length;
  3401. predicate || (predicate = isFlattenable);
  3402. result || (result = []);
  3403. while (++index < length) {
  3404. var value = array[index];
  3405. if (depth > 0 && predicate(value)) {
  3406. if (depth > 1) {
  3407. // Recursively flatten arrays (susceptible to call stack limits).
  3408. baseFlatten(value, depth - 1, predicate, isStrict, result);
  3409. } else {
  3410. arrayPush(result, value);
  3411. }
  3412. } else if (!isStrict) {
  3413. result[result.length] = value;
  3414. }
  3415. }
  3416. return result;
  3417. }
  3418. /**
  3419. * The base implementation of `baseForOwn` which iterates over `object`
  3420. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  3421. * Iteratee functions may exit iteration early by explicitly returning `false`.
  3422. *
  3423. * @private
  3424. * @param {Object} object The object to iterate over.
  3425. * @param {Function} iteratee The function invoked per iteration.
  3426. * @param {Function} keysFunc The function to get the keys of `object`.
  3427. * @returns {Object} Returns `object`.
  3428. */
  3429. var baseFor = createBaseFor();
  3430. /**
  3431. * This function is like `baseFor` except that it iterates over properties
  3432. * in the opposite order.
  3433. *
  3434. * @private
  3435. * @param {Object} object The object to iterate over.
  3436. * @param {Function} iteratee The function invoked per iteration.
  3437. * @param {Function} keysFunc The function to get the keys of `object`.
  3438. * @returns {Object} Returns `object`.
  3439. */
  3440. var baseForRight = createBaseFor(true);
  3441. /**
  3442. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  3443. *
  3444. * @private
  3445. * @param {Object} object The object to iterate over.
  3446. * @param {Function} iteratee The function invoked per iteration.
  3447. * @returns {Object} Returns `object`.
  3448. */
  3449. function baseForOwn(object, iteratee) {
  3450. return object && baseFor(object, iteratee, keys);
  3451. }
  3452. /**
  3453. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  3454. *
  3455. * @private
  3456. * @param {Object} object The object to iterate over.
  3457. * @param {Function} iteratee The function invoked per iteration.
  3458. * @returns {Object} Returns `object`.
  3459. */
  3460. function baseForOwnRight(object, iteratee) {
  3461. return object && baseForRight(object, iteratee, keys);
  3462. }
  3463. /**
  3464. * The base implementation of `_.functions` which creates an array of
  3465. * `object` function property names filtered from `props`.
  3466. *
  3467. * @private
  3468. * @param {Object} object The object to inspect.
  3469. * @param {Array} props The property names to filter.
  3470. * @returns {Array} Returns the function names.
  3471. */
  3472. function baseFunctions(object, props) {
  3473. return arrayFilter(props, function(key) {
  3474. return isFunction(object[key]);
  3475. });
  3476. }
  3477. /**
  3478. * The base implementation of `_.get` without support for default values.
  3479. *
  3480. * @private
  3481. * @param {Object} object The object to query.
  3482. * @param {Array|string} path The path of the property to get.
  3483. * @returns {*} Returns the resolved value.
  3484. */
  3485. function baseGet(object, path) {
  3486. path = castPath(path, object);
  3487. var index = 0,
  3488. length = path.length;
  3489. while (object != null && index < length) {
  3490. object = object[toKey(path[index++])];
  3491. }
  3492. return (index && index == length) ? object : undefined;
  3493. }
  3494. /**
  3495. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  3496. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  3497. * symbols of `object`.
  3498. *
  3499. * @private
  3500. * @param {Object} object The object to query.
  3501. * @param {Function} keysFunc The function to get the keys of `object`.
  3502. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  3503. * @returns {Array} Returns the array of property names and symbols.
  3504. */
  3505. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3506. var result = keysFunc(object);
  3507. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3508. }
  3509. /**
  3510. * The base implementation of `getTag` without fallbacks for buggy environments.
  3511. *
  3512. * @private
  3513. * @param {*} value The value to query.
  3514. * @returns {string} Returns the `toStringTag`.
  3515. */
  3516. function baseGetTag(value) {
  3517. if (value == null) {
  3518. return value === undefined ? undefinedTag : nullTag;
  3519. }
  3520. return (symToStringTag && symToStringTag in Object(value))
  3521. ? getRawTag(value)
  3522. : objectToString(value);
  3523. }
  3524. /**
  3525. * The base implementation of `_.gt` which doesn't coerce arguments.
  3526. *
  3527. * @private
  3528. * @param {*} value The value to compare.
  3529. * @param {*} other The other value to compare.
  3530. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  3531. * else `false`.
  3532. */
  3533. function baseGt(value, other) {
  3534. return value > other;
  3535. }
  3536. /**
  3537. * The base implementation of `_.has` without support for deep paths.
  3538. *
  3539. * @private
  3540. * @param {Object} [object] The object to query.
  3541. * @param {Array|string} key The key to check.
  3542. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3543. */
  3544. function baseHas(object, key) {
  3545. return object != null && hasOwnProperty.call(object, key);
  3546. }
  3547. /**
  3548. * The base implementation of `_.hasIn` without support for deep paths.
  3549. *
  3550. * @private
  3551. * @param {Object} [object] The object to query.
  3552. * @param {Array|string} key The key to check.
  3553. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3554. */
  3555. function baseHasIn(object, key) {
  3556. return object != null && key in Object(object);
  3557. }
  3558. /**
  3559. * The base implementation of `_.inRange` which doesn't coerce arguments.
  3560. *
  3561. * @private
  3562. * @param {number} number The number to check.
  3563. * @param {number} start The start of the range.
  3564. * @param {number} end The end of the range.
  3565. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  3566. */
  3567. function baseInRange(number, start, end) {
  3568. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  3569. }
  3570. /**
  3571. * The base implementation of methods like `_.intersection`, without support
  3572. * for iteratee shorthands, that accepts an array of arrays to inspect.
  3573. *
  3574. * @private
  3575. * @param {Array} arrays The arrays to inspect.
  3576. * @param {Function} [iteratee] The iteratee invoked per element.
  3577. * @param {Function} [comparator] The comparator invoked per element.
  3578. * @returns {Array} Returns the new array of shared values.
  3579. */
  3580. function baseIntersection(arrays, iteratee, comparator) {
  3581. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  3582. length = arrays[0].length,
  3583. othLength = arrays.length,
  3584. othIndex = othLength,
  3585. caches = Array(othLength),
  3586. maxLength = Infinity,
  3587. result = [];
  3588. while (othIndex--) {
  3589. var array = arrays[othIndex];
  3590. if (othIndex && iteratee) {
  3591. array = arrayMap(array, baseUnary(iteratee));
  3592. }
  3593. maxLength = nativeMin(array.length, maxLength);
  3594. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  3595. ? new SetCache(othIndex && array)
  3596. : undefined;
  3597. }
  3598. array = arrays[0];
  3599. var index = -1,
  3600. seen = caches[0];
  3601. outer:
  3602. while (++index < length && result.length < maxLength) {
  3603. var value = array[index],
  3604. computed = iteratee ? iteratee(value) : value;
  3605. value = (comparator || value !== 0) ? value : 0;
  3606. if (!(seen
  3607. ? cacheHas(seen, computed)
  3608. : includes(result, computed, comparator)
  3609. )) {
  3610. othIndex = othLength;
  3611. while (--othIndex) {
  3612. var cache = caches[othIndex];
  3613. if (!(cache
  3614. ? cacheHas(cache, computed)
  3615. : includes(arrays[othIndex], computed, comparator))
  3616. ) {
  3617. continue outer;
  3618. }
  3619. }
  3620. if (seen) {
  3621. seen.push(computed);
  3622. }
  3623. result.push(value);
  3624. }
  3625. }
  3626. return result;
  3627. }
  3628. /**
  3629. * The base implementation of `_.invert` and `_.invertBy` which inverts
  3630. * `object` with values transformed by `iteratee` and set by `setter`.
  3631. *
  3632. * @private
  3633. * @param {Object} object The object to iterate over.
  3634. * @param {Function} setter The function to set `accumulator` values.
  3635. * @param {Function} iteratee The iteratee to transform values.
  3636. * @param {Object} accumulator The initial inverted object.
  3637. * @returns {Function} Returns `accumulator`.
  3638. */
  3639. function baseInverter(object, setter, iteratee, accumulator) {
  3640. baseForOwn(object, function(value, key, object) {
  3641. setter(accumulator, iteratee(value), key, object);
  3642. });
  3643. return accumulator;
  3644. }
  3645. /**
  3646. * The base implementation of `_.invoke` without support for individual
  3647. * method arguments.
  3648. *
  3649. * @private
  3650. * @param {Object} object The object to query.
  3651. * @param {Array|string} path The path of the method to invoke.
  3652. * @param {Array} args The arguments to invoke the method with.
  3653. * @returns {*} Returns the result of the invoked method.
  3654. */
  3655. function baseInvoke(object, path, args) {
  3656. path = castPath(path, object);
  3657. object = parent(object, path);
  3658. var func = object == null ? object : object[toKey(last(path))];
  3659. return func == null ? undefined : apply(func, object, args);
  3660. }
  3661. /**
  3662. * The base implementation of `_.isArguments`.
  3663. *
  3664. * @private
  3665. * @param {*} value The value to check.
  3666. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3667. */
  3668. function baseIsArguments(value) {
  3669. return isObjectLike(value) && baseGetTag(value) == argsTag;
  3670. }
  3671. /**
  3672. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  3673. *
  3674. * @private
  3675. * @param {*} value The value to check.
  3676. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  3677. */
  3678. function baseIsArrayBuffer(value) {
  3679. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  3680. }
  3681. /**
  3682. * The base implementation of `_.isDate` without Node.js optimizations.
  3683. *
  3684. * @private
  3685. * @param {*} value The value to check.
  3686. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  3687. */
  3688. function baseIsDate(value) {
  3689. return isObjectLike(value) && baseGetTag(value) == dateTag;
  3690. }
  3691. /**
  3692. * The base implementation of `_.isEqual` which supports partial comparisons
  3693. * and tracks traversed objects.
  3694. *
  3695. * @private
  3696. * @param {*} value The value to compare.
  3697. * @param {*} other The other value to compare.
  3698. * @param {boolean} bitmask The bitmask flags.
  3699. * 1 - Unordered comparison
  3700. * 2 - Partial comparison
  3701. * @param {Function} [customizer] The function to customize comparisons.
  3702. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  3703. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3704. */
  3705. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3706. if (value === other) {
  3707. return true;
  3708. }
  3709. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  3710. return value !== value && other !== other;
  3711. }
  3712. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3713. }
  3714. /**
  3715. * A specialized version of `baseIsEqual` for arrays and objects which performs
  3716. * deep comparisons and tracks traversed objects enabling objects with circular
  3717. * references to be compared.
  3718. *
  3719. * @private
  3720. * @param {Object} object The object to compare.
  3721. * @param {Object} other The other object to compare.
  3722. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  3723. * @param {Function} customizer The function to customize comparisons.
  3724. * @param {Function} equalFunc The function to determine equivalents of values.
  3725. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  3726. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  3727. */
  3728. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3729. var objIsArr = isArray(object),
  3730. othIsArr = isArray(other),
  3731. objTag = objIsArr ? arrayTag : getTag(object),
  3732. othTag = othIsArr ? arrayTag : getTag(other);
  3733. objTag = objTag == argsTag ? objectTag : objTag;
  3734. othTag = othTag == argsTag ? objectTag : othTag;
  3735. var objIsObj = objTag == objectTag,
  3736. othIsObj = othTag == objectTag,
  3737. isSameTag = objTag == othTag;
  3738. if (isSameTag && isBuffer(object)) {
  3739. if (!isBuffer(other)) {
  3740. return false;
  3741. }
  3742. objIsArr = true;
  3743. objIsObj = false;
  3744. }
  3745. if (isSameTag && !objIsObj) {
  3746. stack || (stack = new Stack);
  3747. return (objIsArr || isTypedArray(object))
  3748. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  3749. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3750. }
  3751. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  3752. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  3753. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  3754. if (objIsWrapped || othIsWrapped) {
  3755. var objUnwrapped = objIsWrapped ? object.value() : object,
  3756. othUnwrapped = othIsWrapped ? other.value() : other;
  3757. stack || (stack = new Stack);
  3758. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3759. }
  3760. }
  3761. if (!isSameTag) {
  3762. return false;
  3763. }
  3764. stack || (stack = new Stack);
  3765. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3766. }
  3767. /**
  3768. * The base implementation of `_.isMap` without Node.js optimizations.
  3769. *
  3770. * @private
  3771. * @param {*} value The value to check.
  3772. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  3773. */
  3774. function baseIsMap(value) {
  3775. return isObjectLike(value) && getTag(value) == mapTag;
  3776. }
  3777. /**
  3778. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  3779. *
  3780. * @private
  3781. * @param {Object} object The object to inspect.
  3782. * @param {Object} source The object of property values to match.
  3783. * @param {Array} matchData The property names, values, and compare flags to match.
  3784. * @param {Function} [customizer] The function to customize comparisons.
  3785. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  3786. */
  3787. function baseIsMatch(object, source, matchData, customizer) {
  3788. var index = matchData.length,
  3789. length = index,
  3790. noCustomizer = !customizer;
  3791. if (object == null) {
  3792. return !length;
  3793. }
  3794. object = Object(object);
  3795. while (index--) {
  3796. var data = matchData[index];
  3797. if ((noCustomizer && data[2])
  3798. ? data[1] !== object[data[0]]
  3799. : !(data[0] in object)
  3800. ) {
  3801. return false;
  3802. }
  3803. }
  3804. while (++index < length) {
  3805. data = matchData[index];
  3806. var key = data[0],
  3807. objValue = object[key],
  3808. srcValue = data[1];
  3809. if (noCustomizer && data[2]) {
  3810. if (objValue === undefined && !(key in object)) {
  3811. return false;
  3812. }
  3813. } else {
  3814. var stack = new Stack;
  3815. if (customizer) {
  3816. var result = customizer(objValue, srcValue, key, object, source, stack);
  3817. }
  3818. if (!(result === undefined
  3819. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  3820. : result
  3821. )) {
  3822. return false;
  3823. }
  3824. }
  3825. }
  3826. return true;
  3827. }
  3828. /**
  3829. * The base implementation of `_.isNative` without bad shim checks.
  3830. *
  3831. * @private
  3832. * @param {*} value The value to check.
  3833. * @returns {boolean} Returns `true` if `value` is a native function,
  3834. * else `false`.
  3835. */
  3836. function baseIsNative(value) {
  3837. if (!isObject(value) || isMasked(value)) {
  3838. return false;
  3839. }
  3840. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  3841. return pattern.test(toSource(value));
  3842. }
  3843. /**
  3844. * The base implementation of `_.isRegExp` without Node.js optimizations.
  3845. *
  3846. * @private
  3847. * @param {*} value The value to check.
  3848. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  3849. */
  3850. function baseIsRegExp(value) {
  3851. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  3852. }
  3853. /**
  3854. * The base implementation of `_.isSet` without Node.js optimizations.
  3855. *
  3856. * @private
  3857. * @param {*} value The value to check.
  3858. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  3859. */
  3860. function baseIsSet(value) {
  3861. return isObjectLike(value) && getTag(value) == setTag;
  3862. }
  3863. /**
  3864. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  3865. *
  3866. * @private
  3867. * @param {*} value The value to check.
  3868. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  3869. */
  3870. function baseIsTypedArray(value) {
  3871. return isObjectLike(value) &&
  3872. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  3873. }
  3874. /**
  3875. * The base implementation of `_.iteratee`.
  3876. *
  3877. * @private
  3878. * @param {*} [value=_.identity] The value to convert to an iteratee.
  3879. * @returns {Function} Returns the iteratee.
  3880. */
  3881. function baseIteratee(value) {
  3882. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  3883. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  3884. if (typeof value == 'function') {
  3885. return value;
  3886. }
  3887. if (value == null) {
  3888. return identity;
  3889. }
  3890. if (typeof value == 'object') {
  3891. return isArray(value)
  3892. ? baseMatchesProperty(value[0], value[1])
  3893. : baseMatches(value);
  3894. }
  3895. return property(value);
  3896. }
  3897. /**
  3898. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  3899. *
  3900. * @private
  3901. * @param {Object} object The object to query.
  3902. * @returns {Array} Returns the array of property names.
  3903. */
  3904. function baseKeys(object) {
  3905. if (!isPrototype(object)) {
  3906. return nativeKeys(object);
  3907. }
  3908. var result = [];
  3909. for (var key in Object(object)) {
  3910. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  3911. result.push(key);
  3912. }
  3913. }
  3914. return result;
  3915. }
  3916. /**
  3917. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  3918. *
  3919. * @private
  3920. * @param {Object} object The object to query.
  3921. * @returns {Array} Returns the array of property names.
  3922. */
  3923. function baseKeysIn(object) {
  3924. if (!isObject(object)) {
  3925. return nativeKeysIn(object);
  3926. }
  3927. var isProto = isPrototype(object),
  3928. result = [];
  3929. for (var key in object) {
  3930. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  3931. result.push(key);
  3932. }
  3933. }
  3934. return result;
  3935. }
  3936. /**
  3937. * The base implementation of `_.lt` which doesn't coerce arguments.
  3938. *
  3939. * @private
  3940. * @param {*} value The value to compare.
  3941. * @param {*} other The other value to compare.
  3942. * @returns {boolean} Returns `true` if `value` is less than `other`,
  3943. * else `false`.
  3944. */
  3945. function baseLt(value, other) {
  3946. return value < other;
  3947. }
  3948. /**
  3949. * The base implementation of `_.map` without support for iteratee shorthands.
  3950. *
  3951. * @private
  3952. * @param {Array|Object} collection The collection to iterate over.
  3953. * @param {Function} iteratee The function invoked per iteration.
  3954. * @returns {Array} Returns the new mapped array.
  3955. */
  3956. function baseMap(collection, iteratee) {
  3957. var index = -1,
  3958. result = isArrayLike(collection) ? Array(collection.length) : [];
  3959. baseEach(collection, function(value, key, collection) {
  3960. result[++index] = iteratee(value, key, collection);
  3961. });
  3962. return result;
  3963. }
  3964. /**
  3965. * The base implementation of `_.matches` which doesn't clone `source`.
  3966. *
  3967. * @private
  3968. * @param {Object} source The object of property values to match.
  3969. * @returns {Function} Returns the new spec function.
  3970. */
  3971. function baseMatches(source) {
  3972. var matchData = getMatchData(source);
  3973. if (matchData.length == 1 && matchData[0][2]) {
  3974. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3975. }
  3976. return function(object) {
  3977. return object === source || baseIsMatch(object, source, matchData);
  3978. };
  3979. }
  3980. /**
  3981. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  3982. *
  3983. * @private
  3984. * @param {string} path The path of the property to get.
  3985. * @param {*} srcValue The value to match.
  3986. * @returns {Function} Returns the new spec function.
  3987. */
  3988. function baseMatchesProperty(path, srcValue) {
  3989. if (isKey(path) && isStrictComparable(srcValue)) {
  3990. return matchesStrictComparable(toKey(path), srcValue);
  3991. }
  3992. return function(object) {
  3993. var objValue = get(object, path);
  3994. return (objValue === undefined && objValue === srcValue)
  3995. ? hasIn(object, path)
  3996. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3997. };
  3998. }
  3999. /**
  4000. * The base implementation of `_.merge` without support for multiple sources.
  4001. *
  4002. * @private
  4003. * @param {Object} object The destination object.
  4004. * @param {Object} source The source object.
  4005. * @param {number} srcIndex The index of `source`.
  4006. * @param {Function} [customizer] The function to customize merged values.
  4007. * @param {Object} [stack] Tracks traversed source values and their merged
  4008. * counterparts.
  4009. */
  4010. function baseMerge(object, source, srcIndex, customizer, stack) {
  4011. if (object === source) {
  4012. return;
  4013. }
  4014. baseFor(source, function(srcValue, key) {
  4015. if (isObject(srcValue)) {
  4016. stack || (stack = new Stack);
  4017. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4018. }
  4019. else {
  4020. var newValue = customizer
  4021. ? customizer(object[key], srcValue, (key + ''), object, source, stack)
  4022. : undefined;
  4023. if (newValue === undefined) {
  4024. newValue = srcValue;
  4025. }
  4026. assignMergeValue(object, key, newValue);
  4027. }
  4028. }, keysIn);
  4029. }
  4030. /**
  4031. * A specialized version of `baseMerge` for arrays and objects which performs
  4032. * deep merges and tracks traversed objects enabling objects with circular
  4033. * references to be merged.
  4034. *
  4035. * @private
  4036. * @param {Object} object The destination object.
  4037. * @param {Object} source The source object.
  4038. * @param {string} key The key of the value to merge.
  4039. * @param {number} srcIndex The index of `source`.
  4040. * @param {Function} mergeFunc The function to merge values.
  4041. * @param {Function} [customizer] The function to customize assigned values.
  4042. * @param {Object} [stack] Tracks traversed source values and their merged
  4043. * counterparts.
  4044. */
  4045. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  4046. var objValue = object[key],
  4047. srcValue = source[key],
  4048. stacked = stack.get(srcValue);
  4049. if (stacked) {
  4050. assignMergeValue(object, key, stacked);
  4051. return;
  4052. }
  4053. var newValue = customizer
  4054. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  4055. : undefined;
  4056. var isCommon = newValue === undefined;
  4057. if (isCommon) {
  4058. var isArr = isArray(srcValue),
  4059. isBuff = !isArr && isBuffer(srcValue),
  4060. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  4061. newValue = srcValue;
  4062. if (isArr || isBuff || isTyped) {
  4063. if (isArray(objValue)) {
  4064. newValue = objValue;
  4065. }
  4066. else if (isArrayLikeObject(objValue)) {
  4067. newValue = copyArray(objValue);
  4068. }
  4069. else if (isBuff) {
  4070. isCommon = false;
  4071. newValue = cloneBuffer(srcValue, true);
  4072. }
  4073. else if (isTyped) {
  4074. isCommon = false;
  4075. newValue = cloneTypedArray(srcValue, true);
  4076. }
  4077. else {
  4078. newValue = [];
  4079. }
  4080. }
  4081. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4082. newValue = objValue;
  4083. if (isArguments(objValue)) {
  4084. newValue = toPlainObject(objValue);
  4085. }
  4086. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  4087. newValue = initCloneObject(srcValue);
  4088. }
  4089. }
  4090. else {
  4091. isCommon = false;
  4092. }
  4093. }
  4094. if (isCommon) {
  4095. // Recursively merge objects and arrays (susceptible to call stack limits).
  4096. stack.set(srcValue, newValue);
  4097. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4098. stack['delete'](srcValue);
  4099. }
  4100. assignMergeValue(object, key, newValue);
  4101. }
  4102. /**
  4103. * The base implementation of `_.nth` which doesn't coerce arguments.
  4104. *
  4105. * @private
  4106. * @param {Array} array The array to query.
  4107. * @param {number} n The index of the element to return.
  4108. * @returns {*} Returns the nth element of `array`.
  4109. */
  4110. function baseNth(array, n) {
  4111. var length = array.length;
  4112. if (!length) {
  4113. return;
  4114. }
  4115. n += n < 0 ? length : 0;
  4116. return isIndex(n, length) ? array[n] : undefined;
  4117. }
  4118. /**
  4119. * The base implementation of `_.orderBy` without param guards.
  4120. *
  4121. * @private
  4122. * @param {Array|Object} collection The collection to iterate over.
  4123. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  4124. * @param {string[]} orders The sort orders of `iteratees`.
  4125. * @returns {Array} Returns the new sorted array.
  4126. */
  4127. function baseOrderBy(collection, iteratees, orders) {
  4128. var index = -1;
  4129. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  4130. var result = baseMap(collection, function(value, key, collection) {
  4131. var criteria = arrayMap(iteratees, function(iteratee) {
  4132. return iteratee(value);
  4133. });
  4134. return { 'criteria': criteria, 'index': ++index, 'value': value };
  4135. });
  4136. return baseSortBy(result, function(object, other) {
  4137. return compareMultiple(object, other, orders);
  4138. });
  4139. }
  4140. /**
  4141. * The base implementation of `_.pick` without support for individual
  4142. * property identifiers.
  4143. *
  4144. * @private
  4145. * @param {Object} object The source object.
  4146. * @param {string[]} paths The property paths to pick.
  4147. * @returns {Object} Returns the new object.
  4148. */
  4149. function basePick(object, paths) {
  4150. return basePickBy(object, paths, function(value, path) {
  4151. return hasIn(object, path);
  4152. });
  4153. }
  4154. /**
  4155. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  4156. *
  4157. * @private
  4158. * @param {Object} object The source object.
  4159. * @param {string[]} paths The property paths to pick.
  4160. * @param {Function} predicate The function invoked per property.
  4161. * @returns {Object} Returns the new object.
  4162. */
  4163. function basePickBy(object, paths, predicate) {
  4164. var index = -1,
  4165. length = paths.length,
  4166. result = {};
  4167. while (++index < length) {
  4168. var path = paths[index],
  4169. value = baseGet(object, path);
  4170. if (predicate(value, path)) {
  4171. baseSet(result, castPath(path, object), value);
  4172. }
  4173. }
  4174. return result;
  4175. }
  4176. /**
  4177. * A specialized version of `baseProperty` which supports deep paths.
  4178. *
  4179. * @private
  4180. * @param {Array|string} path The path of the property to get.
  4181. * @returns {Function} Returns the new accessor function.
  4182. */
  4183. function basePropertyDeep(path) {
  4184. return function(object) {
  4185. return baseGet(object, path);
  4186. };
  4187. }
  4188. /**
  4189. * The base implementation of `_.pullAllBy` without support for iteratee
  4190. * shorthands.
  4191. *
  4192. * @private
  4193. * @param {Array} array The array to modify.
  4194. * @param {Array} values The values to remove.
  4195. * @param {Function} [iteratee] The iteratee invoked per element.
  4196. * @param {Function} [comparator] The comparator invoked per element.
  4197. * @returns {Array} Returns `array`.
  4198. */
  4199. function basePullAll(array, values, iteratee, comparator) {
  4200. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  4201. index = -1,
  4202. length = values.length,
  4203. seen = array;
  4204. if (array === values) {
  4205. values = copyArray(values);
  4206. }
  4207. if (iteratee) {
  4208. seen = arrayMap(array, baseUnary(iteratee));
  4209. }
  4210. while (++index < length) {
  4211. var fromIndex = 0,
  4212. value = values[index],
  4213. computed = iteratee ? iteratee(value) : value;
  4214. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4215. if (seen !== array) {
  4216. splice.call(seen, fromIndex, 1);
  4217. }
  4218. splice.call(array, fromIndex, 1);
  4219. }
  4220. }
  4221. return array;
  4222. }
  4223. /**
  4224. * The base implementation of `_.pullAt` without support for individual
  4225. * indexes or capturing the removed elements.
  4226. *
  4227. * @private
  4228. * @param {Array} array The array to modify.
  4229. * @param {number[]} indexes The indexes of elements to remove.
  4230. * @returns {Array} Returns `array`.
  4231. */
  4232. function basePullAt(array, indexes) {
  4233. var length = array ? indexes.length : 0,
  4234. lastIndex = length - 1;
  4235. while (length--) {
  4236. var index = indexes[length];
  4237. if (length == lastIndex || index !== previous) {
  4238. var previous = index;
  4239. if (isIndex(index)) {
  4240. splice.call(array, index, 1);
  4241. } else {
  4242. baseUnset(array, index);
  4243. }
  4244. }
  4245. }
  4246. return array;
  4247. }
  4248. /**
  4249. * The base implementation of `_.random` without support for returning
  4250. * floating-point numbers.
  4251. *
  4252. * @private
  4253. * @param {number} lower The lower bound.
  4254. * @param {number} upper The upper bound.
  4255. * @returns {number} Returns the random number.
  4256. */
  4257. function baseRandom(lower, upper) {
  4258. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  4259. }
  4260. /**
  4261. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  4262. * coerce arguments.
  4263. *
  4264. * @private
  4265. * @param {number} start The start of the range.
  4266. * @param {number} end The end of the range.
  4267. * @param {number} step The value to increment or decrement by.
  4268. * @param {boolean} [fromRight] Specify iterating from right to left.
  4269. * @returns {Array} Returns the range of numbers.
  4270. */
  4271. function baseRange(start, end, step, fromRight) {
  4272. var index = -1,
  4273. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  4274. result = Array(length);
  4275. while (length--) {
  4276. result[fromRight ? length : ++index] = start;
  4277. start += step;
  4278. }
  4279. return result;
  4280. }
  4281. /**
  4282. * The base implementation of `_.repeat` which doesn't coerce arguments.
  4283. *
  4284. * @private
  4285. * @param {string} string The string to repeat.
  4286. * @param {number} n The number of times to repeat the string.
  4287. * @returns {string} Returns the repeated string.
  4288. */
  4289. function baseRepeat(string, n) {
  4290. var result = '';
  4291. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  4292. return result;
  4293. }
  4294. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  4295. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  4296. do {
  4297. if (n % 2) {
  4298. result += string;
  4299. }
  4300. n = nativeFloor(n / 2);
  4301. if (n) {
  4302. string += string;
  4303. }
  4304. } while (n);
  4305. return result;
  4306. }
  4307. /**
  4308. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  4309. *
  4310. * @private
  4311. * @param {Function} func The function to apply a rest parameter to.
  4312. * @param {number} [start=func.length-1] The start position of the rest parameter.
  4313. * @returns {Function} Returns the new function.
  4314. */
  4315. function baseRest(func, start) {
  4316. return setToString(overRest(func, start, identity), func + '');
  4317. }
  4318. /**
  4319. * The base implementation of `_.sample`.
  4320. *
  4321. * @private
  4322. * @param {Array|Object} collection The collection to sample.
  4323. * @returns {*} Returns the random element.
  4324. */
  4325. function baseSample(collection) {
  4326. return arraySample(values(collection));
  4327. }
  4328. /**
  4329. * The base implementation of `_.sampleSize` without param guards.
  4330. *
  4331. * @private
  4332. * @param {Array|Object} collection The collection to sample.
  4333. * @param {number} n The number of elements to sample.
  4334. * @returns {Array} Returns the random elements.
  4335. */
  4336. function baseSampleSize(collection, n) {
  4337. var array = values(collection);
  4338. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4339. }
  4340. /**
  4341. * The base implementation of `_.set`.
  4342. *
  4343. * @private
  4344. * @param {Object} object The object to modify.
  4345. * @param {Array|string} path The path of the property to set.
  4346. * @param {*} value The value to set.
  4347. * @param {Function} [customizer] The function to customize path creation.
  4348. * @returns {Object} Returns `object`.
  4349. */
  4350. function baseSet(object, path, value, customizer) {
  4351. if (!isObject(object)) {
  4352. return object;
  4353. }
  4354. path = castPath(path, object);
  4355. var index = -1,
  4356. length = path.length,
  4357. lastIndex = length - 1,
  4358. nested = object;
  4359. while (nested != null && ++index < length) {
  4360. var key = toKey(path[index]),
  4361. newValue = value;
  4362. if (index != lastIndex) {
  4363. var objValue = nested[key];
  4364. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  4365. if (newValue === undefined) {
  4366. newValue = isObject(objValue)
  4367. ? objValue
  4368. : (isIndex(path[index + 1]) ? [] : {});
  4369. }
  4370. }
  4371. assignValue(nested, key, newValue);
  4372. nested = nested[key];
  4373. }
  4374. return object;
  4375. }
  4376. /**
  4377. * The base implementation of `setData` without support for hot loop shorting.
  4378. *
  4379. * @private
  4380. * @param {Function} func The function to associate metadata with.
  4381. * @param {*} data The metadata.
  4382. * @returns {Function} Returns `func`.
  4383. */
  4384. var baseSetData = !metaMap ? identity : function(func, data) {
  4385. metaMap.set(func, data);
  4386. return func;
  4387. };
  4388. /**
  4389. * The base implementation of `setToString` without support for hot loop shorting.
  4390. *
  4391. * @private
  4392. * @param {Function} func The function to modify.
  4393. * @param {Function} string The `toString` result.
  4394. * @returns {Function} Returns `func`.
  4395. */
  4396. var baseSetToString = !defineProperty ? identity : function(func, string) {
  4397. return defineProperty(func, 'toString', {
  4398. 'configurable': true,
  4399. 'enumerable': false,
  4400. 'value': constant(string),
  4401. 'writable': true
  4402. });
  4403. };
  4404. /**
  4405. * The base implementation of `_.shuffle`.
  4406. *
  4407. * @private
  4408. * @param {Array|Object} collection The collection to shuffle.
  4409. * @returns {Array} Returns the new shuffled array.
  4410. */
  4411. function baseShuffle(collection) {
  4412. return shuffleSelf(values(collection));
  4413. }
  4414. /**
  4415. * The base implementation of `_.slice` without an iteratee call guard.
  4416. *
  4417. * @private
  4418. * @param {Array} array The array to slice.
  4419. * @param {number} [start=0] The start position.
  4420. * @param {number} [end=array.length] The end position.
  4421. * @returns {Array} Returns the slice of `array`.
  4422. */
  4423. function baseSlice(array, start, end) {
  4424. var index = -1,
  4425. length = array.length;
  4426. if (start < 0) {
  4427. start = -start > length ? 0 : (length + start);
  4428. }
  4429. end = end > length ? length : end;
  4430. if (end < 0) {
  4431. end += length;
  4432. }
  4433. length = start > end ? 0 : ((end - start) >>> 0);
  4434. start >>>= 0;
  4435. var result = Array(length);
  4436. while (++index < length) {
  4437. result[index] = array[index + start];
  4438. }
  4439. return result;
  4440. }
  4441. /**
  4442. * The base implementation of `_.some` without support for iteratee shorthands.
  4443. *
  4444. * @private
  4445. * @param {Array|Object} collection The collection to iterate over.
  4446. * @param {Function} predicate The function invoked per iteration.
  4447. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4448. * else `false`.
  4449. */
  4450. function baseSome(collection, predicate) {
  4451. var result;
  4452. baseEach(collection, function(value, index, collection) {
  4453. result = predicate(value, index, collection);
  4454. return !result;
  4455. });
  4456. return !!result;
  4457. }
  4458. /**
  4459. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  4460. * performs a binary search of `array` to determine the index at which `value`
  4461. * should be inserted into `array` in order to maintain its sort order.
  4462. *
  4463. * @private
  4464. * @param {Array} array The sorted array to inspect.
  4465. * @param {*} value The value to evaluate.
  4466. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4467. * @returns {number} Returns the index at which `value` should be inserted
  4468. * into `array`.
  4469. */
  4470. function baseSortedIndex(array, value, retHighest) {
  4471. var low = 0,
  4472. high = array == null ? low : array.length;
  4473. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  4474. while (low < high) {
  4475. var mid = (low + high) >>> 1,
  4476. computed = array[mid];
  4477. if (computed !== null && !isSymbol(computed) &&
  4478. (retHighest ? (computed <= value) : (computed < value))) {
  4479. low = mid + 1;
  4480. } else {
  4481. high = mid;
  4482. }
  4483. }
  4484. return high;
  4485. }
  4486. return baseSortedIndexBy(array, value, identity, retHighest);
  4487. }
  4488. /**
  4489. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  4490. * which invokes `iteratee` for `value` and each element of `array` to compute
  4491. * their sort ranking. The iteratee is invoked with one argument; (value).
  4492. *
  4493. * @private
  4494. * @param {Array} array The sorted array to inspect.
  4495. * @param {*} value The value to evaluate.
  4496. * @param {Function} iteratee The iteratee invoked per element.
  4497. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4498. * @returns {number} Returns the index at which `value` should be inserted
  4499. * into `array`.
  4500. */
  4501. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  4502. value = iteratee(value);
  4503. var low = 0,
  4504. high = array == null ? 0 : array.length,
  4505. valIsNaN = value !== value,
  4506. valIsNull = value === null,
  4507. valIsSymbol = isSymbol(value),
  4508. valIsUndefined = value === undefined;
  4509. while (low < high) {
  4510. var mid = nativeFloor((low + high) / 2),
  4511. computed = iteratee(array[mid]),
  4512. othIsDefined = computed !== undefined,
  4513. othIsNull = computed === null,
  4514. othIsReflexive = computed === computed,
  4515. othIsSymbol = isSymbol(computed);
  4516. if (valIsNaN) {
  4517. var setLow = retHighest || othIsReflexive;
  4518. } else if (valIsUndefined) {
  4519. setLow = othIsReflexive && (retHighest || othIsDefined);
  4520. } else if (valIsNull) {
  4521. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  4522. } else if (valIsSymbol) {
  4523. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  4524. } else if (othIsNull || othIsSymbol) {
  4525. setLow = false;
  4526. } else {
  4527. setLow = retHighest ? (computed <= value) : (computed < value);
  4528. }
  4529. if (setLow) {
  4530. low = mid + 1;
  4531. } else {
  4532. high = mid;
  4533. }
  4534. }
  4535. return nativeMin(high, MAX_ARRAY_INDEX);
  4536. }
  4537. /**
  4538. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  4539. * support for iteratee shorthands.
  4540. *
  4541. * @private
  4542. * @param {Array} array The array to inspect.
  4543. * @param {Function} [iteratee] The iteratee invoked per element.
  4544. * @returns {Array} Returns the new duplicate free array.
  4545. */
  4546. function baseSortedUniq(array, iteratee) {
  4547. var index = -1,
  4548. length = array.length,
  4549. resIndex = 0,
  4550. result = [];
  4551. while (++index < length) {
  4552. var value = array[index],
  4553. computed = iteratee ? iteratee(value) : value;
  4554. if (!index || !eq(computed, seen)) {
  4555. var seen = computed;
  4556. result[resIndex++] = value === 0 ? 0 : value;
  4557. }
  4558. }
  4559. return result;
  4560. }
  4561. /**
  4562. * The base implementation of `_.toNumber` which doesn't ensure correct
  4563. * conversions of binary, hexadecimal, or octal string values.
  4564. *
  4565. * @private
  4566. * @param {*} value The value to process.
  4567. * @returns {number} Returns the number.
  4568. */
  4569. function baseToNumber(value) {
  4570. if (typeof value == 'number') {
  4571. return value;
  4572. }
  4573. if (isSymbol(value)) {
  4574. return NAN;
  4575. }
  4576. return +value;
  4577. }
  4578. /**
  4579. * The base implementation of `_.toString` which doesn't convert nullish
  4580. * values to empty strings.
  4581. *
  4582. * @private
  4583. * @param {*} value The value to process.
  4584. * @returns {string} Returns the string.
  4585. */
  4586. function baseToString(value) {
  4587. // Exit early for strings to avoid a performance hit in some environments.
  4588. if (typeof value == 'string') {
  4589. return value;
  4590. }
  4591. if (isArray(value)) {
  4592. // Recursively convert values (susceptible to call stack limits).
  4593. return arrayMap(value, baseToString) + '';
  4594. }
  4595. if (isSymbol(value)) {
  4596. return symbolToString ? symbolToString.call(value) : '';
  4597. }
  4598. var result = (value + '');
  4599. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  4600. }
  4601. /**
  4602. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  4603. *
  4604. * @private
  4605. * @param {Array} array The array to inspect.
  4606. * @param {Function} [iteratee] The iteratee invoked per element.
  4607. * @param {Function} [comparator] The comparator invoked per element.
  4608. * @returns {Array} Returns the new duplicate free array.
  4609. */
  4610. function baseUniq(array, iteratee, comparator) {
  4611. var index = -1,
  4612. includes = arrayIncludes,
  4613. length = array.length,
  4614. isCommon = true,
  4615. result = [],
  4616. seen = result;
  4617. if (comparator) {
  4618. isCommon = false;
  4619. includes = arrayIncludesWith;
  4620. }
  4621. else if (length >= LARGE_ARRAY_SIZE) {
  4622. var set = iteratee ? null : createSet(array);
  4623. if (set) {
  4624. return setToArray(set);
  4625. }
  4626. isCommon = false;
  4627. includes = cacheHas;
  4628. seen = new SetCache;
  4629. }
  4630. else {
  4631. seen = iteratee ? [] : result;
  4632. }
  4633. outer:
  4634. while (++index < length) {
  4635. var value = array[index],
  4636. computed = iteratee ? iteratee(value) : value;
  4637. value = (comparator || value !== 0) ? value : 0;
  4638. if (isCommon && computed === computed) {
  4639. var seenIndex = seen.length;
  4640. while (seenIndex--) {
  4641. if (seen[seenIndex] === computed) {
  4642. continue outer;
  4643. }
  4644. }
  4645. if (iteratee) {
  4646. seen.push(computed);
  4647. }
  4648. result.push(value);
  4649. }
  4650. else if (!includes(seen, computed, comparator)) {
  4651. if (seen !== result) {
  4652. seen.push(computed);
  4653. }
  4654. result.push(value);
  4655. }
  4656. }
  4657. return result;
  4658. }
  4659. /**
  4660. * The base implementation of `_.unset`.
  4661. *
  4662. * @private
  4663. * @param {Object} object The object to modify.
  4664. * @param {Array|string} path The property path to unset.
  4665. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  4666. */
  4667. function baseUnset(object, path) {
  4668. path = castPath(path, object);
  4669. object = parent(object, path);
  4670. return object == null || delete object[toKey(last(path))];
  4671. }
  4672. /**
  4673. * The base implementation of `_.update`.
  4674. *
  4675. * @private
  4676. * @param {Object} object The object to modify.
  4677. * @param {Array|string} path The path of the property to update.
  4678. * @param {Function} updater The function to produce the updated value.
  4679. * @param {Function} [customizer] The function to customize path creation.
  4680. * @returns {Object} Returns `object`.
  4681. */
  4682. function baseUpdate(object, path, updater, customizer) {
  4683. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  4684. }
  4685. /**
  4686. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  4687. * without support for iteratee shorthands.
  4688. *
  4689. * @private
  4690. * @param {Array} array The array to query.
  4691. * @param {Function} predicate The function invoked per iteration.
  4692. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  4693. * @param {boolean} [fromRight] Specify iterating from right to left.
  4694. * @returns {Array} Returns the slice of `array`.
  4695. */
  4696. function baseWhile(array, predicate, isDrop, fromRight) {
  4697. var length = array.length,
  4698. index = fromRight ? length : -1;
  4699. while ((fromRight ? index-- : ++index < length) &&
  4700. predicate(array[index], index, array)) {}
  4701. return isDrop
  4702. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  4703. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  4704. }
  4705. /**
  4706. * The base implementation of `wrapperValue` which returns the result of
  4707. * performing a sequence of actions on the unwrapped `value`, where each
  4708. * successive action is supplied the return value of the previous.
  4709. *
  4710. * @private
  4711. * @param {*} value The unwrapped value.
  4712. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  4713. * @returns {*} Returns the resolved value.
  4714. */
  4715. function baseWrapperValue(value, actions) {
  4716. var result = value;
  4717. if (result instanceof LazyWrapper) {
  4718. result = result.value();
  4719. }
  4720. return arrayReduce(actions, function(result, action) {
  4721. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  4722. }, result);
  4723. }
  4724. /**
  4725. * The base implementation of methods like `_.xor`, without support for
  4726. * iteratee shorthands, that accepts an array of arrays to inspect.
  4727. *
  4728. * @private
  4729. * @param {Array} arrays The arrays to inspect.
  4730. * @param {Function} [iteratee] The iteratee invoked per element.
  4731. * @param {Function} [comparator] The comparator invoked per element.
  4732. * @returns {Array} Returns the new array of values.
  4733. */
  4734. function baseXor(arrays, iteratee, comparator) {
  4735. var length = arrays.length;
  4736. if (length < 2) {
  4737. return length ? baseUniq(arrays[0]) : [];
  4738. }
  4739. var index = -1,
  4740. result = Array(length);
  4741. while (++index < length) {
  4742. var array = arrays[index],
  4743. othIndex = -1;
  4744. while (++othIndex < length) {
  4745. if (othIndex != index) {
  4746. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  4747. }
  4748. }
  4749. }
  4750. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  4751. }
  4752. /**
  4753. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  4754. *
  4755. * @private
  4756. * @param {Array} props The property identifiers.
  4757. * @param {Array} values The property values.
  4758. * @param {Function} assignFunc The function to assign values.
  4759. * @returns {Object} Returns the new object.
  4760. */
  4761. function baseZipObject(props, values, assignFunc) {
  4762. var index = -1,
  4763. length = props.length,
  4764. valsLength = values.length,
  4765. result = {};
  4766. while (++index < length) {
  4767. var value = index < valsLength ? values[index] : undefined;
  4768. assignFunc(result, props[index], value);
  4769. }
  4770. return result;
  4771. }
  4772. /**
  4773. * Casts `value` to an empty array if it's not an array like object.
  4774. *
  4775. * @private
  4776. * @param {*} value The value to inspect.
  4777. * @returns {Array|Object} Returns the cast array-like object.
  4778. */
  4779. function castArrayLikeObject(value) {
  4780. return isArrayLikeObject(value) ? value : [];
  4781. }
  4782. /**
  4783. * Casts `value` to `identity` if it's not a function.
  4784. *
  4785. * @private
  4786. * @param {*} value The value to inspect.
  4787. * @returns {Function} Returns cast function.
  4788. */
  4789. function castFunction(value) {
  4790. return typeof value == 'function' ? value : identity;
  4791. }
  4792. /**
  4793. * Casts `value` to a path array if it's not one.
  4794. *
  4795. * @private
  4796. * @param {*} value The value to inspect.
  4797. * @param {Object} [object] The object to query keys on.
  4798. * @returns {Array} Returns the cast property path array.
  4799. */
  4800. function castPath(value, object) {
  4801. if (isArray(value)) {
  4802. return value;
  4803. }
  4804. return isKey(value, object) ? [value] : stringToPath(toString(value));
  4805. }
  4806. /**
  4807. * A `baseRest` alias which can be replaced with `identity` by module
  4808. * replacement plugins.
  4809. *
  4810. * @private
  4811. * @type {Function}
  4812. * @param {Function} func The function to apply a rest parameter to.
  4813. * @returns {Function} Returns the new function.
  4814. */
  4815. var castRest = baseRest;
  4816. /**
  4817. * Casts `array` to a slice if it's needed.
  4818. *
  4819. * @private
  4820. * @param {Array} array The array to inspect.
  4821. * @param {number} start The start position.
  4822. * @param {number} [end=array.length] The end position.
  4823. * @returns {Array} Returns the cast slice.
  4824. */
  4825. function castSlice(array, start, end) {
  4826. var length = array.length;
  4827. end = end === undefined ? length : end;
  4828. return (!start && end >= length) ? array : baseSlice(array, start, end);
  4829. }
  4830. /**
  4831. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  4832. *
  4833. * @private
  4834. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  4835. */
  4836. var clearTimeout = ctxClearTimeout || function(id) {
  4837. return root.clearTimeout(id);
  4838. };
  4839. /**
  4840. * Creates a clone of `buffer`.
  4841. *
  4842. * @private
  4843. * @param {Buffer} buffer The buffer to clone.
  4844. * @param {boolean} [isDeep] Specify a deep clone.
  4845. * @returns {Buffer} Returns the cloned buffer.
  4846. */
  4847. function cloneBuffer(buffer, isDeep) {
  4848. if (isDeep) {
  4849. return buffer.slice();
  4850. }
  4851. var length = buffer.length,
  4852. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  4853. buffer.copy(result);
  4854. return result;
  4855. }
  4856. /**
  4857. * Creates a clone of `arrayBuffer`.
  4858. *
  4859. * @private
  4860. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  4861. * @returns {ArrayBuffer} Returns the cloned array buffer.
  4862. */
  4863. function cloneArrayBuffer(arrayBuffer) {
  4864. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  4865. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  4866. return result;
  4867. }
  4868. /**
  4869. * Creates a clone of `dataView`.
  4870. *
  4871. * @private
  4872. * @param {Object} dataView The data view to clone.
  4873. * @param {boolean} [isDeep] Specify a deep clone.
  4874. * @returns {Object} Returns the cloned data view.
  4875. */
  4876. function cloneDataView(dataView, isDeep) {
  4877. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  4878. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  4879. }
  4880. /**
  4881. * Creates a clone of `map`.
  4882. *
  4883. * @private
  4884. * @param {Object} map The map to clone.
  4885. * @param {Function} cloneFunc The function to clone values.
  4886. * @param {boolean} [isDeep] Specify a deep clone.
  4887. * @returns {Object} Returns the cloned map.
  4888. */
  4889. function cloneMap(map, isDeep, cloneFunc) {
  4890. var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
  4891. return arrayReduce(array, addMapEntry, new map.constructor);
  4892. }
  4893. /**
  4894. * Creates a clone of `regexp`.
  4895. *
  4896. * @private
  4897. * @param {Object} regexp The regexp to clone.
  4898. * @returns {Object} Returns the cloned regexp.
  4899. */
  4900. function cloneRegExp(regexp) {
  4901. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  4902. result.lastIndex = regexp.lastIndex;
  4903. return result;
  4904. }
  4905. /**
  4906. * Creates a clone of `set`.
  4907. *
  4908. * @private
  4909. * @param {Object} set The set to clone.
  4910. * @param {Function} cloneFunc The function to clone values.
  4911. * @param {boolean} [isDeep] Specify a deep clone.
  4912. * @returns {Object} Returns the cloned set.
  4913. */
  4914. function cloneSet(set, isDeep, cloneFunc) {
  4915. var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
  4916. return arrayReduce(array, addSetEntry, new set.constructor);
  4917. }
  4918. /**
  4919. * Creates a clone of the `symbol` object.
  4920. *
  4921. * @private
  4922. * @param {Object} symbol The symbol object to clone.
  4923. * @returns {Object} Returns the cloned symbol object.
  4924. */
  4925. function cloneSymbol(symbol) {
  4926. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  4927. }
  4928. /**
  4929. * Creates a clone of `typedArray`.
  4930. *
  4931. * @private
  4932. * @param {Object} typedArray The typed array to clone.
  4933. * @param {boolean} [isDeep] Specify a deep clone.
  4934. * @returns {Object} Returns the cloned typed array.
  4935. */
  4936. function cloneTypedArray(typedArray, isDeep) {
  4937. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  4938. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  4939. }
  4940. /**
  4941. * Compares values to sort them in ascending order.
  4942. *
  4943. * @private
  4944. * @param {*} value The value to compare.
  4945. * @param {*} other The other value to compare.
  4946. * @returns {number} Returns the sort order indicator for `value`.
  4947. */
  4948. function compareAscending(value, other) {
  4949. if (value !== other) {
  4950. var valIsDefined = value !== undefined,
  4951. valIsNull = value === null,
  4952. valIsReflexive = value === value,
  4953. valIsSymbol = isSymbol(value);
  4954. var othIsDefined = other !== undefined,
  4955. othIsNull = other === null,
  4956. othIsReflexive = other === other,
  4957. othIsSymbol = isSymbol(other);
  4958. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  4959. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  4960. (valIsNull && othIsDefined && othIsReflexive) ||
  4961. (!valIsDefined && othIsReflexive) ||
  4962. !valIsReflexive) {
  4963. return 1;
  4964. }
  4965. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  4966. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  4967. (othIsNull && valIsDefined && valIsReflexive) ||
  4968. (!othIsDefined && valIsReflexive) ||
  4969. !othIsReflexive) {
  4970. return -1;
  4971. }
  4972. }
  4973. return 0;
  4974. }
  4975. /**
  4976. * Used by `_.orderBy` to compare multiple properties of a value to another
  4977. * and stable sort them.
  4978. *
  4979. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  4980. * specify an order of "desc" for descending or "asc" for ascending sort order
  4981. * of corresponding values.
  4982. *
  4983. * @private
  4984. * @param {Object} object The object to compare.
  4985. * @param {Object} other The other object to compare.
  4986. * @param {boolean[]|string[]} orders The order to sort by for each property.
  4987. * @returns {number} Returns the sort order indicator for `object`.
  4988. */
  4989. function compareMultiple(object, other, orders) {
  4990. var index = -1,
  4991. objCriteria = object.criteria,
  4992. othCriteria = other.criteria,
  4993. length = objCriteria.length,
  4994. ordersLength = orders.length;
  4995. while (++index < length) {
  4996. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4997. if (result) {
  4998. if (index >= ordersLength) {
  4999. return result;
  5000. }
  5001. var order = orders[index];
  5002. return result * (order == 'desc' ? -1 : 1);
  5003. }
  5004. }
  5005. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5006. // that causes it, under certain circumstances, to provide the same value for
  5007. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5008. // for more details.
  5009. //
  5010. // This also ensures a stable sort in V8 and other engines.
  5011. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5012. return object.index - other.index;
  5013. }
  5014. /**
  5015. * Creates an array that is the composition of partially applied arguments,
  5016. * placeholders, and provided arguments into a single array of arguments.
  5017. *
  5018. * @private
  5019. * @param {Array} args The provided arguments.
  5020. * @param {Array} partials The arguments to prepend to those provided.
  5021. * @param {Array} holders The `partials` placeholder indexes.
  5022. * @params {boolean} [isCurried] Specify composing for a curried function.
  5023. * @returns {Array} Returns the new array of composed arguments.
  5024. */
  5025. function composeArgs(args, partials, holders, isCurried) {
  5026. var argsIndex = -1,
  5027. argsLength = args.length,
  5028. holdersLength = holders.length,
  5029. leftIndex = -1,
  5030. leftLength = partials.length,
  5031. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5032. result = Array(leftLength + rangeLength),
  5033. isUncurried = !isCurried;
  5034. while (++leftIndex < leftLength) {
  5035. result[leftIndex] = partials[leftIndex];
  5036. }
  5037. while (++argsIndex < holdersLength) {
  5038. if (isUncurried || argsIndex < argsLength) {
  5039. result[holders[argsIndex]] = args[argsIndex];
  5040. }
  5041. }
  5042. while (rangeLength--) {
  5043. result[leftIndex++] = args[argsIndex++];
  5044. }
  5045. return result;
  5046. }
  5047. /**
  5048. * This function is like `composeArgs` except that the arguments composition
  5049. * is tailored for `_.partialRight`.
  5050. *
  5051. * @private
  5052. * @param {Array} args The provided arguments.
  5053. * @param {Array} partials The arguments to append to those provided.
  5054. * @param {Array} holders The `partials` placeholder indexes.
  5055. * @params {boolean} [isCurried] Specify composing for a curried function.
  5056. * @returns {Array} Returns the new array of composed arguments.
  5057. */
  5058. function composeArgsRight(args, partials, holders, isCurried) {
  5059. var argsIndex = -1,
  5060. argsLength = args.length,
  5061. holdersIndex = -1,
  5062. holdersLength = holders.length,
  5063. rightIndex = -1,
  5064. rightLength = partials.length,
  5065. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5066. result = Array(rangeLength + rightLength),
  5067. isUncurried = !isCurried;
  5068. while (++argsIndex < rangeLength) {
  5069. result[argsIndex] = args[argsIndex];
  5070. }
  5071. var offset = argsIndex;
  5072. while (++rightIndex < rightLength) {
  5073. result[offset + rightIndex] = partials[rightIndex];
  5074. }
  5075. while (++holdersIndex < holdersLength) {
  5076. if (isUncurried || argsIndex < argsLength) {
  5077. result[offset + holders[holdersIndex]] = args[argsIndex++];
  5078. }
  5079. }
  5080. return result;
  5081. }
  5082. /**
  5083. * Copies the values of `source` to `array`.
  5084. *
  5085. * @private
  5086. * @param {Array} source The array to copy values from.
  5087. * @param {Array} [array=[]] The array to copy values to.
  5088. * @returns {Array} Returns `array`.
  5089. */
  5090. function copyArray(source, array) {
  5091. var index = -1,
  5092. length = source.length;
  5093. array || (array = Array(length));
  5094. while (++index < length) {
  5095. array[index] = source[index];
  5096. }
  5097. return array;
  5098. }
  5099. /**
  5100. * Copies properties of `source` to `object`.
  5101. *
  5102. * @private
  5103. * @param {Object} source The object to copy properties from.
  5104. * @param {Array} props The property identifiers to copy.
  5105. * @param {Object} [object={}] The object to copy properties to.
  5106. * @param {Function} [customizer] The function to customize copied values.
  5107. * @returns {Object} Returns `object`.
  5108. */
  5109. function copyObject(source, props, object, customizer) {
  5110. var isNew = !object;
  5111. object || (object = {});
  5112. var index = -1,
  5113. length = props.length;
  5114. while (++index < length) {
  5115. var key = props[index];
  5116. var newValue = customizer
  5117. ? customizer(object[key], source[key], key, object, source)
  5118. : undefined;
  5119. if (newValue === undefined) {
  5120. newValue = source[key];
  5121. }
  5122. if (isNew) {
  5123. baseAssignValue(object, key, newValue);
  5124. } else {
  5125. assignValue(object, key, newValue);
  5126. }
  5127. }
  5128. return object;
  5129. }
  5130. /**
  5131. * Copies own symbols of `source` to `object`.
  5132. *
  5133. * @private
  5134. * @param {Object} source The object to copy symbols from.
  5135. * @param {Object} [object={}] The object to copy symbols to.
  5136. * @returns {Object} Returns `object`.
  5137. */
  5138. function copySymbols(source, object) {
  5139. return copyObject(source, getSymbols(source), object);
  5140. }
  5141. /**
  5142. * Copies own and inherited symbols of `source` to `object`.
  5143. *
  5144. * @private
  5145. * @param {Object} source The object to copy symbols from.
  5146. * @param {Object} [object={}] The object to copy symbols to.
  5147. * @returns {Object} Returns `object`.
  5148. */
  5149. function copySymbolsIn(source, object) {
  5150. return copyObject(source, getSymbolsIn(source), object);
  5151. }
  5152. /**
  5153. * Creates a function like `_.groupBy`.
  5154. *
  5155. * @private
  5156. * @param {Function} setter The function to set accumulator values.
  5157. * @param {Function} [initializer] The accumulator object initializer.
  5158. * @returns {Function} Returns the new aggregator function.
  5159. */
  5160. function createAggregator(setter, initializer) {
  5161. return function(collection, iteratee) {
  5162. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  5163. accumulator = initializer ? initializer() : {};
  5164. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  5165. };
  5166. }
  5167. /**
  5168. * Creates a function like `_.assign`.
  5169. *
  5170. * @private
  5171. * @param {Function} assigner The function to assign values.
  5172. * @returns {Function} Returns the new assigner function.
  5173. */
  5174. function createAssigner(assigner) {
  5175. return baseRest(function(object, sources) {
  5176. var index = -1,
  5177. length = sources.length,
  5178. customizer = length > 1 ? sources[length - 1] : undefined,
  5179. guard = length > 2 ? sources[2] : undefined;
  5180. customizer = (assigner.length > 3 && typeof customizer == 'function')
  5181. ? (length--, customizer)
  5182. : undefined;
  5183. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  5184. customizer = length < 3 ? undefined : customizer;
  5185. length = 1;
  5186. }
  5187. object = Object(object);
  5188. while (++index < length) {
  5189. var source = sources[index];
  5190. if (source) {
  5191. assigner(object, source, index, customizer);
  5192. }
  5193. }
  5194. return object;
  5195. });
  5196. }
  5197. /**
  5198. * Creates a `baseEach` or `baseEachRight` function.
  5199. *
  5200. * @private
  5201. * @param {Function} eachFunc The function to iterate over a collection.
  5202. * @param {boolean} [fromRight] Specify iterating from right to left.
  5203. * @returns {Function} Returns the new base function.
  5204. */
  5205. function createBaseEach(eachFunc, fromRight) {
  5206. return function(collection, iteratee) {
  5207. if (collection == null) {
  5208. return collection;
  5209. }
  5210. if (!isArrayLike(collection)) {
  5211. return eachFunc(collection, iteratee);
  5212. }
  5213. var length = collection.length,
  5214. index = fromRight ? length : -1,
  5215. iterable = Object(collection);
  5216. while ((fromRight ? index-- : ++index < length)) {
  5217. if (iteratee(iterable[index], index, iterable) === false) {
  5218. break;
  5219. }
  5220. }
  5221. return collection;
  5222. };
  5223. }
  5224. /**
  5225. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  5226. *
  5227. * @private
  5228. * @param {boolean} [fromRight] Specify iterating from right to left.
  5229. * @returns {Function} Returns the new base function.
  5230. */
  5231. function createBaseFor(fromRight) {
  5232. return function(object, iteratee, keysFunc) {
  5233. var index = -1,
  5234. iterable = Object(object),
  5235. props = keysFunc(object),
  5236. length = props.length;
  5237. while (length--) {
  5238. var key = props[fromRight ? length : ++index];
  5239. if (iteratee(iterable[key], key, iterable) === false) {
  5240. break;
  5241. }
  5242. }
  5243. return object;
  5244. };
  5245. }
  5246. /**
  5247. * Creates a function that wraps `func` to invoke it with the optional `this`
  5248. * binding of `thisArg`.
  5249. *
  5250. * @private
  5251. * @param {Function} func The function to wrap.
  5252. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5253. * @param {*} [thisArg] The `this` binding of `func`.
  5254. * @returns {Function} Returns the new wrapped function.
  5255. */
  5256. function createBind(func, bitmask, thisArg) {
  5257. var isBind = bitmask & WRAP_BIND_FLAG,
  5258. Ctor = createCtor(func);
  5259. function wrapper() {
  5260. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5261. return fn.apply(isBind ? thisArg : this, arguments);
  5262. }
  5263. return wrapper;
  5264. }
  5265. /**
  5266. * Creates a function like `_.lowerFirst`.
  5267. *
  5268. * @private
  5269. * @param {string} methodName The name of the `String` case method to use.
  5270. * @returns {Function} Returns the new case function.
  5271. */
  5272. function createCaseFirst(methodName) {
  5273. return function(string) {
  5274. string = toString(string);
  5275. var strSymbols = hasUnicode(string)
  5276. ? stringToArray(string)
  5277. : undefined;
  5278. var chr = strSymbols
  5279. ? strSymbols[0]
  5280. : string.charAt(0);
  5281. var trailing = strSymbols
  5282. ? castSlice(strSymbols, 1).join('')
  5283. : string.slice(1);
  5284. return chr[methodName]() + trailing;
  5285. };
  5286. }
  5287. /**
  5288. * Creates a function like `_.camelCase`.
  5289. *
  5290. * @private
  5291. * @param {Function} callback The function to combine each word.
  5292. * @returns {Function} Returns the new compounder function.
  5293. */
  5294. function createCompounder(callback) {
  5295. return function(string) {
  5296. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  5297. };
  5298. }
  5299. /**
  5300. * Creates a function that produces an instance of `Ctor` regardless of
  5301. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  5302. *
  5303. * @private
  5304. * @param {Function} Ctor The constructor to wrap.
  5305. * @returns {Function} Returns the new wrapped function.
  5306. */
  5307. function createCtor(Ctor) {
  5308. return function() {
  5309. // Use a `switch` statement to work with class constructors. See
  5310. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  5311. // for more details.
  5312. var args = arguments;
  5313. switch (args.length) {
  5314. case 0: return new Ctor;
  5315. case 1: return new Ctor(args[0]);
  5316. case 2: return new Ctor(args[0], args[1]);
  5317. case 3: return new Ctor(args[0], args[1], args[2]);
  5318. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  5319. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  5320. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  5321. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  5322. }
  5323. var thisBinding = baseCreate(Ctor.prototype),
  5324. result = Ctor.apply(thisBinding, args);
  5325. // Mimic the constructor's `return` behavior.
  5326. // See https://es5.github.io/#x13.2.2 for more details.
  5327. return isObject(result) ? result : thisBinding;
  5328. };
  5329. }
  5330. /**
  5331. * Creates a function that wraps `func` to enable currying.
  5332. *
  5333. * @private
  5334. * @param {Function} func The function to wrap.
  5335. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5336. * @param {number} arity The arity of `func`.
  5337. * @returns {Function} Returns the new wrapped function.
  5338. */
  5339. function createCurry(func, bitmask, arity) {
  5340. var Ctor = createCtor(func);
  5341. function wrapper() {
  5342. var length = arguments.length,
  5343. args = Array(length),
  5344. index = length,
  5345. placeholder = getHolder(wrapper);
  5346. while (index--) {
  5347. args[index] = arguments[index];
  5348. }
  5349. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  5350. ? []
  5351. : replaceHolders(args, placeholder);
  5352. length -= holders.length;
  5353. if (length < arity) {
  5354. return createRecurry(
  5355. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  5356. args, holders, undefined, undefined, arity - length);
  5357. }
  5358. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5359. return apply(fn, this, args);
  5360. }
  5361. return wrapper;
  5362. }
  5363. /**
  5364. * Creates a `_.find` or `_.findLast` function.
  5365. *
  5366. * @private
  5367. * @param {Function} findIndexFunc The function to find the collection index.
  5368. * @returns {Function} Returns the new find function.
  5369. */
  5370. function createFind(findIndexFunc) {
  5371. return function(collection, predicate, fromIndex) {
  5372. var iterable = Object(collection);
  5373. if (!isArrayLike(collection)) {
  5374. var iteratee = getIteratee(predicate, 3);
  5375. collection = keys(collection);
  5376. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  5377. }
  5378. var index = findIndexFunc(collection, predicate, fromIndex);
  5379. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  5380. };
  5381. }
  5382. /**
  5383. * Creates a `_.flow` or `_.flowRight` function.
  5384. *
  5385. * @private
  5386. * @param {boolean} [fromRight] Specify iterating from right to left.
  5387. * @returns {Function} Returns the new flow function.
  5388. */
  5389. function createFlow(fromRight) {
  5390. return flatRest(function(funcs) {
  5391. var length = funcs.length,
  5392. index = length,
  5393. prereq = LodashWrapper.prototype.thru;
  5394. if (fromRight) {
  5395. funcs.reverse();
  5396. }
  5397. while (index--) {
  5398. var func = funcs[index];
  5399. if (typeof func != 'function') {
  5400. throw new TypeError(FUNC_ERROR_TEXT);
  5401. }
  5402. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  5403. var wrapper = new LodashWrapper([], true);
  5404. }
  5405. }
  5406. index = wrapper ? index : length;
  5407. while (++index < length) {
  5408. func = funcs[index];
  5409. var funcName = getFuncName(func),
  5410. data = funcName == 'wrapper' ? getData(func) : undefined;
  5411. if (data && isLaziable(data[0]) &&
  5412. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  5413. !data[4].length && data[9] == 1
  5414. ) {
  5415. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  5416. } else {
  5417. wrapper = (func.length == 1 && isLaziable(func))
  5418. ? wrapper[funcName]()
  5419. : wrapper.thru(func);
  5420. }
  5421. }
  5422. return function() {
  5423. var args = arguments,
  5424. value = args[0];
  5425. if (wrapper && args.length == 1 && isArray(value)) {
  5426. return wrapper.plant(value).value();
  5427. }
  5428. var index = 0,
  5429. result = length ? funcs[index].apply(this, args) : value;
  5430. while (++index < length) {
  5431. result = funcs[index].call(this, result);
  5432. }
  5433. return result;
  5434. };
  5435. });
  5436. }
  5437. /**
  5438. * Creates a function that wraps `func` to invoke it with optional `this`
  5439. * binding of `thisArg`, partial application, and currying.
  5440. *
  5441. * @private
  5442. * @param {Function|string} func The function or method name to wrap.
  5443. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5444. * @param {*} [thisArg] The `this` binding of `func`.
  5445. * @param {Array} [partials] The arguments to prepend to those provided to
  5446. * the new function.
  5447. * @param {Array} [holders] The `partials` placeholder indexes.
  5448. * @param {Array} [partialsRight] The arguments to append to those provided
  5449. * to the new function.
  5450. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  5451. * @param {Array} [argPos] The argument positions of the new function.
  5452. * @param {number} [ary] The arity cap of `func`.
  5453. * @param {number} [arity] The arity of `func`.
  5454. * @returns {Function} Returns the new wrapped function.
  5455. */
  5456. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  5457. var isAry = bitmask & WRAP_ARY_FLAG,
  5458. isBind = bitmask & WRAP_BIND_FLAG,
  5459. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  5460. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  5461. isFlip = bitmask & WRAP_FLIP_FLAG,
  5462. Ctor = isBindKey ? undefined : createCtor(func);
  5463. function wrapper() {
  5464. var length = arguments.length,
  5465. args = Array(length),
  5466. index = length;
  5467. while (index--) {
  5468. args[index] = arguments[index];
  5469. }
  5470. if (isCurried) {
  5471. var placeholder = getHolder(wrapper),
  5472. holdersCount = countHolders(args, placeholder);
  5473. }
  5474. if (partials) {
  5475. args = composeArgs(args, partials, holders, isCurried);
  5476. }
  5477. if (partialsRight) {
  5478. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  5479. }
  5480. length -= holdersCount;
  5481. if (isCurried && length < arity) {
  5482. var newHolders = replaceHolders(args, placeholder);
  5483. return createRecurry(
  5484. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  5485. args, newHolders, argPos, ary, arity - length
  5486. );
  5487. }
  5488. var thisBinding = isBind ? thisArg : this,
  5489. fn = isBindKey ? thisBinding[func] : func;
  5490. length = args.length;
  5491. if (argPos) {
  5492. args = reorder(args, argPos);
  5493. } else if (isFlip && length > 1) {
  5494. args.reverse();
  5495. }
  5496. if (isAry && ary < length) {
  5497. args.length = ary;
  5498. }
  5499. if (this && this !== root && this instanceof wrapper) {
  5500. fn = Ctor || createCtor(fn);
  5501. }
  5502. return fn.apply(thisBinding, args);
  5503. }
  5504. return wrapper;
  5505. }
  5506. /**
  5507. * Creates a function like `_.invertBy`.
  5508. *
  5509. * @private
  5510. * @param {Function} setter The function to set accumulator values.
  5511. * @param {Function} toIteratee The function to resolve iteratees.
  5512. * @returns {Function} Returns the new inverter function.
  5513. */
  5514. function createInverter(setter, toIteratee) {
  5515. return function(object, iteratee) {
  5516. return baseInverter(object, setter, toIteratee(iteratee), {});
  5517. };
  5518. }
  5519. /**
  5520. * Creates a function that performs a mathematical operation on two values.
  5521. *
  5522. * @private
  5523. * @param {Function} operator The function to perform the operation.
  5524. * @param {number} [defaultValue] The value used for `undefined` arguments.
  5525. * @returns {Function} Returns the new mathematical operation function.
  5526. */
  5527. function createMathOperation(operator, defaultValue) {
  5528. return function(value, other) {
  5529. var result;
  5530. if (value === undefined && other === undefined) {
  5531. return defaultValue;
  5532. }
  5533. if (value !== undefined) {
  5534. result = value;
  5535. }
  5536. if (other !== undefined) {
  5537. if (result === undefined) {
  5538. return other;
  5539. }
  5540. if (typeof value == 'string' || typeof other == 'string') {
  5541. value = baseToString(value);
  5542. other = baseToString(other);
  5543. } else {
  5544. value = baseToNumber(value);
  5545. other = baseToNumber(other);
  5546. }
  5547. result = operator(value, other);
  5548. }
  5549. return result;
  5550. };
  5551. }
  5552. /**
  5553. * Creates a function like `_.over`.
  5554. *
  5555. * @private
  5556. * @param {Function} arrayFunc The function to iterate over iteratees.
  5557. * @returns {Function} Returns the new over function.
  5558. */
  5559. function createOver(arrayFunc) {
  5560. return flatRest(function(iteratees) {
  5561. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  5562. return baseRest(function(args) {
  5563. var thisArg = this;
  5564. return arrayFunc(iteratees, function(iteratee) {
  5565. return apply(iteratee, thisArg, args);
  5566. });
  5567. });
  5568. });
  5569. }
  5570. /**
  5571. * Creates the padding for `string` based on `length`. The `chars` string
  5572. * is truncated if the number of characters exceeds `length`.
  5573. *
  5574. * @private
  5575. * @param {number} length The padding length.
  5576. * @param {string} [chars=' '] The string used as padding.
  5577. * @returns {string} Returns the padding for `string`.
  5578. */
  5579. function createPadding(length, chars) {
  5580. chars = chars === undefined ? ' ' : baseToString(chars);
  5581. var charsLength = chars.length;
  5582. if (charsLength < 2) {
  5583. return charsLength ? baseRepeat(chars, length) : chars;
  5584. }
  5585. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  5586. return hasUnicode(chars)
  5587. ? castSlice(stringToArray(result), 0, length).join('')
  5588. : result.slice(0, length);
  5589. }
  5590. /**
  5591. * Creates a function that wraps `func` to invoke it with the `this` binding
  5592. * of `thisArg` and `partials` prepended to the arguments it receives.
  5593. *
  5594. * @private
  5595. * @param {Function} func The function to wrap.
  5596. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5597. * @param {*} thisArg The `this` binding of `func`.
  5598. * @param {Array} partials The arguments to prepend to those provided to
  5599. * the new function.
  5600. * @returns {Function} Returns the new wrapped function.
  5601. */
  5602. function createPartial(func, bitmask, thisArg, partials) {
  5603. var isBind = bitmask & WRAP_BIND_FLAG,
  5604. Ctor = createCtor(func);
  5605. function wrapper() {
  5606. var argsIndex = -1,
  5607. argsLength = arguments.length,
  5608. leftIndex = -1,
  5609. leftLength = partials.length,
  5610. args = Array(leftLength + argsLength),
  5611. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5612. while (++leftIndex < leftLength) {
  5613. args[leftIndex] = partials[leftIndex];
  5614. }
  5615. while (argsLength--) {
  5616. args[leftIndex++] = arguments[++argsIndex];
  5617. }
  5618. return apply(fn, isBind ? thisArg : this, args);
  5619. }
  5620. return wrapper;
  5621. }
  5622. /**
  5623. * Creates a `_.range` or `_.rangeRight` function.
  5624. *
  5625. * @private
  5626. * @param {boolean} [fromRight] Specify iterating from right to left.
  5627. * @returns {Function} Returns the new range function.
  5628. */
  5629. function createRange(fromRight) {
  5630. return function(start, end, step) {
  5631. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  5632. end = step = undefined;
  5633. }
  5634. // Ensure the sign of `-0` is preserved.
  5635. start = toFinite(start);
  5636. if (end === undefined) {
  5637. end = start;
  5638. start = 0;
  5639. } else {
  5640. end = toFinite(end);
  5641. }
  5642. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  5643. return baseRange(start, end, step, fromRight);
  5644. };
  5645. }
  5646. /**
  5647. * Creates a function that performs a relational operation on two values.
  5648. *
  5649. * @private
  5650. * @param {Function} operator The function to perform the operation.
  5651. * @returns {Function} Returns the new relational operation function.
  5652. */
  5653. function createRelationalOperation(operator) {
  5654. return function(value, other) {
  5655. if (!(typeof value == 'string' && typeof other == 'string')) {
  5656. value = toNumber(value);
  5657. other = toNumber(other);
  5658. }
  5659. return operator(value, other);
  5660. };
  5661. }
  5662. /**
  5663. * Creates a function that wraps `func` to continue currying.
  5664. *
  5665. * @private
  5666. * @param {Function} func The function to wrap.
  5667. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5668. * @param {Function} wrapFunc The function to create the `func` wrapper.
  5669. * @param {*} placeholder The placeholder value.
  5670. * @param {*} [thisArg] The `this` binding of `func`.
  5671. * @param {Array} [partials] The arguments to prepend to those provided to
  5672. * the new function.
  5673. * @param {Array} [holders] The `partials` placeholder indexes.
  5674. * @param {Array} [argPos] The argument positions of the new function.
  5675. * @param {number} [ary] The arity cap of `func`.
  5676. * @param {number} [arity] The arity of `func`.
  5677. * @returns {Function} Returns the new wrapped function.
  5678. */
  5679. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  5680. var isCurry = bitmask & WRAP_CURRY_FLAG,
  5681. newHolders = isCurry ? holders : undefined,
  5682. newHoldersRight = isCurry ? undefined : holders,
  5683. newPartials = isCurry ? partials : undefined,
  5684. newPartialsRight = isCurry ? undefined : partials;
  5685. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  5686. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  5687. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  5688. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  5689. }
  5690. var newData = [
  5691. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  5692. newHoldersRight, argPos, ary, arity
  5693. ];
  5694. var result = wrapFunc.apply(undefined, newData);
  5695. if (isLaziable(func)) {
  5696. setData(result, newData);
  5697. }
  5698. result.placeholder = placeholder;
  5699. return setWrapToString(result, func, bitmask);
  5700. }
  5701. /**
  5702. * Creates a function like `_.round`.
  5703. *
  5704. * @private
  5705. * @param {string} methodName The name of the `Math` method to use when rounding.
  5706. * @returns {Function} Returns the new round function.
  5707. */
  5708. function createRound(methodName) {
  5709. var func = Math[methodName];
  5710. return function(number, precision) {
  5711. number = toNumber(number);
  5712. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  5713. if (precision) {
  5714. // Shift with exponential notation to avoid floating-point issues.
  5715. // See [MDN](https://mdn.io/round#Examples) for more details.
  5716. var pair = (toString(number) + 'e').split('e'),
  5717. value = func(pair[0] + 'e' + (+pair[1] + precision));
  5718. pair = (toString(value) + 'e').split('e');
  5719. return +(pair[0] + 'e' + (+pair[1] - precision));
  5720. }
  5721. return func(number);
  5722. };
  5723. }
  5724. /**
  5725. * Creates a set object of `values`.
  5726. *
  5727. * @private
  5728. * @param {Array} values The values to add to the set.
  5729. * @returns {Object} Returns the new set.
  5730. */
  5731. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  5732. return new Set(values);
  5733. };
  5734. /**
  5735. * Creates a `_.toPairs` or `_.toPairsIn` function.
  5736. *
  5737. * @private
  5738. * @param {Function} keysFunc The function to get the keys of a given object.
  5739. * @returns {Function} Returns the new pairs function.
  5740. */
  5741. function createToPairs(keysFunc) {
  5742. return function(object) {
  5743. var tag = getTag(object);
  5744. if (tag == mapTag) {
  5745. return mapToArray(object);
  5746. }
  5747. if (tag == setTag) {
  5748. return setToPairs(object);
  5749. }
  5750. return baseToPairs(object, keysFunc(object));
  5751. };
  5752. }
  5753. /**
  5754. * Creates a function that either curries or invokes `func` with optional
  5755. * `this` binding and partially applied arguments.
  5756. *
  5757. * @private
  5758. * @param {Function|string} func The function or method name to wrap.
  5759. * @param {number} bitmask The bitmask flags.
  5760. * 1 - `_.bind`
  5761. * 2 - `_.bindKey`
  5762. * 4 - `_.curry` or `_.curryRight` of a bound function
  5763. * 8 - `_.curry`
  5764. * 16 - `_.curryRight`
  5765. * 32 - `_.partial`
  5766. * 64 - `_.partialRight`
  5767. * 128 - `_.rearg`
  5768. * 256 - `_.ary`
  5769. * 512 - `_.flip`
  5770. * @param {*} [thisArg] The `this` binding of `func`.
  5771. * @param {Array} [partials] The arguments to be partially applied.
  5772. * @param {Array} [holders] The `partials` placeholder indexes.
  5773. * @param {Array} [argPos] The argument positions of the new function.
  5774. * @param {number} [ary] The arity cap of `func`.
  5775. * @param {number} [arity] The arity of `func`.
  5776. * @returns {Function} Returns the new wrapped function.
  5777. */
  5778. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  5779. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  5780. if (!isBindKey && typeof func != 'function') {
  5781. throw new TypeError(FUNC_ERROR_TEXT);
  5782. }
  5783. var length = partials ? partials.length : 0;
  5784. if (!length) {
  5785. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  5786. partials = holders = undefined;
  5787. }
  5788. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  5789. arity = arity === undefined ? arity : toInteger(arity);
  5790. length -= holders ? holders.length : 0;
  5791. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  5792. var partialsRight = partials,
  5793. holdersRight = holders;
  5794. partials = holders = undefined;
  5795. }
  5796. var data = isBindKey ? undefined : getData(func);
  5797. var newData = [
  5798. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  5799. argPos, ary, arity
  5800. ];
  5801. if (data) {
  5802. mergeData(newData, data);
  5803. }
  5804. func = newData[0];
  5805. bitmask = newData[1];
  5806. thisArg = newData[2];
  5807. partials = newData[3];
  5808. holders = newData[4];
  5809. arity = newData[9] = newData[9] === undefined
  5810. ? (isBindKey ? 0 : func.length)
  5811. : nativeMax(newData[9] - length, 0);
  5812. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  5813. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  5814. }
  5815. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  5816. var result = createBind(func, bitmask, thisArg);
  5817. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  5818. result = createCurry(func, bitmask, arity);
  5819. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  5820. result = createPartial(func, bitmask, thisArg, partials);
  5821. } else {
  5822. result = createHybrid.apply(undefined, newData);
  5823. }
  5824. var setter = data ? baseSetData : setData;
  5825. return setWrapToString(setter(result, newData), func, bitmask);
  5826. }
  5827. /**
  5828. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  5829. * of source objects to the destination object for all destination properties
  5830. * that resolve to `undefined`.
  5831. *
  5832. * @private
  5833. * @param {*} objValue The destination value.
  5834. * @param {*} srcValue The source value.
  5835. * @param {string} key The key of the property to assign.
  5836. * @param {Object} object The parent object of `objValue`.
  5837. * @returns {*} Returns the value to assign.
  5838. */
  5839. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5840. if (objValue === undefined ||
  5841. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  5842. return srcValue;
  5843. }
  5844. return objValue;
  5845. }
  5846. /**
  5847. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  5848. * objects into destination objects that are passed thru.
  5849. *
  5850. * @private
  5851. * @param {*} objValue The destination value.
  5852. * @param {*} srcValue The source value.
  5853. * @param {string} key The key of the property to merge.
  5854. * @param {Object} object The parent object of `objValue`.
  5855. * @param {Object} source The parent object of `srcValue`.
  5856. * @param {Object} [stack] Tracks traversed source values and their merged
  5857. * counterparts.
  5858. * @returns {*} Returns the value to assign.
  5859. */
  5860. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  5861. if (isObject(objValue) && isObject(srcValue)) {
  5862. // Recursively merge objects and arrays (susceptible to call stack limits).
  5863. stack.set(srcValue, objValue);
  5864. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  5865. stack['delete'](srcValue);
  5866. }
  5867. return objValue;
  5868. }
  5869. /**
  5870. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  5871. * objects.
  5872. *
  5873. * @private
  5874. * @param {*} value The value to inspect.
  5875. * @param {string} key The key of the property to inspect.
  5876. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  5877. */
  5878. function customOmitClone(value) {
  5879. return isPlainObject(value) ? undefined : value;
  5880. }
  5881. /**
  5882. * A specialized version of `baseIsEqualDeep` for arrays with support for
  5883. * partial deep comparisons.
  5884. *
  5885. * @private
  5886. * @param {Array} array The array to compare.
  5887. * @param {Array} other The other array to compare.
  5888. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  5889. * @param {Function} customizer The function to customize comparisons.
  5890. * @param {Function} equalFunc The function to determine equivalents of values.
  5891. * @param {Object} stack Tracks traversed `array` and `other` objects.
  5892. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  5893. */
  5894. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  5895. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  5896. arrLength = array.length,
  5897. othLength = other.length;
  5898. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  5899. return false;
  5900. }
  5901. // Assume cyclic values are equal.
  5902. var stacked = stack.get(array);
  5903. if (stacked && stack.get(other)) {
  5904. return stacked == other;
  5905. }
  5906. var index = -1,
  5907. result = true,
  5908. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  5909. stack.set(array, other);
  5910. stack.set(other, array);
  5911. // Ignore non-index properties.
  5912. while (++index < arrLength) {
  5913. var arrValue = array[index],
  5914. othValue = other[index];
  5915. if (customizer) {
  5916. var compared = isPartial
  5917. ? customizer(othValue, arrValue, index, other, array, stack)
  5918. : customizer(arrValue, othValue, index, array, other, stack);
  5919. }
  5920. if (compared !== undefined) {
  5921. if (compared) {
  5922. continue;
  5923. }
  5924. result = false;
  5925. break;
  5926. }
  5927. // Recursively compare arrays (susceptible to call stack limits).
  5928. if (seen) {
  5929. if (!arraySome(other, function(othValue, othIndex) {
  5930. if (!cacheHas(seen, othIndex) &&
  5931. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  5932. return seen.push(othIndex);
  5933. }
  5934. })) {
  5935. result = false;
  5936. break;
  5937. }
  5938. } else if (!(
  5939. arrValue === othValue ||
  5940. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  5941. )) {
  5942. result = false;
  5943. break;
  5944. }
  5945. }
  5946. stack['delete'](array);
  5947. stack['delete'](other);
  5948. return result;
  5949. }
  5950. /**
  5951. * A specialized version of `baseIsEqualDeep` for comparing objects of
  5952. * the same `toStringTag`.
  5953. *
  5954. * **Note:** This function only supports comparing values with tags of
  5955. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  5956. *
  5957. * @private
  5958. * @param {Object} object The object to compare.
  5959. * @param {Object} other The other object to compare.
  5960. * @param {string} tag The `toStringTag` of the objects to compare.
  5961. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  5962. * @param {Function} customizer The function to customize comparisons.
  5963. * @param {Function} equalFunc The function to determine equivalents of values.
  5964. * @param {Object} stack Tracks traversed `object` and `other` objects.
  5965. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5966. */
  5967. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  5968. switch (tag) {
  5969. case dataViewTag:
  5970. if ((object.byteLength != other.byteLength) ||
  5971. (object.byteOffset != other.byteOffset)) {
  5972. return false;
  5973. }
  5974. object = object.buffer;
  5975. other = other.buffer;
  5976. case arrayBufferTag:
  5977. if ((object.byteLength != other.byteLength) ||
  5978. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  5979. return false;
  5980. }
  5981. return true;
  5982. case boolTag:
  5983. case dateTag:
  5984. case numberTag:
  5985. // Coerce booleans to `1` or `0` and dates to milliseconds.
  5986. // Invalid dates are coerced to `NaN`.
  5987. return eq(+object, +other);
  5988. case errorTag:
  5989. return object.name == other.name && object.message == other.message;
  5990. case regexpTag:
  5991. case stringTag:
  5992. // Coerce regexes to strings and treat strings, primitives and objects,
  5993. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  5994. // for more details.
  5995. return object == (other + '');
  5996. case mapTag:
  5997. var convert = mapToArray;
  5998. case setTag:
  5999. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6000. convert || (convert = setToArray);
  6001. if (object.size != other.size && !isPartial) {
  6002. return false;
  6003. }
  6004. // Assume cyclic values are equal.
  6005. var stacked = stack.get(object);
  6006. if (stacked) {
  6007. return stacked == other;
  6008. }
  6009. bitmask |= COMPARE_UNORDERED_FLAG;
  6010. // Recursively compare objects (susceptible to call stack limits).
  6011. stack.set(object, other);
  6012. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6013. stack['delete'](object);
  6014. return result;
  6015. case symbolTag:
  6016. if (symbolValueOf) {
  6017. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6018. }
  6019. }
  6020. return false;
  6021. }
  6022. /**
  6023. * A specialized version of `baseIsEqualDeep` for objects with support for
  6024. * partial deep comparisons.
  6025. *
  6026. * @private
  6027. * @param {Object} object The object to compare.
  6028. * @param {Object} other The other object to compare.
  6029. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6030. * @param {Function} customizer The function to customize comparisons.
  6031. * @param {Function} equalFunc The function to determine equivalents of values.
  6032. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6033. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6034. */
  6035. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6036. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6037. objProps = getAllKeys(object),
  6038. objLength = objProps.length,
  6039. othProps = getAllKeys(other),
  6040. othLength = othProps.length;
  6041. if (objLength != othLength && !isPartial) {
  6042. return false;
  6043. }
  6044. var index = objLength;
  6045. while (index--) {
  6046. var key = objProps[index];
  6047. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  6048. return false;
  6049. }
  6050. }
  6051. // Assume cyclic values are equal.
  6052. var stacked = stack.get(object);
  6053. if (stacked && stack.get(other)) {
  6054. return stacked == other;
  6055. }
  6056. var result = true;
  6057. stack.set(object, other);
  6058. stack.set(other, object);
  6059. var skipCtor = isPartial;
  6060. while (++index < objLength) {
  6061. key = objProps[index];
  6062. var objValue = object[key],
  6063. othValue = other[key];
  6064. if (customizer) {
  6065. var compared = isPartial
  6066. ? customizer(othValue, objValue, key, other, object, stack)
  6067. : customizer(objValue, othValue, key, object, other, stack);
  6068. }
  6069. // Recursively compare objects (susceptible to call stack limits).
  6070. if (!(compared === undefined
  6071. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  6072. : compared
  6073. )) {
  6074. result = false;
  6075. break;
  6076. }
  6077. skipCtor || (skipCtor = key == 'constructor');
  6078. }
  6079. if (result && !skipCtor) {
  6080. var objCtor = object.constructor,
  6081. othCtor = other.constructor;
  6082. // Non `Object` object instances with different constructors are not equal.
  6083. if (objCtor != othCtor &&
  6084. ('constructor' in object && 'constructor' in other) &&
  6085. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  6086. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  6087. result = false;
  6088. }
  6089. }
  6090. stack['delete'](object);
  6091. stack['delete'](other);
  6092. return result;
  6093. }
  6094. /**
  6095. * A specialized version of `baseRest` which flattens the rest array.
  6096. *
  6097. * @private
  6098. * @param {Function} func The function to apply a rest parameter to.
  6099. * @returns {Function} Returns the new function.
  6100. */
  6101. function flatRest(func) {
  6102. return setToString(overRest(func, undefined, flatten), func + '');
  6103. }
  6104. /**
  6105. * Creates an array of own enumerable property names and symbols of `object`.
  6106. *
  6107. * @private
  6108. * @param {Object} object The object to query.
  6109. * @returns {Array} Returns the array of property names and symbols.
  6110. */
  6111. function getAllKeys(object) {
  6112. return baseGetAllKeys(object, keys, getSymbols);
  6113. }
  6114. /**
  6115. * Creates an array of own and inherited enumerable property names and
  6116. * symbols of `object`.
  6117. *
  6118. * @private
  6119. * @param {Object} object The object to query.
  6120. * @returns {Array} Returns the array of property names and symbols.
  6121. */
  6122. function getAllKeysIn(object) {
  6123. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  6124. }
  6125. /**
  6126. * Gets metadata for `func`.
  6127. *
  6128. * @private
  6129. * @param {Function} func The function to query.
  6130. * @returns {*} Returns the metadata for `func`.
  6131. */
  6132. var getData = !metaMap ? noop : function(func) {
  6133. return metaMap.get(func);
  6134. };
  6135. /**
  6136. * Gets the name of `func`.
  6137. *
  6138. * @private
  6139. * @param {Function} func The function to query.
  6140. * @returns {string} Returns the function name.
  6141. */
  6142. function getFuncName(func) {
  6143. var result = (func.name + ''),
  6144. array = realNames[result],
  6145. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  6146. while (length--) {
  6147. var data = array[length],
  6148. otherFunc = data.func;
  6149. if (otherFunc == null || otherFunc == func) {
  6150. return data.name;
  6151. }
  6152. }
  6153. return result;
  6154. }
  6155. /**
  6156. * Gets the argument placeholder value for `func`.
  6157. *
  6158. * @private
  6159. * @param {Function} func The function to inspect.
  6160. * @returns {*} Returns the placeholder value.
  6161. */
  6162. function getHolder(func) {
  6163. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  6164. return object.placeholder;
  6165. }
  6166. /**
  6167. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  6168. * this function returns the custom method, otherwise it returns `baseIteratee`.
  6169. * If arguments are provided, the chosen function is invoked with them and
  6170. * its result is returned.
  6171. *
  6172. * @private
  6173. * @param {*} [value] The value to convert to an iteratee.
  6174. * @param {number} [arity] The arity of the created iteratee.
  6175. * @returns {Function} Returns the chosen function or its result.
  6176. */
  6177. function getIteratee() {
  6178. var result = lodash.iteratee || iteratee;
  6179. result = result === iteratee ? baseIteratee : result;
  6180. return arguments.length ? result(arguments[0], arguments[1]) : result;
  6181. }
  6182. /**
  6183. * Gets the data for `map`.
  6184. *
  6185. * @private
  6186. * @param {Object} map The map to query.
  6187. * @param {string} key The reference key.
  6188. * @returns {*} Returns the map data.
  6189. */
  6190. function getMapData(map, key) {
  6191. var data = map.__data__;
  6192. return isKeyable(key)
  6193. ? data[typeof key == 'string' ? 'string' : 'hash']
  6194. : data.map;
  6195. }
  6196. /**
  6197. * Gets the property names, values, and compare flags of `object`.
  6198. *
  6199. * @private
  6200. * @param {Object} object The object to query.
  6201. * @returns {Array} Returns the match data of `object`.
  6202. */
  6203. function getMatchData(object) {
  6204. var result = keys(object),
  6205. length = result.length;
  6206. while (length--) {
  6207. var key = result[length],
  6208. value = object[key];
  6209. result[length] = [key, value, isStrictComparable(value)];
  6210. }
  6211. return result;
  6212. }
  6213. /**
  6214. * Gets the native function at `key` of `object`.
  6215. *
  6216. * @private
  6217. * @param {Object} object The object to query.
  6218. * @param {string} key The key of the method to get.
  6219. * @returns {*} Returns the function if it's native, else `undefined`.
  6220. */
  6221. function getNative(object, key) {
  6222. var value = getValue(object, key);
  6223. return baseIsNative(value) ? value : undefined;
  6224. }
  6225. /**
  6226. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6227. *
  6228. * @private
  6229. * @param {*} value The value to query.
  6230. * @returns {string} Returns the raw `toStringTag`.
  6231. */
  6232. function getRawTag(value) {
  6233. var isOwn = hasOwnProperty.call(value, symToStringTag),
  6234. tag = value[symToStringTag];
  6235. try {
  6236. value[symToStringTag] = undefined;
  6237. var unmasked = true;
  6238. } catch (e) {}
  6239. var result = nativeObjectToString.call(value);
  6240. if (unmasked) {
  6241. if (isOwn) {
  6242. value[symToStringTag] = tag;
  6243. } else {
  6244. delete value[symToStringTag];
  6245. }
  6246. }
  6247. return result;
  6248. }
  6249. /**
  6250. * Creates an array of the own enumerable symbols of `object`.
  6251. *
  6252. * @private
  6253. * @param {Object} object The object to query.
  6254. * @returns {Array} Returns the array of symbols.
  6255. */
  6256. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  6257. if (object == null) {
  6258. return [];
  6259. }
  6260. object = Object(object);
  6261. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  6262. return propertyIsEnumerable.call(object, symbol);
  6263. });
  6264. };
  6265. /**
  6266. * Creates an array of the own and inherited enumerable symbols of `object`.
  6267. *
  6268. * @private
  6269. * @param {Object} object The object to query.
  6270. * @returns {Array} Returns the array of symbols.
  6271. */
  6272. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  6273. var result = [];
  6274. while (object) {
  6275. arrayPush(result, getSymbols(object));
  6276. object = getPrototype(object);
  6277. }
  6278. return result;
  6279. };
  6280. /**
  6281. * Gets the `toStringTag` of `value`.
  6282. *
  6283. * @private
  6284. * @param {*} value The value to query.
  6285. * @returns {string} Returns the `toStringTag`.
  6286. */
  6287. var getTag = baseGetTag;
  6288. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  6289. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6290. (Map && getTag(new Map) != mapTag) ||
  6291. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6292. (Set && getTag(new Set) != setTag) ||
  6293. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6294. getTag = function(value) {
  6295. var result = baseGetTag(value),
  6296. Ctor = result == objectTag ? value.constructor : undefined,
  6297. ctorString = Ctor ? toSource(Ctor) : '';
  6298. if (ctorString) {
  6299. switch (ctorString) {
  6300. case dataViewCtorString: return dataViewTag;
  6301. case mapCtorString: return mapTag;
  6302. case promiseCtorString: return promiseTag;
  6303. case setCtorString: return setTag;
  6304. case weakMapCtorString: return weakMapTag;
  6305. }
  6306. }
  6307. return result;
  6308. };
  6309. }
  6310. /**
  6311. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  6312. *
  6313. * @private
  6314. * @param {number} start The start of the view.
  6315. * @param {number} end The end of the view.
  6316. * @param {Array} transforms The transformations to apply to the view.
  6317. * @returns {Object} Returns an object containing the `start` and `end`
  6318. * positions of the view.
  6319. */
  6320. function getView(start, end, transforms) {
  6321. var index = -1,
  6322. length = transforms.length;
  6323. while (++index < length) {
  6324. var data = transforms[index],
  6325. size = data.size;
  6326. switch (data.type) {
  6327. case 'drop': start += size; break;
  6328. case 'dropRight': end -= size; break;
  6329. case 'take': end = nativeMin(end, start + size); break;
  6330. case 'takeRight': start = nativeMax(start, end - size); break;
  6331. }
  6332. }
  6333. return { 'start': start, 'end': end };
  6334. }
  6335. /**
  6336. * Extracts wrapper details from the `source` body comment.
  6337. *
  6338. * @private
  6339. * @param {string} source The source to inspect.
  6340. * @returns {Array} Returns the wrapper details.
  6341. */
  6342. function getWrapDetails(source) {
  6343. var match = source.match(reWrapDetails);
  6344. return match ? match[1].split(reSplitDetails) : [];
  6345. }
  6346. /**
  6347. * Checks if `path` exists on `object`.
  6348. *
  6349. * @private
  6350. * @param {Object} object The object to query.
  6351. * @param {Array|string} path The path to check.
  6352. * @param {Function} hasFunc The function to check properties.
  6353. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6354. */
  6355. function hasPath(object, path, hasFunc) {
  6356. path = castPath(path, object);
  6357. var index = -1,
  6358. length = path.length,
  6359. result = false;
  6360. while (++index < length) {
  6361. var key = toKey(path[index]);
  6362. if (!(result = object != null && hasFunc(object, key))) {
  6363. break;
  6364. }
  6365. object = object[key];
  6366. }
  6367. if (result || ++index != length) {
  6368. return result;
  6369. }
  6370. length = object == null ? 0 : object.length;
  6371. return !!length && isLength(length) && isIndex(key, length) &&
  6372. (isArray(object) || isArguments(object));
  6373. }
  6374. /**
  6375. * Initializes an array clone.
  6376. *
  6377. * @private
  6378. * @param {Array} array The array to clone.
  6379. * @returns {Array} Returns the initialized clone.
  6380. */
  6381. function initCloneArray(array) {
  6382. var length = array.length,
  6383. result = array.constructor(length);
  6384. // Add properties assigned by `RegExp#exec`.
  6385. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  6386. result.index = array.index;
  6387. result.input = array.input;
  6388. }
  6389. return result;
  6390. }
  6391. /**
  6392. * Initializes an object clone.
  6393. *
  6394. * @private
  6395. * @param {Object} object The object to clone.
  6396. * @returns {Object} Returns the initialized clone.
  6397. */
  6398. function initCloneObject(object) {
  6399. return (typeof object.constructor == 'function' && !isPrototype(object))
  6400. ? baseCreate(getPrototype(object))
  6401. : {};
  6402. }
  6403. /**
  6404. * Initializes an object clone based on its `toStringTag`.
  6405. *
  6406. * **Note:** This function only supports cloning values with tags of
  6407. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6408. *
  6409. * @private
  6410. * @param {Object} object The object to clone.
  6411. * @param {string} tag The `toStringTag` of the object to clone.
  6412. * @param {Function} cloneFunc The function to clone values.
  6413. * @param {boolean} [isDeep] Specify a deep clone.
  6414. * @returns {Object} Returns the initialized clone.
  6415. */
  6416. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  6417. var Ctor = object.constructor;
  6418. switch (tag) {
  6419. case arrayBufferTag:
  6420. return cloneArrayBuffer(object);
  6421. case boolTag:
  6422. case dateTag:
  6423. return new Ctor(+object);
  6424. case dataViewTag:
  6425. return cloneDataView(object, isDeep);
  6426. case float32Tag: case float64Tag:
  6427. case int8Tag: case int16Tag: case int32Tag:
  6428. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  6429. return cloneTypedArray(object, isDeep);
  6430. case mapTag:
  6431. return cloneMap(object, isDeep, cloneFunc);
  6432. case numberTag:
  6433. case stringTag:
  6434. return new Ctor(object);
  6435. case regexpTag:
  6436. return cloneRegExp(object);
  6437. case setTag:
  6438. return cloneSet(object, isDeep, cloneFunc);
  6439. case symbolTag:
  6440. return cloneSymbol(object);
  6441. }
  6442. }
  6443. /**
  6444. * Inserts wrapper `details` in a comment at the top of the `source` body.
  6445. *
  6446. * @private
  6447. * @param {string} source The source to modify.
  6448. * @returns {Array} details The details to insert.
  6449. * @returns {string} Returns the modified source.
  6450. */
  6451. function insertWrapDetails(source, details) {
  6452. var length = details.length;
  6453. if (!length) {
  6454. return source;
  6455. }
  6456. var lastIndex = length - 1;
  6457. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  6458. details = details.join(length > 2 ? ', ' : ' ');
  6459. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  6460. }
  6461. /**
  6462. * Checks if `value` is a flattenable `arguments` object or array.
  6463. *
  6464. * @private
  6465. * @param {*} value The value to check.
  6466. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  6467. */
  6468. function isFlattenable(value) {
  6469. return isArray(value) || isArguments(value) ||
  6470. !!(spreadableSymbol && value && value[spreadableSymbol]);
  6471. }
  6472. /**
  6473. * Checks if `value` is a valid array-like index.
  6474. *
  6475. * @private
  6476. * @param {*} value The value to check.
  6477. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  6478. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  6479. */
  6480. function isIndex(value, length) {
  6481. length = length == null ? MAX_SAFE_INTEGER : length;
  6482. return !!length &&
  6483. (typeof value == 'number' || reIsUint.test(value)) &&
  6484. (value > -1 && value % 1 == 0 && value < length);
  6485. }
  6486. /**
  6487. * Checks if the given arguments are from an iteratee call.
  6488. *
  6489. * @private
  6490. * @param {*} value The potential iteratee value argument.
  6491. * @param {*} index The potential iteratee index or key argument.
  6492. * @param {*} object The potential iteratee object argument.
  6493. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  6494. * else `false`.
  6495. */
  6496. function isIterateeCall(value, index, object) {
  6497. if (!isObject(object)) {
  6498. return false;
  6499. }
  6500. var type = typeof index;
  6501. if (type == 'number'
  6502. ? (isArrayLike(object) && isIndex(index, object.length))
  6503. : (type == 'string' && index in object)
  6504. ) {
  6505. return eq(object[index], value);
  6506. }
  6507. return false;
  6508. }
  6509. /**
  6510. * Checks if `value` is a property name and not a property path.
  6511. *
  6512. * @private
  6513. * @param {*} value The value to check.
  6514. * @param {Object} [object] The object to query keys on.
  6515. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  6516. */
  6517. function isKey(value, object) {
  6518. if (isArray(value)) {
  6519. return false;
  6520. }
  6521. var type = typeof value;
  6522. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  6523. value == null || isSymbol(value)) {
  6524. return true;
  6525. }
  6526. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  6527. (object != null && value in Object(object));
  6528. }
  6529. /**
  6530. * Checks if `value` is suitable for use as unique object key.
  6531. *
  6532. * @private
  6533. * @param {*} value The value to check.
  6534. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  6535. */
  6536. function isKeyable(value) {
  6537. var type = typeof value;
  6538. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  6539. ? (value !== '__proto__')
  6540. : (value === null);
  6541. }
  6542. /**
  6543. * Checks if `func` has a lazy counterpart.
  6544. *
  6545. * @private
  6546. * @param {Function} func The function to check.
  6547. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  6548. * else `false`.
  6549. */
  6550. function isLaziable(func) {
  6551. var funcName = getFuncName(func),
  6552. other = lodash[funcName];
  6553. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  6554. return false;
  6555. }
  6556. if (func === other) {
  6557. return true;
  6558. }
  6559. var data = getData(other);
  6560. return !!data && func === data[0];
  6561. }
  6562. /**
  6563. * Checks if `func` has its source masked.
  6564. *
  6565. * @private
  6566. * @param {Function} func The function to check.
  6567. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  6568. */
  6569. function isMasked(func) {
  6570. return !!maskSrcKey && (maskSrcKey in func);
  6571. }
  6572. /**
  6573. * Checks if `func` is capable of being masked.
  6574. *
  6575. * @private
  6576. * @param {*} value The value to check.
  6577. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  6578. */
  6579. var isMaskable = coreJsData ? isFunction : stubFalse;
  6580. /**
  6581. * Checks if `value` is likely a prototype object.
  6582. *
  6583. * @private
  6584. * @param {*} value The value to check.
  6585. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  6586. */
  6587. function isPrototype(value) {
  6588. var Ctor = value && value.constructor,
  6589. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  6590. return value === proto;
  6591. }
  6592. /**
  6593. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  6594. *
  6595. * @private
  6596. * @param {*} value The value to check.
  6597. * @returns {boolean} Returns `true` if `value` if suitable for strict
  6598. * equality comparisons, else `false`.
  6599. */
  6600. function isStrictComparable(value) {
  6601. return value === value && !isObject(value);
  6602. }
  6603. /**
  6604. * A specialized version of `matchesProperty` for source values suitable
  6605. * for strict equality comparisons, i.e. `===`.
  6606. *
  6607. * @private
  6608. * @param {string} key The key of the property to get.
  6609. * @param {*} srcValue The value to match.
  6610. * @returns {Function} Returns the new spec function.
  6611. */
  6612. function matchesStrictComparable(key, srcValue) {
  6613. return function(object) {
  6614. if (object == null) {
  6615. return false;
  6616. }
  6617. return object[key] === srcValue &&
  6618. (srcValue !== undefined || (key in Object(object)));
  6619. };
  6620. }
  6621. /**
  6622. * A specialized version of `_.memoize` which clears the memoized function's
  6623. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  6624. *
  6625. * @private
  6626. * @param {Function} func The function to have its output memoized.
  6627. * @returns {Function} Returns the new memoized function.
  6628. */
  6629. function memoizeCapped(func) {
  6630. var result = memoize(func, function(key) {
  6631. if (cache.size === MAX_MEMOIZE_SIZE) {
  6632. cache.clear();
  6633. }
  6634. return key;
  6635. });
  6636. var cache = result.cache;
  6637. return result;
  6638. }
  6639. /**
  6640. * Merges the function metadata of `source` into `data`.
  6641. *
  6642. * Merging metadata reduces the number of wrappers used to invoke a function.
  6643. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  6644. * may be applied regardless of execution order. Methods like `_.ary` and
  6645. * `_.rearg` modify function arguments, making the order in which they are
  6646. * executed important, preventing the merging of metadata. However, we make
  6647. * an exception for a safe combined case where curried functions have `_.ary`
  6648. * and or `_.rearg` applied.
  6649. *
  6650. * @private
  6651. * @param {Array} data The destination metadata.
  6652. * @param {Array} source The source metadata.
  6653. * @returns {Array} Returns `data`.
  6654. */
  6655. function mergeData(data, source) {
  6656. var bitmask = data[1],
  6657. srcBitmask = source[1],
  6658. newBitmask = bitmask | srcBitmask,
  6659. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  6660. var isCombo =
  6661. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  6662. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  6663. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  6664. // Exit early if metadata can't be merged.
  6665. if (!(isCommon || isCombo)) {
  6666. return data;
  6667. }
  6668. // Use source `thisArg` if available.
  6669. if (srcBitmask & WRAP_BIND_FLAG) {
  6670. data[2] = source[2];
  6671. // Set when currying a bound function.
  6672. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  6673. }
  6674. // Compose partial arguments.
  6675. var value = source[3];
  6676. if (value) {
  6677. var partials = data[3];
  6678. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  6679. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  6680. }
  6681. // Compose partial right arguments.
  6682. value = source[5];
  6683. if (value) {
  6684. partials = data[5];
  6685. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  6686. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  6687. }
  6688. // Use source `argPos` if available.
  6689. value = source[7];
  6690. if (value) {
  6691. data[7] = value;
  6692. }
  6693. // Use source `ary` if it's smaller.
  6694. if (srcBitmask & WRAP_ARY_FLAG) {
  6695. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  6696. }
  6697. // Use source `arity` if one is not provided.
  6698. if (data[9] == null) {
  6699. data[9] = source[9];
  6700. }
  6701. // Use source `func` and merge bitmasks.
  6702. data[0] = source[0];
  6703. data[1] = newBitmask;
  6704. return data;
  6705. }
  6706. /**
  6707. * This function is like
  6708. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  6709. * except that it includes inherited enumerable properties.
  6710. *
  6711. * @private
  6712. * @param {Object} object The object to query.
  6713. * @returns {Array} Returns the array of property names.
  6714. */
  6715. function nativeKeysIn(object) {
  6716. var result = [];
  6717. if (object != null) {
  6718. for (var key in Object(object)) {
  6719. result.push(key);
  6720. }
  6721. }
  6722. return result;
  6723. }
  6724. /**
  6725. * Converts `value` to a string using `Object.prototype.toString`.
  6726. *
  6727. * @private
  6728. * @param {*} value The value to convert.
  6729. * @returns {string} Returns the converted string.
  6730. */
  6731. function objectToString(value) {
  6732. return nativeObjectToString.call(value);
  6733. }
  6734. /**
  6735. * A specialized version of `baseRest` which transforms the rest array.
  6736. *
  6737. * @private
  6738. * @param {Function} func The function to apply a rest parameter to.
  6739. * @param {number} [start=func.length-1] The start position of the rest parameter.
  6740. * @param {Function} transform The rest array transform.
  6741. * @returns {Function} Returns the new function.
  6742. */
  6743. function overRest(func, start, transform) {
  6744. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  6745. return function() {
  6746. var args = arguments,
  6747. index = -1,
  6748. length = nativeMax(args.length - start, 0),
  6749. array = Array(length);
  6750. while (++index < length) {
  6751. array[index] = args[start + index];
  6752. }
  6753. index = -1;
  6754. var otherArgs = Array(start + 1);
  6755. while (++index < start) {
  6756. otherArgs[index] = args[index];
  6757. }
  6758. otherArgs[start] = transform(array);
  6759. return apply(func, this, otherArgs);
  6760. };
  6761. }
  6762. /**
  6763. * Gets the parent value at `path` of `object`.
  6764. *
  6765. * @private
  6766. * @param {Object} object The object to query.
  6767. * @param {Array} path The path to get the parent value of.
  6768. * @returns {*} Returns the parent value.
  6769. */
  6770. function parent(object, path) {
  6771. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  6772. }
  6773. /**
  6774. * Reorder `array` according to the specified indexes where the element at
  6775. * the first index is assigned as the first element, the element at
  6776. * the second index is assigned as the second element, and so on.
  6777. *
  6778. * @private
  6779. * @param {Array} array The array to reorder.
  6780. * @param {Array} indexes The arranged array indexes.
  6781. * @returns {Array} Returns `array`.
  6782. */
  6783. function reorder(array, indexes) {
  6784. var arrLength = array.length,
  6785. length = nativeMin(indexes.length, arrLength),
  6786. oldArray = copyArray(array);
  6787. while (length--) {
  6788. var index = indexes[length];
  6789. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  6790. }
  6791. return array;
  6792. }
  6793. /**
  6794. * Sets metadata for `func`.
  6795. *
  6796. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  6797. * period of time, it will trip its breaker and transition to an identity
  6798. * function to avoid garbage collection pauses in V8. See
  6799. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  6800. * for more details.
  6801. *
  6802. * @private
  6803. * @param {Function} func The function to associate metadata with.
  6804. * @param {*} data The metadata.
  6805. * @returns {Function} Returns `func`.
  6806. */
  6807. var setData = shortOut(baseSetData);
  6808. /**
  6809. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  6810. *
  6811. * @private
  6812. * @param {Function} func The function to delay.
  6813. * @param {number} wait The number of milliseconds to delay invocation.
  6814. * @returns {number|Object} Returns the timer id or timeout object.
  6815. */
  6816. var setTimeout = ctxSetTimeout || function(func, wait) {
  6817. return root.setTimeout(func, wait);
  6818. };
  6819. /**
  6820. * Sets the `toString` method of `func` to return `string`.
  6821. *
  6822. * @private
  6823. * @param {Function} func The function to modify.
  6824. * @param {Function} string The `toString` result.
  6825. * @returns {Function} Returns `func`.
  6826. */
  6827. var setToString = shortOut(baseSetToString);
  6828. /**
  6829. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  6830. * with wrapper details in a comment at the top of the source body.
  6831. *
  6832. * @private
  6833. * @param {Function} wrapper The function to modify.
  6834. * @param {Function} reference The reference function.
  6835. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6836. * @returns {Function} Returns `wrapper`.
  6837. */
  6838. function setWrapToString(wrapper, reference, bitmask) {
  6839. var source = (reference + '');
  6840. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  6841. }
  6842. /**
  6843. * Creates a function that'll short out and invoke `identity` instead
  6844. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  6845. * milliseconds.
  6846. *
  6847. * @private
  6848. * @param {Function} func The function to restrict.
  6849. * @returns {Function} Returns the new shortable function.
  6850. */
  6851. function shortOut(func) {
  6852. var count = 0,
  6853. lastCalled = 0;
  6854. return function() {
  6855. var stamp = nativeNow(),
  6856. remaining = HOT_SPAN - (stamp - lastCalled);
  6857. lastCalled = stamp;
  6858. if (remaining > 0) {
  6859. if (++count >= HOT_COUNT) {
  6860. return arguments[0];
  6861. }
  6862. } else {
  6863. count = 0;
  6864. }
  6865. return func.apply(undefined, arguments);
  6866. };
  6867. }
  6868. /**
  6869. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  6870. *
  6871. * @private
  6872. * @param {Array} array The array to shuffle.
  6873. * @param {number} [size=array.length] The size of `array`.
  6874. * @returns {Array} Returns `array`.
  6875. */
  6876. function shuffleSelf(array, size) {
  6877. var index = -1,
  6878. length = array.length,
  6879. lastIndex = length - 1;
  6880. size = size === undefined ? length : size;
  6881. while (++index < size) {
  6882. var rand = baseRandom(index, lastIndex),
  6883. value = array[rand];
  6884. array[rand] = array[index];
  6885. array[index] = value;
  6886. }
  6887. array.length = size;
  6888. return array;
  6889. }
  6890. /**
  6891. * Converts `string` to a property path array.
  6892. *
  6893. * @private
  6894. * @param {string} string The string to convert.
  6895. * @returns {Array} Returns the property path array.
  6896. */
  6897. var stringToPath = memoizeCapped(function(string) {
  6898. var result = [];
  6899. if (reLeadingDot.test(string)) {
  6900. result.push('');
  6901. }
  6902. string.replace(rePropName, function(match, number, quote, string) {
  6903. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  6904. });
  6905. return result;
  6906. });
  6907. /**
  6908. * Converts `value` to a string key if it's not a string or symbol.
  6909. *
  6910. * @private
  6911. * @param {*} value The value to inspect.
  6912. * @returns {string|symbol} Returns the key.
  6913. */
  6914. function toKey(value) {
  6915. if (typeof value == 'string' || isSymbol(value)) {
  6916. return value;
  6917. }
  6918. var result = (value + '');
  6919. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  6920. }
  6921. /**
  6922. * Converts `func` to its source code.
  6923. *
  6924. * @private
  6925. * @param {Function} func The function to convert.
  6926. * @returns {string} Returns the source code.
  6927. */
  6928. function toSource(func) {
  6929. if (func != null) {
  6930. try {
  6931. return funcToString.call(func);
  6932. } catch (e) {}
  6933. try {
  6934. return (func + '');
  6935. } catch (e) {}
  6936. }
  6937. return '';
  6938. }
  6939. /**
  6940. * Updates wrapper `details` based on `bitmask` flags.
  6941. *
  6942. * @private
  6943. * @returns {Array} details The details to modify.
  6944. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6945. * @returns {Array} Returns `details`.
  6946. */
  6947. function updateWrapDetails(details, bitmask) {
  6948. arrayEach(wrapFlags, function(pair) {
  6949. var value = '_.' + pair[0];
  6950. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  6951. details.push(value);
  6952. }
  6953. });
  6954. return details.sort();
  6955. }
  6956. /**
  6957. * Creates a clone of `wrapper`.
  6958. *
  6959. * @private
  6960. * @param {Object} wrapper The wrapper to clone.
  6961. * @returns {Object} Returns the cloned wrapper.
  6962. */
  6963. function wrapperClone(wrapper) {
  6964. if (wrapper instanceof LazyWrapper) {
  6965. return wrapper.clone();
  6966. }
  6967. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  6968. result.__actions__ = copyArray(wrapper.__actions__);
  6969. result.__index__ = wrapper.__index__;
  6970. result.__values__ = wrapper.__values__;
  6971. return result;
  6972. }
  6973. /*------------------------------------------------------------------------*/
  6974. /**
  6975. * Creates an array of elements split into groups the length of `size`.
  6976. * If `array` can't be split evenly, the final chunk will be the remaining
  6977. * elements.
  6978. *
  6979. * @static
  6980. * @memberOf _
  6981. * @since 3.0.0
  6982. * @category Array
  6983. * @param {Array} array The array to process.
  6984. * @param {number} [size=1] The length of each chunk
  6985. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  6986. * @returns {Array} Returns the new array of chunks.
  6987. * @example
  6988. *
  6989. * _.chunk(['a', 'b', 'c', 'd'], 2);
  6990. * // => [['a', 'b'], ['c', 'd']]
  6991. *
  6992. * _.chunk(['a', 'b', 'c', 'd'], 3);
  6993. * // => [['a', 'b', 'c'], ['d']]
  6994. */
  6995. function chunk(array, size, guard) {
  6996. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  6997. size = 1;
  6998. } else {
  6999. size = nativeMax(toInteger(size), 0);
  7000. }
  7001. var length = array == null ? 0 : array.length;
  7002. if (!length || size < 1) {
  7003. return [];
  7004. }
  7005. var index = 0,
  7006. resIndex = 0,
  7007. result = Array(nativeCeil(length / size));
  7008. while (index < length) {
  7009. result[resIndex++] = baseSlice(array, index, (index += size));
  7010. }
  7011. return result;
  7012. }
  7013. /**
  7014. * Creates an array with all falsey values removed. The values `false`, `null`,
  7015. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7016. *
  7017. * @static
  7018. * @memberOf _
  7019. * @since 0.1.0
  7020. * @category Array
  7021. * @param {Array} array The array to compact.
  7022. * @returns {Array} Returns the new array of filtered values.
  7023. * @example
  7024. *
  7025. * _.compact([0, 1, false, 2, '', 3]);
  7026. * // => [1, 2, 3]
  7027. */
  7028. function compact(array) {
  7029. var index = -1,
  7030. length = array == null ? 0 : array.length,
  7031. resIndex = 0,
  7032. result = [];
  7033. while (++index < length) {
  7034. var value = array[index];
  7035. if (value) {
  7036. result[resIndex++] = value;
  7037. }
  7038. }
  7039. return result;
  7040. }
  7041. /**
  7042. * Creates a new array concatenating `array` with any additional arrays
  7043. * and/or values.
  7044. *
  7045. * @static
  7046. * @memberOf _
  7047. * @since 4.0.0
  7048. * @category Array
  7049. * @param {Array} array The array to concatenate.
  7050. * @param {...*} [values] The values to concatenate.
  7051. * @returns {Array} Returns the new concatenated array.
  7052. * @example
  7053. *
  7054. * var array = [1];
  7055. * var other = _.concat(array, 2, [3], [[4]]);
  7056. *
  7057. * console.log(other);
  7058. * // => [1, 2, 3, [4]]
  7059. *
  7060. * console.log(array);
  7061. * // => [1]
  7062. */
  7063. function concat() {
  7064. var length = arguments.length;
  7065. if (!length) {
  7066. return [];
  7067. }
  7068. var args = Array(length - 1),
  7069. array = arguments[0],
  7070. index = length;
  7071. while (index--) {
  7072. args[index - 1] = arguments[index];
  7073. }
  7074. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  7075. }
  7076. /**
  7077. * Creates an array of `array` values not included in the other given arrays
  7078. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7079. * for equality comparisons. The order and references of result values are
  7080. * determined by the first array.
  7081. *
  7082. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  7083. *
  7084. * @static
  7085. * @memberOf _
  7086. * @since 0.1.0
  7087. * @category Array
  7088. * @param {Array} array The array to inspect.
  7089. * @param {...Array} [values] The values to exclude.
  7090. * @returns {Array} Returns the new array of filtered values.
  7091. * @see _.without, _.xor
  7092. * @example
  7093. *
  7094. * _.difference([2, 1], [2, 3]);
  7095. * // => [1]
  7096. */
  7097. var difference = baseRest(function(array, values) {
  7098. return isArrayLikeObject(array)
  7099. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  7100. : [];
  7101. });
  7102. /**
  7103. * This method is like `_.difference` except that it accepts `iteratee` which
  7104. * is invoked for each element of `array` and `values` to generate the criterion
  7105. * by which they're compared. The order and references of result values are
  7106. * determined by the first array. The iteratee is invoked with one argument:
  7107. * (value).
  7108. *
  7109. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  7110. *
  7111. * @static
  7112. * @memberOf _
  7113. * @since 4.0.0
  7114. * @category Array
  7115. * @param {Array} array The array to inspect.
  7116. * @param {...Array} [values] The values to exclude.
  7117. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7118. * @returns {Array} Returns the new array of filtered values.
  7119. * @example
  7120. *
  7121. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7122. * // => [1.2]
  7123. *
  7124. * // The `_.property` iteratee shorthand.
  7125. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  7126. * // => [{ 'x': 2 }]
  7127. */
  7128. var differenceBy = baseRest(function(array, values) {
  7129. var iteratee = last(values);
  7130. if (isArrayLikeObject(iteratee)) {
  7131. iteratee = undefined;
  7132. }
  7133. return isArrayLikeObject(array)
  7134. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  7135. : [];
  7136. });
  7137. /**
  7138. * This method is like `_.difference` except that it accepts `comparator`
  7139. * which is invoked to compare elements of `array` to `values`. The order and
  7140. * references of result values are determined by the first array. The comparator
  7141. * is invoked with two arguments: (arrVal, othVal).
  7142. *
  7143. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  7144. *
  7145. * @static
  7146. * @memberOf _
  7147. * @since 4.0.0
  7148. * @category Array
  7149. * @param {Array} array The array to inspect.
  7150. * @param {...Array} [values] The values to exclude.
  7151. * @param {Function} [comparator] The comparator invoked per element.
  7152. * @returns {Array} Returns the new array of filtered values.
  7153. * @example
  7154. *
  7155. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7156. *
  7157. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  7158. * // => [{ 'x': 2, 'y': 1 }]
  7159. */
  7160. var differenceWith = baseRest(function(array, values) {
  7161. var comparator = last(values);
  7162. if (isArrayLikeObject(comparator)) {
  7163. comparator = undefined;
  7164. }
  7165. return isArrayLikeObject(array)
  7166. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  7167. : [];
  7168. });
  7169. /**
  7170. * Creates a slice of `array` with `n` elements dropped from the beginning.
  7171. *
  7172. * @static
  7173. * @memberOf _
  7174. * @since 0.5.0
  7175. * @category Array
  7176. * @param {Array} array The array to query.
  7177. * @param {number} [n=1] The number of elements to drop.
  7178. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7179. * @returns {Array} Returns the slice of `array`.
  7180. * @example
  7181. *
  7182. * _.drop([1, 2, 3]);
  7183. * // => [2, 3]
  7184. *
  7185. * _.drop([1, 2, 3], 2);
  7186. * // => [3]
  7187. *
  7188. * _.drop([1, 2, 3], 5);
  7189. * // => []
  7190. *
  7191. * _.drop([1, 2, 3], 0);
  7192. * // => [1, 2, 3]
  7193. */
  7194. function drop(array, n, guard) {
  7195. var length = array == null ? 0 : array.length;
  7196. if (!length) {
  7197. return [];
  7198. }
  7199. n = (guard || n === undefined) ? 1 : toInteger(n);
  7200. return baseSlice(array, n < 0 ? 0 : n, length);
  7201. }
  7202. /**
  7203. * Creates a slice of `array` with `n` elements dropped from the end.
  7204. *
  7205. * @static
  7206. * @memberOf _
  7207. * @since 3.0.0
  7208. * @category Array
  7209. * @param {Array} array The array to query.
  7210. * @param {number} [n=1] The number of elements to drop.
  7211. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7212. * @returns {Array} Returns the slice of `array`.
  7213. * @example
  7214. *
  7215. * _.dropRight([1, 2, 3]);
  7216. * // => [1, 2]
  7217. *
  7218. * _.dropRight([1, 2, 3], 2);
  7219. * // => [1]
  7220. *
  7221. * _.dropRight([1, 2, 3], 5);
  7222. * // => []
  7223. *
  7224. * _.dropRight([1, 2, 3], 0);
  7225. * // => [1, 2, 3]
  7226. */
  7227. function dropRight(array, n, guard) {
  7228. var length = array == null ? 0 : array.length;
  7229. if (!length) {
  7230. return [];
  7231. }
  7232. n = (guard || n === undefined) ? 1 : toInteger(n);
  7233. n = length - n;
  7234. return baseSlice(array, 0, n < 0 ? 0 : n);
  7235. }
  7236. /**
  7237. * Creates a slice of `array` excluding elements dropped from the end.
  7238. * Elements are dropped until `predicate` returns falsey. The predicate is
  7239. * invoked with three arguments: (value, index, array).
  7240. *
  7241. * @static
  7242. * @memberOf _
  7243. * @since 3.0.0
  7244. * @category Array
  7245. * @param {Array} array The array to query.
  7246. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7247. * @returns {Array} Returns the slice of `array`.
  7248. * @example
  7249. *
  7250. * var users = [
  7251. * { 'user': 'barney', 'active': true },
  7252. * { 'user': 'fred', 'active': false },
  7253. * { 'user': 'pebbles', 'active': false }
  7254. * ];
  7255. *
  7256. * _.dropRightWhile(users, function(o) { return !o.active; });
  7257. * // => objects for ['barney']
  7258. *
  7259. * // The `_.matches` iteratee shorthand.
  7260. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  7261. * // => objects for ['barney', 'fred']
  7262. *
  7263. * // The `_.matchesProperty` iteratee shorthand.
  7264. * _.dropRightWhile(users, ['active', false]);
  7265. * // => objects for ['barney']
  7266. *
  7267. * // The `_.property` iteratee shorthand.
  7268. * _.dropRightWhile(users, 'active');
  7269. * // => objects for ['barney', 'fred', 'pebbles']
  7270. */
  7271. function dropRightWhile(array, predicate) {
  7272. return (array && array.length)
  7273. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  7274. : [];
  7275. }
  7276. /**
  7277. * Creates a slice of `array` excluding elements dropped from the beginning.
  7278. * Elements are dropped until `predicate` returns falsey. The predicate is
  7279. * invoked with three arguments: (value, index, array).
  7280. *
  7281. * @static
  7282. * @memberOf _
  7283. * @since 3.0.0
  7284. * @category Array
  7285. * @param {Array} array The array to query.
  7286. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7287. * @returns {Array} Returns the slice of `array`.
  7288. * @example
  7289. *
  7290. * var users = [
  7291. * { 'user': 'barney', 'active': false },
  7292. * { 'user': 'fred', 'active': false },
  7293. * { 'user': 'pebbles', 'active': true }
  7294. * ];
  7295. *
  7296. * _.dropWhile(users, function(o) { return !o.active; });
  7297. * // => objects for ['pebbles']
  7298. *
  7299. * // The `_.matches` iteratee shorthand.
  7300. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  7301. * // => objects for ['fred', 'pebbles']
  7302. *
  7303. * // The `_.matchesProperty` iteratee shorthand.
  7304. * _.dropWhile(users, ['active', false]);
  7305. * // => objects for ['pebbles']
  7306. *
  7307. * // The `_.property` iteratee shorthand.
  7308. * _.dropWhile(users, 'active');
  7309. * // => objects for ['barney', 'fred', 'pebbles']
  7310. */
  7311. function dropWhile(array, predicate) {
  7312. return (array && array.length)
  7313. ? baseWhile(array, getIteratee(predicate, 3), true)
  7314. : [];
  7315. }
  7316. /**
  7317. * Fills elements of `array` with `value` from `start` up to, but not
  7318. * including, `end`.
  7319. *
  7320. * **Note:** This method mutates `array`.
  7321. *
  7322. * @static
  7323. * @memberOf _
  7324. * @since 3.2.0
  7325. * @category Array
  7326. * @param {Array} array The array to fill.
  7327. * @param {*} value The value to fill `array` with.
  7328. * @param {number} [start=0] The start position.
  7329. * @param {number} [end=array.length] The end position.
  7330. * @returns {Array} Returns `array`.
  7331. * @example
  7332. *
  7333. * var array = [1, 2, 3];
  7334. *
  7335. * _.fill(array, 'a');
  7336. * console.log(array);
  7337. * // => ['a', 'a', 'a']
  7338. *
  7339. * _.fill(Array(3), 2);
  7340. * // => [2, 2, 2]
  7341. *
  7342. * _.fill([4, 6, 8, 10], '*', 1, 3);
  7343. * // => [4, '*', '*', 10]
  7344. */
  7345. function fill(array, value, start, end) {
  7346. var length = array == null ? 0 : array.length;
  7347. if (!length) {
  7348. return [];
  7349. }
  7350. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  7351. start = 0;
  7352. end = length;
  7353. }
  7354. return baseFill(array, value, start, end);
  7355. }
  7356. /**
  7357. * This method is like `_.find` except that it returns the index of the first
  7358. * element `predicate` returns truthy for instead of the element itself.
  7359. *
  7360. * @static
  7361. * @memberOf _
  7362. * @since 1.1.0
  7363. * @category Array
  7364. * @param {Array} array The array to inspect.
  7365. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7366. * @param {number} [fromIndex=0] The index to search from.
  7367. * @returns {number} Returns the index of the found element, else `-1`.
  7368. * @example
  7369. *
  7370. * var users = [
  7371. * { 'user': 'barney', 'active': false },
  7372. * { 'user': 'fred', 'active': false },
  7373. * { 'user': 'pebbles', 'active': true }
  7374. * ];
  7375. *
  7376. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  7377. * // => 0
  7378. *
  7379. * // The `_.matches` iteratee shorthand.
  7380. * _.findIndex(users, { 'user': 'fred', 'active': false });
  7381. * // => 1
  7382. *
  7383. * // The `_.matchesProperty` iteratee shorthand.
  7384. * _.findIndex(users, ['active', false]);
  7385. * // => 0
  7386. *
  7387. * // The `_.property` iteratee shorthand.
  7388. * _.findIndex(users, 'active');
  7389. * // => 2
  7390. */
  7391. function findIndex(array, predicate, fromIndex) {
  7392. var length = array == null ? 0 : array.length;
  7393. if (!length) {
  7394. return -1;
  7395. }
  7396. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7397. if (index < 0) {
  7398. index = nativeMax(length + index, 0);
  7399. }
  7400. return baseFindIndex(array, getIteratee(predicate, 3), index);
  7401. }
  7402. /**
  7403. * This method is like `_.findIndex` except that it iterates over elements
  7404. * of `collection` from right to left.
  7405. *
  7406. * @static
  7407. * @memberOf _
  7408. * @since 2.0.0
  7409. * @category Array
  7410. * @param {Array} array The array to inspect.
  7411. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7412. * @param {number} [fromIndex=array.length-1] The index to search from.
  7413. * @returns {number} Returns the index of the found element, else `-1`.
  7414. * @example
  7415. *
  7416. * var users = [
  7417. * { 'user': 'barney', 'active': true },
  7418. * { 'user': 'fred', 'active': false },
  7419. * { 'user': 'pebbles', 'active': false }
  7420. * ];
  7421. *
  7422. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  7423. * // => 2
  7424. *
  7425. * // The `_.matches` iteratee shorthand.
  7426. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  7427. * // => 0
  7428. *
  7429. * // The `_.matchesProperty` iteratee shorthand.
  7430. * _.findLastIndex(users, ['active', false]);
  7431. * // => 2
  7432. *
  7433. * // The `_.property` iteratee shorthand.
  7434. * _.findLastIndex(users, 'active');
  7435. * // => 0
  7436. */
  7437. function findLastIndex(array, predicate, fromIndex) {
  7438. var length = array == null ? 0 : array.length;
  7439. if (!length) {
  7440. return -1;
  7441. }
  7442. var index = length - 1;
  7443. if (fromIndex !== undefined) {
  7444. index = toInteger(fromIndex);
  7445. index = fromIndex < 0
  7446. ? nativeMax(length + index, 0)
  7447. : nativeMin(index, length - 1);
  7448. }
  7449. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  7450. }
  7451. /**
  7452. * Flattens `array` a single level deep.
  7453. *
  7454. * @static
  7455. * @memberOf _
  7456. * @since 0.1.0
  7457. * @category Array
  7458. * @param {Array} array The array to flatten.
  7459. * @returns {Array} Returns the new flattened array.
  7460. * @example
  7461. *
  7462. * _.flatten([1, [2, [3, [4]], 5]]);
  7463. * // => [1, 2, [3, [4]], 5]
  7464. */
  7465. function flatten(array) {
  7466. var length = array == null ? 0 : array.length;
  7467. return length ? baseFlatten(array, 1) : [];
  7468. }
  7469. /**
  7470. * Recursively flattens `array`.
  7471. *
  7472. * @static
  7473. * @memberOf _
  7474. * @since 3.0.0
  7475. * @category Array
  7476. * @param {Array} array The array to flatten.
  7477. * @returns {Array} Returns the new flattened array.
  7478. * @example
  7479. *
  7480. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  7481. * // => [1, 2, 3, 4, 5]
  7482. */
  7483. function flattenDeep(array) {
  7484. var length = array == null ? 0 : array.length;
  7485. return length ? baseFlatten(array, INFINITY) : [];
  7486. }
  7487. /**
  7488. * Recursively flatten `array` up to `depth` times.
  7489. *
  7490. * @static
  7491. * @memberOf _
  7492. * @since 4.4.0
  7493. * @category Array
  7494. * @param {Array} array The array to flatten.
  7495. * @param {number} [depth=1] The maximum recursion depth.
  7496. * @returns {Array} Returns the new flattened array.
  7497. * @example
  7498. *
  7499. * var array = [1, [2, [3, [4]], 5]];
  7500. *
  7501. * _.flattenDepth(array, 1);
  7502. * // => [1, 2, [3, [4]], 5]
  7503. *
  7504. * _.flattenDepth(array, 2);
  7505. * // => [1, 2, 3, [4], 5]
  7506. */
  7507. function flattenDepth(array, depth) {
  7508. var length = array == null ? 0 : array.length;
  7509. if (!length) {
  7510. return [];
  7511. }
  7512. depth = depth === undefined ? 1 : toInteger(depth);
  7513. return baseFlatten(array, depth);
  7514. }
  7515. /**
  7516. * The inverse of `_.toPairs`; this method returns an object composed
  7517. * from key-value `pairs`.
  7518. *
  7519. * @static
  7520. * @memberOf _
  7521. * @since 4.0.0
  7522. * @category Array
  7523. * @param {Array} pairs The key-value pairs.
  7524. * @returns {Object} Returns the new object.
  7525. * @example
  7526. *
  7527. * _.fromPairs([['a', 1], ['b', 2]]);
  7528. * // => { 'a': 1, 'b': 2 }
  7529. */
  7530. function fromPairs(pairs) {
  7531. var index = -1,
  7532. length = pairs == null ? 0 : pairs.length,
  7533. result = {};
  7534. while (++index < length) {
  7535. var pair = pairs[index];
  7536. result[pair[0]] = pair[1];
  7537. }
  7538. return result;
  7539. }
  7540. /**
  7541. * Gets the first element of `array`.
  7542. *
  7543. * @static
  7544. * @memberOf _
  7545. * @since 0.1.0
  7546. * @alias first
  7547. * @category Array
  7548. * @param {Array} array The array to query.
  7549. * @returns {*} Returns the first element of `array`.
  7550. * @example
  7551. *
  7552. * _.head([1, 2, 3]);
  7553. * // => 1
  7554. *
  7555. * _.head([]);
  7556. * // => undefined
  7557. */
  7558. function head(array) {
  7559. return (array && array.length) ? array[0] : undefined;
  7560. }
  7561. /**
  7562. * Gets the index at which the first occurrence of `value` is found in `array`
  7563. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7564. * for equality comparisons. If `fromIndex` is negative, it's used as the
  7565. * offset from the end of `array`.
  7566. *
  7567. * @static
  7568. * @memberOf _
  7569. * @since 0.1.0
  7570. * @category Array
  7571. * @param {Array} array The array to inspect.
  7572. * @param {*} value The value to search for.
  7573. * @param {number} [fromIndex=0] The index to search from.
  7574. * @returns {number} Returns the index of the matched value, else `-1`.
  7575. * @example
  7576. *
  7577. * _.indexOf([1, 2, 1, 2], 2);
  7578. * // => 1
  7579. *
  7580. * // Search from the `fromIndex`.
  7581. * _.indexOf([1, 2, 1, 2], 2, 2);
  7582. * // => 3
  7583. */
  7584. function indexOf(array, value, fromIndex) {
  7585. var length = array == null ? 0 : array.length;
  7586. if (!length) {
  7587. return -1;
  7588. }
  7589. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7590. if (index < 0) {
  7591. index = nativeMax(length + index, 0);
  7592. }
  7593. return baseIndexOf(array, value, index);
  7594. }
  7595. /**
  7596. * Gets all but the last element of `array`.
  7597. *
  7598. * @static
  7599. * @memberOf _
  7600. * @since 0.1.0
  7601. * @category Array
  7602. * @param {Array} array The array to query.
  7603. * @returns {Array} Returns the slice of `array`.
  7604. * @example
  7605. *
  7606. * _.initial([1, 2, 3]);
  7607. * // => [1, 2]
  7608. */
  7609. function initial(array) {
  7610. var length = array == null ? 0 : array.length;
  7611. return length ? baseSlice(array, 0, -1) : [];
  7612. }
  7613. /**
  7614. * Creates an array of unique values that are included in all given arrays
  7615. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7616. * for equality comparisons. The order and references of result values are
  7617. * determined by the first array.
  7618. *
  7619. * @static
  7620. * @memberOf _
  7621. * @since 0.1.0
  7622. * @category Array
  7623. * @param {...Array} [arrays] The arrays to inspect.
  7624. * @returns {Array} Returns the new array of intersecting values.
  7625. * @example
  7626. *
  7627. * _.intersection([2, 1], [2, 3]);
  7628. * // => [2]
  7629. */
  7630. var intersection = baseRest(function(arrays) {
  7631. var mapped = arrayMap(arrays, castArrayLikeObject);
  7632. return (mapped.length && mapped[0] === arrays[0])
  7633. ? baseIntersection(mapped)
  7634. : [];
  7635. });
  7636. /**
  7637. * This method is like `_.intersection` except that it accepts `iteratee`
  7638. * which is invoked for each element of each `arrays` to generate the criterion
  7639. * by which they're compared. The order and references of result values are
  7640. * determined by the first array. The iteratee is invoked with one argument:
  7641. * (value).
  7642. *
  7643. * @static
  7644. * @memberOf _
  7645. * @since 4.0.0
  7646. * @category Array
  7647. * @param {...Array} [arrays] The arrays to inspect.
  7648. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7649. * @returns {Array} Returns the new array of intersecting values.
  7650. * @example
  7651. *
  7652. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7653. * // => [2.1]
  7654. *
  7655. * // The `_.property` iteratee shorthand.
  7656. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  7657. * // => [{ 'x': 1 }]
  7658. */
  7659. var intersectionBy = baseRest(function(arrays) {
  7660. var iteratee = last(arrays),
  7661. mapped = arrayMap(arrays, castArrayLikeObject);
  7662. if (iteratee === last(mapped)) {
  7663. iteratee = undefined;
  7664. } else {
  7665. mapped.pop();
  7666. }
  7667. return (mapped.length && mapped[0] === arrays[0])
  7668. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  7669. : [];
  7670. });
  7671. /**
  7672. * This method is like `_.intersection` except that it accepts `comparator`
  7673. * which is invoked to compare elements of `arrays`. The order and references
  7674. * of result values are determined by the first array. The comparator is
  7675. * invoked with two arguments: (arrVal, othVal).
  7676. *
  7677. * @static
  7678. * @memberOf _
  7679. * @since 4.0.0
  7680. * @category Array
  7681. * @param {...Array} [arrays] The arrays to inspect.
  7682. * @param {Function} [comparator] The comparator invoked per element.
  7683. * @returns {Array} Returns the new array of intersecting values.
  7684. * @example
  7685. *
  7686. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7687. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  7688. *
  7689. * _.intersectionWith(objects, others, _.isEqual);
  7690. * // => [{ 'x': 1, 'y': 2 }]
  7691. */
  7692. var intersectionWith = baseRest(function(arrays) {
  7693. var comparator = last(arrays),
  7694. mapped = arrayMap(arrays, castArrayLikeObject);
  7695. comparator = typeof comparator == 'function' ? comparator : undefined;
  7696. if (comparator) {
  7697. mapped.pop();
  7698. }
  7699. return (mapped.length && mapped[0] === arrays[0])
  7700. ? baseIntersection(mapped, undefined, comparator)
  7701. : [];
  7702. });
  7703. /**
  7704. * Converts all elements in `array` into a string separated by `separator`.
  7705. *
  7706. * @static
  7707. * @memberOf _
  7708. * @since 4.0.0
  7709. * @category Array
  7710. * @param {Array} array The array to convert.
  7711. * @param {string} [separator=','] The element separator.
  7712. * @returns {string} Returns the joined string.
  7713. * @example
  7714. *
  7715. * _.join(['a', 'b', 'c'], '~');
  7716. * // => 'a~b~c'
  7717. */
  7718. function join(array, separator) {
  7719. return array == null ? '' : nativeJoin.call(array, separator);
  7720. }
  7721. /**
  7722. * Gets the last element of `array`.
  7723. *
  7724. * @static
  7725. * @memberOf _
  7726. * @since 0.1.0
  7727. * @category Array
  7728. * @param {Array} array The array to query.
  7729. * @returns {*} Returns the last element of `array`.
  7730. * @example
  7731. *
  7732. * _.last([1, 2, 3]);
  7733. * // => 3
  7734. */
  7735. function last(array) {
  7736. var length = array == null ? 0 : array.length;
  7737. return length ? array[length - 1] : undefined;
  7738. }
  7739. /**
  7740. * This method is like `_.indexOf` except that it iterates over elements of
  7741. * `array` from right to left.
  7742. *
  7743. * @static
  7744. * @memberOf _
  7745. * @since 0.1.0
  7746. * @category Array
  7747. * @param {Array} array The array to inspect.
  7748. * @param {*} value The value to search for.
  7749. * @param {number} [fromIndex=array.length-1] The index to search from.
  7750. * @returns {number} Returns the index of the matched value, else `-1`.
  7751. * @example
  7752. *
  7753. * _.lastIndexOf([1, 2, 1, 2], 2);
  7754. * // => 3
  7755. *
  7756. * // Search from the `fromIndex`.
  7757. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  7758. * // => 1
  7759. */
  7760. function lastIndexOf(array, value, fromIndex) {
  7761. var length = array == null ? 0 : array.length;
  7762. if (!length) {
  7763. return -1;
  7764. }
  7765. var index = length;
  7766. if (fromIndex !== undefined) {
  7767. index = toInteger(fromIndex);
  7768. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  7769. }
  7770. return value === value
  7771. ? strictLastIndexOf(array, value, index)
  7772. : baseFindIndex(array, baseIsNaN, index, true);
  7773. }
  7774. /**
  7775. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  7776. * element from the end is returned.
  7777. *
  7778. * @static
  7779. * @memberOf _
  7780. * @since 4.11.0
  7781. * @category Array
  7782. * @param {Array} array The array to query.
  7783. * @param {number} [n=0] The index of the element to return.
  7784. * @returns {*} Returns the nth element of `array`.
  7785. * @example
  7786. *
  7787. * var array = ['a', 'b', 'c', 'd'];
  7788. *
  7789. * _.nth(array, 1);
  7790. * // => 'b'
  7791. *
  7792. * _.nth(array, -2);
  7793. * // => 'c';
  7794. */
  7795. function nth(array, n) {
  7796. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  7797. }
  7798. /**
  7799. * Removes all given values from `array` using
  7800. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7801. * for equality comparisons.
  7802. *
  7803. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  7804. * to remove elements from an array by predicate.
  7805. *
  7806. * @static
  7807. * @memberOf _
  7808. * @since 2.0.0
  7809. * @category Array
  7810. * @param {Array} array The array to modify.
  7811. * @param {...*} [values] The values to remove.
  7812. * @returns {Array} Returns `array`.
  7813. * @example
  7814. *
  7815. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  7816. *
  7817. * _.pull(array, 'a', 'c');
  7818. * console.log(array);
  7819. * // => ['b', 'b']
  7820. */
  7821. var pull = baseRest(pullAll);
  7822. /**
  7823. * This method is like `_.pull` except that it accepts an array of values to remove.
  7824. *
  7825. * **Note:** Unlike `_.difference`, this method mutates `array`.
  7826. *
  7827. * @static
  7828. * @memberOf _
  7829. * @since 4.0.0
  7830. * @category Array
  7831. * @param {Array} array The array to modify.
  7832. * @param {Array} values The values to remove.
  7833. * @returns {Array} Returns `array`.
  7834. * @example
  7835. *
  7836. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  7837. *
  7838. * _.pullAll(array, ['a', 'c']);
  7839. * console.log(array);
  7840. * // => ['b', 'b']
  7841. */
  7842. function pullAll(array, values) {
  7843. return (array && array.length && values && values.length)
  7844. ? basePullAll(array, values)
  7845. : array;
  7846. }
  7847. /**
  7848. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  7849. * invoked for each element of `array` and `values` to generate the criterion
  7850. * by which they're compared. The iteratee is invoked with one argument: (value).
  7851. *
  7852. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  7853. *
  7854. * @static
  7855. * @memberOf _
  7856. * @since 4.0.0
  7857. * @category Array
  7858. * @param {Array} array The array to modify.
  7859. * @param {Array} values The values to remove.
  7860. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7861. * @returns {Array} Returns `array`.
  7862. * @example
  7863. *
  7864. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  7865. *
  7866. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  7867. * console.log(array);
  7868. * // => [{ 'x': 2 }]
  7869. */
  7870. function pullAllBy(array, values, iteratee) {
  7871. return (array && array.length && values && values.length)
  7872. ? basePullAll(array, values, getIteratee(iteratee, 2))
  7873. : array;
  7874. }
  7875. /**
  7876. * This method is like `_.pullAll` except that it accepts `comparator` which
  7877. * is invoked to compare elements of `array` to `values`. The comparator is
  7878. * invoked with two arguments: (arrVal, othVal).
  7879. *
  7880. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  7881. *
  7882. * @static
  7883. * @memberOf _
  7884. * @since 4.6.0
  7885. * @category Array
  7886. * @param {Array} array The array to modify.
  7887. * @param {Array} values The values to remove.
  7888. * @param {Function} [comparator] The comparator invoked per element.
  7889. * @returns {Array} Returns `array`.
  7890. * @example
  7891. *
  7892. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  7893. *
  7894. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  7895. * console.log(array);
  7896. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  7897. */
  7898. function pullAllWith(array, values, comparator) {
  7899. return (array && array.length && values && values.length)
  7900. ? basePullAll(array, values, undefined, comparator)
  7901. : array;
  7902. }
  7903. /**
  7904. * Removes elements from `array` corresponding to `indexes` and returns an
  7905. * array of removed elements.
  7906. *
  7907. * **Note:** Unlike `_.at`, this method mutates `array`.
  7908. *
  7909. * @static
  7910. * @memberOf _
  7911. * @since 3.0.0
  7912. * @category Array
  7913. * @param {Array} array The array to modify.
  7914. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  7915. * @returns {Array} Returns the new array of removed elements.
  7916. * @example
  7917. *
  7918. * var array = ['a', 'b', 'c', 'd'];
  7919. * var pulled = _.pullAt(array, [1, 3]);
  7920. *
  7921. * console.log(array);
  7922. * // => ['a', 'c']
  7923. *
  7924. * console.log(pulled);
  7925. * // => ['b', 'd']
  7926. */
  7927. var pullAt = flatRest(function(array, indexes) {
  7928. var length = array == null ? 0 : array.length,
  7929. result = baseAt(array, indexes);
  7930. basePullAt(array, arrayMap(indexes, function(index) {
  7931. return isIndex(index, length) ? +index : index;
  7932. }).sort(compareAscending));
  7933. return result;
  7934. });
  7935. /**
  7936. * Removes all elements from `array` that `predicate` returns truthy for
  7937. * and returns an array of the removed elements. The predicate is invoked
  7938. * with three arguments: (value, index, array).
  7939. *
  7940. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  7941. * to pull elements from an array by value.
  7942. *
  7943. * @static
  7944. * @memberOf _
  7945. * @since 2.0.0
  7946. * @category Array
  7947. * @param {Array} array The array to modify.
  7948. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7949. * @returns {Array} Returns the new array of removed elements.
  7950. * @example
  7951. *
  7952. * var array = [1, 2, 3, 4];
  7953. * var evens = _.remove(array, function(n) {
  7954. * return n % 2 == 0;
  7955. * });
  7956. *
  7957. * console.log(array);
  7958. * // => [1, 3]
  7959. *
  7960. * console.log(evens);
  7961. * // => [2, 4]
  7962. */
  7963. function remove(array, predicate) {
  7964. var result = [];
  7965. if (!(array && array.length)) {
  7966. return result;
  7967. }
  7968. var index = -1,
  7969. indexes = [],
  7970. length = array.length;
  7971. predicate = getIteratee(predicate, 3);
  7972. while (++index < length) {
  7973. var value = array[index];
  7974. if (predicate(value, index, array)) {
  7975. result.push(value);
  7976. indexes.push(index);
  7977. }
  7978. }
  7979. basePullAt(array, indexes);
  7980. return result;
  7981. }
  7982. /**
  7983. * Reverses `array` so that the first element becomes the last, the second
  7984. * element becomes the second to last, and so on.
  7985. *
  7986. * **Note:** This method mutates `array` and is based on
  7987. * [`Array#reverse`](https://mdn.io/Array/reverse).
  7988. *
  7989. * @static
  7990. * @memberOf _
  7991. * @since 4.0.0
  7992. * @category Array
  7993. * @param {Array} array The array to modify.
  7994. * @returns {Array} Returns `array`.
  7995. * @example
  7996. *
  7997. * var array = [1, 2, 3];
  7998. *
  7999. * _.reverse(array);
  8000. * // => [3, 2, 1]
  8001. *
  8002. * console.log(array);
  8003. * // => [3, 2, 1]
  8004. */
  8005. function reverse(array) {
  8006. return array == null ? array : nativeReverse.call(array);
  8007. }
  8008. /**
  8009. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8010. *
  8011. * **Note:** This method is used instead of
  8012. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8013. * returned.
  8014. *
  8015. * @static
  8016. * @memberOf _
  8017. * @since 3.0.0
  8018. * @category Array
  8019. * @param {Array} array The array to slice.
  8020. * @param {number} [start=0] The start position.
  8021. * @param {number} [end=array.length] The end position.
  8022. * @returns {Array} Returns the slice of `array`.
  8023. */
  8024. function slice(array, start, end) {
  8025. var length = array == null ? 0 : array.length;
  8026. if (!length) {
  8027. return [];
  8028. }
  8029. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  8030. start = 0;
  8031. end = length;
  8032. }
  8033. else {
  8034. start = start == null ? 0 : toInteger(start);
  8035. end = end === undefined ? length : toInteger(end);
  8036. }
  8037. return baseSlice(array, start, end);
  8038. }
  8039. /**
  8040. * Uses a binary search to determine the lowest index at which `value`
  8041. * should be inserted into `array` in order to maintain its sort order.
  8042. *
  8043. * @static
  8044. * @memberOf _
  8045. * @since 0.1.0
  8046. * @category Array
  8047. * @param {Array} array The sorted array to inspect.
  8048. * @param {*} value The value to evaluate.
  8049. * @returns {number} Returns the index at which `value` should be inserted
  8050. * into `array`.
  8051. * @example
  8052. *
  8053. * _.sortedIndex([30, 50], 40);
  8054. * // => 1
  8055. */
  8056. function sortedIndex(array, value) {
  8057. return baseSortedIndex(array, value);
  8058. }
  8059. /**
  8060. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  8061. * which is invoked for `value` and each element of `array` to compute their
  8062. * sort ranking. The iteratee is invoked with one argument: (value).
  8063. *
  8064. * @static
  8065. * @memberOf _
  8066. * @since 4.0.0
  8067. * @category Array
  8068. * @param {Array} array The sorted array to inspect.
  8069. * @param {*} value The value to evaluate.
  8070. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8071. * @returns {number} Returns the index at which `value` should be inserted
  8072. * into `array`.
  8073. * @example
  8074. *
  8075. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8076. *
  8077. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8078. * // => 0
  8079. *
  8080. * // The `_.property` iteratee shorthand.
  8081. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  8082. * // => 0
  8083. */
  8084. function sortedIndexBy(array, value, iteratee) {
  8085. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  8086. }
  8087. /**
  8088. * This method is like `_.indexOf` except that it performs a binary
  8089. * search on a sorted `array`.
  8090. *
  8091. * @static
  8092. * @memberOf _
  8093. * @since 4.0.0
  8094. * @category Array
  8095. * @param {Array} array The array to inspect.
  8096. * @param {*} value The value to search for.
  8097. * @returns {number} Returns the index of the matched value, else `-1`.
  8098. * @example
  8099. *
  8100. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  8101. * // => 1
  8102. */
  8103. function sortedIndexOf(array, value) {
  8104. var length = array == null ? 0 : array.length;
  8105. if (length) {
  8106. var index = baseSortedIndex(array, value);
  8107. if (index < length && eq(array[index], value)) {
  8108. return index;
  8109. }
  8110. }
  8111. return -1;
  8112. }
  8113. /**
  8114. * This method is like `_.sortedIndex` except that it returns the highest
  8115. * index at which `value` should be inserted into `array` in order to
  8116. * maintain its sort order.
  8117. *
  8118. * @static
  8119. * @memberOf _
  8120. * @since 3.0.0
  8121. * @category Array
  8122. * @param {Array} array The sorted array to inspect.
  8123. * @param {*} value The value to evaluate.
  8124. * @returns {number} Returns the index at which `value` should be inserted
  8125. * into `array`.
  8126. * @example
  8127. *
  8128. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  8129. * // => 4
  8130. */
  8131. function sortedLastIndex(array, value) {
  8132. return baseSortedIndex(array, value, true);
  8133. }
  8134. /**
  8135. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  8136. * which is invoked for `value` and each element of `array` to compute their
  8137. * sort ranking. The iteratee is invoked with one argument: (value).
  8138. *
  8139. * @static
  8140. * @memberOf _
  8141. * @since 4.0.0
  8142. * @category Array
  8143. * @param {Array} array The sorted array to inspect.
  8144. * @param {*} value The value to evaluate.
  8145. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8146. * @returns {number} Returns the index at which `value` should be inserted
  8147. * into `array`.
  8148. * @example
  8149. *
  8150. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8151. *
  8152. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8153. * // => 1
  8154. *
  8155. * // The `_.property` iteratee shorthand.
  8156. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  8157. * // => 1
  8158. */
  8159. function sortedLastIndexBy(array, value, iteratee) {
  8160. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  8161. }
  8162. /**
  8163. * This method is like `_.lastIndexOf` except that it performs a binary
  8164. * search on a sorted `array`.
  8165. *
  8166. * @static
  8167. * @memberOf _
  8168. * @since 4.0.0
  8169. * @category Array
  8170. * @param {Array} array The array to inspect.
  8171. * @param {*} value The value to search for.
  8172. * @returns {number} Returns the index of the matched value, else `-1`.
  8173. * @example
  8174. *
  8175. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  8176. * // => 3
  8177. */
  8178. function sortedLastIndexOf(array, value) {
  8179. var length = array == null ? 0 : array.length;
  8180. if (length) {
  8181. var index = baseSortedIndex(array, value, true) - 1;
  8182. if (eq(array[index], value)) {
  8183. return index;
  8184. }
  8185. }
  8186. return -1;
  8187. }
  8188. /**
  8189. * This method is like `_.uniq` except that it's designed and optimized
  8190. * for sorted arrays.
  8191. *
  8192. * @static
  8193. * @memberOf _
  8194. * @since 4.0.0
  8195. * @category Array
  8196. * @param {Array} array The array to inspect.
  8197. * @returns {Array} Returns the new duplicate free array.
  8198. * @example
  8199. *
  8200. * _.sortedUniq([1, 1, 2]);
  8201. * // => [1, 2]
  8202. */
  8203. function sortedUniq(array) {
  8204. return (array && array.length)
  8205. ? baseSortedUniq(array)
  8206. : [];
  8207. }
  8208. /**
  8209. * This method is like `_.uniqBy` except that it's designed and optimized
  8210. * for sorted arrays.
  8211. *
  8212. * @static
  8213. * @memberOf _
  8214. * @since 4.0.0
  8215. * @category Array
  8216. * @param {Array} array The array to inspect.
  8217. * @param {Function} [iteratee] The iteratee invoked per element.
  8218. * @returns {Array} Returns the new duplicate free array.
  8219. * @example
  8220. *
  8221. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  8222. * // => [1.1, 2.3]
  8223. */
  8224. function sortedUniqBy(array, iteratee) {
  8225. return (array && array.length)
  8226. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  8227. : [];
  8228. }
  8229. /**
  8230. * Gets all but the first element of `array`.
  8231. *
  8232. * @static
  8233. * @memberOf _
  8234. * @since 4.0.0
  8235. * @category Array
  8236. * @param {Array} array The array to query.
  8237. * @returns {Array} Returns the slice of `array`.
  8238. * @example
  8239. *
  8240. * _.tail([1, 2, 3]);
  8241. * // => [2, 3]
  8242. */
  8243. function tail(array) {
  8244. var length = array == null ? 0 : array.length;
  8245. return length ? baseSlice(array, 1, length) : [];
  8246. }
  8247. /**
  8248. * Creates a slice of `array` with `n` elements taken from the beginning.
  8249. *
  8250. * @static
  8251. * @memberOf _
  8252. * @since 0.1.0
  8253. * @category Array
  8254. * @param {Array} array The array to query.
  8255. * @param {number} [n=1] The number of elements to take.
  8256. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8257. * @returns {Array} Returns the slice of `array`.
  8258. * @example
  8259. *
  8260. * _.take([1, 2, 3]);
  8261. * // => [1]
  8262. *
  8263. * _.take([1, 2, 3], 2);
  8264. * // => [1, 2]
  8265. *
  8266. * _.take([1, 2, 3], 5);
  8267. * // => [1, 2, 3]
  8268. *
  8269. * _.take([1, 2, 3], 0);
  8270. * // => []
  8271. */
  8272. function take(array, n, guard) {
  8273. if (!(array && array.length)) {
  8274. return [];
  8275. }
  8276. n = (guard || n === undefined) ? 1 : toInteger(n);
  8277. return baseSlice(array, 0, n < 0 ? 0 : n);
  8278. }
  8279. /**
  8280. * Creates a slice of `array` with `n` elements taken from the end.
  8281. *
  8282. * @static
  8283. * @memberOf _
  8284. * @since 3.0.0
  8285. * @category Array
  8286. * @param {Array} array The array to query.
  8287. * @param {number} [n=1] The number of elements to take.
  8288. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8289. * @returns {Array} Returns the slice of `array`.
  8290. * @example
  8291. *
  8292. * _.takeRight([1, 2, 3]);
  8293. * // => [3]
  8294. *
  8295. * _.takeRight([1, 2, 3], 2);
  8296. * // => [2, 3]
  8297. *
  8298. * _.takeRight([1, 2, 3], 5);
  8299. * // => [1, 2, 3]
  8300. *
  8301. * _.takeRight([1, 2, 3], 0);
  8302. * // => []
  8303. */
  8304. function takeRight(array, n, guard) {
  8305. var length = array == null ? 0 : array.length;
  8306. if (!length) {
  8307. return [];
  8308. }
  8309. n = (guard || n === undefined) ? 1 : toInteger(n);
  8310. n = length - n;
  8311. return baseSlice(array, n < 0 ? 0 : n, length);
  8312. }
  8313. /**
  8314. * Creates a slice of `array` with elements taken from the end. Elements are
  8315. * taken until `predicate` returns falsey. The predicate is invoked with
  8316. * three arguments: (value, index, array).
  8317. *
  8318. * @static
  8319. * @memberOf _
  8320. * @since 3.0.0
  8321. * @category Array
  8322. * @param {Array} array The array to query.
  8323. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8324. * @returns {Array} Returns the slice of `array`.
  8325. * @example
  8326. *
  8327. * var users = [
  8328. * { 'user': 'barney', 'active': true },
  8329. * { 'user': 'fred', 'active': false },
  8330. * { 'user': 'pebbles', 'active': false }
  8331. * ];
  8332. *
  8333. * _.takeRightWhile(users, function(o) { return !o.active; });
  8334. * // => objects for ['fred', 'pebbles']
  8335. *
  8336. * // The `_.matches` iteratee shorthand.
  8337. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  8338. * // => objects for ['pebbles']
  8339. *
  8340. * // The `_.matchesProperty` iteratee shorthand.
  8341. * _.takeRightWhile(users, ['active', false]);
  8342. * // => objects for ['fred', 'pebbles']
  8343. *
  8344. * // The `_.property` iteratee shorthand.
  8345. * _.takeRightWhile(users, 'active');
  8346. * // => []
  8347. */
  8348. function takeRightWhile(array, predicate) {
  8349. return (array && array.length)
  8350. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  8351. : [];
  8352. }
  8353. /**
  8354. * Creates a slice of `array` with elements taken from the beginning. Elements
  8355. * are taken until `predicate` returns falsey. The predicate is invoked with
  8356. * three arguments: (value, index, array).
  8357. *
  8358. * @static
  8359. * @memberOf _
  8360. * @since 3.0.0
  8361. * @category Array
  8362. * @param {Array} array The array to query.
  8363. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8364. * @returns {Array} Returns the slice of `array`.
  8365. * @example
  8366. *
  8367. * var users = [
  8368. * { 'user': 'barney', 'active': false },
  8369. * { 'user': 'fred', 'active': false },
  8370. * { 'user': 'pebbles', 'active': true }
  8371. * ];
  8372. *
  8373. * _.takeWhile(users, function(o) { return !o.active; });
  8374. * // => objects for ['barney', 'fred']
  8375. *
  8376. * // The `_.matches` iteratee shorthand.
  8377. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  8378. * // => objects for ['barney']
  8379. *
  8380. * // The `_.matchesProperty` iteratee shorthand.
  8381. * _.takeWhile(users, ['active', false]);
  8382. * // => objects for ['barney', 'fred']
  8383. *
  8384. * // The `_.property` iteratee shorthand.
  8385. * _.takeWhile(users, 'active');
  8386. * // => []
  8387. */
  8388. function takeWhile(array, predicate) {
  8389. return (array && array.length)
  8390. ? baseWhile(array, getIteratee(predicate, 3))
  8391. : [];
  8392. }
  8393. /**
  8394. * Creates an array of unique values, in order, from all given arrays using
  8395. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8396. * for equality comparisons.
  8397. *
  8398. * @static
  8399. * @memberOf _
  8400. * @since 0.1.0
  8401. * @category Array
  8402. * @param {...Array} [arrays] The arrays to inspect.
  8403. * @returns {Array} Returns the new array of combined values.
  8404. * @example
  8405. *
  8406. * _.union([2], [1, 2]);
  8407. * // => [2, 1]
  8408. */
  8409. var union = baseRest(function(arrays) {
  8410. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  8411. });
  8412. /**
  8413. * This method is like `_.union` except that it accepts `iteratee` which is
  8414. * invoked for each element of each `arrays` to generate the criterion by
  8415. * which uniqueness is computed. Result values are chosen from the first
  8416. * array in which the value occurs. The iteratee is invoked with one argument:
  8417. * (value).
  8418. *
  8419. * @static
  8420. * @memberOf _
  8421. * @since 4.0.0
  8422. * @category Array
  8423. * @param {...Array} [arrays] The arrays to inspect.
  8424. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8425. * @returns {Array} Returns the new array of combined values.
  8426. * @example
  8427. *
  8428. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  8429. * // => [2.1, 1.2]
  8430. *
  8431. * // The `_.property` iteratee shorthand.
  8432. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8433. * // => [{ 'x': 1 }, { 'x': 2 }]
  8434. */
  8435. var unionBy = baseRest(function(arrays) {
  8436. var iteratee = last(arrays);
  8437. if (isArrayLikeObject(iteratee)) {
  8438. iteratee = undefined;
  8439. }
  8440. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  8441. });
  8442. /**
  8443. * This method is like `_.union` except that it accepts `comparator` which
  8444. * is invoked to compare elements of `arrays`. Result values are chosen from
  8445. * the first array in which the value occurs. The comparator is invoked
  8446. * with two arguments: (arrVal, othVal).
  8447. *
  8448. * @static
  8449. * @memberOf _
  8450. * @since 4.0.0
  8451. * @category Array
  8452. * @param {...Array} [arrays] The arrays to inspect.
  8453. * @param {Function} [comparator] The comparator invoked per element.
  8454. * @returns {Array} Returns the new array of combined values.
  8455. * @example
  8456. *
  8457. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8458. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8459. *
  8460. * _.unionWith(objects, others, _.isEqual);
  8461. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8462. */
  8463. var unionWith = baseRest(function(arrays) {
  8464. var comparator = last(arrays);
  8465. comparator = typeof comparator == 'function' ? comparator : undefined;
  8466. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  8467. });
  8468. /**
  8469. * Creates a duplicate-free version of an array, using
  8470. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8471. * for equality comparisons, in which only the first occurrence of each element
  8472. * is kept. The order of result values is determined by the order they occur
  8473. * in the array.
  8474. *
  8475. * @static
  8476. * @memberOf _
  8477. * @since 0.1.0
  8478. * @category Array
  8479. * @param {Array} array The array to inspect.
  8480. * @returns {Array} Returns the new duplicate free array.
  8481. * @example
  8482. *
  8483. * _.uniq([2, 1, 2]);
  8484. * // => [2, 1]
  8485. */
  8486. function uniq(array) {
  8487. return (array && array.length) ? baseUniq(array) : [];
  8488. }
  8489. /**
  8490. * This method is like `_.uniq` except that it accepts `iteratee` which is
  8491. * invoked for each element in `array` to generate the criterion by which
  8492. * uniqueness is computed. The order of result values is determined by the
  8493. * order they occur in the array. The iteratee is invoked with one argument:
  8494. * (value).
  8495. *
  8496. * @static
  8497. * @memberOf _
  8498. * @since 4.0.0
  8499. * @category Array
  8500. * @param {Array} array The array to inspect.
  8501. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8502. * @returns {Array} Returns the new duplicate free array.
  8503. * @example
  8504. *
  8505. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  8506. * // => [2.1, 1.2]
  8507. *
  8508. * // The `_.property` iteratee shorthand.
  8509. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  8510. * // => [{ 'x': 1 }, { 'x': 2 }]
  8511. */
  8512. function uniqBy(array, iteratee) {
  8513. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  8514. }
  8515. /**
  8516. * This method is like `_.uniq` except that it accepts `comparator` which
  8517. * is invoked to compare elements of `array`. The order of result values is
  8518. * determined by the order they occur in the array.The comparator is invoked
  8519. * with two arguments: (arrVal, othVal).
  8520. *
  8521. * @static
  8522. * @memberOf _
  8523. * @since 4.0.0
  8524. * @category Array
  8525. * @param {Array} array The array to inspect.
  8526. * @param {Function} [comparator] The comparator invoked per element.
  8527. * @returns {Array} Returns the new duplicate free array.
  8528. * @example
  8529. *
  8530. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8531. *
  8532. * _.uniqWith(objects, _.isEqual);
  8533. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  8534. */
  8535. function uniqWith(array, comparator) {
  8536. comparator = typeof comparator == 'function' ? comparator : undefined;
  8537. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  8538. }
  8539. /**
  8540. * This method is like `_.zip` except that it accepts an array of grouped
  8541. * elements and creates an array regrouping the elements to their pre-zip
  8542. * configuration.
  8543. *
  8544. * @static
  8545. * @memberOf _
  8546. * @since 1.2.0
  8547. * @category Array
  8548. * @param {Array} array The array of grouped elements to process.
  8549. * @returns {Array} Returns the new array of regrouped elements.
  8550. * @example
  8551. *
  8552. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  8553. * // => [['a', 1, true], ['b', 2, false]]
  8554. *
  8555. * _.unzip(zipped);
  8556. * // => [['a', 'b'], [1, 2], [true, false]]
  8557. */
  8558. function unzip(array) {
  8559. if (!(array && array.length)) {
  8560. return [];
  8561. }
  8562. var length = 0;
  8563. array = arrayFilter(array, function(group) {
  8564. if (isArrayLikeObject(group)) {
  8565. length = nativeMax(group.length, length);
  8566. return true;
  8567. }
  8568. });
  8569. return baseTimes(length, function(index) {
  8570. return arrayMap(array, baseProperty(index));
  8571. });
  8572. }
  8573. /**
  8574. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  8575. * how regrouped values should be combined. The iteratee is invoked with the
  8576. * elements of each group: (...group).
  8577. *
  8578. * @static
  8579. * @memberOf _
  8580. * @since 3.8.0
  8581. * @category Array
  8582. * @param {Array} array The array of grouped elements to process.
  8583. * @param {Function} [iteratee=_.identity] The function to combine
  8584. * regrouped values.
  8585. * @returns {Array} Returns the new array of regrouped elements.
  8586. * @example
  8587. *
  8588. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  8589. * // => [[1, 10, 100], [2, 20, 200]]
  8590. *
  8591. * _.unzipWith(zipped, _.add);
  8592. * // => [3, 30, 300]
  8593. */
  8594. function unzipWith(array, iteratee) {
  8595. if (!(array && array.length)) {
  8596. return [];
  8597. }
  8598. var result = unzip(array);
  8599. if (iteratee == null) {
  8600. return result;
  8601. }
  8602. return arrayMap(result, function(group) {
  8603. return apply(iteratee, undefined, group);
  8604. });
  8605. }
  8606. /**
  8607. * Creates an array excluding all given values using
  8608. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8609. * for equality comparisons.
  8610. *
  8611. * **Note:** Unlike `_.pull`, this method returns a new array.
  8612. *
  8613. * @static
  8614. * @memberOf _
  8615. * @since 0.1.0
  8616. * @category Array
  8617. * @param {Array} array The array to inspect.
  8618. * @param {...*} [values] The values to exclude.
  8619. * @returns {Array} Returns the new array of filtered values.
  8620. * @see _.difference, _.xor
  8621. * @example
  8622. *
  8623. * _.without([2, 1, 2, 3], 1, 2);
  8624. * // => [3]
  8625. */
  8626. var without = baseRest(function(array, values) {
  8627. return isArrayLikeObject(array)
  8628. ? baseDifference(array, values)
  8629. : [];
  8630. });
  8631. /**
  8632. * Creates an array of unique values that is the
  8633. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  8634. * of the given arrays. The order of result values is determined by the order
  8635. * they occur in the arrays.
  8636. *
  8637. * @static
  8638. * @memberOf _
  8639. * @since 2.4.0
  8640. * @category Array
  8641. * @param {...Array} [arrays] The arrays to inspect.
  8642. * @returns {Array} Returns the new array of filtered values.
  8643. * @see _.difference, _.without
  8644. * @example
  8645. *
  8646. * _.xor([2, 1], [2, 3]);
  8647. * // => [1, 3]
  8648. */
  8649. var xor = baseRest(function(arrays) {
  8650. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  8651. });
  8652. /**
  8653. * This method is like `_.xor` except that it accepts `iteratee` which is
  8654. * invoked for each element of each `arrays` to generate the criterion by
  8655. * which by which they're compared. The order of result values is determined
  8656. * by the order they occur in the arrays. The iteratee is invoked with one
  8657. * argument: (value).
  8658. *
  8659. * @static
  8660. * @memberOf _
  8661. * @since 4.0.0
  8662. * @category Array
  8663. * @param {...Array} [arrays] The arrays to inspect.
  8664. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8665. * @returns {Array} Returns the new array of filtered values.
  8666. * @example
  8667. *
  8668. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8669. * // => [1.2, 3.4]
  8670. *
  8671. * // The `_.property` iteratee shorthand.
  8672. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8673. * // => [{ 'x': 2 }]
  8674. */
  8675. var xorBy = baseRest(function(arrays) {
  8676. var iteratee = last(arrays);
  8677. if (isArrayLikeObject(iteratee)) {
  8678. iteratee = undefined;
  8679. }
  8680. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  8681. });
  8682. /**
  8683. * This method is like `_.xor` except that it accepts `comparator` which is
  8684. * invoked to compare elements of `arrays`. The order of result values is
  8685. * determined by the order they occur in the arrays. The comparator is invoked
  8686. * with two arguments: (arrVal, othVal).
  8687. *
  8688. * @static
  8689. * @memberOf _
  8690. * @since 4.0.0
  8691. * @category Array
  8692. * @param {...Array} [arrays] The arrays to inspect.
  8693. * @param {Function} [comparator] The comparator invoked per element.
  8694. * @returns {Array} Returns the new array of filtered values.
  8695. * @example
  8696. *
  8697. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8698. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8699. *
  8700. * _.xorWith(objects, others, _.isEqual);
  8701. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8702. */
  8703. var xorWith = baseRest(function(arrays) {
  8704. var comparator = last(arrays);
  8705. comparator = typeof comparator == 'function' ? comparator : undefined;
  8706. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  8707. });
  8708. /**
  8709. * Creates an array of grouped elements, the first of which contains the
  8710. * first elements of the given arrays, the second of which contains the
  8711. * second elements of the given arrays, and so on.
  8712. *
  8713. * @static
  8714. * @memberOf _
  8715. * @since 0.1.0
  8716. * @category Array
  8717. * @param {...Array} [arrays] The arrays to process.
  8718. * @returns {Array} Returns the new array of grouped elements.
  8719. * @example
  8720. *
  8721. * _.zip(['a', 'b'], [1, 2], [true, false]);
  8722. * // => [['a', 1, true], ['b', 2, false]]
  8723. */
  8724. var zip = baseRest(unzip);
  8725. /**
  8726. * This method is like `_.fromPairs` except that it accepts two arrays,
  8727. * one of property identifiers and one of corresponding values.
  8728. *
  8729. * @static
  8730. * @memberOf _
  8731. * @since 0.4.0
  8732. * @category Array
  8733. * @param {Array} [props=[]] The property identifiers.
  8734. * @param {Array} [values=[]] The property values.
  8735. * @returns {Object} Returns the new object.
  8736. * @example
  8737. *
  8738. * _.zipObject(['a', 'b'], [1, 2]);
  8739. * // => { 'a': 1, 'b': 2 }
  8740. */
  8741. function zipObject(props, values) {
  8742. return baseZipObject(props || [], values || [], assignValue);
  8743. }
  8744. /**
  8745. * This method is like `_.zipObject` except that it supports property paths.
  8746. *
  8747. * @static
  8748. * @memberOf _
  8749. * @since 4.1.0
  8750. * @category Array
  8751. * @param {Array} [props=[]] The property identifiers.
  8752. * @param {Array} [values=[]] The property values.
  8753. * @returns {Object} Returns the new object.
  8754. * @example
  8755. *
  8756. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  8757. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  8758. */
  8759. function zipObjectDeep(props, values) {
  8760. return baseZipObject(props || [], values || [], baseSet);
  8761. }
  8762. /**
  8763. * This method is like `_.zip` except that it accepts `iteratee` to specify
  8764. * how grouped values should be combined. The iteratee is invoked with the
  8765. * elements of each group: (...group).
  8766. *
  8767. * @static
  8768. * @memberOf _
  8769. * @since 3.8.0
  8770. * @category Array
  8771. * @param {...Array} [arrays] The arrays to process.
  8772. * @param {Function} [iteratee=_.identity] The function to combine
  8773. * grouped values.
  8774. * @returns {Array} Returns the new array of grouped elements.
  8775. * @example
  8776. *
  8777. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  8778. * return a + b + c;
  8779. * });
  8780. * // => [111, 222]
  8781. */
  8782. var zipWith = baseRest(function(arrays) {
  8783. var length = arrays.length,
  8784. iteratee = length > 1 ? arrays[length - 1] : undefined;
  8785. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  8786. return unzipWith(arrays, iteratee);
  8787. });
  8788. /*------------------------------------------------------------------------*/
  8789. /**
  8790. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  8791. * chain sequences enabled. The result of such sequences must be unwrapped
  8792. * with `_#value`.
  8793. *
  8794. * @static
  8795. * @memberOf _
  8796. * @since 1.3.0
  8797. * @category Seq
  8798. * @param {*} value The value to wrap.
  8799. * @returns {Object} Returns the new `lodash` wrapper instance.
  8800. * @example
  8801. *
  8802. * var users = [
  8803. * { 'user': 'barney', 'age': 36 },
  8804. * { 'user': 'fred', 'age': 40 },
  8805. * { 'user': 'pebbles', 'age': 1 }
  8806. * ];
  8807. *
  8808. * var youngest = _
  8809. * .chain(users)
  8810. * .sortBy('age')
  8811. * .map(function(o) {
  8812. * return o.user + ' is ' + o.age;
  8813. * })
  8814. * .head()
  8815. * .value();
  8816. * // => 'pebbles is 1'
  8817. */
  8818. function chain(value) {
  8819. var result = lodash(value);
  8820. result.__chain__ = true;
  8821. return result;
  8822. }
  8823. /**
  8824. * This method invokes `interceptor` and returns `value`. The interceptor
  8825. * is invoked with one argument; (value). The purpose of this method is to
  8826. * "tap into" a method chain sequence in order to modify intermediate results.
  8827. *
  8828. * @static
  8829. * @memberOf _
  8830. * @since 0.1.0
  8831. * @category Seq
  8832. * @param {*} value The value to provide to `interceptor`.
  8833. * @param {Function} interceptor The function to invoke.
  8834. * @returns {*} Returns `value`.
  8835. * @example
  8836. *
  8837. * _([1, 2, 3])
  8838. * .tap(function(array) {
  8839. * // Mutate input array.
  8840. * array.pop();
  8841. * })
  8842. * .reverse()
  8843. * .value();
  8844. * // => [2, 1]
  8845. */
  8846. function tap(value, interceptor) {
  8847. interceptor(value);
  8848. return value;
  8849. }
  8850. /**
  8851. * This method is like `_.tap` except that it returns the result of `interceptor`.
  8852. * The purpose of this method is to "pass thru" values replacing intermediate
  8853. * results in a method chain sequence.
  8854. *
  8855. * @static
  8856. * @memberOf _
  8857. * @since 3.0.0
  8858. * @category Seq
  8859. * @param {*} value The value to provide to `interceptor`.
  8860. * @param {Function} interceptor The function to invoke.
  8861. * @returns {*} Returns the result of `interceptor`.
  8862. * @example
  8863. *
  8864. * _(' abc ')
  8865. * .chain()
  8866. * .trim()
  8867. * .thru(function(value) {
  8868. * return [value];
  8869. * })
  8870. * .value();
  8871. * // => ['abc']
  8872. */
  8873. function thru(value, interceptor) {
  8874. return interceptor(value);
  8875. }
  8876. /**
  8877. * This method is the wrapper version of `_.at`.
  8878. *
  8879. * @name at
  8880. * @memberOf _
  8881. * @since 1.0.0
  8882. * @category Seq
  8883. * @param {...(string|string[])} [paths] The property paths to pick.
  8884. * @returns {Object} Returns the new `lodash` wrapper instance.
  8885. * @example
  8886. *
  8887. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  8888. *
  8889. * _(object).at(['a[0].b.c', 'a[1]']).value();
  8890. * // => [3, 4]
  8891. */
  8892. var wrapperAt = flatRest(function(paths) {
  8893. var length = paths.length,
  8894. start = length ? paths[0] : 0,
  8895. value = this.__wrapped__,
  8896. interceptor = function(object) { return baseAt(object, paths); };
  8897. if (length > 1 || this.__actions__.length ||
  8898. !(value instanceof LazyWrapper) || !isIndex(start)) {
  8899. return this.thru(interceptor);
  8900. }
  8901. value = value.slice(start, +start + (length ? 1 : 0));
  8902. value.__actions__.push({
  8903. 'func': thru,
  8904. 'args': [interceptor],
  8905. 'thisArg': undefined
  8906. });
  8907. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  8908. if (length && !array.length) {
  8909. array.push(undefined);
  8910. }
  8911. return array;
  8912. });
  8913. });
  8914. /**
  8915. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  8916. *
  8917. * @name chain
  8918. * @memberOf _
  8919. * @since 0.1.0
  8920. * @category Seq
  8921. * @returns {Object} Returns the new `lodash` wrapper instance.
  8922. * @example
  8923. *
  8924. * var users = [
  8925. * { 'user': 'barney', 'age': 36 },
  8926. * { 'user': 'fred', 'age': 40 }
  8927. * ];
  8928. *
  8929. * // A sequence without explicit chaining.
  8930. * _(users).head();
  8931. * // => { 'user': 'barney', 'age': 36 }
  8932. *
  8933. * // A sequence with explicit chaining.
  8934. * _(users)
  8935. * .chain()
  8936. * .head()
  8937. * .pick('user')
  8938. * .value();
  8939. * // => { 'user': 'barney' }
  8940. */
  8941. function wrapperChain() {
  8942. return chain(this);
  8943. }
  8944. /**
  8945. * Executes the chain sequence and returns the wrapped result.
  8946. *
  8947. * @name commit
  8948. * @memberOf _
  8949. * @since 3.2.0
  8950. * @category Seq
  8951. * @returns {Object} Returns the new `lodash` wrapper instance.
  8952. * @example
  8953. *
  8954. * var array = [1, 2];
  8955. * var wrapped = _(array).push(3);
  8956. *
  8957. * console.log(array);
  8958. * // => [1, 2]
  8959. *
  8960. * wrapped = wrapped.commit();
  8961. * console.log(array);
  8962. * // => [1, 2, 3]
  8963. *
  8964. * wrapped.last();
  8965. * // => 3
  8966. *
  8967. * console.log(array);
  8968. * // => [1, 2, 3]
  8969. */
  8970. function wrapperCommit() {
  8971. return new LodashWrapper(this.value(), this.__chain__);
  8972. }
  8973. /**
  8974. * Gets the next value on a wrapped object following the
  8975. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  8976. *
  8977. * @name next
  8978. * @memberOf _
  8979. * @since 4.0.0
  8980. * @category Seq
  8981. * @returns {Object} Returns the next iterator value.
  8982. * @example
  8983. *
  8984. * var wrapped = _([1, 2]);
  8985. *
  8986. * wrapped.next();
  8987. * // => { 'done': false, 'value': 1 }
  8988. *
  8989. * wrapped.next();
  8990. * // => { 'done': false, 'value': 2 }
  8991. *
  8992. * wrapped.next();
  8993. * // => { 'done': true, 'value': undefined }
  8994. */
  8995. function wrapperNext() {
  8996. if (this.__values__ === undefined) {
  8997. this.__values__ = toArray(this.value());
  8998. }
  8999. var done = this.__index__ >= this.__values__.length,
  9000. value = done ? undefined : this.__values__[this.__index__++];
  9001. return { 'done': done, 'value': value };
  9002. }
  9003. /**
  9004. * Enables the wrapper to be iterable.
  9005. *
  9006. * @name Symbol.iterator
  9007. * @memberOf _
  9008. * @since 4.0.0
  9009. * @category Seq
  9010. * @returns {Object} Returns the wrapper object.
  9011. * @example
  9012. *
  9013. * var wrapped = _([1, 2]);
  9014. *
  9015. * wrapped[Symbol.iterator]() === wrapped;
  9016. * // => true
  9017. *
  9018. * Array.from(wrapped);
  9019. * // => [1, 2]
  9020. */
  9021. function wrapperToIterator() {
  9022. return this;
  9023. }
  9024. /**
  9025. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  9026. *
  9027. * @name plant
  9028. * @memberOf _
  9029. * @since 3.2.0
  9030. * @category Seq
  9031. * @param {*} value The value to plant.
  9032. * @returns {Object} Returns the new `lodash` wrapper instance.
  9033. * @example
  9034. *
  9035. * function square(n) {
  9036. * return n * n;
  9037. * }
  9038. *
  9039. * var wrapped = _([1, 2]).map(square);
  9040. * var other = wrapped.plant([3, 4]);
  9041. *
  9042. * other.value();
  9043. * // => [9, 16]
  9044. *
  9045. * wrapped.value();
  9046. * // => [1, 4]
  9047. */
  9048. function wrapperPlant(value) {
  9049. var result,
  9050. parent = this;
  9051. while (parent instanceof baseLodash) {
  9052. var clone = wrapperClone(parent);
  9053. clone.__index__ = 0;
  9054. clone.__values__ = undefined;
  9055. if (result) {
  9056. previous.__wrapped__ = clone;
  9057. } else {
  9058. result = clone;
  9059. }
  9060. var previous = clone;
  9061. parent = parent.__wrapped__;
  9062. }
  9063. previous.__wrapped__ = value;
  9064. return result;
  9065. }
  9066. /**
  9067. * This method is the wrapper version of `_.reverse`.
  9068. *
  9069. * **Note:** This method mutates the wrapped array.
  9070. *
  9071. * @name reverse
  9072. * @memberOf _
  9073. * @since 0.1.0
  9074. * @category Seq
  9075. * @returns {Object} Returns the new `lodash` wrapper instance.
  9076. * @example
  9077. *
  9078. * var array = [1, 2, 3];
  9079. *
  9080. * _(array).reverse().value()
  9081. * // => [3, 2, 1]
  9082. *
  9083. * console.log(array);
  9084. * // => [3, 2, 1]
  9085. */
  9086. function wrapperReverse() {
  9087. var value = this.__wrapped__;
  9088. if (value instanceof LazyWrapper) {
  9089. var wrapped = value;
  9090. if (this.__actions__.length) {
  9091. wrapped = new LazyWrapper(this);
  9092. }
  9093. wrapped = wrapped.reverse();
  9094. wrapped.__actions__.push({
  9095. 'func': thru,
  9096. 'args': [reverse],
  9097. 'thisArg': undefined
  9098. });
  9099. return new LodashWrapper(wrapped, this.__chain__);
  9100. }
  9101. return this.thru(reverse);
  9102. }
  9103. /**
  9104. * Executes the chain sequence to resolve the unwrapped value.
  9105. *
  9106. * @name value
  9107. * @memberOf _
  9108. * @since 0.1.0
  9109. * @alias toJSON, valueOf
  9110. * @category Seq
  9111. * @returns {*} Returns the resolved unwrapped value.
  9112. * @example
  9113. *
  9114. * _([1, 2, 3]).value();
  9115. * // => [1, 2, 3]
  9116. */
  9117. function wrapperValue() {
  9118. return baseWrapperValue(this.__wrapped__, this.__actions__);
  9119. }
  9120. /*------------------------------------------------------------------------*/
  9121. /**
  9122. * Creates an object composed of keys generated from the results of running
  9123. * each element of `collection` thru `iteratee`. The corresponding value of
  9124. * each key is the number of times the key was returned by `iteratee`. The
  9125. * iteratee is invoked with one argument: (value).
  9126. *
  9127. * @static
  9128. * @memberOf _
  9129. * @since 0.5.0
  9130. * @category Collection
  9131. * @param {Array|Object} collection The collection to iterate over.
  9132. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9133. * @returns {Object} Returns the composed aggregate object.
  9134. * @example
  9135. *
  9136. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  9137. * // => { '4': 1, '6': 2 }
  9138. *
  9139. * // The `_.property` iteratee shorthand.
  9140. * _.countBy(['one', 'two', 'three'], 'length');
  9141. * // => { '3': 2, '5': 1 }
  9142. */
  9143. var countBy = createAggregator(function(result, value, key) {
  9144. if (hasOwnProperty.call(result, key)) {
  9145. ++result[key];
  9146. } else {
  9147. baseAssignValue(result, key, 1);
  9148. }
  9149. });
  9150. /**
  9151. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  9152. * Iteration is stopped once `predicate` returns falsey. The predicate is
  9153. * invoked with three arguments: (value, index|key, collection).
  9154. *
  9155. * **Note:** This method returns `true` for
  9156. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  9157. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  9158. * elements of empty collections.
  9159. *
  9160. * @static
  9161. * @memberOf _
  9162. * @since 0.1.0
  9163. * @category Collection
  9164. * @param {Array|Object} collection The collection to iterate over.
  9165. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9166. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9167. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9168. * else `false`.
  9169. * @example
  9170. *
  9171. * _.every([true, 1, null, 'yes'], Boolean);
  9172. * // => false
  9173. *
  9174. * var users = [
  9175. * { 'user': 'barney', 'age': 36, 'active': false },
  9176. * { 'user': 'fred', 'age': 40, 'active': false }
  9177. * ];
  9178. *
  9179. * // The `_.matches` iteratee shorthand.
  9180. * _.every(users, { 'user': 'barney', 'active': false });
  9181. * // => false
  9182. *
  9183. * // The `_.matchesProperty` iteratee shorthand.
  9184. * _.every(users, ['active', false]);
  9185. * // => true
  9186. *
  9187. * // The `_.property` iteratee shorthand.
  9188. * _.every(users, 'active');
  9189. * // => false
  9190. */
  9191. function every(collection, predicate, guard) {
  9192. var func = isArray(collection) ? arrayEvery : baseEvery;
  9193. if (guard && isIterateeCall(collection, predicate, guard)) {
  9194. predicate = undefined;
  9195. }
  9196. return func(collection, getIteratee(predicate, 3));
  9197. }
  9198. /**
  9199. * Iterates over elements of `collection`, returning an array of all elements
  9200. * `predicate` returns truthy for. The predicate is invoked with three
  9201. * arguments: (value, index|key, collection).
  9202. *
  9203. * **Note:** Unlike `_.remove`, this method returns a new array.
  9204. *
  9205. * @static
  9206. * @memberOf _
  9207. * @since 0.1.0
  9208. * @category Collection
  9209. * @param {Array|Object} collection The collection to iterate over.
  9210. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9211. * @returns {Array} Returns the new filtered array.
  9212. * @see _.reject
  9213. * @example
  9214. *
  9215. * var users = [
  9216. * { 'user': 'barney', 'age': 36, 'active': true },
  9217. * { 'user': 'fred', 'age': 40, 'active': false }
  9218. * ];
  9219. *
  9220. * _.filter(users, function(o) { return !o.active; });
  9221. * // => objects for ['fred']
  9222. *
  9223. * // The `_.matches` iteratee shorthand.
  9224. * _.filter(users, { 'age': 36, 'active': true });
  9225. * // => objects for ['barney']
  9226. *
  9227. * // The `_.matchesProperty` iteratee shorthand.
  9228. * _.filter(users, ['active', false]);
  9229. * // => objects for ['fred']
  9230. *
  9231. * // The `_.property` iteratee shorthand.
  9232. * _.filter(users, 'active');
  9233. * // => objects for ['barney']
  9234. */
  9235. function filter(collection, predicate) {
  9236. var func = isArray(collection) ? arrayFilter : baseFilter;
  9237. return func(collection, getIteratee(predicate, 3));
  9238. }
  9239. /**
  9240. * Iterates over elements of `collection`, returning the first element
  9241. * `predicate` returns truthy for. The predicate is invoked with three
  9242. * arguments: (value, index|key, collection).
  9243. *
  9244. * @static
  9245. * @memberOf _
  9246. * @since 0.1.0
  9247. * @category Collection
  9248. * @param {Array|Object} collection The collection to inspect.
  9249. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9250. * @param {number} [fromIndex=0] The index to search from.
  9251. * @returns {*} Returns the matched element, else `undefined`.
  9252. * @example
  9253. *
  9254. * var users = [
  9255. * { 'user': 'barney', 'age': 36, 'active': true },
  9256. * { 'user': 'fred', 'age': 40, 'active': false },
  9257. * { 'user': 'pebbles', 'age': 1, 'active': true }
  9258. * ];
  9259. *
  9260. * _.find(users, function(o) { return o.age < 40; });
  9261. * // => object for 'barney'
  9262. *
  9263. * // The `_.matches` iteratee shorthand.
  9264. * _.find(users, { 'age': 1, 'active': true });
  9265. * // => object for 'pebbles'
  9266. *
  9267. * // The `_.matchesProperty` iteratee shorthand.
  9268. * _.find(users, ['active', false]);
  9269. * // => object for 'fred'
  9270. *
  9271. * // The `_.property` iteratee shorthand.
  9272. * _.find(users, 'active');
  9273. * // => object for 'barney'
  9274. */
  9275. var find = createFind(findIndex);
  9276. /**
  9277. * This method is like `_.find` except that it iterates over elements of
  9278. * `collection` from right to left.
  9279. *
  9280. * @static
  9281. * @memberOf _
  9282. * @since 2.0.0
  9283. * @category Collection
  9284. * @param {Array|Object} collection The collection to inspect.
  9285. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9286. * @param {number} [fromIndex=collection.length-1] The index to search from.
  9287. * @returns {*} Returns the matched element, else `undefined`.
  9288. * @example
  9289. *
  9290. * _.findLast([1, 2, 3, 4], function(n) {
  9291. * return n % 2 == 1;
  9292. * });
  9293. * // => 3
  9294. */
  9295. var findLast = createFind(findLastIndex);
  9296. /**
  9297. * Creates a flattened array of values by running each element in `collection`
  9298. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  9299. * with three arguments: (value, index|key, collection).
  9300. *
  9301. * @static
  9302. * @memberOf _
  9303. * @since 4.0.0
  9304. * @category Collection
  9305. * @param {Array|Object} collection The collection to iterate over.
  9306. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9307. * @returns {Array} Returns the new flattened array.
  9308. * @example
  9309. *
  9310. * function duplicate(n) {
  9311. * return [n, n];
  9312. * }
  9313. *
  9314. * _.flatMap([1, 2], duplicate);
  9315. * // => [1, 1, 2, 2]
  9316. */
  9317. function flatMap(collection, iteratee) {
  9318. return baseFlatten(map(collection, iteratee), 1);
  9319. }
  9320. /**
  9321. * This method is like `_.flatMap` except that it recursively flattens the
  9322. * mapped results.
  9323. *
  9324. * @static
  9325. * @memberOf _
  9326. * @since 4.7.0
  9327. * @category Collection
  9328. * @param {Array|Object} collection The collection to iterate over.
  9329. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9330. * @returns {Array} Returns the new flattened array.
  9331. * @example
  9332. *
  9333. * function duplicate(n) {
  9334. * return [[[n, n]]];
  9335. * }
  9336. *
  9337. * _.flatMapDeep([1, 2], duplicate);
  9338. * // => [1, 1, 2, 2]
  9339. */
  9340. function flatMapDeep(collection, iteratee) {
  9341. return baseFlatten(map(collection, iteratee), INFINITY);
  9342. }
  9343. /**
  9344. * This method is like `_.flatMap` except that it recursively flattens the
  9345. * mapped results up to `depth` times.
  9346. *
  9347. * @static
  9348. * @memberOf _
  9349. * @since 4.7.0
  9350. * @category Collection
  9351. * @param {Array|Object} collection The collection to iterate over.
  9352. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9353. * @param {number} [depth=1] The maximum recursion depth.
  9354. * @returns {Array} Returns the new flattened array.
  9355. * @example
  9356. *
  9357. * function duplicate(n) {
  9358. * return [[[n, n]]];
  9359. * }
  9360. *
  9361. * _.flatMapDepth([1, 2], duplicate, 2);
  9362. * // => [[1, 1], [2, 2]]
  9363. */
  9364. function flatMapDepth(collection, iteratee, depth) {
  9365. depth = depth === undefined ? 1 : toInteger(depth);
  9366. return baseFlatten(map(collection, iteratee), depth);
  9367. }
  9368. /**
  9369. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  9370. * The iteratee is invoked with three arguments: (value, index|key, collection).
  9371. * Iteratee functions may exit iteration early by explicitly returning `false`.
  9372. *
  9373. * **Note:** As with other "Collections" methods, objects with a "length"
  9374. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  9375. * or `_.forOwn` for object iteration.
  9376. *
  9377. * @static
  9378. * @memberOf _
  9379. * @since 0.1.0
  9380. * @alias each
  9381. * @category Collection
  9382. * @param {Array|Object} collection The collection to iterate over.
  9383. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9384. * @returns {Array|Object} Returns `collection`.
  9385. * @see _.forEachRight
  9386. * @example
  9387. *
  9388. * _.forEach([1, 2], function(value) {
  9389. * console.log(value);
  9390. * });
  9391. * // => Logs `1` then `2`.
  9392. *
  9393. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  9394. * console.log(key);
  9395. * });
  9396. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  9397. */
  9398. function forEach(collection, iteratee) {
  9399. var func = isArray(collection) ? arrayEach : baseEach;
  9400. return func(collection, getIteratee(iteratee, 3));
  9401. }
  9402. /**
  9403. * This method is like `_.forEach` except that it iterates over elements of
  9404. * `collection` from right to left.
  9405. *
  9406. * @static
  9407. * @memberOf _
  9408. * @since 2.0.0
  9409. * @alias eachRight
  9410. * @category Collection
  9411. * @param {Array|Object} collection The collection to iterate over.
  9412. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9413. * @returns {Array|Object} Returns `collection`.
  9414. * @see _.forEach
  9415. * @example
  9416. *
  9417. * _.forEachRight([1, 2], function(value) {
  9418. * console.log(value);
  9419. * });
  9420. * // => Logs `2` then `1`.
  9421. */
  9422. function forEachRight(collection, iteratee) {
  9423. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  9424. return func(collection, getIteratee(iteratee, 3));
  9425. }
  9426. /**
  9427. * Creates an object composed of keys generated from the results of running
  9428. * each element of `collection` thru `iteratee`. The order of grouped values
  9429. * is determined by the order they occur in `collection`. The corresponding
  9430. * value of each key is an array of elements responsible for generating the
  9431. * key. The iteratee is invoked with one argument: (value).
  9432. *
  9433. * @static
  9434. * @memberOf _
  9435. * @since 0.1.0
  9436. * @category Collection
  9437. * @param {Array|Object} collection The collection to iterate over.
  9438. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9439. * @returns {Object} Returns the composed aggregate object.
  9440. * @example
  9441. *
  9442. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  9443. * // => { '4': [4.2], '6': [6.1, 6.3] }
  9444. *
  9445. * // The `_.property` iteratee shorthand.
  9446. * _.groupBy(['one', 'two', 'three'], 'length');
  9447. * // => { '3': ['one', 'two'], '5': ['three'] }
  9448. */
  9449. var groupBy = createAggregator(function(result, value, key) {
  9450. if (hasOwnProperty.call(result, key)) {
  9451. result[key].push(value);
  9452. } else {
  9453. baseAssignValue(result, key, [value]);
  9454. }
  9455. });
  9456. /**
  9457. * Checks if `value` is in `collection`. If `collection` is a string, it's
  9458. * checked for a substring of `value`, otherwise
  9459. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9460. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  9461. * the offset from the end of `collection`.
  9462. *
  9463. * @static
  9464. * @memberOf _
  9465. * @since 0.1.0
  9466. * @category Collection
  9467. * @param {Array|Object|string} collection The collection to inspect.
  9468. * @param {*} value The value to search for.
  9469. * @param {number} [fromIndex=0] The index to search from.
  9470. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9471. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  9472. * @example
  9473. *
  9474. * _.includes([1, 2, 3], 1);
  9475. * // => true
  9476. *
  9477. * _.includes([1, 2, 3], 1, 2);
  9478. * // => false
  9479. *
  9480. * _.includes({ 'a': 1, 'b': 2 }, 1);
  9481. * // => true
  9482. *
  9483. * _.includes('abcd', 'bc');
  9484. * // => true
  9485. */
  9486. function includes(collection, value, fromIndex, guard) {
  9487. collection = isArrayLike(collection) ? collection : values(collection);
  9488. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  9489. var length = collection.length;
  9490. if (fromIndex < 0) {
  9491. fromIndex = nativeMax(length + fromIndex, 0);
  9492. }
  9493. return isString(collection)
  9494. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  9495. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  9496. }
  9497. /**
  9498. * Invokes the method at `path` of each element in `collection`, returning
  9499. * an array of the results of each invoked method. Any additional arguments
  9500. * are provided to each invoked method. If `path` is a function, it's invoked
  9501. * for, and `this` bound to, each element in `collection`.
  9502. *
  9503. * @static
  9504. * @memberOf _
  9505. * @since 4.0.0
  9506. * @category Collection
  9507. * @param {Array|Object} collection The collection to iterate over.
  9508. * @param {Array|Function|string} path The path of the method to invoke or
  9509. * the function invoked per iteration.
  9510. * @param {...*} [args] The arguments to invoke each method with.
  9511. * @returns {Array} Returns the array of results.
  9512. * @example
  9513. *
  9514. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  9515. * // => [[1, 5, 7], [1, 2, 3]]
  9516. *
  9517. * _.invokeMap([123, 456], String.prototype.split, '');
  9518. * // => [['1', '2', '3'], ['4', '5', '6']]
  9519. */
  9520. var invokeMap = baseRest(function(collection, path, args) {
  9521. var index = -1,
  9522. isFunc = typeof path == 'function',
  9523. result = isArrayLike(collection) ? Array(collection.length) : [];
  9524. baseEach(collection, function(value) {
  9525. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  9526. });
  9527. return result;
  9528. });
  9529. /**
  9530. * Creates an object composed of keys generated from the results of running
  9531. * each element of `collection` thru `iteratee`. The corresponding value of
  9532. * each key is the last element responsible for generating the key. The
  9533. * iteratee is invoked with one argument: (value).
  9534. *
  9535. * @static
  9536. * @memberOf _
  9537. * @since 4.0.0
  9538. * @category Collection
  9539. * @param {Array|Object} collection The collection to iterate over.
  9540. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9541. * @returns {Object} Returns the composed aggregate object.
  9542. * @example
  9543. *
  9544. * var array = [
  9545. * { 'dir': 'left', 'code': 97 },
  9546. * { 'dir': 'right', 'code': 100 }
  9547. * ];
  9548. *
  9549. * _.keyBy(array, function(o) {
  9550. * return String.fromCharCode(o.code);
  9551. * });
  9552. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  9553. *
  9554. * _.keyBy(array, 'dir');
  9555. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  9556. */
  9557. var keyBy = createAggregator(function(result, value, key) {
  9558. baseAssignValue(result, key, value);
  9559. });
  9560. /**
  9561. * Creates an array of values by running each element in `collection` thru
  9562. * `iteratee`. The iteratee is invoked with three arguments:
  9563. * (value, index|key, collection).
  9564. *
  9565. * Many lodash methods are guarded to work as iteratees for methods like
  9566. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  9567. *
  9568. * The guarded methods are:
  9569. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  9570. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  9571. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  9572. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  9573. *
  9574. * @static
  9575. * @memberOf _
  9576. * @since 0.1.0
  9577. * @category Collection
  9578. * @param {Array|Object} collection The collection to iterate over.
  9579. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9580. * @returns {Array} Returns the new mapped array.
  9581. * @example
  9582. *
  9583. * function square(n) {
  9584. * return n * n;
  9585. * }
  9586. *
  9587. * _.map([4, 8], square);
  9588. * // => [16, 64]
  9589. *
  9590. * _.map({ 'a': 4, 'b': 8 }, square);
  9591. * // => [16, 64] (iteration order is not guaranteed)
  9592. *
  9593. * var users = [
  9594. * { 'user': 'barney' },
  9595. * { 'user': 'fred' }
  9596. * ];
  9597. *
  9598. * // The `_.property` iteratee shorthand.
  9599. * _.map(users, 'user');
  9600. * // => ['barney', 'fred']
  9601. */
  9602. function map(collection, iteratee) {
  9603. var func = isArray(collection) ? arrayMap : baseMap;
  9604. return func(collection, getIteratee(iteratee, 3));
  9605. }
  9606. /**
  9607. * This method is like `_.sortBy` except that it allows specifying the sort
  9608. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  9609. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  9610. * descending or "asc" for ascending sort order of corresponding values.
  9611. *
  9612. * @static
  9613. * @memberOf _
  9614. * @since 4.0.0
  9615. * @category Collection
  9616. * @param {Array|Object} collection The collection to iterate over.
  9617. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  9618. * The iteratees to sort by.
  9619. * @param {string[]} [orders] The sort orders of `iteratees`.
  9620. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9621. * @returns {Array} Returns the new sorted array.
  9622. * @example
  9623. *
  9624. * var users = [
  9625. * { 'user': 'fred', 'age': 48 },
  9626. * { 'user': 'barney', 'age': 34 },
  9627. * { 'user': 'fred', 'age': 40 },
  9628. * { 'user': 'barney', 'age': 36 }
  9629. * ];
  9630. *
  9631. * // Sort by `user` in ascending order and by `age` in descending order.
  9632. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  9633. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  9634. */
  9635. function orderBy(collection, iteratees, orders, guard) {
  9636. if (collection == null) {
  9637. return [];
  9638. }
  9639. if (!isArray(iteratees)) {
  9640. iteratees = iteratees == null ? [] : [iteratees];
  9641. }
  9642. orders = guard ? undefined : orders;
  9643. if (!isArray(orders)) {
  9644. orders = orders == null ? [] : [orders];
  9645. }
  9646. return baseOrderBy(collection, iteratees, orders);
  9647. }
  9648. /**
  9649. * Creates an array of elements split into two groups, the first of which
  9650. * contains elements `predicate` returns truthy for, the second of which
  9651. * contains elements `predicate` returns falsey for. The predicate is
  9652. * invoked with one argument: (value).
  9653. *
  9654. * @static
  9655. * @memberOf _
  9656. * @since 3.0.0
  9657. * @category Collection
  9658. * @param {Array|Object} collection The collection to iterate over.
  9659. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9660. * @returns {Array} Returns the array of grouped elements.
  9661. * @example
  9662. *
  9663. * var users = [
  9664. * { 'user': 'barney', 'age': 36, 'active': false },
  9665. * { 'user': 'fred', 'age': 40, 'active': true },
  9666. * { 'user': 'pebbles', 'age': 1, 'active': false }
  9667. * ];
  9668. *
  9669. * _.partition(users, function(o) { return o.active; });
  9670. * // => objects for [['fred'], ['barney', 'pebbles']]
  9671. *
  9672. * // The `_.matches` iteratee shorthand.
  9673. * _.partition(users, { 'age': 1, 'active': false });
  9674. * // => objects for [['pebbles'], ['barney', 'fred']]
  9675. *
  9676. * // The `_.matchesProperty` iteratee shorthand.
  9677. * _.partition(users, ['active', false]);
  9678. * // => objects for [['barney', 'pebbles'], ['fred']]
  9679. *
  9680. * // The `_.property` iteratee shorthand.
  9681. * _.partition(users, 'active');
  9682. * // => objects for [['fred'], ['barney', 'pebbles']]
  9683. */
  9684. var partition = createAggregator(function(result, value, key) {
  9685. result[key ? 0 : 1].push(value);
  9686. }, function() { return [[], []]; });
  9687. /**
  9688. * Reduces `collection` to a value which is the accumulated result of running
  9689. * each element in `collection` thru `iteratee`, where each successive
  9690. * invocation is supplied the return value of the previous. If `accumulator`
  9691. * is not given, the first element of `collection` is used as the initial
  9692. * value. The iteratee is invoked with four arguments:
  9693. * (accumulator, value, index|key, collection).
  9694. *
  9695. * Many lodash methods are guarded to work as iteratees for methods like
  9696. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  9697. *
  9698. * The guarded methods are:
  9699. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  9700. * and `sortBy`
  9701. *
  9702. * @static
  9703. * @memberOf _
  9704. * @since 0.1.0
  9705. * @category Collection
  9706. * @param {Array|Object} collection The collection to iterate over.
  9707. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9708. * @param {*} [accumulator] The initial value.
  9709. * @returns {*} Returns the accumulated value.
  9710. * @see _.reduceRight
  9711. * @example
  9712. *
  9713. * _.reduce([1, 2], function(sum, n) {
  9714. * return sum + n;
  9715. * }, 0);
  9716. * // => 3
  9717. *
  9718. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  9719. * (result[value] || (result[value] = [])).push(key);
  9720. * return result;
  9721. * }, {});
  9722. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  9723. */
  9724. function reduce(collection, iteratee, accumulator) {
  9725. var func = isArray(collection) ? arrayReduce : baseReduce,
  9726. initAccum = arguments.length < 3;
  9727. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  9728. }
  9729. /**
  9730. * This method is like `_.reduce` except that it iterates over elements of
  9731. * `collection` from right to left.
  9732. *
  9733. * @static
  9734. * @memberOf _
  9735. * @since 0.1.0
  9736. * @category Collection
  9737. * @param {Array|Object} collection The collection to iterate over.
  9738. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9739. * @param {*} [accumulator] The initial value.
  9740. * @returns {*} Returns the accumulated value.
  9741. * @see _.reduce
  9742. * @example
  9743. *
  9744. * var array = [[0, 1], [2, 3], [4, 5]];
  9745. *
  9746. * _.reduceRight(array, function(flattened, other) {
  9747. * return flattened.concat(other);
  9748. * }, []);
  9749. * // => [4, 5, 2, 3, 0, 1]
  9750. */
  9751. function reduceRight(collection, iteratee, accumulator) {
  9752. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  9753. initAccum = arguments.length < 3;
  9754. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  9755. }
  9756. /**
  9757. * The opposite of `_.filter`; this method returns the elements of `collection`
  9758. * that `predicate` does **not** return truthy for.
  9759. *
  9760. * @static
  9761. * @memberOf _
  9762. * @since 0.1.0
  9763. * @category Collection
  9764. * @param {Array|Object} collection The collection to iterate over.
  9765. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9766. * @returns {Array} Returns the new filtered array.
  9767. * @see _.filter
  9768. * @example
  9769. *
  9770. * var users = [
  9771. * { 'user': 'barney', 'age': 36, 'active': false },
  9772. * { 'user': 'fred', 'age': 40, 'active': true }
  9773. * ];
  9774. *
  9775. * _.reject(users, function(o) { return !o.active; });
  9776. * // => objects for ['fred']
  9777. *
  9778. * // The `_.matches` iteratee shorthand.
  9779. * _.reject(users, { 'age': 40, 'active': true });
  9780. * // => objects for ['barney']
  9781. *
  9782. * // The `_.matchesProperty` iteratee shorthand.
  9783. * _.reject(users, ['active', false]);
  9784. * // => objects for ['fred']
  9785. *
  9786. * // The `_.property` iteratee shorthand.
  9787. * _.reject(users, 'active');
  9788. * // => objects for ['barney']
  9789. */
  9790. function reject(collection, predicate) {
  9791. var func = isArray(collection) ? arrayFilter : baseFilter;
  9792. return func(collection, negate(getIteratee(predicate, 3)));
  9793. }
  9794. /**
  9795. * Gets a random element from `collection`.
  9796. *
  9797. * @static
  9798. * @memberOf _
  9799. * @since 2.0.0
  9800. * @category Collection
  9801. * @param {Array|Object} collection The collection to sample.
  9802. * @returns {*} Returns the random element.
  9803. * @example
  9804. *
  9805. * _.sample([1, 2, 3, 4]);
  9806. * // => 2
  9807. */
  9808. function sample(collection) {
  9809. var func = isArray(collection) ? arraySample : baseSample;
  9810. return func(collection);
  9811. }
  9812. /**
  9813. * Gets `n` random elements at unique keys from `collection` up to the
  9814. * size of `collection`.
  9815. *
  9816. * @static
  9817. * @memberOf _
  9818. * @since 4.0.0
  9819. * @category Collection
  9820. * @param {Array|Object} collection The collection to sample.
  9821. * @param {number} [n=1] The number of elements to sample.
  9822. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9823. * @returns {Array} Returns the random elements.
  9824. * @example
  9825. *
  9826. * _.sampleSize([1, 2, 3], 2);
  9827. * // => [3, 1]
  9828. *
  9829. * _.sampleSize([1, 2, 3], 4);
  9830. * // => [2, 3, 1]
  9831. */
  9832. function sampleSize(collection, n, guard) {
  9833. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  9834. n = 1;
  9835. } else {
  9836. n = toInteger(n);
  9837. }
  9838. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  9839. return func(collection, n);
  9840. }
  9841. /**
  9842. * Creates an array of shuffled values, using a version of the
  9843. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  9844. *
  9845. * @static
  9846. * @memberOf _
  9847. * @since 0.1.0
  9848. * @category Collection
  9849. * @param {Array|Object} collection The collection to shuffle.
  9850. * @returns {Array} Returns the new shuffled array.
  9851. * @example
  9852. *
  9853. * _.shuffle([1, 2, 3, 4]);
  9854. * // => [4, 1, 3, 2]
  9855. */
  9856. function shuffle(collection) {
  9857. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  9858. return func(collection);
  9859. }
  9860. /**
  9861. * Gets the size of `collection` by returning its length for array-like
  9862. * values or the number of own enumerable string keyed properties for objects.
  9863. *
  9864. * @static
  9865. * @memberOf _
  9866. * @since 0.1.0
  9867. * @category Collection
  9868. * @param {Array|Object|string} collection The collection to inspect.
  9869. * @returns {number} Returns the collection size.
  9870. * @example
  9871. *
  9872. * _.size([1, 2, 3]);
  9873. * // => 3
  9874. *
  9875. * _.size({ 'a': 1, 'b': 2 });
  9876. * // => 2
  9877. *
  9878. * _.size('pebbles');
  9879. * // => 7
  9880. */
  9881. function size(collection) {
  9882. if (collection == null) {
  9883. return 0;
  9884. }
  9885. if (isArrayLike(collection)) {
  9886. return isString(collection) ? stringSize(collection) : collection.length;
  9887. }
  9888. var tag = getTag(collection);
  9889. if (tag == mapTag || tag == setTag) {
  9890. return collection.size;
  9891. }
  9892. return baseKeys(collection).length;
  9893. }
  9894. /**
  9895. * Checks if `predicate` returns truthy for **any** element of `collection`.
  9896. * Iteration is stopped once `predicate` returns truthy. The predicate is
  9897. * invoked with three arguments: (value, index|key, collection).
  9898. *
  9899. * @static
  9900. * @memberOf _
  9901. * @since 0.1.0
  9902. * @category Collection
  9903. * @param {Array|Object} collection The collection to iterate over.
  9904. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9905. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9906. * @returns {boolean} Returns `true` if any element passes the predicate check,
  9907. * else `false`.
  9908. * @example
  9909. *
  9910. * _.some([null, 0, 'yes', false], Boolean);
  9911. * // => true
  9912. *
  9913. * var users = [
  9914. * { 'user': 'barney', 'active': true },
  9915. * { 'user': 'fred', 'active': false }
  9916. * ];
  9917. *
  9918. * // The `_.matches` iteratee shorthand.
  9919. * _.some(users, { 'user': 'barney', 'active': false });
  9920. * // => false
  9921. *
  9922. * // The `_.matchesProperty` iteratee shorthand.
  9923. * _.some(users, ['active', false]);
  9924. * // => true
  9925. *
  9926. * // The `_.property` iteratee shorthand.
  9927. * _.some(users, 'active');
  9928. * // => true
  9929. */
  9930. function some(collection, predicate, guard) {
  9931. var func = isArray(collection) ? arraySome : baseSome;
  9932. if (guard && isIterateeCall(collection, predicate, guard)) {
  9933. predicate = undefined;
  9934. }
  9935. return func(collection, getIteratee(predicate, 3));
  9936. }
  9937. /**
  9938. * Creates an array of elements, sorted in ascending order by the results of
  9939. * running each element in a collection thru each iteratee. This method
  9940. * performs a stable sort, that is, it preserves the original sort order of
  9941. * equal elements. The iteratees are invoked with one argument: (value).
  9942. *
  9943. * @static
  9944. * @memberOf _
  9945. * @since 0.1.0
  9946. * @category Collection
  9947. * @param {Array|Object} collection The collection to iterate over.
  9948. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  9949. * The iteratees to sort by.
  9950. * @returns {Array} Returns the new sorted array.
  9951. * @example
  9952. *
  9953. * var users = [
  9954. * { 'user': 'fred', 'age': 48 },
  9955. * { 'user': 'barney', 'age': 36 },
  9956. * { 'user': 'fred', 'age': 40 },
  9957. * { 'user': 'barney', 'age': 34 }
  9958. * ];
  9959. *
  9960. * _.sortBy(users, [function(o) { return o.user; }]);
  9961. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  9962. *
  9963. * _.sortBy(users, ['user', 'age']);
  9964. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  9965. */
  9966. var sortBy = baseRest(function(collection, iteratees) {
  9967. if (collection == null) {
  9968. return [];
  9969. }
  9970. var length = iteratees.length;
  9971. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  9972. iteratees = [];
  9973. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  9974. iteratees = [iteratees[0]];
  9975. }
  9976. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  9977. });
  9978. /*------------------------------------------------------------------------*/
  9979. /**
  9980. * Gets the timestamp of the number of milliseconds that have elapsed since
  9981. * the Unix epoch (1 January 1970 00:00:00 UTC).
  9982. *
  9983. * @static
  9984. * @memberOf _
  9985. * @since 2.4.0
  9986. * @category Date
  9987. * @returns {number} Returns the timestamp.
  9988. * @example
  9989. *
  9990. * _.defer(function(stamp) {
  9991. * console.log(_.now() - stamp);
  9992. * }, _.now());
  9993. * // => Logs the number of milliseconds it took for the deferred invocation.
  9994. */
  9995. var now = ctxNow || function() {
  9996. return root.Date.now();
  9997. };
  9998. /*------------------------------------------------------------------------*/
  9999. /**
  10000. * The opposite of `_.before`; this method creates a function that invokes
  10001. * `func` once it's called `n` or more times.
  10002. *
  10003. * @static
  10004. * @memberOf _
  10005. * @since 0.1.0
  10006. * @category Function
  10007. * @param {number} n The number of calls before `func` is invoked.
  10008. * @param {Function} func The function to restrict.
  10009. * @returns {Function} Returns the new restricted function.
  10010. * @example
  10011. *
  10012. * var saves = ['profile', 'settings'];
  10013. *
  10014. * var done = _.after(saves.length, function() {
  10015. * console.log('done saving!');
  10016. * });
  10017. *
  10018. * _.forEach(saves, function(type) {
  10019. * asyncSave({ 'type': type, 'complete': done });
  10020. * });
  10021. * // => Logs 'done saving!' after the two async saves have completed.
  10022. */
  10023. function after(n, func) {
  10024. if (typeof func != 'function') {
  10025. throw new TypeError(FUNC_ERROR_TEXT);
  10026. }
  10027. n = toInteger(n);
  10028. return function() {
  10029. if (--n < 1) {
  10030. return func.apply(this, arguments);
  10031. }
  10032. };
  10033. }
  10034. /**
  10035. * Creates a function that invokes `func`, with up to `n` arguments,
  10036. * ignoring any additional arguments.
  10037. *
  10038. * @static
  10039. * @memberOf _
  10040. * @since 3.0.0
  10041. * @category Function
  10042. * @param {Function} func The function to cap arguments for.
  10043. * @param {number} [n=func.length] The arity cap.
  10044. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10045. * @returns {Function} Returns the new capped function.
  10046. * @example
  10047. *
  10048. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  10049. * // => [6, 8, 10]
  10050. */
  10051. function ary(func, n, guard) {
  10052. n = guard ? undefined : n;
  10053. n = (func && n == null) ? func.length : n;
  10054. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  10055. }
  10056. /**
  10057. * Creates a function that invokes `func`, with the `this` binding and arguments
  10058. * of the created function, while it's called less than `n` times. Subsequent
  10059. * calls to the created function return the result of the last `func` invocation.
  10060. *
  10061. * @static
  10062. * @memberOf _
  10063. * @since 3.0.0
  10064. * @category Function
  10065. * @param {number} n The number of calls at which `func` is no longer invoked.
  10066. * @param {Function} func The function to restrict.
  10067. * @returns {Function} Returns the new restricted function.
  10068. * @example
  10069. *
  10070. * jQuery(element).on('click', _.before(5, addContactToList));
  10071. * // => Allows adding up to 4 contacts to the list.
  10072. */
  10073. function before(n, func) {
  10074. var result;
  10075. if (typeof func != 'function') {
  10076. throw new TypeError(FUNC_ERROR_TEXT);
  10077. }
  10078. n = toInteger(n);
  10079. return function() {
  10080. if (--n > 0) {
  10081. result = func.apply(this, arguments);
  10082. }
  10083. if (n <= 1) {
  10084. func = undefined;
  10085. }
  10086. return result;
  10087. };
  10088. }
  10089. /**
  10090. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  10091. * and `partials` prepended to the arguments it receives.
  10092. *
  10093. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  10094. * may be used as a placeholder for partially applied arguments.
  10095. *
  10096. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  10097. * property of bound functions.
  10098. *
  10099. * @static
  10100. * @memberOf _
  10101. * @since 0.1.0
  10102. * @category Function
  10103. * @param {Function} func The function to bind.
  10104. * @param {*} thisArg The `this` binding of `func`.
  10105. * @param {...*} [partials] The arguments to be partially applied.
  10106. * @returns {Function} Returns the new bound function.
  10107. * @example
  10108. *
  10109. * function greet(greeting, punctuation) {
  10110. * return greeting + ' ' + this.user + punctuation;
  10111. * }
  10112. *
  10113. * var object = { 'user': 'fred' };
  10114. *
  10115. * var bound = _.bind(greet, object, 'hi');
  10116. * bound('!');
  10117. * // => 'hi fred!'
  10118. *
  10119. * // Bound with placeholders.
  10120. * var bound = _.bind(greet, object, _, '!');
  10121. * bound('hi');
  10122. * // => 'hi fred!'
  10123. */
  10124. var bind = baseRest(function(func, thisArg, partials) {
  10125. var bitmask = WRAP_BIND_FLAG;
  10126. if (partials.length) {
  10127. var holders = replaceHolders(partials, getHolder(bind));
  10128. bitmask |= WRAP_PARTIAL_FLAG;
  10129. }
  10130. return createWrap(func, bitmask, thisArg, partials, holders);
  10131. });
  10132. /**
  10133. * Creates a function that invokes the method at `object[key]` with `partials`
  10134. * prepended to the arguments it receives.
  10135. *
  10136. * This method differs from `_.bind` by allowing bound functions to reference
  10137. * methods that may be redefined or don't yet exist. See
  10138. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  10139. * for more details.
  10140. *
  10141. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  10142. * builds, may be used as a placeholder for partially applied arguments.
  10143. *
  10144. * @static
  10145. * @memberOf _
  10146. * @since 0.10.0
  10147. * @category Function
  10148. * @param {Object} object The object to invoke the method on.
  10149. * @param {string} key The key of the method.
  10150. * @param {...*} [partials] The arguments to be partially applied.
  10151. * @returns {Function} Returns the new bound function.
  10152. * @example
  10153. *
  10154. * var object = {
  10155. * 'user': 'fred',
  10156. * 'greet': function(greeting, punctuation) {
  10157. * return greeting + ' ' + this.user + punctuation;
  10158. * }
  10159. * };
  10160. *
  10161. * var bound = _.bindKey(object, 'greet', 'hi');
  10162. * bound('!');
  10163. * // => 'hi fred!'
  10164. *
  10165. * object.greet = function(greeting, punctuation) {
  10166. * return greeting + 'ya ' + this.user + punctuation;
  10167. * };
  10168. *
  10169. * bound('!');
  10170. * // => 'hiya fred!'
  10171. *
  10172. * // Bound with placeholders.
  10173. * var bound = _.bindKey(object, 'greet', _, '!');
  10174. * bound('hi');
  10175. * // => 'hiya fred!'
  10176. */
  10177. var bindKey = baseRest(function(object, key, partials) {
  10178. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  10179. if (partials.length) {
  10180. var holders = replaceHolders(partials, getHolder(bindKey));
  10181. bitmask |= WRAP_PARTIAL_FLAG;
  10182. }
  10183. return createWrap(key, bitmask, object, partials, holders);
  10184. });
  10185. /**
  10186. * Creates a function that accepts arguments of `func` and either invokes
  10187. * `func` returning its result, if at least `arity` number of arguments have
  10188. * been provided, or returns a function that accepts the remaining `func`
  10189. * arguments, and so on. The arity of `func` may be specified if `func.length`
  10190. * is not sufficient.
  10191. *
  10192. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  10193. * may be used as a placeholder for provided arguments.
  10194. *
  10195. * **Note:** This method doesn't set the "length" property of curried functions.
  10196. *
  10197. * @static
  10198. * @memberOf _
  10199. * @since 2.0.0
  10200. * @category Function
  10201. * @param {Function} func The function to curry.
  10202. * @param {number} [arity=func.length] The arity of `func`.
  10203. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10204. * @returns {Function} Returns the new curried function.
  10205. * @example
  10206. *
  10207. * var abc = function(a, b, c) {
  10208. * return [a, b, c];
  10209. * };
  10210. *
  10211. * var curried = _.curry(abc);
  10212. *
  10213. * curried(1)(2)(3);
  10214. * // => [1, 2, 3]
  10215. *
  10216. * curried(1, 2)(3);
  10217. * // => [1, 2, 3]
  10218. *
  10219. * curried(1, 2, 3);
  10220. * // => [1, 2, 3]
  10221. *
  10222. * // Curried with placeholders.
  10223. * curried(1)(_, 3)(2);
  10224. * // => [1, 2, 3]
  10225. */
  10226. function curry(func, arity, guard) {
  10227. arity = guard ? undefined : arity;
  10228. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10229. result.placeholder = curry.placeholder;
  10230. return result;
  10231. }
  10232. /**
  10233. * This method is like `_.curry` except that arguments are applied to `func`
  10234. * in the manner of `_.partialRight` instead of `_.partial`.
  10235. *
  10236. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  10237. * builds, may be used as a placeholder for provided arguments.
  10238. *
  10239. * **Note:** This method doesn't set the "length" property of curried functions.
  10240. *
  10241. * @static
  10242. * @memberOf _
  10243. * @since 3.0.0
  10244. * @category Function
  10245. * @param {Function} func The function to curry.
  10246. * @param {number} [arity=func.length] The arity of `func`.
  10247. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10248. * @returns {Function} Returns the new curried function.
  10249. * @example
  10250. *
  10251. * var abc = function(a, b, c) {
  10252. * return [a, b, c];
  10253. * };
  10254. *
  10255. * var curried = _.curryRight(abc);
  10256. *
  10257. * curried(3)(2)(1);
  10258. * // => [1, 2, 3]
  10259. *
  10260. * curried(2, 3)(1);
  10261. * // => [1, 2, 3]
  10262. *
  10263. * curried(1, 2, 3);
  10264. * // => [1, 2, 3]
  10265. *
  10266. * // Curried with placeholders.
  10267. * curried(3)(1, _)(2);
  10268. * // => [1, 2, 3]
  10269. */
  10270. function curryRight(func, arity, guard) {
  10271. arity = guard ? undefined : arity;
  10272. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10273. result.placeholder = curryRight.placeholder;
  10274. return result;
  10275. }
  10276. /**
  10277. * Creates a debounced function that delays invoking `func` until after `wait`
  10278. * milliseconds have elapsed since the last time the debounced function was
  10279. * invoked. The debounced function comes with a `cancel` method to cancel
  10280. * delayed `func` invocations and a `flush` method to immediately invoke them.
  10281. * Provide `options` to indicate whether `func` should be invoked on the
  10282. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  10283. * with the last arguments provided to the debounced function. Subsequent
  10284. * calls to the debounced function return the result of the last `func`
  10285. * invocation.
  10286. *
  10287. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10288. * invoked on the trailing edge of the timeout only if the debounced function
  10289. * is invoked more than once during the `wait` timeout.
  10290. *
  10291. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10292. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10293. *
  10294. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10295. * for details over the differences between `_.debounce` and `_.throttle`.
  10296. *
  10297. * @static
  10298. * @memberOf _
  10299. * @since 0.1.0
  10300. * @category Function
  10301. * @param {Function} func The function to debounce.
  10302. * @param {number} [wait=0] The number of milliseconds to delay.
  10303. * @param {Object} [options={}] The options object.
  10304. * @param {boolean} [options.leading=false]
  10305. * Specify invoking on the leading edge of the timeout.
  10306. * @param {number} [options.maxWait]
  10307. * The maximum time `func` is allowed to be delayed before it's invoked.
  10308. * @param {boolean} [options.trailing=true]
  10309. * Specify invoking on the trailing edge of the timeout.
  10310. * @returns {Function} Returns the new debounced function.
  10311. * @example
  10312. *
  10313. * // Avoid costly calculations while the window size is in flux.
  10314. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  10315. *
  10316. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  10317. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  10318. * 'leading': true,
  10319. * 'trailing': false
  10320. * }));
  10321. *
  10322. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  10323. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  10324. * var source = new EventSource('/stream');
  10325. * jQuery(source).on('message', debounced);
  10326. *
  10327. * // Cancel the trailing debounced invocation.
  10328. * jQuery(window).on('popstate', debounced.cancel);
  10329. */
  10330. function debounce(func, wait, options) {
  10331. var lastArgs,
  10332. lastThis,
  10333. maxWait,
  10334. result,
  10335. timerId,
  10336. lastCallTime,
  10337. lastInvokeTime = 0,
  10338. leading = false,
  10339. maxing = false,
  10340. trailing = true;
  10341. if (typeof func != 'function') {
  10342. throw new TypeError(FUNC_ERROR_TEXT);
  10343. }
  10344. wait = toNumber(wait) || 0;
  10345. if (isObject(options)) {
  10346. leading = !!options.leading;
  10347. maxing = 'maxWait' in options;
  10348. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  10349. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10350. }
  10351. function invokeFunc(time) {
  10352. var args = lastArgs,
  10353. thisArg = lastThis;
  10354. lastArgs = lastThis = undefined;
  10355. lastInvokeTime = time;
  10356. result = func.apply(thisArg, args);
  10357. return result;
  10358. }
  10359. function leadingEdge(time) {
  10360. // Reset any `maxWait` timer.
  10361. lastInvokeTime = time;
  10362. // Start the timer for the trailing edge.
  10363. timerId = setTimeout(timerExpired, wait);
  10364. // Invoke the leading edge.
  10365. return leading ? invokeFunc(time) : result;
  10366. }
  10367. function remainingWait(time) {
  10368. var timeSinceLastCall = time - lastCallTime,
  10369. timeSinceLastInvoke = time - lastInvokeTime,
  10370. result = wait - timeSinceLastCall;
  10371. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  10372. }
  10373. function shouldInvoke(time) {
  10374. var timeSinceLastCall = time - lastCallTime,
  10375. timeSinceLastInvoke = time - lastInvokeTime;
  10376. // Either this is the first call, activity has stopped and we're at the
  10377. // trailing edge, the system time has gone backwards and we're treating
  10378. // it as the trailing edge, or we've hit the `maxWait` limit.
  10379. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  10380. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  10381. }
  10382. function timerExpired() {
  10383. var time = now();
  10384. if (shouldInvoke(time)) {
  10385. return trailingEdge(time);
  10386. }
  10387. // Restart the timer.
  10388. timerId = setTimeout(timerExpired, remainingWait(time));
  10389. }
  10390. function trailingEdge(time) {
  10391. timerId = undefined;
  10392. // Only invoke if we have `lastArgs` which means `func` has been
  10393. // debounced at least once.
  10394. if (trailing && lastArgs) {
  10395. return invokeFunc(time);
  10396. }
  10397. lastArgs = lastThis = undefined;
  10398. return result;
  10399. }
  10400. function cancel() {
  10401. if (timerId !== undefined) {
  10402. clearTimeout(timerId);
  10403. }
  10404. lastInvokeTime = 0;
  10405. lastArgs = lastCallTime = lastThis = timerId = undefined;
  10406. }
  10407. function flush() {
  10408. return timerId === undefined ? result : trailingEdge(now());
  10409. }
  10410. function debounced() {
  10411. var time = now(),
  10412. isInvoking = shouldInvoke(time);
  10413. lastArgs = arguments;
  10414. lastThis = this;
  10415. lastCallTime = time;
  10416. if (isInvoking) {
  10417. if (timerId === undefined) {
  10418. return leadingEdge(lastCallTime);
  10419. }
  10420. if (maxing) {
  10421. // Handle invocations in a tight loop.
  10422. timerId = setTimeout(timerExpired, wait);
  10423. return invokeFunc(lastCallTime);
  10424. }
  10425. }
  10426. if (timerId === undefined) {
  10427. timerId = setTimeout(timerExpired, wait);
  10428. }
  10429. return result;
  10430. }
  10431. debounced.cancel = cancel;
  10432. debounced.flush = flush;
  10433. return debounced;
  10434. }
  10435. /**
  10436. * Defers invoking the `func` until the current call stack has cleared. Any
  10437. * additional arguments are provided to `func` when it's invoked.
  10438. *
  10439. * @static
  10440. * @memberOf _
  10441. * @since 0.1.0
  10442. * @category Function
  10443. * @param {Function} func The function to defer.
  10444. * @param {...*} [args] The arguments to invoke `func` with.
  10445. * @returns {number} Returns the timer id.
  10446. * @example
  10447. *
  10448. * _.defer(function(text) {
  10449. * console.log(text);
  10450. * }, 'deferred');
  10451. * // => Logs 'deferred' after one millisecond.
  10452. */
  10453. var defer = baseRest(function(func, args) {
  10454. return baseDelay(func, 1, args);
  10455. });
  10456. /**
  10457. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  10458. * provided to `func` when it's invoked.
  10459. *
  10460. * @static
  10461. * @memberOf _
  10462. * @since 0.1.0
  10463. * @category Function
  10464. * @param {Function} func The function to delay.
  10465. * @param {number} wait The number of milliseconds to delay invocation.
  10466. * @param {...*} [args] The arguments to invoke `func` with.
  10467. * @returns {number} Returns the timer id.
  10468. * @example
  10469. *
  10470. * _.delay(function(text) {
  10471. * console.log(text);
  10472. * }, 1000, 'later');
  10473. * // => Logs 'later' after one second.
  10474. */
  10475. var delay = baseRest(function(func, wait, args) {
  10476. return baseDelay(func, toNumber(wait) || 0, args);
  10477. });
  10478. /**
  10479. * Creates a function that invokes `func` with arguments reversed.
  10480. *
  10481. * @static
  10482. * @memberOf _
  10483. * @since 4.0.0
  10484. * @category Function
  10485. * @param {Function} func The function to flip arguments for.
  10486. * @returns {Function} Returns the new flipped function.
  10487. * @example
  10488. *
  10489. * var flipped = _.flip(function() {
  10490. * return _.toArray(arguments);
  10491. * });
  10492. *
  10493. * flipped('a', 'b', 'c', 'd');
  10494. * // => ['d', 'c', 'b', 'a']
  10495. */
  10496. function flip(func) {
  10497. return createWrap(func, WRAP_FLIP_FLAG);
  10498. }
  10499. /**
  10500. * Creates a function that memoizes the result of `func`. If `resolver` is
  10501. * provided, it determines the cache key for storing the result based on the
  10502. * arguments provided to the memoized function. By default, the first argument
  10503. * provided to the memoized function is used as the map cache key. The `func`
  10504. * is invoked with the `this` binding of the memoized function.
  10505. *
  10506. * **Note:** The cache is exposed as the `cache` property on the memoized
  10507. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  10508. * constructor with one whose instances implement the
  10509. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  10510. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  10511. *
  10512. * @static
  10513. * @memberOf _
  10514. * @since 0.1.0
  10515. * @category Function
  10516. * @param {Function} func The function to have its output memoized.
  10517. * @param {Function} [resolver] The function to resolve the cache key.
  10518. * @returns {Function} Returns the new memoized function.
  10519. * @example
  10520. *
  10521. * var object = { 'a': 1, 'b': 2 };
  10522. * var other = { 'c': 3, 'd': 4 };
  10523. *
  10524. * var values = _.memoize(_.values);
  10525. * values(object);
  10526. * // => [1, 2]
  10527. *
  10528. * values(other);
  10529. * // => [3, 4]
  10530. *
  10531. * object.a = 2;
  10532. * values(object);
  10533. * // => [1, 2]
  10534. *
  10535. * // Modify the result cache.
  10536. * values.cache.set(object, ['a', 'b']);
  10537. * values(object);
  10538. * // => ['a', 'b']
  10539. *
  10540. * // Replace `_.memoize.Cache`.
  10541. * _.memoize.Cache = WeakMap;
  10542. */
  10543. function memoize(func, resolver) {
  10544. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  10545. throw new TypeError(FUNC_ERROR_TEXT);
  10546. }
  10547. var memoized = function() {
  10548. var args = arguments,
  10549. key = resolver ? resolver.apply(this, args) : args[0],
  10550. cache = memoized.cache;
  10551. if (cache.has(key)) {
  10552. return cache.get(key);
  10553. }
  10554. var result = func.apply(this, args);
  10555. memoized.cache = cache.set(key, result) || cache;
  10556. return result;
  10557. };
  10558. memoized.cache = new (memoize.Cache || MapCache);
  10559. return memoized;
  10560. }
  10561. // Expose `MapCache`.
  10562. memoize.Cache = MapCache;
  10563. /**
  10564. * Creates a function that negates the result of the predicate `func`. The
  10565. * `func` predicate is invoked with the `this` binding and arguments of the
  10566. * created function.
  10567. *
  10568. * @static
  10569. * @memberOf _
  10570. * @since 3.0.0
  10571. * @category Function
  10572. * @param {Function} predicate The predicate to negate.
  10573. * @returns {Function} Returns the new negated function.
  10574. * @example
  10575. *
  10576. * function isEven(n) {
  10577. * return n % 2 == 0;
  10578. * }
  10579. *
  10580. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  10581. * // => [1, 3, 5]
  10582. */
  10583. function negate(predicate) {
  10584. if (typeof predicate != 'function') {
  10585. throw new TypeError(FUNC_ERROR_TEXT);
  10586. }
  10587. return function() {
  10588. var args = arguments;
  10589. switch (args.length) {
  10590. case 0: return !predicate.call(this);
  10591. case 1: return !predicate.call(this, args[0]);
  10592. case 2: return !predicate.call(this, args[0], args[1]);
  10593. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  10594. }
  10595. return !predicate.apply(this, args);
  10596. };
  10597. }
  10598. /**
  10599. * Creates a function that is restricted to invoking `func` once. Repeat calls
  10600. * to the function return the value of the first invocation. The `func` is
  10601. * invoked with the `this` binding and arguments of the created function.
  10602. *
  10603. * @static
  10604. * @memberOf _
  10605. * @since 0.1.0
  10606. * @category Function
  10607. * @param {Function} func The function to restrict.
  10608. * @returns {Function} Returns the new restricted function.
  10609. * @example
  10610. *
  10611. * var initialize = _.once(createApplication);
  10612. * initialize();
  10613. * initialize();
  10614. * // => `createApplication` is invoked once
  10615. */
  10616. function once(func) {
  10617. return before(2, func);
  10618. }
  10619. /**
  10620. * Creates a function that invokes `func` with its arguments transformed.
  10621. *
  10622. * @static
  10623. * @since 4.0.0
  10624. * @memberOf _
  10625. * @category Function
  10626. * @param {Function} func The function to wrap.
  10627. * @param {...(Function|Function[])} [transforms=[_.identity]]
  10628. * The argument transforms.
  10629. * @returns {Function} Returns the new function.
  10630. * @example
  10631. *
  10632. * function doubled(n) {
  10633. * return n * 2;
  10634. * }
  10635. *
  10636. * function square(n) {
  10637. * return n * n;
  10638. * }
  10639. *
  10640. * var func = _.overArgs(function(x, y) {
  10641. * return [x, y];
  10642. * }, [square, doubled]);
  10643. *
  10644. * func(9, 3);
  10645. * // => [81, 6]
  10646. *
  10647. * func(10, 5);
  10648. * // => [100, 10]
  10649. */
  10650. var overArgs = castRest(function(func, transforms) {
  10651. transforms = (transforms.length == 1 && isArray(transforms[0]))
  10652. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  10653. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  10654. var funcsLength = transforms.length;
  10655. return baseRest(function(args) {
  10656. var index = -1,
  10657. length = nativeMin(args.length, funcsLength);
  10658. while (++index < length) {
  10659. args[index] = transforms[index].call(this, args[index]);
  10660. }
  10661. return apply(func, this, args);
  10662. });
  10663. });
  10664. /**
  10665. * Creates a function that invokes `func` with `partials` prepended to the
  10666. * arguments it receives. This method is like `_.bind` except it does **not**
  10667. * alter the `this` binding.
  10668. *
  10669. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  10670. * builds, may be used as a placeholder for partially applied arguments.
  10671. *
  10672. * **Note:** This method doesn't set the "length" property of partially
  10673. * applied functions.
  10674. *
  10675. * @static
  10676. * @memberOf _
  10677. * @since 0.2.0
  10678. * @category Function
  10679. * @param {Function} func The function to partially apply arguments to.
  10680. * @param {...*} [partials] The arguments to be partially applied.
  10681. * @returns {Function} Returns the new partially applied function.
  10682. * @example
  10683. *
  10684. * function greet(greeting, name) {
  10685. * return greeting + ' ' + name;
  10686. * }
  10687. *
  10688. * var sayHelloTo = _.partial(greet, 'hello');
  10689. * sayHelloTo('fred');
  10690. * // => 'hello fred'
  10691. *
  10692. * // Partially applied with placeholders.
  10693. * var greetFred = _.partial(greet, _, 'fred');
  10694. * greetFred('hi');
  10695. * // => 'hi fred'
  10696. */
  10697. var partial = baseRest(function(func, partials) {
  10698. var holders = replaceHolders(partials, getHolder(partial));
  10699. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  10700. });
  10701. /**
  10702. * This method is like `_.partial` except that partially applied arguments
  10703. * are appended to the arguments it receives.
  10704. *
  10705. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  10706. * builds, may be used as a placeholder for partially applied arguments.
  10707. *
  10708. * **Note:** This method doesn't set the "length" property of partially
  10709. * applied functions.
  10710. *
  10711. * @static
  10712. * @memberOf _
  10713. * @since 1.0.0
  10714. * @category Function
  10715. * @param {Function} func The function to partially apply arguments to.
  10716. * @param {...*} [partials] The arguments to be partially applied.
  10717. * @returns {Function} Returns the new partially applied function.
  10718. * @example
  10719. *
  10720. * function greet(greeting, name) {
  10721. * return greeting + ' ' + name;
  10722. * }
  10723. *
  10724. * var greetFred = _.partialRight(greet, 'fred');
  10725. * greetFred('hi');
  10726. * // => 'hi fred'
  10727. *
  10728. * // Partially applied with placeholders.
  10729. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  10730. * sayHelloTo('fred');
  10731. * // => 'hello fred'
  10732. */
  10733. var partialRight = baseRest(function(func, partials) {
  10734. var holders = replaceHolders(partials, getHolder(partialRight));
  10735. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  10736. });
  10737. /**
  10738. * Creates a function that invokes `func` with arguments arranged according
  10739. * to the specified `indexes` where the argument value at the first index is
  10740. * provided as the first argument, the argument value at the second index is
  10741. * provided as the second argument, and so on.
  10742. *
  10743. * @static
  10744. * @memberOf _
  10745. * @since 3.0.0
  10746. * @category Function
  10747. * @param {Function} func The function to rearrange arguments for.
  10748. * @param {...(number|number[])} indexes The arranged argument indexes.
  10749. * @returns {Function} Returns the new function.
  10750. * @example
  10751. *
  10752. * var rearged = _.rearg(function(a, b, c) {
  10753. * return [a, b, c];
  10754. * }, [2, 0, 1]);
  10755. *
  10756. * rearged('b', 'c', 'a')
  10757. * // => ['a', 'b', 'c']
  10758. */
  10759. var rearg = flatRest(function(func, indexes) {
  10760. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  10761. });
  10762. /**
  10763. * Creates a function that invokes `func` with the `this` binding of the
  10764. * created function and arguments from `start` and beyond provided as
  10765. * an array.
  10766. *
  10767. * **Note:** This method is based on the
  10768. * [rest parameter](https://mdn.io/rest_parameters).
  10769. *
  10770. * @static
  10771. * @memberOf _
  10772. * @since 4.0.0
  10773. * @category Function
  10774. * @param {Function} func The function to apply a rest parameter to.
  10775. * @param {number} [start=func.length-1] The start position of the rest parameter.
  10776. * @returns {Function} Returns the new function.
  10777. * @example
  10778. *
  10779. * var say = _.rest(function(what, names) {
  10780. * return what + ' ' + _.initial(names).join(', ') +
  10781. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  10782. * });
  10783. *
  10784. * say('hello', 'fred', 'barney', 'pebbles');
  10785. * // => 'hello fred, barney, & pebbles'
  10786. */
  10787. function rest(func, start) {
  10788. if (typeof func != 'function') {
  10789. throw new TypeError(FUNC_ERROR_TEXT);
  10790. }
  10791. start = start === undefined ? start : toInteger(start);
  10792. return baseRest(func, start);
  10793. }
  10794. /**
  10795. * Creates a function that invokes `func` with the `this` binding of the
  10796. * create function and an array of arguments much like
  10797. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  10798. *
  10799. * **Note:** This method is based on the
  10800. * [spread operator](https://mdn.io/spread_operator).
  10801. *
  10802. * @static
  10803. * @memberOf _
  10804. * @since 3.2.0
  10805. * @category Function
  10806. * @param {Function} func The function to spread arguments over.
  10807. * @param {number} [start=0] The start position of the spread.
  10808. * @returns {Function} Returns the new function.
  10809. * @example
  10810. *
  10811. * var say = _.spread(function(who, what) {
  10812. * return who + ' says ' + what;
  10813. * });
  10814. *
  10815. * say(['fred', 'hello']);
  10816. * // => 'fred says hello'
  10817. *
  10818. * var numbers = Promise.all([
  10819. * Promise.resolve(40),
  10820. * Promise.resolve(36)
  10821. * ]);
  10822. *
  10823. * numbers.then(_.spread(function(x, y) {
  10824. * return x + y;
  10825. * }));
  10826. * // => a Promise of 76
  10827. */
  10828. function spread(func, start) {
  10829. if (typeof func != 'function') {
  10830. throw new TypeError(FUNC_ERROR_TEXT);
  10831. }
  10832. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  10833. return baseRest(function(args) {
  10834. var array = args[start],
  10835. otherArgs = castSlice(args, 0, start);
  10836. if (array) {
  10837. arrayPush(otherArgs, array);
  10838. }
  10839. return apply(func, this, otherArgs);
  10840. });
  10841. }
  10842. /**
  10843. * Creates a throttled function that only invokes `func` at most once per
  10844. * every `wait` milliseconds. The throttled function comes with a `cancel`
  10845. * method to cancel delayed `func` invocations and a `flush` method to
  10846. * immediately invoke them. Provide `options` to indicate whether `func`
  10847. * should be invoked on the leading and/or trailing edge of the `wait`
  10848. * timeout. The `func` is invoked with the last arguments provided to the
  10849. * throttled function. Subsequent calls to the throttled function return the
  10850. * result of the last `func` invocation.
  10851. *
  10852. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10853. * invoked on the trailing edge of the timeout only if the throttled function
  10854. * is invoked more than once during the `wait` timeout.
  10855. *
  10856. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10857. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10858. *
  10859. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10860. * for details over the differences between `_.throttle` and `_.debounce`.
  10861. *
  10862. * @static
  10863. * @memberOf _
  10864. * @since 0.1.0
  10865. * @category Function
  10866. * @param {Function} func The function to throttle.
  10867. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  10868. * @param {Object} [options={}] The options object.
  10869. * @param {boolean} [options.leading=true]
  10870. * Specify invoking on the leading edge of the timeout.
  10871. * @param {boolean} [options.trailing=true]
  10872. * Specify invoking on the trailing edge of the timeout.
  10873. * @returns {Function} Returns the new throttled function.
  10874. * @example
  10875. *
  10876. * // Avoid excessively updating the position while scrolling.
  10877. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  10878. *
  10879. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  10880. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  10881. * jQuery(element).on('click', throttled);
  10882. *
  10883. * // Cancel the trailing throttled invocation.
  10884. * jQuery(window).on('popstate', throttled.cancel);
  10885. */
  10886. function throttle(func, wait, options) {
  10887. var leading = true,
  10888. trailing = true;
  10889. if (typeof func != 'function') {
  10890. throw new TypeError(FUNC_ERROR_TEXT);
  10891. }
  10892. if (isObject(options)) {
  10893. leading = 'leading' in options ? !!options.leading : leading;
  10894. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10895. }
  10896. return debounce(func, wait, {
  10897. 'leading': leading,
  10898. 'maxWait': wait,
  10899. 'trailing': trailing
  10900. });
  10901. }
  10902. /**
  10903. * Creates a function that accepts up to one argument, ignoring any
  10904. * additional arguments.
  10905. *
  10906. * @static
  10907. * @memberOf _
  10908. * @since 4.0.0
  10909. * @category Function
  10910. * @param {Function} func The function to cap arguments for.
  10911. * @returns {Function} Returns the new capped function.
  10912. * @example
  10913. *
  10914. * _.map(['6', '8', '10'], _.unary(parseInt));
  10915. * // => [6, 8, 10]
  10916. */
  10917. function unary(func) {
  10918. return ary(func, 1);
  10919. }
  10920. /**
  10921. * Creates a function that provides `value` to `wrapper` as its first
  10922. * argument. Any additional arguments provided to the function are appended
  10923. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  10924. * binding of the created function.
  10925. *
  10926. * @static
  10927. * @memberOf _
  10928. * @since 0.1.0
  10929. * @category Function
  10930. * @param {*} value The value to wrap.
  10931. * @param {Function} [wrapper=identity] The wrapper function.
  10932. * @returns {Function} Returns the new function.
  10933. * @example
  10934. *
  10935. * var p = _.wrap(_.escape, function(func, text) {
  10936. * return '<p>' + func(text) + '</p>';
  10937. * });
  10938. *
  10939. * p('fred, barney, & pebbles');
  10940. * // => '<p>fred, barney, &amp; pebbles</p>'
  10941. */
  10942. function wrap(value, wrapper) {
  10943. return partial(castFunction(wrapper), value);
  10944. }
  10945. /*------------------------------------------------------------------------*/
  10946. /**
  10947. * Casts `value` as an array if it's not one.
  10948. *
  10949. * @static
  10950. * @memberOf _
  10951. * @since 4.4.0
  10952. * @category Lang
  10953. * @param {*} value The value to inspect.
  10954. * @returns {Array} Returns the cast array.
  10955. * @example
  10956. *
  10957. * _.castArray(1);
  10958. * // => [1]
  10959. *
  10960. * _.castArray({ 'a': 1 });
  10961. * // => [{ 'a': 1 }]
  10962. *
  10963. * _.castArray('abc');
  10964. * // => ['abc']
  10965. *
  10966. * _.castArray(null);
  10967. * // => [null]
  10968. *
  10969. * _.castArray(undefined);
  10970. * // => [undefined]
  10971. *
  10972. * _.castArray();
  10973. * // => []
  10974. *
  10975. * var array = [1, 2, 3];
  10976. * console.log(_.castArray(array) === array);
  10977. * // => true
  10978. */
  10979. function castArray() {
  10980. if (!arguments.length) {
  10981. return [];
  10982. }
  10983. var value = arguments[0];
  10984. return isArray(value) ? value : [value];
  10985. }
  10986. /**
  10987. * Creates a shallow clone of `value`.
  10988. *
  10989. * **Note:** This method is loosely based on the
  10990. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  10991. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  10992. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  10993. * arrays. The own enumerable properties of `arguments` objects are cloned
  10994. * as plain objects. An empty object is returned for uncloneable values such
  10995. * as error objects, functions, DOM nodes, and WeakMaps.
  10996. *
  10997. * @static
  10998. * @memberOf _
  10999. * @since 0.1.0
  11000. * @category Lang
  11001. * @param {*} value The value to clone.
  11002. * @returns {*} Returns the cloned value.
  11003. * @see _.cloneDeep
  11004. * @example
  11005. *
  11006. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11007. *
  11008. * var shallow = _.clone(objects);
  11009. * console.log(shallow[0] === objects[0]);
  11010. * // => true
  11011. */
  11012. function clone(value) {
  11013. return baseClone(value, CLONE_SYMBOLS_FLAG);
  11014. }
  11015. /**
  11016. * This method is like `_.clone` except that it accepts `customizer` which
  11017. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  11018. * cloning is handled by the method instead. The `customizer` is invoked with
  11019. * up to four arguments; (value [, index|key, object, stack]).
  11020. *
  11021. * @static
  11022. * @memberOf _
  11023. * @since 4.0.0
  11024. * @category Lang
  11025. * @param {*} value The value to clone.
  11026. * @param {Function} [customizer] The function to customize cloning.
  11027. * @returns {*} Returns the cloned value.
  11028. * @see _.cloneDeepWith
  11029. * @example
  11030. *
  11031. * function customizer(value) {
  11032. * if (_.isElement(value)) {
  11033. * return value.cloneNode(false);
  11034. * }
  11035. * }
  11036. *
  11037. * var el = _.cloneWith(document.body, customizer);
  11038. *
  11039. * console.log(el === document.body);
  11040. * // => false
  11041. * console.log(el.nodeName);
  11042. * // => 'BODY'
  11043. * console.log(el.childNodes.length);
  11044. * // => 0
  11045. */
  11046. function cloneWith(value, customizer) {
  11047. customizer = typeof customizer == 'function' ? customizer : undefined;
  11048. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  11049. }
  11050. /**
  11051. * This method is like `_.clone` except that it recursively clones `value`.
  11052. *
  11053. * @static
  11054. * @memberOf _
  11055. * @since 1.0.0
  11056. * @category Lang
  11057. * @param {*} value The value to recursively clone.
  11058. * @returns {*} Returns the deep cloned value.
  11059. * @see _.clone
  11060. * @example
  11061. *
  11062. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11063. *
  11064. * var deep = _.cloneDeep(objects);
  11065. * console.log(deep[0] === objects[0]);
  11066. * // => false
  11067. */
  11068. function cloneDeep(value) {
  11069. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  11070. }
  11071. /**
  11072. * This method is like `_.cloneWith` except that it recursively clones `value`.
  11073. *
  11074. * @static
  11075. * @memberOf _
  11076. * @since 4.0.0
  11077. * @category Lang
  11078. * @param {*} value The value to recursively clone.
  11079. * @param {Function} [customizer] The function to customize cloning.
  11080. * @returns {*} Returns the deep cloned value.
  11081. * @see _.cloneWith
  11082. * @example
  11083. *
  11084. * function customizer(value) {
  11085. * if (_.isElement(value)) {
  11086. * return value.cloneNode(true);
  11087. * }
  11088. * }
  11089. *
  11090. * var el = _.cloneDeepWith(document.body, customizer);
  11091. *
  11092. * console.log(el === document.body);
  11093. * // => false
  11094. * console.log(el.nodeName);
  11095. * // => 'BODY'
  11096. * console.log(el.childNodes.length);
  11097. * // => 20
  11098. */
  11099. function cloneDeepWith(value, customizer) {
  11100. customizer = typeof customizer == 'function' ? customizer : undefined;
  11101. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  11102. }
  11103. /**
  11104. * Checks if `object` conforms to `source` by invoking the predicate
  11105. * properties of `source` with the corresponding property values of `object`.
  11106. *
  11107. * **Note:** This method is equivalent to `_.conforms` when `source` is
  11108. * partially applied.
  11109. *
  11110. * @static
  11111. * @memberOf _
  11112. * @since 4.14.0
  11113. * @category Lang
  11114. * @param {Object} object The object to inspect.
  11115. * @param {Object} source The object of property predicates to conform to.
  11116. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11117. * @example
  11118. *
  11119. * var object = { 'a': 1, 'b': 2 };
  11120. *
  11121. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  11122. * // => true
  11123. *
  11124. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  11125. * // => false
  11126. */
  11127. function conformsTo(object, source) {
  11128. return source == null || baseConformsTo(object, source, keys(source));
  11129. }
  11130. /**
  11131. * Performs a
  11132. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11133. * comparison between two values to determine if they are equivalent.
  11134. *
  11135. * @static
  11136. * @memberOf _
  11137. * @since 4.0.0
  11138. * @category Lang
  11139. * @param {*} value The value to compare.
  11140. * @param {*} other The other value to compare.
  11141. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11142. * @example
  11143. *
  11144. * var object = { 'a': 1 };
  11145. * var other = { 'a': 1 };
  11146. *
  11147. * _.eq(object, object);
  11148. * // => true
  11149. *
  11150. * _.eq(object, other);
  11151. * // => false
  11152. *
  11153. * _.eq('a', 'a');
  11154. * // => true
  11155. *
  11156. * _.eq('a', Object('a'));
  11157. * // => false
  11158. *
  11159. * _.eq(NaN, NaN);
  11160. * // => true
  11161. */
  11162. function eq(value, other) {
  11163. return value === other || (value !== value && other !== other);
  11164. }
  11165. /**
  11166. * Checks if `value` is greater than `other`.
  11167. *
  11168. * @static
  11169. * @memberOf _
  11170. * @since 3.9.0
  11171. * @category Lang
  11172. * @param {*} value The value to compare.
  11173. * @param {*} other The other value to compare.
  11174. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11175. * else `false`.
  11176. * @see _.lt
  11177. * @example
  11178. *
  11179. * _.gt(3, 1);
  11180. * // => true
  11181. *
  11182. * _.gt(3, 3);
  11183. * // => false
  11184. *
  11185. * _.gt(1, 3);
  11186. * // => false
  11187. */
  11188. var gt = createRelationalOperation(baseGt);
  11189. /**
  11190. * Checks if `value` is greater than or equal to `other`.
  11191. *
  11192. * @static
  11193. * @memberOf _
  11194. * @since 3.9.0
  11195. * @category Lang
  11196. * @param {*} value The value to compare.
  11197. * @param {*} other The other value to compare.
  11198. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  11199. * `other`, else `false`.
  11200. * @see _.lte
  11201. * @example
  11202. *
  11203. * _.gte(3, 1);
  11204. * // => true
  11205. *
  11206. * _.gte(3, 3);
  11207. * // => true
  11208. *
  11209. * _.gte(1, 3);
  11210. * // => false
  11211. */
  11212. var gte = createRelationalOperation(function(value, other) {
  11213. return value >= other;
  11214. });
  11215. /**
  11216. * Checks if `value` is likely an `arguments` object.
  11217. *
  11218. * @static
  11219. * @memberOf _
  11220. * @since 0.1.0
  11221. * @category Lang
  11222. * @param {*} value The value to check.
  11223. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11224. * else `false`.
  11225. * @example
  11226. *
  11227. * _.isArguments(function() { return arguments; }());
  11228. * // => true
  11229. *
  11230. * _.isArguments([1, 2, 3]);
  11231. * // => false
  11232. */
  11233. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  11234. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  11235. !propertyIsEnumerable.call(value, 'callee');
  11236. };
  11237. /**
  11238. * Checks if `value` is classified as an `Array` object.
  11239. *
  11240. * @static
  11241. * @memberOf _
  11242. * @since 0.1.0
  11243. * @category Lang
  11244. * @param {*} value The value to check.
  11245. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  11246. * @example
  11247. *
  11248. * _.isArray([1, 2, 3]);
  11249. * // => true
  11250. *
  11251. * _.isArray(document.body.children);
  11252. * // => false
  11253. *
  11254. * _.isArray('abc');
  11255. * // => false
  11256. *
  11257. * _.isArray(_.noop);
  11258. * // => false
  11259. */
  11260. var isArray = Array.isArray;
  11261. /**
  11262. * Checks if `value` is classified as an `ArrayBuffer` object.
  11263. *
  11264. * @static
  11265. * @memberOf _
  11266. * @since 4.3.0
  11267. * @category Lang
  11268. * @param {*} value The value to check.
  11269. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  11270. * @example
  11271. *
  11272. * _.isArrayBuffer(new ArrayBuffer(2));
  11273. * // => true
  11274. *
  11275. * _.isArrayBuffer(new Array(2));
  11276. * // => false
  11277. */
  11278. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  11279. /**
  11280. * Checks if `value` is array-like. A value is considered array-like if it's
  11281. * not a function and has a `value.length` that's an integer greater than or
  11282. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  11283. *
  11284. * @static
  11285. * @memberOf _
  11286. * @since 4.0.0
  11287. * @category Lang
  11288. * @param {*} value The value to check.
  11289. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  11290. * @example
  11291. *
  11292. * _.isArrayLike([1, 2, 3]);
  11293. * // => true
  11294. *
  11295. * _.isArrayLike(document.body.children);
  11296. * // => true
  11297. *
  11298. * _.isArrayLike('abc');
  11299. * // => true
  11300. *
  11301. * _.isArrayLike(_.noop);
  11302. * // => false
  11303. */
  11304. function isArrayLike(value) {
  11305. return value != null && isLength(value.length) && !isFunction(value);
  11306. }
  11307. /**
  11308. * This method is like `_.isArrayLike` except that it also checks if `value`
  11309. * is an object.
  11310. *
  11311. * @static
  11312. * @memberOf _
  11313. * @since 4.0.0
  11314. * @category Lang
  11315. * @param {*} value The value to check.
  11316. * @returns {boolean} Returns `true` if `value` is an array-like object,
  11317. * else `false`.
  11318. * @example
  11319. *
  11320. * _.isArrayLikeObject([1, 2, 3]);
  11321. * // => true
  11322. *
  11323. * _.isArrayLikeObject(document.body.children);
  11324. * // => true
  11325. *
  11326. * _.isArrayLikeObject('abc');
  11327. * // => false
  11328. *
  11329. * _.isArrayLikeObject(_.noop);
  11330. * // => false
  11331. */
  11332. function isArrayLikeObject(value) {
  11333. return isObjectLike(value) && isArrayLike(value);
  11334. }
  11335. /**
  11336. * Checks if `value` is classified as a boolean primitive or object.
  11337. *
  11338. * @static
  11339. * @memberOf _
  11340. * @since 0.1.0
  11341. * @category Lang
  11342. * @param {*} value The value to check.
  11343. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  11344. * @example
  11345. *
  11346. * _.isBoolean(false);
  11347. * // => true
  11348. *
  11349. * _.isBoolean(null);
  11350. * // => false
  11351. */
  11352. function isBoolean(value) {
  11353. return value === true || value === false ||
  11354. (isObjectLike(value) && baseGetTag(value) == boolTag);
  11355. }
  11356. /**
  11357. * Checks if `value` is a buffer.
  11358. *
  11359. * @static
  11360. * @memberOf _
  11361. * @since 4.3.0
  11362. * @category Lang
  11363. * @param {*} value The value to check.
  11364. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  11365. * @example
  11366. *
  11367. * _.isBuffer(new Buffer(2));
  11368. * // => true
  11369. *
  11370. * _.isBuffer(new Uint8Array(2));
  11371. * // => false
  11372. */
  11373. var isBuffer = nativeIsBuffer || stubFalse;
  11374. /**
  11375. * Checks if `value` is classified as a `Date` object.
  11376. *
  11377. * @static
  11378. * @memberOf _
  11379. * @since 0.1.0
  11380. * @category Lang
  11381. * @param {*} value The value to check.
  11382. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  11383. * @example
  11384. *
  11385. * _.isDate(new Date);
  11386. * // => true
  11387. *
  11388. * _.isDate('Mon April 23 2012');
  11389. * // => false
  11390. */
  11391. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  11392. /**
  11393. * Checks if `value` is likely a DOM element.
  11394. *
  11395. * @static
  11396. * @memberOf _
  11397. * @since 0.1.0
  11398. * @category Lang
  11399. * @param {*} value The value to check.
  11400. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  11401. * @example
  11402. *
  11403. * _.isElement(document.body);
  11404. * // => true
  11405. *
  11406. * _.isElement('<body>');
  11407. * // => false
  11408. */
  11409. function isElement(value) {
  11410. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  11411. }
  11412. /**
  11413. * Checks if `value` is an empty object, collection, map, or set.
  11414. *
  11415. * Objects are considered empty if they have no own enumerable string keyed
  11416. * properties.
  11417. *
  11418. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  11419. * jQuery-like collections are considered empty if they have a `length` of `0`.
  11420. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  11421. *
  11422. * @static
  11423. * @memberOf _
  11424. * @since 0.1.0
  11425. * @category Lang
  11426. * @param {*} value The value to check.
  11427. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  11428. * @example
  11429. *
  11430. * _.isEmpty(null);
  11431. * // => true
  11432. *
  11433. * _.isEmpty(true);
  11434. * // => true
  11435. *
  11436. * _.isEmpty(1);
  11437. * // => true
  11438. *
  11439. * _.isEmpty([1, 2, 3]);
  11440. * // => false
  11441. *
  11442. * _.isEmpty({ 'a': 1 });
  11443. * // => false
  11444. */
  11445. function isEmpty(value) {
  11446. if (value == null) {
  11447. return true;
  11448. }
  11449. if (isArrayLike(value) &&
  11450. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  11451. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  11452. return !value.length;
  11453. }
  11454. var tag = getTag(value);
  11455. if (tag == mapTag || tag == setTag) {
  11456. return !value.size;
  11457. }
  11458. if (isPrototype(value)) {
  11459. return !baseKeys(value).length;
  11460. }
  11461. for (var key in value) {
  11462. if (hasOwnProperty.call(value, key)) {
  11463. return false;
  11464. }
  11465. }
  11466. return true;
  11467. }
  11468. /**
  11469. * Performs a deep comparison between two values to determine if they are
  11470. * equivalent.
  11471. *
  11472. * **Note:** This method supports comparing arrays, array buffers, booleans,
  11473. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  11474. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  11475. * by their own, not inherited, enumerable properties. Functions and DOM
  11476. * nodes are compared by strict equality, i.e. `===`.
  11477. *
  11478. * @static
  11479. * @memberOf _
  11480. * @since 0.1.0
  11481. * @category Lang
  11482. * @param {*} value The value to compare.
  11483. * @param {*} other The other value to compare.
  11484. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11485. * @example
  11486. *
  11487. * var object = { 'a': 1 };
  11488. * var other = { 'a': 1 };
  11489. *
  11490. * _.isEqual(object, other);
  11491. * // => true
  11492. *
  11493. * object === other;
  11494. * // => false
  11495. */
  11496. function isEqual(value, other) {
  11497. return baseIsEqual(value, other);
  11498. }
  11499. /**
  11500. * This method is like `_.isEqual` except that it accepts `customizer` which
  11501. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11502. * are handled by the method instead. The `customizer` is invoked with up to
  11503. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  11504. *
  11505. * @static
  11506. * @memberOf _
  11507. * @since 4.0.0
  11508. * @category Lang
  11509. * @param {*} value The value to compare.
  11510. * @param {*} other The other value to compare.
  11511. * @param {Function} [customizer] The function to customize comparisons.
  11512. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11513. * @example
  11514. *
  11515. * function isGreeting(value) {
  11516. * return /^h(?:i|ello)$/.test(value);
  11517. * }
  11518. *
  11519. * function customizer(objValue, othValue) {
  11520. * if (isGreeting(objValue) && isGreeting(othValue)) {
  11521. * return true;
  11522. * }
  11523. * }
  11524. *
  11525. * var array = ['hello', 'goodbye'];
  11526. * var other = ['hi', 'goodbye'];
  11527. *
  11528. * _.isEqualWith(array, other, customizer);
  11529. * // => true
  11530. */
  11531. function isEqualWith(value, other, customizer) {
  11532. customizer = typeof customizer == 'function' ? customizer : undefined;
  11533. var result = customizer ? customizer(value, other) : undefined;
  11534. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  11535. }
  11536. /**
  11537. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  11538. * `SyntaxError`, `TypeError`, or `URIError` object.
  11539. *
  11540. * @static
  11541. * @memberOf _
  11542. * @since 3.0.0
  11543. * @category Lang
  11544. * @param {*} value The value to check.
  11545. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  11546. * @example
  11547. *
  11548. * _.isError(new Error);
  11549. * // => true
  11550. *
  11551. * _.isError(Error);
  11552. * // => false
  11553. */
  11554. function isError(value) {
  11555. if (!isObjectLike(value)) {
  11556. return false;
  11557. }
  11558. var tag = baseGetTag(value);
  11559. return tag == errorTag || tag == domExcTag ||
  11560. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  11561. }
  11562. /**
  11563. * Checks if `value` is a finite primitive number.
  11564. *
  11565. * **Note:** This method is based on
  11566. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  11567. *
  11568. * @static
  11569. * @memberOf _
  11570. * @since 0.1.0
  11571. * @category Lang
  11572. * @param {*} value The value to check.
  11573. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  11574. * @example
  11575. *
  11576. * _.isFinite(3);
  11577. * // => true
  11578. *
  11579. * _.isFinite(Number.MIN_VALUE);
  11580. * // => true
  11581. *
  11582. * _.isFinite(Infinity);
  11583. * // => false
  11584. *
  11585. * _.isFinite('3');
  11586. * // => false
  11587. */
  11588. function isFinite(value) {
  11589. return typeof value == 'number' && nativeIsFinite(value);
  11590. }
  11591. /**
  11592. * Checks if `value` is classified as a `Function` object.
  11593. *
  11594. * @static
  11595. * @memberOf _
  11596. * @since 0.1.0
  11597. * @category Lang
  11598. * @param {*} value The value to check.
  11599. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  11600. * @example
  11601. *
  11602. * _.isFunction(_);
  11603. * // => true
  11604. *
  11605. * _.isFunction(/abc/);
  11606. * // => false
  11607. */
  11608. function isFunction(value) {
  11609. if (!isObject(value)) {
  11610. return false;
  11611. }
  11612. // The use of `Object#toString` avoids issues with the `typeof` operator
  11613. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  11614. var tag = baseGetTag(value);
  11615. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  11616. }
  11617. /**
  11618. * Checks if `value` is an integer.
  11619. *
  11620. * **Note:** This method is based on
  11621. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  11622. *
  11623. * @static
  11624. * @memberOf _
  11625. * @since 4.0.0
  11626. * @category Lang
  11627. * @param {*} value The value to check.
  11628. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  11629. * @example
  11630. *
  11631. * _.isInteger(3);
  11632. * // => true
  11633. *
  11634. * _.isInteger(Number.MIN_VALUE);
  11635. * // => false
  11636. *
  11637. * _.isInteger(Infinity);
  11638. * // => false
  11639. *
  11640. * _.isInteger('3');
  11641. * // => false
  11642. */
  11643. function isInteger(value) {
  11644. return typeof value == 'number' && value == toInteger(value);
  11645. }
  11646. /**
  11647. * Checks if `value` is a valid array-like length.
  11648. *
  11649. * **Note:** This method is loosely based on
  11650. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  11651. *
  11652. * @static
  11653. * @memberOf _
  11654. * @since 4.0.0
  11655. * @category Lang
  11656. * @param {*} value The value to check.
  11657. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  11658. * @example
  11659. *
  11660. * _.isLength(3);
  11661. * // => true
  11662. *
  11663. * _.isLength(Number.MIN_VALUE);
  11664. * // => false
  11665. *
  11666. * _.isLength(Infinity);
  11667. * // => false
  11668. *
  11669. * _.isLength('3');
  11670. * // => false
  11671. */
  11672. function isLength(value) {
  11673. return typeof value == 'number' &&
  11674. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  11675. }
  11676. /**
  11677. * Checks if `value` is the
  11678. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  11679. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  11680. *
  11681. * @static
  11682. * @memberOf _
  11683. * @since 0.1.0
  11684. * @category Lang
  11685. * @param {*} value The value to check.
  11686. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  11687. * @example
  11688. *
  11689. * _.isObject({});
  11690. * // => true
  11691. *
  11692. * _.isObject([1, 2, 3]);
  11693. * // => true
  11694. *
  11695. * _.isObject(_.noop);
  11696. * // => true
  11697. *
  11698. * _.isObject(null);
  11699. * // => false
  11700. */
  11701. function isObject(value) {
  11702. var type = typeof value;
  11703. return value != null && (type == 'object' || type == 'function');
  11704. }
  11705. /**
  11706. * Checks if `value` is object-like. A value is object-like if it's not `null`
  11707. * and has a `typeof` result of "object".
  11708. *
  11709. * @static
  11710. * @memberOf _
  11711. * @since 4.0.0
  11712. * @category Lang
  11713. * @param {*} value The value to check.
  11714. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  11715. * @example
  11716. *
  11717. * _.isObjectLike({});
  11718. * // => true
  11719. *
  11720. * _.isObjectLike([1, 2, 3]);
  11721. * // => true
  11722. *
  11723. * _.isObjectLike(_.noop);
  11724. * // => false
  11725. *
  11726. * _.isObjectLike(null);
  11727. * // => false
  11728. */
  11729. function isObjectLike(value) {
  11730. return value != null && typeof value == 'object';
  11731. }
  11732. /**
  11733. * Checks if `value` is classified as a `Map` object.
  11734. *
  11735. * @static
  11736. * @memberOf _
  11737. * @since 4.3.0
  11738. * @category Lang
  11739. * @param {*} value The value to check.
  11740. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  11741. * @example
  11742. *
  11743. * _.isMap(new Map);
  11744. * // => true
  11745. *
  11746. * _.isMap(new WeakMap);
  11747. * // => false
  11748. */
  11749. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  11750. /**
  11751. * Performs a partial deep comparison between `object` and `source` to
  11752. * determine if `object` contains equivalent property values.
  11753. *
  11754. * **Note:** This method is equivalent to `_.matches` when `source` is
  11755. * partially applied.
  11756. *
  11757. * Partial comparisons will match empty array and empty object `source`
  11758. * values against any array or object value, respectively. See `_.isEqual`
  11759. * for a list of supported value comparisons.
  11760. *
  11761. * @static
  11762. * @memberOf _
  11763. * @since 3.0.0
  11764. * @category Lang
  11765. * @param {Object} object The object to inspect.
  11766. * @param {Object} source The object of property values to match.
  11767. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11768. * @example
  11769. *
  11770. * var object = { 'a': 1, 'b': 2 };
  11771. *
  11772. * _.isMatch(object, { 'b': 2 });
  11773. * // => true
  11774. *
  11775. * _.isMatch(object, { 'b': 1 });
  11776. * // => false
  11777. */
  11778. function isMatch(object, source) {
  11779. return object === source || baseIsMatch(object, source, getMatchData(source));
  11780. }
  11781. /**
  11782. * This method is like `_.isMatch` except that it accepts `customizer` which
  11783. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11784. * are handled by the method instead. The `customizer` is invoked with five
  11785. * arguments: (objValue, srcValue, index|key, object, source).
  11786. *
  11787. * @static
  11788. * @memberOf _
  11789. * @since 4.0.0
  11790. * @category Lang
  11791. * @param {Object} object The object to inspect.
  11792. * @param {Object} source The object of property values to match.
  11793. * @param {Function} [customizer] The function to customize comparisons.
  11794. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11795. * @example
  11796. *
  11797. * function isGreeting(value) {
  11798. * return /^h(?:i|ello)$/.test(value);
  11799. * }
  11800. *
  11801. * function customizer(objValue, srcValue) {
  11802. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  11803. * return true;
  11804. * }
  11805. * }
  11806. *
  11807. * var object = { 'greeting': 'hello' };
  11808. * var source = { 'greeting': 'hi' };
  11809. *
  11810. * _.isMatchWith(object, source, customizer);
  11811. * // => true
  11812. */
  11813. function isMatchWith(object, source, customizer) {
  11814. customizer = typeof customizer == 'function' ? customizer : undefined;
  11815. return baseIsMatch(object, source, getMatchData(source), customizer);
  11816. }
  11817. /**
  11818. * Checks if `value` is `NaN`.
  11819. *
  11820. * **Note:** This method is based on
  11821. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  11822. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  11823. * `undefined` and other non-number values.
  11824. *
  11825. * @static
  11826. * @memberOf _
  11827. * @since 0.1.0
  11828. * @category Lang
  11829. * @param {*} value The value to check.
  11830. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  11831. * @example
  11832. *
  11833. * _.isNaN(NaN);
  11834. * // => true
  11835. *
  11836. * _.isNaN(new Number(NaN));
  11837. * // => true
  11838. *
  11839. * isNaN(undefined);
  11840. * // => true
  11841. *
  11842. * _.isNaN(undefined);
  11843. * // => false
  11844. */
  11845. function isNaN(value) {
  11846. // An `NaN` primitive is the only value that is not equal to itself.
  11847. // Perform the `toStringTag` check first to avoid errors with some
  11848. // ActiveX objects in IE.
  11849. return isNumber(value) && value != +value;
  11850. }
  11851. /**
  11852. * Checks if `value` is a pristine native function.
  11853. *
  11854. * **Note:** This method can't reliably detect native functions in the presence
  11855. * of the core-js package because core-js circumvents this kind of detection.
  11856. * Despite multiple requests, the core-js maintainer has made it clear: any
  11857. * attempt to fix the detection will be obstructed. As a result, we're left
  11858. * with little choice but to throw an error. Unfortunately, this also affects
  11859. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  11860. * which rely on core-js.
  11861. *
  11862. * @static
  11863. * @memberOf _
  11864. * @since 3.0.0
  11865. * @category Lang
  11866. * @param {*} value The value to check.
  11867. * @returns {boolean} Returns `true` if `value` is a native function,
  11868. * else `false`.
  11869. * @example
  11870. *
  11871. * _.isNative(Array.prototype.push);
  11872. * // => true
  11873. *
  11874. * _.isNative(_);
  11875. * // => false
  11876. */
  11877. function isNative(value) {
  11878. if (isMaskable(value)) {
  11879. throw new Error(CORE_ERROR_TEXT);
  11880. }
  11881. return baseIsNative(value);
  11882. }
  11883. /**
  11884. * Checks if `value` is `null`.
  11885. *
  11886. * @static
  11887. * @memberOf _
  11888. * @since 0.1.0
  11889. * @category Lang
  11890. * @param {*} value The value to check.
  11891. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  11892. * @example
  11893. *
  11894. * _.isNull(null);
  11895. * // => true
  11896. *
  11897. * _.isNull(void 0);
  11898. * // => false
  11899. */
  11900. function isNull(value) {
  11901. return value === null;
  11902. }
  11903. /**
  11904. * Checks if `value` is `null` or `undefined`.
  11905. *
  11906. * @static
  11907. * @memberOf _
  11908. * @since 4.0.0
  11909. * @category Lang
  11910. * @param {*} value The value to check.
  11911. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  11912. * @example
  11913. *
  11914. * _.isNil(null);
  11915. * // => true
  11916. *
  11917. * _.isNil(void 0);
  11918. * // => true
  11919. *
  11920. * _.isNil(NaN);
  11921. * // => false
  11922. */
  11923. function isNil(value) {
  11924. return value == null;
  11925. }
  11926. /**
  11927. * Checks if `value` is classified as a `Number` primitive or object.
  11928. *
  11929. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  11930. * classified as numbers, use the `_.isFinite` method.
  11931. *
  11932. * @static
  11933. * @memberOf _
  11934. * @since 0.1.0
  11935. * @category Lang
  11936. * @param {*} value The value to check.
  11937. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  11938. * @example
  11939. *
  11940. * _.isNumber(3);
  11941. * // => true
  11942. *
  11943. * _.isNumber(Number.MIN_VALUE);
  11944. * // => true
  11945. *
  11946. * _.isNumber(Infinity);
  11947. * // => true
  11948. *
  11949. * _.isNumber('3');
  11950. * // => false
  11951. */
  11952. function isNumber(value) {
  11953. return typeof value == 'number' ||
  11954. (isObjectLike(value) && baseGetTag(value) == numberTag);
  11955. }
  11956. /**
  11957. * Checks if `value` is a plain object, that is, an object created by the
  11958. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  11959. *
  11960. * @static
  11961. * @memberOf _
  11962. * @since 0.8.0
  11963. * @category Lang
  11964. * @param {*} value The value to check.
  11965. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  11966. * @example
  11967. *
  11968. * function Foo() {
  11969. * this.a = 1;
  11970. * }
  11971. *
  11972. * _.isPlainObject(new Foo);
  11973. * // => false
  11974. *
  11975. * _.isPlainObject([1, 2, 3]);
  11976. * // => false
  11977. *
  11978. * _.isPlainObject({ 'x': 0, 'y': 0 });
  11979. * // => true
  11980. *
  11981. * _.isPlainObject(Object.create(null));
  11982. * // => true
  11983. */
  11984. function isPlainObject(value) {
  11985. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  11986. return false;
  11987. }
  11988. var proto = getPrototype(value);
  11989. if (proto === null) {
  11990. return true;
  11991. }
  11992. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  11993. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  11994. funcToString.call(Ctor) == objectCtorString;
  11995. }
  11996. /**
  11997. * Checks if `value` is classified as a `RegExp` object.
  11998. *
  11999. * @static
  12000. * @memberOf _
  12001. * @since 0.1.0
  12002. * @category Lang
  12003. * @param {*} value The value to check.
  12004. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12005. * @example
  12006. *
  12007. * _.isRegExp(/abc/);
  12008. * // => true
  12009. *
  12010. * _.isRegExp('/abc/');
  12011. * // => false
  12012. */
  12013. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  12014. /**
  12015. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  12016. * double precision number which isn't the result of a rounded unsafe integer.
  12017. *
  12018. * **Note:** This method is based on
  12019. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  12020. *
  12021. * @static
  12022. * @memberOf _
  12023. * @since 4.0.0
  12024. * @category Lang
  12025. * @param {*} value The value to check.
  12026. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  12027. * @example
  12028. *
  12029. * _.isSafeInteger(3);
  12030. * // => true
  12031. *
  12032. * _.isSafeInteger(Number.MIN_VALUE);
  12033. * // => false
  12034. *
  12035. * _.isSafeInteger(Infinity);
  12036. * // => false
  12037. *
  12038. * _.isSafeInteger('3');
  12039. * // => false
  12040. */
  12041. function isSafeInteger(value) {
  12042. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  12043. }
  12044. /**
  12045. * Checks if `value` is classified as a `Set` object.
  12046. *
  12047. * @static
  12048. * @memberOf _
  12049. * @since 4.3.0
  12050. * @category Lang
  12051. * @param {*} value The value to check.
  12052. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12053. * @example
  12054. *
  12055. * _.isSet(new Set);
  12056. * // => true
  12057. *
  12058. * _.isSet(new WeakSet);
  12059. * // => false
  12060. */
  12061. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  12062. /**
  12063. * Checks if `value` is classified as a `String` primitive or object.
  12064. *
  12065. * @static
  12066. * @since 0.1.0
  12067. * @memberOf _
  12068. * @category Lang
  12069. * @param {*} value The value to check.
  12070. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  12071. * @example
  12072. *
  12073. * _.isString('abc');
  12074. * // => true
  12075. *
  12076. * _.isString(1);
  12077. * // => false
  12078. */
  12079. function isString(value) {
  12080. return typeof value == 'string' ||
  12081. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  12082. }
  12083. /**
  12084. * Checks if `value` is classified as a `Symbol` primitive or object.
  12085. *
  12086. * @static
  12087. * @memberOf _
  12088. * @since 4.0.0
  12089. * @category Lang
  12090. * @param {*} value The value to check.
  12091. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12092. * @example
  12093. *
  12094. * _.isSymbol(Symbol.iterator);
  12095. * // => true
  12096. *
  12097. * _.isSymbol('abc');
  12098. * // => false
  12099. */
  12100. function isSymbol(value) {
  12101. return typeof value == 'symbol' ||
  12102. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  12103. }
  12104. /**
  12105. * Checks if `value` is classified as a typed array.
  12106. *
  12107. * @static
  12108. * @memberOf _
  12109. * @since 3.0.0
  12110. * @category Lang
  12111. * @param {*} value The value to check.
  12112. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12113. * @example
  12114. *
  12115. * _.isTypedArray(new Uint8Array);
  12116. * // => true
  12117. *
  12118. * _.isTypedArray([]);
  12119. * // => false
  12120. */
  12121. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  12122. /**
  12123. * Checks if `value` is `undefined`.
  12124. *
  12125. * @static
  12126. * @since 0.1.0
  12127. * @memberOf _
  12128. * @category Lang
  12129. * @param {*} value The value to check.
  12130. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  12131. * @example
  12132. *
  12133. * _.isUndefined(void 0);
  12134. * // => true
  12135. *
  12136. * _.isUndefined(null);
  12137. * // => false
  12138. */
  12139. function isUndefined(value) {
  12140. return value === undefined;
  12141. }
  12142. /**
  12143. * Checks if `value` is classified as a `WeakMap` object.
  12144. *
  12145. * @static
  12146. * @memberOf _
  12147. * @since 4.3.0
  12148. * @category Lang
  12149. * @param {*} value The value to check.
  12150. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  12151. * @example
  12152. *
  12153. * _.isWeakMap(new WeakMap);
  12154. * // => true
  12155. *
  12156. * _.isWeakMap(new Map);
  12157. * // => false
  12158. */
  12159. function isWeakMap(value) {
  12160. return isObjectLike(value) && getTag(value) == weakMapTag;
  12161. }
  12162. /**
  12163. * Checks if `value` is classified as a `WeakSet` object.
  12164. *
  12165. * @static
  12166. * @memberOf _
  12167. * @since 4.3.0
  12168. * @category Lang
  12169. * @param {*} value The value to check.
  12170. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  12171. * @example
  12172. *
  12173. * _.isWeakSet(new WeakSet);
  12174. * // => true
  12175. *
  12176. * _.isWeakSet(new Set);
  12177. * // => false
  12178. */
  12179. function isWeakSet(value) {
  12180. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  12181. }
  12182. /**
  12183. * Checks if `value` is less than `other`.
  12184. *
  12185. * @static
  12186. * @memberOf _
  12187. * @since 3.9.0
  12188. * @category Lang
  12189. * @param {*} value The value to compare.
  12190. * @param {*} other The other value to compare.
  12191. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12192. * else `false`.
  12193. * @see _.gt
  12194. * @example
  12195. *
  12196. * _.lt(1, 3);
  12197. * // => true
  12198. *
  12199. * _.lt(3, 3);
  12200. * // => false
  12201. *
  12202. * _.lt(3, 1);
  12203. * // => false
  12204. */
  12205. var lt = createRelationalOperation(baseLt);
  12206. /**
  12207. * Checks if `value` is less than or equal to `other`.
  12208. *
  12209. * @static
  12210. * @memberOf _
  12211. * @since 3.9.0
  12212. * @category Lang
  12213. * @param {*} value The value to compare.
  12214. * @param {*} other The other value to compare.
  12215. * @returns {boolean} Returns `true` if `value` is less than or equal to
  12216. * `other`, else `false`.
  12217. * @see _.gte
  12218. * @example
  12219. *
  12220. * _.lte(1, 3);
  12221. * // => true
  12222. *
  12223. * _.lte(3, 3);
  12224. * // => true
  12225. *
  12226. * _.lte(3, 1);
  12227. * // => false
  12228. */
  12229. var lte = createRelationalOperation(function(value, other) {
  12230. return value <= other;
  12231. });
  12232. /**
  12233. * Converts `value` to an array.
  12234. *
  12235. * @static
  12236. * @since 0.1.0
  12237. * @memberOf _
  12238. * @category Lang
  12239. * @param {*} value The value to convert.
  12240. * @returns {Array} Returns the converted array.
  12241. * @example
  12242. *
  12243. * _.toArray({ 'a': 1, 'b': 2 });
  12244. * // => [1, 2]
  12245. *
  12246. * _.toArray('abc');
  12247. * // => ['a', 'b', 'c']
  12248. *
  12249. * _.toArray(1);
  12250. * // => []
  12251. *
  12252. * _.toArray(null);
  12253. * // => []
  12254. */
  12255. function toArray(value) {
  12256. if (!value) {
  12257. return [];
  12258. }
  12259. if (isArrayLike(value)) {
  12260. return isString(value) ? stringToArray(value) : copyArray(value);
  12261. }
  12262. if (symIterator && value[symIterator]) {
  12263. return iteratorToArray(value[symIterator]());
  12264. }
  12265. var tag = getTag(value),
  12266. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  12267. return func(value);
  12268. }
  12269. /**
  12270. * Converts `value` to a finite number.
  12271. *
  12272. * @static
  12273. * @memberOf _
  12274. * @since 4.12.0
  12275. * @category Lang
  12276. * @param {*} value The value to convert.
  12277. * @returns {number} Returns the converted number.
  12278. * @example
  12279. *
  12280. * _.toFinite(3.2);
  12281. * // => 3.2
  12282. *
  12283. * _.toFinite(Number.MIN_VALUE);
  12284. * // => 5e-324
  12285. *
  12286. * _.toFinite(Infinity);
  12287. * // => 1.7976931348623157e+308
  12288. *
  12289. * _.toFinite('3.2');
  12290. * // => 3.2
  12291. */
  12292. function toFinite(value) {
  12293. if (!value) {
  12294. return value === 0 ? value : 0;
  12295. }
  12296. value = toNumber(value);
  12297. if (value === INFINITY || value === -INFINITY) {
  12298. var sign = (value < 0 ? -1 : 1);
  12299. return sign * MAX_INTEGER;
  12300. }
  12301. return value === value ? value : 0;
  12302. }
  12303. /**
  12304. * Converts `value` to an integer.
  12305. *
  12306. * **Note:** This method is loosely based on
  12307. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  12308. *
  12309. * @static
  12310. * @memberOf _
  12311. * @since 4.0.0
  12312. * @category Lang
  12313. * @param {*} value The value to convert.
  12314. * @returns {number} Returns the converted integer.
  12315. * @example
  12316. *
  12317. * _.toInteger(3.2);
  12318. * // => 3
  12319. *
  12320. * _.toInteger(Number.MIN_VALUE);
  12321. * // => 0
  12322. *
  12323. * _.toInteger(Infinity);
  12324. * // => 1.7976931348623157e+308
  12325. *
  12326. * _.toInteger('3.2');
  12327. * // => 3
  12328. */
  12329. function toInteger(value) {
  12330. var result = toFinite(value),
  12331. remainder = result % 1;
  12332. return result === result ? (remainder ? result - remainder : result) : 0;
  12333. }
  12334. /**
  12335. * Converts `value` to an integer suitable for use as the length of an
  12336. * array-like object.
  12337. *
  12338. * **Note:** This method is based on
  12339. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12340. *
  12341. * @static
  12342. * @memberOf _
  12343. * @since 4.0.0
  12344. * @category Lang
  12345. * @param {*} value The value to convert.
  12346. * @returns {number} Returns the converted integer.
  12347. * @example
  12348. *
  12349. * _.toLength(3.2);
  12350. * // => 3
  12351. *
  12352. * _.toLength(Number.MIN_VALUE);
  12353. * // => 0
  12354. *
  12355. * _.toLength(Infinity);
  12356. * // => 4294967295
  12357. *
  12358. * _.toLength('3.2');
  12359. * // => 3
  12360. */
  12361. function toLength(value) {
  12362. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  12363. }
  12364. /**
  12365. * Converts `value` to a number.
  12366. *
  12367. * @static
  12368. * @memberOf _
  12369. * @since 4.0.0
  12370. * @category Lang
  12371. * @param {*} value The value to process.
  12372. * @returns {number} Returns the number.
  12373. * @example
  12374. *
  12375. * _.toNumber(3.2);
  12376. * // => 3.2
  12377. *
  12378. * _.toNumber(Number.MIN_VALUE);
  12379. * // => 5e-324
  12380. *
  12381. * _.toNumber(Infinity);
  12382. * // => Infinity
  12383. *
  12384. * _.toNumber('3.2');
  12385. * // => 3.2
  12386. */
  12387. function toNumber(value) {
  12388. if (typeof value == 'number') {
  12389. return value;
  12390. }
  12391. if (isSymbol(value)) {
  12392. return NAN;
  12393. }
  12394. if (isObject(value)) {
  12395. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  12396. value = isObject(other) ? (other + '') : other;
  12397. }
  12398. if (typeof value != 'string') {
  12399. return value === 0 ? value : +value;
  12400. }
  12401. value = value.replace(reTrim, '');
  12402. var isBinary = reIsBinary.test(value);
  12403. return (isBinary || reIsOctal.test(value))
  12404. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  12405. : (reIsBadHex.test(value) ? NAN : +value);
  12406. }
  12407. /**
  12408. * Converts `value` to a plain object flattening inherited enumerable string
  12409. * keyed properties of `value` to own properties of the plain object.
  12410. *
  12411. * @static
  12412. * @memberOf _
  12413. * @since 3.0.0
  12414. * @category Lang
  12415. * @param {*} value The value to convert.
  12416. * @returns {Object} Returns the converted plain object.
  12417. * @example
  12418. *
  12419. * function Foo() {
  12420. * this.b = 2;
  12421. * }
  12422. *
  12423. * Foo.prototype.c = 3;
  12424. *
  12425. * _.assign({ 'a': 1 }, new Foo);
  12426. * // => { 'a': 1, 'b': 2 }
  12427. *
  12428. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  12429. * // => { 'a': 1, 'b': 2, 'c': 3 }
  12430. */
  12431. function toPlainObject(value) {
  12432. return copyObject(value, keysIn(value));
  12433. }
  12434. /**
  12435. * Converts `value` to a safe integer. A safe integer can be compared and
  12436. * represented correctly.
  12437. *
  12438. * @static
  12439. * @memberOf _
  12440. * @since 4.0.0
  12441. * @category Lang
  12442. * @param {*} value The value to convert.
  12443. * @returns {number} Returns the converted integer.
  12444. * @example
  12445. *
  12446. * _.toSafeInteger(3.2);
  12447. * // => 3
  12448. *
  12449. * _.toSafeInteger(Number.MIN_VALUE);
  12450. * // => 0
  12451. *
  12452. * _.toSafeInteger(Infinity);
  12453. * // => 9007199254740991
  12454. *
  12455. * _.toSafeInteger('3.2');
  12456. * // => 3
  12457. */
  12458. function toSafeInteger(value) {
  12459. return value
  12460. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  12461. : (value === 0 ? value : 0);
  12462. }
  12463. /**
  12464. * Converts `value` to a string. An empty string is returned for `null`
  12465. * and `undefined` values. The sign of `-0` is preserved.
  12466. *
  12467. * @static
  12468. * @memberOf _
  12469. * @since 4.0.0
  12470. * @category Lang
  12471. * @param {*} value The value to convert.
  12472. * @returns {string} Returns the converted string.
  12473. * @example
  12474. *
  12475. * _.toString(null);
  12476. * // => ''
  12477. *
  12478. * _.toString(-0);
  12479. * // => '-0'
  12480. *
  12481. * _.toString([1, 2, 3]);
  12482. * // => '1,2,3'
  12483. */
  12484. function toString(value) {
  12485. return value == null ? '' : baseToString(value);
  12486. }
  12487. /*------------------------------------------------------------------------*/
  12488. /**
  12489. * Assigns own enumerable string keyed properties of source objects to the
  12490. * destination object. Source objects are applied from left to right.
  12491. * Subsequent sources overwrite property assignments of previous sources.
  12492. *
  12493. * **Note:** This method mutates `object` and is loosely based on
  12494. * [`Object.assign`](https://mdn.io/Object/assign).
  12495. *
  12496. * @static
  12497. * @memberOf _
  12498. * @since 0.10.0
  12499. * @category Object
  12500. * @param {Object} object The destination object.
  12501. * @param {...Object} [sources] The source objects.
  12502. * @returns {Object} Returns `object`.
  12503. * @see _.assignIn
  12504. * @example
  12505. *
  12506. * function Foo() {
  12507. * this.a = 1;
  12508. * }
  12509. *
  12510. * function Bar() {
  12511. * this.c = 3;
  12512. * }
  12513. *
  12514. * Foo.prototype.b = 2;
  12515. * Bar.prototype.d = 4;
  12516. *
  12517. * _.assign({ 'a': 0 }, new Foo, new Bar);
  12518. * // => { 'a': 1, 'c': 3 }
  12519. */
  12520. var assign = createAssigner(function(object, source) {
  12521. if (isPrototype(source) || isArrayLike(source)) {
  12522. copyObject(source, keys(source), object);
  12523. return;
  12524. }
  12525. for (var key in source) {
  12526. if (hasOwnProperty.call(source, key)) {
  12527. assignValue(object, key, source[key]);
  12528. }
  12529. }
  12530. });
  12531. /**
  12532. * This method is like `_.assign` except that it iterates over own and
  12533. * inherited source properties.
  12534. *
  12535. * **Note:** This method mutates `object`.
  12536. *
  12537. * @static
  12538. * @memberOf _
  12539. * @since 4.0.0
  12540. * @alias extend
  12541. * @category Object
  12542. * @param {Object} object The destination object.
  12543. * @param {...Object} [sources] The source objects.
  12544. * @returns {Object} Returns `object`.
  12545. * @see _.assign
  12546. * @example
  12547. *
  12548. * function Foo() {
  12549. * this.a = 1;
  12550. * }
  12551. *
  12552. * function Bar() {
  12553. * this.c = 3;
  12554. * }
  12555. *
  12556. * Foo.prototype.b = 2;
  12557. * Bar.prototype.d = 4;
  12558. *
  12559. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  12560. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  12561. */
  12562. var assignIn = createAssigner(function(object, source) {
  12563. copyObject(source, keysIn(source), object);
  12564. });
  12565. /**
  12566. * This method is like `_.assignIn` except that it accepts `customizer`
  12567. * which is invoked to produce the assigned values. If `customizer` returns
  12568. * `undefined`, assignment is handled by the method instead. The `customizer`
  12569. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12570. *
  12571. * **Note:** This method mutates `object`.
  12572. *
  12573. * @static
  12574. * @memberOf _
  12575. * @since 4.0.0
  12576. * @alias extendWith
  12577. * @category Object
  12578. * @param {Object} object The destination object.
  12579. * @param {...Object} sources The source objects.
  12580. * @param {Function} [customizer] The function to customize assigned values.
  12581. * @returns {Object} Returns `object`.
  12582. * @see _.assignWith
  12583. * @example
  12584. *
  12585. * function customizer(objValue, srcValue) {
  12586. * return _.isUndefined(objValue) ? srcValue : objValue;
  12587. * }
  12588. *
  12589. * var defaults = _.partialRight(_.assignInWith, customizer);
  12590. *
  12591. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12592. * // => { 'a': 1, 'b': 2 }
  12593. */
  12594. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  12595. copyObject(source, keysIn(source), object, customizer);
  12596. });
  12597. /**
  12598. * This method is like `_.assign` except that it accepts `customizer`
  12599. * which is invoked to produce the assigned values. If `customizer` returns
  12600. * `undefined`, assignment is handled by the method instead. The `customizer`
  12601. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12602. *
  12603. * **Note:** This method mutates `object`.
  12604. *
  12605. * @static
  12606. * @memberOf _
  12607. * @since 4.0.0
  12608. * @category Object
  12609. * @param {Object} object The destination object.
  12610. * @param {...Object} sources The source objects.
  12611. * @param {Function} [customizer] The function to customize assigned values.
  12612. * @returns {Object} Returns `object`.
  12613. * @see _.assignInWith
  12614. * @example
  12615. *
  12616. * function customizer(objValue, srcValue) {
  12617. * return _.isUndefined(objValue) ? srcValue : objValue;
  12618. * }
  12619. *
  12620. * var defaults = _.partialRight(_.assignWith, customizer);
  12621. *
  12622. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12623. * // => { 'a': 1, 'b': 2 }
  12624. */
  12625. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  12626. copyObject(source, keys(source), object, customizer);
  12627. });
  12628. /**
  12629. * Creates an array of values corresponding to `paths` of `object`.
  12630. *
  12631. * @static
  12632. * @memberOf _
  12633. * @since 1.0.0
  12634. * @category Object
  12635. * @param {Object} object The object to iterate over.
  12636. * @param {...(string|string[])} [paths] The property paths to pick.
  12637. * @returns {Array} Returns the picked values.
  12638. * @example
  12639. *
  12640. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  12641. *
  12642. * _.at(object, ['a[0].b.c', 'a[1]']);
  12643. * // => [3, 4]
  12644. */
  12645. var at = flatRest(baseAt);
  12646. /**
  12647. * Creates an object that inherits from the `prototype` object. If a
  12648. * `properties` object is given, its own enumerable string keyed properties
  12649. * are assigned to the created object.
  12650. *
  12651. * @static
  12652. * @memberOf _
  12653. * @since 2.3.0
  12654. * @category Object
  12655. * @param {Object} prototype The object to inherit from.
  12656. * @param {Object} [properties] The properties to assign to the object.
  12657. * @returns {Object} Returns the new object.
  12658. * @example
  12659. *
  12660. * function Shape() {
  12661. * this.x = 0;
  12662. * this.y = 0;
  12663. * }
  12664. *
  12665. * function Circle() {
  12666. * Shape.call(this);
  12667. * }
  12668. *
  12669. * Circle.prototype = _.create(Shape.prototype, {
  12670. * 'constructor': Circle
  12671. * });
  12672. *
  12673. * var circle = new Circle;
  12674. * circle instanceof Circle;
  12675. * // => true
  12676. *
  12677. * circle instanceof Shape;
  12678. * // => true
  12679. */
  12680. function create(prototype, properties) {
  12681. var result = baseCreate(prototype);
  12682. return properties == null ? result : baseAssign(result, properties);
  12683. }
  12684. /**
  12685. * Assigns own and inherited enumerable string keyed properties of source
  12686. * objects to the destination object for all destination properties that
  12687. * resolve to `undefined`. Source objects are applied from left to right.
  12688. * Once a property is set, additional values of the same property are ignored.
  12689. *
  12690. * **Note:** This method mutates `object`.
  12691. *
  12692. * @static
  12693. * @since 0.1.0
  12694. * @memberOf _
  12695. * @category Object
  12696. * @param {Object} object The destination object.
  12697. * @param {...Object} [sources] The source objects.
  12698. * @returns {Object} Returns `object`.
  12699. * @see _.defaultsDeep
  12700. * @example
  12701. *
  12702. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12703. * // => { 'a': 1, 'b': 2 }
  12704. */
  12705. var defaults = baseRest(function(args) {
  12706. args.push(undefined, customDefaultsAssignIn);
  12707. return apply(assignInWith, undefined, args);
  12708. });
  12709. /**
  12710. * This method is like `_.defaults` except that it recursively assigns
  12711. * default properties.
  12712. *
  12713. * **Note:** This method mutates `object`.
  12714. *
  12715. * @static
  12716. * @memberOf _
  12717. * @since 3.10.0
  12718. * @category Object
  12719. * @param {Object} object The destination object.
  12720. * @param {...Object} [sources] The source objects.
  12721. * @returns {Object} Returns `object`.
  12722. * @see _.defaults
  12723. * @example
  12724. *
  12725. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  12726. * // => { 'a': { 'b': 2, 'c': 3 } }
  12727. */
  12728. var defaultsDeep = baseRest(function(args) {
  12729. args.push(undefined, customDefaultsMerge);
  12730. return apply(mergeWith, undefined, args);
  12731. });
  12732. /**
  12733. * This method is like `_.find` except that it returns the key of the first
  12734. * element `predicate` returns truthy for instead of the element itself.
  12735. *
  12736. * @static
  12737. * @memberOf _
  12738. * @since 1.1.0
  12739. * @category Object
  12740. * @param {Object} object The object to inspect.
  12741. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12742. * @returns {string|undefined} Returns the key of the matched element,
  12743. * else `undefined`.
  12744. * @example
  12745. *
  12746. * var users = {
  12747. * 'barney': { 'age': 36, 'active': true },
  12748. * 'fred': { 'age': 40, 'active': false },
  12749. * 'pebbles': { 'age': 1, 'active': true }
  12750. * };
  12751. *
  12752. * _.findKey(users, function(o) { return o.age < 40; });
  12753. * // => 'barney' (iteration order is not guaranteed)
  12754. *
  12755. * // The `_.matches` iteratee shorthand.
  12756. * _.findKey(users, { 'age': 1, 'active': true });
  12757. * // => 'pebbles'
  12758. *
  12759. * // The `_.matchesProperty` iteratee shorthand.
  12760. * _.findKey(users, ['active', false]);
  12761. * // => 'fred'
  12762. *
  12763. * // The `_.property` iteratee shorthand.
  12764. * _.findKey(users, 'active');
  12765. * // => 'barney'
  12766. */
  12767. function findKey(object, predicate) {
  12768. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  12769. }
  12770. /**
  12771. * This method is like `_.findKey` except that it iterates over elements of
  12772. * a collection in the opposite order.
  12773. *
  12774. * @static
  12775. * @memberOf _
  12776. * @since 2.0.0
  12777. * @category Object
  12778. * @param {Object} object The object to inspect.
  12779. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12780. * @returns {string|undefined} Returns the key of the matched element,
  12781. * else `undefined`.
  12782. * @example
  12783. *
  12784. * var users = {
  12785. * 'barney': { 'age': 36, 'active': true },
  12786. * 'fred': { 'age': 40, 'active': false },
  12787. * 'pebbles': { 'age': 1, 'active': true }
  12788. * };
  12789. *
  12790. * _.findLastKey(users, function(o) { return o.age < 40; });
  12791. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  12792. *
  12793. * // The `_.matches` iteratee shorthand.
  12794. * _.findLastKey(users, { 'age': 36, 'active': true });
  12795. * // => 'barney'
  12796. *
  12797. * // The `_.matchesProperty` iteratee shorthand.
  12798. * _.findLastKey(users, ['active', false]);
  12799. * // => 'fred'
  12800. *
  12801. * // The `_.property` iteratee shorthand.
  12802. * _.findLastKey(users, 'active');
  12803. * // => 'pebbles'
  12804. */
  12805. function findLastKey(object, predicate) {
  12806. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  12807. }
  12808. /**
  12809. * Iterates over own and inherited enumerable string keyed properties of an
  12810. * object and invokes `iteratee` for each property. The iteratee is invoked
  12811. * with three arguments: (value, key, object). Iteratee functions may exit
  12812. * iteration early by explicitly returning `false`.
  12813. *
  12814. * @static
  12815. * @memberOf _
  12816. * @since 0.3.0
  12817. * @category Object
  12818. * @param {Object} object The object to iterate over.
  12819. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12820. * @returns {Object} Returns `object`.
  12821. * @see _.forInRight
  12822. * @example
  12823. *
  12824. * function Foo() {
  12825. * this.a = 1;
  12826. * this.b = 2;
  12827. * }
  12828. *
  12829. * Foo.prototype.c = 3;
  12830. *
  12831. * _.forIn(new Foo, function(value, key) {
  12832. * console.log(key);
  12833. * });
  12834. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  12835. */
  12836. function forIn(object, iteratee) {
  12837. return object == null
  12838. ? object
  12839. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  12840. }
  12841. /**
  12842. * This method is like `_.forIn` except that it iterates over properties of
  12843. * `object` in the opposite order.
  12844. *
  12845. * @static
  12846. * @memberOf _
  12847. * @since 2.0.0
  12848. * @category Object
  12849. * @param {Object} object The object to iterate over.
  12850. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12851. * @returns {Object} Returns `object`.
  12852. * @see _.forIn
  12853. * @example
  12854. *
  12855. * function Foo() {
  12856. * this.a = 1;
  12857. * this.b = 2;
  12858. * }
  12859. *
  12860. * Foo.prototype.c = 3;
  12861. *
  12862. * _.forInRight(new Foo, function(value, key) {
  12863. * console.log(key);
  12864. * });
  12865. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  12866. */
  12867. function forInRight(object, iteratee) {
  12868. return object == null
  12869. ? object
  12870. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  12871. }
  12872. /**
  12873. * Iterates over own enumerable string keyed properties of an object and
  12874. * invokes `iteratee` for each property. The iteratee is invoked with three
  12875. * arguments: (value, key, object). Iteratee functions may exit iteration
  12876. * early by explicitly returning `false`.
  12877. *
  12878. * @static
  12879. * @memberOf _
  12880. * @since 0.3.0
  12881. * @category Object
  12882. * @param {Object} object The object to iterate over.
  12883. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12884. * @returns {Object} Returns `object`.
  12885. * @see _.forOwnRight
  12886. * @example
  12887. *
  12888. * function Foo() {
  12889. * this.a = 1;
  12890. * this.b = 2;
  12891. * }
  12892. *
  12893. * Foo.prototype.c = 3;
  12894. *
  12895. * _.forOwn(new Foo, function(value, key) {
  12896. * console.log(key);
  12897. * });
  12898. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  12899. */
  12900. function forOwn(object, iteratee) {
  12901. return object && baseForOwn(object, getIteratee(iteratee, 3));
  12902. }
  12903. /**
  12904. * This method is like `_.forOwn` except that it iterates over properties of
  12905. * `object` in the opposite order.
  12906. *
  12907. * @static
  12908. * @memberOf _
  12909. * @since 2.0.0
  12910. * @category Object
  12911. * @param {Object} object The object to iterate over.
  12912. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12913. * @returns {Object} Returns `object`.
  12914. * @see _.forOwn
  12915. * @example
  12916. *
  12917. * function Foo() {
  12918. * this.a = 1;
  12919. * this.b = 2;
  12920. * }
  12921. *
  12922. * Foo.prototype.c = 3;
  12923. *
  12924. * _.forOwnRight(new Foo, function(value, key) {
  12925. * console.log(key);
  12926. * });
  12927. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  12928. */
  12929. function forOwnRight(object, iteratee) {
  12930. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  12931. }
  12932. /**
  12933. * Creates an array of function property names from own enumerable properties
  12934. * of `object`.
  12935. *
  12936. * @static
  12937. * @since 0.1.0
  12938. * @memberOf _
  12939. * @category Object
  12940. * @param {Object} object The object to inspect.
  12941. * @returns {Array} Returns the function names.
  12942. * @see _.functionsIn
  12943. * @example
  12944. *
  12945. * function Foo() {
  12946. * this.a = _.constant('a');
  12947. * this.b = _.constant('b');
  12948. * }
  12949. *
  12950. * Foo.prototype.c = _.constant('c');
  12951. *
  12952. * _.functions(new Foo);
  12953. * // => ['a', 'b']
  12954. */
  12955. function functions(object) {
  12956. return object == null ? [] : baseFunctions(object, keys(object));
  12957. }
  12958. /**
  12959. * Creates an array of function property names from own and inherited
  12960. * enumerable properties of `object`.
  12961. *
  12962. * @static
  12963. * @memberOf _
  12964. * @since 4.0.0
  12965. * @category Object
  12966. * @param {Object} object The object to inspect.
  12967. * @returns {Array} Returns the function names.
  12968. * @see _.functions
  12969. * @example
  12970. *
  12971. * function Foo() {
  12972. * this.a = _.constant('a');
  12973. * this.b = _.constant('b');
  12974. * }
  12975. *
  12976. * Foo.prototype.c = _.constant('c');
  12977. *
  12978. * _.functionsIn(new Foo);
  12979. * // => ['a', 'b', 'c']
  12980. */
  12981. function functionsIn(object) {
  12982. return object == null ? [] : baseFunctions(object, keysIn(object));
  12983. }
  12984. /**
  12985. * Gets the value at `path` of `object`. If the resolved value is
  12986. * `undefined`, the `defaultValue` is returned in its place.
  12987. *
  12988. * @static
  12989. * @memberOf _
  12990. * @since 3.7.0
  12991. * @category Object
  12992. * @param {Object} object The object to query.
  12993. * @param {Array|string} path The path of the property to get.
  12994. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  12995. * @returns {*} Returns the resolved value.
  12996. * @example
  12997. *
  12998. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  12999. *
  13000. * _.get(object, 'a[0].b.c');
  13001. * // => 3
  13002. *
  13003. * _.get(object, ['a', '0', 'b', 'c']);
  13004. * // => 3
  13005. *
  13006. * _.get(object, 'a.b.c', 'default');
  13007. * // => 'default'
  13008. */
  13009. function get(object, path, defaultValue) {
  13010. var result = object == null ? undefined : baseGet(object, path);
  13011. return result === undefined ? defaultValue : result;
  13012. }
  13013. /**
  13014. * Checks if `path` is a direct property of `object`.
  13015. *
  13016. * @static
  13017. * @since 0.1.0
  13018. * @memberOf _
  13019. * @category Object
  13020. * @param {Object} object The object to query.
  13021. * @param {Array|string} path The path to check.
  13022. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13023. * @example
  13024. *
  13025. * var object = { 'a': { 'b': 2 } };
  13026. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  13027. *
  13028. * _.has(object, 'a');
  13029. * // => true
  13030. *
  13031. * _.has(object, 'a.b');
  13032. * // => true
  13033. *
  13034. * _.has(object, ['a', 'b']);
  13035. * // => true
  13036. *
  13037. * _.has(other, 'a');
  13038. * // => false
  13039. */
  13040. function has(object, path) {
  13041. return object != null && hasPath(object, path, baseHas);
  13042. }
  13043. /**
  13044. * Checks if `path` is a direct or inherited property of `object`.
  13045. *
  13046. * @static
  13047. * @memberOf _
  13048. * @since 4.0.0
  13049. * @category Object
  13050. * @param {Object} object The object to query.
  13051. * @param {Array|string} path The path to check.
  13052. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13053. * @example
  13054. *
  13055. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  13056. *
  13057. * _.hasIn(object, 'a');
  13058. * // => true
  13059. *
  13060. * _.hasIn(object, 'a.b');
  13061. * // => true
  13062. *
  13063. * _.hasIn(object, ['a', 'b']);
  13064. * // => true
  13065. *
  13066. * _.hasIn(object, 'b');
  13067. * // => false
  13068. */
  13069. function hasIn(object, path) {
  13070. return object != null && hasPath(object, path, baseHasIn);
  13071. }
  13072. /**
  13073. * Creates an object composed of the inverted keys and values of `object`.
  13074. * If `object` contains duplicate values, subsequent values overwrite
  13075. * property assignments of previous values.
  13076. *
  13077. * @static
  13078. * @memberOf _
  13079. * @since 0.7.0
  13080. * @category Object
  13081. * @param {Object} object The object to invert.
  13082. * @returns {Object} Returns the new inverted object.
  13083. * @example
  13084. *
  13085. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13086. *
  13087. * _.invert(object);
  13088. * // => { '1': 'c', '2': 'b' }
  13089. */
  13090. var invert = createInverter(function(result, value, key) {
  13091. result[value] = key;
  13092. }, constant(identity));
  13093. /**
  13094. * This method is like `_.invert` except that the inverted object is generated
  13095. * from the results of running each element of `object` thru `iteratee`. The
  13096. * corresponding inverted value of each inverted key is an array of keys
  13097. * responsible for generating the inverted value. The iteratee is invoked
  13098. * with one argument: (value).
  13099. *
  13100. * @static
  13101. * @memberOf _
  13102. * @since 4.1.0
  13103. * @category Object
  13104. * @param {Object} object The object to invert.
  13105. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  13106. * @returns {Object} Returns the new inverted object.
  13107. * @example
  13108. *
  13109. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13110. *
  13111. * _.invertBy(object);
  13112. * // => { '1': ['a', 'c'], '2': ['b'] }
  13113. *
  13114. * _.invertBy(object, function(value) {
  13115. * return 'group' + value;
  13116. * });
  13117. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  13118. */
  13119. var invertBy = createInverter(function(result, value, key) {
  13120. if (hasOwnProperty.call(result, value)) {
  13121. result[value].push(key);
  13122. } else {
  13123. result[value] = [key];
  13124. }
  13125. }, getIteratee);
  13126. /**
  13127. * Invokes the method at `path` of `object`.
  13128. *
  13129. * @static
  13130. * @memberOf _
  13131. * @since 4.0.0
  13132. * @category Object
  13133. * @param {Object} object The object to query.
  13134. * @param {Array|string} path The path of the method to invoke.
  13135. * @param {...*} [args] The arguments to invoke the method with.
  13136. * @returns {*} Returns the result of the invoked method.
  13137. * @example
  13138. *
  13139. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  13140. *
  13141. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  13142. * // => [2, 3]
  13143. */
  13144. var invoke = baseRest(baseInvoke);
  13145. /**
  13146. * Creates an array of the own enumerable property names of `object`.
  13147. *
  13148. * **Note:** Non-object values are coerced to objects. See the
  13149. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  13150. * for more details.
  13151. *
  13152. * @static
  13153. * @since 0.1.0
  13154. * @memberOf _
  13155. * @category Object
  13156. * @param {Object} object The object to query.
  13157. * @returns {Array} Returns the array of property names.
  13158. * @example
  13159. *
  13160. * function Foo() {
  13161. * this.a = 1;
  13162. * this.b = 2;
  13163. * }
  13164. *
  13165. * Foo.prototype.c = 3;
  13166. *
  13167. * _.keys(new Foo);
  13168. * // => ['a', 'b'] (iteration order is not guaranteed)
  13169. *
  13170. * _.keys('hi');
  13171. * // => ['0', '1']
  13172. */
  13173. function keys(object) {
  13174. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  13175. }
  13176. /**
  13177. * Creates an array of the own and inherited enumerable property names of `object`.
  13178. *
  13179. * **Note:** Non-object values are coerced to objects.
  13180. *
  13181. * @static
  13182. * @memberOf _
  13183. * @since 3.0.0
  13184. * @category Object
  13185. * @param {Object} object The object to query.
  13186. * @returns {Array} Returns the array of property names.
  13187. * @example
  13188. *
  13189. * function Foo() {
  13190. * this.a = 1;
  13191. * this.b = 2;
  13192. * }
  13193. *
  13194. * Foo.prototype.c = 3;
  13195. *
  13196. * _.keysIn(new Foo);
  13197. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  13198. */
  13199. function keysIn(object) {
  13200. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  13201. }
  13202. /**
  13203. * The opposite of `_.mapValues`; this method creates an object with the
  13204. * same values as `object` and keys generated by running each own enumerable
  13205. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  13206. * with three arguments: (value, key, object).
  13207. *
  13208. * @static
  13209. * @memberOf _
  13210. * @since 3.8.0
  13211. * @category Object
  13212. * @param {Object} object The object to iterate over.
  13213. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13214. * @returns {Object} Returns the new mapped object.
  13215. * @see _.mapValues
  13216. * @example
  13217. *
  13218. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  13219. * return key + value;
  13220. * });
  13221. * // => { 'a1': 1, 'b2': 2 }
  13222. */
  13223. function mapKeys(object, iteratee) {
  13224. var result = {};
  13225. iteratee = getIteratee(iteratee, 3);
  13226. baseForOwn(object, function(value, key, object) {
  13227. baseAssignValue(result, iteratee(value, key, object), value);
  13228. });
  13229. return result;
  13230. }
  13231. /**
  13232. * Creates an object with the same keys as `object` and values generated
  13233. * by running each own enumerable string keyed property of `object` thru
  13234. * `iteratee`. The iteratee is invoked with three arguments:
  13235. * (value, key, object).
  13236. *
  13237. * @static
  13238. * @memberOf _
  13239. * @since 2.4.0
  13240. * @category Object
  13241. * @param {Object} object The object to iterate over.
  13242. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13243. * @returns {Object} Returns the new mapped object.
  13244. * @see _.mapKeys
  13245. * @example
  13246. *
  13247. * var users = {
  13248. * 'fred': { 'user': 'fred', 'age': 40 },
  13249. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  13250. * };
  13251. *
  13252. * _.mapValues(users, function(o) { return o.age; });
  13253. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13254. *
  13255. * // The `_.property` iteratee shorthand.
  13256. * _.mapValues(users, 'age');
  13257. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13258. */
  13259. function mapValues(object, iteratee) {
  13260. var result = {};
  13261. iteratee = getIteratee(iteratee, 3);
  13262. baseForOwn(object, function(value, key, object) {
  13263. baseAssignValue(result, key, iteratee(value, key, object));
  13264. });
  13265. return result;
  13266. }
  13267. /**
  13268. * This method is like `_.assign` except that it recursively merges own and
  13269. * inherited enumerable string keyed properties of source objects into the
  13270. * destination object. Source properties that resolve to `undefined` are
  13271. * skipped if a destination value exists. Array and plain object properties
  13272. * are merged recursively. Other objects and value types are overridden by
  13273. * assignment. Source objects are applied from left to right. Subsequent
  13274. * sources overwrite property assignments of previous sources.
  13275. *
  13276. * **Note:** This method mutates `object`.
  13277. *
  13278. * @static
  13279. * @memberOf _
  13280. * @since 0.5.0
  13281. * @category Object
  13282. * @param {Object} object The destination object.
  13283. * @param {...Object} [sources] The source objects.
  13284. * @returns {Object} Returns `object`.
  13285. * @example
  13286. *
  13287. * var object = {
  13288. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  13289. * };
  13290. *
  13291. * var other = {
  13292. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  13293. * };
  13294. *
  13295. * _.merge(object, other);
  13296. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  13297. */
  13298. var merge = createAssigner(function(object, source, srcIndex) {
  13299. baseMerge(object, source, srcIndex);
  13300. });
  13301. /**
  13302. * This method is like `_.merge` except that it accepts `customizer` which
  13303. * is invoked to produce the merged values of the destination and source
  13304. * properties. If `customizer` returns `undefined`, merging is handled by the
  13305. * method instead. The `customizer` is invoked with six arguments:
  13306. * (objValue, srcValue, key, object, source, stack).
  13307. *
  13308. * **Note:** This method mutates `object`.
  13309. *
  13310. * @static
  13311. * @memberOf _
  13312. * @since 4.0.0
  13313. * @category Object
  13314. * @param {Object} object The destination object.
  13315. * @param {...Object} sources The source objects.
  13316. * @param {Function} customizer The function to customize assigned values.
  13317. * @returns {Object} Returns `object`.
  13318. * @example
  13319. *
  13320. * function customizer(objValue, srcValue) {
  13321. * if (_.isArray(objValue)) {
  13322. * return objValue.concat(srcValue);
  13323. * }
  13324. * }
  13325. *
  13326. * var object = { 'a': [1], 'b': [2] };
  13327. * var other = { 'a': [3], 'b': [4] };
  13328. *
  13329. * _.mergeWith(object, other, customizer);
  13330. * // => { 'a': [1, 3], 'b': [2, 4] }
  13331. */
  13332. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  13333. baseMerge(object, source, srcIndex, customizer);
  13334. });
  13335. /**
  13336. * The opposite of `_.pick`; this method creates an object composed of the
  13337. * own and inherited enumerable property paths of `object` that are not omitted.
  13338. *
  13339. * **Note:** This method is considerably slower than `_.pick`.
  13340. *
  13341. * @static
  13342. * @since 0.1.0
  13343. * @memberOf _
  13344. * @category Object
  13345. * @param {Object} object The source object.
  13346. * @param {...(string|string[])} [paths] The property paths to omit.
  13347. * @returns {Object} Returns the new object.
  13348. * @example
  13349. *
  13350. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13351. *
  13352. * _.omit(object, ['a', 'c']);
  13353. * // => { 'b': '2' }
  13354. */
  13355. var omit = flatRest(function(object, paths) {
  13356. var result = {};
  13357. if (object == null) {
  13358. return result;
  13359. }
  13360. var isDeep = false;
  13361. paths = arrayMap(paths, function(path) {
  13362. path = castPath(path, object);
  13363. isDeep || (isDeep = path.length > 1);
  13364. return path;
  13365. });
  13366. copyObject(object, getAllKeysIn(object), result);
  13367. if (isDeep) {
  13368. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  13369. }
  13370. var length = paths.length;
  13371. while (length--) {
  13372. baseUnset(result, paths[length]);
  13373. }
  13374. return result;
  13375. });
  13376. /**
  13377. * The opposite of `_.pickBy`; this method creates an object composed of
  13378. * the own and inherited enumerable string keyed properties of `object` that
  13379. * `predicate` doesn't return truthy for. The predicate is invoked with two
  13380. * arguments: (value, key).
  13381. *
  13382. * @static
  13383. * @memberOf _
  13384. * @since 4.0.0
  13385. * @category Object
  13386. * @param {Object} object The source object.
  13387. * @param {Function} [predicate=_.identity] The function invoked per property.
  13388. * @returns {Object} Returns the new object.
  13389. * @example
  13390. *
  13391. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13392. *
  13393. * _.omitBy(object, _.isNumber);
  13394. * // => { 'b': '2' }
  13395. */
  13396. function omitBy(object, predicate) {
  13397. return pickBy(object, negate(getIteratee(predicate)));
  13398. }
  13399. /**
  13400. * Creates an object composed of the picked `object` properties.
  13401. *
  13402. * @static
  13403. * @since 0.1.0
  13404. * @memberOf _
  13405. * @category Object
  13406. * @param {Object} object The source object.
  13407. * @param {...(string|string[])} [paths] The property paths to pick.
  13408. * @returns {Object} Returns the new object.
  13409. * @example
  13410. *
  13411. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13412. *
  13413. * _.pick(object, ['a', 'c']);
  13414. * // => { 'a': 1, 'c': 3 }
  13415. */
  13416. var pick = flatRest(function(object, paths) {
  13417. return object == null ? {} : basePick(object, paths);
  13418. });
  13419. /**
  13420. * Creates an object composed of the `object` properties `predicate` returns
  13421. * truthy for. The predicate is invoked with two arguments: (value, key).
  13422. *
  13423. * @static
  13424. * @memberOf _
  13425. * @since 4.0.0
  13426. * @category Object
  13427. * @param {Object} object The source object.
  13428. * @param {Function} [predicate=_.identity] The function invoked per property.
  13429. * @returns {Object} Returns the new object.
  13430. * @example
  13431. *
  13432. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13433. *
  13434. * _.pickBy(object, _.isNumber);
  13435. * // => { 'a': 1, 'c': 3 }
  13436. */
  13437. function pickBy(object, predicate) {
  13438. if (object == null) {
  13439. return {};
  13440. }
  13441. var props = arrayMap(getAllKeysIn(object), function(prop) {
  13442. return [prop];
  13443. });
  13444. predicate = getIteratee(predicate);
  13445. return basePickBy(object, props, function(value, path) {
  13446. return predicate(value, path[0]);
  13447. });
  13448. }
  13449. /**
  13450. * This method is like `_.get` except that if the resolved value is a
  13451. * function it's invoked with the `this` binding of its parent object and
  13452. * its result is returned.
  13453. *
  13454. * @static
  13455. * @since 0.1.0
  13456. * @memberOf _
  13457. * @category Object
  13458. * @param {Object} object The object to query.
  13459. * @param {Array|string} path The path of the property to resolve.
  13460. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13461. * @returns {*} Returns the resolved value.
  13462. * @example
  13463. *
  13464. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  13465. *
  13466. * _.result(object, 'a[0].b.c1');
  13467. * // => 3
  13468. *
  13469. * _.result(object, 'a[0].b.c2');
  13470. * // => 4
  13471. *
  13472. * _.result(object, 'a[0].b.c3', 'default');
  13473. * // => 'default'
  13474. *
  13475. * _.result(object, 'a[0].b.c3', _.constant('default'));
  13476. * // => 'default'
  13477. */
  13478. function result(object, path, defaultValue) {
  13479. path = castPath(path, object);
  13480. var index = -1,
  13481. length = path.length;
  13482. // Ensure the loop is entered when path is empty.
  13483. if (!length) {
  13484. length = 1;
  13485. object = undefined;
  13486. }
  13487. while (++index < length) {
  13488. var value = object == null ? undefined : object[toKey(path[index])];
  13489. if (value === undefined) {
  13490. index = length;
  13491. value = defaultValue;
  13492. }
  13493. object = isFunction(value) ? value.call(object) : value;
  13494. }
  13495. return object;
  13496. }
  13497. /**
  13498. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  13499. * it's created. Arrays are created for missing index properties while objects
  13500. * are created for all other missing properties. Use `_.setWith` to customize
  13501. * `path` creation.
  13502. *
  13503. * **Note:** This method mutates `object`.
  13504. *
  13505. * @static
  13506. * @memberOf _
  13507. * @since 3.7.0
  13508. * @category Object
  13509. * @param {Object} object The object to modify.
  13510. * @param {Array|string} path The path of the property to set.
  13511. * @param {*} value The value to set.
  13512. * @returns {Object} Returns `object`.
  13513. * @example
  13514. *
  13515. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13516. *
  13517. * _.set(object, 'a[0].b.c', 4);
  13518. * console.log(object.a[0].b.c);
  13519. * // => 4
  13520. *
  13521. * _.set(object, ['x', '0', 'y', 'z'], 5);
  13522. * console.log(object.x[0].y.z);
  13523. * // => 5
  13524. */
  13525. function set(object, path, value) {
  13526. return object == null ? object : baseSet(object, path, value);
  13527. }
  13528. /**
  13529. * This method is like `_.set` except that it accepts `customizer` which is
  13530. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13531. * path creation is handled by the method instead. The `customizer` is invoked
  13532. * with three arguments: (nsValue, key, nsObject).
  13533. *
  13534. * **Note:** This method mutates `object`.
  13535. *
  13536. * @static
  13537. * @memberOf _
  13538. * @since 4.0.0
  13539. * @category Object
  13540. * @param {Object} object The object to modify.
  13541. * @param {Array|string} path The path of the property to set.
  13542. * @param {*} value The value to set.
  13543. * @param {Function} [customizer] The function to customize assigned values.
  13544. * @returns {Object} Returns `object`.
  13545. * @example
  13546. *
  13547. * var object = {};
  13548. *
  13549. * _.setWith(object, '[0][1]', 'a', Object);
  13550. * // => { '0': { '1': 'a' } }
  13551. */
  13552. function setWith(object, path, value, customizer) {
  13553. customizer = typeof customizer == 'function' ? customizer : undefined;
  13554. return object == null ? object : baseSet(object, path, value, customizer);
  13555. }
  13556. /**
  13557. * Creates an array of own enumerable string keyed-value pairs for `object`
  13558. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  13559. * entries are returned.
  13560. *
  13561. * @static
  13562. * @memberOf _
  13563. * @since 4.0.0
  13564. * @alias entries
  13565. * @category Object
  13566. * @param {Object} object The object to query.
  13567. * @returns {Array} Returns the key-value pairs.
  13568. * @example
  13569. *
  13570. * function Foo() {
  13571. * this.a = 1;
  13572. * this.b = 2;
  13573. * }
  13574. *
  13575. * Foo.prototype.c = 3;
  13576. *
  13577. * _.toPairs(new Foo);
  13578. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  13579. */
  13580. var toPairs = createToPairs(keys);
  13581. /**
  13582. * Creates an array of own and inherited enumerable string keyed-value pairs
  13583. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  13584. * or set, its entries are returned.
  13585. *
  13586. * @static
  13587. * @memberOf _
  13588. * @since 4.0.0
  13589. * @alias entriesIn
  13590. * @category Object
  13591. * @param {Object} object The object to query.
  13592. * @returns {Array} Returns the key-value pairs.
  13593. * @example
  13594. *
  13595. * function Foo() {
  13596. * this.a = 1;
  13597. * this.b = 2;
  13598. * }
  13599. *
  13600. * Foo.prototype.c = 3;
  13601. *
  13602. * _.toPairsIn(new Foo);
  13603. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  13604. */
  13605. var toPairsIn = createToPairs(keysIn);
  13606. /**
  13607. * An alternative to `_.reduce`; this method transforms `object` to a new
  13608. * `accumulator` object which is the result of running each of its own
  13609. * enumerable string keyed properties thru `iteratee`, with each invocation
  13610. * potentially mutating the `accumulator` object. If `accumulator` is not
  13611. * provided, a new object with the same `[[Prototype]]` will be used. The
  13612. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  13613. * Iteratee functions may exit iteration early by explicitly returning `false`.
  13614. *
  13615. * @static
  13616. * @memberOf _
  13617. * @since 1.3.0
  13618. * @category Object
  13619. * @param {Object} object The object to iterate over.
  13620. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13621. * @param {*} [accumulator] The custom accumulator value.
  13622. * @returns {*} Returns the accumulated value.
  13623. * @example
  13624. *
  13625. * _.transform([2, 3, 4], function(result, n) {
  13626. * result.push(n *= n);
  13627. * return n % 2 == 0;
  13628. * }, []);
  13629. * // => [4, 9]
  13630. *
  13631. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  13632. * (result[value] || (result[value] = [])).push(key);
  13633. * }, {});
  13634. * // => { '1': ['a', 'c'], '2': ['b'] }
  13635. */
  13636. function transform(object, iteratee, accumulator) {
  13637. var isArr = isArray(object),
  13638. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  13639. iteratee = getIteratee(iteratee, 4);
  13640. if (accumulator == null) {
  13641. var Ctor = object && object.constructor;
  13642. if (isArrLike) {
  13643. accumulator = isArr ? new Ctor : [];
  13644. }
  13645. else if (isObject(object)) {
  13646. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  13647. }
  13648. else {
  13649. accumulator = {};
  13650. }
  13651. }
  13652. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  13653. return iteratee(accumulator, value, index, object);
  13654. });
  13655. return accumulator;
  13656. }
  13657. /**
  13658. * Removes the property at `path` of `object`.
  13659. *
  13660. * **Note:** This method mutates `object`.
  13661. *
  13662. * @static
  13663. * @memberOf _
  13664. * @since 4.0.0
  13665. * @category Object
  13666. * @param {Object} object The object to modify.
  13667. * @param {Array|string} path The path of the property to unset.
  13668. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  13669. * @example
  13670. *
  13671. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  13672. * _.unset(object, 'a[0].b.c');
  13673. * // => true
  13674. *
  13675. * console.log(object);
  13676. * // => { 'a': [{ 'b': {} }] };
  13677. *
  13678. * _.unset(object, ['a', '0', 'b', 'c']);
  13679. * // => true
  13680. *
  13681. * console.log(object);
  13682. * // => { 'a': [{ 'b': {} }] };
  13683. */
  13684. function unset(object, path) {
  13685. return object == null ? true : baseUnset(object, path);
  13686. }
  13687. /**
  13688. * This method is like `_.set` except that accepts `updater` to produce the
  13689. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  13690. * is invoked with one argument: (value).
  13691. *
  13692. * **Note:** This method mutates `object`.
  13693. *
  13694. * @static
  13695. * @memberOf _
  13696. * @since 4.6.0
  13697. * @category Object
  13698. * @param {Object} object The object to modify.
  13699. * @param {Array|string} path The path of the property to set.
  13700. * @param {Function} updater The function to produce the updated value.
  13701. * @returns {Object} Returns `object`.
  13702. * @example
  13703. *
  13704. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13705. *
  13706. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  13707. * console.log(object.a[0].b.c);
  13708. * // => 9
  13709. *
  13710. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  13711. * console.log(object.x[0].y.z);
  13712. * // => 0
  13713. */
  13714. function update(object, path, updater) {
  13715. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  13716. }
  13717. /**
  13718. * This method is like `_.update` except that it accepts `customizer` which is
  13719. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13720. * path creation is handled by the method instead. The `customizer` is invoked
  13721. * with three arguments: (nsValue, key, nsObject).
  13722. *
  13723. * **Note:** This method mutates `object`.
  13724. *
  13725. * @static
  13726. * @memberOf _
  13727. * @since 4.6.0
  13728. * @category Object
  13729. * @param {Object} object The object to modify.
  13730. * @param {Array|string} path The path of the property to set.
  13731. * @param {Function} updater The function to produce the updated value.
  13732. * @param {Function} [customizer] The function to customize assigned values.
  13733. * @returns {Object} Returns `object`.
  13734. * @example
  13735. *
  13736. * var object = {};
  13737. *
  13738. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  13739. * // => { '0': { '1': 'a' } }
  13740. */
  13741. function updateWith(object, path, updater, customizer) {
  13742. customizer = typeof customizer == 'function' ? customizer : undefined;
  13743. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  13744. }
  13745. /**
  13746. * Creates an array of the own enumerable string keyed property values of `object`.
  13747. *
  13748. * **Note:** Non-object values are coerced to objects.
  13749. *
  13750. * @static
  13751. * @since 0.1.0
  13752. * @memberOf _
  13753. * @category Object
  13754. * @param {Object} object The object to query.
  13755. * @returns {Array} Returns the array of property values.
  13756. * @example
  13757. *
  13758. * function Foo() {
  13759. * this.a = 1;
  13760. * this.b = 2;
  13761. * }
  13762. *
  13763. * Foo.prototype.c = 3;
  13764. *
  13765. * _.values(new Foo);
  13766. * // => [1, 2] (iteration order is not guaranteed)
  13767. *
  13768. * _.values('hi');
  13769. * // => ['h', 'i']
  13770. */
  13771. function values(object) {
  13772. return object == null ? [] : baseValues(object, keys(object));
  13773. }
  13774. /**
  13775. * Creates an array of the own and inherited enumerable string keyed property
  13776. * values of `object`.
  13777. *
  13778. * **Note:** Non-object values are coerced to objects.
  13779. *
  13780. * @static
  13781. * @memberOf _
  13782. * @since 3.0.0
  13783. * @category Object
  13784. * @param {Object} object The object to query.
  13785. * @returns {Array} Returns the array of property values.
  13786. * @example
  13787. *
  13788. * function Foo() {
  13789. * this.a = 1;
  13790. * this.b = 2;
  13791. * }
  13792. *
  13793. * Foo.prototype.c = 3;
  13794. *
  13795. * _.valuesIn(new Foo);
  13796. * // => [1, 2, 3] (iteration order is not guaranteed)
  13797. */
  13798. function valuesIn(object) {
  13799. return object == null ? [] : baseValues(object, keysIn(object));
  13800. }
  13801. /*------------------------------------------------------------------------*/
  13802. /**
  13803. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  13804. *
  13805. * @static
  13806. * @memberOf _
  13807. * @since 4.0.0
  13808. * @category Number
  13809. * @param {number} number The number to clamp.
  13810. * @param {number} [lower] The lower bound.
  13811. * @param {number} upper The upper bound.
  13812. * @returns {number} Returns the clamped number.
  13813. * @example
  13814. *
  13815. * _.clamp(-10, -5, 5);
  13816. * // => -5
  13817. *
  13818. * _.clamp(10, -5, 5);
  13819. * // => 5
  13820. */
  13821. function clamp(number, lower, upper) {
  13822. if (upper === undefined) {
  13823. upper = lower;
  13824. lower = undefined;
  13825. }
  13826. if (upper !== undefined) {
  13827. upper = toNumber(upper);
  13828. upper = upper === upper ? upper : 0;
  13829. }
  13830. if (lower !== undefined) {
  13831. lower = toNumber(lower);
  13832. lower = lower === lower ? lower : 0;
  13833. }
  13834. return baseClamp(toNumber(number), lower, upper);
  13835. }
  13836. /**
  13837. * Checks if `n` is between `start` and up to, but not including, `end`. If
  13838. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  13839. * If `start` is greater than `end` the params are swapped to support
  13840. * negative ranges.
  13841. *
  13842. * @static
  13843. * @memberOf _
  13844. * @since 3.3.0
  13845. * @category Number
  13846. * @param {number} number The number to check.
  13847. * @param {number} [start=0] The start of the range.
  13848. * @param {number} end The end of the range.
  13849. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  13850. * @see _.range, _.rangeRight
  13851. * @example
  13852. *
  13853. * _.inRange(3, 2, 4);
  13854. * // => true
  13855. *
  13856. * _.inRange(4, 8);
  13857. * // => true
  13858. *
  13859. * _.inRange(4, 2);
  13860. * // => false
  13861. *
  13862. * _.inRange(2, 2);
  13863. * // => false
  13864. *
  13865. * _.inRange(1.2, 2);
  13866. * // => true
  13867. *
  13868. * _.inRange(5.2, 4);
  13869. * // => false
  13870. *
  13871. * _.inRange(-3, -2, -6);
  13872. * // => true
  13873. */
  13874. function inRange(number, start, end) {
  13875. start = toFinite(start);
  13876. if (end === undefined) {
  13877. end = start;
  13878. start = 0;
  13879. } else {
  13880. end = toFinite(end);
  13881. }
  13882. number = toNumber(number);
  13883. return baseInRange(number, start, end);
  13884. }
  13885. /**
  13886. * Produces a random number between the inclusive `lower` and `upper` bounds.
  13887. * If only one argument is provided a number between `0` and the given number
  13888. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  13889. * floats, a floating-point number is returned instead of an integer.
  13890. *
  13891. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  13892. * floating-point values which can produce unexpected results.
  13893. *
  13894. * @static
  13895. * @memberOf _
  13896. * @since 0.7.0
  13897. * @category Number
  13898. * @param {number} [lower=0] The lower bound.
  13899. * @param {number} [upper=1] The upper bound.
  13900. * @param {boolean} [floating] Specify returning a floating-point number.
  13901. * @returns {number} Returns the random number.
  13902. * @example
  13903. *
  13904. * _.random(0, 5);
  13905. * // => an integer between 0 and 5
  13906. *
  13907. * _.random(5);
  13908. * // => also an integer between 0 and 5
  13909. *
  13910. * _.random(5, true);
  13911. * // => a floating-point number between 0 and 5
  13912. *
  13913. * _.random(1.2, 5.2);
  13914. * // => a floating-point number between 1.2 and 5.2
  13915. */
  13916. function random(lower, upper, floating) {
  13917. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  13918. upper = floating = undefined;
  13919. }
  13920. if (floating === undefined) {
  13921. if (typeof upper == 'boolean') {
  13922. floating = upper;
  13923. upper = undefined;
  13924. }
  13925. else if (typeof lower == 'boolean') {
  13926. floating = lower;
  13927. lower = undefined;
  13928. }
  13929. }
  13930. if (lower === undefined && upper === undefined) {
  13931. lower = 0;
  13932. upper = 1;
  13933. }
  13934. else {
  13935. lower = toFinite(lower);
  13936. if (upper === undefined) {
  13937. upper = lower;
  13938. lower = 0;
  13939. } else {
  13940. upper = toFinite(upper);
  13941. }
  13942. }
  13943. if (lower > upper) {
  13944. var temp = lower;
  13945. lower = upper;
  13946. upper = temp;
  13947. }
  13948. if (floating || lower % 1 || upper % 1) {
  13949. var rand = nativeRandom();
  13950. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  13951. }
  13952. return baseRandom(lower, upper);
  13953. }
  13954. /*------------------------------------------------------------------------*/
  13955. /**
  13956. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  13957. *
  13958. * @static
  13959. * @memberOf _
  13960. * @since 3.0.0
  13961. * @category String
  13962. * @param {string} [string=''] The string to convert.
  13963. * @returns {string} Returns the camel cased string.
  13964. * @example
  13965. *
  13966. * _.camelCase('Foo Bar');
  13967. * // => 'fooBar'
  13968. *
  13969. * _.camelCase('--foo-bar--');
  13970. * // => 'fooBar'
  13971. *
  13972. * _.camelCase('__FOO_BAR__');
  13973. * // => 'fooBar'
  13974. */
  13975. var camelCase = createCompounder(function(result, word, index) {
  13976. word = word.toLowerCase();
  13977. return result + (index ? capitalize(word) : word);
  13978. });
  13979. /**
  13980. * Converts the first character of `string` to upper case and the remaining
  13981. * to lower case.
  13982. *
  13983. * @static
  13984. * @memberOf _
  13985. * @since 3.0.0
  13986. * @category String
  13987. * @param {string} [string=''] The string to capitalize.
  13988. * @returns {string} Returns the capitalized string.
  13989. * @example
  13990. *
  13991. * _.capitalize('FRED');
  13992. * // => 'Fred'
  13993. */
  13994. function capitalize(string) {
  13995. return upperFirst(toString(string).toLowerCase());
  13996. }
  13997. /**
  13998. * Deburrs `string` by converting
  13999. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  14000. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  14001. * letters to basic Latin letters and removing
  14002. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  14003. *
  14004. * @static
  14005. * @memberOf _
  14006. * @since 3.0.0
  14007. * @category String
  14008. * @param {string} [string=''] The string to deburr.
  14009. * @returns {string} Returns the deburred string.
  14010. * @example
  14011. *
  14012. * _.deburr('déjà vu');
  14013. * // => 'deja vu'
  14014. */
  14015. function deburr(string) {
  14016. string = toString(string);
  14017. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  14018. }
  14019. /**
  14020. * Checks if `string` ends with the given target string.
  14021. *
  14022. * @static
  14023. * @memberOf _
  14024. * @since 3.0.0
  14025. * @category String
  14026. * @param {string} [string=''] The string to inspect.
  14027. * @param {string} [target] The string to search for.
  14028. * @param {number} [position=string.length] The position to search up to.
  14029. * @returns {boolean} Returns `true` if `string` ends with `target`,
  14030. * else `false`.
  14031. * @example
  14032. *
  14033. * _.endsWith('abc', 'c');
  14034. * // => true
  14035. *
  14036. * _.endsWith('abc', 'b');
  14037. * // => false
  14038. *
  14039. * _.endsWith('abc', 'b', 2);
  14040. * // => true
  14041. */
  14042. function endsWith(string, target, position) {
  14043. string = toString(string);
  14044. target = baseToString(target);
  14045. var length = string.length;
  14046. position = position === undefined
  14047. ? length
  14048. : baseClamp(toInteger(position), 0, length);
  14049. var end = position;
  14050. position -= target.length;
  14051. return position >= 0 && string.slice(position, end) == target;
  14052. }
  14053. /**
  14054. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  14055. * corresponding HTML entities.
  14056. *
  14057. * **Note:** No other characters are escaped. To escape additional
  14058. * characters use a third-party library like [_he_](https://mths.be/he).
  14059. *
  14060. * Though the ">" character is escaped for symmetry, characters like
  14061. * ">" and "/" don't need escaping in HTML and have no special meaning
  14062. * unless they're part of a tag or unquoted attribute value. See
  14063. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  14064. * (under "semi-related fun fact") for more details.
  14065. *
  14066. * When working with HTML you should always
  14067. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  14068. * XSS vectors.
  14069. *
  14070. * @static
  14071. * @since 0.1.0
  14072. * @memberOf _
  14073. * @category String
  14074. * @param {string} [string=''] The string to escape.
  14075. * @returns {string} Returns the escaped string.
  14076. * @example
  14077. *
  14078. * _.escape('fred, barney, & pebbles');
  14079. * // => 'fred, barney, &amp; pebbles'
  14080. */
  14081. function escape(string) {
  14082. string = toString(string);
  14083. return (string && reHasUnescapedHtml.test(string))
  14084. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  14085. : string;
  14086. }
  14087. /**
  14088. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  14089. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  14090. *
  14091. * @static
  14092. * @memberOf _
  14093. * @since 3.0.0
  14094. * @category String
  14095. * @param {string} [string=''] The string to escape.
  14096. * @returns {string} Returns the escaped string.
  14097. * @example
  14098. *
  14099. * _.escapeRegExp('[lodash](https://lodash.com/)');
  14100. * // => '\[lodash\]\(https://lodash\.com/\)'
  14101. */
  14102. function escapeRegExp(string) {
  14103. string = toString(string);
  14104. return (string && reHasRegExpChar.test(string))
  14105. ? string.replace(reRegExpChar, '\\$&')
  14106. : string;
  14107. }
  14108. /**
  14109. * Converts `string` to
  14110. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  14111. *
  14112. * @static
  14113. * @memberOf _
  14114. * @since 3.0.0
  14115. * @category String
  14116. * @param {string} [string=''] The string to convert.
  14117. * @returns {string} Returns the kebab cased string.
  14118. * @example
  14119. *
  14120. * _.kebabCase('Foo Bar');
  14121. * // => 'foo-bar'
  14122. *
  14123. * _.kebabCase('fooBar');
  14124. * // => 'foo-bar'
  14125. *
  14126. * _.kebabCase('__FOO_BAR__');
  14127. * // => 'foo-bar'
  14128. */
  14129. var kebabCase = createCompounder(function(result, word, index) {
  14130. return result + (index ? '-' : '') + word.toLowerCase();
  14131. });
  14132. /**
  14133. * Converts `string`, as space separated words, to lower case.
  14134. *
  14135. * @static
  14136. * @memberOf _
  14137. * @since 4.0.0
  14138. * @category String
  14139. * @param {string} [string=''] The string to convert.
  14140. * @returns {string} Returns the lower cased string.
  14141. * @example
  14142. *
  14143. * _.lowerCase('--Foo-Bar--');
  14144. * // => 'foo bar'
  14145. *
  14146. * _.lowerCase('fooBar');
  14147. * // => 'foo bar'
  14148. *
  14149. * _.lowerCase('__FOO_BAR__');
  14150. * // => 'foo bar'
  14151. */
  14152. var lowerCase = createCompounder(function(result, word, index) {
  14153. return result + (index ? ' ' : '') + word.toLowerCase();
  14154. });
  14155. /**
  14156. * Converts the first character of `string` to lower case.
  14157. *
  14158. * @static
  14159. * @memberOf _
  14160. * @since 4.0.0
  14161. * @category String
  14162. * @param {string} [string=''] The string to convert.
  14163. * @returns {string} Returns the converted string.
  14164. * @example
  14165. *
  14166. * _.lowerFirst('Fred');
  14167. * // => 'fred'
  14168. *
  14169. * _.lowerFirst('FRED');
  14170. * // => 'fRED'
  14171. */
  14172. var lowerFirst = createCaseFirst('toLowerCase');
  14173. /**
  14174. * Pads `string` on the left and right sides if it's shorter than `length`.
  14175. * Padding characters are truncated if they can't be evenly divided by `length`.
  14176. *
  14177. * @static
  14178. * @memberOf _
  14179. * @since 3.0.0
  14180. * @category String
  14181. * @param {string} [string=''] The string to pad.
  14182. * @param {number} [length=0] The padding length.
  14183. * @param {string} [chars=' '] The string used as padding.
  14184. * @returns {string} Returns the padded string.
  14185. * @example
  14186. *
  14187. * _.pad('abc', 8);
  14188. * // => ' abc '
  14189. *
  14190. * _.pad('abc', 8, '_-');
  14191. * // => '_-abc_-_'
  14192. *
  14193. * _.pad('abc', 3);
  14194. * // => 'abc'
  14195. */
  14196. function pad(string, length, chars) {
  14197. string = toString(string);
  14198. length = toInteger(length);
  14199. var strLength = length ? stringSize(string) : 0;
  14200. if (!length || strLength >= length) {
  14201. return string;
  14202. }
  14203. var mid = (length - strLength) / 2;
  14204. return (
  14205. createPadding(nativeFloor(mid), chars) +
  14206. string +
  14207. createPadding(nativeCeil(mid), chars)
  14208. );
  14209. }
  14210. /**
  14211. * Pads `string` on the right side if it's shorter than `length`. Padding
  14212. * characters are truncated if they exceed `length`.
  14213. *
  14214. * @static
  14215. * @memberOf _
  14216. * @since 4.0.0
  14217. * @category String
  14218. * @param {string} [string=''] The string to pad.
  14219. * @param {number} [length=0] The padding length.
  14220. * @param {string} [chars=' '] The string used as padding.
  14221. * @returns {string} Returns the padded string.
  14222. * @example
  14223. *
  14224. * _.padEnd('abc', 6);
  14225. * // => 'abc '
  14226. *
  14227. * _.padEnd('abc', 6, '_-');
  14228. * // => 'abc_-_'
  14229. *
  14230. * _.padEnd('abc', 3);
  14231. * // => 'abc'
  14232. */
  14233. function padEnd(string, length, chars) {
  14234. string = toString(string);
  14235. length = toInteger(length);
  14236. var strLength = length ? stringSize(string) : 0;
  14237. return (length && strLength < length)
  14238. ? (string + createPadding(length - strLength, chars))
  14239. : string;
  14240. }
  14241. /**
  14242. * Pads `string` on the left side if it's shorter than `length`. Padding
  14243. * characters are truncated if they exceed `length`.
  14244. *
  14245. * @static
  14246. * @memberOf _
  14247. * @since 4.0.0
  14248. * @category String
  14249. * @param {string} [string=''] The string to pad.
  14250. * @param {number} [length=0] The padding length.
  14251. * @param {string} [chars=' '] The string used as padding.
  14252. * @returns {string} Returns the padded string.
  14253. * @example
  14254. *
  14255. * _.padStart('abc', 6);
  14256. * // => ' abc'
  14257. *
  14258. * _.padStart('abc', 6, '_-');
  14259. * // => '_-_abc'
  14260. *
  14261. * _.padStart('abc', 3);
  14262. * // => 'abc'
  14263. */
  14264. function padStart(string, length, chars) {
  14265. string = toString(string);
  14266. length = toInteger(length);
  14267. var strLength = length ? stringSize(string) : 0;
  14268. return (length && strLength < length)
  14269. ? (createPadding(length - strLength, chars) + string)
  14270. : string;
  14271. }
  14272. /**
  14273. * Converts `string` to an integer of the specified radix. If `radix` is
  14274. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  14275. * hexadecimal, in which case a `radix` of `16` is used.
  14276. *
  14277. * **Note:** This method aligns with the
  14278. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  14279. *
  14280. * @static
  14281. * @memberOf _
  14282. * @since 1.1.0
  14283. * @category String
  14284. * @param {string} string The string to convert.
  14285. * @param {number} [radix=10] The radix to interpret `value` by.
  14286. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14287. * @returns {number} Returns the converted integer.
  14288. * @example
  14289. *
  14290. * _.parseInt('08');
  14291. * // => 8
  14292. *
  14293. * _.map(['6', '08', '10'], _.parseInt);
  14294. * // => [6, 8, 10]
  14295. */
  14296. function parseInt(string, radix, guard) {
  14297. if (guard || radix == null) {
  14298. radix = 0;
  14299. } else if (radix) {
  14300. radix = +radix;
  14301. }
  14302. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  14303. }
  14304. /**
  14305. * Repeats the given string `n` times.
  14306. *
  14307. * @static
  14308. * @memberOf _
  14309. * @since 3.0.0
  14310. * @category String
  14311. * @param {string} [string=''] The string to repeat.
  14312. * @param {number} [n=1] The number of times to repeat the string.
  14313. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14314. * @returns {string} Returns the repeated string.
  14315. * @example
  14316. *
  14317. * _.repeat('*', 3);
  14318. * // => '***'
  14319. *
  14320. * _.repeat('abc', 2);
  14321. * // => 'abcabc'
  14322. *
  14323. * _.repeat('abc', 0);
  14324. * // => ''
  14325. */
  14326. function repeat(string, n, guard) {
  14327. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  14328. n = 1;
  14329. } else {
  14330. n = toInteger(n);
  14331. }
  14332. return baseRepeat(toString(string), n);
  14333. }
  14334. /**
  14335. * Replaces matches for `pattern` in `string` with `replacement`.
  14336. *
  14337. * **Note:** This method is based on
  14338. * [`String#replace`](https://mdn.io/String/replace).
  14339. *
  14340. * @static
  14341. * @memberOf _
  14342. * @since 4.0.0
  14343. * @category String
  14344. * @param {string} [string=''] The string to modify.
  14345. * @param {RegExp|string} pattern The pattern to replace.
  14346. * @param {Function|string} replacement The match replacement.
  14347. * @returns {string} Returns the modified string.
  14348. * @example
  14349. *
  14350. * _.replace('Hi Fred', 'Fred', 'Barney');
  14351. * // => 'Hi Barney'
  14352. */
  14353. function replace() {
  14354. var args = arguments,
  14355. string = toString(args[0]);
  14356. return args.length < 3 ? string : string.replace(args[1], args[2]);
  14357. }
  14358. /**
  14359. * Converts `string` to
  14360. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  14361. *
  14362. * @static
  14363. * @memberOf _
  14364. * @since 3.0.0
  14365. * @category String
  14366. * @param {string} [string=''] The string to convert.
  14367. * @returns {string} Returns the snake cased string.
  14368. * @example
  14369. *
  14370. * _.snakeCase('Foo Bar');
  14371. * // => 'foo_bar'
  14372. *
  14373. * _.snakeCase('fooBar');
  14374. * // => 'foo_bar'
  14375. *
  14376. * _.snakeCase('--FOO-BAR--');
  14377. * // => 'foo_bar'
  14378. */
  14379. var snakeCase = createCompounder(function(result, word, index) {
  14380. return result + (index ? '_' : '') + word.toLowerCase();
  14381. });
  14382. /**
  14383. * Splits `string` by `separator`.
  14384. *
  14385. * **Note:** This method is based on
  14386. * [`String#split`](https://mdn.io/String/split).
  14387. *
  14388. * @static
  14389. * @memberOf _
  14390. * @since 4.0.0
  14391. * @category String
  14392. * @param {string} [string=''] The string to split.
  14393. * @param {RegExp|string} separator The separator pattern to split by.
  14394. * @param {number} [limit] The length to truncate results to.
  14395. * @returns {Array} Returns the string segments.
  14396. * @example
  14397. *
  14398. * _.split('a-b-c', '-', 2);
  14399. * // => ['a', 'b']
  14400. */
  14401. function split(string, separator, limit) {
  14402. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  14403. separator = limit = undefined;
  14404. }
  14405. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  14406. if (!limit) {
  14407. return [];
  14408. }
  14409. string = toString(string);
  14410. if (string && (
  14411. typeof separator == 'string' ||
  14412. (separator != null && !isRegExp(separator))
  14413. )) {
  14414. separator = baseToString(separator);
  14415. if (!separator && hasUnicode(string)) {
  14416. return castSlice(stringToArray(string), 0, limit);
  14417. }
  14418. }
  14419. return string.split(separator, limit);
  14420. }
  14421. /**
  14422. * Converts `string` to
  14423. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  14424. *
  14425. * @static
  14426. * @memberOf _
  14427. * @since 3.1.0
  14428. * @category String
  14429. * @param {string} [string=''] The string to convert.
  14430. * @returns {string} Returns the start cased string.
  14431. * @example
  14432. *
  14433. * _.startCase('--foo-bar--');
  14434. * // => 'Foo Bar'
  14435. *
  14436. * _.startCase('fooBar');
  14437. * // => 'Foo Bar'
  14438. *
  14439. * _.startCase('__FOO_BAR__');
  14440. * // => 'FOO BAR'
  14441. */
  14442. var startCase = createCompounder(function(result, word, index) {
  14443. return result + (index ? ' ' : '') + upperFirst(word);
  14444. });
  14445. /**
  14446. * Checks if `string` starts with the given target string.
  14447. *
  14448. * @static
  14449. * @memberOf _
  14450. * @since 3.0.0
  14451. * @category String
  14452. * @param {string} [string=''] The string to inspect.
  14453. * @param {string} [target] The string to search for.
  14454. * @param {number} [position=0] The position to search from.
  14455. * @returns {boolean} Returns `true` if `string` starts with `target`,
  14456. * else `false`.
  14457. * @example
  14458. *
  14459. * _.startsWith('abc', 'a');
  14460. * // => true
  14461. *
  14462. * _.startsWith('abc', 'b');
  14463. * // => false
  14464. *
  14465. * _.startsWith('abc', 'b', 1);
  14466. * // => true
  14467. */
  14468. function startsWith(string, target, position) {
  14469. string = toString(string);
  14470. position = position == null
  14471. ? 0
  14472. : baseClamp(toInteger(position), 0, string.length);
  14473. target = baseToString(target);
  14474. return string.slice(position, position + target.length) == target;
  14475. }
  14476. /**
  14477. * Creates a compiled template function that can interpolate data properties
  14478. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  14479. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  14480. * properties may be accessed as free variables in the template. If a setting
  14481. * object is given, it takes precedence over `_.templateSettings` values.
  14482. *
  14483. * **Note:** In the development build `_.template` utilizes
  14484. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  14485. * for easier debugging.
  14486. *
  14487. * For more information on precompiling templates see
  14488. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  14489. *
  14490. * For more information on Chrome extension sandboxes see
  14491. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  14492. *
  14493. * @static
  14494. * @since 0.1.0
  14495. * @memberOf _
  14496. * @category String
  14497. * @param {string} [string=''] The template string.
  14498. * @param {Object} [options={}] The options object.
  14499. * @param {RegExp} [options.escape=_.templateSettings.escape]
  14500. * The HTML "escape" delimiter.
  14501. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  14502. * The "evaluate" delimiter.
  14503. * @param {Object} [options.imports=_.templateSettings.imports]
  14504. * An object to import into the template as free variables.
  14505. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  14506. * The "interpolate" delimiter.
  14507. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  14508. * The sourceURL of the compiled template.
  14509. * @param {string} [options.variable='obj']
  14510. * The data object variable name.
  14511. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14512. * @returns {Function} Returns the compiled template function.
  14513. * @example
  14514. *
  14515. * // Use the "interpolate" delimiter to create a compiled template.
  14516. * var compiled = _.template('hello <%= user %>!');
  14517. * compiled({ 'user': 'fred' });
  14518. * // => 'hello fred!'
  14519. *
  14520. * // Use the HTML "escape" delimiter to escape data property values.
  14521. * var compiled = _.template('<b><%- value %></b>');
  14522. * compiled({ 'value': '<script>' });
  14523. * // => '<b>&lt;script&gt;</b>'
  14524. *
  14525. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  14526. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  14527. * compiled({ 'users': ['fred', 'barney'] });
  14528. * // => '<li>fred</li><li>barney</li>'
  14529. *
  14530. * // Use the internal `print` function in "evaluate" delimiters.
  14531. * var compiled = _.template('<% print("hello " + user); %>!');
  14532. * compiled({ 'user': 'barney' });
  14533. * // => 'hello barney!'
  14534. *
  14535. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  14536. * // Disable support by replacing the "interpolate" delimiter.
  14537. * var compiled = _.template('hello ${ user }!');
  14538. * compiled({ 'user': 'pebbles' });
  14539. * // => 'hello pebbles!'
  14540. *
  14541. * // Use backslashes to treat delimiters as plain text.
  14542. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  14543. * compiled({ 'value': 'ignored' });
  14544. * // => '<%- value %>'
  14545. *
  14546. * // Use the `imports` option to import `jQuery` as `jq`.
  14547. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  14548. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  14549. * compiled({ 'users': ['fred', 'barney'] });
  14550. * // => '<li>fred</li><li>barney</li>'
  14551. *
  14552. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  14553. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  14554. * compiled(data);
  14555. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  14556. *
  14557. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  14558. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  14559. * compiled.source;
  14560. * // => function(data) {
  14561. * // var __t, __p = '';
  14562. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  14563. * // return __p;
  14564. * // }
  14565. *
  14566. * // Use custom template delimiters.
  14567. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  14568. * var compiled = _.template('hello {{ user }}!');
  14569. * compiled({ 'user': 'mustache' });
  14570. * // => 'hello mustache!'
  14571. *
  14572. * // Use the `source` property to inline compiled templates for meaningful
  14573. * // line numbers in error messages and stack traces.
  14574. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  14575. * var JST = {\
  14576. * "main": ' + _.template(mainText).source + '\
  14577. * };\
  14578. * ');
  14579. */
  14580. function template(string, options, guard) {
  14581. // Based on John Resig's `tmpl` implementation
  14582. // (http://ejohn.org/blog/javascript-micro-templating/)
  14583. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  14584. var settings = lodash.templateSettings;
  14585. if (guard && isIterateeCall(string, options, guard)) {
  14586. options = undefined;
  14587. }
  14588. string = toString(string);
  14589. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  14590. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  14591. importsKeys = keys(imports),
  14592. importsValues = baseValues(imports, importsKeys);
  14593. var isEscaping,
  14594. isEvaluating,
  14595. index = 0,
  14596. interpolate = options.interpolate || reNoMatch,
  14597. source = "__p += '";
  14598. // Compile the regexp to match each delimiter.
  14599. var reDelimiters = RegExp(
  14600. (options.escape || reNoMatch).source + '|' +
  14601. interpolate.source + '|' +
  14602. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  14603. (options.evaluate || reNoMatch).source + '|$'
  14604. , 'g');
  14605. // Use a sourceURL for easier debugging.
  14606. var sourceURL = '//# sourceURL=' +
  14607. ('sourceURL' in options
  14608. ? options.sourceURL
  14609. : ('lodash.templateSources[' + (++templateCounter) + ']')
  14610. ) + '\n';
  14611. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  14612. interpolateValue || (interpolateValue = esTemplateValue);
  14613. // Escape characters that can't be included in string literals.
  14614. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  14615. // Replace delimiters with snippets.
  14616. if (escapeValue) {
  14617. isEscaping = true;
  14618. source += "' +\n__e(" + escapeValue + ") +\n'";
  14619. }
  14620. if (evaluateValue) {
  14621. isEvaluating = true;
  14622. source += "';\n" + evaluateValue + ";\n__p += '";
  14623. }
  14624. if (interpolateValue) {
  14625. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  14626. }
  14627. index = offset + match.length;
  14628. // The JS engine embedded in Adobe products needs `match` returned in
  14629. // order to produce the correct `offset` value.
  14630. return match;
  14631. });
  14632. source += "';\n";
  14633. // If `variable` is not specified wrap a with-statement around the generated
  14634. // code to add the data object to the top of the scope chain.
  14635. var variable = options.variable;
  14636. if (!variable) {
  14637. source = 'with (obj) {\n' + source + '\n}\n';
  14638. }
  14639. // Cleanup code by stripping empty strings.
  14640. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  14641. .replace(reEmptyStringMiddle, '$1')
  14642. .replace(reEmptyStringTrailing, '$1;');
  14643. // Frame code as the function body.
  14644. source = 'function(' + (variable || 'obj') + ') {\n' +
  14645. (variable
  14646. ? ''
  14647. : 'obj || (obj = {});\n'
  14648. ) +
  14649. "var __t, __p = ''" +
  14650. (isEscaping
  14651. ? ', __e = _.escape'
  14652. : ''
  14653. ) +
  14654. (isEvaluating
  14655. ? ', __j = Array.prototype.join;\n' +
  14656. "function print() { __p += __j.call(arguments, '') }\n"
  14657. : ';\n'
  14658. ) +
  14659. source +
  14660. 'return __p\n}';
  14661. var result = attempt(function() {
  14662. return Function(importsKeys, sourceURL + 'return ' + source)
  14663. .apply(undefined, importsValues);
  14664. });
  14665. // Provide the compiled function's source by its `toString` method or
  14666. // the `source` property as a convenience for inlining compiled templates.
  14667. result.source = source;
  14668. if (isError(result)) {
  14669. throw result;
  14670. }
  14671. return result;
  14672. }
  14673. /**
  14674. * Converts `string`, as a whole, to lower case just like
  14675. * [String#toLowerCase](https://mdn.io/toLowerCase).
  14676. *
  14677. * @static
  14678. * @memberOf _
  14679. * @since 4.0.0
  14680. * @category String
  14681. * @param {string} [string=''] The string to convert.
  14682. * @returns {string} Returns the lower cased string.
  14683. * @example
  14684. *
  14685. * _.toLower('--Foo-Bar--');
  14686. * // => '--foo-bar--'
  14687. *
  14688. * _.toLower('fooBar');
  14689. * // => 'foobar'
  14690. *
  14691. * _.toLower('__FOO_BAR__');
  14692. * // => '__foo_bar__'
  14693. */
  14694. function toLower(value) {
  14695. return toString(value).toLowerCase();
  14696. }
  14697. /**
  14698. * Converts `string`, as a whole, to upper case just like
  14699. * [String#toUpperCase](https://mdn.io/toUpperCase).
  14700. *
  14701. * @static
  14702. * @memberOf _
  14703. * @since 4.0.0
  14704. * @category String
  14705. * @param {string} [string=''] The string to convert.
  14706. * @returns {string} Returns the upper cased string.
  14707. * @example
  14708. *
  14709. * _.toUpper('--foo-bar--');
  14710. * // => '--FOO-BAR--'
  14711. *
  14712. * _.toUpper('fooBar');
  14713. * // => 'FOOBAR'
  14714. *
  14715. * _.toUpper('__foo_bar__');
  14716. * // => '__FOO_BAR__'
  14717. */
  14718. function toUpper(value) {
  14719. return toString(value).toUpperCase();
  14720. }
  14721. /**
  14722. * Removes leading and trailing whitespace or specified characters from `string`.
  14723. *
  14724. * @static
  14725. * @memberOf _
  14726. * @since 3.0.0
  14727. * @category String
  14728. * @param {string} [string=''] The string to trim.
  14729. * @param {string} [chars=whitespace] The characters to trim.
  14730. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14731. * @returns {string} Returns the trimmed string.
  14732. * @example
  14733. *
  14734. * _.trim(' abc ');
  14735. * // => 'abc'
  14736. *
  14737. * _.trim('-_-abc-_-', '_-');
  14738. * // => 'abc'
  14739. *
  14740. * _.map([' foo ', ' bar '], _.trim);
  14741. * // => ['foo', 'bar']
  14742. */
  14743. function trim(string, chars, guard) {
  14744. string = toString(string);
  14745. if (string && (guard || chars === undefined)) {
  14746. return string.replace(reTrim, '');
  14747. }
  14748. if (!string || !(chars = baseToString(chars))) {
  14749. return string;
  14750. }
  14751. var strSymbols = stringToArray(string),
  14752. chrSymbols = stringToArray(chars),
  14753. start = charsStartIndex(strSymbols, chrSymbols),
  14754. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  14755. return castSlice(strSymbols, start, end).join('');
  14756. }
  14757. /**
  14758. * Removes trailing whitespace or specified characters from `string`.
  14759. *
  14760. * @static
  14761. * @memberOf _
  14762. * @since 4.0.0
  14763. * @category String
  14764. * @param {string} [string=''] The string to trim.
  14765. * @param {string} [chars=whitespace] The characters to trim.
  14766. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14767. * @returns {string} Returns the trimmed string.
  14768. * @example
  14769. *
  14770. * _.trimEnd(' abc ');
  14771. * // => ' abc'
  14772. *
  14773. * _.trimEnd('-_-abc-_-', '_-');
  14774. * // => '-_-abc'
  14775. */
  14776. function trimEnd(string, chars, guard) {
  14777. string = toString(string);
  14778. if (string && (guard || chars === undefined)) {
  14779. return string.replace(reTrimEnd, '');
  14780. }
  14781. if (!string || !(chars = baseToString(chars))) {
  14782. return string;
  14783. }
  14784. var strSymbols = stringToArray(string),
  14785. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  14786. return castSlice(strSymbols, 0, end).join('');
  14787. }
  14788. /**
  14789. * Removes leading whitespace or specified characters from `string`.
  14790. *
  14791. * @static
  14792. * @memberOf _
  14793. * @since 4.0.0
  14794. * @category String
  14795. * @param {string} [string=''] The string to trim.
  14796. * @param {string} [chars=whitespace] The characters to trim.
  14797. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14798. * @returns {string} Returns the trimmed string.
  14799. * @example
  14800. *
  14801. * _.trimStart(' abc ');
  14802. * // => 'abc '
  14803. *
  14804. * _.trimStart('-_-abc-_-', '_-');
  14805. * // => 'abc-_-'
  14806. */
  14807. function trimStart(string, chars, guard) {
  14808. string = toString(string);
  14809. if (string && (guard || chars === undefined)) {
  14810. return string.replace(reTrimStart, '');
  14811. }
  14812. if (!string || !(chars = baseToString(chars))) {
  14813. return string;
  14814. }
  14815. var strSymbols = stringToArray(string),
  14816. start = charsStartIndex(strSymbols, stringToArray(chars));
  14817. return castSlice(strSymbols, start).join('');
  14818. }
  14819. /**
  14820. * Truncates `string` if it's longer than the given maximum string length.
  14821. * The last characters of the truncated string are replaced with the omission
  14822. * string which defaults to "...".
  14823. *
  14824. * @static
  14825. * @memberOf _
  14826. * @since 4.0.0
  14827. * @category String
  14828. * @param {string} [string=''] The string to truncate.
  14829. * @param {Object} [options={}] The options object.
  14830. * @param {number} [options.length=30] The maximum string length.
  14831. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  14832. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  14833. * @returns {string} Returns the truncated string.
  14834. * @example
  14835. *
  14836. * _.truncate('hi-diddly-ho there, neighborino');
  14837. * // => 'hi-diddly-ho there, neighbo...'
  14838. *
  14839. * _.truncate('hi-diddly-ho there, neighborino', {
  14840. * 'length': 24,
  14841. * 'separator': ' '
  14842. * });
  14843. * // => 'hi-diddly-ho there,...'
  14844. *
  14845. * _.truncate('hi-diddly-ho there, neighborino', {
  14846. * 'length': 24,
  14847. * 'separator': /,? +/
  14848. * });
  14849. * // => 'hi-diddly-ho there...'
  14850. *
  14851. * _.truncate('hi-diddly-ho there, neighborino', {
  14852. * 'omission': ' [...]'
  14853. * });
  14854. * // => 'hi-diddly-ho there, neig [...]'
  14855. */
  14856. function truncate(string, options) {
  14857. var length = DEFAULT_TRUNC_LENGTH,
  14858. omission = DEFAULT_TRUNC_OMISSION;
  14859. if (isObject(options)) {
  14860. var separator = 'separator' in options ? options.separator : separator;
  14861. length = 'length' in options ? toInteger(options.length) : length;
  14862. omission = 'omission' in options ? baseToString(options.omission) : omission;
  14863. }
  14864. string = toString(string);
  14865. var strLength = string.length;
  14866. if (hasUnicode(string)) {
  14867. var strSymbols = stringToArray(string);
  14868. strLength = strSymbols.length;
  14869. }
  14870. if (length >= strLength) {
  14871. return string;
  14872. }
  14873. var end = length - stringSize(omission);
  14874. if (end < 1) {
  14875. return omission;
  14876. }
  14877. var result = strSymbols
  14878. ? castSlice(strSymbols, 0, end).join('')
  14879. : string.slice(0, end);
  14880. if (separator === undefined) {
  14881. return result + omission;
  14882. }
  14883. if (strSymbols) {
  14884. end += (result.length - end);
  14885. }
  14886. if (isRegExp(separator)) {
  14887. if (string.slice(end).search(separator)) {
  14888. var match,
  14889. substring = result;
  14890. if (!separator.global) {
  14891. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  14892. }
  14893. separator.lastIndex = 0;
  14894. while ((match = separator.exec(substring))) {
  14895. var newEnd = match.index;
  14896. }
  14897. result = result.slice(0, newEnd === undefined ? end : newEnd);
  14898. }
  14899. } else if (string.indexOf(baseToString(separator), end) != end) {
  14900. var index = result.lastIndexOf(separator);
  14901. if (index > -1) {
  14902. result = result.slice(0, index);
  14903. }
  14904. }
  14905. return result + omission;
  14906. }
  14907. /**
  14908. * The inverse of `_.escape`; this method converts the HTML entities
  14909. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  14910. * their corresponding characters.
  14911. *
  14912. * **Note:** No other HTML entities are unescaped. To unescape additional
  14913. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  14914. *
  14915. * @static
  14916. * @memberOf _
  14917. * @since 0.6.0
  14918. * @category String
  14919. * @param {string} [string=''] The string to unescape.
  14920. * @returns {string} Returns the unescaped string.
  14921. * @example
  14922. *
  14923. * _.unescape('fred, barney, &amp; pebbles');
  14924. * // => 'fred, barney, & pebbles'
  14925. */
  14926. function unescape(string) {
  14927. string = toString(string);
  14928. return (string && reHasEscapedHtml.test(string))
  14929. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  14930. : string;
  14931. }
  14932. /**
  14933. * Converts `string`, as space separated words, to upper case.
  14934. *
  14935. * @static
  14936. * @memberOf _
  14937. * @since 4.0.0
  14938. * @category String
  14939. * @param {string} [string=''] The string to convert.
  14940. * @returns {string} Returns the upper cased string.
  14941. * @example
  14942. *
  14943. * _.upperCase('--foo-bar');
  14944. * // => 'FOO BAR'
  14945. *
  14946. * _.upperCase('fooBar');
  14947. * // => 'FOO BAR'
  14948. *
  14949. * _.upperCase('__foo_bar__');
  14950. * // => 'FOO BAR'
  14951. */
  14952. var upperCase = createCompounder(function(result, word, index) {
  14953. return result + (index ? ' ' : '') + word.toUpperCase();
  14954. });
  14955. /**
  14956. * Converts the first character of `string` to upper case.
  14957. *
  14958. * @static
  14959. * @memberOf _
  14960. * @since 4.0.0
  14961. * @category String
  14962. * @param {string} [string=''] The string to convert.
  14963. * @returns {string} Returns the converted string.
  14964. * @example
  14965. *
  14966. * _.upperFirst('fred');
  14967. * // => 'Fred'
  14968. *
  14969. * _.upperFirst('FRED');
  14970. * // => 'FRED'
  14971. */
  14972. var upperFirst = createCaseFirst('toUpperCase');
  14973. /**
  14974. * Splits `string` into an array of its words.
  14975. *
  14976. * @static
  14977. * @memberOf _
  14978. * @since 3.0.0
  14979. * @category String
  14980. * @param {string} [string=''] The string to inspect.
  14981. * @param {RegExp|string} [pattern] The pattern to match words.
  14982. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14983. * @returns {Array} Returns the words of `string`.
  14984. * @example
  14985. *
  14986. * _.words('fred, barney, & pebbles');
  14987. * // => ['fred', 'barney', 'pebbles']
  14988. *
  14989. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  14990. * // => ['fred', 'barney', '&', 'pebbles']
  14991. */
  14992. function words(string, pattern, guard) {
  14993. string = toString(string);
  14994. pattern = guard ? undefined : pattern;
  14995. if (pattern === undefined) {
  14996. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  14997. }
  14998. return string.match(pattern) || [];
  14999. }
  15000. /*------------------------------------------------------------------------*/
  15001. /**
  15002. * Attempts to invoke `func`, returning either the result or the caught error
  15003. * object. Any additional arguments are provided to `func` when it's invoked.
  15004. *
  15005. * @static
  15006. * @memberOf _
  15007. * @since 3.0.0
  15008. * @category Util
  15009. * @param {Function} func The function to attempt.
  15010. * @param {...*} [args] The arguments to invoke `func` with.
  15011. * @returns {*} Returns the `func` result or error object.
  15012. * @example
  15013. *
  15014. * // Avoid throwing errors for invalid selectors.
  15015. * var elements = _.attempt(function(selector) {
  15016. * return document.querySelectorAll(selector);
  15017. * }, '>_>');
  15018. *
  15019. * if (_.isError(elements)) {
  15020. * elements = [];
  15021. * }
  15022. */
  15023. var attempt = baseRest(function(func, args) {
  15024. try {
  15025. return apply(func, undefined, args);
  15026. } catch (e) {
  15027. return isError(e) ? e : new Error(e);
  15028. }
  15029. });
  15030. /**
  15031. * Binds methods of an object to the object itself, overwriting the existing
  15032. * method.
  15033. *
  15034. * **Note:** This method doesn't set the "length" property of bound functions.
  15035. *
  15036. * @static
  15037. * @since 0.1.0
  15038. * @memberOf _
  15039. * @category Util
  15040. * @param {Object} object The object to bind and assign the bound methods to.
  15041. * @param {...(string|string[])} methodNames The object method names to bind.
  15042. * @returns {Object} Returns `object`.
  15043. * @example
  15044. *
  15045. * var view = {
  15046. * 'label': 'docs',
  15047. * 'click': function() {
  15048. * console.log('clicked ' + this.label);
  15049. * }
  15050. * };
  15051. *
  15052. * _.bindAll(view, ['click']);
  15053. * jQuery(element).on('click', view.click);
  15054. * // => Logs 'clicked docs' when clicked.
  15055. */
  15056. var bindAll = flatRest(function(object, methodNames) {
  15057. arrayEach(methodNames, function(key) {
  15058. key = toKey(key);
  15059. baseAssignValue(object, key, bind(object[key], object));
  15060. });
  15061. return object;
  15062. });
  15063. /**
  15064. * Creates a function that iterates over `pairs` and invokes the corresponding
  15065. * function of the first predicate to return truthy. The predicate-function
  15066. * pairs are invoked with the `this` binding and arguments of the created
  15067. * function.
  15068. *
  15069. * @static
  15070. * @memberOf _
  15071. * @since 4.0.0
  15072. * @category Util
  15073. * @param {Array} pairs The predicate-function pairs.
  15074. * @returns {Function} Returns the new composite function.
  15075. * @example
  15076. *
  15077. * var func = _.cond([
  15078. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  15079. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  15080. * [_.stubTrue, _.constant('no match')]
  15081. * ]);
  15082. *
  15083. * func({ 'a': 1, 'b': 2 });
  15084. * // => 'matches A'
  15085. *
  15086. * func({ 'a': 0, 'b': 1 });
  15087. * // => 'matches B'
  15088. *
  15089. * func({ 'a': '1', 'b': '2' });
  15090. * // => 'no match'
  15091. */
  15092. function cond(pairs) {
  15093. var length = pairs == null ? 0 : pairs.length,
  15094. toIteratee = getIteratee();
  15095. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  15096. if (typeof pair[1] != 'function') {
  15097. throw new TypeError(FUNC_ERROR_TEXT);
  15098. }
  15099. return [toIteratee(pair[0]), pair[1]];
  15100. });
  15101. return baseRest(function(args) {
  15102. var index = -1;
  15103. while (++index < length) {
  15104. var pair = pairs[index];
  15105. if (apply(pair[0], this, args)) {
  15106. return apply(pair[1], this, args);
  15107. }
  15108. }
  15109. });
  15110. }
  15111. /**
  15112. * Creates a function that invokes the predicate properties of `source` with
  15113. * the corresponding property values of a given object, returning `true` if
  15114. * all predicates return truthy, else `false`.
  15115. *
  15116. * **Note:** The created function is equivalent to `_.conformsTo` with
  15117. * `source` partially applied.
  15118. *
  15119. * @static
  15120. * @memberOf _
  15121. * @since 4.0.0
  15122. * @category Util
  15123. * @param {Object} source The object of property predicates to conform to.
  15124. * @returns {Function} Returns the new spec function.
  15125. * @example
  15126. *
  15127. * var objects = [
  15128. * { 'a': 2, 'b': 1 },
  15129. * { 'a': 1, 'b': 2 }
  15130. * ];
  15131. *
  15132. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  15133. * // => [{ 'a': 1, 'b': 2 }]
  15134. */
  15135. function conforms(source) {
  15136. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  15137. }
  15138. /**
  15139. * Creates a function that returns `value`.
  15140. *
  15141. * @static
  15142. * @memberOf _
  15143. * @since 2.4.0
  15144. * @category Util
  15145. * @param {*} value The value to return from the new function.
  15146. * @returns {Function} Returns the new constant function.
  15147. * @example
  15148. *
  15149. * var objects = _.times(2, _.constant({ 'a': 1 }));
  15150. *
  15151. * console.log(objects);
  15152. * // => [{ 'a': 1 }, { 'a': 1 }]
  15153. *
  15154. * console.log(objects[0] === objects[1]);
  15155. * // => true
  15156. */
  15157. function constant(value) {
  15158. return function() {
  15159. return value;
  15160. };
  15161. }
  15162. /**
  15163. * Checks `value` to determine whether a default value should be returned in
  15164. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  15165. * or `undefined`.
  15166. *
  15167. * @static
  15168. * @memberOf _
  15169. * @since 4.14.0
  15170. * @category Util
  15171. * @param {*} value The value to check.
  15172. * @param {*} defaultValue The default value.
  15173. * @returns {*} Returns the resolved value.
  15174. * @example
  15175. *
  15176. * _.defaultTo(1, 10);
  15177. * // => 1
  15178. *
  15179. * _.defaultTo(undefined, 10);
  15180. * // => 10
  15181. */
  15182. function defaultTo(value, defaultValue) {
  15183. return (value == null || value !== value) ? defaultValue : value;
  15184. }
  15185. /**
  15186. * Creates a function that returns the result of invoking the given functions
  15187. * with the `this` binding of the created function, where each successive
  15188. * invocation is supplied the return value of the previous.
  15189. *
  15190. * @static
  15191. * @memberOf _
  15192. * @since 3.0.0
  15193. * @category Util
  15194. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15195. * @returns {Function} Returns the new composite function.
  15196. * @see _.flowRight
  15197. * @example
  15198. *
  15199. * function square(n) {
  15200. * return n * n;
  15201. * }
  15202. *
  15203. * var addSquare = _.flow([_.add, square]);
  15204. * addSquare(1, 2);
  15205. * // => 9
  15206. */
  15207. var flow = createFlow();
  15208. /**
  15209. * This method is like `_.flow` except that it creates a function that
  15210. * invokes the given functions from right to left.
  15211. *
  15212. * @static
  15213. * @since 3.0.0
  15214. * @memberOf _
  15215. * @category Util
  15216. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15217. * @returns {Function} Returns the new composite function.
  15218. * @see _.flow
  15219. * @example
  15220. *
  15221. * function square(n) {
  15222. * return n * n;
  15223. * }
  15224. *
  15225. * var addSquare = _.flowRight([square, _.add]);
  15226. * addSquare(1, 2);
  15227. * // => 9
  15228. */
  15229. var flowRight = createFlow(true);
  15230. /**
  15231. * This method returns the first argument it receives.
  15232. *
  15233. * @static
  15234. * @since 0.1.0
  15235. * @memberOf _
  15236. * @category Util
  15237. * @param {*} value Any value.
  15238. * @returns {*} Returns `value`.
  15239. * @example
  15240. *
  15241. * var object = { 'a': 1 };
  15242. *
  15243. * console.log(_.identity(object) === object);
  15244. * // => true
  15245. */
  15246. function identity(value) {
  15247. return value;
  15248. }
  15249. /**
  15250. * Creates a function that invokes `func` with the arguments of the created
  15251. * function. If `func` is a property name, the created function returns the
  15252. * property value for a given element. If `func` is an array or object, the
  15253. * created function returns `true` for elements that contain the equivalent
  15254. * source properties, otherwise it returns `false`.
  15255. *
  15256. * @static
  15257. * @since 4.0.0
  15258. * @memberOf _
  15259. * @category Util
  15260. * @param {*} [func=_.identity] The value to convert to a callback.
  15261. * @returns {Function} Returns the callback.
  15262. * @example
  15263. *
  15264. * var users = [
  15265. * { 'user': 'barney', 'age': 36, 'active': true },
  15266. * { 'user': 'fred', 'age': 40, 'active': false }
  15267. * ];
  15268. *
  15269. * // The `_.matches` iteratee shorthand.
  15270. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  15271. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  15272. *
  15273. * // The `_.matchesProperty` iteratee shorthand.
  15274. * _.filter(users, _.iteratee(['user', 'fred']));
  15275. * // => [{ 'user': 'fred', 'age': 40 }]
  15276. *
  15277. * // The `_.property` iteratee shorthand.
  15278. * _.map(users, _.iteratee('user'));
  15279. * // => ['barney', 'fred']
  15280. *
  15281. * // Create custom iteratee shorthands.
  15282. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  15283. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  15284. * return func.test(string);
  15285. * };
  15286. * });
  15287. *
  15288. * _.filter(['abc', 'def'], /ef/);
  15289. * // => ['def']
  15290. */
  15291. function iteratee(func) {
  15292. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  15293. }
  15294. /**
  15295. * Creates a function that performs a partial deep comparison between a given
  15296. * object and `source`, returning `true` if the given object has equivalent
  15297. * property values, else `false`.
  15298. *
  15299. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  15300. * partially applied.
  15301. *
  15302. * Partial comparisons will match empty array and empty object `source`
  15303. * values against any array or object value, respectively. See `_.isEqual`
  15304. * for a list of supported value comparisons.
  15305. *
  15306. * @static
  15307. * @memberOf _
  15308. * @since 3.0.0
  15309. * @category Util
  15310. * @param {Object} source The object of property values to match.
  15311. * @returns {Function} Returns the new spec function.
  15312. * @example
  15313. *
  15314. * var objects = [
  15315. * { 'a': 1, 'b': 2, 'c': 3 },
  15316. * { 'a': 4, 'b': 5, 'c': 6 }
  15317. * ];
  15318. *
  15319. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  15320. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  15321. */
  15322. function matches(source) {
  15323. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  15324. }
  15325. /**
  15326. * Creates a function that performs a partial deep comparison between the
  15327. * value at `path` of a given object to `srcValue`, returning `true` if the
  15328. * object value is equivalent, else `false`.
  15329. *
  15330. * **Note:** Partial comparisons will match empty array and empty object
  15331. * `srcValue` values against any array or object value, respectively. See
  15332. * `_.isEqual` for a list of supported value comparisons.
  15333. *
  15334. * @static
  15335. * @memberOf _
  15336. * @since 3.2.0
  15337. * @category Util
  15338. * @param {Array|string} path The path of the property to get.
  15339. * @param {*} srcValue The value to match.
  15340. * @returns {Function} Returns the new spec function.
  15341. * @example
  15342. *
  15343. * var objects = [
  15344. * { 'a': 1, 'b': 2, 'c': 3 },
  15345. * { 'a': 4, 'b': 5, 'c': 6 }
  15346. * ];
  15347. *
  15348. * _.find(objects, _.matchesProperty('a', 4));
  15349. * // => { 'a': 4, 'b': 5, 'c': 6 }
  15350. */
  15351. function matchesProperty(path, srcValue) {
  15352. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  15353. }
  15354. /**
  15355. * Creates a function that invokes the method at `path` of a given object.
  15356. * Any additional arguments are provided to the invoked method.
  15357. *
  15358. * @static
  15359. * @memberOf _
  15360. * @since 3.7.0
  15361. * @category Util
  15362. * @param {Array|string} path The path of the method to invoke.
  15363. * @param {...*} [args] The arguments to invoke the method with.
  15364. * @returns {Function} Returns the new invoker function.
  15365. * @example
  15366. *
  15367. * var objects = [
  15368. * { 'a': { 'b': _.constant(2) } },
  15369. * { 'a': { 'b': _.constant(1) } }
  15370. * ];
  15371. *
  15372. * _.map(objects, _.method('a.b'));
  15373. * // => [2, 1]
  15374. *
  15375. * _.map(objects, _.method(['a', 'b']));
  15376. * // => [2, 1]
  15377. */
  15378. var method = baseRest(function(path, args) {
  15379. return function(object) {
  15380. return baseInvoke(object, path, args);
  15381. };
  15382. });
  15383. /**
  15384. * The opposite of `_.method`; this method creates a function that invokes
  15385. * the method at a given path of `object`. Any additional arguments are
  15386. * provided to the invoked method.
  15387. *
  15388. * @static
  15389. * @memberOf _
  15390. * @since 3.7.0
  15391. * @category Util
  15392. * @param {Object} object The object to query.
  15393. * @param {...*} [args] The arguments to invoke the method with.
  15394. * @returns {Function} Returns the new invoker function.
  15395. * @example
  15396. *
  15397. * var array = _.times(3, _.constant),
  15398. * object = { 'a': array, 'b': array, 'c': array };
  15399. *
  15400. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  15401. * // => [2, 0]
  15402. *
  15403. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  15404. * // => [2, 0]
  15405. */
  15406. var methodOf = baseRest(function(object, args) {
  15407. return function(path) {
  15408. return baseInvoke(object, path, args);
  15409. };
  15410. });
  15411. /**
  15412. * Adds all own enumerable string keyed function properties of a source
  15413. * object to the destination object. If `object` is a function, then methods
  15414. * are added to its prototype as well.
  15415. *
  15416. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  15417. * avoid conflicts caused by modifying the original.
  15418. *
  15419. * @static
  15420. * @since 0.1.0
  15421. * @memberOf _
  15422. * @category Util
  15423. * @param {Function|Object} [object=lodash] The destination object.
  15424. * @param {Object} source The object of functions to add.
  15425. * @param {Object} [options={}] The options object.
  15426. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  15427. * @returns {Function|Object} Returns `object`.
  15428. * @example
  15429. *
  15430. * function vowels(string) {
  15431. * return _.filter(string, function(v) {
  15432. * return /[aeiou]/i.test(v);
  15433. * });
  15434. * }
  15435. *
  15436. * _.mixin({ 'vowels': vowels });
  15437. * _.vowels('fred');
  15438. * // => ['e']
  15439. *
  15440. * _('fred').vowels().value();
  15441. * // => ['e']
  15442. *
  15443. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  15444. * _('fred').vowels();
  15445. * // => ['e']
  15446. */
  15447. function mixin(object, source, options) {
  15448. var props = keys(source),
  15449. methodNames = baseFunctions(source, props);
  15450. if (options == null &&
  15451. !(isObject(source) && (methodNames.length || !props.length))) {
  15452. options = source;
  15453. source = object;
  15454. object = this;
  15455. methodNames = baseFunctions(source, keys(source));
  15456. }
  15457. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  15458. isFunc = isFunction(object);
  15459. arrayEach(methodNames, function(methodName) {
  15460. var func = source[methodName];
  15461. object[methodName] = func;
  15462. if (isFunc) {
  15463. object.prototype[methodName] = function() {
  15464. var chainAll = this.__chain__;
  15465. if (chain || chainAll) {
  15466. var result = object(this.__wrapped__),
  15467. actions = result.__actions__ = copyArray(this.__actions__);
  15468. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  15469. result.__chain__ = chainAll;
  15470. return result;
  15471. }
  15472. return func.apply(object, arrayPush([this.value()], arguments));
  15473. };
  15474. }
  15475. });
  15476. return object;
  15477. }
  15478. /**
  15479. * Reverts the `_` variable to its previous value and returns a reference to
  15480. * the `lodash` function.
  15481. *
  15482. * @static
  15483. * @since 0.1.0
  15484. * @memberOf _
  15485. * @category Util
  15486. * @returns {Function} Returns the `lodash` function.
  15487. * @example
  15488. *
  15489. * var lodash = _.noConflict();
  15490. */
  15491. function noConflict() {
  15492. if (root._ === this) {
  15493. root._ = oldDash;
  15494. }
  15495. return this;
  15496. }
  15497. /**
  15498. * This method returns `undefined`.
  15499. *
  15500. * @static
  15501. * @memberOf _
  15502. * @since 2.3.0
  15503. * @category Util
  15504. * @example
  15505. *
  15506. * _.times(2, _.noop);
  15507. * // => [undefined, undefined]
  15508. */
  15509. function noop() {
  15510. // No operation performed.
  15511. }
  15512. /**
  15513. * Creates a function that gets the argument at index `n`. If `n` is negative,
  15514. * the nth argument from the end is returned.
  15515. *
  15516. * @static
  15517. * @memberOf _
  15518. * @since 4.0.0
  15519. * @category Util
  15520. * @param {number} [n=0] The index of the argument to return.
  15521. * @returns {Function} Returns the new pass-thru function.
  15522. * @example
  15523. *
  15524. * var func = _.nthArg(1);
  15525. * func('a', 'b', 'c', 'd');
  15526. * // => 'b'
  15527. *
  15528. * var func = _.nthArg(-2);
  15529. * func('a', 'b', 'c', 'd');
  15530. * // => 'c'
  15531. */
  15532. function nthArg(n) {
  15533. n = toInteger(n);
  15534. return baseRest(function(args) {
  15535. return baseNth(args, n);
  15536. });
  15537. }
  15538. /**
  15539. * Creates a function that invokes `iteratees` with the arguments it receives
  15540. * and returns their results.
  15541. *
  15542. * @static
  15543. * @memberOf _
  15544. * @since 4.0.0
  15545. * @category Util
  15546. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  15547. * The iteratees to invoke.
  15548. * @returns {Function} Returns the new function.
  15549. * @example
  15550. *
  15551. * var func = _.over([Math.max, Math.min]);
  15552. *
  15553. * func(1, 2, 3, 4);
  15554. * // => [4, 1]
  15555. */
  15556. var over = createOver(arrayMap);
  15557. /**
  15558. * Creates a function that checks if **all** of the `predicates` return
  15559. * truthy when invoked with the arguments it receives.
  15560. *
  15561. * @static
  15562. * @memberOf _
  15563. * @since 4.0.0
  15564. * @category Util
  15565. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15566. * The predicates to check.
  15567. * @returns {Function} Returns the new function.
  15568. * @example
  15569. *
  15570. * var func = _.overEvery([Boolean, isFinite]);
  15571. *
  15572. * func('1');
  15573. * // => true
  15574. *
  15575. * func(null);
  15576. * // => false
  15577. *
  15578. * func(NaN);
  15579. * // => false
  15580. */
  15581. var overEvery = createOver(arrayEvery);
  15582. /**
  15583. * Creates a function that checks if **any** of the `predicates` return
  15584. * truthy when invoked with the arguments it receives.
  15585. *
  15586. * @static
  15587. * @memberOf _
  15588. * @since 4.0.0
  15589. * @category Util
  15590. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15591. * The predicates to check.
  15592. * @returns {Function} Returns the new function.
  15593. * @example
  15594. *
  15595. * var func = _.overSome([Boolean, isFinite]);
  15596. *
  15597. * func('1');
  15598. * // => true
  15599. *
  15600. * func(null);
  15601. * // => true
  15602. *
  15603. * func(NaN);
  15604. * // => false
  15605. */
  15606. var overSome = createOver(arraySome);
  15607. /**
  15608. * Creates a function that returns the value at `path` of a given object.
  15609. *
  15610. * @static
  15611. * @memberOf _
  15612. * @since 2.4.0
  15613. * @category Util
  15614. * @param {Array|string} path The path of the property to get.
  15615. * @returns {Function} Returns the new accessor function.
  15616. * @example
  15617. *
  15618. * var objects = [
  15619. * { 'a': { 'b': 2 } },
  15620. * { 'a': { 'b': 1 } }
  15621. * ];
  15622. *
  15623. * _.map(objects, _.property('a.b'));
  15624. * // => [2, 1]
  15625. *
  15626. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  15627. * // => [1, 2]
  15628. */
  15629. function property(path) {
  15630. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  15631. }
  15632. /**
  15633. * The opposite of `_.property`; this method creates a function that returns
  15634. * the value at a given path of `object`.
  15635. *
  15636. * @static
  15637. * @memberOf _
  15638. * @since 3.0.0
  15639. * @category Util
  15640. * @param {Object} object The object to query.
  15641. * @returns {Function} Returns the new accessor function.
  15642. * @example
  15643. *
  15644. * var array = [0, 1, 2],
  15645. * object = { 'a': array, 'b': array, 'c': array };
  15646. *
  15647. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  15648. * // => [2, 0]
  15649. *
  15650. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  15651. * // => [2, 0]
  15652. */
  15653. function propertyOf(object) {
  15654. return function(path) {
  15655. return object == null ? undefined : baseGet(object, path);
  15656. };
  15657. }
  15658. /**
  15659. * Creates an array of numbers (positive and/or negative) progressing from
  15660. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  15661. * `start` is specified without an `end` or `step`. If `end` is not specified,
  15662. * it's set to `start` with `start` then set to `0`.
  15663. *
  15664. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  15665. * floating-point values which can produce unexpected results.
  15666. *
  15667. * @static
  15668. * @since 0.1.0
  15669. * @memberOf _
  15670. * @category Util
  15671. * @param {number} [start=0] The start of the range.
  15672. * @param {number} end The end of the range.
  15673. * @param {number} [step=1] The value to increment or decrement by.
  15674. * @returns {Array} Returns the range of numbers.
  15675. * @see _.inRange, _.rangeRight
  15676. * @example
  15677. *
  15678. * _.range(4);
  15679. * // => [0, 1, 2, 3]
  15680. *
  15681. * _.range(-4);
  15682. * // => [0, -1, -2, -3]
  15683. *
  15684. * _.range(1, 5);
  15685. * // => [1, 2, 3, 4]
  15686. *
  15687. * _.range(0, 20, 5);
  15688. * // => [0, 5, 10, 15]
  15689. *
  15690. * _.range(0, -4, -1);
  15691. * // => [0, -1, -2, -3]
  15692. *
  15693. * _.range(1, 4, 0);
  15694. * // => [1, 1, 1]
  15695. *
  15696. * _.range(0);
  15697. * // => []
  15698. */
  15699. var range = createRange();
  15700. /**
  15701. * This method is like `_.range` except that it populates values in
  15702. * descending order.
  15703. *
  15704. * @static
  15705. * @memberOf _
  15706. * @since 4.0.0
  15707. * @category Util
  15708. * @param {number} [start=0] The start of the range.
  15709. * @param {number} end The end of the range.
  15710. * @param {number} [step=1] The value to increment or decrement by.
  15711. * @returns {Array} Returns the range of numbers.
  15712. * @see _.inRange, _.range
  15713. * @example
  15714. *
  15715. * _.rangeRight(4);
  15716. * // => [3, 2, 1, 0]
  15717. *
  15718. * _.rangeRight(-4);
  15719. * // => [-3, -2, -1, 0]
  15720. *
  15721. * _.rangeRight(1, 5);
  15722. * // => [4, 3, 2, 1]
  15723. *
  15724. * _.rangeRight(0, 20, 5);
  15725. * // => [15, 10, 5, 0]
  15726. *
  15727. * _.rangeRight(0, -4, -1);
  15728. * // => [-3, -2, -1, 0]
  15729. *
  15730. * _.rangeRight(1, 4, 0);
  15731. * // => [1, 1, 1]
  15732. *
  15733. * _.rangeRight(0);
  15734. * // => []
  15735. */
  15736. var rangeRight = createRange(true);
  15737. /**
  15738. * This method returns a new empty array.
  15739. *
  15740. * @static
  15741. * @memberOf _
  15742. * @since 4.13.0
  15743. * @category Util
  15744. * @returns {Array} Returns the new empty array.
  15745. * @example
  15746. *
  15747. * var arrays = _.times(2, _.stubArray);
  15748. *
  15749. * console.log(arrays);
  15750. * // => [[], []]
  15751. *
  15752. * console.log(arrays[0] === arrays[1]);
  15753. * // => false
  15754. */
  15755. function stubArray() {
  15756. return [];
  15757. }
  15758. /**
  15759. * This method returns `false`.
  15760. *
  15761. * @static
  15762. * @memberOf _
  15763. * @since 4.13.0
  15764. * @category Util
  15765. * @returns {boolean} Returns `false`.
  15766. * @example
  15767. *
  15768. * _.times(2, _.stubFalse);
  15769. * // => [false, false]
  15770. */
  15771. function stubFalse() {
  15772. return false;
  15773. }
  15774. /**
  15775. * This method returns a new empty object.
  15776. *
  15777. * @static
  15778. * @memberOf _
  15779. * @since 4.13.0
  15780. * @category Util
  15781. * @returns {Object} Returns the new empty object.
  15782. * @example
  15783. *
  15784. * var objects = _.times(2, _.stubObject);
  15785. *
  15786. * console.log(objects);
  15787. * // => [{}, {}]
  15788. *
  15789. * console.log(objects[0] === objects[1]);
  15790. * // => false
  15791. */
  15792. function stubObject() {
  15793. return {};
  15794. }
  15795. /**
  15796. * This method returns an empty string.
  15797. *
  15798. * @static
  15799. * @memberOf _
  15800. * @since 4.13.0
  15801. * @category Util
  15802. * @returns {string} Returns the empty string.
  15803. * @example
  15804. *
  15805. * _.times(2, _.stubString);
  15806. * // => ['', '']
  15807. */
  15808. function stubString() {
  15809. return '';
  15810. }
  15811. /**
  15812. * This method returns `true`.
  15813. *
  15814. * @static
  15815. * @memberOf _
  15816. * @since 4.13.0
  15817. * @category Util
  15818. * @returns {boolean} Returns `true`.
  15819. * @example
  15820. *
  15821. * _.times(2, _.stubTrue);
  15822. * // => [true, true]
  15823. */
  15824. function stubTrue() {
  15825. return true;
  15826. }
  15827. /**
  15828. * Invokes the iteratee `n` times, returning an array of the results of
  15829. * each invocation. The iteratee is invoked with one argument; (index).
  15830. *
  15831. * @static
  15832. * @since 0.1.0
  15833. * @memberOf _
  15834. * @category Util
  15835. * @param {number} n The number of times to invoke `iteratee`.
  15836. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  15837. * @returns {Array} Returns the array of results.
  15838. * @example
  15839. *
  15840. * _.times(3, String);
  15841. * // => ['0', '1', '2']
  15842. *
  15843. * _.times(4, _.constant(0));
  15844. * // => [0, 0, 0, 0]
  15845. */
  15846. function times(n, iteratee) {
  15847. n = toInteger(n);
  15848. if (n < 1 || n > MAX_SAFE_INTEGER) {
  15849. return [];
  15850. }
  15851. var index = MAX_ARRAY_LENGTH,
  15852. length = nativeMin(n, MAX_ARRAY_LENGTH);
  15853. iteratee = getIteratee(iteratee);
  15854. n -= MAX_ARRAY_LENGTH;
  15855. var result = baseTimes(length, iteratee);
  15856. while (++index < n) {
  15857. iteratee(index);
  15858. }
  15859. return result;
  15860. }
  15861. /**
  15862. * Converts `value` to a property path array.
  15863. *
  15864. * @static
  15865. * @memberOf _
  15866. * @since 4.0.0
  15867. * @category Util
  15868. * @param {*} value The value to convert.
  15869. * @returns {Array} Returns the new property path array.
  15870. * @example
  15871. *
  15872. * _.toPath('a.b.c');
  15873. * // => ['a', 'b', 'c']
  15874. *
  15875. * _.toPath('a[0].b.c');
  15876. * // => ['a', '0', 'b', 'c']
  15877. */
  15878. function toPath(value) {
  15879. if (isArray(value)) {
  15880. return arrayMap(value, toKey);
  15881. }
  15882. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  15883. }
  15884. /**
  15885. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  15886. *
  15887. * @static
  15888. * @since 0.1.0
  15889. * @memberOf _
  15890. * @category Util
  15891. * @param {string} [prefix=''] The value to prefix the ID with.
  15892. * @returns {string} Returns the unique ID.
  15893. * @example
  15894. *
  15895. * _.uniqueId('contact_');
  15896. * // => 'contact_104'
  15897. *
  15898. * _.uniqueId();
  15899. * // => '105'
  15900. */
  15901. function uniqueId(prefix) {
  15902. var id = ++idCounter;
  15903. return toString(prefix) + id;
  15904. }
  15905. /*------------------------------------------------------------------------*/
  15906. /**
  15907. * Adds two numbers.
  15908. *
  15909. * @static
  15910. * @memberOf _
  15911. * @since 3.4.0
  15912. * @category Math
  15913. * @param {number} augend The first number in an addition.
  15914. * @param {number} addend The second number in an addition.
  15915. * @returns {number} Returns the total.
  15916. * @example
  15917. *
  15918. * _.add(6, 4);
  15919. * // => 10
  15920. */
  15921. var add = createMathOperation(function(augend, addend) {
  15922. return augend + addend;
  15923. }, 0);
  15924. /**
  15925. * Computes `number` rounded up to `precision`.
  15926. *
  15927. * @static
  15928. * @memberOf _
  15929. * @since 3.10.0
  15930. * @category Math
  15931. * @param {number} number The number to round up.
  15932. * @param {number} [precision=0] The precision to round up to.
  15933. * @returns {number} Returns the rounded up number.
  15934. * @example
  15935. *
  15936. * _.ceil(4.006);
  15937. * // => 5
  15938. *
  15939. * _.ceil(6.004, 2);
  15940. * // => 6.01
  15941. *
  15942. * _.ceil(6040, -2);
  15943. * // => 6100
  15944. */
  15945. var ceil = createRound('ceil');
  15946. /**
  15947. * Divide two numbers.
  15948. *
  15949. * @static
  15950. * @memberOf _
  15951. * @since 4.7.0
  15952. * @category Math
  15953. * @param {number} dividend The first number in a division.
  15954. * @param {number} divisor The second number in a division.
  15955. * @returns {number} Returns the quotient.
  15956. * @example
  15957. *
  15958. * _.divide(6, 4);
  15959. * // => 1.5
  15960. */
  15961. var divide = createMathOperation(function(dividend, divisor) {
  15962. return dividend / divisor;
  15963. }, 1);
  15964. /**
  15965. * Computes `number` rounded down to `precision`.
  15966. *
  15967. * @static
  15968. * @memberOf _
  15969. * @since 3.10.0
  15970. * @category Math
  15971. * @param {number} number The number to round down.
  15972. * @param {number} [precision=0] The precision to round down to.
  15973. * @returns {number} Returns the rounded down number.
  15974. * @example
  15975. *
  15976. * _.floor(4.006);
  15977. * // => 4
  15978. *
  15979. * _.floor(0.046, 2);
  15980. * // => 0.04
  15981. *
  15982. * _.floor(4060, -2);
  15983. * // => 4000
  15984. */
  15985. var floor = createRound('floor');
  15986. /**
  15987. * Computes the maximum value of `array`. If `array` is empty or falsey,
  15988. * `undefined` is returned.
  15989. *
  15990. * @static
  15991. * @since 0.1.0
  15992. * @memberOf _
  15993. * @category Math
  15994. * @param {Array} array The array to iterate over.
  15995. * @returns {*} Returns the maximum value.
  15996. * @example
  15997. *
  15998. * _.max([4, 2, 8, 6]);
  15999. * // => 8
  16000. *
  16001. * _.max([]);
  16002. * // => undefined
  16003. */
  16004. function max(array) {
  16005. return (array && array.length)
  16006. ? baseExtremum(array, identity, baseGt)
  16007. : undefined;
  16008. }
  16009. /**
  16010. * This method is like `_.max` except that it accepts `iteratee` which is
  16011. * invoked for each element in `array` to generate the criterion by which
  16012. * the value is ranked. The iteratee is invoked with one argument: (value).
  16013. *
  16014. * @static
  16015. * @memberOf _
  16016. * @since 4.0.0
  16017. * @category Math
  16018. * @param {Array} array The array to iterate over.
  16019. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16020. * @returns {*} Returns the maximum value.
  16021. * @example
  16022. *
  16023. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16024. *
  16025. * _.maxBy(objects, function(o) { return o.n; });
  16026. * // => { 'n': 2 }
  16027. *
  16028. * // The `_.property` iteratee shorthand.
  16029. * _.maxBy(objects, 'n');
  16030. * // => { 'n': 2 }
  16031. */
  16032. function maxBy(array, iteratee) {
  16033. return (array && array.length)
  16034. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  16035. : undefined;
  16036. }
  16037. /**
  16038. * Computes the mean of the values in `array`.
  16039. *
  16040. * @static
  16041. * @memberOf _
  16042. * @since 4.0.0
  16043. * @category Math
  16044. * @param {Array} array The array to iterate over.
  16045. * @returns {number} Returns the mean.
  16046. * @example
  16047. *
  16048. * _.mean([4, 2, 8, 6]);
  16049. * // => 5
  16050. */
  16051. function mean(array) {
  16052. return baseMean(array, identity);
  16053. }
  16054. /**
  16055. * This method is like `_.mean` except that it accepts `iteratee` which is
  16056. * invoked for each element in `array` to generate the value to be averaged.
  16057. * The iteratee is invoked with one argument: (value).
  16058. *
  16059. * @static
  16060. * @memberOf _
  16061. * @since 4.7.0
  16062. * @category Math
  16063. * @param {Array} array The array to iterate over.
  16064. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16065. * @returns {number} Returns the mean.
  16066. * @example
  16067. *
  16068. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16069. *
  16070. * _.meanBy(objects, function(o) { return o.n; });
  16071. * // => 5
  16072. *
  16073. * // The `_.property` iteratee shorthand.
  16074. * _.meanBy(objects, 'n');
  16075. * // => 5
  16076. */
  16077. function meanBy(array, iteratee) {
  16078. return baseMean(array, getIteratee(iteratee, 2));
  16079. }
  16080. /**
  16081. * Computes the minimum value of `array`. If `array` is empty or falsey,
  16082. * `undefined` is returned.
  16083. *
  16084. * @static
  16085. * @since 0.1.0
  16086. * @memberOf _
  16087. * @category Math
  16088. * @param {Array} array The array to iterate over.
  16089. * @returns {*} Returns the minimum value.
  16090. * @example
  16091. *
  16092. * _.min([4, 2, 8, 6]);
  16093. * // => 2
  16094. *
  16095. * _.min([]);
  16096. * // => undefined
  16097. */
  16098. function min(array) {
  16099. return (array && array.length)
  16100. ? baseExtremum(array, identity, baseLt)
  16101. : undefined;
  16102. }
  16103. /**
  16104. * This method is like `_.min` except that it accepts `iteratee` which is
  16105. * invoked for each element in `array` to generate the criterion by which
  16106. * the value is ranked. The iteratee is invoked with one argument: (value).
  16107. *
  16108. * @static
  16109. * @memberOf _
  16110. * @since 4.0.0
  16111. * @category Math
  16112. * @param {Array} array The array to iterate over.
  16113. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16114. * @returns {*} Returns the minimum value.
  16115. * @example
  16116. *
  16117. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16118. *
  16119. * _.minBy(objects, function(o) { return o.n; });
  16120. * // => { 'n': 1 }
  16121. *
  16122. * // The `_.property` iteratee shorthand.
  16123. * _.minBy(objects, 'n');
  16124. * // => { 'n': 1 }
  16125. */
  16126. function minBy(array, iteratee) {
  16127. return (array && array.length)
  16128. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  16129. : undefined;
  16130. }
  16131. /**
  16132. * Multiply two numbers.
  16133. *
  16134. * @static
  16135. * @memberOf _
  16136. * @since 4.7.0
  16137. * @category Math
  16138. * @param {number} multiplier The first number in a multiplication.
  16139. * @param {number} multiplicand The second number in a multiplication.
  16140. * @returns {number} Returns the product.
  16141. * @example
  16142. *
  16143. * _.multiply(6, 4);
  16144. * // => 24
  16145. */
  16146. var multiply = createMathOperation(function(multiplier, multiplicand) {
  16147. return multiplier * multiplicand;
  16148. }, 1);
  16149. /**
  16150. * Computes `number` rounded to `precision`.
  16151. *
  16152. * @static
  16153. * @memberOf _
  16154. * @since 3.10.0
  16155. * @category Math
  16156. * @param {number} number The number to round.
  16157. * @param {number} [precision=0] The precision to round to.
  16158. * @returns {number} Returns the rounded number.
  16159. * @example
  16160. *
  16161. * _.round(4.006);
  16162. * // => 4
  16163. *
  16164. * _.round(4.006, 2);
  16165. * // => 4.01
  16166. *
  16167. * _.round(4060, -2);
  16168. * // => 4100
  16169. */
  16170. var round = createRound('round');
  16171. /**
  16172. * Subtract two numbers.
  16173. *
  16174. * @static
  16175. * @memberOf _
  16176. * @since 4.0.0
  16177. * @category Math
  16178. * @param {number} minuend The first number in a subtraction.
  16179. * @param {number} subtrahend The second number in a subtraction.
  16180. * @returns {number} Returns the difference.
  16181. * @example
  16182. *
  16183. * _.subtract(6, 4);
  16184. * // => 2
  16185. */
  16186. var subtract = createMathOperation(function(minuend, subtrahend) {
  16187. return minuend - subtrahend;
  16188. }, 0);
  16189. /**
  16190. * Computes the sum of the values in `array`.
  16191. *
  16192. * @static
  16193. * @memberOf _
  16194. * @since 3.4.0
  16195. * @category Math
  16196. * @param {Array} array The array to iterate over.
  16197. * @returns {number} Returns the sum.
  16198. * @example
  16199. *
  16200. * _.sum([4, 2, 8, 6]);
  16201. * // => 20
  16202. */
  16203. function sum(array) {
  16204. return (array && array.length)
  16205. ? baseSum(array, identity)
  16206. : 0;
  16207. }
  16208. /**
  16209. * This method is like `_.sum` except that it accepts `iteratee` which is
  16210. * invoked for each element in `array` to generate the value to be summed.
  16211. * The iteratee is invoked with one argument: (value).
  16212. *
  16213. * @static
  16214. * @memberOf _
  16215. * @since 4.0.0
  16216. * @category Math
  16217. * @param {Array} array The array to iterate over.
  16218. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16219. * @returns {number} Returns the sum.
  16220. * @example
  16221. *
  16222. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16223. *
  16224. * _.sumBy(objects, function(o) { return o.n; });
  16225. * // => 20
  16226. *
  16227. * // The `_.property` iteratee shorthand.
  16228. * _.sumBy(objects, 'n');
  16229. * // => 20
  16230. */
  16231. function sumBy(array, iteratee) {
  16232. return (array && array.length)
  16233. ? baseSum(array, getIteratee(iteratee, 2))
  16234. : 0;
  16235. }
  16236. /*------------------------------------------------------------------------*/
  16237. // Add methods that return wrapped values in chain sequences.
  16238. lodash.after = after;
  16239. lodash.ary = ary;
  16240. lodash.assign = assign;
  16241. lodash.assignIn = assignIn;
  16242. lodash.assignInWith = assignInWith;
  16243. lodash.assignWith = assignWith;
  16244. lodash.at = at;
  16245. lodash.before = before;
  16246. lodash.bind = bind;
  16247. lodash.bindAll = bindAll;
  16248. lodash.bindKey = bindKey;
  16249. lodash.castArray = castArray;
  16250. lodash.chain = chain;
  16251. lodash.chunk = chunk;
  16252. lodash.compact = compact;
  16253. lodash.concat = concat;
  16254. lodash.cond = cond;
  16255. lodash.conforms = conforms;
  16256. lodash.constant = constant;
  16257. lodash.countBy = countBy;
  16258. lodash.create = create;
  16259. lodash.curry = curry;
  16260. lodash.curryRight = curryRight;
  16261. lodash.debounce = debounce;
  16262. lodash.defaults = defaults;
  16263. lodash.defaultsDeep = defaultsDeep;
  16264. lodash.defer = defer;
  16265. lodash.delay = delay;
  16266. lodash.difference = difference;
  16267. lodash.differenceBy = differenceBy;
  16268. lodash.differenceWith = differenceWith;
  16269. lodash.drop = drop;
  16270. lodash.dropRight = dropRight;
  16271. lodash.dropRightWhile = dropRightWhile;
  16272. lodash.dropWhile = dropWhile;
  16273. lodash.fill = fill;
  16274. lodash.filter = filter;
  16275. lodash.flatMap = flatMap;
  16276. lodash.flatMapDeep = flatMapDeep;
  16277. lodash.flatMapDepth = flatMapDepth;
  16278. lodash.flatten = flatten;
  16279. lodash.flattenDeep = flattenDeep;
  16280. lodash.flattenDepth = flattenDepth;
  16281. lodash.flip = flip;
  16282. lodash.flow = flow;
  16283. lodash.flowRight = flowRight;
  16284. lodash.fromPairs = fromPairs;
  16285. lodash.functions = functions;
  16286. lodash.functionsIn = functionsIn;
  16287. lodash.groupBy = groupBy;
  16288. lodash.initial = initial;
  16289. lodash.intersection = intersection;
  16290. lodash.intersectionBy = intersectionBy;
  16291. lodash.intersectionWith = intersectionWith;
  16292. lodash.invert = invert;
  16293. lodash.invertBy = invertBy;
  16294. lodash.invokeMap = invokeMap;
  16295. lodash.iteratee = iteratee;
  16296. lodash.keyBy = keyBy;
  16297. lodash.keys = keys;
  16298. lodash.keysIn = keysIn;
  16299. lodash.map = map;
  16300. lodash.mapKeys = mapKeys;
  16301. lodash.mapValues = mapValues;
  16302. lodash.matches = matches;
  16303. lodash.matchesProperty = matchesProperty;
  16304. lodash.memoize = memoize;
  16305. lodash.merge = merge;
  16306. lodash.mergeWith = mergeWith;
  16307. lodash.method = method;
  16308. lodash.methodOf = methodOf;
  16309. lodash.mixin = mixin;
  16310. lodash.negate = negate;
  16311. lodash.nthArg = nthArg;
  16312. lodash.omit = omit;
  16313. lodash.omitBy = omitBy;
  16314. lodash.once = once;
  16315. lodash.orderBy = orderBy;
  16316. lodash.over = over;
  16317. lodash.overArgs = overArgs;
  16318. lodash.overEvery = overEvery;
  16319. lodash.overSome = overSome;
  16320. lodash.partial = partial;
  16321. lodash.partialRight = partialRight;
  16322. lodash.partition = partition;
  16323. lodash.pick = pick;
  16324. lodash.pickBy = pickBy;
  16325. lodash.property = property;
  16326. lodash.propertyOf = propertyOf;
  16327. lodash.pull = pull;
  16328. lodash.pullAll = pullAll;
  16329. lodash.pullAllBy = pullAllBy;
  16330. lodash.pullAllWith = pullAllWith;
  16331. lodash.pullAt = pullAt;
  16332. lodash.range = range;
  16333. lodash.rangeRight = rangeRight;
  16334. lodash.rearg = rearg;
  16335. lodash.reject = reject;
  16336. lodash.remove = remove;
  16337. lodash.rest = rest;
  16338. lodash.reverse = reverse;
  16339. lodash.sampleSize = sampleSize;
  16340. lodash.set = set;
  16341. lodash.setWith = setWith;
  16342. lodash.shuffle = shuffle;
  16343. lodash.slice = slice;
  16344. lodash.sortBy = sortBy;
  16345. lodash.sortedUniq = sortedUniq;
  16346. lodash.sortedUniqBy = sortedUniqBy;
  16347. lodash.split = split;
  16348. lodash.spread = spread;
  16349. lodash.tail = tail;
  16350. lodash.take = take;
  16351. lodash.takeRight = takeRight;
  16352. lodash.takeRightWhile = takeRightWhile;
  16353. lodash.takeWhile = takeWhile;
  16354. lodash.tap = tap;
  16355. lodash.throttle = throttle;
  16356. lodash.thru = thru;
  16357. lodash.toArray = toArray;
  16358. lodash.toPairs = toPairs;
  16359. lodash.toPairsIn = toPairsIn;
  16360. lodash.toPath = toPath;
  16361. lodash.toPlainObject = toPlainObject;
  16362. lodash.transform = transform;
  16363. lodash.unary = unary;
  16364. lodash.union = union;
  16365. lodash.unionBy = unionBy;
  16366. lodash.unionWith = unionWith;
  16367. lodash.uniq = uniq;
  16368. lodash.uniqBy = uniqBy;
  16369. lodash.uniqWith = uniqWith;
  16370. lodash.unset = unset;
  16371. lodash.unzip = unzip;
  16372. lodash.unzipWith = unzipWith;
  16373. lodash.update = update;
  16374. lodash.updateWith = updateWith;
  16375. lodash.values = values;
  16376. lodash.valuesIn = valuesIn;
  16377. lodash.without = without;
  16378. lodash.words = words;
  16379. lodash.wrap = wrap;
  16380. lodash.xor = xor;
  16381. lodash.xorBy = xorBy;
  16382. lodash.xorWith = xorWith;
  16383. lodash.zip = zip;
  16384. lodash.zipObject = zipObject;
  16385. lodash.zipObjectDeep = zipObjectDeep;
  16386. lodash.zipWith = zipWith;
  16387. // Add aliases.
  16388. lodash.entries = toPairs;
  16389. lodash.entriesIn = toPairsIn;
  16390. lodash.extend = assignIn;
  16391. lodash.extendWith = assignInWith;
  16392. // Add methods to `lodash.prototype`.
  16393. mixin(lodash, lodash);
  16394. /*------------------------------------------------------------------------*/
  16395. // Add methods that return unwrapped values in chain sequences.
  16396. lodash.add = add;
  16397. lodash.attempt = attempt;
  16398. lodash.camelCase = camelCase;
  16399. lodash.capitalize = capitalize;
  16400. lodash.ceil = ceil;
  16401. lodash.clamp = clamp;
  16402. lodash.clone = clone;
  16403. lodash.cloneDeep = cloneDeep;
  16404. lodash.cloneDeepWith = cloneDeepWith;
  16405. lodash.cloneWith = cloneWith;
  16406. lodash.conformsTo = conformsTo;
  16407. lodash.deburr = deburr;
  16408. lodash.defaultTo = defaultTo;
  16409. lodash.divide = divide;
  16410. lodash.endsWith = endsWith;
  16411. lodash.eq = eq;
  16412. lodash.escape = escape;
  16413. lodash.escapeRegExp = escapeRegExp;
  16414. lodash.every = every;
  16415. lodash.find = find;
  16416. lodash.findIndex = findIndex;
  16417. lodash.findKey = findKey;
  16418. lodash.findLast = findLast;
  16419. lodash.findLastIndex = findLastIndex;
  16420. lodash.findLastKey = findLastKey;
  16421. lodash.floor = floor;
  16422. lodash.forEach = forEach;
  16423. lodash.forEachRight = forEachRight;
  16424. lodash.forIn = forIn;
  16425. lodash.forInRight = forInRight;
  16426. lodash.forOwn = forOwn;
  16427. lodash.forOwnRight = forOwnRight;
  16428. lodash.get = get;
  16429. lodash.gt = gt;
  16430. lodash.gte = gte;
  16431. lodash.has = has;
  16432. lodash.hasIn = hasIn;
  16433. lodash.head = head;
  16434. lodash.identity = identity;
  16435. lodash.includes = includes;
  16436. lodash.indexOf = indexOf;
  16437. lodash.inRange = inRange;
  16438. lodash.invoke = invoke;
  16439. lodash.isArguments = isArguments;
  16440. lodash.isArray = isArray;
  16441. lodash.isArrayBuffer = isArrayBuffer;
  16442. lodash.isArrayLike = isArrayLike;
  16443. lodash.isArrayLikeObject = isArrayLikeObject;
  16444. lodash.isBoolean = isBoolean;
  16445. lodash.isBuffer = isBuffer;
  16446. lodash.isDate = isDate;
  16447. lodash.isElement = isElement;
  16448. lodash.isEmpty = isEmpty;
  16449. lodash.isEqual = isEqual;
  16450. lodash.isEqualWith = isEqualWith;
  16451. lodash.isError = isError;
  16452. lodash.isFinite = isFinite;
  16453. lodash.isFunction = isFunction;
  16454. lodash.isInteger = isInteger;
  16455. lodash.isLength = isLength;
  16456. lodash.isMap = isMap;
  16457. lodash.isMatch = isMatch;
  16458. lodash.isMatchWith = isMatchWith;
  16459. lodash.isNaN = isNaN;
  16460. lodash.isNative = isNative;
  16461. lodash.isNil = isNil;
  16462. lodash.isNull = isNull;
  16463. lodash.isNumber = isNumber;
  16464. lodash.isObject = isObject;
  16465. lodash.isObjectLike = isObjectLike;
  16466. lodash.isPlainObject = isPlainObject;
  16467. lodash.isRegExp = isRegExp;
  16468. lodash.isSafeInteger = isSafeInteger;
  16469. lodash.isSet = isSet;
  16470. lodash.isString = isString;
  16471. lodash.isSymbol = isSymbol;
  16472. lodash.isTypedArray = isTypedArray;
  16473. lodash.isUndefined = isUndefined;
  16474. lodash.isWeakMap = isWeakMap;
  16475. lodash.isWeakSet = isWeakSet;
  16476. lodash.join = join;
  16477. lodash.kebabCase = kebabCase;
  16478. lodash.last = last;
  16479. lodash.lastIndexOf = lastIndexOf;
  16480. lodash.lowerCase = lowerCase;
  16481. lodash.lowerFirst = lowerFirst;
  16482. lodash.lt = lt;
  16483. lodash.lte = lte;
  16484. lodash.max = max;
  16485. lodash.maxBy = maxBy;
  16486. lodash.mean = mean;
  16487. lodash.meanBy = meanBy;
  16488. lodash.min = min;
  16489. lodash.minBy = minBy;
  16490. lodash.stubArray = stubArray;
  16491. lodash.stubFalse = stubFalse;
  16492. lodash.stubObject = stubObject;
  16493. lodash.stubString = stubString;
  16494. lodash.stubTrue = stubTrue;
  16495. lodash.multiply = multiply;
  16496. lodash.nth = nth;
  16497. lodash.noConflict = noConflict;
  16498. lodash.noop = noop;
  16499. lodash.now = now;
  16500. lodash.pad = pad;
  16501. lodash.padEnd = padEnd;
  16502. lodash.padStart = padStart;
  16503. lodash.parseInt = parseInt;
  16504. lodash.random = random;
  16505. lodash.reduce = reduce;
  16506. lodash.reduceRight = reduceRight;
  16507. lodash.repeat = repeat;
  16508. lodash.replace = replace;
  16509. lodash.result = result;
  16510. lodash.round = round;
  16511. lodash.runInContext = runInContext;
  16512. lodash.sample = sample;
  16513. lodash.size = size;
  16514. lodash.snakeCase = snakeCase;
  16515. lodash.some = some;
  16516. lodash.sortedIndex = sortedIndex;
  16517. lodash.sortedIndexBy = sortedIndexBy;
  16518. lodash.sortedIndexOf = sortedIndexOf;
  16519. lodash.sortedLastIndex = sortedLastIndex;
  16520. lodash.sortedLastIndexBy = sortedLastIndexBy;
  16521. lodash.sortedLastIndexOf = sortedLastIndexOf;
  16522. lodash.startCase = startCase;
  16523. lodash.startsWith = startsWith;
  16524. lodash.subtract = subtract;
  16525. lodash.sum = sum;
  16526. lodash.sumBy = sumBy;
  16527. lodash.template = template;
  16528. lodash.times = times;
  16529. lodash.toFinite = toFinite;
  16530. lodash.toInteger = toInteger;
  16531. lodash.toLength = toLength;
  16532. lodash.toLower = toLower;
  16533. lodash.toNumber = toNumber;
  16534. lodash.toSafeInteger = toSafeInteger;
  16535. lodash.toString = toString;
  16536. lodash.toUpper = toUpper;
  16537. lodash.trim = trim;
  16538. lodash.trimEnd = trimEnd;
  16539. lodash.trimStart = trimStart;
  16540. lodash.truncate = truncate;
  16541. lodash.unescape = unescape;
  16542. lodash.uniqueId = uniqueId;
  16543. lodash.upperCase = upperCase;
  16544. lodash.upperFirst = upperFirst;
  16545. // Add aliases.
  16546. lodash.each = forEach;
  16547. lodash.eachRight = forEachRight;
  16548. lodash.first = head;
  16549. mixin(lodash, (function() {
  16550. var source = {};
  16551. baseForOwn(lodash, function(func, methodName) {
  16552. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  16553. source[methodName] = func;
  16554. }
  16555. });
  16556. return source;
  16557. }()), { 'chain': false });
  16558. /*------------------------------------------------------------------------*/
  16559. /**
  16560. * The semantic version number.
  16561. *
  16562. * @static
  16563. * @memberOf _
  16564. * @type {string}
  16565. */
  16566. lodash.VERSION = VERSION;
  16567. // Assign default placeholders.
  16568. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  16569. lodash[methodName].placeholder = lodash;
  16570. });
  16571. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  16572. arrayEach(['drop', 'take'], function(methodName, index) {
  16573. LazyWrapper.prototype[methodName] = function(n) {
  16574. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  16575. var result = (this.__filtered__ && !index)
  16576. ? new LazyWrapper(this)
  16577. : this.clone();
  16578. if (result.__filtered__) {
  16579. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  16580. } else {
  16581. result.__views__.push({
  16582. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  16583. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  16584. });
  16585. }
  16586. return result;
  16587. };
  16588. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  16589. return this.reverse()[methodName](n).reverse();
  16590. };
  16591. });
  16592. // Add `LazyWrapper` methods that accept an `iteratee` value.
  16593. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  16594. var type = index + 1,
  16595. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  16596. LazyWrapper.prototype[methodName] = function(iteratee) {
  16597. var result = this.clone();
  16598. result.__iteratees__.push({
  16599. 'iteratee': getIteratee(iteratee, 3),
  16600. 'type': type
  16601. });
  16602. result.__filtered__ = result.__filtered__ || isFilter;
  16603. return result;
  16604. };
  16605. });
  16606. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  16607. arrayEach(['head', 'last'], function(methodName, index) {
  16608. var takeName = 'take' + (index ? 'Right' : '');
  16609. LazyWrapper.prototype[methodName] = function() {
  16610. return this[takeName](1).value()[0];
  16611. };
  16612. });
  16613. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  16614. arrayEach(['initial', 'tail'], function(methodName, index) {
  16615. var dropName = 'drop' + (index ? '' : 'Right');
  16616. LazyWrapper.prototype[methodName] = function() {
  16617. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  16618. };
  16619. });
  16620. LazyWrapper.prototype.compact = function() {
  16621. return this.filter(identity);
  16622. };
  16623. LazyWrapper.prototype.find = function(predicate) {
  16624. return this.filter(predicate).head();
  16625. };
  16626. LazyWrapper.prototype.findLast = function(predicate) {
  16627. return this.reverse().find(predicate);
  16628. };
  16629. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  16630. if (typeof path == 'function') {
  16631. return new LazyWrapper(this);
  16632. }
  16633. return this.map(function(value) {
  16634. return baseInvoke(value, path, args);
  16635. });
  16636. });
  16637. LazyWrapper.prototype.reject = function(predicate) {
  16638. return this.filter(negate(getIteratee(predicate)));
  16639. };
  16640. LazyWrapper.prototype.slice = function(start, end) {
  16641. start = toInteger(start);
  16642. var result = this;
  16643. if (result.__filtered__ && (start > 0 || end < 0)) {
  16644. return new LazyWrapper(result);
  16645. }
  16646. if (start < 0) {
  16647. result = result.takeRight(-start);
  16648. } else if (start) {
  16649. result = result.drop(start);
  16650. }
  16651. if (end !== undefined) {
  16652. end = toInteger(end);
  16653. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  16654. }
  16655. return result;
  16656. };
  16657. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  16658. return this.reverse().takeWhile(predicate).reverse();
  16659. };
  16660. LazyWrapper.prototype.toArray = function() {
  16661. return this.take(MAX_ARRAY_LENGTH);
  16662. };
  16663. // Add `LazyWrapper` methods to `lodash.prototype`.
  16664. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16665. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  16666. isTaker = /^(?:head|last)$/.test(methodName),
  16667. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  16668. retUnwrapped = isTaker || /^find/.test(methodName);
  16669. if (!lodashFunc) {
  16670. return;
  16671. }
  16672. lodash.prototype[methodName] = function() {
  16673. var value = this.__wrapped__,
  16674. args = isTaker ? [1] : arguments,
  16675. isLazy = value instanceof LazyWrapper,
  16676. iteratee = args[0],
  16677. useLazy = isLazy || isArray(value);
  16678. var interceptor = function(value) {
  16679. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  16680. return (isTaker && chainAll) ? result[0] : result;
  16681. };
  16682. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  16683. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  16684. isLazy = useLazy = false;
  16685. }
  16686. var chainAll = this.__chain__,
  16687. isHybrid = !!this.__actions__.length,
  16688. isUnwrapped = retUnwrapped && !chainAll,
  16689. onlyLazy = isLazy && !isHybrid;
  16690. if (!retUnwrapped && useLazy) {
  16691. value = onlyLazy ? value : new LazyWrapper(this);
  16692. var result = func.apply(value, args);
  16693. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  16694. return new LodashWrapper(result, chainAll);
  16695. }
  16696. if (isUnwrapped && onlyLazy) {
  16697. return func.apply(this, args);
  16698. }
  16699. result = this.thru(interceptor);
  16700. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  16701. };
  16702. });
  16703. // Add `Array` methods to `lodash.prototype`.
  16704. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  16705. var func = arrayProto[methodName],
  16706. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  16707. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  16708. lodash.prototype[methodName] = function() {
  16709. var args = arguments;
  16710. if (retUnwrapped && !this.__chain__) {
  16711. var value = this.value();
  16712. return func.apply(isArray(value) ? value : [], args);
  16713. }
  16714. return this[chainName](function(value) {
  16715. return func.apply(isArray(value) ? value : [], args);
  16716. });
  16717. };
  16718. });
  16719. // Map minified method names to their real names.
  16720. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16721. var lodashFunc = lodash[methodName];
  16722. if (lodashFunc) {
  16723. var key = (lodashFunc.name + ''),
  16724. names = realNames[key] || (realNames[key] = []);
  16725. names.push({ 'name': methodName, 'func': lodashFunc });
  16726. }
  16727. });
  16728. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  16729. 'name': 'wrapper',
  16730. 'func': undefined
  16731. }];
  16732. // Add methods to `LazyWrapper`.
  16733. LazyWrapper.prototype.clone = lazyClone;
  16734. LazyWrapper.prototype.reverse = lazyReverse;
  16735. LazyWrapper.prototype.value = lazyValue;
  16736. // Add chain sequence methods to the `lodash` wrapper.
  16737. lodash.prototype.at = wrapperAt;
  16738. lodash.prototype.chain = wrapperChain;
  16739. lodash.prototype.commit = wrapperCommit;
  16740. lodash.prototype.next = wrapperNext;
  16741. lodash.prototype.plant = wrapperPlant;
  16742. lodash.prototype.reverse = wrapperReverse;
  16743. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  16744. // Add lazy aliases.
  16745. lodash.prototype.first = lodash.prototype.head;
  16746. if (symIterator) {
  16747. lodash.prototype[symIterator] = wrapperToIterator;
  16748. }
  16749. return lodash;
  16750. });
  16751. /*--------------------------------------------------------------------------*/
  16752. // Export lodash.
  16753. var _ = runInContext();
  16754. // Some AMD build optimizers, like r.js, check for condition patterns like:
  16755. if (true) {
  16756. // Expose Lodash on the global object to prevent errors when Lodash is
  16757. // loaded by a script tag in the presence of an AMD loader.
  16758. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  16759. // Use `_.noConflict` to remove Lodash from the global object.
  16760. root._ = _;
  16761. // Define as an anonymous module so, through path mapping, it can be
  16762. // referenced as the "underscore" module.
  16763. !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
  16764. return _;
  16765. }.call(exports, __webpack_require__, exports, module),
  16766. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16767. }
  16768. // Check for `exports` after `define` in case a build optimizer adds it.
  16769. else if (freeModule) {
  16770. // Export for Node.js.
  16771. (freeModule.exports = _)._ = _;
  16772. // Export for CommonJS support.
  16773. freeExports._ = _;
  16774. }
  16775. else {
  16776. // Export to the global object.
  16777. root._ = _;
  16778. }
  16779. }.call(this));
  16780. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(12)(module)))
  16781. /***/ }),
  16782. /* 12 */
  16783. /***/ (function(module, exports) {
  16784. module.exports = function(module) {
  16785. if(!module.webpackPolyfill) {
  16786. module.deprecate = function() {};
  16787. module.paths = [];
  16788. // module.parent = undefined by default
  16789. if(!module.children) module.children = [];
  16790. Object.defineProperty(module, "loaded", {
  16791. enumerable: true,
  16792. get: function() {
  16793. return module.l;
  16794. }
  16795. });
  16796. Object.defineProperty(module, "id", {
  16797. enumerable: true,
  16798. get: function() {
  16799. return module.i;
  16800. }
  16801. });
  16802. module.webpackPolyfill = 1;
  16803. }
  16804. return module;
  16805. };
  16806. /***/ }),
  16807. /* 13 */
  16808. /***/ (function(module, exports, __webpack_require__) {
  16809. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  16810. * jQuery JavaScript Library v3.2.1
  16811. * https://jquery.com/
  16812. *
  16813. * Includes Sizzle.js
  16814. * https://sizzlejs.com/
  16815. *
  16816. * Copyright JS Foundation and other contributors
  16817. * Released under the MIT license
  16818. * https://jquery.org/license
  16819. *
  16820. * Date: 2017-03-20T18:59Z
  16821. */
  16822. ( function( global, factory ) {
  16823. "use strict";
  16824. if ( typeof module === "object" && typeof module.exports === "object" ) {
  16825. // For CommonJS and CommonJS-like environments where a proper `window`
  16826. // is present, execute the factory and get jQuery.
  16827. // For environments that do not have a `window` with a `document`
  16828. // (such as Node.js), expose a factory as module.exports.
  16829. // This accentuates the need for the creation of a real `window`.
  16830. // e.g. var jQuery = require("jquery")(window);
  16831. // See ticket #14549 for more info.
  16832. module.exports = global.document ?
  16833. factory( global, true ) :
  16834. function( w ) {
  16835. if ( !w.document ) {
  16836. throw new Error( "jQuery requires a window with a document" );
  16837. }
  16838. return factory( w );
  16839. };
  16840. } else {
  16841. factory( global );
  16842. }
  16843. // Pass this if window is not defined yet
  16844. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  16845. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  16846. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  16847. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  16848. // enough that all such attempts are guarded in a try block.
  16849. "use strict";
  16850. var arr = [];
  16851. var document = window.document;
  16852. var getProto = Object.getPrototypeOf;
  16853. var slice = arr.slice;
  16854. var concat = arr.concat;
  16855. var push = arr.push;
  16856. var indexOf = arr.indexOf;
  16857. var class2type = {};
  16858. var toString = class2type.toString;
  16859. var hasOwn = class2type.hasOwnProperty;
  16860. var fnToString = hasOwn.toString;
  16861. var ObjectFunctionString = fnToString.call( Object );
  16862. var support = {};
  16863. function DOMEval( code, doc ) {
  16864. doc = doc || document;
  16865. var script = doc.createElement( "script" );
  16866. script.text = code;
  16867. doc.head.appendChild( script ).parentNode.removeChild( script );
  16868. }
  16869. /* global Symbol */
  16870. // Defining this global in .eslintrc.json would create a danger of using the global
  16871. // unguarded in another place, it seems safer to define global only for this module
  16872. var
  16873. version = "3.2.1",
  16874. // Define a local copy of jQuery
  16875. jQuery = function( selector, context ) {
  16876. // The jQuery object is actually just the init constructor 'enhanced'
  16877. // Need init if jQuery is called (just allow error to be thrown if not included)
  16878. return new jQuery.fn.init( selector, context );
  16879. },
  16880. // Support: Android <=4.0 only
  16881. // Make sure we trim BOM and NBSP
  16882. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  16883. // Matches dashed string for camelizing
  16884. rmsPrefix = /^-ms-/,
  16885. rdashAlpha = /-([a-z])/g,
  16886. // Used by jQuery.camelCase as callback to replace()
  16887. fcamelCase = function( all, letter ) {
  16888. return letter.toUpperCase();
  16889. };
  16890. jQuery.fn = jQuery.prototype = {
  16891. // The current version of jQuery being used
  16892. jquery: version,
  16893. constructor: jQuery,
  16894. // The default length of a jQuery object is 0
  16895. length: 0,
  16896. toArray: function() {
  16897. return slice.call( this );
  16898. },
  16899. // Get the Nth element in the matched element set OR
  16900. // Get the whole matched element set as a clean array
  16901. get: function( num ) {
  16902. // Return all the elements in a clean array
  16903. if ( num == null ) {
  16904. return slice.call( this );
  16905. }
  16906. // Return just the one element from the set
  16907. return num < 0 ? this[ num + this.length ] : this[ num ];
  16908. },
  16909. // Take an array of elements and push it onto the stack
  16910. // (returning the new matched element set)
  16911. pushStack: function( elems ) {
  16912. // Build a new jQuery matched element set
  16913. var ret = jQuery.merge( this.constructor(), elems );
  16914. // Add the old object onto the stack (as a reference)
  16915. ret.prevObject = this;
  16916. // Return the newly-formed element set
  16917. return ret;
  16918. },
  16919. // Execute a callback for every element in the matched set.
  16920. each: function( callback ) {
  16921. return jQuery.each( this, callback );
  16922. },
  16923. map: function( callback ) {
  16924. return this.pushStack( jQuery.map( this, function( elem, i ) {
  16925. return callback.call( elem, i, elem );
  16926. } ) );
  16927. },
  16928. slice: function() {
  16929. return this.pushStack( slice.apply( this, arguments ) );
  16930. },
  16931. first: function() {
  16932. return this.eq( 0 );
  16933. },
  16934. last: function() {
  16935. return this.eq( -1 );
  16936. },
  16937. eq: function( i ) {
  16938. var len = this.length,
  16939. j = +i + ( i < 0 ? len : 0 );
  16940. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  16941. },
  16942. end: function() {
  16943. return this.prevObject || this.constructor();
  16944. },
  16945. // For internal use only.
  16946. // Behaves like an Array's method, not like a jQuery method.
  16947. push: push,
  16948. sort: arr.sort,
  16949. splice: arr.splice
  16950. };
  16951. jQuery.extend = jQuery.fn.extend = function() {
  16952. var options, name, src, copy, copyIsArray, clone,
  16953. target = arguments[ 0 ] || {},
  16954. i = 1,
  16955. length = arguments.length,
  16956. deep = false;
  16957. // Handle a deep copy situation
  16958. if ( typeof target === "boolean" ) {
  16959. deep = target;
  16960. // Skip the boolean and the target
  16961. target = arguments[ i ] || {};
  16962. i++;
  16963. }
  16964. // Handle case when target is a string or something (possible in deep copy)
  16965. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  16966. target = {};
  16967. }
  16968. // Extend jQuery itself if only one argument is passed
  16969. if ( i === length ) {
  16970. target = this;
  16971. i--;
  16972. }
  16973. for ( ; i < length; i++ ) {
  16974. // Only deal with non-null/undefined values
  16975. if ( ( options = arguments[ i ] ) != null ) {
  16976. // Extend the base object
  16977. for ( name in options ) {
  16978. src = target[ name ];
  16979. copy = options[ name ];
  16980. // Prevent never-ending loop
  16981. if ( target === copy ) {
  16982. continue;
  16983. }
  16984. // Recurse if we're merging plain objects or arrays
  16985. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  16986. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  16987. if ( copyIsArray ) {
  16988. copyIsArray = false;
  16989. clone = src && Array.isArray( src ) ? src : [];
  16990. } else {
  16991. clone = src && jQuery.isPlainObject( src ) ? src : {};
  16992. }
  16993. // Never move original objects, clone them
  16994. target[ name ] = jQuery.extend( deep, clone, copy );
  16995. // Don't bring in undefined values
  16996. } else if ( copy !== undefined ) {
  16997. target[ name ] = copy;
  16998. }
  16999. }
  17000. }
  17001. }
  17002. // Return the modified object
  17003. return target;
  17004. };
  17005. jQuery.extend( {
  17006. // Unique for each copy of jQuery on the page
  17007. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  17008. // Assume jQuery is ready without the ready module
  17009. isReady: true,
  17010. error: function( msg ) {
  17011. throw new Error( msg );
  17012. },
  17013. noop: function() {},
  17014. isFunction: function( obj ) {
  17015. return jQuery.type( obj ) === "function";
  17016. },
  17017. isWindow: function( obj ) {
  17018. return obj != null && obj === obj.window;
  17019. },
  17020. isNumeric: function( obj ) {
  17021. // As of jQuery 3.0, isNumeric is limited to
  17022. // strings and numbers (primitives or objects)
  17023. // that can be coerced to finite numbers (gh-2662)
  17024. var type = jQuery.type( obj );
  17025. return ( type === "number" || type === "string" ) &&
  17026. // parseFloat NaNs numeric-cast false positives ("")
  17027. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17028. // subtraction forces infinities to NaN
  17029. !isNaN( obj - parseFloat( obj ) );
  17030. },
  17031. isPlainObject: function( obj ) {
  17032. var proto, Ctor;
  17033. // Detect obvious negatives
  17034. // Use toString instead of jQuery.type to catch host objects
  17035. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  17036. return false;
  17037. }
  17038. proto = getProto( obj );
  17039. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  17040. if ( !proto ) {
  17041. return true;
  17042. }
  17043. // Objects with prototype are plain iff they were constructed by a global Object function
  17044. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  17045. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  17046. },
  17047. isEmptyObject: function( obj ) {
  17048. /* eslint-disable no-unused-vars */
  17049. // See https://github.com/eslint/eslint/issues/6125
  17050. var name;
  17051. for ( name in obj ) {
  17052. return false;
  17053. }
  17054. return true;
  17055. },
  17056. type: function( obj ) {
  17057. if ( obj == null ) {
  17058. return obj + "";
  17059. }
  17060. // Support: Android <=2.3 only (functionish RegExp)
  17061. return typeof obj === "object" || typeof obj === "function" ?
  17062. class2type[ toString.call( obj ) ] || "object" :
  17063. typeof obj;
  17064. },
  17065. // Evaluates a script in a global context
  17066. globalEval: function( code ) {
  17067. DOMEval( code );
  17068. },
  17069. // Convert dashed to camelCase; used by the css and data modules
  17070. // Support: IE <=9 - 11, Edge 12 - 13
  17071. // Microsoft forgot to hump their vendor prefix (#9572)
  17072. camelCase: function( string ) {
  17073. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  17074. },
  17075. each: function( obj, callback ) {
  17076. var length, i = 0;
  17077. if ( isArrayLike( obj ) ) {
  17078. length = obj.length;
  17079. for ( ; i < length; i++ ) {
  17080. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17081. break;
  17082. }
  17083. }
  17084. } else {
  17085. for ( i in obj ) {
  17086. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17087. break;
  17088. }
  17089. }
  17090. }
  17091. return obj;
  17092. },
  17093. // Support: Android <=4.0 only
  17094. trim: function( text ) {
  17095. return text == null ?
  17096. "" :
  17097. ( text + "" ).replace( rtrim, "" );
  17098. },
  17099. // results is for internal usage only
  17100. makeArray: function( arr, results ) {
  17101. var ret = results || [];
  17102. if ( arr != null ) {
  17103. if ( isArrayLike( Object( arr ) ) ) {
  17104. jQuery.merge( ret,
  17105. typeof arr === "string" ?
  17106. [ arr ] : arr
  17107. );
  17108. } else {
  17109. push.call( ret, arr );
  17110. }
  17111. }
  17112. return ret;
  17113. },
  17114. inArray: function( elem, arr, i ) {
  17115. return arr == null ? -1 : indexOf.call( arr, elem, i );
  17116. },
  17117. // Support: Android <=4.0 only, PhantomJS 1 only
  17118. // push.apply(_, arraylike) throws on ancient WebKit
  17119. merge: function( first, second ) {
  17120. var len = +second.length,
  17121. j = 0,
  17122. i = first.length;
  17123. for ( ; j < len; j++ ) {
  17124. first[ i++ ] = second[ j ];
  17125. }
  17126. first.length = i;
  17127. return first;
  17128. },
  17129. grep: function( elems, callback, invert ) {
  17130. var callbackInverse,
  17131. matches = [],
  17132. i = 0,
  17133. length = elems.length,
  17134. callbackExpect = !invert;
  17135. // Go through the array, only saving the items
  17136. // that pass the validator function
  17137. for ( ; i < length; i++ ) {
  17138. callbackInverse = !callback( elems[ i ], i );
  17139. if ( callbackInverse !== callbackExpect ) {
  17140. matches.push( elems[ i ] );
  17141. }
  17142. }
  17143. return matches;
  17144. },
  17145. // arg is for internal usage only
  17146. map: function( elems, callback, arg ) {
  17147. var length, value,
  17148. i = 0,
  17149. ret = [];
  17150. // Go through the array, translating each of the items to their new values
  17151. if ( isArrayLike( elems ) ) {
  17152. length = elems.length;
  17153. for ( ; i < length; i++ ) {
  17154. value = callback( elems[ i ], i, arg );
  17155. if ( value != null ) {
  17156. ret.push( value );
  17157. }
  17158. }
  17159. // Go through every key on the object,
  17160. } else {
  17161. for ( i in elems ) {
  17162. value = callback( elems[ i ], i, arg );
  17163. if ( value != null ) {
  17164. ret.push( value );
  17165. }
  17166. }
  17167. }
  17168. // Flatten any nested arrays
  17169. return concat.apply( [], ret );
  17170. },
  17171. // A global GUID counter for objects
  17172. guid: 1,
  17173. // Bind a function to a context, optionally partially applying any
  17174. // arguments.
  17175. proxy: function( fn, context ) {
  17176. var tmp, args, proxy;
  17177. if ( typeof context === "string" ) {
  17178. tmp = fn[ context ];
  17179. context = fn;
  17180. fn = tmp;
  17181. }
  17182. // Quick check to determine if target is callable, in the spec
  17183. // this throws a TypeError, but we will just return undefined.
  17184. if ( !jQuery.isFunction( fn ) ) {
  17185. return undefined;
  17186. }
  17187. // Simulated bind
  17188. args = slice.call( arguments, 2 );
  17189. proxy = function() {
  17190. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17191. };
  17192. // Set the guid of unique handler to the same of original handler, so it can be removed
  17193. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17194. return proxy;
  17195. },
  17196. now: Date.now,
  17197. // jQuery.support is not used in Core but other projects attach their
  17198. // properties to it so it needs to exist.
  17199. support: support
  17200. } );
  17201. if ( typeof Symbol === "function" ) {
  17202. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  17203. }
  17204. // Populate the class2type map
  17205. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  17206. function( i, name ) {
  17207. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  17208. } );
  17209. function isArrayLike( obj ) {
  17210. // Support: real iOS 8.2 only (not reproducible in simulator)
  17211. // `in` check used to prevent JIT error (gh-2145)
  17212. // hasOwn isn't used here due to false negatives
  17213. // regarding Nodelist length in IE
  17214. var length = !!obj && "length" in obj && obj.length,
  17215. type = jQuery.type( obj );
  17216. if ( type === "function" || jQuery.isWindow( obj ) ) {
  17217. return false;
  17218. }
  17219. return type === "array" || length === 0 ||
  17220. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  17221. }
  17222. var Sizzle =
  17223. /*!
  17224. * Sizzle CSS Selector Engine v2.3.3
  17225. * https://sizzlejs.com/
  17226. *
  17227. * Copyright jQuery Foundation and other contributors
  17228. * Released under the MIT license
  17229. * http://jquery.org/license
  17230. *
  17231. * Date: 2016-08-08
  17232. */
  17233. (function( window ) {
  17234. var i,
  17235. support,
  17236. Expr,
  17237. getText,
  17238. isXML,
  17239. tokenize,
  17240. compile,
  17241. select,
  17242. outermostContext,
  17243. sortInput,
  17244. hasDuplicate,
  17245. // Local document vars
  17246. setDocument,
  17247. document,
  17248. docElem,
  17249. documentIsHTML,
  17250. rbuggyQSA,
  17251. rbuggyMatches,
  17252. matches,
  17253. contains,
  17254. // Instance-specific data
  17255. expando = "sizzle" + 1 * new Date(),
  17256. preferredDoc = window.document,
  17257. dirruns = 0,
  17258. done = 0,
  17259. classCache = createCache(),
  17260. tokenCache = createCache(),
  17261. compilerCache = createCache(),
  17262. sortOrder = function( a, b ) {
  17263. if ( a === b ) {
  17264. hasDuplicate = true;
  17265. }
  17266. return 0;
  17267. },
  17268. // Instance methods
  17269. hasOwn = ({}).hasOwnProperty,
  17270. arr = [],
  17271. pop = arr.pop,
  17272. push_native = arr.push,
  17273. push = arr.push,
  17274. slice = arr.slice,
  17275. // Use a stripped-down indexOf as it's faster than native
  17276. // https://jsperf.com/thor-indexof-vs-for/5
  17277. indexOf = function( list, elem ) {
  17278. var i = 0,
  17279. len = list.length;
  17280. for ( ; i < len; i++ ) {
  17281. if ( list[i] === elem ) {
  17282. return i;
  17283. }
  17284. }
  17285. return -1;
  17286. },
  17287. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  17288. // Regular expressions
  17289. // http://www.w3.org/TR/css3-selectors/#whitespace
  17290. whitespace = "[\\x20\\t\\r\\n\\f]",
  17291. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  17292. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  17293. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  17294. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  17295. // Operator (capture 2)
  17296. "*([*^$|!~]?=)" + whitespace +
  17297. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  17298. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  17299. "*\\]",
  17300. pseudos = ":(" + identifier + ")(?:\\((" +
  17301. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  17302. // 1. quoted (capture 3; capture 4 or capture 5)
  17303. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  17304. // 2. simple (capture 6)
  17305. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  17306. // 3. anything else (capture 2)
  17307. ".*" +
  17308. ")\\)|)",
  17309. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  17310. rwhitespace = new RegExp( whitespace + "+", "g" ),
  17311. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  17312. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  17313. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  17314. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  17315. rpseudo = new RegExp( pseudos ),
  17316. ridentifier = new RegExp( "^" + identifier + "$" ),
  17317. matchExpr = {
  17318. "ID": new RegExp( "^#(" + identifier + ")" ),
  17319. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  17320. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  17321. "ATTR": new RegExp( "^" + attributes ),
  17322. "PSEUDO": new RegExp( "^" + pseudos ),
  17323. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  17324. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  17325. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  17326. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  17327. // For use in libraries implementing .is()
  17328. // We use this for POS matching in `select`
  17329. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  17330. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  17331. },
  17332. rinputs = /^(?:input|select|textarea|button)$/i,
  17333. rheader = /^h\d$/i,
  17334. rnative = /^[^{]+\{\s*\[native \w/,
  17335. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  17336. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  17337. rsibling = /[+~]/,
  17338. // CSS escapes
  17339. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  17340. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  17341. funescape = function( _, escaped, escapedWhitespace ) {
  17342. var high = "0x" + escaped - 0x10000;
  17343. // NaN means non-codepoint
  17344. // Support: Firefox<24
  17345. // Workaround erroneous numeric interpretation of +"0x"
  17346. return high !== high || escapedWhitespace ?
  17347. escaped :
  17348. high < 0 ?
  17349. // BMP codepoint
  17350. String.fromCharCode( high + 0x10000 ) :
  17351. // Supplemental Plane codepoint (surrogate pair)
  17352. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  17353. },
  17354. // CSS string/identifier serialization
  17355. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  17356. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  17357. fcssescape = function( ch, asCodePoint ) {
  17358. if ( asCodePoint ) {
  17359. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  17360. if ( ch === "\0" ) {
  17361. return "\uFFFD";
  17362. }
  17363. // Control characters and (dependent upon position) numbers get escaped as code points
  17364. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  17365. }
  17366. // Other potentially-special ASCII characters get backslash-escaped
  17367. return "\\" + ch;
  17368. },
  17369. // Used for iframes
  17370. // See setDocument()
  17371. // Removing the function wrapper causes a "Permission Denied"
  17372. // error in IE
  17373. unloadHandler = function() {
  17374. setDocument();
  17375. },
  17376. disabledAncestor = addCombinator(
  17377. function( elem ) {
  17378. return elem.disabled === true && ("form" in elem || "label" in elem);
  17379. },
  17380. { dir: "parentNode", next: "legend" }
  17381. );
  17382. // Optimize for push.apply( _, NodeList )
  17383. try {
  17384. push.apply(
  17385. (arr = slice.call( preferredDoc.childNodes )),
  17386. preferredDoc.childNodes
  17387. );
  17388. // Support: Android<4.0
  17389. // Detect silently failing push.apply
  17390. arr[ preferredDoc.childNodes.length ].nodeType;
  17391. } catch ( e ) {
  17392. push = { apply: arr.length ?
  17393. // Leverage slice if possible
  17394. function( target, els ) {
  17395. push_native.apply( target, slice.call(els) );
  17396. } :
  17397. // Support: IE<9
  17398. // Otherwise append directly
  17399. function( target, els ) {
  17400. var j = target.length,
  17401. i = 0;
  17402. // Can't trust NodeList.length
  17403. while ( (target[j++] = els[i++]) ) {}
  17404. target.length = j - 1;
  17405. }
  17406. };
  17407. }
  17408. function Sizzle( selector, context, results, seed ) {
  17409. var m, i, elem, nid, match, groups, newSelector,
  17410. newContext = context && context.ownerDocument,
  17411. // nodeType defaults to 9, since context defaults to document
  17412. nodeType = context ? context.nodeType : 9;
  17413. results = results || [];
  17414. // Return early from calls with invalid selector or context
  17415. if ( typeof selector !== "string" || !selector ||
  17416. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  17417. return results;
  17418. }
  17419. // Try to shortcut find operations (as opposed to filters) in HTML documents
  17420. if ( !seed ) {
  17421. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  17422. setDocument( context );
  17423. }
  17424. context = context || document;
  17425. if ( documentIsHTML ) {
  17426. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  17427. // (excepting DocumentFragment context, where the methods don't exist)
  17428. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  17429. // ID selector
  17430. if ( (m = match[1]) ) {
  17431. // Document context
  17432. if ( nodeType === 9 ) {
  17433. if ( (elem = context.getElementById( m )) ) {
  17434. // Support: IE, Opera, Webkit
  17435. // TODO: identify versions
  17436. // getElementById can match elements by name instead of ID
  17437. if ( elem.id === m ) {
  17438. results.push( elem );
  17439. return results;
  17440. }
  17441. } else {
  17442. return results;
  17443. }
  17444. // Element context
  17445. } else {
  17446. // Support: IE, Opera, Webkit
  17447. // TODO: identify versions
  17448. // getElementById can match elements by name instead of ID
  17449. if ( newContext && (elem = newContext.getElementById( m )) &&
  17450. contains( context, elem ) &&
  17451. elem.id === m ) {
  17452. results.push( elem );
  17453. return results;
  17454. }
  17455. }
  17456. // Type selector
  17457. } else if ( match[2] ) {
  17458. push.apply( results, context.getElementsByTagName( selector ) );
  17459. return results;
  17460. // Class selector
  17461. } else if ( (m = match[3]) && support.getElementsByClassName &&
  17462. context.getElementsByClassName ) {
  17463. push.apply( results, context.getElementsByClassName( m ) );
  17464. return results;
  17465. }
  17466. }
  17467. // Take advantage of querySelectorAll
  17468. if ( support.qsa &&
  17469. !compilerCache[ selector + " " ] &&
  17470. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  17471. if ( nodeType !== 1 ) {
  17472. newContext = context;
  17473. newSelector = selector;
  17474. // qSA looks outside Element context, which is not what we want
  17475. // Thanks to Andrew Dupont for this workaround technique
  17476. // Support: IE <=8
  17477. // Exclude object elements
  17478. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  17479. // Capture the context ID, setting it first if necessary
  17480. if ( (nid = context.getAttribute( "id" )) ) {
  17481. nid = nid.replace( rcssescape, fcssescape );
  17482. } else {
  17483. context.setAttribute( "id", (nid = expando) );
  17484. }
  17485. // Prefix every selector in the list
  17486. groups = tokenize( selector );
  17487. i = groups.length;
  17488. while ( i-- ) {
  17489. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  17490. }
  17491. newSelector = groups.join( "," );
  17492. // Expand context for sibling selectors
  17493. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  17494. context;
  17495. }
  17496. if ( newSelector ) {
  17497. try {
  17498. push.apply( results,
  17499. newContext.querySelectorAll( newSelector )
  17500. );
  17501. return results;
  17502. } catch ( qsaError ) {
  17503. } finally {
  17504. if ( nid === expando ) {
  17505. context.removeAttribute( "id" );
  17506. }
  17507. }
  17508. }
  17509. }
  17510. }
  17511. }
  17512. // All others
  17513. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  17514. }
  17515. /**
  17516. * Create key-value caches of limited size
  17517. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  17518. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  17519. * deleting the oldest entry
  17520. */
  17521. function createCache() {
  17522. var keys = [];
  17523. function cache( key, value ) {
  17524. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  17525. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  17526. // Only keep the most recent entries
  17527. delete cache[ keys.shift() ];
  17528. }
  17529. return (cache[ key + " " ] = value);
  17530. }
  17531. return cache;
  17532. }
  17533. /**
  17534. * Mark a function for special use by Sizzle
  17535. * @param {Function} fn The function to mark
  17536. */
  17537. function markFunction( fn ) {
  17538. fn[ expando ] = true;
  17539. return fn;
  17540. }
  17541. /**
  17542. * Support testing using an element
  17543. * @param {Function} fn Passed the created element and returns a boolean result
  17544. */
  17545. function assert( fn ) {
  17546. var el = document.createElement("fieldset");
  17547. try {
  17548. return !!fn( el );
  17549. } catch (e) {
  17550. return false;
  17551. } finally {
  17552. // Remove from its parent by default
  17553. if ( el.parentNode ) {
  17554. el.parentNode.removeChild( el );
  17555. }
  17556. // release memory in IE
  17557. el = null;
  17558. }
  17559. }
  17560. /**
  17561. * Adds the same handler for all of the specified attrs
  17562. * @param {String} attrs Pipe-separated list of attributes
  17563. * @param {Function} handler The method that will be applied
  17564. */
  17565. function addHandle( attrs, handler ) {
  17566. var arr = attrs.split("|"),
  17567. i = arr.length;
  17568. while ( i-- ) {
  17569. Expr.attrHandle[ arr[i] ] = handler;
  17570. }
  17571. }
  17572. /**
  17573. * Checks document order of two siblings
  17574. * @param {Element} a
  17575. * @param {Element} b
  17576. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  17577. */
  17578. function siblingCheck( a, b ) {
  17579. var cur = b && a,
  17580. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  17581. a.sourceIndex - b.sourceIndex;
  17582. // Use IE sourceIndex if available on both nodes
  17583. if ( diff ) {
  17584. return diff;
  17585. }
  17586. // Check if b follows a
  17587. if ( cur ) {
  17588. while ( (cur = cur.nextSibling) ) {
  17589. if ( cur === b ) {
  17590. return -1;
  17591. }
  17592. }
  17593. }
  17594. return a ? 1 : -1;
  17595. }
  17596. /**
  17597. * Returns a function to use in pseudos for input types
  17598. * @param {String} type
  17599. */
  17600. function createInputPseudo( type ) {
  17601. return function( elem ) {
  17602. var name = elem.nodeName.toLowerCase();
  17603. return name === "input" && elem.type === type;
  17604. };
  17605. }
  17606. /**
  17607. * Returns a function to use in pseudos for buttons
  17608. * @param {String} type
  17609. */
  17610. function createButtonPseudo( type ) {
  17611. return function( elem ) {
  17612. var name = elem.nodeName.toLowerCase();
  17613. return (name === "input" || name === "button") && elem.type === type;
  17614. };
  17615. }
  17616. /**
  17617. * Returns a function to use in pseudos for :enabled/:disabled
  17618. * @param {Boolean} disabled true for :disabled; false for :enabled
  17619. */
  17620. function createDisabledPseudo( disabled ) {
  17621. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  17622. return function( elem ) {
  17623. // Only certain elements can match :enabled or :disabled
  17624. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  17625. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  17626. if ( "form" in elem ) {
  17627. // Check for inherited disabledness on relevant non-disabled elements:
  17628. // * listed form-associated elements in a disabled fieldset
  17629. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  17630. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  17631. // * option elements in a disabled optgroup
  17632. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  17633. // All such elements have a "form" property.
  17634. if ( elem.parentNode && elem.disabled === false ) {
  17635. // Option elements defer to a parent optgroup if present
  17636. if ( "label" in elem ) {
  17637. if ( "label" in elem.parentNode ) {
  17638. return elem.parentNode.disabled === disabled;
  17639. } else {
  17640. return elem.disabled === disabled;
  17641. }
  17642. }
  17643. // Support: IE 6 - 11
  17644. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  17645. return elem.isDisabled === disabled ||
  17646. // Where there is no isDisabled, check manually
  17647. /* jshint -W018 */
  17648. elem.isDisabled !== !disabled &&
  17649. disabledAncestor( elem ) === disabled;
  17650. }
  17651. return elem.disabled === disabled;
  17652. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  17653. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  17654. // even exist on them, let alone have a boolean value.
  17655. } else if ( "label" in elem ) {
  17656. return elem.disabled === disabled;
  17657. }
  17658. // Remaining elements are neither :enabled nor :disabled
  17659. return false;
  17660. };
  17661. }
  17662. /**
  17663. * Returns a function to use in pseudos for positionals
  17664. * @param {Function} fn
  17665. */
  17666. function createPositionalPseudo( fn ) {
  17667. return markFunction(function( argument ) {
  17668. argument = +argument;
  17669. return markFunction(function( seed, matches ) {
  17670. var j,
  17671. matchIndexes = fn( [], seed.length, argument ),
  17672. i = matchIndexes.length;
  17673. // Match elements found at the specified indexes
  17674. while ( i-- ) {
  17675. if ( seed[ (j = matchIndexes[i]) ] ) {
  17676. seed[j] = !(matches[j] = seed[j]);
  17677. }
  17678. }
  17679. });
  17680. });
  17681. }
  17682. /**
  17683. * Checks a node for validity as a Sizzle context
  17684. * @param {Element|Object=} context
  17685. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  17686. */
  17687. function testContext( context ) {
  17688. return context && typeof context.getElementsByTagName !== "undefined" && context;
  17689. }
  17690. // Expose support vars for convenience
  17691. support = Sizzle.support = {};
  17692. /**
  17693. * Detects XML nodes
  17694. * @param {Element|Object} elem An element or a document
  17695. * @returns {Boolean} True iff elem is a non-HTML XML node
  17696. */
  17697. isXML = Sizzle.isXML = function( elem ) {
  17698. // documentElement is verified for cases where it doesn't yet exist
  17699. // (such as loading iframes in IE - #4833)
  17700. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  17701. return documentElement ? documentElement.nodeName !== "HTML" : false;
  17702. };
  17703. /**
  17704. * Sets document-related variables once based on the current document
  17705. * @param {Element|Object} [doc] An element or document object to use to set the document
  17706. * @returns {Object} Returns the current document
  17707. */
  17708. setDocument = Sizzle.setDocument = function( node ) {
  17709. var hasCompare, subWindow,
  17710. doc = node ? node.ownerDocument || node : preferredDoc;
  17711. // Return early if doc is invalid or already selected
  17712. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  17713. return document;
  17714. }
  17715. // Update global variables
  17716. document = doc;
  17717. docElem = document.documentElement;
  17718. documentIsHTML = !isXML( document );
  17719. // Support: IE 9-11, Edge
  17720. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  17721. if ( preferredDoc !== document &&
  17722. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  17723. // Support: IE 11, Edge
  17724. if ( subWindow.addEventListener ) {
  17725. subWindow.addEventListener( "unload", unloadHandler, false );
  17726. // Support: IE 9 - 10 only
  17727. } else if ( subWindow.attachEvent ) {
  17728. subWindow.attachEvent( "onunload", unloadHandler );
  17729. }
  17730. }
  17731. /* Attributes
  17732. ---------------------------------------------------------------------- */
  17733. // Support: IE<8
  17734. // Verify that getAttribute really returns attributes and not properties
  17735. // (excepting IE8 booleans)
  17736. support.attributes = assert(function( el ) {
  17737. el.className = "i";
  17738. return !el.getAttribute("className");
  17739. });
  17740. /* getElement(s)By*
  17741. ---------------------------------------------------------------------- */
  17742. // Check if getElementsByTagName("*") returns only elements
  17743. support.getElementsByTagName = assert(function( el ) {
  17744. el.appendChild( document.createComment("") );
  17745. return !el.getElementsByTagName("*").length;
  17746. });
  17747. // Support: IE<9
  17748. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  17749. // Support: IE<10
  17750. // Check if getElementById returns elements by name
  17751. // The broken getElementById methods don't pick up programmatically-set names,
  17752. // so use a roundabout getElementsByName test
  17753. support.getById = assert(function( el ) {
  17754. docElem.appendChild( el ).id = expando;
  17755. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  17756. });
  17757. // ID filter and find
  17758. if ( support.getById ) {
  17759. Expr.filter["ID"] = function( id ) {
  17760. var attrId = id.replace( runescape, funescape );
  17761. return function( elem ) {
  17762. return elem.getAttribute("id") === attrId;
  17763. };
  17764. };
  17765. Expr.find["ID"] = function( id, context ) {
  17766. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  17767. var elem = context.getElementById( id );
  17768. return elem ? [ elem ] : [];
  17769. }
  17770. };
  17771. } else {
  17772. Expr.filter["ID"] = function( id ) {
  17773. var attrId = id.replace( runescape, funescape );
  17774. return function( elem ) {
  17775. var node = typeof elem.getAttributeNode !== "undefined" &&
  17776. elem.getAttributeNode("id");
  17777. return node && node.value === attrId;
  17778. };
  17779. };
  17780. // Support: IE 6 - 7 only
  17781. // getElementById is not reliable as a find shortcut
  17782. Expr.find["ID"] = function( id, context ) {
  17783. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  17784. var node, i, elems,
  17785. elem = context.getElementById( id );
  17786. if ( elem ) {
  17787. // Verify the id attribute
  17788. node = elem.getAttributeNode("id");
  17789. if ( node && node.value === id ) {
  17790. return [ elem ];
  17791. }
  17792. // Fall back on getElementsByName
  17793. elems = context.getElementsByName( id );
  17794. i = 0;
  17795. while ( (elem = elems[i++]) ) {
  17796. node = elem.getAttributeNode("id");
  17797. if ( node && node.value === id ) {
  17798. return [ elem ];
  17799. }
  17800. }
  17801. }
  17802. return [];
  17803. }
  17804. };
  17805. }
  17806. // Tag
  17807. Expr.find["TAG"] = support.getElementsByTagName ?
  17808. function( tag, context ) {
  17809. if ( typeof context.getElementsByTagName !== "undefined" ) {
  17810. return context.getElementsByTagName( tag );
  17811. // DocumentFragment nodes don't have gEBTN
  17812. } else if ( support.qsa ) {
  17813. return context.querySelectorAll( tag );
  17814. }
  17815. } :
  17816. function( tag, context ) {
  17817. var elem,
  17818. tmp = [],
  17819. i = 0,
  17820. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  17821. results = context.getElementsByTagName( tag );
  17822. // Filter out possible comments
  17823. if ( tag === "*" ) {
  17824. while ( (elem = results[i++]) ) {
  17825. if ( elem.nodeType === 1 ) {
  17826. tmp.push( elem );
  17827. }
  17828. }
  17829. return tmp;
  17830. }
  17831. return results;
  17832. };
  17833. // Class
  17834. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  17835. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  17836. return context.getElementsByClassName( className );
  17837. }
  17838. };
  17839. /* QSA/matchesSelector
  17840. ---------------------------------------------------------------------- */
  17841. // QSA and matchesSelector support
  17842. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  17843. rbuggyMatches = [];
  17844. // qSa(:focus) reports false when true (Chrome 21)
  17845. // We allow this because of a bug in IE8/9 that throws an error
  17846. // whenever `document.activeElement` is accessed on an iframe
  17847. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  17848. // See https://bugs.jquery.com/ticket/13378
  17849. rbuggyQSA = [];
  17850. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  17851. // Build QSA regex
  17852. // Regex strategy adopted from Diego Perini
  17853. assert(function( el ) {
  17854. // Select is set to empty string on purpose
  17855. // This is to test IE's treatment of not explicitly
  17856. // setting a boolean content attribute,
  17857. // since its presence should be enough
  17858. // https://bugs.jquery.com/ticket/12359
  17859. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  17860. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  17861. "<option selected=''></option></select>";
  17862. // Support: IE8, Opera 11-12.16
  17863. // Nothing should be selected when empty strings follow ^= or $= or *=
  17864. // The test attribute must be unknown in Opera but "safe" for WinRT
  17865. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  17866. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  17867. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  17868. }
  17869. // Support: IE8
  17870. // Boolean attributes and "value" are not treated correctly
  17871. if ( !el.querySelectorAll("[selected]").length ) {
  17872. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  17873. }
  17874. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  17875. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  17876. rbuggyQSA.push("~=");
  17877. }
  17878. // Webkit/Opera - :checked should return selected option elements
  17879. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  17880. // IE8 throws error here and will not see later tests
  17881. if ( !el.querySelectorAll(":checked").length ) {
  17882. rbuggyQSA.push(":checked");
  17883. }
  17884. // Support: Safari 8+, iOS 8+
  17885. // https://bugs.webkit.org/show_bug.cgi?id=136851
  17886. // In-page `selector#id sibling-combinator selector` fails
  17887. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  17888. rbuggyQSA.push(".#.+[+~]");
  17889. }
  17890. });
  17891. assert(function( el ) {
  17892. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  17893. "<select disabled='disabled'><option/></select>";
  17894. // Support: Windows 8 Native Apps
  17895. // The type and name attributes are restricted during .innerHTML assignment
  17896. var input = document.createElement("input");
  17897. input.setAttribute( "type", "hidden" );
  17898. el.appendChild( input ).setAttribute( "name", "D" );
  17899. // Support: IE8
  17900. // Enforce case-sensitivity of name attribute
  17901. if ( el.querySelectorAll("[name=d]").length ) {
  17902. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  17903. }
  17904. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  17905. // IE8 throws error here and will not see later tests
  17906. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  17907. rbuggyQSA.push( ":enabled", ":disabled" );
  17908. }
  17909. // Support: IE9-11+
  17910. // IE's :disabled selector does not pick up the children of disabled fieldsets
  17911. docElem.appendChild( el ).disabled = true;
  17912. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  17913. rbuggyQSA.push( ":enabled", ":disabled" );
  17914. }
  17915. // Opera 10-11 does not throw on post-comma invalid pseudos
  17916. el.querySelectorAll("*,:x");
  17917. rbuggyQSA.push(",.*:");
  17918. });
  17919. }
  17920. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  17921. docElem.webkitMatchesSelector ||
  17922. docElem.mozMatchesSelector ||
  17923. docElem.oMatchesSelector ||
  17924. docElem.msMatchesSelector) )) ) {
  17925. assert(function( el ) {
  17926. // Check to see if it's possible to do matchesSelector
  17927. // on a disconnected node (IE 9)
  17928. support.disconnectedMatch = matches.call( el, "*" );
  17929. // This should fail with an exception
  17930. // Gecko does not error, returns false instead
  17931. matches.call( el, "[s!='']:x" );
  17932. rbuggyMatches.push( "!=", pseudos );
  17933. });
  17934. }
  17935. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  17936. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  17937. /* Contains
  17938. ---------------------------------------------------------------------- */
  17939. hasCompare = rnative.test( docElem.compareDocumentPosition );
  17940. // Element contains another
  17941. // Purposefully self-exclusive
  17942. // As in, an element does not contain itself
  17943. contains = hasCompare || rnative.test( docElem.contains ) ?
  17944. function( a, b ) {
  17945. var adown = a.nodeType === 9 ? a.documentElement : a,
  17946. bup = b && b.parentNode;
  17947. return a === bup || !!( bup && bup.nodeType === 1 && (
  17948. adown.contains ?
  17949. adown.contains( bup ) :
  17950. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  17951. ));
  17952. } :
  17953. function( a, b ) {
  17954. if ( b ) {
  17955. while ( (b = b.parentNode) ) {
  17956. if ( b === a ) {
  17957. return true;
  17958. }
  17959. }
  17960. }
  17961. return false;
  17962. };
  17963. /* Sorting
  17964. ---------------------------------------------------------------------- */
  17965. // Document order sorting
  17966. sortOrder = hasCompare ?
  17967. function( a, b ) {
  17968. // Flag for duplicate removal
  17969. if ( a === b ) {
  17970. hasDuplicate = true;
  17971. return 0;
  17972. }
  17973. // Sort on method existence if only one input has compareDocumentPosition
  17974. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  17975. if ( compare ) {
  17976. return compare;
  17977. }
  17978. // Calculate position if both inputs belong to the same document
  17979. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  17980. a.compareDocumentPosition( b ) :
  17981. // Otherwise we know they are disconnected
  17982. 1;
  17983. // Disconnected nodes
  17984. if ( compare & 1 ||
  17985. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  17986. // Choose the first element that is related to our preferred document
  17987. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  17988. return -1;
  17989. }
  17990. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  17991. return 1;
  17992. }
  17993. // Maintain original order
  17994. return sortInput ?
  17995. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  17996. 0;
  17997. }
  17998. return compare & 4 ? -1 : 1;
  17999. } :
  18000. function( a, b ) {
  18001. // Exit early if the nodes are identical
  18002. if ( a === b ) {
  18003. hasDuplicate = true;
  18004. return 0;
  18005. }
  18006. var cur,
  18007. i = 0,
  18008. aup = a.parentNode,
  18009. bup = b.parentNode,
  18010. ap = [ a ],
  18011. bp = [ b ];
  18012. // Parentless nodes are either documents or disconnected
  18013. if ( !aup || !bup ) {
  18014. return a === document ? -1 :
  18015. b === document ? 1 :
  18016. aup ? -1 :
  18017. bup ? 1 :
  18018. sortInput ?
  18019. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  18020. 0;
  18021. // If the nodes are siblings, we can do a quick check
  18022. } else if ( aup === bup ) {
  18023. return siblingCheck( a, b );
  18024. }
  18025. // Otherwise we need full lists of their ancestors for comparison
  18026. cur = a;
  18027. while ( (cur = cur.parentNode) ) {
  18028. ap.unshift( cur );
  18029. }
  18030. cur = b;
  18031. while ( (cur = cur.parentNode) ) {
  18032. bp.unshift( cur );
  18033. }
  18034. // Walk down the tree looking for a discrepancy
  18035. while ( ap[i] === bp[i] ) {
  18036. i++;
  18037. }
  18038. return i ?
  18039. // Do a sibling check if the nodes have a common ancestor
  18040. siblingCheck( ap[i], bp[i] ) :
  18041. // Otherwise nodes in our document sort first
  18042. ap[i] === preferredDoc ? -1 :
  18043. bp[i] === preferredDoc ? 1 :
  18044. 0;
  18045. };
  18046. return document;
  18047. };
  18048. Sizzle.matches = function( expr, elements ) {
  18049. return Sizzle( expr, null, null, elements );
  18050. };
  18051. Sizzle.matchesSelector = function( elem, expr ) {
  18052. // Set document vars if needed
  18053. if ( ( elem.ownerDocument || elem ) !== document ) {
  18054. setDocument( elem );
  18055. }
  18056. // Make sure that attribute selectors are quoted
  18057. expr = expr.replace( rattributeQuotes, "='$1']" );
  18058. if ( support.matchesSelector && documentIsHTML &&
  18059. !compilerCache[ expr + " " ] &&
  18060. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  18061. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  18062. try {
  18063. var ret = matches.call( elem, expr );
  18064. // IE 9's matchesSelector returns false on disconnected nodes
  18065. if ( ret || support.disconnectedMatch ||
  18066. // As well, disconnected nodes are said to be in a document
  18067. // fragment in IE 9
  18068. elem.document && elem.document.nodeType !== 11 ) {
  18069. return ret;
  18070. }
  18071. } catch (e) {}
  18072. }
  18073. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  18074. };
  18075. Sizzle.contains = function( context, elem ) {
  18076. // Set document vars if needed
  18077. if ( ( context.ownerDocument || context ) !== document ) {
  18078. setDocument( context );
  18079. }
  18080. return contains( context, elem );
  18081. };
  18082. Sizzle.attr = function( elem, name ) {
  18083. // Set document vars if needed
  18084. if ( ( elem.ownerDocument || elem ) !== document ) {
  18085. setDocument( elem );
  18086. }
  18087. var fn = Expr.attrHandle[ name.toLowerCase() ],
  18088. // Don't get fooled by Object.prototype properties (jQuery #13807)
  18089. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  18090. fn( elem, name, !documentIsHTML ) :
  18091. undefined;
  18092. return val !== undefined ?
  18093. val :
  18094. support.attributes || !documentIsHTML ?
  18095. elem.getAttribute( name ) :
  18096. (val = elem.getAttributeNode(name)) && val.specified ?
  18097. val.value :
  18098. null;
  18099. };
  18100. Sizzle.escape = function( sel ) {
  18101. return (sel + "").replace( rcssescape, fcssescape );
  18102. };
  18103. Sizzle.error = function( msg ) {
  18104. throw new Error( "Syntax error, unrecognized expression: " + msg );
  18105. };
  18106. /**
  18107. * Document sorting and removing duplicates
  18108. * @param {ArrayLike} results
  18109. */
  18110. Sizzle.uniqueSort = function( results ) {
  18111. var elem,
  18112. duplicates = [],
  18113. j = 0,
  18114. i = 0;
  18115. // Unless we *know* we can detect duplicates, assume their presence
  18116. hasDuplicate = !support.detectDuplicates;
  18117. sortInput = !support.sortStable && results.slice( 0 );
  18118. results.sort( sortOrder );
  18119. if ( hasDuplicate ) {
  18120. while ( (elem = results[i++]) ) {
  18121. if ( elem === results[ i ] ) {
  18122. j = duplicates.push( i );
  18123. }
  18124. }
  18125. while ( j-- ) {
  18126. results.splice( duplicates[ j ], 1 );
  18127. }
  18128. }
  18129. // Clear input after sorting to release objects
  18130. // See https://github.com/jquery/sizzle/pull/225
  18131. sortInput = null;
  18132. return results;
  18133. };
  18134. /**
  18135. * Utility function for retrieving the text value of an array of DOM nodes
  18136. * @param {Array|Element} elem
  18137. */
  18138. getText = Sizzle.getText = function( elem ) {
  18139. var node,
  18140. ret = "",
  18141. i = 0,
  18142. nodeType = elem.nodeType;
  18143. if ( !nodeType ) {
  18144. // If no nodeType, this is expected to be an array
  18145. while ( (node = elem[i++]) ) {
  18146. // Do not traverse comment nodes
  18147. ret += getText( node );
  18148. }
  18149. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  18150. // Use textContent for elements
  18151. // innerText usage removed for consistency of new lines (jQuery #11153)
  18152. if ( typeof elem.textContent === "string" ) {
  18153. return elem.textContent;
  18154. } else {
  18155. // Traverse its children
  18156. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18157. ret += getText( elem );
  18158. }
  18159. }
  18160. } else if ( nodeType === 3 || nodeType === 4 ) {
  18161. return elem.nodeValue;
  18162. }
  18163. // Do not include comment or processing instruction nodes
  18164. return ret;
  18165. };
  18166. Expr = Sizzle.selectors = {
  18167. // Can be adjusted by the user
  18168. cacheLength: 50,
  18169. createPseudo: markFunction,
  18170. match: matchExpr,
  18171. attrHandle: {},
  18172. find: {},
  18173. relative: {
  18174. ">": { dir: "parentNode", first: true },
  18175. " ": { dir: "parentNode" },
  18176. "+": { dir: "previousSibling", first: true },
  18177. "~": { dir: "previousSibling" }
  18178. },
  18179. preFilter: {
  18180. "ATTR": function( match ) {
  18181. match[1] = match[1].replace( runescape, funescape );
  18182. // Move the given value to match[3] whether quoted or unquoted
  18183. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  18184. if ( match[2] === "~=" ) {
  18185. match[3] = " " + match[3] + " ";
  18186. }
  18187. return match.slice( 0, 4 );
  18188. },
  18189. "CHILD": function( match ) {
  18190. /* matches from matchExpr["CHILD"]
  18191. 1 type (only|nth|...)
  18192. 2 what (child|of-type)
  18193. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  18194. 4 xn-component of xn+y argument ([+-]?\d*n|)
  18195. 5 sign of xn-component
  18196. 6 x of xn-component
  18197. 7 sign of y-component
  18198. 8 y of y-component
  18199. */
  18200. match[1] = match[1].toLowerCase();
  18201. if ( match[1].slice( 0, 3 ) === "nth" ) {
  18202. // nth-* requires argument
  18203. if ( !match[3] ) {
  18204. Sizzle.error( match[0] );
  18205. }
  18206. // numeric x and y parameters for Expr.filter.CHILD
  18207. // remember that false/true cast respectively to 0/1
  18208. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  18209. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  18210. // other types prohibit arguments
  18211. } else if ( match[3] ) {
  18212. Sizzle.error( match[0] );
  18213. }
  18214. return match;
  18215. },
  18216. "PSEUDO": function( match ) {
  18217. var excess,
  18218. unquoted = !match[6] && match[2];
  18219. if ( matchExpr["CHILD"].test( match[0] ) ) {
  18220. return null;
  18221. }
  18222. // Accept quoted arguments as-is
  18223. if ( match[3] ) {
  18224. match[2] = match[4] || match[5] || "";
  18225. // Strip excess characters from unquoted arguments
  18226. } else if ( unquoted && rpseudo.test( unquoted ) &&
  18227. // Get excess from tokenize (recursively)
  18228. (excess = tokenize( unquoted, true )) &&
  18229. // advance to the next closing parenthesis
  18230. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  18231. // excess is a negative index
  18232. match[0] = match[0].slice( 0, excess );
  18233. match[2] = unquoted.slice( 0, excess );
  18234. }
  18235. // Return only captures needed by the pseudo filter method (type and argument)
  18236. return match.slice( 0, 3 );
  18237. }
  18238. },
  18239. filter: {
  18240. "TAG": function( nodeNameSelector ) {
  18241. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  18242. return nodeNameSelector === "*" ?
  18243. function() { return true; } :
  18244. function( elem ) {
  18245. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  18246. };
  18247. },
  18248. "CLASS": function( className ) {
  18249. var pattern = classCache[ className + " " ];
  18250. return pattern ||
  18251. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  18252. classCache( className, function( elem ) {
  18253. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  18254. });
  18255. },
  18256. "ATTR": function( name, operator, check ) {
  18257. return function( elem ) {
  18258. var result = Sizzle.attr( elem, name );
  18259. if ( result == null ) {
  18260. return operator === "!=";
  18261. }
  18262. if ( !operator ) {
  18263. return true;
  18264. }
  18265. result += "";
  18266. return operator === "=" ? result === check :
  18267. operator === "!=" ? result !== check :
  18268. operator === "^=" ? check && result.indexOf( check ) === 0 :
  18269. operator === "*=" ? check && result.indexOf( check ) > -1 :
  18270. operator === "$=" ? check && result.slice( -check.length ) === check :
  18271. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  18272. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  18273. false;
  18274. };
  18275. },
  18276. "CHILD": function( type, what, argument, first, last ) {
  18277. var simple = type.slice( 0, 3 ) !== "nth",
  18278. forward = type.slice( -4 ) !== "last",
  18279. ofType = what === "of-type";
  18280. return first === 1 && last === 0 ?
  18281. // Shortcut for :nth-*(n)
  18282. function( elem ) {
  18283. return !!elem.parentNode;
  18284. } :
  18285. function( elem, context, xml ) {
  18286. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  18287. dir = simple !== forward ? "nextSibling" : "previousSibling",
  18288. parent = elem.parentNode,
  18289. name = ofType && elem.nodeName.toLowerCase(),
  18290. useCache = !xml && !ofType,
  18291. diff = false;
  18292. if ( parent ) {
  18293. // :(first|last|only)-(child|of-type)
  18294. if ( simple ) {
  18295. while ( dir ) {
  18296. node = elem;
  18297. while ( (node = node[ dir ]) ) {
  18298. if ( ofType ?
  18299. node.nodeName.toLowerCase() === name :
  18300. node.nodeType === 1 ) {
  18301. return false;
  18302. }
  18303. }
  18304. // Reverse direction for :only-* (if we haven't yet done so)
  18305. start = dir = type === "only" && !start && "nextSibling";
  18306. }
  18307. return true;
  18308. }
  18309. start = [ forward ? parent.firstChild : parent.lastChild ];
  18310. // non-xml :nth-child(...) stores cache data on `parent`
  18311. if ( forward && useCache ) {
  18312. // Seek `elem` from a previously-cached index
  18313. // ...in a gzip-friendly way
  18314. node = parent;
  18315. outerCache = node[ expando ] || (node[ expando ] = {});
  18316. // Support: IE <9 only
  18317. // Defend against cloned attroperties (jQuery gh-1709)
  18318. uniqueCache = outerCache[ node.uniqueID ] ||
  18319. (outerCache[ node.uniqueID ] = {});
  18320. cache = uniqueCache[ type ] || [];
  18321. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18322. diff = nodeIndex && cache[ 2 ];
  18323. node = nodeIndex && parent.childNodes[ nodeIndex ];
  18324. while ( (node = ++nodeIndex && node && node[ dir ] ||
  18325. // Fallback to seeking `elem` from the start
  18326. (diff = nodeIndex = 0) || start.pop()) ) {
  18327. // When found, cache indexes on `parent` and break
  18328. if ( node.nodeType === 1 && ++diff && node === elem ) {
  18329. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  18330. break;
  18331. }
  18332. }
  18333. } else {
  18334. // Use previously-cached element index if available
  18335. if ( useCache ) {
  18336. // ...in a gzip-friendly way
  18337. node = elem;
  18338. outerCache = node[ expando ] || (node[ expando ] = {});
  18339. // Support: IE <9 only
  18340. // Defend against cloned attroperties (jQuery gh-1709)
  18341. uniqueCache = outerCache[ node.uniqueID ] ||
  18342. (outerCache[ node.uniqueID ] = {});
  18343. cache = uniqueCache[ type ] || [];
  18344. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18345. diff = nodeIndex;
  18346. }
  18347. // xml :nth-child(...)
  18348. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  18349. if ( diff === false ) {
  18350. // Use the same loop as above to seek `elem` from the start
  18351. while ( (node = ++nodeIndex && node && node[ dir ] ||
  18352. (diff = nodeIndex = 0) || start.pop()) ) {
  18353. if ( ( ofType ?
  18354. node.nodeName.toLowerCase() === name :
  18355. node.nodeType === 1 ) &&
  18356. ++diff ) {
  18357. // Cache the index of each encountered element
  18358. if ( useCache ) {
  18359. outerCache = node[ expando ] || (node[ expando ] = {});
  18360. // Support: IE <9 only
  18361. // Defend against cloned attroperties (jQuery gh-1709)
  18362. uniqueCache = outerCache[ node.uniqueID ] ||
  18363. (outerCache[ node.uniqueID ] = {});
  18364. uniqueCache[ type ] = [ dirruns, diff ];
  18365. }
  18366. if ( node === elem ) {
  18367. break;
  18368. }
  18369. }
  18370. }
  18371. }
  18372. }
  18373. // Incorporate the offset, then check against cycle size
  18374. diff -= last;
  18375. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  18376. }
  18377. };
  18378. },
  18379. "PSEUDO": function( pseudo, argument ) {
  18380. // pseudo-class names are case-insensitive
  18381. // http://www.w3.org/TR/selectors/#pseudo-classes
  18382. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  18383. // Remember that setFilters inherits from pseudos
  18384. var args,
  18385. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  18386. Sizzle.error( "unsupported pseudo: " + pseudo );
  18387. // The user may use createPseudo to indicate that
  18388. // arguments are needed to create the filter function
  18389. // just as Sizzle does
  18390. if ( fn[ expando ] ) {
  18391. return fn( argument );
  18392. }
  18393. // But maintain support for old signatures
  18394. if ( fn.length > 1 ) {
  18395. args = [ pseudo, pseudo, "", argument ];
  18396. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  18397. markFunction(function( seed, matches ) {
  18398. var idx,
  18399. matched = fn( seed, argument ),
  18400. i = matched.length;
  18401. while ( i-- ) {
  18402. idx = indexOf( seed, matched[i] );
  18403. seed[ idx ] = !( matches[ idx ] = matched[i] );
  18404. }
  18405. }) :
  18406. function( elem ) {
  18407. return fn( elem, 0, args );
  18408. };
  18409. }
  18410. return fn;
  18411. }
  18412. },
  18413. pseudos: {
  18414. // Potentially complex pseudos
  18415. "not": markFunction(function( selector ) {
  18416. // Trim the selector passed to compile
  18417. // to avoid treating leading and trailing
  18418. // spaces as combinators
  18419. var input = [],
  18420. results = [],
  18421. matcher = compile( selector.replace( rtrim, "$1" ) );
  18422. return matcher[ expando ] ?
  18423. markFunction(function( seed, matches, context, xml ) {
  18424. var elem,
  18425. unmatched = matcher( seed, null, xml, [] ),
  18426. i = seed.length;
  18427. // Match elements unmatched by `matcher`
  18428. while ( i-- ) {
  18429. if ( (elem = unmatched[i]) ) {
  18430. seed[i] = !(matches[i] = elem);
  18431. }
  18432. }
  18433. }) :
  18434. function( elem, context, xml ) {
  18435. input[0] = elem;
  18436. matcher( input, null, xml, results );
  18437. // Don't keep the element (issue #299)
  18438. input[0] = null;
  18439. return !results.pop();
  18440. };
  18441. }),
  18442. "has": markFunction(function( selector ) {
  18443. return function( elem ) {
  18444. return Sizzle( selector, elem ).length > 0;
  18445. };
  18446. }),
  18447. "contains": markFunction(function( text ) {
  18448. text = text.replace( runescape, funescape );
  18449. return function( elem ) {
  18450. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  18451. };
  18452. }),
  18453. // "Whether an element is represented by a :lang() selector
  18454. // is based solely on the element's language value
  18455. // being equal to the identifier C,
  18456. // or beginning with the identifier C immediately followed by "-".
  18457. // The matching of C against the element's language value is performed case-insensitively.
  18458. // The identifier C does not have to be a valid language name."
  18459. // http://www.w3.org/TR/selectors/#lang-pseudo
  18460. "lang": markFunction( function( lang ) {
  18461. // lang value must be a valid identifier
  18462. if ( !ridentifier.test(lang || "") ) {
  18463. Sizzle.error( "unsupported lang: " + lang );
  18464. }
  18465. lang = lang.replace( runescape, funescape ).toLowerCase();
  18466. return function( elem ) {
  18467. var elemLang;
  18468. do {
  18469. if ( (elemLang = documentIsHTML ?
  18470. elem.lang :
  18471. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  18472. elemLang = elemLang.toLowerCase();
  18473. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  18474. }
  18475. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  18476. return false;
  18477. };
  18478. }),
  18479. // Miscellaneous
  18480. "target": function( elem ) {
  18481. var hash = window.location && window.location.hash;
  18482. return hash && hash.slice( 1 ) === elem.id;
  18483. },
  18484. "root": function( elem ) {
  18485. return elem === docElem;
  18486. },
  18487. "focus": function( elem ) {
  18488. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  18489. },
  18490. // Boolean properties
  18491. "enabled": createDisabledPseudo( false ),
  18492. "disabled": createDisabledPseudo( true ),
  18493. "checked": function( elem ) {
  18494. // In CSS3, :checked should return both checked and selected elements
  18495. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  18496. var nodeName = elem.nodeName.toLowerCase();
  18497. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  18498. },
  18499. "selected": function( elem ) {
  18500. // Accessing this property makes selected-by-default
  18501. // options in Safari work properly
  18502. if ( elem.parentNode ) {
  18503. elem.parentNode.selectedIndex;
  18504. }
  18505. return elem.selected === true;
  18506. },
  18507. // Contents
  18508. "empty": function( elem ) {
  18509. // http://www.w3.org/TR/selectors/#empty-pseudo
  18510. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  18511. // but not by others (comment: 8; processing instruction: 7; etc.)
  18512. // nodeType < 6 works because attributes (2) do not appear as children
  18513. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18514. if ( elem.nodeType < 6 ) {
  18515. return false;
  18516. }
  18517. }
  18518. return true;
  18519. },
  18520. "parent": function( elem ) {
  18521. return !Expr.pseudos["empty"]( elem );
  18522. },
  18523. // Element/input types
  18524. "header": function( elem ) {
  18525. return rheader.test( elem.nodeName );
  18526. },
  18527. "input": function( elem ) {
  18528. return rinputs.test( elem.nodeName );
  18529. },
  18530. "button": function( elem ) {
  18531. var name = elem.nodeName.toLowerCase();
  18532. return name === "input" && elem.type === "button" || name === "button";
  18533. },
  18534. "text": function( elem ) {
  18535. var attr;
  18536. return elem.nodeName.toLowerCase() === "input" &&
  18537. elem.type === "text" &&
  18538. // Support: IE<8
  18539. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  18540. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  18541. },
  18542. // Position-in-collection
  18543. "first": createPositionalPseudo(function() {
  18544. return [ 0 ];
  18545. }),
  18546. "last": createPositionalPseudo(function( matchIndexes, length ) {
  18547. return [ length - 1 ];
  18548. }),
  18549. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18550. return [ argument < 0 ? argument + length : argument ];
  18551. }),
  18552. "even": createPositionalPseudo(function( matchIndexes, length ) {
  18553. var i = 0;
  18554. for ( ; i < length; i += 2 ) {
  18555. matchIndexes.push( i );
  18556. }
  18557. return matchIndexes;
  18558. }),
  18559. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  18560. var i = 1;
  18561. for ( ; i < length; i += 2 ) {
  18562. matchIndexes.push( i );
  18563. }
  18564. return matchIndexes;
  18565. }),
  18566. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18567. var i = argument < 0 ? argument + length : argument;
  18568. for ( ; --i >= 0; ) {
  18569. matchIndexes.push( i );
  18570. }
  18571. return matchIndexes;
  18572. }),
  18573. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18574. var i = argument < 0 ? argument + length : argument;
  18575. for ( ; ++i < length; ) {
  18576. matchIndexes.push( i );
  18577. }
  18578. return matchIndexes;
  18579. })
  18580. }
  18581. };
  18582. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  18583. // Add button/input type pseudos
  18584. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  18585. Expr.pseudos[ i ] = createInputPseudo( i );
  18586. }
  18587. for ( i in { submit: true, reset: true } ) {
  18588. Expr.pseudos[ i ] = createButtonPseudo( i );
  18589. }
  18590. // Easy API for creating new setFilters
  18591. function setFilters() {}
  18592. setFilters.prototype = Expr.filters = Expr.pseudos;
  18593. Expr.setFilters = new setFilters();
  18594. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  18595. var matched, match, tokens, type,
  18596. soFar, groups, preFilters,
  18597. cached = tokenCache[ selector + " " ];
  18598. if ( cached ) {
  18599. return parseOnly ? 0 : cached.slice( 0 );
  18600. }
  18601. soFar = selector;
  18602. groups = [];
  18603. preFilters = Expr.preFilter;
  18604. while ( soFar ) {
  18605. // Comma and first run
  18606. if ( !matched || (match = rcomma.exec( soFar )) ) {
  18607. if ( match ) {
  18608. // Don't consume trailing commas as valid
  18609. soFar = soFar.slice( match[0].length ) || soFar;
  18610. }
  18611. groups.push( (tokens = []) );
  18612. }
  18613. matched = false;
  18614. // Combinators
  18615. if ( (match = rcombinators.exec( soFar )) ) {
  18616. matched = match.shift();
  18617. tokens.push({
  18618. value: matched,
  18619. // Cast descendant combinators to space
  18620. type: match[0].replace( rtrim, " " )
  18621. });
  18622. soFar = soFar.slice( matched.length );
  18623. }
  18624. // Filters
  18625. for ( type in Expr.filter ) {
  18626. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  18627. (match = preFilters[ type ]( match ))) ) {
  18628. matched = match.shift();
  18629. tokens.push({
  18630. value: matched,
  18631. type: type,
  18632. matches: match
  18633. });
  18634. soFar = soFar.slice( matched.length );
  18635. }
  18636. }
  18637. if ( !matched ) {
  18638. break;
  18639. }
  18640. }
  18641. // Return the length of the invalid excess
  18642. // if we're just parsing
  18643. // Otherwise, throw an error or return tokens
  18644. return parseOnly ?
  18645. soFar.length :
  18646. soFar ?
  18647. Sizzle.error( selector ) :
  18648. // Cache the tokens
  18649. tokenCache( selector, groups ).slice( 0 );
  18650. };
  18651. function toSelector( tokens ) {
  18652. var i = 0,
  18653. len = tokens.length,
  18654. selector = "";
  18655. for ( ; i < len; i++ ) {
  18656. selector += tokens[i].value;
  18657. }
  18658. return selector;
  18659. }
  18660. function addCombinator( matcher, combinator, base ) {
  18661. var dir = combinator.dir,
  18662. skip = combinator.next,
  18663. key = skip || dir,
  18664. checkNonElements = base && key === "parentNode",
  18665. doneName = done++;
  18666. return combinator.first ?
  18667. // Check against closest ancestor/preceding element
  18668. function( elem, context, xml ) {
  18669. while ( (elem = elem[ dir ]) ) {
  18670. if ( elem.nodeType === 1 || checkNonElements ) {
  18671. return matcher( elem, context, xml );
  18672. }
  18673. }
  18674. return false;
  18675. } :
  18676. // Check against all ancestor/preceding elements
  18677. function( elem, context, xml ) {
  18678. var oldCache, uniqueCache, outerCache,
  18679. newCache = [ dirruns, doneName ];
  18680. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  18681. if ( xml ) {
  18682. while ( (elem = elem[ dir ]) ) {
  18683. if ( elem.nodeType === 1 || checkNonElements ) {
  18684. if ( matcher( elem, context, xml ) ) {
  18685. return true;
  18686. }
  18687. }
  18688. }
  18689. } else {
  18690. while ( (elem = elem[ dir ]) ) {
  18691. if ( elem.nodeType === 1 || checkNonElements ) {
  18692. outerCache = elem[ expando ] || (elem[ expando ] = {});
  18693. // Support: IE <9 only
  18694. // Defend against cloned attroperties (jQuery gh-1709)
  18695. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  18696. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  18697. elem = elem[ dir ] || elem;
  18698. } else if ( (oldCache = uniqueCache[ key ]) &&
  18699. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  18700. // Assign to newCache so results back-propagate to previous elements
  18701. return (newCache[ 2 ] = oldCache[ 2 ]);
  18702. } else {
  18703. // Reuse newcache so results back-propagate to previous elements
  18704. uniqueCache[ key ] = newCache;
  18705. // A match means we're done; a fail means we have to keep checking
  18706. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  18707. return true;
  18708. }
  18709. }
  18710. }
  18711. }
  18712. }
  18713. return false;
  18714. };
  18715. }
  18716. function elementMatcher( matchers ) {
  18717. return matchers.length > 1 ?
  18718. function( elem, context, xml ) {
  18719. var i = matchers.length;
  18720. while ( i-- ) {
  18721. if ( !matchers[i]( elem, context, xml ) ) {
  18722. return false;
  18723. }
  18724. }
  18725. return true;
  18726. } :
  18727. matchers[0];
  18728. }
  18729. function multipleContexts( selector, contexts, results ) {
  18730. var i = 0,
  18731. len = contexts.length;
  18732. for ( ; i < len; i++ ) {
  18733. Sizzle( selector, contexts[i], results );
  18734. }
  18735. return results;
  18736. }
  18737. function condense( unmatched, map, filter, context, xml ) {
  18738. var elem,
  18739. newUnmatched = [],
  18740. i = 0,
  18741. len = unmatched.length,
  18742. mapped = map != null;
  18743. for ( ; i < len; i++ ) {
  18744. if ( (elem = unmatched[i]) ) {
  18745. if ( !filter || filter( elem, context, xml ) ) {
  18746. newUnmatched.push( elem );
  18747. if ( mapped ) {
  18748. map.push( i );
  18749. }
  18750. }
  18751. }
  18752. }
  18753. return newUnmatched;
  18754. }
  18755. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  18756. if ( postFilter && !postFilter[ expando ] ) {
  18757. postFilter = setMatcher( postFilter );
  18758. }
  18759. if ( postFinder && !postFinder[ expando ] ) {
  18760. postFinder = setMatcher( postFinder, postSelector );
  18761. }
  18762. return markFunction(function( seed, results, context, xml ) {
  18763. var temp, i, elem,
  18764. preMap = [],
  18765. postMap = [],
  18766. preexisting = results.length,
  18767. // Get initial elements from seed or context
  18768. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  18769. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  18770. matcherIn = preFilter && ( seed || !selector ) ?
  18771. condense( elems, preMap, preFilter, context, xml ) :
  18772. elems,
  18773. matcherOut = matcher ?
  18774. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  18775. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  18776. // ...intermediate processing is necessary
  18777. [] :
  18778. // ...otherwise use results directly
  18779. results :
  18780. matcherIn;
  18781. // Find primary matches
  18782. if ( matcher ) {
  18783. matcher( matcherIn, matcherOut, context, xml );
  18784. }
  18785. // Apply postFilter
  18786. if ( postFilter ) {
  18787. temp = condense( matcherOut, postMap );
  18788. postFilter( temp, [], context, xml );
  18789. // Un-match failing elements by moving them back to matcherIn
  18790. i = temp.length;
  18791. while ( i-- ) {
  18792. if ( (elem = temp[i]) ) {
  18793. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  18794. }
  18795. }
  18796. }
  18797. if ( seed ) {
  18798. if ( postFinder || preFilter ) {
  18799. if ( postFinder ) {
  18800. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  18801. temp = [];
  18802. i = matcherOut.length;
  18803. while ( i-- ) {
  18804. if ( (elem = matcherOut[i]) ) {
  18805. // Restore matcherIn since elem is not yet a final match
  18806. temp.push( (matcherIn[i] = elem) );
  18807. }
  18808. }
  18809. postFinder( null, (matcherOut = []), temp, xml );
  18810. }
  18811. // Move matched elements from seed to results to keep them synchronized
  18812. i = matcherOut.length;
  18813. while ( i-- ) {
  18814. if ( (elem = matcherOut[i]) &&
  18815. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  18816. seed[temp] = !(results[temp] = elem);
  18817. }
  18818. }
  18819. }
  18820. // Add elements to results, through postFinder if defined
  18821. } else {
  18822. matcherOut = condense(
  18823. matcherOut === results ?
  18824. matcherOut.splice( preexisting, matcherOut.length ) :
  18825. matcherOut
  18826. );
  18827. if ( postFinder ) {
  18828. postFinder( null, results, matcherOut, xml );
  18829. } else {
  18830. push.apply( results, matcherOut );
  18831. }
  18832. }
  18833. });
  18834. }
  18835. function matcherFromTokens( tokens ) {
  18836. var checkContext, matcher, j,
  18837. len = tokens.length,
  18838. leadingRelative = Expr.relative[ tokens[0].type ],
  18839. implicitRelative = leadingRelative || Expr.relative[" "],
  18840. i = leadingRelative ? 1 : 0,
  18841. // The foundational matcher ensures that elements are reachable from top-level context(s)
  18842. matchContext = addCombinator( function( elem ) {
  18843. return elem === checkContext;
  18844. }, implicitRelative, true ),
  18845. matchAnyContext = addCombinator( function( elem ) {
  18846. return indexOf( checkContext, elem ) > -1;
  18847. }, implicitRelative, true ),
  18848. matchers = [ function( elem, context, xml ) {
  18849. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  18850. (checkContext = context).nodeType ?
  18851. matchContext( elem, context, xml ) :
  18852. matchAnyContext( elem, context, xml ) );
  18853. // Avoid hanging onto element (issue #299)
  18854. checkContext = null;
  18855. return ret;
  18856. } ];
  18857. for ( ; i < len; i++ ) {
  18858. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  18859. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  18860. } else {
  18861. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  18862. // Return special upon seeing a positional matcher
  18863. if ( matcher[ expando ] ) {
  18864. // Find the next relative operator (if any) for proper handling
  18865. j = ++i;
  18866. for ( ; j < len; j++ ) {
  18867. if ( Expr.relative[ tokens[j].type ] ) {
  18868. break;
  18869. }
  18870. }
  18871. return setMatcher(
  18872. i > 1 && elementMatcher( matchers ),
  18873. i > 1 && toSelector(
  18874. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  18875. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  18876. ).replace( rtrim, "$1" ),
  18877. matcher,
  18878. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  18879. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  18880. j < len && toSelector( tokens )
  18881. );
  18882. }
  18883. matchers.push( matcher );
  18884. }
  18885. }
  18886. return elementMatcher( matchers );
  18887. }
  18888. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  18889. var bySet = setMatchers.length > 0,
  18890. byElement = elementMatchers.length > 0,
  18891. superMatcher = function( seed, context, xml, results, outermost ) {
  18892. var elem, j, matcher,
  18893. matchedCount = 0,
  18894. i = "0",
  18895. unmatched = seed && [],
  18896. setMatched = [],
  18897. contextBackup = outermostContext,
  18898. // We must always have either seed elements or outermost context
  18899. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  18900. // Use integer dirruns iff this is the outermost matcher
  18901. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  18902. len = elems.length;
  18903. if ( outermost ) {
  18904. outermostContext = context === document || context || outermost;
  18905. }
  18906. // Add elements passing elementMatchers directly to results
  18907. // Support: IE<9, Safari
  18908. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  18909. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  18910. if ( byElement && elem ) {
  18911. j = 0;
  18912. if ( !context && elem.ownerDocument !== document ) {
  18913. setDocument( elem );
  18914. xml = !documentIsHTML;
  18915. }
  18916. while ( (matcher = elementMatchers[j++]) ) {
  18917. if ( matcher( elem, context || document, xml) ) {
  18918. results.push( elem );
  18919. break;
  18920. }
  18921. }
  18922. if ( outermost ) {
  18923. dirruns = dirrunsUnique;
  18924. }
  18925. }
  18926. // Track unmatched elements for set filters
  18927. if ( bySet ) {
  18928. // They will have gone through all possible matchers
  18929. if ( (elem = !matcher && elem) ) {
  18930. matchedCount--;
  18931. }
  18932. // Lengthen the array for every element, matched or not
  18933. if ( seed ) {
  18934. unmatched.push( elem );
  18935. }
  18936. }
  18937. }
  18938. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  18939. // makes the latter nonnegative.
  18940. matchedCount += i;
  18941. // Apply set filters to unmatched elements
  18942. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  18943. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  18944. // no element matchers and no seed.
  18945. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  18946. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  18947. // numerically zero.
  18948. if ( bySet && i !== matchedCount ) {
  18949. j = 0;
  18950. while ( (matcher = setMatchers[j++]) ) {
  18951. matcher( unmatched, setMatched, context, xml );
  18952. }
  18953. if ( seed ) {
  18954. // Reintegrate element matches to eliminate the need for sorting
  18955. if ( matchedCount > 0 ) {
  18956. while ( i-- ) {
  18957. if ( !(unmatched[i] || setMatched[i]) ) {
  18958. setMatched[i] = pop.call( results );
  18959. }
  18960. }
  18961. }
  18962. // Discard index placeholder values to get only actual matches
  18963. setMatched = condense( setMatched );
  18964. }
  18965. // Add matches to results
  18966. push.apply( results, setMatched );
  18967. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  18968. if ( outermost && !seed && setMatched.length > 0 &&
  18969. ( matchedCount + setMatchers.length ) > 1 ) {
  18970. Sizzle.uniqueSort( results );
  18971. }
  18972. }
  18973. // Override manipulation of globals by nested matchers
  18974. if ( outermost ) {
  18975. dirruns = dirrunsUnique;
  18976. outermostContext = contextBackup;
  18977. }
  18978. return unmatched;
  18979. };
  18980. return bySet ?
  18981. markFunction( superMatcher ) :
  18982. superMatcher;
  18983. }
  18984. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  18985. var i,
  18986. setMatchers = [],
  18987. elementMatchers = [],
  18988. cached = compilerCache[ selector + " " ];
  18989. if ( !cached ) {
  18990. // Generate a function of recursive functions that can be used to check each element
  18991. if ( !match ) {
  18992. match = tokenize( selector );
  18993. }
  18994. i = match.length;
  18995. while ( i-- ) {
  18996. cached = matcherFromTokens( match[i] );
  18997. if ( cached[ expando ] ) {
  18998. setMatchers.push( cached );
  18999. } else {
  19000. elementMatchers.push( cached );
  19001. }
  19002. }
  19003. // Cache the compiled function
  19004. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  19005. // Save selector and tokenization
  19006. cached.selector = selector;
  19007. }
  19008. return cached;
  19009. };
  19010. /**
  19011. * A low-level selection function that works with Sizzle's compiled
  19012. * selector functions
  19013. * @param {String|Function} selector A selector or a pre-compiled
  19014. * selector function built with Sizzle.compile
  19015. * @param {Element} context
  19016. * @param {Array} [results]
  19017. * @param {Array} [seed] A set of elements to match against
  19018. */
  19019. select = Sizzle.select = function( selector, context, results, seed ) {
  19020. var i, tokens, token, type, find,
  19021. compiled = typeof selector === "function" && selector,
  19022. match = !seed && tokenize( (selector = compiled.selector || selector) );
  19023. results = results || [];
  19024. // Try to minimize operations if there is only one selector in the list and no seed
  19025. // (the latter of which guarantees us context)
  19026. if ( match.length === 1 ) {
  19027. // Reduce context if the leading compound selector is an ID
  19028. tokens = match[0] = match[0].slice( 0 );
  19029. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  19030. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  19031. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  19032. if ( !context ) {
  19033. return results;
  19034. // Precompiled matchers will still verify ancestry, so step up a level
  19035. } else if ( compiled ) {
  19036. context = context.parentNode;
  19037. }
  19038. selector = selector.slice( tokens.shift().value.length );
  19039. }
  19040. // Fetch a seed set for right-to-left matching
  19041. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  19042. while ( i-- ) {
  19043. token = tokens[i];
  19044. // Abort if we hit a combinator
  19045. if ( Expr.relative[ (type = token.type) ] ) {
  19046. break;
  19047. }
  19048. if ( (find = Expr.find[ type ]) ) {
  19049. // Search, expanding context for leading sibling combinators
  19050. if ( (seed = find(
  19051. token.matches[0].replace( runescape, funescape ),
  19052. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  19053. )) ) {
  19054. // If seed is empty or no tokens remain, we can return early
  19055. tokens.splice( i, 1 );
  19056. selector = seed.length && toSelector( tokens );
  19057. if ( !selector ) {
  19058. push.apply( results, seed );
  19059. return results;
  19060. }
  19061. break;
  19062. }
  19063. }
  19064. }
  19065. }
  19066. // Compile and execute a filtering function if one is not provided
  19067. // Provide `match` to avoid retokenization if we modified the selector above
  19068. ( compiled || compile( selector, match ) )(
  19069. seed,
  19070. context,
  19071. !documentIsHTML,
  19072. results,
  19073. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  19074. );
  19075. return results;
  19076. };
  19077. // One-time assignments
  19078. // Sort stability
  19079. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  19080. // Support: Chrome 14-35+
  19081. // Always assume duplicates if they aren't passed to the comparison function
  19082. support.detectDuplicates = !!hasDuplicate;
  19083. // Initialize against the default document
  19084. setDocument();
  19085. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  19086. // Detached nodes confoundingly follow *each other*
  19087. support.sortDetached = assert(function( el ) {
  19088. // Should return 1, but returns 4 (following)
  19089. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  19090. });
  19091. // Support: IE<8
  19092. // Prevent attribute/property "interpolation"
  19093. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  19094. if ( !assert(function( el ) {
  19095. el.innerHTML = "<a href='#'></a>";
  19096. return el.firstChild.getAttribute("href") === "#" ;
  19097. }) ) {
  19098. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  19099. if ( !isXML ) {
  19100. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  19101. }
  19102. });
  19103. }
  19104. // Support: IE<9
  19105. // Use defaultValue in place of getAttribute("value")
  19106. if ( !support.attributes || !assert(function( el ) {
  19107. el.innerHTML = "<input/>";
  19108. el.firstChild.setAttribute( "value", "" );
  19109. return el.firstChild.getAttribute( "value" ) === "";
  19110. }) ) {
  19111. addHandle( "value", function( elem, name, isXML ) {
  19112. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  19113. return elem.defaultValue;
  19114. }
  19115. });
  19116. }
  19117. // Support: IE<9
  19118. // Use getAttributeNode to fetch booleans when getAttribute lies
  19119. if ( !assert(function( el ) {
  19120. return el.getAttribute("disabled") == null;
  19121. }) ) {
  19122. addHandle( booleans, function( elem, name, isXML ) {
  19123. var val;
  19124. if ( !isXML ) {
  19125. return elem[ name ] === true ? name.toLowerCase() :
  19126. (val = elem.getAttributeNode( name )) && val.specified ?
  19127. val.value :
  19128. null;
  19129. }
  19130. });
  19131. }
  19132. return Sizzle;
  19133. })( window );
  19134. jQuery.find = Sizzle;
  19135. jQuery.expr = Sizzle.selectors;
  19136. // Deprecated
  19137. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  19138. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  19139. jQuery.text = Sizzle.getText;
  19140. jQuery.isXMLDoc = Sizzle.isXML;
  19141. jQuery.contains = Sizzle.contains;
  19142. jQuery.escapeSelector = Sizzle.escape;
  19143. var dir = function( elem, dir, until ) {
  19144. var matched = [],
  19145. truncate = until !== undefined;
  19146. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  19147. if ( elem.nodeType === 1 ) {
  19148. if ( truncate && jQuery( elem ).is( until ) ) {
  19149. break;
  19150. }
  19151. matched.push( elem );
  19152. }
  19153. }
  19154. return matched;
  19155. };
  19156. var siblings = function( n, elem ) {
  19157. var matched = [];
  19158. for ( ; n; n = n.nextSibling ) {
  19159. if ( n.nodeType === 1 && n !== elem ) {
  19160. matched.push( n );
  19161. }
  19162. }
  19163. return matched;
  19164. };
  19165. var rneedsContext = jQuery.expr.match.needsContext;
  19166. function nodeName( elem, name ) {
  19167. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  19168. };
  19169. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  19170. var risSimple = /^.[^:#\[\.,]*$/;
  19171. // Implement the identical functionality for filter and not
  19172. function winnow( elements, qualifier, not ) {
  19173. if ( jQuery.isFunction( qualifier ) ) {
  19174. return jQuery.grep( elements, function( elem, i ) {
  19175. return !!qualifier.call( elem, i, elem ) !== not;
  19176. } );
  19177. }
  19178. // Single element
  19179. if ( qualifier.nodeType ) {
  19180. return jQuery.grep( elements, function( elem ) {
  19181. return ( elem === qualifier ) !== not;
  19182. } );
  19183. }
  19184. // Arraylike of elements (jQuery, arguments, Array)
  19185. if ( typeof qualifier !== "string" ) {
  19186. return jQuery.grep( elements, function( elem ) {
  19187. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  19188. } );
  19189. }
  19190. // Simple selector that can be filtered directly, removing non-Elements
  19191. if ( risSimple.test( qualifier ) ) {
  19192. return jQuery.filter( qualifier, elements, not );
  19193. }
  19194. // Complex selector, compare the two sets, removing non-Elements
  19195. qualifier = jQuery.filter( qualifier, elements );
  19196. return jQuery.grep( elements, function( elem ) {
  19197. return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
  19198. } );
  19199. }
  19200. jQuery.filter = function( expr, elems, not ) {
  19201. var elem = elems[ 0 ];
  19202. if ( not ) {
  19203. expr = ":not(" + expr + ")";
  19204. }
  19205. if ( elems.length === 1 && elem.nodeType === 1 ) {
  19206. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  19207. }
  19208. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  19209. return elem.nodeType === 1;
  19210. } ) );
  19211. };
  19212. jQuery.fn.extend( {
  19213. find: function( selector ) {
  19214. var i, ret,
  19215. len = this.length,
  19216. self = this;
  19217. if ( typeof selector !== "string" ) {
  19218. return this.pushStack( jQuery( selector ).filter( function() {
  19219. for ( i = 0; i < len; i++ ) {
  19220. if ( jQuery.contains( self[ i ], this ) ) {
  19221. return true;
  19222. }
  19223. }
  19224. } ) );
  19225. }
  19226. ret = this.pushStack( [] );
  19227. for ( i = 0; i < len; i++ ) {
  19228. jQuery.find( selector, self[ i ], ret );
  19229. }
  19230. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  19231. },
  19232. filter: function( selector ) {
  19233. return this.pushStack( winnow( this, selector || [], false ) );
  19234. },
  19235. not: function( selector ) {
  19236. return this.pushStack( winnow( this, selector || [], true ) );
  19237. },
  19238. is: function( selector ) {
  19239. return !!winnow(
  19240. this,
  19241. // If this is a positional/relative selector, check membership in the returned set
  19242. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  19243. typeof selector === "string" && rneedsContext.test( selector ) ?
  19244. jQuery( selector ) :
  19245. selector || [],
  19246. false
  19247. ).length;
  19248. }
  19249. } );
  19250. // Initialize a jQuery object
  19251. // A central reference to the root jQuery(document)
  19252. var rootjQuery,
  19253. // A simple way to check for HTML strings
  19254. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  19255. // Strict HTML recognition (#11290: must start with <)
  19256. // Shortcut simple #id case for speed
  19257. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  19258. init = jQuery.fn.init = function( selector, context, root ) {
  19259. var match, elem;
  19260. // HANDLE: $(""), $(null), $(undefined), $(false)
  19261. if ( !selector ) {
  19262. return this;
  19263. }
  19264. // Method init() accepts an alternate rootjQuery
  19265. // so migrate can support jQuery.sub (gh-2101)
  19266. root = root || rootjQuery;
  19267. // Handle HTML strings
  19268. if ( typeof selector === "string" ) {
  19269. if ( selector[ 0 ] === "<" &&
  19270. selector[ selector.length - 1 ] === ">" &&
  19271. selector.length >= 3 ) {
  19272. // Assume that strings that start and end with <> are HTML and skip the regex check
  19273. match = [ null, selector, null ];
  19274. } else {
  19275. match = rquickExpr.exec( selector );
  19276. }
  19277. // Match html or make sure no context is specified for #id
  19278. if ( match && ( match[ 1 ] || !context ) ) {
  19279. // HANDLE: $(html) -> $(array)
  19280. if ( match[ 1 ] ) {
  19281. context = context instanceof jQuery ? context[ 0 ] : context;
  19282. // Option to run scripts is true for back-compat
  19283. // Intentionally let the error be thrown if parseHTML is not present
  19284. jQuery.merge( this, jQuery.parseHTML(
  19285. match[ 1 ],
  19286. context && context.nodeType ? context.ownerDocument || context : document,
  19287. true
  19288. ) );
  19289. // HANDLE: $(html, props)
  19290. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  19291. for ( match in context ) {
  19292. // Properties of context are called as methods if possible
  19293. if ( jQuery.isFunction( this[ match ] ) ) {
  19294. this[ match ]( context[ match ] );
  19295. // ...and otherwise set as attributes
  19296. } else {
  19297. this.attr( match, context[ match ] );
  19298. }
  19299. }
  19300. }
  19301. return this;
  19302. // HANDLE: $(#id)
  19303. } else {
  19304. elem = document.getElementById( match[ 2 ] );
  19305. if ( elem ) {
  19306. // Inject the element directly into the jQuery object
  19307. this[ 0 ] = elem;
  19308. this.length = 1;
  19309. }
  19310. return this;
  19311. }
  19312. // HANDLE: $(expr, $(...))
  19313. } else if ( !context || context.jquery ) {
  19314. return ( context || root ).find( selector );
  19315. // HANDLE: $(expr, context)
  19316. // (which is just equivalent to: $(context).find(expr)
  19317. } else {
  19318. return this.constructor( context ).find( selector );
  19319. }
  19320. // HANDLE: $(DOMElement)
  19321. } else if ( selector.nodeType ) {
  19322. this[ 0 ] = selector;
  19323. this.length = 1;
  19324. return this;
  19325. // HANDLE: $(function)
  19326. // Shortcut for document ready
  19327. } else if ( jQuery.isFunction( selector ) ) {
  19328. return root.ready !== undefined ?
  19329. root.ready( selector ) :
  19330. // Execute immediately if ready is not present
  19331. selector( jQuery );
  19332. }
  19333. return jQuery.makeArray( selector, this );
  19334. };
  19335. // Give the init function the jQuery prototype for later instantiation
  19336. init.prototype = jQuery.fn;
  19337. // Initialize central reference
  19338. rootjQuery = jQuery( document );
  19339. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  19340. // Methods guaranteed to produce a unique set when starting from a unique set
  19341. guaranteedUnique = {
  19342. children: true,
  19343. contents: true,
  19344. next: true,
  19345. prev: true
  19346. };
  19347. jQuery.fn.extend( {
  19348. has: function( target ) {
  19349. var targets = jQuery( target, this ),
  19350. l = targets.length;
  19351. return this.filter( function() {
  19352. var i = 0;
  19353. for ( ; i < l; i++ ) {
  19354. if ( jQuery.contains( this, targets[ i ] ) ) {
  19355. return true;
  19356. }
  19357. }
  19358. } );
  19359. },
  19360. closest: function( selectors, context ) {
  19361. var cur,
  19362. i = 0,
  19363. l = this.length,
  19364. matched = [],
  19365. targets = typeof selectors !== "string" && jQuery( selectors );
  19366. // Positional selectors never match, since there's no _selection_ context
  19367. if ( !rneedsContext.test( selectors ) ) {
  19368. for ( ; i < l; i++ ) {
  19369. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  19370. // Always skip document fragments
  19371. if ( cur.nodeType < 11 && ( targets ?
  19372. targets.index( cur ) > -1 :
  19373. // Don't pass non-elements to Sizzle
  19374. cur.nodeType === 1 &&
  19375. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  19376. matched.push( cur );
  19377. break;
  19378. }
  19379. }
  19380. }
  19381. }
  19382. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  19383. },
  19384. // Determine the position of an element within the set
  19385. index: function( elem ) {
  19386. // No argument, return index in parent
  19387. if ( !elem ) {
  19388. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  19389. }
  19390. // Index in selector
  19391. if ( typeof elem === "string" ) {
  19392. return indexOf.call( jQuery( elem ), this[ 0 ] );
  19393. }
  19394. // Locate the position of the desired element
  19395. return indexOf.call( this,
  19396. // If it receives a jQuery object, the first element is used
  19397. elem.jquery ? elem[ 0 ] : elem
  19398. );
  19399. },
  19400. add: function( selector, context ) {
  19401. return this.pushStack(
  19402. jQuery.uniqueSort(
  19403. jQuery.merge( this.get(), jQuery( selector, context ) )
  19404. )
  19405. );
  19406. },
  19407. addBack: function( selector ) {
  19408. return this.add( selector == null ?
  19409. this.prevObject : this.prevObject.filter( selector )
  19410. );
  19411. }
  19412. } );
  19413. function sibling( cur, dir ) {
  19414. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  19415. return cur;
  19416. }
  19417. jQuery.each( {
  19418. parent: function( elem ) {
  19419. var parent = elem.parentNode;
  19420. return parent && parent.nodeType !== 11 ? parent : null;
  19421. },
  19422. parents: function( elem ) {
  19423. return dir( elem, "parentNode" );
  19424. },
  19425. parentsUntil: function( elem, i, until ) {
  19426. return dir( elem, "parentNode", until );
  19427. },
  19428. next: function( elem ) {
  19429. return sibling( elem, "nextSibling" );
  19430. },
  19431. prev: function( elem ) {
  19432. return sibling( elem, "previousSibling" );
  19433. },
  19434. nextAll: function( elem ) {
  19435. return dir( elem, "nextSibling" );
  19436. },
  19437. prevAll: function( elem ) {
  19438. return dir( elem, "previousSibling" );
  19439. },
  19440. nextUntil: function( elem, i, until ) {
  19441. return dir( elem, "nextSibling", until );
  19442. },
  19443. prevUntil: function( elem, i, until ) {
  19444. return dir( elem, "previousSibling", until );
  19445. },
  19446. siblings: function( elem ) {
  19447. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  19448. },
  19449. children: function( elem ) {
  19450. return siblings( elem.firstChild );
  19451. },
  19452. contents: function( elem ) {
  19453. if ( nodeName( elem, "iframe" ) ) {
  19454. return elem.contentDocument;
  19455. }
  19456. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  19457. // Treat the template element as a regular one in browsers that
  19458. // don't support it.
  19459. if ( nodeName( elem, "template" ) ) {
  19460. elem = elem.content || elem;
  19461. }
  19462. return jQuery.merge( [], elem.childNodes );
  19463. }
  19464. }, function( name, fn ) {
  19465. jQuery.fn[ name ] = function( until, selector ) {
  19466. var matched = jQuery.map( this, fn, until );
  19467. if ( name.slice( -5 ) !== "Until" ) {
  19468. selector = until;
  19469. }
  19470. if ( selector && typeof selector === "string" ) {
  19471. matched = jQuery.filter( selector, matched );
  19472. }
  19473. if ( this.length > 1 ) {
  19474. // Remove duplicates
  19475. if ( !guaranteedUnique[ name ] ) {
  19476. jQuery.uniqueSort( matched );
  19477. }
  19478. // Reverse order for parents* and prev-derivatives
  19479. if ( rparentsprev.test( name ) ) {
  19480. matched.reverse();
  19481. }
  19482. }
  19483. return this.pushStack( matched );
  19484. };
  19485. } );
  19486. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  19487. // Convert String-formatted options into Object-formatted ones
  19488. function createOptions( options ) {
  19489. var object = {};
  19490. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  19491. object[ flag ] = true;
  19492. } );
  19493. return object;
  19494. }
  19495. /*
  19496. * Create a callback list using the following parameters:
  19497. *
  19498. * options: an optional list of space-separated options that will change how
  19499. * the callback list behaves or a more traditional option object
  19500. *
  19501. * By default a callback list will act like an event callback list and can be
  19502. * "fired" multiple times.
  19503. *
  19504. * Possible options:
  19505. *
  19506. * once: will ensure the callback list can only be fired once (like a Deferred)
  19507. *
  19508. * memory: will keep track of previous values and will call any callback added
  19509. * after the list has been fired right away with the latest "memorized"
  19510. * values (like a Deferred)
  19511. *
  19512. * unique: will ensure a callback can only be added once (no duplicate in the list)
  19513. *
  19514. * stopOnFalse: interrupt callings when a callback returns false
  19515. *
  19516. */
  19517. jQuery.Callbacks = function( options ) {
  19518. // Convert options from String-formatted to Object-formatted if needed
  19519. // (we check in cache first)
  19520. options = typeof options === "string" ?
  19521. createOptions( options ) :
  19522. jQuery.extend( {}, options );
  19523. var // Flag to know if list is currently firing
  19524. firing,
  19525. // Last fire value for non-forgettable lists
  19526. memory,
  19527. // Flag to know if list was already fired
  19528. fired,
  19529. // Flag to prevent firing
  19530. locked,
  19531. // Actual callback list
  19532. list = [],
  19533. // Queue of execution data for repeatable lists
  19534. queue = [],
  19535. // Index of currently firing callback (modified by add/remove as needed)
  19536. firingIndex = -1,
  19537. // Fire callbacks
  19538. fire = function() {
  19539. // Enforce single-firing
  19540. locked = locked || options.once;
  19541. // Execute callbacks for all pending executions,
  19542. // respecting firingIndex overrides and runtime changes
  19543. fired = firing = true;
  19544. for ( ; queue.length; firingIndex = -1 ) {
  19545. memory = queue.shift();
  19546. while ( ++firingIndex < list.length ) {
  19547. // Run callback and check for early termination
  19548. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  19549. options.stopOnFalse ) {
  19550. // Jump to end and forget the data so .add doesn't re-fire
  19551. firingIndex = list.length;
  19552. memory = false;
  19553. }
  19554. }
  19555. }
  19556. // Forget the data if we're done with it
  19557. if ( !options.memory ) {
  19558. memory = false;
  19559. }
  19560. firing = false;
  19561. // Clean up if we're done firing for good
  19562. if ( locked ) {
  19563. // Keep an empty list if we have data for future add calls
  19564. if ( memory ) {
  19565. list = [];
  19566. // Otherwise, this object is spent
  19567. } else {
  19568. list = "";
  19569. }
  19570. }
  19571. },
  19572. // Actual Callbacks object
  19573. self = {
  19574. // Add a callback or a collection of callbacks to the list
  19575. add: function() {
  19576. if ( list ) {
  19577. // If we have memory from a past run, we should fire after adding
  19578. if ( memory && !firing ) {
  19579. firingIndex = list.length - 1;
  19580. queue.push( memory );
  19581. }
  19582. ( function add( args ) {
  19583. jQuery.each( args, function( _, arg ) {
  19584. if ( jQuery.isFunction( arg ) ) {
  19585. if ( !options.unique || !self.has( arg ) ) {
  19586. list.push( arg );
  19587. }
  19588. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  19589. // Inspect recursively
  19590. add( arg );
  19591. }
  19592. } );
  19593. } )( arguments );
  19594. if ( memory && !firing ) {
  19595. fire();
  19596. }
  19597. }
  19598. return this;
  19599. },
  19600. // Remove a callback from the list
  19601. remove: function() {
  19602. jQuery.each( arguments, function( _, arg ) {
  19603. var index;
  19604. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  19605. list.splice( index, 1 );
  19606. // Handle firing indexes
  19607. if ( index <= firingIndex ) {
  19608. firingIndex--;
  19609. }
  19610. }
  19611. } );
  19612. return this;
  19613. },
  19614. // Check if a given callback is in the list.
  19615. // If no argument is given, return whether or not list has callbacks attached.
  19616. has: function( fn ) {
  19617. return fn ?
  19618. jQuery.inArray( fn, list ) > -1 :
  19619. list.length > 0;
  19620. },
  19621. // Remove all callbacks from the list
  19622. empty: function() {
  19623. if ( list ) {
  19624. list = [];
  19625. }
  19626. return this;
  19627. },
  19628. // Disable .fire and .add
  19629. // Abort any current/pending executions
  19630. // Clear all callbacks and values
  19631. disable: function() {
  19632. locked = queue = [];
  19633. list = memory = "";
  19634. return this;
  19635. },
  19636. disabled: function() {
  19637. return !list;
  19638. },
  19639. // Disable .fire
  19640. // Also disable .add unless we have memory (since it would have no effect)
  19641. // Abort any pending executions
  19642. lock: function() {
  19643. locked = queue = [];
  19644. if ( !memory && !firing ) {
  19645. list = memory = "";
  19646. }
  19647. return this;
  19648. },
  19649. locked: function() {
  19650. return !!locked;
  19651. },
  19652. // Call all callbacks with the given context and arguments
  19653. fireWith: function( context, args ) {
  19654. if ( !locked ) {
  19655. args = args || [];
  19656. args = [ context, args.slice ? args.slice() : args ];
  19657. queue.push( args );
  19658. if ( !firing ) {
  19659. fire();
  19660. }
  19661. }
  19662. return this;
  19663. },
  19664. // Call all the callbacks with the given arguments
  19665. fire: function() {
  19666. self.fireWith( this, arguments );
  19667. return this;
  19668. },
  19669. // To know if the callbacks have already been called at least once
  19670. fired: function() {
  19671. return !!fired;
  19672. }
  19673. };
  19674. return self;
  19675. };
  19676. function Identity( v ) {
  19677. return v;
  19678. }
  19679. function Thrower( ex ) {
  19680. throw ex;
  19681. }
  19682. function adoptValue( value, resolve, reject, noValue ) {
  19683. var method;
  19684. try {
  19685. // Check for promise aspect first to privilege synchronous behavior
  19686. if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
  19687. method.call( value ).done( resolve ).fail( reject );
  19688. // Other thenables
  19689. } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
  19690. method.call( value, resolve, reject );
  19691. // Other non-thenables
  19692. } else {
  19693. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  19694. // * false: [ value ].slice( 0 ) => resolve( value )
  19695. // * true: [ value ].slice( 1 ) => resolve()
  19696. resolve.apply( undefined, [ value ].slice( noValue ) );
  19697. }
  19698. // For Promises/A+, convert exceptions into rejections
  19699. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  19700. // Deferred#then to conditionally suppress rejection.
  19701. } catch ( value ) {
  19702. // Support: Android 4.0 only
  19703. // Strict mode functions invoked without .call/.apply get global-object context
  19704. reject.apply( undefined, [ value ] );
  19705. }
  19706. }
  19707. jQuery.extend( {
  19708. Deferred: function( func ) {
  19709. var tuples = [
  19710. // action, add listener, callbacks,
  19711. // ... .then handlers, argument index, [final state]
  19712. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  19713. jQuery.Callbacks( "memory" ), 2 ],
  19714. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  19715. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  19716. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  19717. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  19718. ],
  19719. state = "pending",
  19720. promise = {
  19721. state: function() {
  19722. return state;
  19723. },
  19724. always: function() {
  19725. deferred.done( arguments ).fail( arguments );
  19726. return this;
  19727. },
  19728. "catch": function( fn ) {
  19729. return promise.then( null, fn );
  19730. },
  19731. // Keep pipe for back-compat
  19732. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  19733. var fns = arguments;
  19734. return jQuery.Deferred( function( newDefer ) {
  19735. jQuery.each( tuples, function( i, tuple ) {
  19736. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  19737. var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  19738. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  19739. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  19740. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  19741. deferred[ tuple[ 1 ] ]( function() {
  19742. var returned = fn && fn.apply( this, arguments );
  19743. if ( returned && jQuery.isFunction( returned.promise ) ) {
  19744. returned.promise()
  19745. .progress( newDefer.notify )
  19746. .done( newDefer.resolve )
  19747. .fail( newDefer.reject );
  19748. } else {
  19749. newDefer[ tuple[ 0 ] + "With" ](
  19750. this,
  19751. fn ? [ returned ] : arguments
  19752. );
  19753. }
  19754. } );
  19755. } );
  19756. fns = null;
  19757. } ).promise();
  19758. },
  19759. then: function( onFulfilled, onRejected, onProgress ) {
  19760. var maxDepth = 0;
  19761. function resolve( depth, deferred, handler, special ) {
  19762. return function() {
  19763. var that = this,
  19764. args = arguments,
  19765. mightThrow = function() {
  19766. var returned, then;
  19767. // Support: Promises/A+ section 2.3.3.3.3
  19768. // https://promisesaplus.com/#point-59
  19769. // Ignore double-resolution attempts
  19770. if ( depth < maxDepth ) {
  19771. return;
  19772. }
  19773. returned = handler.apply( that, args );
  19774. // Support: Promises/A+ section 2.3.1
  19775. // https://promisesaplus.com/#point-48
  19776. if ( returned === deferred.promise() ) {
  19777. throw new TypeError( "Thenable self-resolution" );
  19778. }
  19779. // Support: Promises/A+ sections 2.3.3.1, 3.5
  19780. // https://promisesaplus.com/#point-54
  19781. // https://promisesaplus.com/#point-75
  19782. // Retrieve `then` only once
  19783. then = returned &&
  19784. // Support: Promises/A+ section 2.3.4
  19785. // https://promisesaplus.com/#point-64
  19786. // Only check objects and functions for thenability
  19787. ( typeof returned === "object" ||
  19788. typeof returned === "function" ) &&
  19789. returned.then;
  19790. // Handle a returned thenable
  19791. if ( jQuery.isFunction( then ) ) {
  19792. // Special processors (notify) just wait for resolution
  19793. if ( special ) {
  19794. then.call(
  19795. returned,
  19796. resolve( maxDepth, deferred, Identity, special ),
  19797. resolve( maxDepth, deferred, Thrower, special )
  19798. );
  19799. // Normal processors (resolve) also hook into progress
  19800. } else {
  19801. // ...and disregard older resolution values
  19802. maxDepth++;
  19803. then.call(
  19804. returned,
  19805. resolve( maxDepth, deferred, Identity, special ),
  19806. resolve( maxDepth, deferred, Thrower, special ),
  19807. resolve( maxDepth, deferred, Identity,
  19808. deferred.notifyWith )
  19809. );
  19810. }
  19811. // Handle all other returned values
  19812. } else {
  19813. // Only substitute handlers pass on context
  19814. // and multiple values (non-spec behavior)
  19815. if ( handler !== Identity ) {
  19816. that = undefined;
  19817. args = [ returned ];
  19818. }
  19819. // Process the value(s)
  19820. // Default process is resolve
  19821. ( special || deferred.resolveWith )( that, args );
  19822. }
  19823. },
  19824. // Only normal processors (resolve) catch and reject exceptions
  19825. process = special ?
  19826. mightThrow :
  19827. function() {
  19828. try {
  19829. mightThrow();
  19830. } catch ( e ) {
  19831. if ( jQuery.Deferred.exceptionHook ) {
  19832. jQuery.Deferred.exceptionHook( e,
  19833. process.stackTrace );
  19834. }
  19835. // Support: Promises/A+ section 2.3.3.3.4.1
  19836. // https://promisesaplus.com/#point-61
  19837. // Ignore post-resolution exceptions
  19838. if ( depth + 1 >= maxDepth ) {
  19839. // Only substitute handlers pass on context
  19840. // and multiple values (non-spec behavior)
  19841. if ( handler !== Thrower ) {
  19842. that = undefined;
  19843. args = [ e ];
  19844. }
  19845. deferred.rejectWith( that, args );
  19846. }
  19847. }
  19848. };
  19849. // Support: Promises/A+ section 2.3.3.3.1
  19850. // https://promisesaplus.com/#point-57
  19851. // Re-resolve promises immediately to dodge false rejection from
  19852. // subsequent errors
  19853. if ( depth ) {
  19854. process();
  19855. } else {
  19856. // Call an optional hook to record the stack, in case of exception
  19857. // since it's otherwise lost when execution goes async
  19858. if ( jQuery.Deferred.getStackHook ) {
  19859. process.stackTrace = jQuery.Deferred.getStackHook();
  19860. }
  19861. window.setTimeout( process );
  19862. }
  19863. };
  19864. }
  19865. return jQuery.Deferred( function( newDefer ) {
  19866. // progress_handlers.add( ... )
  19867. tuples[ 0 ][ 3 ].add(
  19868. resolve(
  19869. 0,
  19870. newDefer,
  19871. jQuery.isFunction( onProgress ) ?
  19872. onProgress :
  19873. Identity,
  19874. newDefer.notifyWith
  19875. )
  19876. );
  19877. // fulfilled_handlers.add( ... )
  19878. tuples[ 1 ][ 3 ].add(
  19879. resolve(
  19880. 0,
  19881. newDefer,
  19882. jQuery.isFunction( onFulfilled ) ?
  19883. onFulfilled :
  19884. Identity
  19885. )
  19886. );
  19887. // rejected_handlers.add( ... )
  19888. tuples[ 2 ][ 3 ].add(
  19889. resolve(
  19890. 0,
  19891. newDefer,
  19892. jQuery.isFunction( onRejected ) ?
  19893. onRejected :
  19894. Thrower
  19895. )
  19896. );
  19897. } ).promise();
  19898. },
  19899. // Get a promise for this deferred
  19900. // If obj is provided, the promise aspect is added to the object
  19901. promise: function( obj ) {
  19902. return obj != null ? jQuery.extend( obj, promise ) : promise;
  19903. }
  19904. },
  19905. deferred = {};
  19906. // Add list-specific methods
  19907. jQuery.each( tuples, function( i, tuple ) {
  19908. var list = tuple[ 2 ],
  19909. stateString = tuple[ 5 ];
  19910. // promise.progress = list.add
  19911. // promise.done = list.add
  19912. // promise.fail = list.add
  19913. promise[ tuple[ 1 ] ] = list.add;
  19914. // Handle state
  19915. if ( stateString ) {
  19916. list.add(
  19917. function() {
  19918. // state = "resolved" (i.e., fulfilled)
  19919. // state = "rejected"
  19920. state = stateString;
  19921. },
  19922. // rejected_callbacks.disable
  19923. // fulfilled_callbacks.disable
  19924. tuples[ 3 - i ][ 2 ].disable,
  19925. // progress_callbacks.lock
  19926. tuples[ 0 ][ 2 ].lock
  19927. );
  19928. }
  19929. // progress_handlers.fire
  19930. // fulfilled_handlers.fire
  19931. // rejected_handlers.fire
  19932. list.add( tuple[ 3 ].fire );
  19933. // deferred.notify = function() { deferred.notifyWith(...) }
  19934. // deferred.resolve = function() { deferred.resolveWith(...) }
  19935. // deferred.reject = function() { deferred.rejectWith(...) }
  19936. deferred[ tuple[ 0 ] ] = function() {
  19937. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  19938. return this;
  19939. };
  19940. // deferred.notifyWith = list.fireWith
  19941. // deferred.resolveWith = list.fireWith
  19942. // deferred.rejectWith = list.fireWith
  19943. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  19944. } );
  19945. // Make the deferred a promise
  19946. promise.promise( deferred );
  19947. // Call given func if any
  19948. if ( func ) {
  19949. func.call( deferred, deferred );
  19950. }
  19951. // All done!
  19952. return deferred;
  19953. },
  19954. // Deferred helper
  19955. when: function( singleValue ) {
  19956. var
  19957. // count of uncompleted subordinates
  19958. remaining = arguments.length,
  19959. // count of unprocessed arguments
  19960. i = remaining,
  19961. // subordinate fulfillment data
  19962. resolveContexts = Array( i ),
  19963. resolveValues = slice.call( arguments ),
  19964. // the master Deferred
  19965. master = jQuery.Deferred(),
  19966. // subordinate callback factory
  19967. updateFunc = function( i ) {
  19968. return function( value ) {
  19969. resolveContexts[ i ] = this;
  19970. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  19971. if ( !( --remaining ) ) {
  19972. master.resolveWith( resolveContexts, resolveValues );
  19973. }
  19974. };
  19975. };
  19976. // Single- and empty arguments are adopted like Promise.resolve
  19977. if ( remaining <= 1 ) {
  19978. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  19979. !remaining );
  19980. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  19981. if ( master.state() === "pending" ||
  19982. jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  19983. return master.then();
  19984. }
  19985. }
  19986. // Multiple arguments are aggregated like Promise.all array elements
  19987. while ( i-- ) {
  19988. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  19989. }
  19990. return master.promise();
  19991. }
  19992. } );
  19993. // These usually indicate a programmer mistake during development,
  19994. // warn about them ASAP rather than swallowing them by default.
  19995. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  19996. jQuery.Deferred.exceptionHook = function( error, stack ) {
  19997. // Support: IE 8 - 9 only
  19998. // Console exists when dev tools are open, which can happen at any time
  19999. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  20000. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  20001. }
  20002. };
  20003. jQuery.readyException = function( error ) {
  20004. window.setTimeout( function() {
  20005. throw error;
  20006. } );
  20007. };
  20008. // The deferred used on DOM ready
  20009. var readyList = jQuery.Deferred();
  20010. jQuery.fn.ready = function( fn ) {
  20011. readyList
  20012. .then( fn )
  20013. // Wrap jQuery.readyException in a function so that the lookup
  20014. // happens at the time of error handling instead of callback
  20015. // registration.
  20016. .catch( function( error ) {
  20017. jQuery.readyException( error );
  20018. } );
  20019. return this;
  20020. };
  20021. jQuery.extend( {
  20022. // Is the DOM ready to be used? Set to true once it occurs.
  20023. isReady: false,
  20024. // A counter to track how many items to wait for before
  20025. // the ready event fires. See #6781
  20026. readyWait: 1,
  20027. // Handle when the DOM is ready
  20028. ready: function( wait ) {
  20029. // Abort if there are pending holds or we're already ready
  20030. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  20031. return;
  20032. }
  20033. // Remember that the DOM is ready
  20034. jQuery.isReady = true;
  20035. // If a normal DOM Ready event fired, decrement, and wait if need be
  20036. if ( wait !== true && --jQuery.readyWait > 0 ) {
  20037. return;
  20038. }
  20039. // If there are functions bound, to execute
  20040. readyList.resolveWith( document, [ jQuery ] );
  20041. }
  20042. } );
  20043. jQuery.ready.then = readyList.then;
  20044. // The ready event handler and self cleanup method
  20045. function completed() {
  20046. document.removeEventListener( "DOMContentLoaded", completed );
  20047. window.removeEventListener( "load", completed );
  20048. jQuery.ready();
  20049. }
  20050. // Catch cases where $(document).ready() is called
  20051. // after the browser event has already occurred.
  20052. // Support: IE <=9 - 10 only
  20053. // Older IE sometimes signals "interactive" too soon
  20054. if ( document.readyState === "complete" ||
  20055. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  20056. // Handle it asynchronously to allow scripts the opportunity to delay ready
  20057. window.setTimeout( jQuery.ready );
  20058. } else {
  20059. // Use the handy event callback
  20060. document.addEventListener( "DOMContentLoaded", completed );
  20061. // A fallback to window.onload, that will always work
  20062. window.addEventListener( "load", completed );
  20063. }
  20064. // Multifunctional method to get and set values of a collection
  20065. // The value/s can optionally be executed if it's a function
  20066. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  20067. var i = 0,
  20068. len = elems.length,
  20069. bulk = key == null;
  20070. // Sets many values
  20071. if ( jQuery.type( key ) === "object" ) {
  20072. chainable = true;
  20073. for ( i in key ) {
  20074. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  20075. }
  20076. // Sets one value
  20077. } else if ( value !== undefined ) {
  20078. chainable = true;
  20079. if ( !jQuery.isFunction( value ) ) {
  20080. raw = true;
  20081. }
  20082. if ( bulk ) {
  20083. // Bulk operations run against the entire set
  20084. if ( raw ) {
  20085. fn.call( elems, value );
  20086. fn = null;
  20087. // ...except when executing function values
  20088. } else {
  20089. bulk = fn;
  20090. fn = function( elem, key, value ) {
  20091. return bulk.call( jQuery( elem ), value );
  20092. };
  20093. }
  20094. }
  20095. if ( fn ) {
  20096. for ( ; i < len; i++ ) {
  20097. fn(
  20098. elems[ i ], key, raw ?
  20099. value :
  20100. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  20101. );
  20102. }
  20103. }
  20104. }
  20105. if ( chainable ) {
  20106. return elems;
  20107. }
  20108. // Gets
  20109. if ( bulk ) {
  20110. return fn.call( elems );
  20111. }
  20112. return len ? fn( elems[ 0 ], key ) : emptyGet;
  20113. };
  20114. var acceptData = function( owner ) {
  20115. // Accepts only:
  20116. // - Node
  20117. // - Node.ELEMENT_NODE
  20118. // - Node.DOCUMENT_NODE
  20119. // - Object
  20120. // - Any
  20121. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  20122. };
  20123. function Data() {
  20124. this.expando = jQuery.expando + Data.uid++;
  20125. }
  20126. Data.uid = 1;
  20127. Data.prototype = {
  20128. cache: function( owner ) {
  20129. // Check if the owner object already has a cache
  20130. var value = owner[ this.expando ];
  20131. // If not, create one
  20132. if ( !value ) {
  20133. value = {};
  20134. // We can accept data for non-element nodes in modern browsers,
  20135. // but we should not, see #8335.
  20136. // Always return an empty object.
  20137. if ( acceptData( owner ) ) {
  20138. // If it is a node unlikely to be stringify-ed or looped over
  20139. // use plain assignment
  20140. if ( owner.nodeType ) {
  20141. owner[ this.expando ] = value;
  20142. // Otherwise secure it in a non-enumerable property
  20143. // configurable must be true to allow the property to be
  20144. // deleted when data is removed
  20145. } else {
  20146. Object.defineProperty( owner, this.expando, {
  20147. value: value,
  20148. configurable: true
  20149. } );
  20150. }
  20151. }
  20152. }
  20153. return value;
  20154. },
  20155. set: function( owner, data, value ) {
  20156. var prop,
  20157. cache = this.cache( owner );
  20158. // Handle: [ owner, key, value ] args
  20159. // Always use camelCase key (gh-2257)
  20160. if ( typeof data === "string" ) {
  20161. cache[ jQuery.camelCase( data ) ] = value;
  20162. // Handle: [ owner, { properties } ] args
  20163. } else {
  20164. // Copy the properties one-by-one to the cache object
  20165. for ( prop in data ) {
  20166. cache[ jQuery.camelCase( prop ) ] = data[ prop ];
  20167. }
  20168. }
  20169. return cache;
  20170. },
  20171. get: function( owner, key ) {
  20172. return key === undefined ?
  20173. this.cache( owner ) :
  20174. // Always use camelCase key (gh-2257)
  20175. owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
  20176. },
  20177. access: function( owner, key, value ) {
  20178. // In cases where either:
  20179. //
  20180. // 1. No key was specified
  20181. // 2. A string key was specified, but no value provided
  20182. //
  20183. // Take the "read" path and allow the get method to determine
  20184. // which value to return, respectively either:
  20185. //
  20186. // 1. The entire cache object
  20187. // 2. The data stored at the key
  20188. //
  20189. if ( key === undefined ||
  20190. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  20191. return this.get( owner, key );
  20192. }
  20193. // When the key is not a string, or both a key and value
  20194. // are specified, set or extend (existing objects) with either:
  20195. //
  20196. // 1. An object of properties
  20197. // 2. A key and value
  20198. //
  20199. this.set( owner, key, value );
  20200. // Since the "set" path can have two possible entry points
  20201. // return the expected data based on which path was taken[*]
  20202. return value !== undefined ? value : key;
  20203. },
  20204. remove: function( owner, key ) {
  20205. var i,
  20206. cache = owner[ this.expando ];
  20207. if ( cache === undefined ) {
  20208. return;
  20209. }
  20210. if ( key !== undefined ) {
  20211. // Support array or space separated string of keys
  20212. if ( Array.isArray( key ) ) {
  20213. // If key is an array of keys...
  20214. // We always set camelCase keys, so remove that.
  20215. key = key.map( jQuery.camelCase );
  20216. } else {
  20217. key = jQuery.camelCase( key );
  20218. // If a key with the spaces exists, use it.
  20219. // Otherwise, create an array by matching non-whitespace
  20220. key = key in cache ?
  20221. [ key ] :
  20222. ( key.match( rnothtmlwhite ) || [] );
  20223. }
  20224. i = key.length;
  20225. while ( i-- ) {
  20226. delete cache[ key[ i ] ];
  20227. }
  20228. }
  20229. // Remove the expando if there's no more data
  20230. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  20231. // Support: Chrome <=35 - 45
  20232. // Webkit & Blink performance suffers when deleting properties
  20233. // from DOM nodes, so set to undefined instead
  20234. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  20235. if ( owner.nodeType ) {
  20236. owner[ this.expando ] = undefined;
  20237. } else {
  20238. delete owner[ this.expando ];
  20239. }
  20240. }
  20241. },
  20242. hasData: function( owner ) {
  20243. var cache = owner[ this.expando ];
  20244. return cache !== undefined && !jQuery.isEmptyObject( cache );
  20245. }
  20246. };
  20247. var dataPriv = new Data();
  20248. var dataUser = new Data();
  20249. // Implementation Summary
  20250. //
  20251. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  20252. // 2. Improve the module's maintainability by reducing the storage
  20253. // paths to a single mechanism.
  20254. // 3. Use the same single mechanism to support "private" and "user" data.
  20255. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  20256. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  20257. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  20258. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  20259. rmultiDash = /[A-Z]/g;
  20260. function getData( data ) {
  20261. if ( data === "true" ) {
  20262. return true;
  20263. }
  20264. if ( data === "false" ) {
  20265. return false;
  20266. }
  20267. if ( data === "null" ) {
  20268. return null;
  20269. }
  20270. // Only convert to a number if it doesn't change the string
  20271. if ( data === +data + "" ) {
  20272. return +data;
  20273. }
  20274. if ( rbrace.test( data ) ) {
  20275. return JSON.parse( data );
  20276. }
  20277. return data;
  20278. }
  20279. function dataAttr( elem, key, data ) {
  20280. var name;
  20281. // If nothing was found internally, try to fetch any
  20282. // data from the HTML5 data-* attribute
  20283. if ( data === undefined && elem.nodeType === 1 ) {
  20284. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  20285. data = elem.getAttribute( name );
  20286. if ( typeof data === "string" ) {
  20287. try {
  20288. data = getData( data );
  20289. } catch ( e ) {}
  20290. // Make sure we set the data so it isn't changed later
  20291. dataUser.set( elem, key, data );
  20292. } else {
  20293. data = undefined;
  20294. }
  20295. }
  20296. return data;
  20297. }
  20298. jQuery.extend( {
  20299. hasData: function( elem ) {
  20300. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  20301. },
  20302. data: function( elem, name, data ) {
  20303. return dataUser.access( elem, name, data );
  20304. },
  20305. removeData: function( elem, name ) {
  20306. dataUser.remove( elem, name );
  20307. },
  20308. // TODO: Now that all calls to _data and _removeData have been replaced
  20309. // with direct calls to dataPriv methods, these can be deprecated.
  20310. _data: function( elem, name, data ) {
  20311. return dataPriv.access( elem, name, data );
  20312. },
  20313. _removeData: function( elem, name ) {
  20314. dataPriv.remove( elem, name );
  20315. }
  20316. } );
  20317. jQuery.fn.extend( {
  20318. data: function( key, value ) {
  20319. var i, name, data,
  20320. elem = this[ 0 ],
  20321. attrs = elem && elem.attributes;
  20322. // Gets all values
  20323. if ( key === undefined ) {
  20324. if ( this.length ) {
  20325. data = dataUser.get( elem );
  20326. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  20327. i = attrs.length;
  20328. while ( i-- ) {
  20329. // Support: IE 11 only
  20330. // The attrs elements can be null (#14894)
  20331. if ( attrs[ i ] ) {
  20332. name = attrs[ i ].name;
  20333. if ( name.indexOf( "data-" ) === 0 ) {
  20334. name = jQuery.camelCase( name.slice( 5 ) );
  20335. dataAttr( elem, name, data[ name ] );
  20336. }
  20337. }
  20338. }
  20339. dataPriv.set( elem, "hasDataAttrs", true );
  20340. }
  20341. }
  20342. return data;
  20343. }
  20344. // Sets multiple values
  20345. if ( typeof key === "object" ) {
  20346. return this.each( function() {
  20347. dataUser.set( this, key );
  20348. } );
  20349. }
  20350. return access( this, function( value ) {
  20351. var data;
  20352. // The calling jQuery object (element matches) is not empty
  20353. // (and therefore has an element appears at this[ 0 ]) and the
  20354. // `value` parameter was not undefined. An empty jQuery object
  20355. // will result in `undefined` for elem = this[ 0 ] which will
  20356. // throw an exception if an attempt to read a data cache is made.
  20357. if ( elem && value === undefined ) {
  20358. // Attempt to get data from the cache
  20359. // The key will always be camelCased in Data
  20360. data = dataUser.get( elem, key );
  20361. if ( data !== undefined ) {
  20362. return data;
  20363. }
  20364. // Attempt to "discover" the data in
  20365. // HTML5 custom data-* attrs
  20366. data = dataAttr( elem, key );
  20367. if ( data !== undefined ) {
  20368. return data;
  20369. }
  20370. // We tried really hard, but the data doesn't exist.
  20371. return;
  20372. }
  20373. // Set the data...
  20374. this.each( function() {
  20375. // We always store the camelCased key
  20376. dataUser.set( this, key, value );
  20377. } );
  20378. }, null, value, arguments.length > 1, null, true );
  20379. },
  20380. removeData: function( key ) {
  20381. return this.each( function() {
  20382. dataUser.remove( this, key );
  20383. } );
  20384. }
  20385. } );
  20386. jQuery.extend( {
  20387. queue: function( elem, type, data ) {
  20388. var queue;
  20389. if ( elem ) {
  20390. type = ( type || "fx" ) + "queue";
  20391. queue = dataPriv.get( elem, type );
  20392. // Speed up dequeue by getting out quickly if this is just a lookup
  20393. if ( data ) {
  20394. if ( !queue || Array.isArray( data ) ) {
  20395. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  20396. } else {
  20397. queue.push( data );
  20398. }
  20399. }
  20400. return queue || [];
  20401. }
  20402. },
  20403. dequeue: function( elem, type ) {
  20404. type = type || "fx";
  20405. var queue = jQuery.queue( elem, type ),
  20406. startLength = queue.length,
  20407. fn = queue.shift(),
  20408. hooks = jQuery._queueHooks( elem, type ),
  20409. next = function() {
  20410. jQuery.dequeue( elem, type );
  20411. };
  20412. // If the fx queue is dequeued, always remove the progress sentinel
  20413. if ( fn === "inprogress" ) {
  20414. fn = queue.shift();
  20415. startLength--;
  20416. }
  20417. if ( fn ) {
  20418. // Add a progress sentinel to prevent the fx queue from being
  20419. // automatically dequeued
  20420. if ( type === "fx" ) {
  20421. queue.unshift( "inprogress" );
  20422. }
  20423. // Clear up the last queue stop function
  20424. delete hooks.stop;
  20425. fn.call( elem, next, hooks );
  20426. }
  20427. if ( !startLength && hooks ) {
  20428. hooks.empty.fire();
  20429. }
  20430. },
  20431. // Not public - generate a queueHooks object, or return the current one
  20432. _queueHooks: function( elem, type ) {
  20433. var key = type + "queueHooks";
  20434. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  20435. empty: jQuery.Callbacks( "once memory" ).add( function() {
  20436. dataPriv.remove( elem, [ type + "queue", key ] );
  20437. } )
  20438. } );
  20439. }
  20440. } );
  20441. jQuery.fn.extend( {
  20442. queue: function( type, data ) {
  20443. var setter = 2;
  20444. if ( typeof type !== "string" ) {
  20445. data = type;
  20446. type = "fx";
  20447. setter--;
  20448. }
  20449. if ( arguments.length < setter ) {
  20450. return jQuery.queue( this[ 0 ], type );
  20451. }
  20452. return data === undefined ?
  20453. this :
  20454. this.each( function() {
  20455. var queue = jQuery.queue( this, type, data );
  20456. // Ensure a hooks for this queue
  20457. jQuery._queueHooks( this, type );
  20458. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  20459. jQuery.dequeue( this, type );
  20460. }
  20461. } );
  20462. },
  20463. dequeue: function( type ) {
  20464. return this.each( function() {
  20465. jQuery.dequeue( this, type );
  20466. } );
  20467. },
  20468. clearQueue: function( type ) {
  20469. return this.queue( type || "fx", [] );
  20470. },
  20471. // Get a promise resolved when queues of a certain type
  20472. // are emptied (fx is the type by default)
  20473. promise: function( type, obj ) {
  20474. var tmp,
  20475. count = 1,
  20476. defer = jQuery.Deferred(),
  20477. elements = this,
  20478. i = this.length,
  20479. resolve = function() {
  20480. if ( !( --count ) ) {
  20481. defer.resolveWith( elements, [ elements ] );
  20482. }
  20483. };
  20484. if ( typeof type !== "string" ) {
  20485. obj = type;
  20486. type = undefined;
  20487. }
  20488. type = type || "fx";
  20489. while ( i-- ) {
  20490. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  20491. if ( tmp && tmp.empty ) {
  20492. count++;
  20493. tmp.empty.add( resolve );
  20494. }
  20495. }
  20496. resolve();
  20497. return defer.promise( obj );
  20498. }
  20499. } );
  20500. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  20501. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  20502. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  20503. var isHiddenWithinTree = function( elem, el ) {
  20504. // isHiddenWithinTree might be called from jQuery#filter function;
  20505. // in that case, element will be second argument
  20506. elem = el || elem;
  20507. // Inline style trumps all
  20508. return elem.style.display === "none" ||
  20509. elem.style.display === "" &&
  20510. // Otherwise, check computed style
  20511. // Support: Firefox <=43 - 45
  20512. // Disconnected elements can have computed display: none, so first confirm that elem is
  20513. // in the document.
  20514. jQuery.contains( elem.ownerDocument, elem ) &&
  20515. jQuery.css( elem, "display" ) === "none";
  20516. };
  20517. var swap = function( elem, options, callback, args ) {
  20518. var ret, name,
  20519. old = {};
  20520. // Remember the old values, and insert the new ones
  20521. for ( name in options ) {
  20522. old[ name ] = elem.style[ name ];
  20523. elem.style[ name ] = options[ name ];
  20524. }
  20525. ret = callback.apply( elem, args || [] );
  20526. // Revert the old values
  20527. for ( name in options ) {
  20528. elem.style[ name ] = old[ name ];
  20529. }
  20530. return ret;
  20531. };
  20532. function adjustCSS( elem, prop, valueParts, tween ) {
  20533. var adjusted,
  20534. scale = 1,
  20535. maxIterations = 20,
  20536. currentValue = tween ?
  20537. function() {
  20538. return tween.cur();
  20539. } :
  20540. function() {
  20541. return jQuery.css( elem, prop, "" );
  20542. },
  20543. initial = currentValue(),
  20544. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  20545. // Starting value computation is required for potential unit mismatches
  20546. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  20547. rcssNum.exec( jQuery.css( elem, prop ) );
  20548. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  20549. // Trust units reported by jQuery.css
  20550. unit = unit || initialInUnit[ 3 ];
  20551. // Make sure we update the tween properties later on
  20552. valueParts = valueParts || [];
  20553. // Iteratively approximate from a nonzero starting point
  20554. initialInUnit = +initial || 1;
  20555. do {
  20556. // If previous iteration zeroed out, double until we get *something*.
  20557. // Use string for doubling so we don't accidentally see scale as unchanged below
  20558. scale = scale || ".5";
  20559. // Adjust and apply
  20560. initialInUnit = initialInUnit / scale;
  20561. jQuery.style( elem, prop, initialInUnit + unit );
  20562. // Update scale, tolerating zero or NaN from tween.cur()
  20563. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  20564. } while (
  20565. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  20566. );
  20567. }
  20568. if ( valueParts ) {
  20569. initialInUnit = +initialInUnit || +initial || 0;
  20570. // Apply relative offset (+=/-=) if specified
  20571. adjusted = valueParts[ 1 ] ?
  20572. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  20573. +valueParts[ 2 ];
  20574. if ( tween ) {
  20575. tween.unit = unit;
  20576. tween.start = initialInUnit;
  20577. tween.end = adjusted;
  20578. }
  20579. }
  20580. return adjusted;
  20581. }
  20582. var defaultDisplayMap = {};
  20583. function getDefaultDisplay( elem ) {
  20584. var temp,
  20585. doc = elem.ownerDocument,
  20586. nodeName = elem.nodeName,
  20587. display = defaultDisplayMap[ nodeName ];
  20588. if ( display ) {
  20589. return display;
  20590. }
  20591. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  20592. display = jQuery.css( temp, "display" );
  20593. temp.parentNode.removeChild( temp );
  20594. if ( display === "none" ) {
  20595. display = "block";
  20596. }
  20597. defaultDisplayMap[ nodeName ] = display;
  20598. return display;
  20599. }
  20600. function showHide( elements, show ) {
  20601. var display, elem,
  20602. values = [],
  20603. index = 0,
  20604. length = elements.length;
  20605. // Determine new display value for elements that need to change
  20606. for ( ; index < length; index++ ) {
  20607. elem = elements[ index ];
  20608. if ( !elem.style ) {
  20609. continue;
  20610. }
  20611. display = elem.style.display;
  20612. if ( show ) {
  20613. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  20614. // check is required in this first loop unless we have a nonempty display value (either
  20615. // inline or about-to-be-restored)
  20616. if ( display === "none" ) {
  20617. values[ index ] = dataPriv.get( elem, "display" ) || null;
  20618. if ( !values[ index ] ) {
  20619. elem.style.display = "";
  20620. }
  20621. }
  20622. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  20623. values[ index ] = getDefaultDisplay( elem );
  20624. }
  20625. } else {
  20626. if ( display !== "none" ) {
  20627. values[ index ] = "none";
  20628. // Remember what we're overwriting
  20629. dataPriv.set( elem, "display", display );
  20630. }
  20631. }
  20632. }
  20633. // Set the display of the elements in a second loop to avoid constant reflow
  20634. for ( index = 0; index < length; index++ ) {
  20635. if ( values[ index ] != null ) {
  20636. elements[ index ].style.display = values[ index ];
  20637. }
  20638. }
  20639. return elements;
  20640. }
  20641. jQuery.fn.extend( {
  20642. show: function() {
  20643. return showHide( this, true );
  20644. },
  20645. hide: function() {
  20646. return showHide( this );
  20647. },
  20648. toggle: function( state ) {
  20649. if ( typeof state === "boolean" ) {
  20650. return state ? this.show() : this.hide();
  20651. }
  20652. return this.each( function() {
  20653. if ( isHiddenWithinTree( this ) ) {
  20654. jQuery( this ).show();
  20655. } else {
  20656. jQuery( this ).hide();
  20657. }
  20658. } );
  20659. }
  20660. } );
  20661. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  20662. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  20663. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  20664. // We have to close these tags to support XHTML (#13200)
  20665. var wrapMap = {
  20666. // Support: IE <=9 only
  20667. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  20668. // XHTML parsers do not magically insert elements in the
  20669. // same way that tag soup parsers do. So we cannot shorten
  20670. // this by omitting <tbody> or other required elements.
  20671. thead: [ 1, "<table>", "</table>" ],
  20672. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  20673. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  20674. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  20675. _default: [ 0, "", "" ]
  20676. };
  20677. // Support: IE <=9 only
  20678. wrapMap.optgroup = wrapMap.option;
  20679. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  20680. wrapMap.th = wrapMap.td;
  20681. function getAll( context, tag ) {
  20682. // Support: IE <=9 - 11 only
  20683. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  20684. var ret;
  20685. if ( typeof context.getElementsByTagName !== "undefined" ) {
  20686. ret = context.getElementsByTagName( tag || "*" );
  20687. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  20688. ret = context.querySelectorAll( tag || "*" );
  20689. } else {
  20690. ret = [];
  20691. }
  20692. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  20693. return jQuery.merge( [ context ], ret );
  20694. }
  20695. return ret;
  20696. }
  20697. // Mark scripts as having already been evaluated
  20698. function setGlobalEval( elems, refElements ) {
  20699. var i = 0,
  20700. l = elems.length;
  20701. for ( ; i < l; i++ ) {
  20702. dataPriv.set(
  20703. elems[ i ],
  20704. "globalEval",
  20705. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  20706. );
  20707. }
  20708. }
  20709. var rhtml = /<|&#?\w+;/;
  20710. function buildFragment( elems, context, scripts, selection, ignored ) {
  20711. var elem, tmp, tag, wrap, contains, j,
  20712. fragment = context.createDocumentFragment(),
  20713. nodes = [],
  20714. i = 0,
  20715. l = elems.length;
  20716. for ( ; i < l; i++ ) {
  20717. elem = elems[ i ];
  20718. if ( elem || elem === 0 ) {
  20719. // Add nodes directly
  20720. if ( jQuery.type( elem ) === "object" ) {
  20721. // Support: Android <=4.0 only, PhantomJS 1 only
  20722. // push.apply(_, arraylike) throws on ancient WebKit
  20723. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  20724. // Convert non-html into a text node
  20725. } else if ( !rhtml.test( elem ) ) {
  20726. nodes.push( context.createTextNode( elem ) );
  20727. // Convert html into DOM nodes
  20728. } else {
  20729. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  20730. // Deserialize a standard representation
  20731. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  20732. wrap = wrapMap[ tag ] || wrapMap._default;
  20733. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  20734. // Descend through wrappers to the right content
  20735. j = wrap[ 0 ];
  20736. while ( j-- ) {
  20737. tmp = tmp.lastChild;
  20738. }
  20739. // Support: Android <=4.0 only, PhantomJS 1 only
  20740. // push.apply(_, arraylike) throws on ancient WebKit
  20741. jQuery.merge( nodes, tmp.childNodes );
  20742. // Remember the top-level container
  20743. tmp = fragment.firstChild;
  20744. // Ensure the created nodes are orphaned (#12392)
  20745. tmp.textContent = "";
  20746. }
  20747. }
  20748. }
  20749. // Remove wrapper from fragment
  20750. fragment.textContent = "";
  20751. i = 0;
  20752. while ( ( elem = nodes[ i++ ] ) ) {
  20753. // Skip elements already in the context collection (trac-4087)
  20754. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  20755. if ( ignored ) {
  20756. ignored.push( elem );
  20757. }
  20758. continue;
  20759. }
  20760. contains = jQuery.contains( elem.ownerDocument, elem );
  20761. // Append to fragment
  20762. tmp = getAll( fragment.appendChild( elem ), "script" );
  20763. // Preserve script evaluation history
  20764. if ( contains ) {
  20765. setGlobalEval( tmp );
  20766. }
  20767. // Capture executables
  20768. if ( scripts ) {
  20769. j = 0;
  20770. while ( ( elem = tmp[ j++ ] ) ) {
  20771. if ( rscriptType.test( elem.type || "" ) ) {
  20772. scripts.push( elem );
  20773. }
  20774. }
  20775. }
  20776. }
  20777. return fragment;
  20778. }
  20779. ( function() {
  20780. var fragment = document.createDocumentFragment(),
  20781. div = fragment.appendChild( document.createElement( "div" ) ),
  20782. input = document.createElement( "input" );
  20783. // Support: Android 4.0 - 4.3 only
  20784. // Check state lost if the name is set (#11217)
  20785. // Support: Windows Web Apps (WWA)
  20786. // `name` and `type` must use .setAttribute for WWA (#14901)
  20787. input.setAttribute( "type", "radio" );
  20788. input.setAttribute( "checked", "checked" );
  20789. input.setAttribute( "name", "t" );
  20790. div.appendChild( input );
  20791. // Support: Android <=4.1 only
  20792. // Older WebKit doesn't clone checked state correctly in fragments
  20793. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  20794. // Support: IE <=11 only
  20795. // Make sure textarea (and checkbox) defaultValue is properly cloned
  20796. div.innerHTML = "<textarea>x</textarea>";
  20797. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  20798. } )();
  20799. var documentElement = document.documentElement;
  20800. var
  20801. rkeyEvent = /^key/,
  20802. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  20803. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  20804. function returnTrue() {
  20805. return true;
  20806. }
  20807. function returnFalse() {
  20808. return false;
  20809. }
  20810. // Support: IE <=9 only
  20811. // See #13393 for more info
  20812. function safeActiveElement() {
  20813. try {
  20814. return document.activeElement;
  20815. } catch ( err ) { }
  20816. }
  20817. function on( elem, types, selector, data, fn, one ) {
  20818. var origFn, type;
  20819. // Types can be a map of types/handlers
  20820. if ( typeof types === "object" ) {
  20821. // ( types-Object, selector, data )
  20822. if ( typeof selector !== "string" ) {
  20823. // ( types-Object, data )
  20824. data = data || selector;
  20825. selector = undefined;
  20826. }
  20827. for ( type in types ) {
  20828. on( elem, type, selector, data, types[ type ], one );
  20829. }
  20830. return elem;
  20831. }
  20832. if ( data == null && fn == null ) {
  20833. // ( types, fn )
  20834. fn = selector;
  20835. data = selector = undefined;
  20836. } else if ( fn == null ) {
  20837. if ( typeof selector === "string" ) {
  20838. // ( types, selector, fn )
  20839. fn = data;
  20840. data = undefined;
  20841. } else {
  20842. // ( types, data, fn )
  20843. fn = data;
  20844. data = selector;
  20845. selector = undefined;
  20846. }
  20847. }
  20848. if ( fn === false ) {
  20849. fn = returnFalse;
  20850. } else if ( !fn ) {
  20851. return elem;
  20852. }
  20853. if ( one === 1 ) {
  20854. origFn = fn;
  20855. fn = function( event ) {
  20856. // Can use an empty set, since event contains the info
  20857. jQuery().off( event );
  20858. return origFn.apply( this, arguments );
  20859. };
  20860. // Use same guid so caller can remove using origFn
  20861. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  20862. }
  20863. return elem.each( function() {
  20864. jQuery.event.add( this, types, fn, data, selector );
  20865. } );
  20866. }
  20867. /*
  20868. * Helper functions for managing events -- not part of the public interface.
  20869. * Props to Dean Edwards' addEvent library for many of the ideas.
  20870. */
  20871. jQuery.event = {
  20872. global: {},
  20873. add: function( elem, types, handler, data, selector ) {
  20874. var handleObjIn, eventHandle, tmp,
  20875. events, t, handleObj,
  20876. special, handlers, type, namespaces, origType,
  20877. elemData = dataPriv.get( elem );
  20878. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  20879. if ( !elemData ) {
  20880. return;
  20881. }
  20882. // Caller can pass in an object of custom data in lieu of the handler
  20883. if ( handler.handler ) {
  20884. handleObjIn = handler;
  20885. handler = handleObjIn.handler;
  20886. selector = handleObjIn.selector;
  20887. }
  20888. // Ensure that invalid selectors throw exceptions at attach time
  20889. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  20890. if ( selector ) {
  20891. jQuery.find.matchesSelector( documentElement, selector );
  20892. }
  20893. // Make sure that the handler has a unique ID, used to find/remove it later
  20894. if ( !handler.guid ) {
  20895. handler.guid = jQuery.guid++;
  20896. }
  20897. // Init the element's event structure and main handler, if this is the first
  20898. if ( !( events = elemData.events ) ) {
  20899. events = elemData.events = {};
  20900. }
  20901. if ( !( eventHandle = elemData.handle ) ) {
  20902. eventHandle = elemData.handle = function( e ) {
  20903. // Discard the second event of a jQuery.event.trigger() and
  20904. // when an event is called after a page has unloaded
  20905. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  20906. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  20907. };
  20908. }
  20909. // Handle multiple events separated by a space
  20910. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  20911. t = types.length;
  20912. while ( t-- ) {
  20913. tmp = rtypenamespace.exec( types[ t ] ) || [];
  20914. type = origType = tmp[ 1 ];
  20915. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  20916. // There *must* be a type, no attaching namespace-only handlers
  20917. if ( !type ) {
  20918. continue;
  20919. }
  20920. // If event changes its type, use the special event handlers for the changed type
  20921. special = jQuery.event.special[ type ] || {};
  20922. // If selector defined, determine special event api type, otherwise given type
  20923. type = ( selector ? special.delegateType : special.bindType ) || type;
  20924. // Update special based on newly reset type
  20925. special = jQuery.event.special[ type ] || {};
  20926. // handleObj is passed to all event handlers
  20927. handleObj = jQuery.extend( {
  20928. type: type,
  20929. origType: origType,
  20930. data: data,
  20931. handler: handler,
  20932. guid: handler.guid,
  20933. selector: selector,
  20934. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  20935. namespace: namespaces.join( "." )
  20936. }, handleObjIn );
  20937. // Init the event handler queue if we're the first
  20938. if ( !( handlers = events[ type ] ) ) {
  20939. handlers = events[ type ] = [];
  20940. handlers.delegateCount = 0;
  20941. // Only use addEventListener if the special events handler returns false
  20942. if ( !special.setup ||
  20943. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  20944. if ( elem.addEventListener ) {
  20945. elem.addEventListener( type, eventHandle );
  20946. }
  20947. }
  20948. }
  20949. if ( special.add ) {
  20950. special.add.call( elem, handleObj );
  20951. if ( !handleObj.handler.guid ) {
  20952. handleObj.handler.guid = handler.guid;
  20953. }
  20954. }
  20955. // Add to the element's handler list, delegates in front
  20956. if ( selector ) {
  20957. handlers.splice( handlers.delegateCount++, 0, handleObj );
  20958. } else {
  20959. handlers.push( handleObj );
  20960. }
  20961. // Keep track of which events have ever been used, for event optimization
  20962. jQuery.event.global[ type ] = true;
  20963. }
  20964. },
  20965. // Detach an event or set of events from an element
  20966. remove: function( elem, types, handler, selector, mappedTypes ) {
  20967. var j, origCount, tmp,
  20968. events, t, handleObj,
  20969. special, handlers, type, namespaces, origType,
  20970. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  20971. if ( !elemData || !( events = elemData.events ) ) {
  20972. return;
  20973. }
  20974. // Once for each type.namespace in types; type may be omitted
  20975. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  20976. t = types.length;
  20977. while ( t-- ) {
  20978. tmp = rtypenamespace.exec( types[ t ] ) || [];
  20979. type = origType = tmp[ 1 ];
  20980. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  20981. // Unbind all events (on this namespace, if provided) for the element
  20982. if ( !type ) {
  20983. for ( type in events ) {
  20984. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  20985. }
  20986. continue;
  20987. }
  20988. special = jQuery.event.special[ type ] || {};
  20989. type = ( selector ? special.delegateType : special.bindType ) || type;
  20990. handlers = events[ type ] || [];
  20991. tmp = tmp[ 2 ] &&
  20992. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  20993. // Remove matching events
  20994. origCount = j = handlers.length;
  20995. while ( j-- ) {
  20996. handleObj = handlers[ j ];
  20997. if ( ( mappedTypes || origType === handleObj.origType ) &&
  20998. ( !handler || handler.guid === handleObj.guid ) &&
  20999. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  21000. ( !selector || selector === handleObj.selector ||
  21001. selector === "**" && handleObj.selector ) ) {
  21002. handlers.splice( j, 1 );
  21003. if ( handleObj.selector ) {
  21004. handlers.delegateCount--;
  21005. }
  21006. if ( special.remove ) {
  21007. special.remove.call( elem, handleObj );
  21008. }
  21009. }
  21010. }
  21011. // Remove generic event handler if we removed something and no more handlers exist
  21012. // (avoids potential for endless recursion during removal of special event handlers)
  21013. if ( origCount && !handlers.length ) {
  21014. if ( !special.teardown ||
  21015. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  21016. jQuery.removeEvent( elem, type, elemData.handle );
  21017. }
  21018. delete events[ type ];
  21019. }
  21020. }
  21021. // Remove data and the expando if it's no longer used
  21022. if ( jQuery.isEmptyObject( events ) ) {
  21023. dataPriv.remove( elem, "handle events" );
  21024. }
  21025. },
  21026. dispatch: function( nativeEvent ) {
  21027. // Make a writable jQuery.Event from the native event object
  21028. var event = jQuery.event.fix( nativeEvent );
  21029. var i, j, ret, matched, handleObj, handlerQueue,
  21030. args = new Array( arguments.length ),
  21031. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  21032. special = jQuery.event.special[ event.type ] || {};
  21033. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  21034. args[ 0 ] = event;
  21035. for ( i = 1; i < arguments.length; i++ ) {
  21036. args[ i ] = arguments[ i ];
  21037. }
  21038. event.delegateTarget = this;
  21039. // Call the preDispatch hook for the mapped type, and let it bail if desired
  21040. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  21041. return;
  21042. }
  21043. // Determine handlers
  21044. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  21045. // Run delegates first; they may want to stop propagation beneath us
  21046. i = 0;
  21047. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  21048. event.currentTarget = matched.elem;
  21049. j = 0;
  21050. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  21051. !event.isImmediatePropagationStopped() ) {
  21052. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  21053. // a subset or equal to those in the bound event (both can have no namespace).
  21054. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  21055. event.handleObj = handleObj;
  21056. event.data = handleObj.data;
  21057. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  21058. handleObj.handler ).apply( matched.elem, args );
  21059. if ( ret !== undefined ) {
  21060. if ( ( event.result = ret ) === false ) {
  21061. event.preventDefault();
  21062. event.stopPropagation();
  21063. }
  21064. }
  21065. }
  21066. }
  21067. }
  21068. // Call the postDispatch hook for the mapped type
  21069. if ( special.postDispatch ) {
  21070. special.postDispatch.call( this, event );
  21071. }
  21072. return event.result;
  21073. },
  21074. handlers: function( event, handlers ) {
  21075. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  21076. handlerQueue = [],
  21077. delegateCount = handlers.delegateCount,
  21078. cur = event.target;
  21079. // Find delegate handlers
  21080. if ( delegateCount &&
  21081. // Support: IE <=9
  21082. // Black-hole SVG <use> instance trees (trac-13180)
  21083. cur.nodeType &&
  21084. // Support: Firefox <=42
  21085. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  21086. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  21087. // Support: IE 11 only
  21088. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  21089. !( event.type === "click" && event.button >= 1 ) ) {
  21090. for ( ; cur !== this; cur = cur.parentNode || this ) {
  21091. // Don't check non-elements (#13208)
  21092. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  21093. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  21094. matchedHandlers = [];
  21095. matchedSelectors = {};
  21096. for ( i = 0; i < delegateCount; i++ ) {
  21097. handleObj = handlers[ i ];
  21098. // Don't conflict with Object.prototype properties (#13203)
  21099. sel = handleObj.selector + " ";
  21100. if ( matchedSelectors[ sel ] === undefined ) {
  21101. matchedSelectors[ sel ] = handleObj.needsContext ?
  21102. jQuery( sel, this ).index( cur ) > -1 :
  21103. jQuery.find( sel, this, null, [ cur ] ).length;
  21104. }
  21105. if ( matchedSelectors[ sel ] ) {
  21106. matchedHandlers.push( handleObj );
  21107. }
  21108. }
  21109. if ( matchedHandlers.length ) {
  21110. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  21111. }
  21112. }
  21113. }
  21114. }
  21115. // Add the remaining (directly-bound) handlers
  21116. cur = this;
  21117. if ( delegateCount < handlers.length ) {
  21118. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  21119. }
  21120. return handlerQueue;
  21121. },
  21122. addProp: function( name, hook ) {
  21123. Object.defineProperty( jQuery.Event.prototype, name, {
  21124. enumerable: true,
  21125. configurable: true,
  21126. get: jQuery.isFunction( hook ) ?
  21127. function() {
  21128. if ( this.originalEvent ) {
  21129. return hook( this.originalEvent );
  21130. }
  21131. } :
  21132. function() {
  21133. if ( this.originalEvent ) {
  21134. return this.originalEvent[ name ];
  21135. }
  21136. },
  21137. set: function( value ) {
  21138. Object.defineProperty( this, name, {
  21139. enumerable: true,
  21140. configurable: true,
  21141. writable: true,
  21142. value: value
  21143. } );
  21144. }
  21145. } );
  21146. },
  21147. fix: function( originalEvent ) {
  21148. return originalEvent[ jQuery.expando ] ?
  21149. originalEvent :
  21150. new jQuery.Event( originalEvent );
  21151. },
  21152. special: {
  21153. load: {
  21154. // Prevent triggered image.load events from bubbling to window.load
  21155. noBubble: true
  21156. },
  21157. focus: {
  21158. // Fire native event if possible so blur/focus sequence is correct
  21159. trigger: function() {
  21160. if ( this !== safeActiveElement() && this.focus ) {
  21161. this.focus();
  21162. return false;
  21163. }
  21164. },
  21165. delegateType: "focusin"
  21166. },
  21167. blur: {
  21168. trigger: function() {
  21169. if ( this === safeActiveElement() && this.blur ) {
  21170. this.blur();
  21171. return false;
  21172. }
  21173. },
  21174. delegateType: "focusout"
  21175. },
  21176. click: {
  21177. // For checkbox, fire native event so checked state will be right
  21178. trigger: function() {
  21179. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  21180. this.click();
  21181. return false;
  21182. }
  21183. },
  21184. // For cross-browser consistency, don't fire native .click() on links
  21185. _default: function( event ) {
  21186. return nodeName( event.target, "a" );
  21187. }
  21188. },
  21189. beforeunload: {
  21190. postDispatch: function( event ) {
  21191. // Support: Firefox 20+
  21192. // Firefox doesn't alert if the returnValue field is not set.
  21193. if ( event.result !== undefined && event.originalEvent ) {
  21194. event.originalEvent.returnValue = event.result;
  21195. }
  21196. }
  21197. }
  21198. }
  21199. };
  21200. jQuery.removeEvent = function( elem, type, handle ) {
  21201. // This "if" is needed for plain objects
  21202. if ( elem.removeEventListener ) {
  21203. elem.removeEventListener( type, handle );
  21204. }
  21205. };
  21206. jQuery.Event = function( src, props ) {
  21207. // Allow instantiation without the 'new' keyword
  21208. if ( !( this instanceof jQuery.Event ) ) {
  21209. return new jQuery.Event( src, props );
  21210. }
  21211. // Event object
  21212. if ( src && src.type ) {
  21213. this.originalEvent = src;
  21214. this.type = src.type;
  21215. // Events bubbling up the document may have been marked as prevented
  21216. // by a handler lower down the tree; reflect the correct value.
  21217. this.isDefaultPrevented = src.defaultPrevented ||
  21218. src.defaultPrevented === undefined &&
  21219. // Support: Android <=2.3 only
  21220. src.returnValue === false ?
  21221. returnTrue :
  21222. returnFalse;
  21223. // Create target properties
  21224. // Support: Safari <=6 - 7 only
  21225. // Target should not be a text node (#504, #13143)
  21226. this.target = ( src.target && src.target.nodeType === 3 ) ?
  21227. src.target.parentNode :
  21228. src.target;
  21229. this.currentTarget = src.currentTarget;
  21230. this.relatedTarget = src.relatedTarget;
  21231. // Event type
  21232. } else {
  21233. this.type = src;
  21234. }
  21235. // Put explicitly provided properties onto the event object
  21236. if ( props ) {
  21237. jQuery.extend( this, props );
  21238. }
  21239. // Create a timestamp if incoming event doesn't have one
  21240. this.timeStamp = src && src.timeStamp || jQuery.now();
  21241. // Mark it as fixed
  21242. this[ jQuery.expando ] = true;
  21243. };
  21244. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  21245. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  21246. jQuery.Event.prototype = {
  21247. constructor: jQuery.Event,
  21248. isDefaultPrevented: returnFalse,
  21249. isPropagationStopped: returnFalse,
  21250. isImmediatePropagationStopped: returnFalse,
  21251. isSimulated: false,
  21252. preventDefault: function() {
  21253. var e = this.originalEvent;
  21254. this.isDefaultPrevented = returnTrue;
  21255. if ( e && !this.isSimulated ) {
  21256. e.preventDefault();
  21257. }
  21258. },
  21259. stopPropagation: function() {
  21260. var e = this.originalEvent;
  21261. this.isPropagationStopped = returnTrue;
  21262. if ( e && !this.isSimulated ) {
  21263. e.stopPropagation();
  21264. }
  21265. },
  21266. stopImmediatePropagation: function() {
  21267. var e = this.originalEvent;
  21268. this.isImmediatePropagationStopped = returnTrue;
  21269. if ( e && !this.isSimulated ) {
  21270. e.stopImmediatePropagation();
  21271. }
  21272. this.stopPropagation();
  21273. }
  21274. };
  21275. // Includes all common event props including KeyEvent and MouseEvent specific props
  21276. jQuery.each( {
  21277. altKey: true,
  21278. bubbles: true,
  21279. cancelable: true,
  21280. changedTouches: true,
  21281. ctrlKey: true,
  21282. detail: true,
  21283. eventPhase: true,
  21284. metaKey: true,
  21285. pageX: true,
  21286. pageY: true,
  21287. shiftKey: true,
  21288. view: true,
  21289. "char": true,
  21290. charCode: true,
  21291. key: true,
  21292. keyCode: true,
  21293. button: true,
  21294. buttons: true,
  21295. clientX: true,
  21296. clientY: true,
  21297. offsetX: true,
  21298. offsetY: true,
  21299. pointerId: true,
  21300. pointerType: true,
  21301. screenX: true,
  21302. screenY: true,
  21303. targetTouches: true,
  21304. toElement: true,
  21305. touches: true,
  21306. which: function( event ) {
  21307. var button = event.button;
  21308. // Add which for key events
  21309. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  21310. return event.charCode != null ? event.charCode : event.keyCode;
  21311. }
  21312. // Add which for click: 1 === left; 2 === middle; 3 === right
  21313. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  21314. if ( button & 1 ) {
  21315. return 1;
  21316. }
  21317. if ( button & 2 ) {
  21318. return 3;
  21319. }
  21320. if ( button & 4 ) {
  21321. return 2;
  21322. }
  21323. return 0;
  21324. }
  21325. return event.which;
  21326. }
  21327. }, jQuery.event.addProp );
  21328. // Create mouseenter/leave events using mouseover/out and event-time checks
  21329. // so that event delegation works in jQuery.
  21330. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  21331. //
  21332. // Support: Safari 7 only
  21333. // Safari sends mouseenter too often; see:
  21334. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  21335. // for the description of the bug (it existed in older Chrome versions as well).
  21336. jQuery.each( {
  21337. mouseenter: "mouseover",
  21338. mouseleave: "mouseout",
  21339. pointerenter: "pointerover",
  21340. pointerleave: "pointerout"
  21341. }, function( orig, fix ) {
  21342. jQuery.event.special[ orig ] = {
  21343. delegateType: fix,
  21344. bindType: fix,
  21345. handle: function( event ) {
  21346. var ret,
  21347. target = this,
  21348. related = event.relatedTarget,
  21349. handleObj = event.handleObj;
  21350. // For mouseenter/leave call the handler if related is outside the target.
  21351. // NB: No relatedTarget if the mouse left/entered the browser window
  21352. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  21353. event.type = handleObj.origType;
  21354. ret = handleObj.handler.apply( this, arguments );
  21355. event.type = fix;
  21356. }
  21357. return ret;
  21358. }
  21359. };
  21360. } );
  21361. jQuery.fn.extend( {
  21362. on: function( types, selector, data, fn ) {
  21363. return on( this, types, selector, data, fn );
  21364. },
  21365. one: function( types, selector, data, fn ) {
  21366. return on( this, types, selector, data, fn, 1 );
  21367. },
  21368. off: function( types, selector, fn ) {
  21369. var handleObj, type;
  21370. if ( types && types.preventDefault && types.handleObj ) {
  21371. // ( event ) dispatched jQuery.Event
  21372. handleObj = types.handleObj;
  21373. jQuery( types.delegateTarget ).off(
  21374. handleObj.namespace ?
  21375. handleObj.origType + "." + handleObj.namespace :
  21376. handleObj.origType,
  21377. handleObj.selector,
  21378. handleObj.handler
  21379. );
  21380. return this;
  21381. }
  21382. if ( typeof types === "object" ) {
  21383. // ( types-object [, selector] )
  21384. for ( type in types ) {
  21385. this.off( type, selector, types[ type ] );
  21386. }
  21387. return this;
  21388. }
  21389. if ( selector === false || typeof selector === "function" ) {
  21390. // ( types [, fn] )
  21391. fn = selector;
  21392. selector = undefined;
  21393. }
  21394. if ( fn === false ) {
  21395. fn = returnFalse;
  21396. }
  21397. return this.each( function() {
  21398. jQuery.event.remove( this, types, fn, selector );
  21399. } );
  21400. }
  21401. } );
  21402. var
  21403. /* eslint-disable max-len */
  21404. // See https://github.com/eslint/eslint/issues/3229
  21405. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  21406. /* eslint-enable */
  21407. // Support: IE <=10 - 11, Edge 12 - 13
  21408. // In IE/Edge using regex groups here causes severe slowdowns.
  21409. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  21410. rnoInnerhtml = /<script|<style|<link/i,
  21411. // checked="checked" or checked
  21412. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  21413. rscriptTypeMasked = /^true\/(.*)/,
  21414. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  21415. // Prefer a tbody over its parent table for containing new rows
  21416. function manipulationTarget( elem, content ) {
  21417. if ( nodeName( elem, "table" ) &&
  21418. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  21419. return jQuery( ">tbody", elem )[ 0 ] || elem;
  21420. }
  21421. return elem;
  21422. }
  21423. // Replace/restore the type attribute of script elements for safe DOM manipulation
  21424. function disableScript( elem ) {
  21425. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  21426. return elem;
  21427. }
  21428. function restoreScript( elem ) {
  21429. var match = rscriptTypeMasked.exec( elem.type );
  21430. if ( match ) {
  21431. elem.type = match[ 1 ];
  21432. } else {
  21433. elem.removeAttribute( "type" );
  21434. }
  21435. return elem;
  21436. }
  21437. function cloneCopyEvent( src, dest ) {
  21438. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  21439. if ( dest.nodeType !== 1 ) {
  21440. return;
  21441. }
  21442. // 1. Copy private data: events, handlers, etc.
  21443. if ( dataPriv.hasData( src ) ) {
  21444. pdataOld = dataPriv.access( src );
  21445. pdataCur = dataPriv.set( dest, pdataOld );
  21446. events = pdataOld.events;
  21447. if ( events ) {
  21448. delete pdataCur.handle;
  21449. pdataCur.events = {};
  21450. for ( type in events ) {
  21451. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  21452. jQuery.event.add( dest, type, events[ type ][ i ] );
  21453. }
  21454. }
  21455. }
  21456. }
  21457. // 2. Copy user data
  21458. if ( dataUser.hasData( src ) ) {
  21459. udataOld = dataUser.access( src );
  21460. udataCur = jQuery.extend( {}, udataOld );
  21461. dataUser.set( dest, udataCur );
  21462. }
  21463. }
  21464. // Fix IE bugs, see support tests
  21465. function fixInput( src, dest ) {
  21466. var nodeName = dest.nodeName.toLowerCase();
  21467. // Fails to persist the checked state of a cloned checkbox or radio button.
  21468. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  21469. dest.checked = src.checked;
  21470. // Fails to return the selected option to the default selected state when cloning options
  21471. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  21472. dest.defaultValue = src.defaultValue;
  21473. }
  21474. }
  21475. function domManip( collection, args, callback, ignored ) {
  21476. // Flatten any nested arrays
  21477. args = concat.apply( [], args );
  21478. var fragment, first, scripts, hasScripts, node, doc,
  21479. i = 0,
  21480. l = collection.length,
  21481. iNoClone = l - 1,
  21482. value = args[ 0 ],
  21483. isFunction = jQuery.isFunction( value );
  21484. // We can't cloneNode fragments that contain checked, in WebKit
  21485. if ( isFunction ||
  21486. ( l > 1 && typeof value === "string" &&
  21487. !support.checkClone && rchecked.test( value ) ) ) {
  21488. return collection.each( function( index ) {
  21489. var self = collection.eq( index );
  21490. if ( isFunction ) {
  21491. args[ 0 ] = value.call( this, index, self.html() );
  21492. }
  21493. domManip( self, args, callback, ignored );
  21494. } );
  21495. }
  21496. if ( l ) {
  21497. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  21498. first = fragment.firstChild;
  21499. if ( fragment.childNodes.length === 1 ) {
  21500. fragment = first;
  21501. }
  21502. // Require either new content or an interest in ignored elements to invoke the callback
  21503. if ( first || ignored ) {
  21504. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  21505. hasScripts = scripts.length;
  21506. // Use the original fragment for the last item
  21507. // instead of the first because it can end up
  21508. // being emptied incorrectly in certain situations (#8070).
  21509. for ( ; i < l; i++ ) {
  21510. node = fragment;
  21511. if ( i !== iNoClone ) {
  21512. node = jQuery.clone( node, true, true );
  21513. // Keep references to cloned scripts for later restoration
  21514. if ( hasScripts ) {
  21515. // Support: Android <=4.0 only, PhantomJS 1 only
  21516. // push.apply(_, arraylike) throws on ancient WebKit
  21517. jQuery.merge( scripts, getAll( node, "script" ) );
  21518. }
  21519. }
  21520. callback.call( collection[ i ], node, i );
  21521. }
  21522. if ( hasScripts ) {
  21523. doc = scripts[ scripts.length - 1 ].ownerDocument;
  21524. // Reenable scripts
  21525. jQuery.map( scripts, restoreScript );
  21526. // Evaluate executable scripts on first document insertion
  21527. for ( i = 0; i < hasScripts; i++ ) {
  21528. node = scripts[ i ];
  21529. if ( rscriptType.test( node.type || "" ) &&
  21530. !dataPriv.access( node, "globalEval" ) &&
  21531. jQuery.contains( doc, node ) ) {
  21532. if ( node.src ) {
  21533. // Optional AJAX dependency, but won't run scripts if not present
  21534. if ( jQuery._evalUrl ) {
  21535. jQuery._evalUrl( node.src );
  21536. }
  21537. } else {
  21538. DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
  21539. }
  21540. }
  21541. }
  21542. }
  21543. }
  21544. }
  21545. return collection;
  21546. }
  21547. function remove( elem, selector, keepData ) {
  21548. var node,
  21549. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  21550. i = 0;
  21551. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  21552. if ( !keepData && node.nodeType === 1 ) {
  21553. jQuery.cleanData( getAll( node ) );
  21554. }
  21555. if ( node.parentNode ) {
  21556. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  21557. setGlobalEval( getAll( node, "script" ) );
  21558. }
  21559. node.parentNode.removeChild( node );
  21560. }
  21561. }
  21562. return elem;
  21563. }
  21564. jQuery.extend( {
  21565. htmlPrefilter: function( html ) {
  21566. return html.replace( rxhtmlTag, "<$1></$2>" );
  21567. },
  21568. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  21569. var i, l, srcElements, destElements,
  21570. clone = elem.cloneNode( true ),
  21571. inPage = jQuery.contains( elem.ownerDocument, elem );
  21572. // Fix IE cloning issues
  21573. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  21574. !jQuery.isXMLDoc( elem ) ) {
  21575. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  21576. destElements = getAll( clone );
  21577. srcElements = getAll( elem );
  21578. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  21579. fixInput( srcElements[ i ], destElements[ i ] );
  21580. }
  21581. }
  21582. // Copy the events from the original to the clone
  21583. if ( dataAndEvents ) {
  21584. if ( deepDataAndEvents ) {
  21585. srcElements = srcElements || getAll( elem );
  21586. destElements = destElements || getAll( clone );
  21587. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  21588. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  21589. }
  21590. } else {
  21591. cloneCopyEvent( elem, clone );
  21592. }
  21593. }
  21594. // Preserve script evaluation history
  21595. destElements = getAll( clone, "script" );
  21596. if ( destElements.length > 0 ) {
  21597. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  21598. }
  21599. // Return the cloned set
  21600. return clone;
  21601. },
  21602. cleanData: function( elems ) {
  21603. var data, elem, type,
  21604. special = jQuery.event.special,
  21605. i = 0;
  21606. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  21607. if ( acceptData( elem ) ) {
  21608. if ( ( data = elem[ dataPriv.expando ] ) ) {
  21609. if ( data.events ) {
  21610. for ( type in data.events ) {
  21611. if ( special[ type ] ) {
  21612. jQuery.event.remove( elem, type );
  21613. // This is a shortcut to avoid jQuery.event.remove's overhead
  21614. } else {
  21615. jQuery.removeEvent( elem, type, data.handle );
  21616. }
  21617. }
  21618. }
  21619. // Support: Chrome <=35 - 45+
  21620. // Assign undefined instead of using delete, see Data#remove
  21621. elem[ dataPriv.expando ] = undefined;
  21622. }
  21623. if ( elem[ dataUser.expando ] ) {
  21624. // Support: Chrome <=35 - 45+
  21625. // Assign undefined instead of using delete, see Data#remove
  21626. elem[ dataUser.expando ] = undefined;
  21627. }
  21628. }
  21629. }
  21630. }
  21631. } );
  21632. jQuery.fn.extend( {
  21633. detach: function( selector ) {
  21634. return remove( this, selector, true );
  21635. },
  21636. remove: function( selector ) {
  21637. return remove( this, selector );
  21638. },
  21639. text: function( value ) {
  21640. return access( this, function( value ) {
  21641. return value === undefined ?
  21642. jQuery.text( this ) :
  21643. this.empty().each( function() {
  21644. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21645. this.textContent = value;
  21646. }
  21647. } );
  21648. }, null, value, arguments.length );
  21649. },
  21650. append: function() {
  21651. return domManip( this, arguments, function( elem ) {
  21652. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21653. var target = manipulationTarget( this, elem );
  21654. target.appendChild( elem );
  21655. }
  21656. } );
  21657. },
  21658. prepend: function() {
  21659. return domManip( this, arguments, function( elem ) {
  21660. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21661. var target = manipulationTarget( this, elem );
  21662. target.insertBefore( elem, target.firstChild );
  21663. }
  21664. } );
  21665. },
  21666. before: function() {
  21667. return domManip( this, arguments, function( elem ) {
  21668. if ( this.parentNode ) {
  21669. this.parentNode.insertBefore( elem, this );
  21670. }
  21671. } );
  21672. },
  21673. after: function() {
  21674. return domManip( this, arguments, function( elem ) {
  21675. if ( this.parentNode ) {
  21676. this.parentNode.insertBefore( elem, this.nextSibling );
  21677. }
  21678. } );
  21679. },
  21680. empty: function() {
  21681. var elem,
  21682. i = 0;
  21683. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  21684. if ( elem.nodeType === 1 ) {
  21685. // Prevent memory leaks
  21686. jQuery.cleanData( getAll( elem, false ) );
  21687. // Remove any remaining nodes
  21688. elem.textContent = "";
  21689. }
  21690. }
  21691. return this;
  21692. },
  21693. clone: function( dataAndEvents, deepDataAndEvents ) {
  21694. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  21695. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  21696. return this.map( function() {
  21697. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  21698. } );
  21699. },
  21700. html: function( value ) {
  21701. return access( this, function( value ) {
  21702. var elem = this[ 0 ] || {},
  21703. i = 0,
  21704. l = this.length;
  21705. if ( value === undefined && elem.nodeType === 1 ) {
  21706. return elem.innerHTML;
  21707. }
  21708. // See if we can take a shortcut and just use innerHTML
  21709. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  21710. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  21711. value = jQuery.htmlPrefilter( value );
  21712. try {
  21713. for ( ; i < l; i++ ) {
  21714. elem = this[ i ] || {};
  21715. // Remove element nodes and prevent memory leaks
  21716. if ( elem.nodeType === 1 ) {
  21717. jQuery.cleanData( getAll( elem, false ) );
  21718. elem.innerHTML = value;
  21719. }
  21720. }
  21721. elem = 0;
  21722. // If using innerHTML throws an exception, use the fallback method
  21723. } catch ( e ) {}
  21724. }
  21725. if ( elem ) {
  21726. this.empty().append( value );
  21727. }
  21728. }, null, value, arguments.length );
  21729. },
  21730. replaceWith: function() {
  21731. var ignored = [];
  21732. // Make the changes, replacing each non-ignored context element with the new content
  21733. return domManip( this, arguments, function( elem ) {
  21734. var parent = this.parentNode;
  21735. if ( jQuery.inArray( this, ignored ) < 0 ) {
  21736. jQuery.cleanData( getAll( this ) );
  21737. if ( parent ) {
  21738. parent.replaceChild( elem, this );
  21739. }
  21740. }
  21741. // Force callback invocation
  21742. }, ignored );
  21743. }
  21744. } );
  21745. jQuery.each( {
  21746. appendTo: "append",
  21747. prependTo: "prepend",
  21748. insertBefore: "before",
  21749. insertAfter: "after",
  21750. replaceAll: "replaceWith"
  21751. }, function( name, original ) {
  21752. jQuery.fn[ name ] = function( selector ) {
  21753. var elems,
  21754. ret = [],
  21755. insert = jQuery( selector ),
  21756. last = insert.length - 1,
  21757. i = 0;
  21758. for ( ; i <= last; i++ ) {
  21759. elems = i === last ? this : this.clone( true );
  21760. jQuery( insert[ i ] )[ original ]( elems );
  21761. // Support: Android <=4.0 only, PhantomJS 1 only
  21762. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  21763. push.apply( ret, elems.get() );
  21764. }
  21765. return this.pushStack( ret );
  21766. };
  21767. } );
  21768. var rmargin = ( /^margin/ );
  21769. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  21770. var getStyles = function( elem ) {
  21771. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  21772. // IE throws on elements created in popups
  21773. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  21774. var view = elem.ownerDocument.defaultView;
  21775. if ( !view || !view.opener ) {
  21776. view = window;
  21777. }
  21778. return view.getComputedStyle( elem );
  21779. };
  21780. ( function() {
  21781. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  21782. // so they're executed at the same time to save the second computation.
  21783. function computeStyleTests() {
  21784. // This is a singleton, we need to execute it only once
  21785. if ( !div ) {
  21786. return;
  21787. }
  21788. div.style.cssText =
  21789. "box-sizing:border-box;" +
  21790. "position:relative;display:block;" +
  21791. "margin:auto;border:1px;padding:1px;" +
  21792. "top:1%;width:50%";
  21793. div.innerHTML = "";
  21794. documentElement.appendChild( container );
  21795. var divStyle = window.getComputedStyle( div );
  21796. pixelPositionVal = divStyle.top !== "1%";
  21797. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  21798. reliableMarginLeftVal = divStyle.marginLeft === "2px";
  21799. boxSizingReliableVal = divStyle.width === "4px";
  21800. // Support: Android 4.0 - 4.3 only
  21801. // Some styles come back with percentage values, even though they shouldn't
  21802. div.style.marginRight = "50%";
  21803. pixelMarginRightVal = divStyle.marginRight === "4px";
  21804. documentElement.removeChild( container );
  21805. // Nullify the div so it wouldn't be stored in the memory and
  21806. // it will also be a sign that checks already performed
  21807. div = null;
  21808. }
  21809. var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
  21810. container = document.createElement( "div" ),
  21811. div = document.createElement( "div" );
  21812. // Finish early in limited (non-browser) environments
  21813. if ( !div.style ) {
  21814. return;
  21815. }
  21816. // Support: IE <=9 - 11 only
  21817. // Style of cloned element affects source element cloned (#8908)
  21818. div.style.backgroundClip = "content-box";
  21819. div.cloneNode( true ).style.backgroundClip = "";
  21820. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  21821. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  21822. "padding:0;margin-top:1px;position:absolute";
  21823. container.appendChild( div );
  21824. jQuery.extend( support, {
  21825. pixelPosition: function() {
  21826. computeStyleTests();
  21827. return pixelPositionVal;
  21828. },
  21829. boxSizingReliable: function() {
  21830. computeStyleTests();
  21831. return boxSizingReliableVal;
  21832. },
  21833. pixelMarginRight: function() {
  21834. computeStyleTests();
  21835. return pixelMarginRightVal;
  21836. },
  21837. reliableMarginLeft: function() {
  21838. computeStyleTests();
  21839. return reliableMarginLeftVal;
  21840. }
  21841. } );
  21842. } )();
  21843. function curCSS( elem, name, computed ) {
  21844. var width, minWidth, maxWidth, ret,
  21845. // Support: Firefox 51+
  21846. // Retrieving style before computed somehow
  21847. // fixes an issue with getting wrong values
  21848. // on detached elements
  21849. style = elem.style;
  21850. computed = computed || getStyles( elem );
  21851. // getPropertyValue is needed for:
  21852. // .css('filter') (IE 9 only, #12537)
  21853. // .css('--customProperty) (#3144)
  21854. if ( computed ) {
  21855. ret = computed.getPropertyValue( name ) || computed[ name ];
  21856. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  21857. ret = jQuery.style( elem, name );
  21858. }
  21859. // A tribute to the "awesome hack by Dean Edwards"
  21860. // Android Browser returns percentage for some values,
  21861. // but width seems to be reliably pixels.
  21862. // This is against the CSSOM draft spec:
  21863. // https://drafts.csswg.org/cssom/#resolved-values
  21864. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  21865. // Remember the original values
  21866. width = style.width;
  21867. minWidth = style.minWidth;
  21868. maxWidth = style.maxWidth;
  21869. // Put in the new values to get a computed value out
  21870. style.minWidth = style.maxWidth = style.width = ret;
  21871. ret = computed.width;
  21872. // Revert the changed values
  21873. style.width = width;
  21874. style.minWidth = minWidth;
  21875. style.maxWidth = maxWidth;
  21876. }
  21877. }
  21878. return ret !== undefined ?
  21879. // Support: IE <=9 - 11 only
  21880. // IE returns zIndex value as an integer.
  21881. ret + "" :
  21882. ret;
  21883. }
  21884. function addGetHookIf( conditionFn, hookFn ) {
  21885. // Define the hook, we'll check on the first run if it's really needed.
  21886. return {
  21887. get: function() {
  21888. if ( conditionFn() ) {
  21889. // Hook not needed (or it's not possible to use it due
  21890. // to missing dependency), remove it.
  21891. delete this.get;
  21892. return;
  21893. }
  21894. // Hook needed; redefine it so that the support test is not executed again.
  21895. return ( this.get = hookFn ).apply( this, arguments );
  21896. }
  21897. };
  21898. }
  21899. var
  21900. // Swappable if display is none or starts with table
  21901. // except "table", "table-cell", or "table-caption"
  21902. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  21903. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  21904. rcustomProp = /^--/,
  21905. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  21906. cssNormalTransform = {
  21907. letterSpacing: "0",
  21908. fontWeight: "400"
  21909. },
  21910. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  21911. emptyStyle = document.createElement( "div" ).style;
  21912. // Return a css property mapped to a potentially vendor prefixed property
  21913. function vendorPropName( name ) {
  21914. // Shortcut for names that are not vendor prefixed
  21915. if ( name in emptyStyle ) {
  21916. return name;
  21917. }
  21918. // Check for vendor prefixed names
  21919. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  21920. i = cssPrefixes.length;
  21921. while ( i-- ) {
  21922. name = cssPrefixes[ i ] + capName;
  21923. if ( name in emptyStyle ) {
  21924. return name;
  21925. }
  21926. }
  21927. }
  21928. // Return a property mapped along what jQuery.cssProps suggests or to
  21929. // a vendor prefixed property.
  21930. function finalPropName( name ) {
  21931. var ret = jQuery.cssProps[ name ];
  21932. if ( !ret ) {
  21933. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  21934. }
  21935. return ret;
  21936. }
  21937. function setPositiveNumber( elem, value, subtract ) {
  21938. // Any relative (+/-) values have already been
  21939. // normalized at this point
  21940. var matches = rcssNum.exec( value );
  21941. return matches ?
  21942. // Guard against undefined "subtract", e.g., when used as in cssHooks
  21943. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  21944. value;
  21945. }
  21946. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  21947. var i,
  21948. val = 0;
  21949. // If we already have the right measurement, avoid augmentation
  21950. if ( extra === ( isBorderBox ? "border" : "content" ) ) {
  21951. i = 4;
  21952. // Otherwise initialize for horizontal or vertical properties
  21953. } else {
  21954. i = name === "width" ? 1 : 0;
  21955. }
  21956. for ( ; i < 4; i += 2 ) {
  21957. // Both box models exclude margin, so add it if we want it
  21958. if ( extra === "margin" ) {
  21959. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  21960. }
  21961. if ( isBorderBox ) {
  21962. // border-box includes padding, so remove it if we want content
  21963. if ( extra === "content" ) {
  21964. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  21965. }
  21966. // At this point, extra isn't border nor margin, so remove border
  21967. if ( extra !== "margin" ) {
  21968. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  21969. }
  21970. } else {
  21971. // At this point, extra isn't content, so add padding
  21972. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  21973. // At this point, extra isn't content nor padding, so add border
  21974. if ( extra !== "padding" ) {
  21975. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  21976. }
  21977. }
  21978. }
  21979. return val;
  21980. }
  21981. function getWidthOrHeight( elem, name, extra ) {
  21982. // Start with computed style
  21983. var valueIsBorderBox,
  21984. styles = getStyles( elem ),
  21985. val = curCSS( elem, name, styles ),
  21986. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  21987. // Computed unit is not pixels. Stop here and return.
  21988. if ( rnumnonpx.test( val ) ) {
  21989. return val;
  21990. }
  21991. // Check for style in case a browser which returns unreliable values
  21992. // for getComputedStyle silently falls back to the reliable elem.style
  21993. valueIsBorderBox = isBorderBox &&
  21994. ( support.boxSizingReliable() || val === elem.style[ name ] );
  21995. // Fall back to offsetWidth/Height when value is "auto"
  21996. // This happens for inline elements with no explicit setting (gh-3571)
  21997. if ( val === "auto" ) {
  21998. val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
  21999. }
  22000. // Normalize "", auto, and prepare for extra
  22001. val = parseFloat( val ) || 0;
  22002. // Use the active box-sizing model to add/subtract irrelevant styles
  22003. return ( val +
  22004. augmentWidthOrHeight(
  22005. elem,
  22006. name,
  22007. extra || ( isBorderBox ? "border" : "content" ),
  22008. valueIsBorderBox,
  22009. styles
  22010. )
  22011. ) + "px";
  22012. }
  22013. jQuery.extend( {
  22014. // Add in style property hooks for overriding the default
  22015. // behavior of getting and setting a style property
  22016. cssHooks: {
  22017. opacity: {
  22018. get: function( elem, computed ) {
  22019. if ( computed ) {
  22020. // We should always get a number back from opacity
  22021. var ret = curCSS( elem, "opacity" );
  22022. return ret === "" ? "1" : ret;
  22023. }
  22024. }
  22025. }
  22026. },
  22027. // Don't automatically add "px" to these possibly-unitless properties
  22028. cssNumber: {
  22029. "animationIterationCount": true,
  22030. "columnCount": true,
  22031. "fillOpacity": true,
  22032. "flexGrow": true,
  22033. "flexShrink": true,
  22034. "fontWeight": true,
  22035. "lineHeight": true,
  22036. "opacity": true,
  22037. "order": true,
  22038. "orphans": true,
  22039. "widows": true,
  22040. "zIndex": true,
  22041. "zoom": true
  22042. },
  22043. // Add in properties whose names you wish to fix before
  22044. // setting or getting the value
  22045. cssProps: {
  22046. "float": "cssFloat"
  22047. },
  22048. // Get and set the style property on a DOM Node
  22049. style: function( elem, name, value, extra ) {
  22050. // Don't set styles on text and comment nodes
  22051. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  22052. return;
  22053. }
  22054. // Make sure that we're working with the right name
  22055. var ret, type, hooks,
  22056. origName = jQuery.camelCase( name ),
  22057. isCustomProp = rcustomProp.test( name ),
  22058. style = elem.style;
  22059. // Make sure that we're working with the right name. We don't
  22060. // want to query the value if it is a CSS custom property
  22061. // since they are user-defined.
  22062. if ( !isCustomProp ) {
  22063. name = finalPropName( origName );
  22064. }
  22065. // Gets hook for the prefixed version, then unprefixed version
  22066. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22067. // Check if we're setting a value
  22068. if ( value !== undefined ) {
  22069. type = typeof value;
  22070. // Convert "+=" or "-=" to relative numbers (#7345)
  22071. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  22072. value = adjustCSS( elem, name, ret );
  22073. // Fixes bug #9237
  22074. type = "number";
  22075. }
  22076. // Make sure that null and NaN values aren't set (#7116)
  22077. if ( value == null || value !== value ) {
  22078. return;
  22079. }
  22080. // If a number was passed in, add the unit (except for certain CSS properties)
  22081. if ( type === "number" ) {
  22082. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  22083. }
  22084. // background-* props affect original clone's values
  22085. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  22086. style[ name ] = "inherit";
  22087. }
  22088. // If a hook was provided, use that value, otherwise just set the specified value
  22089. if ( !hooks || !( "set" in hooks ) ||
  22090. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  22091. if ( isCustomProp ) {
  22092. style.setProperty( name, value );
  22093. } else {
  22094. style[ name ] = value;
  22095. }
  22096. }
  22097. } else {
  22098. // If a hook was provided get the non-computed value from there
  22099. if ( hooks && "get" in hooks &&
  22100. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  22101. return ret;
  22102. }
  22103. // Otherwise just get the value from the style object
  22104. return style[ name ];
  22105. }
  22106. },
  22107. css: function( elem, name, extra, styles ) {
  22108. var val, num, hooks,
  22109. origName = jQuery.camelCase( name ),
  22110. isCustomProp = rcustomProp.test( name );
  22111. // Make sure that we're working with the right name. We don't
  22112. // want to modify the value if it is a CSS custom property
  22113. // since they are user-defined.
  22114. if ( !isCustomProp ) {
  22115. name = finalPropName( origName );
  22116. }
  22117. // Try prefixed name followed by the unprefixed name
  22118. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22119. // If a hook was provided get the computed value from there
  22120. if ( hooks && "get" in hooks ) {
  22121. val = hooks.get( elem, true, extra );
  22122. }
  22123. // Otherwise, if a way to get the computed value exists, use that
  22124. if ( val === undefined ) {
  22125. val = curCSS( elem, name, styles );
  22126. }
  22127. // Convert "normal" to computed value
  22128. if ( val === "normal" && name in cssNormalTransform ) {
  22129. val = cssNormalTransform[ name ];
  22130. }
  22131. // Make numeric if forced or a qualifier was provided and val looks numeric
  22132. if ( extra === "" || extra ) {
  22133. num = parseFloat( val );
  22134. return extra === true || isFinite( num ) ? num || 0 : val;
  22135. }
  22136. return val;
  22137. }
  22138. } );
  22139. jQuery.each( [ "height", "width" ], function( i, name ) {
  22140. jQuery.cssHooks[ name ] = {
  22141. get: function( elem, computed, extra ) {
  22142. if ( computed ) {
  22143. // Certain elements can have dimension info if we invisibly show them
  22144. // but it must have a current display style that would benefit
  22145. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  22146. // Support: Safari 8+
  22147. // Table columns in Safari have non-zero offsetWidth & zero
  22148. // getBoundingClientRect().width unless display is changed.
  22149. // Support: IE <=11 only
  22150. // Running getBoundingClientRect on a disconnected node
  22151. // in IE throws an error.
  22152. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  22153. swap( elem, cssShow, function() {
  22154. return getWidthOrHeight( elem, name, extra );
  22155. } ) :
  22156. getWidthOrHeight( elem, name, extra );
  22157. }
  22158. },
  22159. set: function( elem, value, extra ) {
  22160. var matches,
  22161. styles = extra && getStyles( elem ),
  22162. subtract = extra && augmentWidthOrHeight(
  22163. elem,
  22164. name,
  22165. extra,
  22166. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  22167. styles
  22168. );
  22169. // Convert to pixels if value adjustment is needed
  22170. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  22171. ( matches[ 3 ] || "px" ) !== "px" ) {
  22172. elem.style[ name ] = value;
  22173. value = jQuery.css( elem, name );
  22174. }
  22175. return setPositiveNumber( elem, value, subtract );
  22176. }
  22177. };
  22178. } );
  22179. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  22180. function( elem, computed ) {
  22181. if ( computed ) {
  22182. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  22183. elem.getBoundingClientRect().left -
  22184. swap( elem, { marginLeft: 0 }, function() {
  22185. return elem.getBoundingClientRect().left;
  22186. } )
  22187. ) + "px";
  22188. }
  22189. }
  22190. );
  22191. // These hooks are used by animate to expand properties
  22192. jQuery.each( {
  22193. margin: "",
  22194. padding: "",
  22195. border: "Width"
  22196. }, function( prefix, suffix ) {
  22197. jQuery.cssHooks[ prefix + suffix ] = {
  22198. expand: function( value ) {
  22199. var i = 0,
  22200. expanded = {},
  22201. // Assumes a single number if not a string
  22202. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  22203. for ( ; i < 4; i++ ) {
  22204. expanded[ prefix + cssExpand[ i ] + suffix ] =
  22205. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  22206. }
  22207. return expanded;
  22208. }
  22209. };
  22210. if ( !rmargin.test( prefix ) ) {
  22211. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  22212. }
  22213. } );
  22214. jQuery.fn.extend( {
  22215. css: function( name, value ) {
  22216. return access( this, function( elem, name, value ) {
  22217. var styles, len,
  22218. map = {},
  22219. i = 0;
  22220. if ( Array.isArray( name ) ) {
  22221. styles = getStyles( elem );
  22222. len = name.length;
  22223. for ( ; i < len; i++ ) {
  22224. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  22225. }
  22226. return map;
  22227. }
  22228. return value !== undefined ?
  22229. jQuery.style( elem, name, value ) :
  22230. jQuery.css( elem, name );
  22231. }, name, value, arguments.length > 1 );
  22232. }
  22233. } );
  22234. function Tween( elem, options, prop, end, easing ) {
  22235. return new Tween.prototype.init( elem, options, prop, end, easing );
  22236. }
  22237. jQuery.Tween = Tween;
  22238. Tween.prototype = {
  22239. constructor: Tween,
  22240. init: function( elem, options, prop, end, easing, unit ) {
  22241. this.elem = elem;
  22242. this.prop = prop;
  22243. this.easing = easing || jQuery.easing._default;
  22244. this.options = options;
  22245. this.start = this.now = this.cur();
  22246. this.end = end;
  22247. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  22248. },
  22249. cur: function() {
  22250. var hooks = Tween.propHooks[ this.prop ];
  22251. return hooks && hooks.get ?
  22252. hooks.get( this ) :
  22253. Tween.propHooks._default.get( this );
  22254. },
  22255. run: function( percent ) {
  22256. var eased,
  22257. hooks = Tween.propHooks[ this.prop ];
  22258. if ( this.options.duration ) {
  22259. this.pos = eased = jQuery.easing[ this.easing ](
  22260. percent, this.options.duration * percent, 0, 1, this.options.duration
  22261. );
  22262. } else {
  22263. this.pos = eased = percent;
  22264. }
  22265. this.now = ( this.end - this.start ) * eased + this.start;
  22266. if ( this.options.step ) {
  22267. this.options.step.call( this.elem, this.now, this );
  22268. }
  22269. if ( hooks && hooks.set ) {
  22270. hooks.set( this );
  22271. } else {
  22272. Tween.propHooks._default.set( this );
  22273. }
  22274. return this;
  22275. }
  22276. };
  22277. Tween.prototype.init.prototype = Tween.prototype;
  22278. Tween.propHooks = {
  22279. _default: {
  22280. get: function( tween ) {
  22281. var result;
  22282. // Use a property on the element directly when it is not a DOM element,
  22283. // or when there is no matching style property that exists.
  22284. if ( tween.elem.nodeType !== 1 ||
  22285. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  22286. return tween.elem[ tween.prop ];
  22287. }
  22288. // Passing an empty string as a 3rd parameter to .css will automatically
  22289. // attempt a parseFloat and fallback to a string if the parse fails.
  22290. // Simple values such as "10px" are parsed to Float;
  22291. // complex values such as "rotate(1rad)" are returned as-is.
  22292. result = jQuery.css( tween.elem, tween.prop, "" );
  22293. // Empty strings, null, undefined and "auto" are converted to 0.
  22294. return !result || result === "auto" ? 0 : result;
  22295. },
  22296. set: function( tween ) {
  22297. // Use step hook for back compat.
  22298. // Use cssHook if its there.
  22299. // Use .style if available and use plain properties where available.
  22300. if ( jQuery.fx.step[ tween.prop ] ) {
  22301. jQuery.fx.step[ tween.prop ]( tween );
  22302. } else if ( tween.elem.nodeType === 1 &&
  22303. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  22304. jQuery.cssHooks[ tween.prop ] ) ) {
  22305. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  22306. } else {
  22307. tween.elem[ tween.prop ] = tween.now;
  22308. }
  22309. }
  22310. }
  22311. };
  22312. // Support: IE <=9 only
  22313. // Panic based approach to setting things on disconnected nodes
  22314. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  22315. set: function( tween ) {
  22316. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  22317. tween.elem[ tween.prop ] = tween.now;
  22318. }
  22319. }
  22320. };
  22321. jQuery.easing = {
  22322. linear: function( p ) {
  22323. return p;
  22324. },
  22325. swing: function( p ) {
  22326. return 0.5 - Math.cos( p * Math.PI ) / 2;
  22327. },
  22328. _default: "swing"
  22329. };
  22330. jQuery.fx = Tween.prototype.init;
  22331. // Back compat <1.8 extension point
  22332. jQuery.fx.step = {};
  22333. var
  22334. fxNow, inProgress,
  22335. rfxtypes = /^(?:toggle|show|hide)$/,
  22336. rrun = /queueHooks$/;
  22337. function schedule() {
  22338. if ( inProgress ) {
  22339. if ( document.hidden === false && window.requestAnimationFrame ) {
  22340. window.requestAnimationFrame( schedule );
  22341. } else {
  22342. window.setTimeout( schedule, jQuery.fx.interval );
  22343. }
  22344. jQuery.fx.tick();
  22345. }
  22346. }
  22347. // Animations created synchronously will run synchronously
  22348. function createFxNow() {
  22349. window.setTimeout( function() {
  22350. fxNow = undefined;
  22351. } );
  22352. return ( fxNow = jQuery.now() );
  22353. }
  22354. // Generate parameters to create a standard animation
  22355. function genFx( type, includeWidth ) {
  22356. var which,
  22357. i = 0,
  22358. attrs = { height: type };
  22359. // If we include width, step value is 1 to do all cssExpand values,
  22360. // otherwise step value is 2 to skip over Left and Right
  22361. includeWidth = includeWidth ? 1 : 0;
  22362. for ( ; i < 4; i += 2 - includeWidth ) {
  22363. which = cssExpand[ i ];
  22364. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  22365. }
  22366. if ( includeWidth ) {
  22367. attrs.opacity = attrs.width = type;
  22368. }
  22369. return attrs;
  22370. }
  22371. function createTween( value, prop, animation ) {
  22372. var tween,
  22373. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  22374. index = 0,
  22375. length = collection.length;
  22376. for ( ; index < length; index++ ) {
  22377. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  22378. // We're done with this property
  22379. return tween;
  22380. }
  22381. }
  22382. }
  22383. function defaultPrefilter( elem, props, opts ) {
  22384. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  22385. isBox = "width" in props || "height" in props,
  22386. anim = this,
  22387. orig = {},
  22388. style = elem.style,
  22389. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  22390. dataShow = dataPriv.get( elem, "fxshow" );
  22391. // Queue-skipping animations hijack the fx hooks
  22392. if ( !opts.queue ) {
  22393. hooks = jQuery._queueHooks( elem, "fx" );
  22394. if ( hooks.unqueued == null ) {
  22395. hooks.unqueued = 0;
  22396. oldfire = hooks.empty.fire;
  22397. hooks.empty.fire = function() {
  22398. if ( !hooks.unqueued ) {
  22399. oldfire();
  22400. }
  22401. };
  22402. }
  22403. hooks.unqueued++;
  22404. anim.always( function() {
  22405. // Ensure the complete handler is called before this completes
  22406. anim.always( function() {
  22407. hooks.unqueued--;
  22408. if ( !jQuery.queue( elem, "fx" ).length ) {
  22409. hooks.empty.fire();
  22410. }
  22411. } );
  22412. } );
  22413. }
  22414. // Detect show/hide animations
  22415. for ( prop in props ) {
  22416. value = props[ prop ];
  22417. if ( rfxtypes.test( value ) ) {
  22418. delete props[ prop ];
  22419. toggle = toggle || value === "toggle";
  22420. if ( value === ( hidden ? "hide" : "show" ) ) {
  22421. // Pretend to be hidden if this is a "show" and
  22422. // there is still data from a stopped show/hide
  22423. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  22424. hidden = true;
  22425. // Ignore all other no-op show/hide data
  22426. } else {
  22427. continue;
  22428. }
  22429. }
  22430. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  22431. }
  22432. }
  22433. // Bail out if this is a no-op like .hide().hide()
  22434. propTween = !jQuery.isEmptyObject( props );
  22435. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  22436. return;
  22437. }
  22438. // Restrict "overflow" and "display" styles during box animations
  22439. if ( isBox && elem.nodeType === 1 ) {
  22440. // Support: IE <=9 - 11, Edge 12 - 13
  22441. // Record all 3 overflow attributes because IE does not infer the shorthand
  22442. // from identically-valued overflowX and overflowY
  22443. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  22444. // Identify a display type, preferring old show/hide data over the CSS cascade
  22445. restoreDisplay = dataShow && dataShow.display;
  22446. if ( restoreDisplay == null ) {
  22447. restoreDisplay = dataPriv.get( elem, "display" );
  22448. }
  22449. display = jQuery.css( elem, "display" );
  22450. if ( display === "none" ) {
  22451. if ( restoreDisplay ) {
  22452. display = restoreDisplay;
  22453. } else {
  22454. // Get nonempty value(s) by temporarily forcing visibility
  22455. showHide( [ elem ], true );
  22456. restoreDisplay = elem.style.display || restoreDisplay;
  22457. display = jQuery.css( elem, "display" );
  22458. showHide( [ elem ] );
  22459. }
  22460. }
  22461. // Animate inline elements as inline-block
  22462. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  22463. if ( jQuery.css( elem, "float" ) === "none" ) {
  22464. // Restore the original display value at the end of pure show/hide animations
  22465. if ( !propTween ) {
  22466. anim.done( function() {
  22467. style.display = restoreDisplay;
  22468. } );
  22469. if ( restoreDisplay == null ) {
  22470. display = style.display;
  22471. restoreDisplay = display === "none" ? "" : display;
  22472. }
  22473. }
  22474. style.display = "inline-block";
  22475. }
  22476. }
  22477. }
  22478. if ( opts.overflow ) {
  22479. style.overflow = "hidden";
  22480. anim.always( function() {
  22481. style.overflow = opts.overflow[ 0 ];
  22482. style.overflowX = opts.overflow[ 1 ];
  22483. style.overflowY = opts.overflow[ 2 ];
  22484. } );
  22485. }
  22486. // Implement show/hide animations
  22487. propTween = false;
  22488. for ( prop in orig ) {
  22489. // General show/hide setup for this element animation
  22490. if ( !propTween ) {
  22491. if ( dataShow ) {
  22492. if ( "hidden" in dataShow ) {
  22493. hidden = dataShow.hidden;
  22494. }
  22495. } else {
  22496. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  22497. }
  22498. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  22499. if ( toggle ) {
  22500. dataShow.hidden = !hidden;
  22501. }
  22502. // Show elements before animating them
  22503. if ( hidden ) {
  22504. showHide( [ elem ], true );
  22505. }
  22506. /* eslint-disable no-loop-func */
  22507. anim.done( function() {
  22508. /* eslint-enable no-loop-func */
  22509. // The final step of a "hide" animation is actually hiding the element
  22510. if ( !hidden ) {
  22511. showHide( [ elem ] );
  22512. }
  22513. dataPriv.remove( elem, "fxshow" );
  22514. for ( prop in orig ) {
  22515. jQuery.style( elem, prop, orig[ prop ] );
  22516. }
  22517. } );
  22518. }
  22519. // Per-property setup
  22520. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  22521. if ( !( prop in dataShow ) ) {
  22522. dataShow[ prop ] = propTween.start;
  22523. if ( hidden ) {
  22524. propTween.end = propTween.start;
  22525. propTween.start = 0;
  22526. }
  22527. }
  22528. }
  22529. }
  22530. function propFilter( props, specialEasing ) {
  22531. var index, name, easing, value, hooks;
  22532. // camelCase, specialEasing and expand cssHook pass
  22533. for ( index in props ) {
  22534. name = jQuery.camelCase( index );
  22535. easing = specialEasing[ name ];
  22536. value = props[ index ];
  22537. if ( Array.isArray( value ) ) {
  22538. easing = value[ 1 ];
  22539. value = props[ index ] = value[ 0 ];
  22540. }
  22541. if ( index !== name ) {
  22542. props[ name ] = value;
  22543. delete props[ index ];
  22544. }
  22545. hooks = jQuery.cssHooks[ name ];
  22546. if ( hooks && "expand" in hooks ) {
  22547. value = hooks.expand( value );
  22548. delete props[ name ];
  22549. // Not quite $.extend, this won't overwrite existing keys.
  22550. // Reusing 'index' because we have the correct "name"
  22551. for ( index in value ) {
  22552. if ( !( index in props ) ) {
  22553. props[ index ] = value[ index ];
  22554. specialEasing[ index ] = easing;
  22555. }
  22556. }
  22557. } else {
  22558. specialEasing[ name ] = easing;
  22559. }
  22560. }
  22561. }
  22562. function Animation( elem, properties, options ) {
  22563. var result,
  22564. stopped,
  22565. index = 0,
  22566. length = Animation.prefilters.length,
  22567. deferred = jQuery.Deferred().always( function() {
  22568. // Don't match elem in the :animated selector
  22569. delete tick.elem;
  22570. } ),
  22571. tick = function() {
  22572. if ( stopped ) {
  22573. return false;
  22574. }
  22575. var currentTime = fxNow || createFxNow(),
  22576. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  22577. // Support: Android 2.3 only
  22578. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  22579. temp = remaining / animation.duration || 0,
  22580. percent = 1 - temp,
  22581. index = 0,
  22582. length = animation.tweens.length;
  22583. for ( ; index < length; index++ ) {
  22584. animation.tweens[ index ].run( percent );
  22585. }
  22586. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  22587. // If there's more to do, yield
  22588. if ( percent < 1 && length ) {
  22589. return remaining;
  22590. }
  22591. // If this was an empty animation, synthesize a final progress notification
  22592. if ( !length ) {
  22593. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  22594. }
  22595. // Resolve the animation and report its conclusion
  22596. deferred.resolveWith( elem, [ animation ] );
  22597. return false;
  22598. },
  22599. animation = deferred.promise( {
  22600. elem: elem,
  22601. props: jQuery.extend( {}, properties ),
  22602. opts: jQuery.extend( true, {
  22603. specialEasing: {},
  22604. easing: jQuery.easing._default
  22605. }, options ),
  22606. originalProperties: properties,
  22607. originalOptions: options,
  22608. startTime: fxNow || createFxNow(),
  22609. duration: options.duration,
  22610. tweens: [],
  22611. createTween: function( prop, end ) {
  22612. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  22613. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  22614. animation.tweens.push( tween );
  22615. return tween;
  22616. },
  22617. stop: function( gotoEnd ) {
  22618. var index = 0,
  22619. // If we are going to the end, we want to run all the tweens
  22620. // otherwise we skip this part
  22621. length = gotoEnd ? animation.tweens.length : 0;
  22622. if ( stopped ) {
  22623. return this;
  22624. }
  22625. stopped = true;
  22626. for ( ; index < length; index++ ) {
  22627. animation.tweens[ index ].run( 1 );
  22628. }
  22629. // Resolve when we played the last frame; otherwise, reject
  22630. if ( gotoEnd ) {
  22631. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  22632. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  22633. } else {
  22634. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  22635. }
  22636. return this;
  22637. }
  22638. } ),
  22639. props = animation.props;
  22640. propFilter( props, animation.opts.specialEasing );
  22641. for ( ; index < length; index++ ) {
  22642. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  22643. if ( result ) {
  22644. if ( jQuery.isFunction( result.stop ) ) {
  22645. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  22646. jQuery.proxy( result.stop, result );
  22647. }
  22648. return result;
  22649. }
  22650. }
  22651. jQuery.map( props, createTween, animation );
  22652. if ( jQuery.isFunction( animation.opts.start ) ) {
  22653. animation.opts.start.call( elem, animation );
  22654. }
  22655. // Attach callbacks from options
  22656. animation
  22657. .progress( animation.opts.progress )
  22658. .done( animation.opts.done, animation.opts.complete )
  22659. .fail( animation.opts.fail )
  22660. .always( animation.opts.always );
  22661. jQuery.fx.timer(
  22662. jQuery.extend( tick, {
  22663. elem: elem,
  22664. anim: animation,
  22665. queue: animation.opts.queue
  22666. } )
  22667. );
  22668. return animation;
  22669. }
  22670. jQuery.Animation = jQuery.extend( Animation, {
  22671. tweeners: {
  22672. "*": [ function( prop, value ) {
  22673. var tween = this.createTween( prop, value );
  22674. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  22675. return tween;
  22676. } ]
  22677. },
  22678. tweener: function( props, callback ) {
  22679. if ( jQuery.isFunction( props ) ) {
  22680. callback = props;
  22681. props = [ "*" ];
  22682. } else {
  22683. props = props.match( rnothtmlwhite );
  22684. }
  22685. var prop,
  22686. index = 0,
  22687. length = props.length;
  22688. for ( ; index < length; index++ ) {
  22689. prop = props[ index ];
  22690. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  22691. Animation.tweeners[ prop ].unshift( callback );
  22692. }
  22693. },
  22694. prefilters: [ defaultPrefilter ],
  22695. prefilter: function( callback, prepend ) {
  22696. if ( prepend ) {
  22697. Animation.prefilters.unshift( callback );
  22698. } else {
  22699. Animation.prefilters.push( callback );
  22700. }
  22701. }
  22702. } );
  22703. jQuery.speed = function( speed, easing, fn ) {
  22704. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  22705. complete: fn || !fn && easing ||
  22706. jQuery.isFunction( speed ) && speed,
  22707. duration: speed,
  22708. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  22709. };
  22710. // Go to the end state if fx are off
  22711. if ( jQuery.fx.off ) {
  22712. opt.duration = 0;
  22713. } else {
  22714. if ( typeof opt.duration !== "number" ) {
  22715. if ( opt.duration in jQuery.fx.speeds ) {
  22716. opt.duration = jQuery.fx.speeds[ opt.duration ];
  22717. } else {
  22718. opt.duration = jQuery.fx.speeds._default;
  22719. }
  22720. }
  22721. }
  22722. // Normalize opt.queue - true/undefined/null -> "fx"
  22723. if ( opt.queue == null || opt.queue === true ) {
  22724. opt.queue = "fx";
  22725. }
  22726. // Queueing
  22727. opt.old = opt.complete;
  22728. opt.complete = function() {
  22729. if ( jQuery.isFunction( opt.old ) ) {
  22730. opt.old.call( this );
  22731. }
  22732. if ( opt.queue ) {
  22733. jQuery.dequeue( this, opt.queue );
  22734. }
  22735. };
  22736. return opt;
  22737. };
  22738. jQuery.fn.extend( {
  22739. fadeTo: function( speed, to, easing, callback ) {
  22740. // Show any hidden elements after setting opacity to 0
  22741. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  22742. // Animate to the value specified
  22743. .end().animate( { opacity: to }, speed, easing, callback );
  22744. },
  22745. animate: function( prop, speed, easing, callback ) {
  22746. var empty = jQuery.isEmptyObject( prop ),
  22747. optall = jQuery.speed( speed, easing, callback ),
  22748. doAnimation = function() {
  22749. // Operate on a copy of prop so per-property easing won't be lost
  22750. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  22751. // Empty animations, or finishing resolves immediately
  22752. if ( empty || dataPriv.get( this, "finish" ) ) {
  22753. anim.stop( true );
  22754. }
  22755. };
  22756. doAnimation.finish = doAnimation;
  22757. return empty || optall.queue === false ?
  22758. this.each( doAnimation ) :
  22759. this.queue( optall.queue, doAnimation );
  22760. },
  22761. stop: function( type, clearQueue, gotoEnd ) {
  22762. var stopQueue = function( hooks ) {
  22763. var stop = hooks.stop;
  22764. delete hooks.stop;
  22765. stop( gotoEnd );
  22766. };
  22767. if ( typeof type !== "string" ) {
  22768. gotoEnd = clearQueue;
  22769. clearQueue = type;
  22770. type = undefined;
  22771. }
  22772. if ( clearQueue && type !== false ) {
  22773. this.queue( type || "fx", [] );
  22774. }
  22775. return this.each( function() {
  22776. var dequeue = true,
  22777. index = type != null && type + "queueHooks",
  22778. timers = jQuery.timers,
  22779. data = dataPriv.get( this );
  22780. if ( index ) {
  22781. if ( data[ index ] && data[ index ].stop ) {
  22782. stopQueue( data[ index ] );
  22783. }
  22784. } else {
  22785. for ( index in data ) {
  22786. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  22787. stopQueue( data[ index ] );
  22788. }
  22789. }
  22790. }
  22791. for ( index = timers.length; index--; ) {
  22792. if ( timers[ index ].elem === this &&
  22793. ( type == null || timers[ index ].queue === type ) ) {
  22794. timers[ index ].anim.stop( gotoEnd );
  22795. dequeue = false;
  22796. timers.splice( index, 1 );
  22797. }
  22798. }
  22799. // Start the next in the queue if the last step wasn't forced.
  22800. // Timers currently will call their complete callbacks, which
  22801. // will dequeue but only if they were gotoEnd.
  22802. if ( dequeue || !gotoEnd ) {
  22803. jQuery.dequeue( this, type );
  22804. }
  22805. } );
  22806. },
  22807. finish: function( type ) {
  22808. if ( type !== false ) {
  22809. type = type || "fx";
  22810. }
  22811. return this.each( function() {
  22812. var index,
  22813. data = dataPriv.get( this ),
  22814. queue = data[ type + "queue" ],
  22815. hooks = data[ type + "queueHooks" ],
  22816. timers = jQuery.timers,
  22817. length = queue ? queue.length : 0;
  22818. // Enable finishing flag on private data
  22819. data.finish = true;
  22820. // Empty the queue first
  22821. jQuery.queue( this, type, [] );
  22822. if ( hooks && hooks.stop ) {
  22823. hooks.stop.call( this, true );
  22824. }
  22825. // Look for any active animations, and finish them
  22826. for ( index = timers.length; index--; ) {
  22827. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  22828. timers[ index ].anim.stop( true );
  22829. timers.splice( index, 1 );
  22830. }
  22831. }
  22832. // Look for any animations in the old queue and finish them
  22833. for ( index = 0; index < length; index++ ) {
  22834. if ( queue[ index ] && queue[ index ].finish ) {
  22835. queue[ index ].finish.call( this );
  22836. }
  22837. }
  22838. // Turn off finishing flag
  22839. delete data.finish;
  22840. } );
  22841. }
  22842. } );
  22843. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  22844. var cssFn = jQuery.fn[ name ];
  22845. jQuery.fn[ name ] = function( speed, easing, callback ) {
  22846. return speed == null || typeof speed === "boolean" ?
  22847. cssFn.apply( this, arguments ) :
  22848. this.animate( genFx( name, true ), speed, easing, callback );
  22849. };
  22850. } );
  22851. // Generate shortcuts for custom animations
  22852. jQuery.each( {
  22853. slideDown: genFx( "show" ),
  22854. slideUp: genFx( "hide" ),
  22855. slideToggle: genFx( "toggle" ),
  22856. fadeIn: { opacity: "show" },
  22857. fadeOut: { opacity: "hide" },
  22858. fadeToggle: { opacity: "toggle" }
  22859. }, function( name, props ) {
  22860. jQuery.fn[ name ] = function( speed, easing, callback ) {
  22861. return this.animate( props, speed, easing, callback );
  22862. };
  22863. } );
  22864. jQuery.timers = [];
  22865. jQuery.fx.tick = function() {
  22866. var timer,
  22867. i = 0,
  22868. timers = jQuery.timers;
  22869. fxNow = jQuery.now();
  22870. for ( ; i < timers.length; i++ ) {
  22871. timer = timers[ i ];
  22872. // Run the timer and safely remove it when done (allowing for external removal)
  22873. if ( !timer() && timers[ i ] === timer ) {
  22874. timers.splice( i--, 1 );
  22875. }
  22876. }
  22877. if ( !timers.length ) {
  22878. jQuery.fx.stop();
  22879. }
  22880. fxNow = undefined;
  22881. };
  22882. jQuery.fx.timer = function( timer ) {
  22883. jQuery.timers.push( timer );
  22884. jQuery.fx.start();
  22885. };
  22886. jQuery.fx.interval = 13;
  22887. jQuery.fx.start = function() {
  22888. if ( inProgress ) {
  22889. return;
  22890. }
  22891. inProgress = true;
  22892. schedule();
  22893. };
  22894. jQuery.fx.stop = function() {
  22895. inProgress = null;
  22896. };
  22897. jQuery.fx.speeds = {
  22898. slow: 600,
  22899. fast: 200,
  22900. // Default speed
  22901. _default: 400
  22902. };
  22903. // Based off of the plugin by Clint Helfers, with permission.
  22904. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  22905. jQuery.fn.delay = function( time, type ) {
  22906. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  22907. type = type || "fx";
  22908. return this.queue( type, function( next, hooks ) {
  22909. var timeout = window.setTimeout( next, time );
  22910. hooks.stop = function() {
  22911. window.clearTimeout( timeout );
  22912. };
  22913. } );
  22914. };
  22915. ( function() {
  22916. var input = document.createElement( "input" ),
  22917. select = document.createElement( "select" ),
  22918. opt = select.appendChild( document.createElement( "option" ) );
  22919. input.type = "checkbox";
  22920. // Support: Android <=4.3 only
  22921. // Default value for a checkbox should be "on"
  22922. support.checkOn = input.value !== "";
  22923. // Support: IE <=11 only
  22924. // Must access selectedIndex to make default options select
  22925. support.optSelected = opt.selected;
  22926. // Support: IE <=11 only
  22927. // An input loses its value after becoming a radio
  22928. input = document.createElement( "input" );
  22929. input.value = "t";
  22930. input.type = "radio";
  22931. support.radioValue = input.value === "t";
  22932. } )();
  22933. var boolHook,
  22934. attrHandle = jQuery.expr.attrHandle;
  22935. jQuery.fn.extend( {
  22936. attr: function( name, value ) {
  22937. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  22938. },
  22939. removeAttr: function( name ) {
  22940. return this.each( function() {
  22941. jQuery.removeAttr( this, name );
  22942. } );
  22943. }
  22944. } );
  22945. jQuery.extend( {
  22946. attr: function( elem, name, value ) {
  22947. var ret, hooks,
  22948. nType = elem.nodeType;
  22949. // Don't get/set attributes on text, comment and attribute nodes
  22950. if ( nType === 3 || nType === 8 || nType === 2 ) {
  22951. return;
  22952. }
  22953. // Fallback to prop when attributes are not supported
  22954. if ( typeof elem.getAttribute === "undefined" ) {
  22955. return jQuery.prop( elem, name, value );
  22956. }
  22957. // Attribute hooks are determined by the lowercase version
  22958. // Grab necessary hook if one is defined
  22959. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  22960. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  22961. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  22962. }
  22963. if ( value !== undefined ) {
  22964. if ( value === null ) {
  22965. jQuery.removeAttr( elem, name );
  22966. return;
  22967. }
  22968. if ( hooks && "set" in hooks &&
  22969. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  22970. return ret;
  22971. }
  22972. elem.setAttribute( name, value + "" );
  22973. return value;
  22974. }
  22975. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  22976. return ret;
  22977. }
  22978. ret = jQuery.find.attr( elem, name );
  22979. // Non-existent attributes return null, we normalize to undefined
  22980. return ret == null ? undefined : ret;
  22981. },
  22982. attrHooks: {
  22983. type: {
  22984. set: function( elem, value ) {
  22985. if ( !support.radioValue && value === "radio" &&
  22986. nodeName( elem, "input" ) ) {
  22987. var val = elem.value;
  22988. elem.setAttribute( "type", value );
  22989. if ( val ) {
  22990. elem.value = val;
  22991. }
  22992. return value;
  22993. }
  22994. }
  22995. }
  22996. },
  22997. removeAttr: function( elem, value ) {
  22998. var name,
  22999. i = 0,
  23000. // Attribute names can contain non-HTML whitespace characters
  23001. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  23002. attrNames = value && value.match( rnothtmlwhite );
  23003. if ( attrNames && elem.nodeType === 1 ) {
  23004. while ( ( name = attrNames[ i++ ] ) ) {
  23005. elem.removeAttribute( name );
  23006. }
  23007. }
  23008. }
  23009. } );
  23010. // Hooks for boolean attributes
  23011. boolHook = {
  23012. set: function( elem, value, name ) {
  23013. if ( value === false ) {
  23014. // Remove boolean attributes when set to false
  23015. jQuery.removeAttr( elem, name );
  23016. } else {
  23017. elem.setAttribute( name, name );
  23018. }
  23019. return name;
  23020. }
  23021. };
  23022. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  23023. var getter = attrHandle[ name ] || jQuery.find.attr;
  23024. attrHandle[ name ] = function( elem, name, isXML ) {
  23025. var ret, handle,
  23026. lowercaseName = name.toLowerCase();
  23027. if ( !isXML ) {
  23028. // Avoid an infinite loop by temporarily removing this function from the getter
  23029. handle = attrHandle[ lowercaseName ];
  23030. attrHandle[ lowercaseName ] = ret;
  23031. ret = getter( elem, name, isXML ) != null ?
  23032. lowercaseName :
  23033. null;
  23034. attrHandle[ lowercaseName ] = handle;
  23035. }
  23036. return ret;
  23037. };
  23038. } );
  23039. var rfocusable = /^(?:input|select|textarea|button)$/i,
  23040. rclickable = /^(?:a|area)$/i;
  23041. jQuery.fn.extend( {
  23042. prop: function( name, value ) {
  23043. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  23044. },
  23045. removeProp: function( name ) {
  23046. return this.each( function() {
  23047. delete this[ jQuery.propFix[ name ] || name ];
  23048. } );
  23049. }
  23050. } );
  23051. jQuery.extend( {
  23052. prop: function( elem, name, value ) {
  23053. var ret, hooks,
  23054. nType = elem.nodeType;
  23055. // Don't get/set properties on text, comment and attribute nodes
  23056. if ( nType === 3 || nType === 8 || nType === 2 ) {
  23057. return;
  23058. }
  23059. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  23060. // Fix name and attach hooks
  23061. name = jQuery.propFix[ name ] || name;
  23062. hooks = jQuery.propHooks[ name ];
  23063. }
  23064. if ( value !== undefined ) {
  23065. if ( hooks && "set" in hooks &&
  23066. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  23067. return ret;
  23068. }
  23069. return ( elem[ name ] = value );
  23070. }
  23071. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  23072. return ret;
  23073. }
  23074. return elem[ name ];
  23075. },
  23076. propHooks: {
  23077. tabIndex: {
  23078. get: function( elem ) {
  23079. // Support: IE <=9 - 11 only
  23080. // elem.tabIndex doesn't always return the
  23081. // correct value when it hasn't been explicitly set
  23082. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  23083. // Use proper attribute retrieval(#12072)
  23084. var tabindex = jQuery.find.attr( elem, "tabindex" );
  23085. if ( tabindex ) {
  23086. return parseInt( tabindex, 10 );
  23087. }
  23088. if (
  23089. rfocusable.test( elem.nodeName ) ||
  23090. rclickable.test( elem.nodeName ) &&
  23091. elem.href
  23092. ) {
  23093. return 0;
  23094. }
  23095. return -1;
  23096. }
  23097. }
  23098. },
  23099. propFix: {
  23100. "for": "htmlFor",
  23101. "class": "className"
  23102. }
  23103. } );
  23104. // Support: IE <=11 only
  23105. // Accessing the selectedIndex property
  23106. // forces the browser to respect setting selected
  23107. // on the option
  23108. // The getter ensures a default option is selected
  23109. // when in an optgroup
  23110. // eslint rule "no-unused-expressions" is disabled for this code
  23111. // since it considers such accessions noop
  23112. if ( !support.optSelected ) {
  23113. jQuery.propHooks.selected = {
  23114. get: function( elem ) {
  23115. /* eslint no-unused-expressions: "off" */
  23116. var parent = elem.parentNode;
  23117. if ( parent && parent.parentNode ) {
  23118. parent.parentNode.selectedIndex;
  23119. }
  23120. return null;
  23121. },
  23122. set: function( elem ) {
  23123. /* eslint no-unused-expressions: "off" */
  23124. var parent = elem.parentNode;
  23125. if ( parent ) {
  23126. parent.selectedIndex;
  23127. if ( parent.parentNode ) {
  23128. parent.parentNode.selectedIndex;
  23129. }
  23130. }
  23131. }
  23132. };
  23133. }
  23134. jQuery.each( [
  23135. "tabIndex",
  23136. "readOnly",
  23137. "maxLength",
  23138. "cellSpacing",
  23139. "cellPadding",
  23140. "rowSpan",
  23141. "colSpan",
  23142. "useMap",
  23143. "frameBorder",
  23144. "contentEditable"
  23145. ], function() {
  23146. jQuery.propFix[ this.toLowerCase() ] = this;
  23147. } );
  23148. // Strip and collapse whitespace according to HTML spec
  23149. // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
  23150. function stripAndCollapse( value ) {
  23151. var tokens = value.match( rnothtmlwhite ) || [];
  23152. return tokens.join( " " );
  23153. }
  23154. function getClass( elem ) {
  23155. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  23156. }
  23157. jQuery.fn.extend( {
  23158. addClass: function( value ) {
  23159. var classes, elem, cur, curValue, clazz, j, finalValue,
  23160. i = 0;
  23161. if ( jQuery.isFunction( value ) ) {
  23162. return this.each( function( j ) {
  23163. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  23164. } );
  23165. }
  23166. if ( typeof value === "string" && value ) {
  23167. classes = value.match( rnothtmlwhite ) || [];
  23168. while ( ( elem = this[ i++ ] ) ) {
  23169. curValue = getClass( elem );
  23170. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23171. if ( cur ) {
  23172. j = 0;
  23173. while ( ( clazz = classes[ j++ ] ) ) {
  23174. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  23175. cur += clazz + " ";
  23176. }
  23177. }
  23178. // Only assign if different to avoid unneeded rendering.
  23179. finalValue = stripAndCollapse( cur );
  23180. if ( curValue !== finalValue ) {
  23181. elem.setAttribute( "class", finalValue );
  23182. }
  23183. }
  23184. }
  23185. }
  23186. return this;
  23187. },
  23188. removeClass: function( value ) {
  23189. var classes, elem, cur, curValue, clazz, j, finalValue,
  23190. i = 0;
  23191. if ( jQuery.isFunction( value ) ) {
  23192. return this.each( function( j ) {
  23193. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  23194. } );
  23195. }
  23196. if ( !arguments.length ) {
  23197. return this.attr( "class", "" );
  23198. }
  23199. if ( typeof value === "string" && value ) {
  23200. classes = value.match( rnothtmlwhite ) || [];
  23201. while ( ( elem = this[ i++ ] ) ) {
  23202. curValue = getClass( elem );
  23203. // This expression is here for better compressibility (see addClass)
  23204. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23205. if ( cur ) {
  23206. j = 0;
  23207. while ( ( clazz = classes[ j++ ] ) ) {
  23208. // Remove *all* instances
  23209. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  23210. cur = cur.replace( " " + clazz + " ", " " );
  23211. }
  23212. }
  23213. // Only assign if different to avoid unneeded rendering.
  23214. finalValue = stripAndCollapse( cur );
  23215. if ( curValue !== finalValue ) {
  23216. elem.setAttribute( "class", finalValue );
  23217. }
  23218. }
  23219. }
  23220. }
  23221. return this;
  23222. },
  23223. toggleClass: function( value, stateVal ) {
  23224. var type = typeof value;
  23225. if ( typeof stateVal === "boolean" && type === "string" ) {
  23226. return stateVal ? this.addClass( value ) : this.removeClass( value );
  23227. }
  23228. if ( jQuery.isFunction( value ) ) {
  23229. return this.each( function( i ) {
  23230. jQuery( this ).toggleClass(
  23231. value.call( this, i, getClass( this ), stateVal ),
  23232. stateVal
  23233. );
  23234. } );
  23235. }
  23236. return this.each( function() {
  23237. var className, i, self, classNames;
  23238. if ( type === "string" ) {
  23239. // Toggle individual class names
  23240. i = 0;
  23241. self = jQuery( this );
  23242. classNames = value.match( rnothtmlwhite ) || [];
  23243. while ( ( className = classNames[ i++ ] ) ) {
  23244. // Check each className given, space separated list
  23245. if ( self.hasClass( className ) ) {
  23246. self.removeClass( className );
  23247. } else {
  23248. self.addClass( className );
  23249. }
  23250. }
  23251. // Toggle whole class name
  23252. } else if ( value === undefined || type === "boolean" ) {
  23253. className = getClass( this );
  23254. if ( className ) {
  23255. // Store className if set
  23256. dataPriv.set( this, "__className__", className );
  23257. }
  23258. // If the element has a class name or if we're passed `false`,
  23259. // then remove the whole classname (if there was one, the above saved it).
  23260. // Otherwise bring back whatever was previously saved (if anything),
  23261. // falling back to the empty string if nothing was stored.
  23262. if ( this.setAttribute ) {
  23263. this.setAttribute( "class",
  23264. className || value === false ?
  23265. "" :
  23266. dataPriv.get( this, "__className__" ) || ""
  23267. );
  23268. }
  23269. }
  23270. } );
  23271. },
  23272. hasClass: function( selector ) {
  23273. var className, elem,
  23274. i = 0;
  23275. className = " " + selector + " ";
  23276. while ( ( elem = this[ i++ ] ) ) {
  23277. if ( elem.nodeType === 1 &&
  23278. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  23279. return true;
  23280. }
  23281. }
  23282. return false;
  23283. }
  23284. } );
  23285. var rreturn = /\r/g;
  23286. jQuery.fn.extend( {
  23287. val: function( value ) {
  23288. var hooks, ret, isFunction,
  23289. elem = this[ 0 ];
  23290. if ( !arguments.length ) {
  23291. if ( elem ) {
  23292. hooks = jQuery.valHooks[ elem.type ] ||
  23293. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  23294. if ( hooks &&
  23295. "get" in hooks &&
  23296. ( ret = hooks.get( elem, "value" ) ) !== undefined
  23297. ) {
  23298. return ret;
  23299. }
  23300. ret = elem.value;
  23301. // Handle most common string cases
  23302. if ( typeof ret === "string" ) {
  23303. return ret.replace( rreturn, "" );
  23304. }
  23305. // Handle cases where value is null/undef or number
  23306. return ret == null ? "" : ret;
  23307. }
  23308. return;
  23309. }
  23310. isFunction = jQuery.isFunction( value );
  23311. return this.each( function( i ) {
  23312. var val;
  23313. if ( this.nodeType !== 1 ) {
  23314. return;
  23315. }
  23316. if ( isFunction ) {
  23317. val = value.call( this, i, jQuery( this ).val() );
  23318. } else {
  23319. val = value;
  23320. }
  23321. // Treat null/undefined as ""; convert numbers to string
  23322. if ( val == null ) {
  23323. val = "";
  23324. } else if ( typeof val === "number" ) {
  23325. val += "";
  23326. } else if ( Array.isArray( val ) ) {
  23327. val = jQuery.map( val, function( value ) {
  23328. return value == null ? "" : value + "";
  23329. } );
  23330. }
  23331. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  23332. // If set returns undefined, fall back to normal setting
  23333. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  23334. this.value = val;
  23335. }
  23336. } );
  23337. }
  23338. } );
  23339. jQuery.extend( {
  23340. valHooks: {
  23341. option: {
  23342. get: function( elem ) {
  23343. var val = jQuery.find.attr( elem, "value" );
  23344. return val != null ?
  23345. val :
  23346. // Support: IE <=10 - 11 only
  23347. // option.text throws exceptions (#14686, #14858)
  23348. // Strip and collapse whitespace
  23349. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  23350. stripAndCollapse( jQuery.text( elem ) );
  23351. }
  23352. },
  23353. select: {
  23354. get: function( elem ) {
  23355. var value, option, i,
  23356. options = elem.options,
  23357. index = elem.selectedIndex,
  23358. one = elem.type === "select-one",
  23359. values = one ? null : [],
  23360. max = one ? index + 1 : options.length;
  23361. if ( index < 0 ) {
  23362. i = max;
  23363. } else {
  23364. i = one ? index : 0;
  23365. }
  23366. // Loop through all the selected options
  23367. for ( ; i < max; i++ ) {
  23368. option = options[ i ];
  23369. // Support: IE <=9 only
  23370. // IE8-9 doesn't update selected after form reset (#2551)
  23371. if ( ( option.selected || i === index ) &&
  23372. // Don't return options that are disabled or in a disabled optgroup
  23373. !option.disabled &&
  23374. ( !option.parentNode.disabled ||
  23375. !nodeName( option.parentNode, "optgroup" ) ) ) {
  23376. // Get the specific value for the option
  23377. value = jQuery( option ).val();
  23378. // We don't need an array for one selects
  23379. if ( one ) {
  23380. return value;
  23381. }
  23382. // Multi-Selects return an array
  23383. values.push( value );
  23384. }
  23385. }
  23386. return values;
  23387. },
  23388. set: function( elem, value ) {
  23389. var optionSet, option,
  23390. options = elem.options,
  23391. values = jQuery.makeArray( value ),
  23392. i = options.length;
  23393. while ( i-- ) {
  23394. option = options[ i ];
  23395. /* eslint-disable no-cond-assign */
  23396. if ( option.selected =
  23397. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  23398. ) {
  23399. optionSet = true;
  23400. }
  23401. /* eslint-enable no-cond-assign */
  23402. }
  23403. // Force browsers to behave consistently when non-matching value is set
  23404. if ( !optionSet ) {
  23405. elem.selectedIndex = -1;
  23406. }
  23407. return values;
  23408. }
  23409. }
  23410. }
  23411. } );
  23412. // Radios and checkboxes getter/setter
  23413. jQuery.each( [ "radio", "checkbox" ], function() {
  23414. jQuery.valHooks[ this ] = {
  23415. set: function( elem, value ) {
  23416. if ( Array.isArray( value ) ) {
  23417. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  23418. }
  23419. }
  23420. };
  23421. if ( !support.checkOn ) {
  23422. jQuery.valHooks[ this ].get = function( elem ) {
  23423. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  23424. };
  23425. }
  23426. } );
  23427. // Return jQuery for attributes-only inclusion
  23428. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
  23429. jQuery.extend( jQuery.event, {
  23430. trigger: function( event, data, elem, onlyHandlers ) {
  23431. var i, cur, tmp, bubbleType, ontype, handle, special,
  23432. eventPath = [ elem || document ],
  23433. type = hasOwn.call( event, "type" ) ? event.type : event,
  23434. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  23435. cur = tmp = elem = elem || document;
  23436. // Don't do events on text and comment nodes
  23437. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  23438. return;
  23439. }
  23440. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  23441. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  23442. return;
  23443. }
  23444. if ( type.indexOf( "." ) > -1 ) {
  23445. // Namespaced trigger; create a regexp to match event type in handle()
  23446. namespaces = type.split( "." );
  23447. type = namespaces.shift();
  23448. namespaces.sort();
  23449. }
  23450. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  23451. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  23452. event = event[ jQuery.expando ] ?
  23453. event :
  23454. new jQuery.Event( type, typeof event === "object" && event );
  23455. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  23456. event.isTrigger = onlyHandlers ? 2 : 3;
  23457. event.namespace = namespaces.join( "." );
  23458. event.rnamespace = event.namespace ?
  23459. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  23460. null;
  23461. // Clean up the event in case it is being reused
  23462. event.result = undefined;
  23463. if ( !event.target ) {
  23464. event.target = elem;
  23465. }
  23466. // Clone any incoming data and prepend the event, creating the handler arg list
  23467. data = data == null ?
  23468. [ event ] :
  23469. jQuery.makeArray( data, [ event ] );
  23470. // Allow special events to draw outside the lines
  23471. special = jQuery.event.special[ type ] || {};
  23472. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  23473. return;
  23474. }
  23475. // Determine event propagation path in advance, per W3C events spec (#9951)
  23476. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  23477. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  23478. bubbleType = special.delegateType || type;
  23479. if ( !rfocusMorph.test( bubbleType + type ) ) {
  23480. cur = cur.parentNode;
  23481. }
  23482. for ( ; cur; cur = cur.parentNode ) {
  23483. eventPath.push( cur );
  23484. tmp = cur;
  23485. }
  23486. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  23487. if ( tmp === ( elem.ownerDocument || document ) ) {
  23488. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  23489. }
  23490. }
  23491. // Fire handlers on the event path
  23492. i = 0;
  23493. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  23494. event.type = i > 1 ?
  23495. bubbleType :
  23496. special.bindType || type;
  23497. // jQuery handler
  23498. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  23499. dataPriv.get( cur, "handle" );
  23500. if ( handle ) {
  23501. handle.apply( cur, data );
  23502. }
  23503. // Native handler
  23504. handle = ontype && cur[ ontype ];
  23505. if ( handle && handle.apply && acceptData( cur ) ) {
  23506. event.result = handle.apply( cur, data );
  23507. if ( event.result === false ) {
  23508. event.preventDefault();
  23509. }
  23510. }
  23511. }
  23512. event.type = type;
  23513. // If nobody prevented the default action, do it now
  23514. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  23515. if ( ( !special._default ||
  23516. special._default.apply( eventPath.pop(), data ) === false ) &&
  23517. acceptData( elem ) ) {
  23518. // Call a native DOM method on the target with the same name as the event.
  23519. // Don't do default actions on window, that's where global variables be (#6170)
  23520. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  23521. // Don't re-trigger an onFOO event when we call its FOO() method
  23522. tmp = elem[ ontype ];
  23523. if ( tmp ) {
  23524. elem[ ontype ] = null;
  23525. }
  23526. // Prevent re-triggering of the same event, since we already bubbled it above
  23527. jQuery.event.triggered = type;
  23528. elem[ type ]();
  23529. jQuery.event.triggered = undefined;
  23530. if ( tmp ) {
  23531. elem[ ontype ] = tmp;
  23532. }
  23533. }
  23534. }
  23535. }
  23536. return event.result;
  23537. },
  23538. // Piggyback on a donor event to simulate a different one
  23539. // Used only for `focus(in | out)` events
  23540. simulate: function( type, elem, event ) {
  23541. var e = jQuery.extend(
  23542. new jQuery.Event(),
  23543. event,
  23544. {
  23545. type: type,
  23546. isSimulated: true
  23547. }
  23548. );
  23549. jQuery.event.trigger( e, null, elem );
  23550. }
  23551. } );
  23552. jQuery.fn.extend( {
  23553. trigger: function( type, data ) {
  23554. return this.each( function() {
  23555. jQuery.event.trigger( type, data, this );
  23556. } );
  23557. },
  23558. triggerHandler: function( type, data ) {
  23559. var elem = this[ 0 ];
  23560. if ( elem ) {
  23561. return jQuery.event.trigger( type, data, elem, true );
  23562. }
  23563. }
  23564. } );
  23565. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  23566. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  23567. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  23568. function( i, name ) {
  23569. // Handle event binding
  23570. jQuery.fn[ name ] = function( data, fn ) {
  23571. return arguments.length > 0 ?
  23572. this.on( name, null, data, fn ) :
  23573. this.trigger( name );
  23574. };
  23575. } );
  23576. jQuery.fn.extend( {
  23577. hover: function( fnOver, fnOut ) {
  23578. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  23579. }
  23580. } );
  23581. support.focusin = "onfocusin" in window;
  23582. // Support: Firefox <=44
  23583. // Firefox doesn't have focus(in | out) events
  23584. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  23585. //
  23586. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  23587. // focus(in | out) events fire after focus & blur events,
  23588. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  23589. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  23590. if ( !support.focusin ) {
  23591. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  23592. // Attach a single capturing handler on the document while someone wants focusin/focusout
  23593. var handler = function( event ) {
  23594. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  23595. };
  23596. jQuery.event.special[ fix ] = {
  23597. setup: function() {
  23598. var doc = this.ownerDocument || this,
  23599. attaches = dataPriv.access( doc, fix );
  23600. if ( !attaches ) {
  23601. doc.addEventListener( orig, handler, true );
  23602. }
  23603. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  23604. },
  23605. teardown: function() {
  23606. var doc = this.ownerDocument || this,
  23607. attaches = dataPriv.access( doc, fix ) - 1;
  23608. if ( !attaches ) {
  23609. doc.removeEventListener( orig, handler, true );
  23610. dataPriv.remove( doc, fix );
  23611. } else {
  23612. dataPriv.access( doc, fix, attaches );
  23613. }
  23614. }
  23615. };
  23616. } );
  23617. }
  23618. var location = window.location;
  23619. var nonce = jQuery.now();
  23620. var rquery = ( /\?/ );
  23621. // Cross-browser xml parsing
  23622. jQuery.parseXML = function( data ) {
  23623. var xml;
  23624. if ( !data || typeof data !== "string" ) {
  23625. return null;
  23626. }
  23627. // Support: IE 9 - 11 only
  23628. // IE throws on parseFromString with invalid input.
  23629. try {
  23630. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  23631. } catch ( e ) {
  23632. xml = undefined;
  23633. }
  23634. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  23635. jQuery.error( "Invalid XML: " + data );
  23636. }
  23637. return xml;
  23638. };
  23639. var
  23640. rbracket = /\[\]$/,
  23641. rCRLF = /\r?\n/g,
  23642. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  23643. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  23644. function buildParams( prefix, obj, traditional, add ) {
  23645. var name;
  23646. if ( Array.isArray( obj ) ) {
  23647. // Serialize array item.
  23648. jQuery.each( obj, function( i, v ) {
  23649. if ( traditional || rbracket.test( prefix ) ) {
  23650. // Treat each array item as a scalar.
  23651. add( prefix, v );
  23652. } else {
  23653. // Item is non-scalar (array or object), encode its numeric index.
  23654. buildParams(
  23655. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  23656. v,
  23657. traditional,
  23658. add
  23659. );
  23660. }
  23661. } );
  23662. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  23663. // Serialize object item.
  23664. for ( name in obj ) {
  23665. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  23666. }
  23667. } else {
  23668. // Serialize scalar item.
  23669. add( prefix, obj );
  23670. }
  23671. }
  23672. // Serialize an array of form elements or a set of
  23673. // key/values into a query string
  23674. jQuery.param = function( a, traditional ) {
  23675. var prefix,
  23676. s = [],
  23677. add = function( key, valueOrFunction ) {
  23678. // If value is a function, invoke it and use its return value
  23679. var value = jQuery.isFunction( valueOrFunction ) ?
  23680. valueOrFunction() :
  23681. valueOrFunction;
  23682. s[ s.length ] = encodeURIComponent( key ) + "=" +
  23683. encodeURIComponent( value == null ? "" : value );
  23684. };
  23685. // If an array was passed in, assume that it is an array of form elements.
  23686. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  23687. // Serialize the form elements
  23688. jQuery.each( a, function() {
  23689. add( this.name, this.value );
  23690. } );
  23691. } else {
  23692. // If traditional, encode the "old" way (the way 1.3.2 or older
  23693. // did it), otherwise encode params recursively.
  23694. for ( prefix in a ) {
  23695. buildParams( prefix, a[ prefix ], traditional, add );
  23696. }
  23697. }
  23698. // Return the resulting serialization
  23699. return s.join( "&" );
  23700. };
  23701. jQuery.fn.extend( {
  23702. serialize: function() {
  23703. return jQuery.param( this.serializeArray() );
  23704. },
  23705. serializeArray: function() {
  23706. return this.map( function() {
  23707. // Can add propHook for "elements" to filter or add form elements
  23708. var elements = jQuery.prop( this, "elements" );
  23709. return elements ? jQuery.makeArray( elements ) : this;
  23710. } )
  23711. .filter( function() {
  23712. var type = this.type;
  23713. // Use .is( ":disabled" ) so that fieldset[disabled] works
  23714. return this.name && !jQuery( this ).is( ":disabled" ) &&
  23715. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  23716. ( this.checked || !rcheckableType.test( type ) );
  23717. } )
  23718. .map( function( i, elem ) {
  23719. var val = jQuery( this ).val();
  23720. if ( val == null ) {
  23721. return null;
  23722. }
  23723. if ( Array.isArray( val ) ) {
  23724. return jQuery.map( val, function( val ) {
  23725. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  23726. } );
  23727. }
  23728. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  23729. } ).get();
  23730. }
  23731. } );
  23732. var
  23733. r20 = /%20/g,
  23734. rhash = /#.*$/,
  23735. rantiCache = /([?&])_=[^&]*/,
  23736. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  23737. // #7653, #8125, #8152: local protocol detection
  23738. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  23739. rnoContent = /^(?:GET|HEAD)$/,
  23740. rprotocol = /^\/\//,
  23741. /* Prefilters
  23742. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  23743. * 2) These are called:
  23744. * - BEFORE asking for a transport
  23745. * - AFTER param serialization (s.data is a string if s.processData is true)
  23746. * 3) key is the dataType
  23747. * 4) the catchall symbol "*" can be used
  23748. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  23749. */
  23750. prefilters = {},
  23751. /* Transports bindings
  23752. * 1) key is the dataType
  23753. * 2) the catchall symbol "*" can be used
  23754. * 3) selection will start with transport dataType and THEN go to "*" if needed
  23755. */
  23756. transports = {},
  23757. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  23758. allTypes = "*/".concat( "*" ),
  23759. // Anchor tag for parsing the document origin
  23760. originAnchor = document.createElement( "a" );
  23761. originAnchor.href = location.href;
  23762. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  23763. function addToPrefiltersOrTransports( structure ) {
  23764. // dataTypeExpression is optional and defaults to "*"
  23765. return function( dataTypeExpression, func ) {
  23766. if ( typeof dataTypeExpression !== "string" ) {
  23767. func = dataTypeExpression;
  23768. dataTypeExpression = "*";
  23769. }
  23770. var dataType,
  23771. i = 0,
  23772. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  23773. if ( jQuery.isFunction( func ) ) {
  23774. // For each dataType in the dataTypeExpression
  23775. while ( ( dataType = dataTypes[ i++ ] ) ) {
  23776. // Prepend if requested
  23777. if ( dataType[ 0 ] === "+" ) {
  23778. dataType = dataType.slice( 1 ) || "*";
  23779. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  23780. // Otherwise append
  23781. } else {
  23782. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  23783. }
  23784. }
  23785. }
  23786. };
  23787. }
  23788. // Base inspection function for prefilters and transports
  23789. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  23790. var inspected = {},
  23791. seekingTransport = ( structure === transports );
  23792. function inspect( dataType ) {
  23793. var selected;
  23794. inspected[ dataType ] = true;
  23795. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  23796. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  23797. if ( typeof dataTypeOrTransport === "string" &&
  23798. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  23799. options.dataTypes.unshift( dataTypeOrTransport );
  23800. inspect( dataTypeOrTransport );
  23801. return false;
  23802. } else if ( seekingTransport ) {
  23803. return !( selected = dataTypeOrTransport );
  23804. }
  23805. } );
  23806. return selected;
  23807. }
  23808. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  23809. }
  23810. // A special extend for ajax options
  23811. // that takes "flat" options (not to be deep extended)
  23812. // Fixes #9887
  23813. function ajaxExtend( target, src ) {
  23814. var key, deep,
  23815. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  23816. for ( key in src ) {
  23817. if ( src[ key ] !== undefined ) {
  23818. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  23819. }
  23820. }
  23821. if ( deep ) {
  23822. jQuery.extend( true, target, deep );
  23823. }
  23824. return target;
  23825. }
  23826. /* Handles responses to an ajax request:
  23827. * - finds the right dataType (mediates between content-type and expected dataType)
  23828. * - returns the corresponding response
  23829. */
  23830. function ajaxHandleResponses( s, jqXHR, responses ) {
  23831. var ct, type, finalDataType, firstDataType,
  23832. contents = s.contents,
  23833. dataTypes = s.dataTypes;
  23834. // Remove auto dataType and get content-type in the process
  23835. while ( dataTypes[ 0 ] === "*" ) {
  23836. dataTypes.shift();
  23837. if ( ct === undefined ) {
  23838. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  23839. }
  23840. }
  23841. // Check if we're dealing with a known content-type
  23842. if ( ct ) {
  23843. for ( type in contents ) {
  23844. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  23845. dataTypes.unshift( type );
  23846. break;
  23847. }
  23848. }
  23849. }
  23850. // Check to see if we have a response for the expected dataType
  23851. if ( dataTypes[ 0 ] in responses ) {
  23852. finalDataType = dataTypes[ 0 ];
  23853. } else {
  23854. // Try convertible dataTypes
  23855. for ( type in responses ) {
  23856. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  23857. finalDataType = type;
  23858. break;
  23859. }
  23860. if ( !firstDataType ) {
  23861. firstDataType = type;
  23862. }
  23863. }
  23864. // Or just use first one
  23865. finalDataType = finalDataType || firstDataType;
  23866. }
  23867. // If we found a dataType
  23868. // We add the dataType to the list if needed
  23869. // and return the corresponding response
  23870. if ( finalDataType ) {
  23871. if ( finalDataType !== dataTypes[ 0 ] ) {
  23872. dataTypes.unshift( finalDataType );
  23873. }
  23874. return responses[ finalDataType ];
  23875. }
  23876. }
  23877. /* Chain conversions given the request and the original response
  23878. * Also sets the responseXXX fields on the jqXHR instance
  23879. */
  23880. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  23881. var conv2, current, conv, tmp, prev,
  23882. converters = {},
  23883. // Work with a copy of dataTypes in case we need to modify it for conversion
  23884. dataTypes = s.dataTypes.slice();
  23885. // Create converters map with lowercased keys
  23886. if ( dataTypes[ 1 ] ) {
  23887. for ( conv in s.converters ) {
  23888. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  23889. }
  23890. }
  23891. current = dataTypes.shift();
  23892. // Convert to each sequential dataType
  23893. while ( current ) {
  23894. if ( s.responseFields[ current ] ) {
  23895. jqXHR[ s.responseFields[ current ] ] = response;
  23896. }
  23897. // Apply the dataFilter if provided
  23898. if ( !prev && isSuccess && s.dataFilter ) {
  23899. response = s.dataFilter( response, s.dataType );
  23900. }
  23901. prev = current;
  23902. current = dataTypes.shift();
  23903. if ( current ) {
  23904. // There's only work to do if current dataType is non-auto
  23905. if ( current === "*" ) {
  23906. current = prev;
  23907. // Convert response if prev dataType is non-auto and differs from current
  23908. } else if ( prev !== "*" && prev !== current ) {
  23909. // Seek a direct converter
  23910. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  23911. // If none found, seek a pair
  23912. if ( !conv ) {
  23913. for ( conv2 in converters ) {
  23914. // If conv2 outputs current
  23915. tmp = conv2.split( " " );
  23916. if ( tmp[ 1 ] === current ) {
  23917. // If prev can be converted to accepted input
  23918. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  23919. converters[ "* " + tmp[ 0 ] ];
  23920. if ( conv ) {
  23921. // Condense equivalence converters
  23922. if ( conv === true ) {
  23923. conv = converters[ conv2 ];
  23924. // Otherwise, insert the intermediate dataType
  23925. } else if ( converters[ conv2 ] !== true ) {
  23926. current = tmp[ 0 ];
  23927. dataTypes.unshift( tmp[ 1 ] );
  23928. }
  23929. break;
  23930. }
  23931. }
  23932. }
  23933. }
  23934. // Apply converter (if not an equivalence)
  23935. if ( conv !== true ) {
  23936. // Unless errors are allowed to bubble, catch and return them
  23937. if ( conv && s.throws ) {
  23938. response = conv( response );
  23939. } else {
  23940. try {
  23941. response = conv( response );
  23942. } catch ( e ) {
  23943. return {
  23944. state: "parsererror",
  23945. error: conv ? e : "No conversion from " + prev + " to " + current
  23946. };
  23947. }
  23948. }
  23949. }
  23950. }
  23951. }
  23952. }
  23953. return { state: "success", data: response };
  23954. }
  23955. jQuery.extend( {
  23956. // Counter for holding the number of active queries
  23957. active: 0,
  23958. // Last-Modified header cache for next request
  23959. lastModified: {},
  23960. etag: {},
  23961. ajaxSettings: {
  23962. url: location.href,
  23963. type: "GET",
  23964. isLocal: rlocalProtocol.test( location.protocol ),
  23965. global: true,
  23966. processData: true,
  23967. async: true,
  23968. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  23969. /*
  23970. timeout: 0,
  23971. data: null,
  23972. dataType: null,
  23973. username: null,
  23974. password: null,
  23975. cache: null,
  23976. throws: false,
  23977. traditional: false,
  23978. headers: {},
  23979. */
  23980. accepts: {
  23981. "*": allTypes,
  23982. text: "text/plain",
  23983. html: "text/html",
  23984. xml: "application/xml, text/xml",
  23985. json: "application/json, text/javascript"
  23986. },
  23987. contents: {
  23988. xml: /\bxml\b/,
  23989. html: /\bhtml/,
  23990. json: /\bjson\b/
  23991. },
  23992. responseFields: {
  23993. xml: "responseXML",
  23994. text: "responseText",
  23995. json: "responseJSON"
  23996. },
  23997. // Data converters
  23998. // Keys separate source (or catchall "*") and destination types with a single space
  23999. converters: {
  24000. // Convert anything to text
  24001. "* text": String,
  24002. // Text to html (true = no transformation)
  24003. "text html": true,
  24004. // Evaluate text as a json expression
  24005. "text json": JSON.parse,
  24006. // Parse text as xml
  24007. "text xml": jQuery.parseXML
  24008. },
  24009. // For options that shouldn't be deep extended:
  24010. // you can add your own custom options here if
  24011. // and when you create one that shouldn't be
  24012. // deep extended (see ajaxExtend)
  24013. flatOptions: {
  24014. url: true,
  24015. context: true
  24016. }
  24017. },
  24018. // Creates a full fledged settings object into target
  24019. // with both ajaxSettings and settings fields.
  24020. // If target is omitted, writes into ajaxSettings.
  24021. ajaxSetup: function( target, settings ) {
  24022. return settings ?
  24023. // Building a settings object
  24024. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  24025. // Extending ajaxSettings
  24026. ajaxExtend( jQuery.ajaxSettings, target );
  24027. },
  24028. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  24029. ajaxTransport: addToPrefiltersOrTransports( transports ),
  24030. // Main method
  24031. ajax: function( url, options ) {
  24032. // If url is an object, simulate pre-1.5 signature
  24033. if ( typeof url === "object" ) {
  24034. options = url;
  24035. url = undefined;
  24036. }
  24037. // Force options to be an object
  24038. options = options || {};
  24039. var transport,
  24040. // URL without anti-cache param
  24041. cacheURL,
  24042. // Response headers
  24043. responseHeadersString,
  24044. responseHeaders,
  24045. // timeout handle
  24046. timeoutTimer,
  24047. // Url cleanup var
  24048. urlAnchor,
  24049. // Request state (becomes false upon send and true upon completion)
  24050. completed,
  24051. // To know if global events are to be dispatched
  24052. fireGlobals,
  24053. // Loop variable
  24054. i,
  24055. // uncached part of the url
  24056. uncached,
  24057. // Create the final options object
  24058. s = jQuery.ajaxSetup( {}, options ),
  24059. // Callbacks context
  24060. callbackContext = s.context || s,
  24061. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  24062. globalEventContext = s.context &&
  24063. ( callbackContext.nodeType || callbackContext.jquery ) ?
  24064. jQuery( callbackContext ) :
  24065. jQuery.event,
  24066. // Deferreds
  24067. deferred = jQuery.Deferred(),
  24068. completeDeferred = jQuery.Callbacks( "once memory" ),
  24069. // Status-dependent callbacks
  24070. statusCode = s.statusCode || {},
  24071. // Headers (they are sent all at once)
  24072. requestHeaders = {},
  24073. requestHeadersNames = {},
  24074. // Default abort message
  24075. strAbort = "canceled",
  24076. // Fake xhr
  24077. jqXHR = {
  24078. readyState: 0,
  24079. // Builds headers hashtable if needed
  24080. getResponseHeader: function( key ) {
  24081. var match;
  24082. if ( completed ) {
  24083. if ( !responseHeaders ) {
  24084. responseHeaders = {};
  24085. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  24086. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  24087. }
  24088. }
  24089. match = responseHeaders[ key.toLowerCase() ];
  24090. }
  24091. return match == null ? null : match;
  24092. },
  24093. // Raw string
  24094. getAllResponseHeaders: function() {
  24095. return completed ? responseHeadersString : null;
  24096. },
  24097. // Caches the header
  24098. setRequestHeader: function( name, value ) {
  24099. if ( completed == null ) {
  24100. name = requestHeadersNames[ name.toLowerCase() ] =
  24101. requestHeadersNames[ name.toLowerCase() ] || name;
  24102. requestHeaders[ name ] = value;
  24103. }
  24104. return this;
  24105. },
  24106. // Overrides response content-type header
  24107. overrideMimeType: function( type ) {
  24108. if ( completed == null ) {
  24109. s.mimeType = type;
  24110. }
  24111. return this;
  24112. },
  24113. // Status-dependent callbacks
  24114. statusCode: function( map ) {
  24115. var code;
  24116. if ( map ) {
  24117. if ( completed ) {
  24118. // Execute the appropriate callbacks
  24119. jqXHR.always( map[ jqXHR.status ] );
  24120. } else {
  24121. // Lazy-add the new callbacks in a way that preserves old ones
  24122. for ( code in map ) {
  24123. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  24124. }
  24125. }
  24126. }
  24127. return this;
  24128. },
  24129. // Cancel the request
  24130. abort: function( statusText ) {
  24131. var finalText = statusText || strAbort;
  24132. if ( transport ) {
  24133. transport.abort( finalText );
  24134. }
  24135. done( 0, finalText );
  24136. return this;
  24137. }
  24138. };
  24139. // Attach deferreds
  24140. deferred.promise( jqXHR );
  24141. // Add protocol if not provided (prefilters might expect it)
  24142. // Handle falsy url in the settings object (#10093: consistency with old signature)
  24143. // We also use the url parameter if available
  24144. s.url = ( ( url || s.url || location.href ) + "" )
  24145. .replace( rprotocol, location.protocol + "//" );
  24146. // Alias method option to type as per ticket #12004
  24147. s.type = options.method || options.type || s.method || s.type;
  24148. // Extract dataTypes list
  24149. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  24150. // A cross-domain request is in order when the origin doesn't match the current origin.
  24151. if ( s.crossDomain == null ) {
  24152. urlAnchor = document.createElement( "a" );
  24153. // Support: IE <=8 - 11, Edge 12 - 13
  24154. // IE throws exception on accessing the href property if url is malformed,
  24155. // e.g. http://example.com:80x/
  24156. try {
  24157. urlAnchor.href = s.url;
  24158. // Support: IE <=8 - 11 only
  24159. // Anchor's host property isn't correctly set when s.url is relative
  24160. urlAnchor.href = urlAnchor.href;
  24161. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  24162. urlAnchor.protocol + "//" + urlAnchor.host;
  24163. } catch ( e ) {
  24164. // If there is an error parsing the URL, assume it is crossDomain,
  24165. // it can be rejected by the transport if it is invalid
  24166. s.crossDomain = true;
  24167. }
  24168. }
  24169. // Convert data if not already a string
  24170. if ( s.data && s.processData && typeof s.data !== "string" ) {
  24171. s.data = jQuery.param( s.data, s.traditional );
  24172. }
  24173. // Apply prefilters
  24174. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  24175. // If request was aborted inside a prefilter, stop there
  24176. if ( completed ) {
  24177. return jqXHR;
  24178. }
  24179. // We can fire global events as of now if asked to
  24180. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  24181. fireGlobals = jQuery.event && s.global;
  24182. // Watch for a new set of requests
  24183. if ( fireGlobals && jQuery.active++ === 0 ) {
  24184. jQuery.event.trigger( "ajaxStart" );
  24185. }
  24186. // Uppercase the type
  24187. s.type = s.type.toUpperCase();
  24188. // Determine if request has content
  24189. s.hasContent = !rnoContent.test( s.type );
  24190. // Save the URL in case we're toying with the If-Modified-Since
  24191. // and/or If-None-Match header later on
  24192. // Remove hash to simplify url manipulation
  24193. cacheURL = s.url.replace( rhash, "" );
  24194. // More options handling for requests with no content
  24195. if ( !s.hasContent ) {
  24196. // Remember the hash so we can put it back
  24197. uncached = s.url.slice( cacheURL.length );
  24198. // If data is available, append data to url
  24199. if ( s.data ) {
  24200. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  24201. // #9682: remove data so that it's not used in an eventual retry
  24202. delete s.data;
  24203. }
  24204. // Add or update anti-cache param if needed
  24205. if ( s.cache === false ) {
  24206. cacheURL = cacheURL.replace( rantiCache, "$1" );
  24207. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  24208. }
  24209. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  24210. s.url = cacheURL + uncached;
  24211. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  24212. } else if ( s.data && s.processData &&
  24213. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  24214. s.data = s.data.replace( r20, "+" );
  24215. }
  24216. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24217. if ( s.ifModified ) {
  24218. if ( jQuery.lastModified[ cacheURL ] ) {
  24219. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  24220. }
  24221. if ( jQuery.etag[ cacheURL ] ) {
  24222. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  24223. }
  24224. }
  24225. // Set the correct header, if data is being sent
  24226. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  24227. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  24228. }
  24229. // Set the Accepts header for the server, depending on the dataType
  24230. jqXHR.setRequestHeader(
  24231. "Accept",
  24232. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  24233. s.accepts[ s.dataTypes[ 0 ] ] +
  24234. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  24235. s.accepts[ "*" ]
  24236. );
  24237. // Check for headers option
  24238. for ( i in s.headers ) {
  24239. jqXHR.setRequestHeader( i, s.headers[ i ] );
  24240. }
  24241. // Allow custom headers/mimetypes and early abort
  24242. if ( s.beforeSend &&
  24243. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  24244. // Abort if not done already and return
  24245. return jqXHR.abort();
  24246. }
  24247. // Aborting is no longer a cancellation
  24248. strAbort = "abort";
  24249. // Install callbacks on deferreds
  24250. completeDeferred.add( s.complete );
  24251. jqXHR.done( s.success );
  24252. jqXHR.fail( s.error );
  24253. // Get transport
  24254. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  24255. // If no transport, we auto-abort
  24256. if ( !transport ) {
  24257. done( -1, "No Transport" );
  24258. } else {
  24259. jqXHR.readyState = 1;
  24260. // Send global event
  24261. if ( fireGlobals ) {
  24262. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  24263. }
  24264. // If request was aborted inside ajaxSend, stop there
  24265. if ( completed ) {
  24266. return jqXHR;
  24267. }
  24268. // Timeout
  24269. if ( s.async && s.timeout > 0 ) {
  24270. timeoutTimer = window.setTimeout( function() {
  24271. jqXHR.abort( "timeout" );
  24272. }, s.timeout );
  24273. }
  24274. try {
  24275. completed = false;
  24276. transport.send( requestHeaders, done );
  24277. } catch ( e ) {
  24278. // Rethrow post-completion exceptions
  24279. if ( completed ) {
  24280. throw e;
  24281. }
  24282. // Propagate others as results
  24283. done( -1, e );
  24284. }
  24285. }
  24286. // Callback for when everything is done
  24287. function done( status, nativeStatusText, responses, headers ) {
  24288. var isSuccess, success, error, response, modified,
  24289. statusText = nativeStatusText;
  24290. // Ignore repeat invocations
  24291. if ( completed ) {
  24292. return;
  24293. }
  24294. completed = true;
  24295. // Clear timeout if it exists
  24296. if ( timeoutTimer ) {
  24297. window.clearTimeout( timeoutTimer );
  24298. }
  24299. // Dereference transport for early garbage collection
  24300. // (no matter how long the jqXHR object will be used)
  24301. transport = undefined;
  24302. // Cache response headers
  24303. responseHeadersString = headers || "";
  24304. // Set readyState
  24305. jqXHR.readyState = status > 0 ? 4 : 0;
  24306. // Determine if successful
  24307. isSuccess = status >= 200 && status < 300 || status === 304;
  24308. // Get response data
  24309. if ( responses ) {
  24310. response = ajaxHandleResponses( s, jqXHR, responses );
  24311. }
  24312. // Convert no matter what (that way responseXXX fields are always set)
  24313. response = ajaxConvert( s, response, jqXHR, isSuccess );
  24314. // If successful, handle type chaining
  24315. if ( isSuccess ) {
  24316. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24317. if ( s.ifModified ) {
  24318. modified = jqXHR.getResponseHeader( "Last-Modified" );
  24319. if ( modified ) {
  24320. jQuery.lastModified[ cacheURL ] = modified;
  24321. }
  24322. modified = jqXHR.getResponseHeader( "etag" );
  24323. if ( modified ) {
  24324. jQuery.etag[ cacheURL ] = modified;
  24325. }
  24326. }
  24327. // if no content
  24328. if ( status === 204 || s.type === "HEAD" ) {
  24329. statusText = "nocontent";
  24330. // if not modified
  24331. } else if ( status === 304 ) {
  24332. statusText = "notmodified";
  24333. // If we have data, let's convert it
  24334. } else {
  24335. statusText = response.state;
  24336. success = response.data;
  24337. error = response.error;
  24338. isSuccess = !error;
  24339. }
  24340. } else {
  24341. // Extract error from statusText and normalize for non-aborts
  24342. error = statusText;
  24343. if ( status || !statusText ) {
  24344. statusText = "error";
  24345. if ( status < 0 ) {
  24346. status = 0;
  24347. }
  24348. }
  24349. }
  24350. // Set data for the fake xhr object
  24351. jqXHR.status = status;
  24352. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  24353. // Success/Error
  24354. if ( isSuccess ) {
  24355. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  24356. } else {
  24357. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  24358. }
  24359. // Status-dependent callbacks
  24360. jqXHR.statusCode( statusCode );
  24361. statusCode = undefined;
  24362. if ( fireGlobals ) {
  24363. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  24364. [ jqXHR, s, isSuccess ? success : error ] );
  24365. }
  24366. // Complete
  24367. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  24368. if ( fireGlobals ) {
  24369. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  24370. // Handle the global AJAX counter
  24371. if ( !( --jQuery.active ) ) {
  24372. jQuery.event.trigger( "ajaxStop" );
  24373. }
  24374. }
  24375. }
  24376. return jqXHR;
  24377. },
  24378. getJSON: function( url, data, callback ) {
  24379. return jQuery.get( url, data, callback, "json" );
  24380. },
  24381. getScript: function( url, callback ) {
  24382. return jQuery.get( url, undefined, callback, "script" );
  24383. }
  24384. } );
  24385. jQuery.each( [ "get", "post" ], function( i, method ) {
  24386. jQuery[ method ] = function( url, data, callback, type ) {
  24387. // Shift arguments if data argument was omitted
  24388. if ( jQuery.isFunction( data ) ) {
  24389. type = type || callback;
  24390. callback = data;
  24391. data = undefined;
  24392. }
  24393. // The url can be an options object (which then must have .url)
  24394. return jQuery.ajax( jQuery.extend( {
  24395. url: url,
  24396. type: method,
  24397. dataType: type,
  24398. data: data,
  24399. success: callback
  24400. }, jQuery.isPlainObject( url ) && url ) );
  24401. };
  24402. } );
  24403. jQuery._evalUrl = function( url ) {
  24404. return jQuery.ajax( {
  24405. url: url,
  24406. // Make this explicit, since user can override this through ajaxSetup (#11264)
  24407. type: "GET",
  24408. dataType: "script",
  24409. cache: true,
  24410. async: false,
  24411. global: false,
  24412. "throws": true
  24413. } );
  24414. };
  24415. jQuery.fn.extend( {
  24416. wrapAll: function( html ) {
  24417. var wrap;
  24418. if ( this[ 0 ] ) {
  24419. if ( jQuery.isFunction( html ) ) {
  24420. html = html.call( this[ 0 ] );
  24421. }
  24422. // The elements to wrap the target around
  24423. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  24424. if ( this[ 0 ].parentNode ) {
  24425. wrap.insertBefore( this[ 0 ] );
  24426. }
  24427. wrap.map( function() {
  24428. var elem = this;
  24429. while ( elem.firstElementChild ) {
  24430. elem = elem.firstElementChild;
  24431. }
  24432. return elem;
  24433. } ).append( this );
  24434. }
  24435. return this;
  24436. },
  24437. wrapInner: function( html ) {
  24438. if ( jQuery.isFunction( html ) ) {
  24439. return this.each( function( i ) {
  24440. jQuery( this ).wrapInner( html.call( this, i ) );
  24441. } );
  24442. }
  24443. return this.each( function() {
  24444. var self = jQuery( this ),
  24445. contents = self.contents();
  24446. if ( contents.length ) {
  24447. contents.wrapAll( html );
  24448. } else {
  24449. self.append( html );
  24450. }
  24451. } );
  24452. },
  24453. wrap: function( html ) {
  24454. var isFunction = jQuery.isFunction( html );
  24455. return this.each( function( i ) {
  24456. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  24457. } );
  24458. },
  24459. unwrap: function( selector ) {
  24460. this.parent( selector ).not( "body" ).each( function() {
  24461. jQuery( this ).replaceWith( this.childNodes );
  24462. } );
  24463. return this;
  24464. }
  24465. } );
  24466. jQuery.expr.pseudos.hidden = function( elem ) {
  24467. return !jQuery.expr.pseudos.visible( elem );
  24468. };
  24469. jQuery.expr.pseudos.visible = function( elem ) {
  24470. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  24471. };
  24472. jQuery.ajaxSettings.xhr = function() {
  24473. try {
  24474. return new window.XMLHttpRequest();
  24475. } catch ( e ) {}
  24476. };
  24477. var xhrSuccessStatus = {
  24478. // File protocol always yields status code 0, assume 200
  24479. 0: 200,
  24480. // Support: IE <=9 only
  24481. // #1450: sometimes IE returns 1223 when it should be 204
  24482. 1223: 204
  24483. },
  24484. xhrSupported = jQuery.ajaxSettings.xhr();
  24485. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  24486. support.ajax = xhrSupported = !!xhrSupported;
  24487. jQuery.ajaxTransport( function( options ) {
  24488. var callback, errorCallback;
  24489. // Cross domain only allowed if supported through XMLHttpRequest
  24490. if ( support.cors || xhrSupported && !options.crossDomain ) {
  24491. return {
  24492. send: function( headers, complete ) {
  24493. var i,
  24494. xhr = options.xhr();
  24495. xhr.open(
  24496. options.type,
  24497. options.url,
  24498. options.async,
  24499. options.username,
  24500. options.password
  24501. );
  24502. // Apply custom fields if provided
  24503. if ( options.xhrFields ) {
  24504. for ( i in options.xhrFields ) {
  24505. xhr[ i ] = options.xhrFields[ i ];
  24506. }
  24507. }
  24508. // Override mime type if needed
  24509. if ( options.mimeType && xhr.overrideMimeType ) {
  24510. xhr.overrideMimeType( options.mimeType );
  24511. }
  24512. // X-Requested-With header
  24513. // For cross-domain requests, seeing as conditions for a preflight are
  24514. // akin to a jigsaw puzzle, we simply never set it to be sure.
  24515. // (it can always be set on a per-request basis or even using ajaxSetup)
  24516. // For same-domain requests, won't change header if already provided.
  24517. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  24518. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  24519. }
  24520. // Set headers
  24521. for ( i in headers ) {
  24522. xhr.setRequestHeader( i, headers[ i ] );
  24523. }
  24524. // Callback
  24525. callback = function( type ) {
  24526. return function() {
  24527. if ( callback ) {
  24528. callback = errorCallback = xhr.onload =
  24529. xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
  24530. if ( type === "abort" ) {
  24531. xhr.abort();
  24532. } else if ( type === "error" ) {
  24533. // Support: IE <=9 only
  24534. // On a manual native abort, IE9 throws
  24535. // errors on any property access that is not readyState
  24536. if ( typeof xhr.status !== "number" ) {
  24537. complete( 0, "error" );
  24538. } else {
  24539. complete(
  24540. // File: protocol always yields status 0; see #8605, #14207
  24541. xhr.status,
  24542. xhr.statusText
  24543. );
  24544. }
  24545. } else {
  24546. complete(
  24547. xhrSuccessStatus[ xhr.status ] || xhr.status,
  24548. xhr.statusText,
  24549. // Support: IE <=9 only
  24550. // IE9 has no XHR2 but throws on binary (trac-11426)
  24551. // For XHR2 non-text, let the caller handle it (gh-2498)
  24552. ( xhr.responseType || "text" ) !== "text" ||
  24553. typeof xhr.responseText !== "string" ?
  24554. { binary: xhr.response } :
  24555. { text: xhr.responseText },
  24556. xhr.getAllResponseHeaders()
  24557. );
  24558. }
  24559. }
  24560. };
  24561. };
  24562. // Listen to events
  24563. xhr.onload = callback();
  24564. errorCallback = xhr.onerror = callback( "error" );
  24565. // Support: IE 9 only
  24566. // Use onreadystatechange to replace onabort
  24567. // to handle uncaught aborts
  24568. if ( xhr.onabort !== undefined ) {
  24569. xhr.onabort = errorCallback;
  24570. } else {
  24571. xhr.onreadystatechange = function() {
  24572. // Check readyState before timeout as it changes
  24573. if ( xhr.readyState === 4 ) {
  24574. // Allow onerror to be called first,
  24575. // but that will not handle a native abort
  24576. // Also, save errorCallback to a variable
  24577. // as xhr.onerror cannot be accessed
  24578. window.setTimeout( function() {
  24579. if ( callback ) {
  24580. errorCallback();
  24581. }
  24582. } );
  24583. }
  24584. };
  24585. }
  24586. // Create the abort callback
  24587. callback = callback( "abort" );
  24588. try {
  24589. // Do send the request (this may raise an exception)
  24590. xhr.send( options.hasContent && options.data || null );
  24591. } catch ( e ) {
  24592. // #14683: Only rethrow if this hasn't been notified as an error yet
  24593. if ( callback ) {
  24594. throw e;
  24595. }
  24596. }
  24597. },
  24598. abort: function() {
  24599. if ( callback ) {
  24600. callback();
  24601. }
  24602. }
  24603. };
  24604. }
  24605. } );
  24606. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  24607. jQuery.ajaxPrefilter( function( s ) {
  24608. if ( s.crossDomain ) {
  24609. s.contents.script = false;
  24610. }
  24611. } );
  24612. // Install script dataType
  24613. jQuery.ajaxSetup( {
  24614. accepts: {
  24615. script: "text/javascript, application/javascript, " +
  24616. "application/ecmascript, application/x-ecmascript"
  24617. },
  24618. contents: {
  24619. script: /\b(?:java|ecma)script\b/
  24620. },
  24621. converters: {
  24622. "text script": function( text ) {
  24623. jQuery.globalEval( text );
  24624. return text;
  24625. }
  24626. }
  24627. } );
  24628. // Handle cache's special case and crossDomain
  24629. jQuery.ajaxPrefilter( "script", function( s ) {
  24630. if ( s.cache === undefined ) {
  24631. s.cache = false;
  24632. }
  24633. if ( s.crossDomain ) {
  24634. s.type = "GET";
  24635. }
  24636. } );
  24637. // Bind script tag hack transport
  24638. jQuery.ajaxTransport( "script", function( s ) {
  24639. // This transport only deals with cross domain requests
  24640. if ( s.crossDomain ) {
  24641. var script, callback;
  24642. return {
  24643. send: function( _, complete ) {
  24644. script = jQuery( "<script>" ).prop( {
  24645. charset: s.scriptCharset,
  24646. src: s.url
  24647. } ).on(
  24648. "load error",
  24649. callback = function( evt ) {
  24650. script.remove();
  24651. callback = null;
  24652. if ( evt ) {
  24653. complete( evt.type === "error" ? 404 : 200, evt.type );
  24654. }
  24655. }
  24656. );
  24657. // Use native DOM manipulation to avoid our domManip AJAX trickery
  24658. document.head.appendChild( script[ 0 ] );
  24659. },
  24660. abort: function() {
  24661. if ( callback ) {
  24662. callback();
  24663. }
  24664. }
  24665. };
  24666. }
  24667. } );
  24668. var oldCallbacks = [],
  24669. rjsonp = /(=)\?(?=&|$)|\?\?/;
  24670. // Default jsonp settings
  24671. jQuery.ajaxSetup( {
  24672. jsonp: "callback",
  24673. jsonpCallback: function() {
  24674. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  24675. this[ callback ] = true;
  24676. return callback;
  24677. }
  24678. } );
  24679. // Detect, normalize options and install callbacks for jsonp requests
  24680. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  24681. var callbackName, overwritten, responseContainer,
  24682. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  24683. "url" :
  24684. typeof s.data === "string" &&
  24685. ( s.contentType || "" )
  24686. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  24687. rjsonp.test( s.data ) && "data"
  24688. );
  24689. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  24690. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  24691. // Get callback name, remembering preexisting value associated with it
  24692. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  24693. s.jsonpCallback() :
  24694. s.jsonpCallback;
  24695. // Insert callback into url or form data
  24696. if ( jsonProp ) {
  24697. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  24698. } else if ( s.jsonp !== false ) {
  24699. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  24700. }
  24701. // Use data converter to retrieve json after script execution
  24702. s.converters[ "script json" ] = function() {
  24703. if ( !responseContainer ) {
  24704. jQuery.error( callbackName + " was not called" );
  24705. }
  24706. return responseContainer[ 0 ];
  24707. };
  24708. // Force json dataType
  24709. s.dataTypes[ 0 ] = "json";
  24710. // Install callback
  24711. overwritten = window[ callbackName ];
  24712. window[ callbackName ] = function() {
  24713. responseContainer = arguments;
  24714. };
  24715. // Clean-up function (fires after converters)
  24716. jqXHR.always( function() {
  24717. // If previous value didn't exist - remove it
  24718. if ( overwritten === undefined ) {
  24719. jQuery( window ).removeProp( callbackName );
  24720. // Otherwise restore preexisting value
  24721. } else {
  24722. window[ callbackName ] = overwritten;
  24723. }
  24724. // Save back as free
  24725. if ( s[ callbackName ] ) {
  24726. // Make sure that re-using the options doesn't screw things around
  24727. s.jsonpCallback = originalSettings.jsonpCallback;
  24728. // Save the callback name for future use
  24729. oldCallbacks.push( callbackName );
  24730. }
  24731. // Call if it was a function and we have a response
  24732. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  24733. overwritten( responseContainer[ 0 ] );
  24734. }
  24735. responseContainer = overwritten = undefined;
  24736. } );
  24737. // Delegate to script
  24738. return "script";
  24739. }
  24740. } );
  24741. // Support: Safari 8 only
  24742. // In Safari 8 documents created via document.implementation.createHTMLDocument
  24743. // collapse sibling forms: the second one becomes a child of the first one.
  24744. // Because of that, this security measure has to be disabled in Safari 8.
  24745. // https://bugs.webkit.org/show_bug.cgi?id=137337
  24746. support.createHTMLDocument = ( function() {
  24747. var body = document.implementation.createHTMLDocument( "" ).body;
  24748. body.innerHTML = "<form></form><form></form>";
  24749. return body.childNodes.length === 2;
  24750. } )();
  24751. // Argument "data" should be string of html
  24752. // context (optional): If specified, the fragment will be created in this context,
  24753. // defaults to document
  24754. // keepScripts (optional): If true, will include scripts passed in the html string
  24755. jQuery.parseHTML = function( data, context, keepScripts ) {
  24756. if ( typeof data !== "string" ) {
  24757. return [];
  24758. }
  24759. if ( typeof context === "boolean" ) {
  24760. keepScripts = context;
  24761. context = false;
  24762. }
  24763. var base, parsed, scripts;
  24764. if ( !context ) {
  24765. // Stop scripts or inline event handlers from being executed immediately
  24766. // by using document.implementation
  24767. if ( support.createHTMLDocument ) {
  24768. context = document.implementation.createHTMLDocument( "" );
  24769. // Set the base href for the created document
  24770. // so any parsed elements with URLs
  24771. // are based on the document's URL (gh-2965)
  24772. base = context.createElement( "base" );
  24773. base.href = document.location.href;
  24774. context.head.appendChild( base );
  24775. } else {
  24776. context = document;
  24777. }
  24778. }
  24779. parsed = rsingleTag.exec( data );
  24780. scripts = !keepScripts && [];
  24781. // Single tag
  24782. if ( parsed ) {
  24783. return [ context.createElement( parsed[ 1 ] ) ];
  24784. }
  24785. parsed = buildFragment( [ data ], context, scripts );
  24786. if ( scripts && scripts.length ) {
  24787. jQuery( scripts ).remove();
  24788. }
  24789. return jQuery.merge( [], parsed.childNodes );
  24790. };
  24791. /**
  24792. * Load a url into a page
  24793. */
  24794. jQuery.fn.load = function( url, params, callback ) {
  24795. var selector, type, response,
  24796. self = this,
  24797. off = url.indexOf( " " );
  24798. if ( off > -1 ) {
  24799. selector = stripAndCollapse( url.slice( off ) );
  24800. url = url.slice( 0, off );
  24801. }
  24802. // If it's a function
  24803. if ( jQuery.isFunction( params ) ) {
  24804. // We assume that it's the callback
  24805. callback = params;
  24806. params = undefined;
  24807. // Otherwise, build a param string
  24808. } else if ( params && typeof params === "object" ) {
  24809. type = "POST";
  24810. }
  24811. // If we have elements to modify, make the request
  24812. if ( self.length > 0 ) {
  24813. jQuery.ajax( {
  24814. url: url,
  24815. // If "type" variable is undefined, then "GET" method will be used.
  24816. // Make value of this field explicit since
  24817. // user can override it through ajaxSetup method
  24818. type: type || "GET",
  24819. dataType: "html",
  24820. data: params
  24821. } ).done( function( responseText ) {
  24822. // Save response for use in complete callback
  24823. response = arguments;
  24824. self.html( selector ?
  24825. // If a selector was specified, locate the right elements in a dummy div
  24826. // Exclude scripts to avoid IE 'Permission Denied' errors
  24827. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  24828. // Otherwise use the full result
  24829. responseText );
  24830. // If the request succeeds, this function gets "data", "status", "jqXHR"
  24831. // but they are ignored because response was set above.
  24832. // If it fails, this function gets "jqXHR", "status", "error"
  24833. } ).always( callback && function( jqXHR, status ) {
  24834. self.each( function() {
  24835. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  24836. } );
  24837. } );
  24838. }
  24839. return this;
  24840. };
  24841. // Attach a bunch of functions for handling common AJAX events
  24842. jQuery.each( [
  24843. "ajaxStart",
  24844. "ajaxStop",
  24845. "ajaxComplete",
  24846. "ajaxError",
  24847. "ajaxSuccess",
  24848. "ajaxSend"
  24849. ], function( i, type ) {
  24850. jQuery.fn[ type ] = function( fn ) {
  24851. return this.on( type, fn );
  24852. };
  24853. } );
  24854. jQuery.expr.pseudos.animated = function( elem ) {
  24855. return jQuery.grep( jQuery.timers, function( fn ) {
  24856. return elem === fn.elem;
  24857. } ).length;
  24858. };
  24859. jQuery.offset = {
  24860. setOffset: function( elem, options, i ) {
  24861. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  24862. position = jQuery.css( elem, "position" ),
  24863. curElem = jQuery( elem ),
  24864. props = {};
  24865. // Set position first, in-case top/left are set even on static elem
  24866. if ( position === "static" ) {
  24867. elem.style.position = "relative";
  24868. }
  24869. curOffset = curElem.offset();
  24870. curCSSTop = jQuery.css( elem, "top" );
  24871. curCSSLeft = jQuery.css( elem, "left" );
  24872. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  24873. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  24874. // Need to be able to calculate position if either
  24875. // top or left is auto and position is either absolute or fixed
  24876. if ( calculatePosition ) {
  24877. curPosition = curElem.position();
  24878. curTop = curPosition.top;
  24879. curLeft = curPosition.left;
  24880. } else {
  24881. curTop = parseFloat( curCSSTop ) || 0;
  24882. curLeft = parseFloat( curCSSLeft ) || 0;
  24883. }
  24884. if ( jQuery.isFunction( options ) ) {
  24885. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  24886. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  24887. }
  24888. if ( options.top != null ) {
  24889. props.top = ( options.top - curOffset.top ) + curTop;
  24890. }
  24891. if ( options.left != null ) {
  24892. props.left = ( options.left - curOffset.left ) + curLeft;
  24893. }
  24894. if ( "using" in options ) {
  24895. options.using.call( elem, props );
  24896. } else {
  24897. curElem.css( props );
  24898. }
  24899. }
  24900. };
  24901. jQuery.fn.extend( {
  24902. offset: function( options ) {
  24903. // Preserve chaining for setter
  24904. if ( arguments.length ) {
  24905. return options === undefined ?
  24906. this :
  24907. this.each( function( i ) {
  24908. jQuery.offset.setOffset( this, options, i );
  24909. } );
  24910. }
  24911. var doc, docElem, rect, win,
  24912. elem = this[ 0 ];
  24913. if ( !elem ) {
  24914. return;
  24915. }
  24916. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  24917. // Support: IE <=11 only
  24918. // Running getBoundingClientRect on a
  24919. // disconnected node in IE throws an error
  24920. if ( !elem.getClientRects().length ) {
  24921. return { top: 0, left: 0 };
  24922. }
  24923. rect = elem.getBoundingClientRect();
  24924. doc = elem.ownerDocument;
  24925. docElem = doc.documentElement;
  24926. win = doc.defaultView;
  24927. return {
  24928. top: rect.top + win.pageYOffset - docElem.clientTop,
  24929. left: rect.left + win.pageXOffset - docElem.clientLeft
  24930. };
  24931. },
  24932. position: function() {
  24933. if ( !this[ 0 ] ) {
  24934. return;
  24935. }
  24936. var offsetParent, offset,
  24937. elem = this[ 0 ],
  24938. parentOffset = { top: 0, left: 0 };
  24939. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  24940. // because it is its only offset parent
  24941. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  24942. // Assume getBoundingClientRect is there when computed position is fixed
  24943. offset = elem.getBoundingClientRect();
  24944. } else {
  24945. // Get *real* offsetParent
  24946. offsetParent = this.offsetParent();
  24947. // Get correct offsets
  24948. offset = this.offset();
  24949. if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
  24950. parentOffset = offsetParent.offset();
  24951. }
  24952. // Add offsetParent borders
  24953. parentOffset = {
  24954. top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
  24955. left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
  24956. };
  24957. }
  24958. // Subtract parent offsets and element margins
  24959. return {
  24960. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  24961. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  24962. };
  24963. },
  24964. // This method will return documentElement in the following cases:
  24965. // 1) For the element inside the iframe without offsetParent, this method will return
  24966. // documentElement of the parent window
  24967. // 2) For the hidden or detached element
  24968. // 3) For body or html element, i.e. in case of the html node - it will return itself
  24969. //
  24970. // but those exceptions were never presented as a real life use-cases
  24971. // and might be considered as more preferable results.
  24972. //
  24973. // This logic, however, is not guaranteed and can change at any point in the future
  24974. offsetParent: function() {
  24975. return this.map( function() {
  24976. var offsetParent = this.offsetParent;
  24977. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  24978. offsetParent = offsetParent.offsetParent;
  24979. }
  24980. return offsetParent || documentElement;
  24981. } );
  24982. }
  24983. } );
  24984. // Create scrollLeft and scrollTop methods
  24985. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  24986. var top = "pageYOffset" === prop;
  24987. jQuery.fn[ method ] = function( val ) {
  24988. return access( this, function( elem, method, val ) {
  24989. // Coalesce documents and windows
  24990. var win;
  24991. if ( jQuery.isWindow( elem ) ) {
  24992. win = elem;
  24993. } else if ( elem.nodeType === 9 ) {
  24994. win = elem.defaultView;
  24995. }
  24996. if ( val === undefined ) {
  24997. return win ? win[ prop ] : elem[ method ];
  24998. }
  24999. if ( win ) {
  25000. win.scrollTo(
  25001. !top ? val : win.pageXOffset,
  25002. top ? val : win.pageYOffset
  25003. );
  25004. } else {
  25005. elem[ method ] = val;
  25006. }
  25007. }, method, val, arguments.length );
  25008. };
  25009. } );
  25010. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  25011. // Add the top/left cssHooks using jQuery.fn.position
  25012. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  25013. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  25014. // getComputedStyle returns percent when specified for top/left/bottom/right;
  25015. // rather than make the css module depend on the offset module, just check for it here
  25016. jQuery.each( [ "top", "left" ], function( i, prop ) {
  25017. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  25018. function( elem, computed ) {
  25019. if ( computed ) {
  25020. computed = curCSS( elem, prop );
  25021. // If curCSS returns percentage, fallback to offset
  25022. return rnumnonpx.test( computed ) ?
  25023. jQuery( elem ).position()[ prop ] + "px" :
  25024. computed;
  25025. }
  25026. }
  25027. );
  25028. } );
  25029. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  25030. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  25031. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  25032. function( defaultExtra, funcName ) {
  25033. // Margin is only for outerHeight, outerWidth
  25034. jQuery.fn[ funcName ] = function( margin, value ) {
  25035. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  25036. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  25037. return access( this, function( elem, type, value ) {
  25038. var doc;
  25039. if ( jQuery.isWindow( elem ) ) {
  25040. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  25041. return funcName.indexOf( "outer" ) === 0 ?
  25042. elem[ "inner" + name ] :
  25043. elem.document.documentElement[ "client" + name ];
  25044. }
  25045. // Get document width or height
  25046. if ( elem.nodeType === 9 ) {
  25047. doc = elem.documentElement;
  25048. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  25049. // whichever is greatest
  25050. return Math.max(
  25051. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  25052. elem.body[ "offset" + name ], doc[ "offset" + name ],
  25053. doc[ "client" + name ]
  25054. );
  25055. }
  25056. return value === undefined ?
  25057. // Get width or height on the element, requesting but not forcing parseFloat
  25058. jQuery.css( elem, type, extra ) :
  25059. // Set width or height on the element
  25060. jQuery.style( elem, type, value, extra );
  25061. }, type, chainable ? margin : undefined, chainable );
  25062. };
  25063. } );
  25064. } );
  25065. jQuery.fn.extend( {
  25066. bind: function( types, data, fn ) {
  25067. return this.on( types, null, data, fn );
  25068. },
  25069. unbind: function( types, fn ) {
  25070. return this.off( types, null, fn );
  25071. },
  25072. delegate: function( selector, types, data, fn ) {
  25073. return this.on( types, selector, data, fn );
  25074. },
  25075. undelegate: function( selector, types, fn ) {
  25076. // ( namespace ) or ( selector, types [, fn] )
  25077. return arguments.length === 1 ?
  25078. this.off( selector, "**" ) :
  25079. this.off( types, selector || "**", fn );
  25080. }
  25081. } );
  25082. jQuery.holdReady = function( hold ) {
  25083. if ( hold ) {
  25084. jQuery.readyWait++;
  25085. } else {
  25086. jQuery.ready( true );
  25087. }
  25088. };
  25089. jQuery.isArray = Array.isArray;
  25090. jQuery.parseJSON = JSON.parse;
  25091. jQuery.nodeName = nodeName;
  25092. // Register as a named AMD module, since jQuery can be concatenated with other
  25093. // files that may use define, but not via a proper concatenation script that
  25094. // understands anonymous AMD modules. A named AMD is safest and most robust
  25095. // way to register. Lowercase jquery is used because AMD module names are
  25096. // derived from file names, and jQuery is normally delivered in a lowercase
  25097. // file name. Do this after creating the global so that if an AMD module wants
  25098. // to call noConflict to hide this version of jQuery, it will work.
  25099. // Note that for maximum portability, libraries that are not jQuery should
  25100. // declare themselves as anonymous modules, and avoid setting a global if an
  25101. // AMD loader is present. jQuery is a special case. For more information, see
  25102. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  25103. if ( true ) {
  25104. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
  25105. return jQuery;
  25106. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  25107. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  25108. }
  25109. var
  25110. // Map over jQuery in case of overwrite
  25111. _jQuery = window.jQuery,
  25112. // Map over the $ in case of overwrite
  25113. _$ = window.$;
  25114. jQuery.noConflict = function( deep ) {
  25115. if ( window.$ === jQuery ) {
  25116. window.$ = _$;
  25117. }
  25118. if ( deep && window.jQuery === jQuery ) {
  25119. window.jQuery = _jQuery;
  25120. }
  25121. return jQuery;
  25122. };
  25123. // Expose jQuery and $ identifiers, even in AMD
  25124. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  25125. // and CommonJS for browser emulators (#13566)
  25126. if ( !noGlobal ) {
  25127. window.jQuery = window.$ = jQuery;
  25128. }
  25129. return jQuery;
  25130. } );
  25131. /***/ }),
  25132. /* 14 */
  25133. /***/ (function(module, exports) {
  25134. /*!
  25135. * Bootstrap v3.3.7 (http://getbootstrap.com)
  25136. * Copyright 2011-2016 Twitter, Inc.
  25137. * Licensed under the MIT license
  25138. */
  25139. if (typeof jQuery === 'undefined') {
  25140. throw new Error('Bootstrap\'s JavaScript requires jQuery')
  25141. }
  25142. +function ($) {
  25143. 'use strict';
  25144. var version = $.fn.jquery.split(' ')[0].split('.')
  25145. if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
  25146. throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  25147. }
  25148. }(jQuery);
  25149. /* ========================================================================
  25150. * Bootstrap: transition.js v3.3.7
  25151. * http://getbootstrap.com/javascript/#transitions
  25152. * ========================================================================
  25153. * Copyright 2011-2016 Twitter, Inc.
  25154. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25155. * ======================================================================== */
  25156. +function ($) {
  25157. 'use strict';
  25158. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  25159. // ============================================================
  25160. function transitionEnd() {
  25161. var el = document.createElement('bootstrap')
  25162. var transEndEventNames = {
  25163. WebkitTransition : 'webkitTransitionEnd',
  25164. MozTransition : 'transitionend',
  25165. OTransition : 'oTransitionEnd otransitionend',
  25166. transition : 'transitionend'
  25167. }
  25168. for (var name in transEndEventNames) {
  25169. if (el.style[name] !== undefined) {
  25170. return { end: transEndEventNames[name] }
  25171. }
  25172. }
  25173. return false // explicit for ie8 ( ._.)
  25174. }
  25175. // http://blog.alexmaccaw.com/css-transitions
  25176. $.fn.emulateTransitionEnd = function (duration) {
  25177. var called = false
  25178. var $el = this
  25179. $(this).one('bsTransitionEnd', function () { called = true })
  25180. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  25181. setTimeout(callback, duration)
  25182. return this
  25183. }
  25184. $(function () {
  25185. $.support.transition = transitionEnd()
  25186. if (!$.support.transition) return
  25187. $.event.special.bsTransitionEnd = {
  25188. bindType: $.support.transition.end,
  25189. delegateType: $.support.transition.end,
  25190. handle: function (e) {
  25191. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  25192. }
  25193. }
  25194. })
  25195. }(jQuery);
  25196. /* ========================================================================
  25197. * Bootstrap: alert.js v3.3.7
  25198. * http://getbootstrap.com/javascript/#alerts
  25199. * ========================================================================
  25200. * Copyright 2011-2016 Twitter, Inc.
  25201. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25202. * ======================================================================== */
  25203. +function ($) {
  25204. 'use strict';
  25205. // ALERT CLASS DEFINITION
  25206. // ======================
  25207. var dismiss = '[data-dismiss="alert"]'
  25208. var Alert = function (el) {
  25209. $(el).on('click', dismiss, this.close)
  25210. }
  25211. Alert.VERSION = '3.3.7'
  25212. Alert.TRANSITION_DURATION = 150
  25213. Alert.prototype.close = function (e) {
  25214. var $this = $(this)
  25215. var selector = $this.attr('data-target')
  25216. if (!selector) {
  25217. selector = $this.attr('href')
  25218. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25219. }
  25220. var $parent = $(selector === '#' ? [] : selector)
  25221. if (e) e.preventDefault()
  25222. if (!$parent.length) {
  25223. $parent = $this.closest('.alert')
  25224. }
  25225. $parent.trigger(e = $.Event('close.bs.alert'))
  25226. if (e.isDefaultPrevented()) return
  25227. $parent.removeClass('in')
  25228. function removeElement() {
  25229. // detach from parent, fire event then clean up data
  25230. $parent.detach().trigger('closed.bs.alert').remove()
  25231. }
  25232. $.support.transition && $parent.hasClass('fade') ?
  25233. $parent
  25234. .one('bsTransitionEnd', removeElement)
  25235. .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
  25236. removeElement()
  25237. }
  25238. // ALERT PLUGIN DEFINITION
  25239. // =======================
  25240. function Plugin(option) {
  25241. return this.each(function () {
  25242. var $this = $(this)
  25243. var data = $this.data('bs.alert')
  25244. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  25245. if (typeof option == 'string') data[option].call($this)
  25246. })
  25247. }
  25248. var old = $.fn.alert
  25249. $.fn.alert = Plugin
  25250. $.fn.alert.Constructor = Alert
  25251. // ALERT NO CONFLICT
  25252. // =================
  25253. $.fn.alert.noConflict = function () {
  25254. $.fn.alert = old
  25255. return this
  25256. }
  25257. // ALERT DATA-API
  25258. // ==============
  25259. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  25260. }(jQuery);
  25261. /* ========================================================================
  25262. * Bootstrap: button.js v3.3.7
  25263. * http://getbootstrap.com/javascript/#buttons
  25264. * ========================================================================
  25265. * Copyright 2011-2016 Twitter, Inc.
  25266. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25267. * ======================================================================== */
  25268. +function ($) {
  25269. 'use strict';
  25270. // BUTTON PUBLIC CLASS DEFINITION
  25271. // ==============================
  25272. var Button = function (element, options) {
  25273. this.$element = $(element)
  25274. this.options = $.extend({}, Button.DEFAULTS, options)
  25275. this.isLoading = false
  25276. }
  25277. Button.VERSION = '3.3.7'
  25278. Button.DEFAULTS = {
  25279. loadingText: 'loading...'
  25280. }
  25281. Button.prototype.setState = function (state) {
  25282. var d = 'disabled'
  25283. var $el = this.$element
  25284. var val = $el.is('input') ? 'val' : 'html'
  25285. var data = $el.data()
  25286. state += 'Text'
  25287. if (data.resetText == null) $el.data('resetText', $el[val]())
  25288. // push to event loop to allow forms to submit
  25289. setTimeout($.proxy(function () {
  25290. $el[val](data[state] == null ? this.options[state] : data[state])
  25291. if (state == 'loadingText') {
  25292. this.isLoading = true
  25293. $el.addClass(d).attr(d, d).prop(d, true)
  25294. } else if (this.isLoading) {
  25295. this.isLoading = false
  25296. $el.removeClass(d).removeAttr(d).prop(d, false)
  25297. }
  25298. }, this), 0)
  25299. }
  25300. Button.prototype.toggle = function () {
  25301. var changed = true
  25302. var $parent = this.$element.closest('[data-toggle="buttons"]')
  25303. if ($parent.length) {
  25304. var $input = this.$element.find('input')
  25305. if ($input.prop('type') == 'radio') {
  25306. if ($input.prop('checked')) changed = false
  25307. $parent.find('.active').removeClass('active')
  25308. this.$element.addClass('active')
  25309. } else if ($input.prop('type') == 'checkbox') {
  25310. if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
  25311. this.$element.toggleClass('active')
  25312. }
  25313. $input.prop('checked', this.$element.hasClass('active'))
  25314. if (changed) $input.trigger('change')
  25315. } else {
  25316. this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
  25317. this.$element.toggleClass('active')
  25318. }
  25319. }
  25320. // BUTTON PLUGIN DEFINITION
  25321. // ========================
  25322. function Plugin(option) {
  25323. return this.each(function () {
  25324. var $this = $(this)
  25325. var data = $this.data('bs.button')
  25326. var options = typeof option == 'object' && option
  25327. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  25328. if (option == 'toggle') data.toggle()
  25329. else if (option) data.setState(option)
  25330. })
  25331. }
  25332. var old = $.fn.button
  25333. $.fn.button = Plugin
  25334. $.fn.button.Constructor = Button
  25335. // BUTTON NO CONFLICT
  25336. // ==================
  25337. $.fn.button.noConflict = function () {
  25338. $.fn.button = old
  25339. return this
  25340. }
  25341. // BUTTON DATA-API
  25342. // ===============
  25343. $(document)
  25344. .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  25345. var $btn = $(e.target).closest('.btn')
  25346. Plugin.call($btn, 'toggle')
  25347. if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
  25348. // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
  25349. e.preventDefault()
  25350. // The target component still receive the focus
  25351. if ($btn.is('input,button')) $btn.trigger('focus')
  25352. else $btn.find('input:visible,button:visible').first().trigger('focus')
  25353. }
  25354. })
  25355. .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  25356. $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
  25357. })
  25358. }(jQuery);
  25359. /* ========================================================================
  25360. * Bootstrap: carousel.js v3.3.7
  25361. * http://getbootstrap.com/javascript/#carousel
  25362. * ========================================================================
  25363. * Copyright 2011-2016 Twitter, Inc.
  25364. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25365. * ======================================================================== */
  25366. +function ($) {
  25367. 'use strict';
  25368. // CAROUSEL CLASS DEFINITION
  25369. // =========================
  25370. var Carousel = function (element, options) {
  25371. this.$element = $(element)
  25372. this.$indicators = this.$element.find('.carousel-indicators')
  25373. this.options = options
  25374. this.paused = null
  25375. this.sliding = null
  25376. this.interval = null
  25377. this.$active = null
  25378. this.$items = null
  25379. this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
  25380. this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
  25381. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  25382. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  25383. }
  25384. Carousel.VERSION = '3.3.7'
  25385. Carousel.TRANSITION_DURATION = 600
  25386. Carousel.DEFAULTS = {
  25387. interval: 5000,
  25388. pause: 'hover',
  25389. wrap: true,
  25390. keyboard: true
  25391. }
  25392. Carousel.prototype.keydown = function (e) {
  25393. if (/input|textarea/i.test(e.target.tagName)) return
  25394. switch (e.which) {
  25395. case 37: this.prev(); break
  25396. case 39: this.next(); break
  25397. default: return
  25398. }
  25399. e.preventDefault()
  25400. }
  25401. Carousel.prototype.cycle = function (e) {
  25402. e || (this.paused = false)
  25403. this.interval && clearInterval(this.interval)
  25404. this.options.interval
  25405. && !this.paused
  25406. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  25407. return this
  25408. }
  25409. Carousel.prototype.getItemIndex = function (item) {
  25410. this.$items = item.parent().children('.item')
  25411. return this.$items.index(item || this.$active)
  25412. }
  25413. Carousel.prototype.getItemForDirection = function (direction, active) {
  25414. var activeIndex = this.getItemIndex(active)
  25415. var willWrap = (direction == 'prev' && activeIndex === 0)
  25416. || (direction == 'next' && activeIndex == (this.$items.length - 1))
  25417. if (willWrap && !this.options.wrap) return active
  25418. var delta = direction == 'prev' ? -1 : 1
  25419. var itemIndex = (activeIndex + delta) % this.$items.length
  25420. return this.$items.eq(itemIndex)
  25421. }
  25422. Carousel.prototype.to = function (pos) {
  25423. var that = this
  25424. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  25425. if (pos > (this.$items.length - 1) || pos < 0) return
  25426. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  25427. if (activeIndex == pos) return this.pause().cycle()
  25428. return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  25429. }
  25430. Carousel.prototype.pause = function (e) {
  25431. e || (this.paused = true)
  25432. if (this.$element.find('.next, .prev').length && $.support.transition) {
  25433. this.$element.trigger($.support.transition.end)
  25434. this.cycle(true)
  25435. }
  25436. this.interval = clearInterval(this.interval)
  25437. return this
  25438. }
  25439. Carousel.prototype.next = function () {
  25440. if (this.sliding) return
  25441. return this.slide('next')
  25442. }
  25443. Carousel.prototype.prev = function () {
  25444. if (this.sliding) return
  25445. return this.slide('prev')
  25446. }
  25447. Carousel.prototype.slide = function (type, next) {
  25448. var $active = this.$element.find('.item.active')
  25449. var $next = next || this.getItemForDirection(type, $active)
  25450. var isCycling = this.interval
  25451. var direction = type == 'next' ? 'left' : 'right'
  25452. var that = this
  25453. if ($next.hasClass('active')) return (this.sliding = false)
  25454. var relatedTarget = $next[0]
  25455. var slideEvent = $.Event('slide.bs.carousel', {
  25456. relatedTarget: relatedTarget,
  25457. direction: direction
  25458. })
  25459. this.$element.trigger(slideEvent)
  25460. if (slideEvent.isDefaultPrevented()) return
  25461. this.sliding = true
  25462. isCycling && this.pause()
  25463. if (this.$indicators.length) {
  25464. this.$indicators.find('.active').removeClass('active')
  25465. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  25466. $nextIndicator && $nextIndicator.addClass('active')
  25467. }
  25468. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  25469. if ($.support.transition && this.$element.hasClass('slide')) {
  25470. $next.addClass(type)
  25471. $next[0].offsetWidth // force reflow
  25472. $active.addClass(direction)
  25473. $next.addClass(direction)
  25474. $active
  25475. .one('bsTransitionEnd', function () {
  25476. $next.removeClass([type, direction].join(' ')).addClass('active')
  25477. $active.removeClass(['active', direction].join(' '))
  25478. that.sliding = false
  25479. setTimeout(function () {
  25480. that.$element.trigger(slidEvent)
  25481. }, 0)
  25482. })
  25483. .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
  25484. } else {
  25485. $active.removeClass('active')
  25486. $next.addClass('active')
  25487. this.sliding = false
  25488. this.$element.trigger(slidEvent)
  25489. }
  25490. isCycling && this.cycle()
  25491. return this
  25492. }
  25493. // CAROUSEL PLUGIN DEFINITION
  25494. // ==========================
  25495. function Plugin(option) {
  25496. return this.each(function () {
  25497. var $this = $(this)
  25498. var data = $this.data('bs.carousel')
  25499. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  25500. var action = typeof option == 'string' ? option : options.slide
  25501. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  25502. if (typeof option == 'number') data.to(option)
  25503. else if (action) data[action]()
  25504. else if (options.interval) data.pause().cycle()
  25505. })
  25506. }
  25507. var old = $.fn.carousel
  25508. $.fn.carousel = Plugin
  25509. $.fn.carousel.Constructor = Carousel
  25510. // CAROUSEL NO CONFLICT
  25511. // ====================
  25512. $.fn.carousel.noConflict = function () {
  25513. $.fn.carousel = old
  25514. return this
  25515. }
  25516. // CAROUSEL DATA-API
  25517. // =================
  25518. var clickHandler = function (e) {
  25519. var href
  25520. var $this = $(this)
  25521. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  25522. if (!$target.hasClass('carousel')) return
  25523. var options = $.extend({}, $target.data(), $this.data())
  25524. var slideIndex = $this.attr('data-slide-to')
  25525. if (slideIndex) options.interval = false
  25526. Plugin.call($target, options)
  25527. if (slideIndex) {
  25528. $target.data('bs.carousel').to(slideIndex)
  25529. }
  25530. e.preventDefault()
  25531. }
  25532. $(document)
  25533. .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
  25534. .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
  25535. $(window).on('load', function () {
  25536. $('[data-ride="carousel"]').each(function () {
  25537. var $carousel = $(this)
  25538. Plugin.call($carousel, $carousel.data())
  25539. })
  25540. })
  25541. }(jQuery);
  25542. /* ========================================================================
  25543. * Bootstrap: collapse.js v3.3.7
  25544. * http://getbootstrap.com/javascript/#collapse
  25545. * ========================================================================
  25546. * Copyright 2011-2016 Twitter, Inc.
  25547. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25548. * ======================================================================== */
  25549. /* jshint latedef: false */
  25550. +function ($) {
  25551. 'use strict';
  25552. // COLLAPSE PUBLIC CLASS DEFINITION
  25553. // ================================
  25554. var Collapse = function (element, options) {
  25555. this.$element = $(element)
  25556. this.options = $.extend({}, Collapse.DEFAULTS, options)
  25557. this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
  25558. '[data-toggle="collapse"][data-target="#' + element.id + '"]')
  25559. this.transitioning = null
  25560. if (this.options.parent) {
  25561. this.$parent = this.getParent()
  25562. } else {
  25563. this.addAriaAndCollapsedClass(this.$element, this.$trigger)
  25564. }
  25565. if (this.options.toggle) this.toggle()
  25566. }
  25567. Collapse.VERSION = '3.3.7'
  25568. Collapse.TRANSITION_DURATION = 350
  25569. Collapse.DEFAULTS = {
  25570. toggle: true
  25571. }
  25572. Collapse.prototype.dimension = function () {
  25573. var hasWidth = this.$element.hasClass('width')
  25574. return hasWidth ? 'width' : 'height'
  25575. }
  25576. Collapse.prototype.show = function () {
  25577. if (this.transitioning || this.$element.hasClass('in')) return
  25578. var activesData
  25579. var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
  25580. if (actives && actives.length) {
  25581. activesData = actives.data('bs.collapse')
  25582. if (activesData && activesData.transitioning) return
  25583. }
  25584. var startEvent = $.Event('show.bs.collapse')
  25585. this.$element.trigger(startEvent)
  25586. if (startEvent.isDefaultPrevented()) return
  25587. if (actives && actives.length) {
  25588. Plugin.call(actives, 'hide')
  25589. activesData || actives.data('bs.collapse', null)
  25590. }
  25591. var dimension = this.dimension()
  25592. this.$element
  25593. .removeClass('collapse')
  25594. .addClass('collapsing')[dimension](0)
  25595. .attr('aria-expanded', true)
  25596. this.$trigger
  25597. .removeClass('collapsed')
  25598. .attr('aria-expanded', true)
  25599. this.transitioning = 1
  25600. var complete = function () {
  25601. this.$element
  25602. .removeClass('collapsing')
  25603. .addClass('collapse in')[dimension]('')
  25604. this.transitioning = 0
  25605. this.$element
  25606. .trigger('shown.bs.collapse')
  25607. }
  25608. if (!$.support.transition) return complete.call(this)
  25609. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  25610. this.$element
  25611. .one('bsTransitionEnd', $.proxy(complete, this))
  25612. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  25613. }
  25614. Collapse.prototype.hide = function () {
  25615. if (this.transitioning || !this.$element.hasClass('in')) return
  25616. var startEvent = $.Event('hide.bs.collapse')
  25617. this.$element.trigger(startEvent)
  25618. if (startEvent.isDefaultPrevented()) return
  25619. var dimension = this.dimension()
  25620. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  25621. this.$element
  25622. .addClass('collapsing')
  25623. .removeClass('collapse in')
  25624. .attr('aria-expanded', false)
  25625. this.$trigger
  25626. .addClass('collapsed')
  25627. .attr('aria-expanded', false)
  25628. this.transitioning = 1
  25629. var complete = function () {
  25630. this.transitioning = 0
  25631. this.$element
  25632. .removeClass('collapsing')
  25633. .addClass('collapse')
  25634. .trigger('hidden.bs.collapse')
  25635. }
  25636. if (!$.support.transition) return complete.call(this)
  25637. this.$element
  25638. [dimension](0)
  25639. .one('bsTransitionEnd', $.proxy(complete, this))
  25640. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  25641. }
  25642. Collapse.prototype.toggle = function () {
  25643. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  25644. }
  25645. Collapse.prototype.getParent = function () {
  25646. return $(this.options.parent)
  25647. .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
  25648. .each($.proxy(function (i, element) {
  25649. var $element = $(element)
  25650. this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
  25651. }, this))
  25652. .end()
  25653. }
  25654. Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
  25655. var isOpen = $element.hasClass('in')
  25656. $element.attr('aria-expanded', isOpen)
  25657. $trigger
  25658. .toggleClass('collapsed', !isOpen)
  25659. .attr('aria-expanded', isOpen)
  25660. }
  25661. function getTargetFromTrigger($trigger) {
  25662. var href
  25663. var target = $trigger.attr('data-target')
  25664. || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  25665. return $(target)
  25666. }
  25667. // COLLAPSE PLUGIN DEFINITION
  25668. // ==========================
  25669. function Plugin(option) {
  25670. return this.each(function () {
  25671. var $this = $(this)
  25672. var data = $this.data('bs.collapse')
  25673. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  25674. if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
  25675. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  25676. if (typeof option == 'string') data[option]()
  25677. })
  25678. }
  25679. var old = $.fn.collapse
  25680. $.fn.collapse = Plugin
  25681. $.fn.collapse.Constructor = Collapse
  25682. // COLLAPSE NO CONFLICT
  25683. // ====================
  25684. $.fn.collapse.noConflict = function () {
  25685. $.fn.collapse = old
  25686. return this
  25687. }
  25688. // COLLAPSE DATA-API
  25689. // =================
  25690. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  25691. var $this = $(this)
  25692. if (!$this.attr('data-target')) e.preventDefault()
  25693. var $target = getTargetFromTrigger($this)
  25694. var data = $target.data('bs.collapse')
  25695. var option = data ? 'toggle' : $this.data()
  25696. Plugin.call($target, option)
  25697. })
  25698. }(jQuery);
  25699. /* ========================================================================
  25700. * Bootstrap: dropdown.js v3.3.7
  25701. * http://getbootstrap.com/javascript/#dropdowns
  25702. * ========================================================================
  25703. * Copyright 2011-2016 Twitter, Inc.
  25704. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25705. * ======================================================================== */
  25706. +function ($) {
  25707. 'use strict';
  25708. // DROPDOWN CLASS DEFINITION
  25709. // =========================
  25710. var backdrop = '.dropdown-backdrop'
  25711. var toggle = '[data-toggle="dropdown"]'
  25712. var Dropdown = function (element) {
  25713. $(element).on('click.bs.dropdown', this.toggle)
  25714. }
  25715. Dropdown.VERSION = '3.3.7'
  25716. function getParent($this) {
  25717. var selector = $this.attr('data-target')
  25718. if (!selector) {
  25719. selector = $this.attr('href')
  25720. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25721. }
  25722. var $parent = selector && $(selector)
  25723. return $parent && $parent.length ? $parent : $this.parent()
  25724. }
  25725. function clearMenus(e) {
  25726. if (e && e.which === 3) return
  25727. $(backdrop).remove()
  25728. $(toggle).each(function () {
  25729. var $this = $(this)
  25730. var $parent = getParent($this)
  25731. var relatedTarget = { relatedTarget: this }
  25732. if (!$parent.hasClass('open')) return
  25733. if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
  25734. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  25735. if (e.isDefaultPrevented()) return
  25736. $this.attr('aria-expanded', 'false')
  25737. $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
  25738. })
  25739. }
  25740. Dropdown.prototype.toggle = function (e) {
  25741. var $this = $(this)
  25742. if ($this.is('.disabled, :disabled')) return
  25743. var $parent = getParent($this)
  25744. var isActive = $parent.hasClass('open')
  25745. clearMenus()
  25746. if (!isActive) {
  25747. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  25748. // if mobile we use a backdrop because click events don't delegate
  25749. $(document.createElement('div'))
  25750. .addClass('dropdown-backdrop')
  25751. .insertAfter($(this))
  25752. .on('click', clearMenus)
  25753. }
  25754. var relatedTarget = { relatedTarget: this }
  25755. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  25756. if (e.isDefaultPrevented()) return
  25757. $this
  25758. .trigger('focus')
  25759. .attr('aria-expanded', 'true')
  25760. $parent
  25761. .toggleClass('open')
  25762. .trigger($.Event('shown.bs.dropdown', relatedTarget))
  25763. }
  25764. return false
  25765. }
  25766. Dropdown.prototype.keydown = function (e) {
  25767. if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
  25768. var $this = $(this)
  25769. e.preventDefault()
  25770. e.stopPropagation()
  25771. if ($this.is('.disabled, :disabled')) return
  25772. var $parent = getParent($this)
  25773. var isActive = $parent.hasClass('open')
  25774. if (!isActive && e.which != 27 || isActive && e.which == 27) {
  25775. if (e.which == 27) $parent.find(toggle).trigger('focus')
  25776. return $this.trigger('click')
  25777. }
  25778. var desc = ' li:not(.disabled):visible a'
  25779. var $items = $parent.find('.dropdown-menu' + desc)
  25780. if (!$items.length) return
  25781. var index = $items.index(e.target)
  25782. if (e.which == 38 && index > 0) index-- // up
  25783. if (e.which == 40 && index < $items.length - 1) index++ // down
  25784. if (!~index) index = 0
  25785. $items.eq(index).trigger('focus')
  25786. }
  25787. // DROPDOWN PLUGIN DEFINITION
  25788. // ==========================
  25789. function Plugin(option) {
  25790. return this.each(function () {
  25791. var $this = $(this)
  25792. var data = $this.data('bs.dropdown')
  25793. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  25794. if (typeof option == 'string') data[option].call($this)
  25795. })
  25796. }
  25797. var old = $.fn.dropdown
  25798. $.fn.dropdown = Plugin
  25799. $.fn.dropdown.Constructor = Dropdown
  25800. // DROPDOWN NO CONFLICT
  25801. // ====================
  25802. $.fn.dropdown.noConflict = function () {
  25803. $.fn.dropdown = old
  25804. return this
  25805. }
  25806. // APPLY TO STANDARD DROPDOWN ELEMENTS
  25807. // ===================================
  25808. $(document)
  25809. .on('click.bs.dropdown.data-api', clearMenus)
  25810. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  25811. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  25812. .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
  25813. .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
  25814. }(jQuery);
  25815. /* ========================================================================
  25816. * Bootstrap: modal.js v3.3.7
  25817. * http://getbootstrap.com/javascript/#modals
  25818. * ========================================================================
  25819. * Copyright 2011-2016 Twitter, Inc.
  25820. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25821. * ======================================================================== */
  25822. +function ($) {
  25823. 'use strict';
  25824. // MODAL CLASS DEFINITION
  25825. // ======================
  25826. var Modal = function (element, options) {
  25827. this.options = options
  25828. this.$body = $(document.body)
  25829. this.$element = $(element)
  25830. this.$dialog = this.$element.find('.modal-dialog')
  25831. this.$backdrop = null
  25832. this.isShown = null
  25833. this.originalBodyPad = null
  25834. this.scrollbarWidth = 0
  25835. this.ignoreBackdropClick = false
  25836. if (this.options.remote) {
  25837. this.$element
  25838. .find('.modal-content')
  25839. .load(this.options.remote, $.proxy(function () {
  25840. this.$element.trigger('loaded.bs.modal')
  25841. }, this))
  25842. }
  25843. }
  25844. Modal.VERSION = '3.3.7'
  25845. Modal.TRANSITION_DURATION = 300
  25846. Modal.BACKDROP_TRANSITION_DURATION = 150
  25847. Modal.DEFAULTS = {
  25848. backdrop: true,
  25849. keyboard: true,
  25850. show: true
  25851. }
  25852. Modal.prototype.toggle = function (_relatedTarget) {
  25853. return this.isShown ? this.hide() : this.show(_relatedTarget)
  25854. }
  25855. Modal.prototype.show = function (_relatedTarget) {
  25856. var that = this
  25857. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  25858. this.$element.trigger(e)
  25859. if (this.isShown || e.isDefaultPrevented()) return
  25860. this.isShown = true
  25861. this.checkScrollbar()
  25862. this.setScrollbar()
  25863. this.$body.addClass('modal-open')
  25864. this.escape()
  25865. this.resize()
  25866. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  25867. this.$dialog.on('mousedown.dismiss.bs.modal', function () {
  25868. that.$element.one('mouseup.dismiss.bs.modal', function (e) {
  25869. if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
  25870. })
  25871. })
  25872. this.backdrop(function () {
  25873. var transition = $.support.transition && that.$element.hasClass('fade')
  25874. if (!that.$element.parent().length) {
  25875. that.$element.appendTo(that.$body) // don't move modals dom position
  25876. }
  25877. that.$element
  25878. .show()
  25879. .scrollTop(0)
  25880. that.adjustDialog()
  25881. if (transition) {
  25882. that.$element[0].offsetWidth // force reflow
  25883. }
  25884. that.$element.addClass('in')
  25885. that.enforceFocus()
  25886. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  25887. transition ?
  25888. that.$dialog // wait for modal to slide in
  25889. .one('bsTransitionEnd', function () {
  25890. that.$element.trigger('focus').trigger(e)
  25891. })
  25892. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  25893. that.$element.trigger('focus').trigger(e)
  25894. })
  25895. }
  25896. Modal.prototype.hide = function (e) {
  25897. if (e) e.preventDefault()
  25898. e = $.Event('hide.bs.modal')
  25899. this.$element.trigger(e)
  25900. if (!this.isShown || e.isDefaultPrevented()) return
  25901. this.isShown = false
  25902. this.escape()
  25903. this.resize()
  25904. $(document).off('focusin.bs.modal')
  25905. this.$element
  25906. .removeClass('in')
  25907. .off('click.dismiss.bs.modal')
  25908. .off('mouseup.dismiss.bs.modal')
  25909. this.$dialog.off('mousedown.dismiss.bs.modal')
  25910. $.support.transition && this.$element.hasClass('fade') ?
  25911. this.$element
  25912. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  25913. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  25914. this.hideModal()
  25915. }
  25916. Modal.prototype.enforceFocus = function () {
  25917. $(document)
  25918. .off('focusin.bs.modal') // guard against infinite focus loop
  25919. .on('focusin.bs.modal', $.proxy(function (e) {
  25920. if (document !== e.target &&
  25921. this.$element[0] !== e.target &&
  25922. !this.$element.has(e.target).length) {
  25923. this.$element.trigger('focus')
  25924. }
  25925. }, this))
  25926. }
  25927. Modal.prototype.escape = function () {
  25928. if (this.isShown && this.options.keyboard) {
  25929. this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
  25930. e.which == 27 && this.hide()
  25931. }, this))
  25932. } else if (!this.isShown) {
  25933. this.$element.off('keydown.dismiss.bs.modal')
  25934. }
  25935. }
  25936. Modal.prototype.resize = function () {
  25937. if (this.isShown) {
  25938. $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
  25939. } else {
  25940. $(window).off('resize.bs.modal')
  25941. }
  25942. }
  25943. Modal.prototype.hideModal = function () {
  25944. var that = this
  25945. this.$element.hide()
  25946. this.backdrop(function () {
  25947. that.$body.removeClass('modal-open')
  25948. that.resetAdjustments()
  25949. that.resetScrollbar()
  25950. that.$element.trigger('hidden.bs.modal')
  25951. })
  25952. }
  25953. Modal.prototype.removeBackdrop = function () {
  25954. this.$backdrop && this.$backdrop.remove()
  25955. this.$backdrop = null
  25956. }
  25957. Modal.prototype.backdrop = function (callback) {
  25958. var that = this
  25959. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  25960. if (this.isShown && this.options.backdrop) {
  25961. var doAnimate = $.support.transition && animate
  25962. this.$backdrop = $(document.createElement('div'))
  25963. .addClass('modal-backdrop ' + animate)
  25964. .appendTo(this.$body)
  25965. this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
  25966. if (this.ignoreBackdropClick) {
  25967. this.ignoreBackdropClick = false
  25968. return
  25969. }
  25970. if (e.target !== e.currentTarget) return
  25971. this.options.backdrop == 'static'
  25972. ? this.$element[0].focus()
  25973. : this.hide()
  25974. }, this))
  25975. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  25976. this.$backdrop.addClass('in')
  25977. if (!callback) return
  25978. doAnimate ?
  25979. this.$backdrop
  25980. .one('bsTransitionEnd', callback)
  25981. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  25982. callback()
  25983. } else if (!this.isShown && this.$backdrop) {
  25984. this.$backdrop.removeClass('in')
  25985. var callbackRemove = function () {
  25986. that.removeBackdrop()
  25987. callback && callback()
  25988. }
  25989. $.support.transition && this.$element.hasClass('fade') ?
  25990. this.$backdrop
  25991. .one('bsTransitionEnd', callbackRemove)
  25992. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  25993. callbackRemove()
  25994. } else if (callback) {
  25995. callback()
  25996. }
  25997. }
  25998. // these following methods are used to handle overflowing modals
  25999. Modal.prototype.handleUpdate = function () {
  26000. this.adjustDialog()
  26001. }
  26002. Modal.prototype.adjustDialog = function () {
  26003. var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
  26004. this.$element.css({
  26005. paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
  26006. paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
  26007. })
  26008. }
  26009. Modal.prototype.resetAdjustments = function () {
  26010. this.$element.css({
  26011. paddingLeft: '',
  26012. paddingRight: ''
  26013. })
  26014. }
  26015. Modal.prototype.checkScrollbar = function () {
  26016. var fullWindowWidth = window.innerWidth
  26017. if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
  26018. var documentElementRect = document.documentElement.getBoundingClientRect()
  26019. fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
  26020. }
  26021. this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
  26022. this.scrollbarWidth = this.measureScrollbar()
  26023. }
  26024. Modal.prototype.setScrollbar = function () {
  26025. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  26026. this.originalBodyPad = document.body.style.paddingRight || ''
  26027. if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
  26028. }
  26029. Modal.prototype.resetScrollbar = function () {
  26030. this.$body.css('padding-right', this.originalBodyPad)
  26031. }
  26032. Modal.prototype.measureScrollbar = function () { // thx walsh
  26033. var scrollDiv = document.createElement('div')
  26034. scrollDiv.className = 'modal-scrollbar-measure'
  26035. this.$body.append(scrollDiv)
  26036. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  26037. this.$body[0].removeChild(scrollDiv)
  26038. return scrollbarWidth
  26039. }
  26040. // MODAL PLUGIN DEFINITION
  26041. // =======================
  26042. function Plugin(option, _relatedTarget) {
  26043. return this.each(function () {
  26044. var $this = $(this)
  26045. var data = $this.data('bs.modal')
  26046. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  26047. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  26048. if (typeof option == 'string') data[option](_relatedTarget)
  26049. else if (options.show) data.show(_relatedTarget)
  26050. })
  26051. }
  26052. var old = $.fn.modal
  26053. $.fn.modal = Plugin
  26054. $.fn.modal.Constructor = Modal
  26055. // MODAL NO CONFLICT
  26056. // =================
  26057. $.fn.modal.noConflict = function () {
  26058. $.fn.modal = old
  26059. return this
  26060. }
  26061. // MODAL DATA-API
  26062. // ==============
  26063. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  26064. var $this = $(this)
  26065. var href = $this.attr('href')
  26066. var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
  26067. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  26068. if ($this.is('a')) e.preventDefault()
  26069. $target.one('show.bs.modal', function (showEvent) {
  26070. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  26071. $target.one('hidden.bs.modal', function () {
  26072. $this.is(':visible') && $this.trigger('focus')
  26073. })
  26074. })
  26075. Plugin.call($target, option, this)
  26076. })
  26077. }(jQuery);
  26078. /* ========================================================================
  26079. * Bootstrap: tooltip.js v3.3.7
  26080. * http://getbootstrap.com/javascript/#tooltip
  26081. * Inspired by the original jQuery.tipsy by Jason Frame
  26082. * ========================================================================
  26083. * Copyright 2011-2016 Twitter, Inc.
  26084. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26085. * ======================================================================== */
  26086. +function ($) {
  26087. 'use strict';
  26088. // TOOLTIP PUBLIC CLASS DEFINITION
  26089. // ===============================
  26090. var Tooltip = function (element, options) {
  26091. this.type = null
  26092. this.options = null
  26093. this.enabled = null
  26094. this.timeout = null
  26095. this.hoverState = null
  26096. this.$element = null
  26097. this.inState = null
  26098. this.init('tooltip', element, options)
  26099. }
  26100. Tooltip.VERSION = '3.3.7'
  26101. Tooltip.TRANSITION_DURATION = 150
  26102. Tooltip.DEFAULTS = {
  26103. animation: true,
  26104. placement: 'top',
  26105. selector: false,
  26106. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  26107. trigger: 'hover focus',
  26108. title: '',
  26109. delay: 0,
  26110. html: false,
  26111. container: false,
  26112. viewport: {
  26113. selector: 'body',
  26114. padding: 0
  26115. }
  26116. }
  26117. Tooltip.prototype.init = function (type, element, options) {
  26118. this.enabled = true
  26119. this.type = type
  26120. this.$element = $(element)
  26121. this.options = this.getOptions(options)
  26122. this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
  26123. this.inState = { click: false, hover: false, focus: false }
  26124. if (this.$element[0] instanceof document.constructor && !this.options.selector) {
  26125. throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
  26126. }
  26127. var triggers = this.options.trigger.split(' ')
  26128. for (var i = triggers.length; i--;) {
  26129. var trigger = triggers[i]
  26130. if (trigger == 'click') {
  26131. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  26132. } else if (trigger != 'manual') {
  26133. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  26134. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  26135. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  26136. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  26137. }
  26138. }
  26139. this.options.selector ?
  26140. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  26141. this.fixTitle()
  26142. }
  26143. Tooltip.prototype.getDefaults = function () {
  26144. return Tooltip.DEFAULTS
  26145. }
  26146. Tooltip.prototype.getOptions = function (options) {
  26147. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  26148. if (options.delay && typeof options.delay == 'number') {
  26149. options.delay = {
  26150. show: options.delay,
  26151. hide: options.delay
  26152. }
  26153. }
  26154. return options
  26155. }
  26156. Tooltip.prototype.getDelegateOptions = function () {
  26157. var options = {}
  26158. var defaults = this.getDefaults()
  26159. this._options && $.each(this._options, function (key, value) {
  26160. if (defaults[key] != value) options[key] = value
  26161. })
  26162. return options
  26163. }
  26164. Tooltip.prototype.enter = function (obj) {
  26165. var self = obj instanceof this.constructor ?
  26166. obj : $(obj.currentTarget).data('bs.' + this.type)
  26167. if (!self) {
  26168. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  26169. $(obj.currentTarget).data('bs.' + this.type, self)
  26170. }
  26171. if (obj instanceof $.Event) {
  26172. self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
  26173. }
  26174. if (self.tip().hasClass('in') || self.hoverState == 'in') {
  26175. self.hoverState = 'in'
  26176. return
  26177. }
  26178. clearTimeout(self.timeout)
  26179. self.hoverState = 'in'
  26180. if (!self.options.delay || !self.options.delay.show) return self.show()
  26181. self.timeout = setTimeout(function () {
  26182. if (self.hoverState == 'in') self.show()
  26183. }, self.options.delay.show)
  26184. }
  26185. Tooltip.prototype.isInStateTrue = function () {
  26186. for (var key in this.inState) {
  26187. if (this.inState[key]) return true
  26188. }
  26189. return false
  26190. }
  26191. Tooltip.prototype.leave = function (obj) {
  26192. var self = obj instanceof this.constructor ?
  26193. obj : $(obj.currentTarget).data('bs.' + this.type)
  26194. if (!self) {
  26195. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  26196. $(obj.currentTarget).data('bs.' + this.type, self)
  26197. }
  26198. if (obj instanceof $.Event) {
  26199. self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
  26200. }
  26201. if (self.isInStateTrue()) return
  26202. clearTimeout(self.timeout)
  26203. self.hoverState = 'out'
  26204. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  26205. self.timeout = setTimeout(function () {
  26206. if (self.hoverState == 'out') self.hide()
  26207. }, self.options.delay.hide)
  26208. }
  26209. Tooltip.prototype.show = function () {
  26210. var e = $.Event('show.bs.' + this.type)
  26211. if (this.hasContent() && this.enabled) {
  26212. this.$element.trigger(e)
  26213. var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
  26214. if (e.isDefaultPrevented() || !inDom) return
  26215. var that = this
  26216. var $tip = this.tip()
  26217. var tipId = this.getUID(this.type)
  26218. this.setContent()
  26219. $tip.attr('id', tipId)
  26220. this.$element.attr('aria-describedby', tipId)
  26221. if (this.options.animation) $tip.addClass('fade')
  26222. var placement = typeof this.options.placement == 'function' ?
  26223. this.options.placement.call(this, $tip[0], this.$element[0]) :
  26224. this.options.placement
  26225. var autoToken = /\s?auto?\s?/i
  26226. var autoPlace = autoToken.test(placement)
  26227. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  26228. $tip
  26229. .detach()
  26230. .css({ top: 0, left: 0, display: 'block' })
  26231. .addClass(placement)
  26232. .data('bs.' + this.type, this)
  26233. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  26234. this.$element.trigger('inserted.bs.' + this.type)
  26235. var pos = this.getPosition()
  26236. var actualWidth = $tip[0].offsetWidth
  26237. var actualHeight = $tip[0].offsetHeight
  26238. if (autoPlace) {
  26239. var orgPlacement = placement
  26240. var viewportDim = this.getPosition(this.$viewport)
  26241. placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
  26242. placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
  26243. placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
  26244. placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
  26245. placement
  26246. $tip
  26247. .removeClass(orgPlacement)
  26248. .addClass(placement)
  26249. }
  26250. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  26251. this.applyPlacement(calculatedOffset, placement)
  26252. var complete = function () {
  26253. var prevHoverState = that.hoverState
  26254. that.$element.trigger('shown.bs.' + that.type)
  26255. that.hoverState = null
  26256. if (prevHoverState == 'out') that.leave(that)
  26257. }
  26258. $.support.transition && this.$tip.hasClass('fade') ?
  26259. $tip
  26260. .one('bsTransitionEnd', complete)
  26261. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  26262. complete()
  26263. }
  26264. }
  26265. Tooltip.prototype.applyPlacement = function (offset, placement) {
  26266. var $tip = this.tip()
  26267. var width = $tip[0].offsetWidth
  26268. var height = $tip[0].offsetHeight
  26269. // manually read margins because getBoundingClientRect includes difference
  26270. var marginTop = parseInt($tip.css('margin-top'), 10)
  26271. var marginLeft = parseInt($tip.css('margin-left'), 10)
  26272. // we must check for NaN for ie 8/9
  26273. if (isNaN(marginTop)) marginTop = 0
  26274. if (isNaN(marginLeft)) marginLeft = 0
  26275. offset.top += marginTop
  26276. offset.left += marginLeft
  26277. // $.fn.offset doesn't round pixel values
  26278. // so we use setOffset directly with our own function B-0
  26279. $.offset.setOffset($tip[0], $.extend({
  26280. using: function (props) {
  26281. $tip.css({
  26282. top: Math.round(props.top),
  26283. left: Math.round(props.left)
  26284. })
  26285. }
  26286. }, offset), 0)
  26287. $tip.addClass('in')
  26288. // check to see if placing tip in new offset caused the tip to resize itself
  26289. var actualWidth = $tip[0].offsetWidth
  26290. var actualHeight = $tip[0].offsetHeight
  26291. if (placement == 'top' && actualHeight != height) {
  26292. offset.top = offset.top + height - actualHeight
  26293. }
  26294. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  26295. if (delta.left) offset.left += delta.left
  26296. else offset.top += delta.top
  26297. var isVertical = /top|bottom/.test(placement)
  26298. var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  26299. var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
  26300. $tip.offset(offset)
  26301. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  26302. }
  26303. Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
  26304. this.arrow()
  26305. .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
  26306. .css(isVertical ? 'top' : 'left', '')
  26307. }
  26308. Tooltip.prototype.setContent = function () {
  26309. var $tip = this.tip()
  26310. var title = this.getTitle()
  26311. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  26312. $tip.removeClass('fade in top bottom left right')
  26313. }
  26314. Tooltip.prototype.hide = function (callback) {
  26315. var that = this
  26316. var $tip = $(this.$tip)
  26317. var e = $.Event('hide.bs.' + this.type)
  26318. function complete() {
  26319. if (that.hoverState != 'in') $tip.detach()
  26320. if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
  26321. that.$element
  26322. .removeAttr('aria-describedby')
  26323. .trigger('hidden.bs.' + that.type)
  26324. }
  26325. callback && callback()
  26326. }
  26327. this.$element.trigger(e)
  26328. if (e.isDefaultPrevented()) return
  26329. $tip.removeClass('in')
  26330. $.support.transition && $tip.hasClass('fade') ?
  26331. $tip
  26332. .one('bsTransitionEnd', complete)
  26333. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  26334. complete()
  26335. this.hoverState = null
  26336. return this
  26337. }
  26338. Tooltip.prototype.fixTitle = function () {
  26339. var $e = this.$element
  26340. if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
  26341. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  26342. }
  26343. }
  26344. Tooltip.prototype.hasContent = function () {
  26345. return this.getTitle()
  26346. }
  26347. Tooltip.prototype.getPosition = function ($element) {
  26348. $element = $element || this.$element
  26349. var el = $element[0]
  26350. var isBody = el.tagName == 'BODY'
  26351. var elRect = el.getBoundingClientRect()
  26352. if (elRect.width == null) {
  26353. // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
  26354. elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
  26355. }
  26356. var isSvg = window.SVGElement && el instanceof window.SVGElement
  26357. // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
  26358. // See https://github.com/twbs/bootstrap/issues/20280
  26359. var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
  26360. var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
  26361. var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
  26362. return $.extend({}, elRect, scroll, outerDims, elOffset)
  26363. }
  26364. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  26365. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  26366. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  26367. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  26368. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  26369. }
  26370. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  26371. var delta = { top: 0, left: 0 }
  26372. if (!this.$viewport) return delta
  26373. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  26374. var viewportDimensions = this.getPosition(this.$viewport)
  26375. if (/right|left/.test(placement)) {
  26376. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  26377. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  26378. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  26379. delta.top = viewportDimensions.top - topEdgeOffset
  26380. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  26381. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  26382. }
  26383. } else {
  26384. var leftEdgeOffset = pos.left - viewportPadding
  26385. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  26386. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  26387. delta.left = viewportDimensions.left - leftEdgeOffset
  26388. } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
  26389. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  26390. }
  26391. }
  26392. return delta
  26393. }
  26394. Tooltip.prototype.getTitle = function () {
  26395. var title
  26396. var $e = this.$element
  26397. var o = this.options
  26398. title = $e.attr('data-original-title')
  26399. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  26400. return title
  26401. }
  26402. Tooltip.prototype.getUID = function (prefix) {
  26403. do prefix += ~~(Math.random() * 1000000)
  26404. while (document.getElementById(prefix))
  26405. return prefix
  26406. }
  26407. Tooltip.prototype.tip = function () {
  26408. if (!this.$tip) {
  26409. this.$tip = $(this.options.template)
  26410. if (this.$tip.length != 1) {
  26411. throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
  26412. }
  26413. }
  26414. return this.$tip
  26415. }
  26416. Tooltip.prototype.arrow = function () {
  26417. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  26418. }
  26419. Tooltip.prototype.enable = function () {
  26420. this.enabled = true
  26421. }
  26422. Tooltip.prototype.disable = function () {
  26423. this.enabled = false
  26424. }
  26425. Tooltip.prototype.toggleEnabled = function () {
  26426. this.enabled = !this.enabled
  26427. }
  26428. Tooltip.prototype.toggle = function (e) {
  26429. var self = this
  26430. if (e) {
  26431. self = $(e.currentTarget).data('bs.' + this.type)
  26432. if (!self) {
  26433. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  26434. $(e.currentTarget).data('bs.' + this.type, self)
  26435. }
  26436. }
  26437. if (e) {
  26438. self.inState.click = !self.inState.click
  26439. if (self.isInStateTrue()) self.enter(self)
  26440. else self.leave(self)
  26441. } else {
  26442. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  26443. }
  26444. }
  26445. Tooltip.prototype.destroy = function () {
  26446. var that = this
  26447. clearTimeout(this.timeout)
  26448. this.hide(function () {
  26449. that.$element.off('.' + that.type).removeData('bs.' + that.type)
  26450. if (that.$tip) {
  26451. that.$tip.detach()
  26452. }
  26453. that.$tip = null
  26454. that.$arrow = null
  26455. that.$viewport = null
  26456. that.$element = null
  26457. })
  26458. }
  26459. // TOOLTIP PLUGIN DEFINITION
  26460. // =========================
  26461. function Plugin(option) {
  26462. return this.each(function () {
  26463. var $this = $(this)
  26464. var data = $this.data('bs.tooltip')
  26465. var options = typeof option == 'object' && option
  26466. if (!data && /destroy|hide/.test(option)) return
  26467. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  26468. if (typeof option == 'string') data[option]()
  26469. })
  26470. }
  26471. var old = $.fn.tooltip
  26472. $.fn.tooltip = Plugin
  26473. $.fn.tooltip.Constructor = Tooltip
  26474. // TOOLTIP NO CONFLICT
  26475. // ===================
  26476. $.fn.tooltip.noConflict = function () {
  26477. $.fn.tooltip = old
  26478. return this
  26479. }
  26480. }(jQuery);
  26481. /* ========================================================================
  26482. * Bootstrap: popover.js v3.3.7
  26483. * http://getbootstrap.com/javascript/#popovers
  26484. * ========================================================================
  26485. * Copyright 2011-2016 Twitter, Inc.
  26486. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26487. * ======================================================================== */
  26488. +function ($) {
  26489. 'use strict';
  26490. // POPOVER PUBLIC CLASS DEFINITION
  26491. // ===============================
  26492. var Popover = function (element, options) {
  26493. this.init('popover', element, options)
  26494. }
  26495. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  26496. Popover.VERSION = '3.3.7'
  26497. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  26498. placement: 'right',
  26499. trigger: 'click',
  26500. content: '',
  26501. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  26502. })
  26503. // NOTE: POPOVER EXTENDS tooltip.js
  26504. // ================================
  26505. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  26506. Popover.prototype.constructor = Popover
  26507. Popover.prototype.getDefaults = function () {
  26508. return Popover.DEFAULTS
  26509. }
  26510. Popover.prototype.setContent = function () {
  26511. var $tip = this.tip()
  26512. var title = this.getTitle()
  26513. var content = this.getContent()
  26514. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  26515. $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
  26516. this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
  26517. ](content)
  26518. $tip.removeClass('fade top bottom left right in')
  26519. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  26520. // this manually by checking the contents.
  26521. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  26522. }
  26523. Popover.prototype.hasContent = function () {
  26524. return this.getTitle() || this.getContent()
  26525. }
  26526. Popover.prototype.getContent = function () {
  26527. var $e = this.$element
  26528. var o = this.options
  26529. return $e.attr('data-content')
  26530. || (typeof o.content == 'function' ?
  26531. o.content.call($e[0]) :
  26532. o.content)
  26533. }
  26534. Popover.prototype.arrow = function () {
  26535. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  26536. }
  26537. // POPOVER PLUGIN DEFINITION
  26538. // =========================
  26539. function Plugin(option) {
  26540. return this.each(function () {
  26541. var $this = $(this)
  26542. var data = $this.data('bs.popover')
  26543. var options = typeof option == 'object' && option
  26544. if (!data && /destroy|hide/.test(option)) return
  26545. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  26546. if (typeof option == 'string') data[option]()
  26547. })
  26548. }
  26549. var old = $.fn.popover
  26550. $.fn.popover = Plugin
  26551. $.fn.popover.Constructor = Popover
  26552. // POPOVER NO CONFLICT
  26553. // ===================
  26554. $.fn.popover.noConflict = function () {
  26555. $.fn.popover = old
  26556. return this
  26557. }
  26558. }(jQuery);
  26559. /* ========================================================================
  26560. * Bootstrap: scrollspy.js v3.3.7
  26561. * http://getbootstrap.com/javascript/#scrollspy
  26562. * ========================================================================
  26563. * Copyright 2011-2016 Twitter, Inc.
  26564. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26565. * ======================================================================== */
  26566. +function ($) {
  26567. 'use strict';
  26568. // SCROLLSPY CLASS DEFINITION
  26569. // ==========================
  26570. function ScrollSpy(element, options) {
  26571. this.$body = $(document.body)
  26572. this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
  26573. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  26574. this.selector = (this.options.target || '') + ' .nav li > a'
  26575. this.offsets = []
  26576. this.targets = []
  26577. this.activeTarget = null
  26578. this.scrollHeight = 0
  26579. this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
  26580. this.refresh()
  26581. this.process()
  26582. }
  26583. ScrollSpy.VERSION = '3.3.7'
  26584. ScrollSpy.DEFAULTS = {
  26585. offset: 10
  26586. }
  26587. ScrollSpy.prototype.getScrollHeight = function () {
  26588. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  26589. }
  26590. ScrollSpy.prototype.refresh = function () {
  26591. var that = this
  26592. var offsetMethod = 'offset'
  26593. var offsetBase = 0
  26594. this.offsets = []
  26595. this.targets = []
  26596. this.scrollHeight = this.getScrollHeight()
  26597. if (!$.isWindow(this.$scrollElement[0])) {
  26598. offsetMethod = 'position'
  26599. offsetBase = this.$scrollElement.scrollTop()
  26600. }
  26601. this.$body
  26602. .find(this.selector)
  26603. .map(function () {
  26604. var $el = $(this)
  26605. var href = $el.data('target') || $el.attr('href')
  26606. var $href = /^#./.test(href) && $(href)
  26607. return ($href
  26608. && $href.length
  26609. && $href.is(':visible')
  26610. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  26611. })
  26612. .sort(function (a, b) { return a[0] - b[0] })
  26613. .each(function () {
  26614. that.offsets.push(this[0])
  26615. that.targets.push(this[1])
  26616. })
  26617. }
  26618. ScrollSpy.prototype.process = function () {
  26619. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  26620. var scrollHeight = this.getScrollHeight()
  26621. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  26622. var offsets = this.offsets
  26623. var targets = this.targets
  26624. var activeTarget = this.activeTarget
  26625. var i
  26626. if (this.scrollHeight != scrollHeight) {
  26627. this.refresh()
  26628. }
  26629. if (scrollTop >= maxScroll) {
  26630. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  26631. }
  26632. if (activeTarget && scrollTop < offsets[0]) {
  26633. this.activeTarget = null
  26634. return this.clear()
  26635. }
  26636. for (i = offsets.length; i--;) {
  26637. activeTarget != targets[i]
  26638. && scrollTop >= offsets[i]
  26639. && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
  26640. && this.activate(targets[i])
  26641. }
  26642. }
  26643. ScrollSpy.prototype.activate = function (target) {
  26644. this.activeTarget = target
  26645. this.clear()
  26646. var selector = this.selector +
  26647. '[data-target="' + target + '"],' +
  26648. this.selector + '[href="' + target + '"]'
  26649. var active = $(selector)
  26650. .parents('li')
  26651. .addClass('active')
  26652. if (active.parent('.dropdown-menu').length) {
  26653. active = active
  26654. .closest('li.dropdown')
  26655. .addClass('active')
  26656. }
  26657. active.trigger('activate.bs.scrollspy')
  26658. }
  26659. ScrollSpy.prototype.clear = function () {
  26660. $(this.selector)
  26661. .parentsUntil(this.options.target, '.active')
  26662. .removeClass('active')
  26663. }
  26664. // SCROLLSPY PLUGIN DEFINITION
  26665. // ===========================
  26666. function Plugin(option) {
  26667. return this.each(function () {
  26668. var $this = $(this)
  26669. var data = $this.data('bs.scrollspy')
  26670. var options = typeof option == 'object' && option
  26671. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  26672. if (typeof option == 'string') data[option]()
  26673. })
  26674. }
  26675. var old = $.fn.scrollspy
  26676. $.fn.scrollspy = Plugin
  26677. $.fn.scrollspy.Constructor = ScrollSpy
  26678. // SCROLLSPY NO CONFLICT
  26679. // =====================
  26680. $.fn.scrollspy.noConflict = function () {
  26681. $.fn.scrollspy = old
  26682. return this
  26683. }
  26684. // SCROLLSPY DATA-API
  26685. // ==================
  26686. $(window).on('load.bs.scrollspy.data-api', function () {
  26687. $('[data-spy="scroll"]').each(function () {
  26688. var $spy = $(this)
  26689. Plugin.call($spy, $spy.data())
  26690. })
  26691. })
  26692. }(jQuery);
  26693. /* ========================================================================
  26694. * Bootstrap: tab.js v3.3.7
  26695. * http://getbootstrap.com/javascript/#tabs
  26696. * ========================================================================
  26697. * Copyright 2011-2016 Twitter, Inc.
  26698. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26699. * ======================================================================== */
  26700. +function ($) {
  26701. 'use strict';
  26702. // TAB CLASS DEFINITION
  26703. // ====================
  26704. var Tab = function (element) {
  26705. // jscs:disable requireDollarBeforejQueryAssignment
  26706. this.element = $(element)
  26707. // jscs:enable requireDollarBeforejQueryAssignment
  26708. }
  26709. Tab.VERSION = '3.3.7'
  26710. Tab.TRANSITION_DURATION = 150
  26711. Tab.prototype.show = function () {
  26712. var $this = this.element
  26713. var $ul = $this.closest('ul:not(.dropdown-menu)')
  26714. var selector = $this.data('target')
  26715. if (!selector) {
  26716. selector = $this.attr('href')
  26717. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  26718. }
  26719. if ($this.parent('li').hasClass('active')) return
  26720. var $previous = $ul.find('.active:last a')
  26721. var hideEvent = $.Event('hide.bs.tab', {
  26722. relatedTarget: $this[0]
  26723. })
  26724. var showEvent = $.Event('show.bs.tab', {
  26725. relatedTarget: $previous[0]
  26726. })
  26727. $previous.trigger(hideEvent)
  26728. $this.trigger(showEvent)
  26729. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
  26730. var $target = $(selector)
  26731. this.activate($this.closest('li'), $ul)
  26732. this.activate($target, $target.parent(), function () {
  26733. $previous.trigger({
  26734. type: 'hidden.bs.tab',
  26735. relatedTarget: $this[0]
  26736. })
  26737. $this.trigger({
  26738. type: 'shown.bs.tab',
  26739. relatedTarget: $previous[0]
  26740. })
  26741. })
  26742. }
  26743. Tab.prototype.activate = function (element, container, callback) {
  26744. var $active = container.find('> .active')
  26745. var transition = callback
  26746. && $.support.transition
  26747. && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
  26748. function next() {
  26749. $active
  26750. .removeClass('active')
  26751. .find('> .dropdown-menu > .active')
  26752. .removeClass('active')
  26753. .end()
  26754. .find('[data-toggle="tab"]')
  26755. .attr('aria-expanded', false)
  26756. element
  26757. .addClass('active')
  26758. .find('[data-toggle="tab"]')
  26759. .attr('aria-expanded', true)
  26760. if (transition) {
  26761. element[0].offsetWidth // reflow for transition
  26762. element.addClass('in')
  26763. } else {
  26764. element.removeClass('fade')
  26765. }
  26766. if (element.parent('.dropdown-menu').length) {
  26767. element
  26768. .closest('li.dropdown')
  26769. .addClass('active')
  26770. .end()
  26771. .find('[data-toggle="tab"]')
  26772. .attr('aria-expanded', true)
  26773. }
  26774. callback && callback()
  26775. }
  26776. $active.length && transition ?
  26777. $active
  26778. .one('bsTransitionEnd', next)
  26779. .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
  26780. next()
  26781. $active.removeClass('in')
  26782. }
  26783. // TAB PLUGIN DEFINITION
  26784. // =====================
  26785. function Plugin(option) {
  26786. return this.each(function () {
  26787. var $this = $(this)
  26788. var data = $this.data('bs.tab')
  26789. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  26790. if (typeof option == 'string') data[option]()
  26791. })
  26792. }
  26793. var old = $.fn.tab
  26794. $.fn.tab = Plugin
  26795. $.fn.tab.Constructor = Tab
  26796. // TAB NO CONFLICT
  26797. // ===============
  26798. $.fn.tab.noConflict = function () {
  26799. $.fn.tab = old
  26800. return this
  26801. }
  26802. // TAB DATA-API
  26803. // ============
  26804. var clickHandler = function (e) {
  26805. e.preventDefault()
  26806. Plugin.call($(this), 'show')
  26807. }
  26808. $(document)
  26809. .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
  26810. .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
  26811. }(jQuery);
  26812. /* ========================================================================
  26813. * Bootstrap: affix.js v3.3.7
  26814. * http://getbootstrap.com/javascript/#affix
  26815. * ========================================================================
  26816. * Copyright 2011-2016 Twitter, Inc.
  26817. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26818. * ======================================================================== */
  26819. +function ($) {
  26820. 'use strict';
  26821. // AFFIX CLASS DEFINITION
  26822. // ======================
  26823. var Affix = function (element, options) {
  26824. this.options = $.extend({}, Affix.DEFAULTS, options)
  26825. this.$target = $(this.options.target)
  26826. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  26827. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  26828. this.$element = $(element)
  26829. this.affixed = null
  26830. this.unpin = null
  26831. this.pinnedOffset = null
  26832. this.checkPosition()
  26833. }
  26834. Affix.VERSION = '3.3.7'
  26835. Affix.RESET = 'affix affix-top affix-bottom'
  26836. Affix.DEFAULTS = {
  26837. offset: 0,
  26838. target: window
  26839. }
  26840. Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  26841. var scrollTop = this.$target.scrollTop()
  26842. var position = this.$element.offset()
  26843. var targetHeight = this.$target.height()
  26844. if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  26845. if (this.affixed == 'bottom') {
  26846. if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  26847. return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  26848. }
  26849. var initializing = this.affixed == null
  26850. var colliderTop = initializing ? scrollTop : position.top
  26851. var colliderHeight = initializing ? targetHeight : height
  26852. if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  26853. if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  26854. return false
  26855. }
  26856. Affix.prototype.getPinnedOffset = function () {
  26857. if (this.pinnedOffset) return this.pinnedOffset
  26858. this.$element.removeClass(Affix.RESET).addClass('affix')
  26859. var scrollTop = this.$target.scrollTop()
  26860. var position = this.$element.offset()
  26861. return (this.pinnedOffset = position.top - scrollTop)
  26862. }
  26863. Affix.prototype.checkPositionWithEventLoop = function () {
  26864. setTimeout($.proxy(this.checkPosition, this), 1)
  26865. }
  26866. Affix.prototype.checkPosition = function () {
  26867. if (!this.$element.is(':visible')) return
  26868. var height = this.$element.height()
  26869. var offset = this.options.offset
  26870. var offsetTop = offset.top
  26871. var offsetBottom = offset.bottom
  26872. var scrollHeight = Math.max($(document).height(), $(document.body).height())
  26873. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  26874. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  26875. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  26876. var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  26877. if (this.affixed != affix) {
  26878. if (this.unpin != null) this.$element.css('top', '')
  26879. var affixType = 'affix' + (affix ? '-' + affix : '')
  26880. var e = $.Event(affixType + '.bs.affix')
  26881. this.$element.trigger(e)
  26882. if (e.isDefaultPrevented()) return
  26883. this.affixed = affix
  26884. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  26885. this.$element
  26886. .removeClass(Affix.RESET)
  26887. .addClass(affixType)
  26888. .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  26889. }
  26890. if (affix == 'bottom') {
  26891. this.$element.offset({
  26892. top: scrollHeight - height - offsetBottom
  26893. })
  26894. }
  26895. }
  26896. // AFFIX PLUGIN DEFINITION
  26897. // =======================
  26898. function Plugin(option) {
  26899. return this.each(function () {
  26900. var $this = $(this)
  26901. var data = $this.data('bs.affix')
  26902. var options = typeof option == 'object' && option
  26903. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  26904. if (typeof option == 'string') data[option]()
  26905. })
  26906. }
  26907. var old = $.fn.affix
  26908. $.fn.affix = Plugin
  26909. $.fn.affix.Constructor = Affix
  26910. // AFFIX NO CONFLICT
  26911. // =================
  26912. $.fn.affix.noConflict = function () {
  26913. $.fn.affix = old
  26914. return this
  26915. }
  26916. // AFFIX DATA-API
  26917. // ==============
  26918. $(window).on('load', function () {
  26919. $('[data-spy="affix"]').each(function () {
  26920. var $spy = $(this)
  26921. var data = $spy.data()
  26922. data.offset = data.offset || {}
  26923. if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  26924. if (data.offsetTop != null) data.offset.top = data.offsetTop
  26925. Plugin.call($spy, data)
  26926. })
  26927. })
  26928. }(jQuery);
  26929. /***/ }),
  26930. /* 15 */
  26931. /***/ (function(module, exports, __webpack_require__) {
  26932. module.exports = __webpack_require__(16);
  26933. /***/ }),
  26934. /* 16 */
  26935. /***/ (function(module, exports, __webpack_require__) {
  26936. "use strict";
  26937. var utils = __webpack_require__(0);
  26938. var bind = __webpack_require__(3);
  26939. var Axios = __webpack_require__(18);
  26940. var defaults = __webpack_require__(1);
  26941. /**
  26942. * Create an instance of Axios
  26943. *
  26944. * @param {Object} defaultConfig The default config for the instance
  26945. * @return {Axios} A new instance of Axios
  26946. */
  26947. function createInstance(defaultConfig) {
  26948. var context = new Axios(defaultConfig);
  26949. var instance = bind(Axios.prototype.request, context);
  26950. // Copy axios.prototype to instance
  26951. utils.extend(instance, Axios.prototype, context);
  26952. // Copy context to instance
  26953. utils.extend(instance, context);
  26954. return instance;
  26955. }
  26956. // Create the default instance to be exported
  26957. var axios = createInstance(defaults);
  26958. // Expose Axios class to allow class inheritance
  26959. axios.Axios = Axios;
  26960. // Factory for creating new instances
  26961. axios.create = function create(instanceConfig) {
  26962. return createInstance(utils.merge(defaults, instanceConfig));
  26963. };
  26964. // Expose Cancel & CancelToken
  26965. axios.Cancel = __webpack_require__(7);
  26966. axios.CancelToken = __webpack_require__(33);
  26967. axios.isCancel = __webpack_require__(6);
  26968. // Expose all/spread
  26969. axios.all = function all(promises) {
  26970. return Promise.all(promises);
  26971. };
  26972. axios.spread = __webpack_require__(34);
  26973. module.exports = axios;
  26974. // Allow use of default import syntax in TypeScript
  26975. module.exports.default = axios;
  26976. /***/ }),
  26977. /* 17 */
  26978. /***/ (function(module, exports) {
  26979. /*!
  26980. * Determine if an object is a Buffer
  26981. *
  26982. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  26983. * @license MIT
  26984. */
  26985. // The _isBuffer check is for Safari 5-7 support, because it's missing
  26986. // Object.prototype.constructor. Remove this eventually
  26987. module.exports = function (obj) {
  26988. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  26989. }
  26990. function isBuffer (obj) {
  26991. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  26992. }
  26993. // For Node v0.10 support. Remove this eventually.
  26994. function isSlowBuffer (obj) {
  26995. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  26996. }
  26997. /***/ }),
  26998. /* 18 */
  26999. /***/ (function(module, exports, __webpack_require__) {
  27000. "use strict";
  27001. var defaults = __webpack_require__(1);
  27002. var utils = __webpack_require__(0);
  27003. var InterceptorManager = __webpack_require__(28);
  27004. var dispatchRequest = __webpack_require__(29);
  27005. var isAbsoluteURL = __webpack_require__(31);
  27006. var combineURLs = __webpack_require__(32);
  27007. /**
  27008. * Create a new instance of Axios
  27009. *
  27010. * @param {Object} instanceConfig The default config for the instance
  27011. */
  27012. function Axios(instanceConfig) {
  27013. this.defaults = instanceConfig;
  27014. this.interceptors = {
  27015. request: new InterceptorManager(),
  27016. response: new InterceptorManager()
  27017. };
  27018. }
  27019. /**
  27020. * Dispatch a request
  27021. *
  27022. * @param {Object} config The config specific for this request (merged with this.defaults)
  27023. */
  27024. Axios.prototype.request = function request(config) {
  27025. /*eslint no-param-reassign:0*/
  27026. // Allow for axios('example/url'[, config]) a la fetch API
  27027. if (typeof config === 'string') {
  27028. config = utils.merge({
  27029. url: arguments[0]
  27030. }, arguments[1]);
  27031. }
  27032. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  27033. config.method = config.method.toLowerCase();
  27034. // Support baseURL config
  27035. if (config.baseURL && !isAbsoluteURL(config.url)) {
  27036. config.url = combineURLs(config.baseURL, config.url);
  27037. }
  27038. // Hook up interceptors middleware
  27039. var chain = [dispatchRequest, undefined];
  27040. var promise = Promise.resolve(config);
  27041. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  27042. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  27043. });
  27044. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  27045. chain.push(interceptor.fulfilled, interceptor.rejected);
  27046. });
  27047. while (chain.length) {
  27048. promise = promise.then(chain.shift(), chain.shift());
  27049. }
  27050. return promise;
  27051. };
  27052. // Provide aliases for supported request methods
  27053. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  27054. /*eslint func-names:0*/
  27055. Axios.prototype[method] = function(url, config) {
  27056. return this.request(utils.merge(config || {}, {
  27057. method: method,
  27058. url: url
  27059. }));
  27060. };
  27061. });
  27062. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  27063. /*eslint func-names:0*/
  27064. Axios.prototype[method] = function(url, data, config) {
  27065. return this.request(utils.merge(config || {}, {
  27066. method: method,
  27067. url: url,
  27068. data: data
  27069. }));
  27070. };
  27071. });
  27072. module.exports = Axios;
  27073. /***/ }),
  27074. /* 19 */
  27075. /***/ (function(module, exports) {
  27076. // shim for using process in browser
  27077. var process = module.exports = {};
  27078. // cached from whatever global is present so that test runners that stub it
  27079. // don't break things. But we need to wrap it in a try catch in case it is
  27080. // wrapped in strict mode code which doesn't define any globals. It's inside a
  27081. // function because try/catches deoptimize in certain engines.
  27082. var cachedSetTimeout;
  27083. var cachedClearTimeout;
  27084. function defaultSetTimout() {
  27085. throw new Error('setTimeout has not been defined');
  27086. }
  27087. function defaultClearTimeout () {
  27088. throw new Error('clearTimeout has not been defined');
  27089. }
  27090. (function () {
  27091. try {
  27092. if (typeof setTimeout === 'function') {
  27093. cachedSetTimeout = setTimeout;
  27094. } else {
  27095. cachedSetTimeout = defaultSetTimout;
  27096. }
  27097. } catch (e) {
  27098. cachedSetTimeout = defaultSetTimout;
  27099. }
  27100. try {
  27101. if (typeof clearTimeout === 'function') {
  27102. cachedClearTimeout = clearTimeout;
  27103. } else {
  27104. cachedClearTimeout = defaultClearTimeout;
  27105. }
  27106. } catch (e) {
  27107. cachedClearTimeout = defaultClearTimeout;
  27108. }
  27109. } ())
  27110. function runTimeout(fun) {
  27111. if (cachedSetTimeout === setTimeout) {
  27112. //normal enviroments in sane situations
  27113. return setTimeout(fun, 0);
  27114. }
  27115. // if setTimeout wasn't available but was latter defined
  27116. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  27117. cachedSetTimeout = setTimeout;
  27118. return setTimeout(fun, 0);
  27119. }
  27120. try {
  27121. // when when somebody has screwed with setTimeout but no I.E. maddness
  27122. return cachedSetTimeout(fun, 0);
  27123. } catch(e){
  27124. try {
  27125. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  27126. return cachedSetTimeout.call(null, fun, 0);
  27127. } catch(e){
  27128. // 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
  27129. return cachedSetTimeout.call(this, fun, 0);
  27130. }
  27131. }
  27132. }
  27133. function runClearTimeout(marker) {
  27134. if (cachedClearTimeout === clearTimeout) {
  27135. //normal enviroments in sane situations
  27136. return clearTimeout(marker);
  27137. }
  27138. // if clearTimeout wasn't available but was latter defined
  27139. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  27140. cachedClearTimeout = clearTimeout;
  27141. return clearTimeout(marker);
  27142. }
  27143. try {
  27144. // when when somebody has screwed with setTimeout but no I.E. maddness
  27145. return cachedClearTimeout(marker);
  27146. } catch (e){
  27147. try {
  27148. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  27149. return cachedClearTimeout.call(null, marker);
  27150. } catch (e){
  27151. // 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.
  27152. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  27153. return cachedClearTimeout.call(this, marker);
  27154. }
  27155. }
  27156. }
  27157. var queue = [];
  27158. var draining = false;
  27159. var currentQueue;
  27160. var queueIndex = -1;
  27161. function cleanUpNextTick() {
  27162. if (!draining || !currentQueue) {
  27163. return;
  27164. }
  27165. draining = false;
  27166. if (currentQueue.length) {
  27167. queue = currentQueue.concat(queue);
  27168. } else {
  27169. queueIndex = -1;
  27170. }
  27171. if (queue.length) {
  27172. drainQueue();
  27173. }
  27174. }
  27175. function drainQueue() {
  27176. if (draining) {
  27177. return;
  27178. }
  27179. var timeout = runTimeout(cleanUpNextTick);
  27180. draining = true;
  27181. var len = queue.length;
  27182. while(len) {
  27183. currentQueue = queue;
  27184. queue = [];
  27185. while (++queueIndex < len) {
  27186. if (currentQueue) {
  27187. currentQueue[queueIndex].run();
  27188. }
  27189. }
  27190. queueIndex = -1;
  27191. len = queue.length;
  27192. }
  27193. currentQueue = null;
  27194. draining = false;
  27195. runClearTimeout(timeout);
  27196. }
  27197. process.nextTick = function (fun) {
  27198. var args = new Array(arguments.length - 1);
  27199. if (arguments.length > 1) {
  27200. for (var i = 1; i < arguments.length; i++) {
  27201. args[i - 1] = arguments[i];
  27202. }
  27203. }
  27204. queue.push(new Item(fun, args));
  27205. if (queue.length === 1 && !draining) {
  27206. runTimeout(drainQueue);
  27207. }
  27208. };
  27209. // v8 likes predictible objects
  27210. function Item(fun, array) {
  27211. this.fun = fun;
  27212. this.array = array;
  27213. }
  27214. Item.prototype.run = function () {
  27215. this.fun.apply(null, this.array);
  27216. };
  27217. process.title = 'browser';
  27218. process.browser = true;
  27219. process.env = {};
  27220. process.argv = [];
  27221. process.version = ''; // empty string to avoid regexp issues
  27222. process.versions = {};
  27223. function noop() {}
  27224. process.on = noop;
  27225. process.addListener = noop;
  27226. process.once = noop;
  27227. process.off = noop;
  27228. process.removeListener = noop;
  27229. process.removeAllListeners = noop;
  27230. process.emit = noop;
  27231. process.prependListener = noop;
  27232. process.prependOnceListener = noop;
  27233. process.listeners = function (name) { return [] }
  27234. process.binding = function (name) {
  27235. throw new Error('process.binding is not supported');
  27236. };
  27237. process.cwd = function () { return '/' };
  27238. process.chdir = function (dir) {
  27239. throw new Error('process.chdir is not supported');
  27240. };
  27241. process.umask = function() { return 0; };
  27242. /***/ }),
  27243. /* 20 */
  27244. /***/ (function(module, exports, __webpack_require__) {
  27245. "use strict";
  27246. var utils = __webpack_require__(0);
  27247. module.exports = function normalizeHeaderName(headers, normalizedName) {
  27248. utils.forEach(headers, function processHeader(value, name) {
  27249. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  27250. headers[normalizedName] = value;
  27251. delete headers[name];
  27252. }
  27253. });
  27254. };
  27255. /***/ }),
  27256. /* 21 */
  27257. /***/ (function(module, exports, __webpack_require__) {
  27258. "use strict";
  27259. var createError = __webpack_require__(5);
  27260. /**
  27261. * Resolve or reject a Promise based on response status.
  27262. *
  27263. * @param {Function} resolve A function that resolves the promise.
  27264. * @param {Function} reject A function that rejects the promise.
  27265. * @param {object} response The response.
  27266. */
  27267. module.exports = function settle(resolve, reject, response) {
  27268. var validateStatus = response.config.validateStatus;
  27269. // Note: status is not exposed by XDomainRequest
  27270. if (!response.status || !validateStatus || validateStatus(response.status)) {
  27271. resolve(response);
  27272. } else {
  27273. reject(createError(
  27274. 'Request failed with status code ' + response.status,
  27275. response.config,
  27276. null,
  27277. response.request,
  27278. response
  27279. ));
  27280. }
  27281. };
  27282. /***/ }),
  27283. /* 22 */
  27284. /***/ (function(module, exports, __webpack_require__) {
  27285. "use strict";
  27286. /**
  27287. * Update an Error with the specified config, error code, and response.
  27288. *
  27289. * @param {Error} error The error to update.
  27290. * @param {Object} config The config.
  27291. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  27292. * @param {Object} [request] The request.
  27293. * @param {Object} [response] The response.
  27294. * @returns {Error} The error.
  27295. */
  27296. module.exports = function enhanceError(error, config, code, request, response) {
  27297. error.config = config;
  27298. if (code) {
  27299. error.code = code;
  27300. }
  27301. error.request = request;
  27302. error.response = response;
  27303. return error;
  27304. };
  27305. /***/ }),
  27306. /* 23 */
  27307. /***/ (function(module, exports, __webpack_require__) {
  27308. "use strict";
  27309. var utils = __webpack_require__(0);
  27310. function encode(val) {
  27311. return encodeURIComponent(val).
  27312. replace(/%40/gi, '@').
  27313. replace(/%3A/gi, ':').
  27314. replace(/%24/g, '$').
  27315. replace(/%2C/gi, ',').
  27316. replace(/%20/g, '+').
  27317. replace(/%5B/gi, '[').
  27318. replace(/%5D/gi, ']');
  27319. }
  27320. /**
  27321. * Build a URL by appending params to the end
  27322. *
  27323. * @param {string} url The base of the url (e.g., http://www.google.com)
  27324. * @param {object} [params] The params to be appended
  27325. * @returns {string} The formatted url
  27326. */
  27327. module.exports = function buildURL(url, params, paramsSerializer) {
  27328. /*eslint no-param-reassign:0*/
  27329. if (!params) {
  27330. return url;
  27331. }
  27332. var serializedParams;
  27333. if (paramsSerializer) {
  27334. serializedParams = paramsSerializer(params);
  27335. } else if (utils.isURLSearchParams(params)) {
  27336. serializedParams = params.toString();
  27337. } else {
  27338. var parts = [];
  27339. utils.forEach(params, function serialize(val, key) {
  27340. if (val === null || typeof val === 'undefined') {
  27341. return;
  27342. }
  27343. if (utils.isArray(val)) {
  27344. key = key + '[]';
  27345. }
  27346. if (!utils.isArray(val)) {
  27347. val = [val];
  27348. }
  27349. utils.forEach(val, function parseValue(v) {
  27350. if (utils.isDate(v)) {
  27351. v = v.toISOString();
  27352. } else if (utils.isObject(v)) {
  27353. v = JSON.stringify(v);
  27354. }
  27355. parts.push(encode(key) + '=' + encode(v));
  27356. });
  27357. });
  27358. serializedParams = parts.join('&');
  27359. }
  27360. if (serializedParams) {
  27361. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  27362. }
  27363. return url;
  27364. };
  27365. /***/ }),
  27366. /* 24 */
  27367. /***/ (function(module, exports, __webpack_require__) {
  27368. "use strict";
  27369. var utils = __webpack_require__(0);
  27370. /**
  27371. * Parse headers into an object
  27372. *
  27373. * ```
  27374. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  27375. * Content-Type: application/json
  27376. * Connection: keep-alive
  27377. * Transfer-Encoding: chunked
  27378. * ```
  27379. *
  27380. * @param {String} headers Headers needing to be parsed
  27381. * @returns {Object} Headers parsed into an object
  27382. */
  27383. module.exports = function parseHeaders(headers) {
  27384. var parsed = {};
  27385. var key;
  27386. var val;
  27387. var i;
  27388. if (!headers) { return parsed; }
  27389. utils.forEach(headers.split('\n'), function parser(line) {
  27390. i = line.indexOf(':');
  27391. key = utils.trim(line.substr(0, i)).toLowerCase();
  27392. val = utils.trim(line.substr(i + 1));
  27393. if (key) {
  27394. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  27395. }
  27396. });
  27397. return parsed;
  27398. };
  27399. /***/ }),
  27400. /* 25 */
  27401. /***/ (function(module, exports, __webpack_require__) {
  27402. "use strict";
  27403. var utils = __webpack_require__(0);
  27404. module.exports = (
  27405. utils.isStandardBrowserEnv() ?
  27406. // Standard browser envs have full support of the APIs needed to test
  27407. // whether the request URL is of the same origin as current location.
  27408. (function standardBrowserEnv() {
  27409. var msie = /(msie|trident)/i.test(navigator.userAgent);
  27410. var urlParsingNode = document.createElement('a');
  27411. var originURL;
  27412. /**
  27413. * Parse a URL to discover it's components
  27414. *
  27415. * @param {String} url The URL to be parsed
  27416. * @returns {Object}
  27417. */
  27418. function resolveURL(url) {
  27419. var href = url;
  27420. if (msie) {
  27421. // IE needs attribute set twice to normalize properties
  27422. urlParsingNode.setAttribute('href', href);
  27423. href = urlParsingNode.href;
  27424. }
  27425. urlParsingNode.setAttribute('href', href);
  27426. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  27427. return {
  27428. href: urlParsingNode.href,
  27429. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  27430. host: urlParsingNode.host,
  27431. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  27432. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  27433. hostname: urlParsingNode.hostname,
  27434. port: urlParsingNode.port,
  27435. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  27436. urlParsingNode.pathname :
  27437. '/' + urlParsingNode.pathname
  27438. };
  27439. }
  27440. originURL = resolveURL(window.location.href);
  27441. /**
  27442. * Determine if a URL shares the same origin as the current location
  27443. *
  27444. * @param {String} requestURL The URL to test
  27445. * @returns {boolean} True if URL shares the same origin, otherwise false
  27446. */
  27447. return function isURLSameOrigin(requestURL) {
  27448. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  27449. return (parsed.protocol === originURL.protocol &&
  27450. parsed.host === originURL.host);
  27451. };
  27452. })() :
  27453. // Non standard browser envs (web workers, react-native) lack needed support.
  27454. (function nonStandardBrowserEnv() {
  27455. return function isURLSameOrigin() {
  27456. return true;
  27457. };
  27458. })()
  27459. );
  27460. /***/ }),
  27461. /* 26 */
  27462. /***/ (function(module, exports, __webpack_require__) {
  27463. "use strict";
  27464. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  27465. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  27466. function E() {
  27467. this.message = 'String contains an invalid character';
  27468. }
  27469. E.prototype = new Error;
  27470. E.prototype.code = 5;
  27471. E.prototype.name = 'InvalidCharacterError';
  27472. function btoa(input) {
  27473. var str = String(input);
  27474. var output = '';
  27475. for (
  27476. // initialize result and counter
  27477. var block, charCode, idx = 0, map = chars;
  27478. // if the next str index does not exist:
  27479. // change the mapping table to "="
  27480. // check if d has no fractional digits
  27481. str.charAt(idx | 0) || (map = '=', idx % 1);
  27482. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  27483. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  27484. ) {
  27485. charCode = str.charCodeAt(idx += 3 / 4);
  27486. if (charCode > 0xFF) {
  27487. throw new E();
  27488. }
  27489. block = block << 8 | charCode;
  27490. }
  27491. return output;
  27492. }
  27493. module.exports = btoa;
  27494. /***/ }),
  27495. /* 27 */
  27496. /***/ (function(module, exports, __webpack_require__) {
  27497. "use strict";
  27498. var utils = __webpack_require__(0);
  27499. module.exports = (
  27500. utils.isStandardBrowserEnv() ?
  27501. // Standard browser envs support document.cookie
  27502. (function standardBrowserEnv() {
  27503. return {
  27504. write: function write(name, value, expires, path, domain, secure) {
  27505. var cookie = [];
  27506. cookie.push(name + '=' + encodeURIComponent(value));
  27507. if (utils.isNumber(expires)) {
  27508. cookie.push('expires=' + new Date(expires).toGMTString());
  27509. }
  27510. if (utils.isString(path)) {
  27511. cookie.push('path=' + path);
  27512. }
  27513. if (utils.isString(domain)) {
  27514. cookie.push('domain=' + domain);
  27515. }
  27516. if (secure === true) {
  27517. cookie.push('secure');
  27518. }
  27519. document.cookie = cookie.join('; ');
  27520. },
  27521. read: function read(name) {
  27522. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  27523. return (match ? decodeURIComponent(match[3]) : null);
  27524. },
  27525. remove: function remove(name) {
  27526. this.write(name, '', Date.now() - 86400000);
  27527. }
  27528. };
  27529. })() :
  27530. // Non standard browser env (web workers, react-native) lack needed support.
  27531. (function nonStandardBrowserEnv() {
  27532. return {
  27533. write: function write() {},
  27534. read: function read() { return null; },
  27535. remove: function remove() {}
  27536. };
  27537. })()
  27538. );
  27539. /***/ }),
  27540. /* 28 */
  27541. /***/ (function(module, exports, __webpack_require__) {
  27542. "use strict";
  27543. var utils = __webpack_require__(0);
  27544. function InterceptorManager() {
  27545. this.handlers = [];
  27546. }
  27547. /**
  27548. * Add a new interceptor to the stack
  27549. *
  27550. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  27551. * @param {Function} rejected The function to handle `reject` for a `Promise`
  27552. *
  27553. * @return {Number} An ID used to remove interceptor later
  27554. */
  27555. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  27556. this.handlers.push({
  27557. fulfilled: fulfilled,
  27558. rejected: rejected
  27559. });
  27560. return this.handlers.length - 1;
  27561. };
  27562. /**
  27563. * Remove an interceptor from the stack
  27564. *
  27565. * @param {Number} id The ID that was returned by `use`
  27566. */
  27567. InterceptorManager.prototype.eject = function eject(id) {
  27568. if (this.handlers[id]) {
  27569. this.handlers[id] = null;
  27570. }
  27571. };
  27572. /**
  27573. * Iterate over all the registered interceptors
  27574. *
  27575. * This method is particularly useful for skipping over any
  27576. * interceptors that may have become `null` calling `eject`.
  27577. *
  27578. * @param {Function} fn The function to call for each interceptor
  27579. */
  27580. InterceptorManager.prototype.forEach = function forEach(fn) {
  27581. utils.forEach(this.handlers, function forEachHandler(h) {
  27582. if (h !== null) {
  27583. fn(h);
  27584. }
  27585. });
  27586. };
  27587. module.exports = InterceptorManager;
  27588. /***/ }),
  27589. /* 29 */
  27590. /***/ (function(module, exports, __webpack_require__) {
  27591. "use strict";
  27592. var utils = __webpack_require__(0);
  27593. var transformData = __webpack_require__(30);
  27594. var isCancel = __webpack_require__(6);
  27595. var defaults = __webpack_require__(1);
  27596. /**
  27597. * Throws a `Cancel` if cancellation has been requested.
  27598. */
  27599. function throwIfCancellationRequested(config) {
  27600. if (config.cancelToken) {
  27601. config.cancelToken.throwIfRequested();
  27602. }
  27603. }
  27604. /**
  27605. * Dispatch a request to the server using the configured adapter.
  27606. *
  27607. * @param {object} config The config that is to be used for the request
  27608. * @returns {Promise} The Promise to be fulfilled
  27609. */
  27610. module.exports = function dispatchRequest(config) {
  27611. throwIfCancellationRequested(config);
  27612. // Ensure headers exist
  27613. config.headers = config.headers || {};
  27614. // Transform request data
  27615. config.data = transformData(
  27616. config.data,
  27617. config.headers,
  27618. config.transformRequest
  27619. );
  27620. // Flatten headers
  27621. config.headers = utils.merge(
  27622. config.headers.common || {},
  27623. config.headers[config.method] || {},
  27624. config.headers || {}
  27625. );
  27626. utils.forEach(
  27627. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  27628. function cleanHeaderConfig(method) {
  27629. delete config.headers[method];
  27630. }
  27631. );
  27632. var adapter = config.adapter || defaults.adapter;
  27633. return adapter(config).then(function onAdapterResolution(response) {
  27634. throwIfCancellationRequested(config);
  27635. // Transform response data
  27636. response.data = transformData(
  27637. response.data,
  27638. response.headers,
  27639. config.transformResponse
  27640. );
  27641. return response;
  27642. }, function onAdapterRejection(reason) {
  27643. if (!isCancel(reason)) {
  27644. throwIfCancellationRequested(config);
  27645. // Transform response data
  27646. if (reason && reason.response) {
  27647. reason.response.data = transformData(
  27648. reason.response.data,
  27649. reason.response.headers,
  27650. config.transformResponse
  27651. );
  27652. }
  27653. }
  27654. return Promise.reject(reason);
  27655. });
  27656. };
  27657. /***/ }),
  27658. /* 30 */
  27659. /***/ (function(module, exports, __webpack_require__) {
  27660. "use strict";
  27661. var utils = __webpack_require__(0);
  27662. /**
  27663. * Transform the data for a request or a response
  27664. *
  27665. * @param {Object|String} data The data to be transformed
  27666. * @param {Array} headers The headers for the request or response
  27667. * @param {Array|Function} fns A single function or Array of functions
  27668. * @returns {*} The resulting transformed data
  27669. */
  27670. module.exports = function transformData(data, headers, fns) {
  27671. /*eslint no-param-reassign:0*/
  27672. utils.forEach(fns, function transform(fn) {
  27673. data = fn(data, headers);
  27674. });
  27675. return data;
  27676. };
  27677. /***/ }),
  27678. /* 31 */
  27679. /***/ (function(module, exports, __webpack_require__) {
  27680. "use strict";
  27681. /**
  27682. * Determines whether the specified URL is absolute
  27683. *
  27684. * @param {string} url The URL to test
  27685. * @returns {boolean} True if the specified URL is absolute, otherwise false
  27686. */
  27687. module.exports = function isAbsoluteURL(url) {
  27688. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  27689. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  27690. // by any combination of letters, digits, plus, period, or hyphen.
  27691. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  27692. };
  27693. /***/ }),
  27694. /* 32 */
  27695. /***/ (function(module, exports, __webpack_require__) {
  27696. "use strict";
  27697. /**
  27698. * Creates a new URL by combining the specified URLs
  27699. *
  27700. * @param {string} baseURL The base URL
  27701. * @param {string} relativeURL The relative URL
  27702. * @returns {string} The combined URL
  27703. */
  27704. module.exports = function combineURLs(baseURL, relativeURL) {
  27705. return relativeURL
  27706. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  27707. : baseURL;
  27708. };
  27709. /***/ }),
  27710. /* 33 */
  27711. /***/ (function(module, exports, __webpack_require__) {
  27712. "use strict";
  27713. var Cancel = __webpack_require__(7);
  27714. /**
  27715. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  27716. *
  27717. * @class
  27718. * @param {Function} executor The executor function.
  27719. */
  27720. function CancelToken(executor) {
  27721. if (typeof executor !== 'function') {
  27722. throw new TypeError('executor must be a function.');
  27723. }
  27724. var resolvePromise;
  27725. this.promise = new Promise(function promiseExecutor(resolve) {
  27726. resolvePromise = resolve;
  27727. });
  27728. var token = this;
  27729. executor(function cancel(message) {
  27730. if (token.reason) {
  27731. // Cancellation has already been requested
  27732. return;
  27733. }
  27734. token.reason = new Cancel(message);
  27735. resolvePromise(token.reason);
  27736. });
  27737. }
  27738. /**
  27739. * Throws a `Cancel` if cancellation has been requested.
  27740. */
  27741. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  27742. if (this.reason) {
  27743. throw this.reason;
  27744. }
  27745. };
  27746. /**
  27747. * Returns an object that contains a new `CancelToken` and a function that, when called,
  27748. * cancels the `CancelToken`.
  27749. */
  27750. CancelToken.source = function source() {
  27751. var cancel;
  27752. var token = new CancelToken(function executor(c) {
  27753. cancel = c;
  27754. });
  27755. return {
  27756. token: token,
  27757. cancel: cancel
  27758. };
  27759. };
  27760. module.exports = CancelToken;
  27761. /***/ }),
  27762. /* 34 */
  27763. /***/ (function(module, exports, __webpack_require__) {
  27764. "use strict";
  27765. /**
  27766. * Syntactic sugar for invoking a function and expanding an array for arguments.
  27767. *
  27768. * Common use case would be to use `Function.prototype.apply`.
  27769. *
  27770. * ```js
  27771. * function f(x, y, z) {}
  27772. * var args = [1, 2, 3];
  27773. * f.apply(null, args);
  27774. * ```
  27775. *
  27776. * With `spread` this example can be re-written.
  27777. *
  27778. * ```js
  27779. * spread(function(x, y, z) {})([1, 2, 3]);
  27780. * ```
  27781. *
  27782. * @param {Function} callback
  27783. * @returns {Function}
  27784. */
  27785. module.exports = function spread(callback) {
  27786. return function wrap(arr) {
  27787. return callback.apply(null, arr);
  27788. };
  27789. };
  27790. /***/ }),
  27791. /* 35 */
  27792. /***/ (function(module, exports, __webpack_require__) {
  27793. "use strict";
  27794. /* WEBPACK VAR INJECTION */(function(global) {/*!
  27795. * Vue.js v2.4.2
  27796. * (c) 2014-2017 Evan You
  27797. * Released under the MIT License.
  27798. */
  27799. /* */
  27800. // these helpers produces better vm code in JS engines due to their
  27801. // explicitness and function inlining
  27802. function isUndef (v) {
  27803. return v === undefined || v === null
  27804. }
  27805. function isDef (v) {
  27806. return v !== undefined && v !== null
  27807. }
  27808. function isTrue (v) {
  27809. return v === true
  27810. }
  27811. function isFalse (v) {
  27812. return v === false
  27813. }
  27814. /**
  27815. * Check if value is primitive
  27816. */
  27817. function isPrimitive (value) {
  27818. return (
  27819. typeof value === 'string' ||
  27820. typeof value === 'number' ||
  27821. typeof value === 'boolean'
  27822. )
  27823. }
  27824. /**
  27825. * Quick object check - this is primarily used to tell
  27826. * Objects from primitive values when we know the value
  27827. * is a JSON-compliant type.
  27828. */
  27829. function isObject (obj) {
  27830. return obj !== null && typeof obj === 'object'
  27831. }
  27832. var _toString = Object.prototype.toString;
  27833. /**
  27834. * Strict object type check. Only returns true
  27835. * for plain JavaScript objects.
  27836. */
  27837. function isPlainObject (obj) {
  27838. return _toString.call(obj) === '[object Object]'
  27839. }
  27840. function isRegExp (v) {
  27841. return _toString.call(v) === '[object RegExp]'
  27842. }
  27843. /**
  27844. * Check if val is a valid array index.
  27845. */
  27846. function isValidArrayIndex (val) {
  27847. var n = parseFloat(val);
  27848. return n >= 0 && Math.floor(n) === n && isFinite(val)
  27849. }
  27850. /**
  27851. * Convert a value to a string that is actually rendered.
  27852. */
  27853. function toString (val) {
  27854. return val == null
  27855. ? ''
  27856. : typeof val === 'object'
  27857. ? JSON.stringify(val, null, 2)
  27858. : String(val)
  27859. }
  27860. /**
  27861. * Convert a input value to a number for persistence.
  27862. * If the conversion fails, return original string.
  27863. */
  27864. function toNumber (val) {
  27865. var n = parseFloat(val);
  27866. return isNaN(n) ? val : n
  27867. }
  27868. /**
  27869. * Make a map and return a function for checking if a key
  27870. * is in that map.
  27871. */
  27872. function makeMap (
  27873. str,
  27874. expectsLowerCase
  27875. ) {
  27876. var map = Object.create(null);
  27877. var list = str.split(',');
  27878. for (var i = 0; i < list.length; i++) {
  27879. map[list[i]] = true;
  27880. }
  27881. return expectsLowerCase
  27882. ? function (val) { return map[val.toLowerCase()]; }
  27883. : function (val) { return map[val]; }
  27884. }
  27885. /**
  27886. * Check if a tag is a built-in tag.
  27887. */
  27888. var isBuiltInTag = makeMap('slot,component', true);
  27889. /**
  27890. * Check if a attribute is a reserved attribute.
  27891. */
  27892. var isReservedAttribute = makeMap('key,ref,slot,is');
  27893. /**
  27894. * Remove an item from an array
  27895. */
  27896. function remove (arr, item) {
  27897. if (arr.length) {
  27898. var index = arr.indexOf(item);
  27899. if (index > -1) {
  27900. return arr.splice(index, 1)
  27901. }
  27902. }
  27903. }
  27904. /**
  27905. * Check whether the object has the property.
  27906. */
  27907. var hasOwnProperty = Object.prototype.hasOwnProperty;
  27908. function hasOwn (obj, key) {
  27909. return hasOwnProperty.call(obj, key)
  27910. }
  27911. /**
  27912. * Create a cached version of a pure function.
  27913. */
  27914. function cached (fn) {
  27915. var cache = Object.create(null);
  27916. return (function cachedFn (str) {
  27917. var hit = cache[str];
  27918. return hit || (cache[str] = fn(str))
  27919. })
  27920. }
  27921. /**
  27922. * Camelize a hyphen-delimited string.
  27923. */
  27924. var camelizeRE = /-(\w)/g;
  27925. var camelize = cached(function (str) {
  27926. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  27927. });
  27928. /**
  27929. * Capitalize a string.
  27930. */
  27931. var capitalize = cached(function (str) {
  27932. return str.charAt(0).toUpperCase() + str.slice(1)
  27933. });
  27934. /**
  27935. * Hyphenate a camelCase string.
  27936. */
  27937. var hyphenateRE = /([^-])([A-Z])/g;
  27938. var hyphenate = cached(function (str) {
  27939. return str
  27940. .replace(hyphenateRE, '$1-$2')
  27941. .replace(hyphenateRE, '$1-$2')
  27942. .toLowerCase()
  27943. });
  27944. /**
  27945. * Simple bind, faster than native
  27946. */
  27947. function bind (fn, ctx) {
  27948. function boundFn (a) {
  27949. var l = arguments.length;
  27950. return l
  27951. ? l > 1
  27952. ? fn.apply(ctx, arguments)
  27953. : fn.call(ctx, a)
  27954. : fn.call(ctx)
  27955. }
  27956. // record original fn length
  27957. boundFn._length = fn.length;
  27958. return boundFn
  27959. }
  27960. /**
  27961. * Convert an Array-like object to a real Array.
  27962. */
  27963. function toArray (list, start) {
  27964. start = start || 0;
  27965. var i = list.length - start;
  27966. var ret = new Array(i);
  27967. while (i--) {
  27968. ret[i] = list[i + start];
  27969. }
  27970. return ret
  27971. }
  27972. /**
  27973. * Mix properties into target object.
  27974. */
  27975. function extend (to, _from) {
  27976. for (var key in _from) {
  27977. to[key] = _from[key];
  27978. }
  27979. return to
  27980. }
  27981. /**
  27982. * Merge an Array of Objects into a single Object.
  27983. */
  27984. function toObject (arr) {
  27985. var res = {};
  27986. for (var i = 0; i < arr.length; i++) {
  27987. if (arr[i]) {
  27988. extend(res, arr[i]);
  27989. }
  27990. }
  27991. return res
  27992. }
  27993. /**
  27994. * Perform no operation.
  27995. * Stubbing args to make Flow happy without leaving useless transpiled code
  27996. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  27997. */
  27998. function noop (a, b, c) {}
  27999. /**
  28000. * Always return false.
  28001. */
  28002. var no = function (a, b, c) { return false; };
  28003. /**
  28004. * Return same value
  28005. */
  28006. var identity = function (_) { return _; };
  28007. /**
  28008. * Generate a static keys string from compiler modules.
  28009. */
  28010. function genStaticKeys (modules) {
  28011. return modules.reduce(function (keys, m) {
  28012. return keys.concat(m.staticKeys || [])
  28013. }, []).join(',')
  28014. }
  28015. /**
  28016. * Check if two values are loosely equal - that is,
  28017. * if they are plain objects, do they have the same shape?
  28018. */
  28019. function looseEqual (a, b) {
  28020. if (a === b) { return true }
  28021. var isObjectA = isObject(a);
  28022. var isObjectB = isObject(b);
  28023. if (isObjectA && isObjectB) {
  28024. try {
  28025. var isArrayA = Array.isArray(a);
  28026. var isArrayB = Array.isArray(b);
  28027. if (isArrayA && isArrayB) {
  28028. return a.length === b.length && a.every(function (e, i) {
  28029. return looseEqual(e, b[i])
  28030. })
  28031. } else if (!isArrayA && !isArrayB) {
  28032. var keysA = Object.keys(a);
  28033. var keysB = Object.keys(b);
  28034. return keysA.length === keysB.length && keysA.every(function (key) {
  28035. return looseEqual(a[key], b[key])
  28036. })
  28037. } else {
  28038. /* istanbul ignore next */
  28039. return false
  28040. }
  28041. } catch (e) {
  28042. /* istanbul ignore next */
  28043. return false
  28044. }
  28045. } else if (!isObjectA && !isObjectB) {
  28046. return String(a) === String(b)
  28047. } else {
  28048. return false
  28049. }
  28050. }
  28051. function looseIndexOf (arr, val) {
  28052. for (var i = 0; i < arr.length; i++) {
  28053. if (looseEqual(arr[i], val)) { return i }
  28054. }
  28055. return -1
  28056. }
  28057. /**
  28058. * Ensure a function is called only once.
  28059. */
  28060. function once (fn) {
  28061. var called = false;
  28062. return function () {
  28063. if (!called) {
  28064. called = true;
  28065. fn.apply(this, arguments);
  28066. }
  28067. }
  28068. }
  28069. var SSR_ATTR = 'data-server-rendered';
  28070. var ASSET_TYPES = [
  28071. 'component',
  28072. 'directive',
  28073. 'filter'
  28074. ];
  28075. var LIFECYCLE_HOOKS = [
  28076. 'beforeCreate',
  28077. 'created',
  28078. 'beforeMount',
  28079. 'mounted',
  28080. 'beforeUpdate',
  28081. 'updated',
  28082. 'beforeDestroy',
  28083. 'destroyed',
  28084. 'activated',
  28085. 'deactivated'
  28086. ];
  28087. /* */
  28088. var config = ({
  28089. /**
  28090. * Option merge strategies (used in core/util/options)
  28091. */
  28092. optionMergeStrategies: Object.create(null),
  28093. /**
  28094. * Whether to suppress warnings.
  28095. */
  28096. silent: false,
  28097. /**
  28098. * Show production mode tip message on boot?
  28099. */
  28100. productionTip: "development" !== 'production',
  28101. /**
  28102. * Whether to enable devtools
  28103. */
  28104. devtools: "development" !== 'production',
  28105. /**
  28106. * Whether to record perf
  28107. */
  28108. performance: false,
  28109. /**
  28110. * Error handler for watcher errors
  28111. */
  28112. errorHandler: null,
  28113. /**
  28114. * Warn handler for watcher warns
  28115. */
  28116. warnHandler: null,
  28117. /**
  28118. * Ignore certain custom elements
  28119. */
  28120. ignoredElements: [],
  28121. /**
  28122. * Custom user key aliases for v-on
  28123. */
  28124. keyCodes: Object.create(null),
  28125. /**
  28126. * Check if a tag is reserved so that it cannot be registered as a
  28127. * component. This is platform-dependent and may be overwritten.
  28128. */
  28129. isReservedTag: no,
  28130. /**
  28131. * Check if an attribute is reserved so that it cannot be used as a component
  28132. * prop. This is platform-dependent and may be overwritten.
  28133. */
  28134. isReservedAttr: no,
  28135. /**
  28136. * Check if a tag is an unknown element.
  28137. * Platform-dependent.
  28138. */
  28139. isUnknownElement: no,
  28140. /**
  28141. * Get the namespace of an element
  28142. */
  28143. getTagNamespace: noop,
  28144. /**
  28145. * Parse the real tag name for the specific platform.
  28146. */
  28147. parsePlatformTagName: identity,
  28148. /**
  28149. * Check if an attribute must be bound using property, e.g. value
  28150. * Platform-dependent.
  28151. */
  28152. mustUseProp: no,
  28153. /**
  28154. * Exposed for legacy reasons
  28155. */
  28156. _lifecycleHooks: LIFECYCLE_HOOKS
  28157. });
  28158. /* */
  28159. var emptyObject = Object.freeze({});
  28160. /**
  28161. * Check if a string starts with $ or _
  28162. */
  28163. function isReserved (str) {
  28164. var c = (str + '').charCodeAt(0);
  28165. return c === 0x24 || c === 0x5F
  28166. }
  28167. /**
  28168. * Define a property.
  28169. */
  28170. function def (obj, key, val, enumerable) {
  28171. Object.defineProperty(obj, key, {
  28172. value: val,
  28173. enumerable: !!enumerable,
  28174. writable: true,
  28175. configurable: true
  28176. });
  28177. }
  28178. /**
  28179. * Parse simple path.
  28180. */
  28181. var bailRE = /[^\w.$]/;
  28182. function parsePath (path) {
  28183. if (bailRE.test(path)) {
  28184. return
  28185. }
  28186. var segments = path.split('.');
  28187. return function (obj) {
  28188. for (var i = 0; i < segments.length; i++) {
  28189. if (!obj) { return }
  28190. obj = obj[segments[i]];
  28191. }
  28192. return obj
  28193. }
  28194. }
  28195. /* */
  28196. var warn = noop;
  28197. var tip = noop;
  28198. var formatComponentName = (null); // work around flow check
  28199. if (true) {
  28200. var hasConsole = typeof console !== 'undefined';
  28201. var classifyRE = /(?:^|[-_])(\w)/g;
  28202. var classify = function (str) { return str
  28203. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  28204. .replace(/[-_]/g, ''); };
  28205. warn = function (msg, vm) {
  28206. var trace = vm ? generateComponentTrace(vm) : '';
  28207. if (config.warnHandler) {
  28208. config.warnHandler.call(null, msg, vm, trace);
  28209. } else if (hasConsole && (!config.silent)) {
  28210. console.error(("[Vue warn]: " + msg + trace));
  28211. }
  28212. };
  28213. tip = function (msg, vm) {
  28214. if (hasConsole && (!config.silent)) {
  28215. console.warn("[Vue tip]: " + msg + (
  28216. vm ? generateComponentTrace(vm) : ''
  28217. ));
  28218. }
  28219. };
  28220. formatComponentName = function (vm, includeFile) {
  28221. if (vm.$root === vm) {
  28222. return '<Root>'
  28223. }
  28224. var name = typeof vm === 'string'
  28225. ? vm
  28226. : typeof vm === 'function' && vm.options
  28227. ? vm.options.name
  28228. : vm._isVue
  28229. ? vm.$options.name || vm.$options._componentTag
  28230. : vm.name;
  28231. var file = vm._isVue && vm.$options.__file;
  28232. if (!name && file) {
  28233. var match = file.match(/([^/\\]+)\.vue$/);
  28234. name = match && match[1];
  28235. }
  28236. return (
  28237. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  28238. (file && includeFile !== false ? (" at " + file) : '')
  28239. )
  28240. };
  28241. var repeat = function (str, n) {
  28242. var res = '';
  28243. while (n) {
  28244. if (n % 2 === 1) { res += str; }
  28245. if (n > 1) { str += str; }
  28246. n >>= 1;
  28247. }
  28248. return res
  28249. };
  28250. var generateComponentTrace = function (vm) {
  28251. if (vm._isVue && vm.$parent) {
  28252. var tree = [];
  28253. var currentRecursiveSequence = 0;
  28254. while (vm) {
  28255. if (tree.length > 0) {
  28256. var last = tree[tree.length - 1];
  28257. if (last.constructor === vm.constructor) {
  28258. currentRecursiveSequence++;
  28259. vm = vm.$parent;
  28260. continue
  28261. } else if (currentRecursiveSequence > 0) {
  28262. tree[tree.length - 1] = [last, currentRecursiveSequence];
  28263. currentRecursiveSequence = 0;
  28264. }
  28265. }
  28266. tree.push(vm);
  28267. vm = vm.$parent;
  28268. }
  28269. return '\n\nfound in\n\n' + tree
  28270. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  28271. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  28272. : formatComponentName(vm))); })
  28273. .join('\n')
  28274. } else {
  28275. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  28276. }
  28277. };
  28278. }
  28279. /* */
  28280. function handleError (err, vm, info) {
  28281. if (config.errorHandler) {
  28282. config.errorHandler.call(null, err, vm, info);
  28283. } else {
  28284. if (true) {
  28285. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  28286. }
  28287. /* istanbul ignore else */
  28288. if (inBrowser && typeof console !== 'undefined') {
  28289. console.error(err);
  28290. } else {
  28291. throw err
  28292. }
  28293. }
  28294. }
  28295. /* */
  28296. /* globals MutationObserver */
  28297. // can we use __proto__?
  28298. var hasProto = '__proto__' in {};
  28299. // Browser environment sniffing
  28300. var inBrowser = typeof window !== 'undefined';
  28301. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  28302. var isIE = UA && /msie|trident/.test(UA);
  28303. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  28304. var isEdge = UA && UA.indexOf('edge/') > 0;
  28305. var isAndroid = UA && UA.indexOf('android') > 0;
  28306. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  28307. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  28308. // Firefix has a "watch" function on Object.prototype...
  28309. var nativeWatch = ({}).watch;
  28310. var supportsPassive = false;
  28311. if (inBrowser) {
  28312. try {
  28313. var opts = {};
  28314. Object.defineProperty(opts, 'passive', ({
  28315. get: function get () {
  28316. /* istanbul ignore next */
  28317. supportsPassive = true;
  28318. }
  28319. })); // https://github.com/facebook/flow/issues/285
  28320. window.addEventListener('test-passive', null, opts);
  28321. } catch (e) {}
  28322. }
  28323. // this needs to be lazy-evaled because vue may be required before
  28324. // vue-server-renderer can set VUE_ENV
  28325. var _isServer;
  28326. var isServerRendering = function () {
  28327. if (_isServer === undefined) {
  28328. /* istanbul ignore if */
  28329. if (!inBrowser && typeof global !== 'undefined') {
  28330. // detect presence of vue-server-renderer and avoid
  28331. // Webpack shimming the process
  28332. _isServer = global['process'].env.VUE_ENV === 'server';
  28333. } else {
  28334. _isServer = false;
  28335. }
  28336. }
  28337. return _isServer
  28338. };
  28339. // detect devtools
  28340. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  28341. /* istanbul ignore next */
  28342. function isNative (Ctor) {
  28343. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  28344. }
  28345. var hasSymbol =
  28346. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  28347. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  28348. /**
  28349. * Defer a task to execute it asynchronously.
  28350. */
  28351. var nextTick = (function () {
  28352. var callbacks = [];
  28353. var pending = false;
  28354. var timerFunc;
  28355. function nextTickHandler () {
  28356. pending = false;
  28357. var copies = callbacks.slice(0);
  28358. callbacks.length = 0;
  28359. for (var i = 0; i < copies.length; i++) {
  28360. copies[i]();
  28361. }
  28362. }
  28363. // the nextTick behavior leverages the microtask queue, which can be accessed
  28364. // via either native Promise.then or MutationObserver.
  28365. // MutationObserver has wider support, however it is seriously bugged in
  28366. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  28367. // completely stops working after triggering a few times... so, if native
  28368. // Promise is available, we will use it:
  28369. /* istanbul ignore if */
  28370. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  28371. var p = Promise.resolve();
  28372. var logError = function (err) { console.error(err); };
  28373. timerFunc = function () {
  28374. p.then(nextTickHandler).catch(logError);
  28375. // in problematic UIWebViews, Promise.then doesn't completely break, but
  28376. // it can get stuck in a weird state where callbacks are pushed into the
  28377. // microtask queue but the queue isn't being flushed, until the browser
  28378. // needs to do some other work, e.g. handle a timer. Therefore we can
  28379. // "force" the microtask queue to be flushed by adding an empty timer.
  28380. if (isIOS) { setTimeout(noop); }
  28381. };
  28382. } else if (typeof MutationObserver !== 'undefined' && (
  28383. isNative(MutationObserver) ||
  28384. // PhantomJS and iOS 7.x
  28385. MutationObserver.toString() === '[object MutationObserverConstructor]'
  28386. )) {
  28387. // use MutationObserver where native Promise is not available,
  28388. // e.g. PhantomJS IE11, iOS7, Android 4.4
  28389. var counter = 1;
  28390. var observer = new MutationObserver(nextTickHandler);
  28391. var textNode = document.createTextNode(String(counter));
  28392. observer.observe(textNode, {
  28393. characterData: true
  28394. });
  28395. timerFunc = function () {
  28396. counter = (counter + 1) % 2;
  28397. textNode.data = String(counter);
  28398. };
  28399. } else {
  28400. // fallback to setTimeout
  28401. /* istanbul ignore next */
  28402. timerFunc = function () {
  28403. setTimeout(nextTickHandler, 0);
  28404. };
  28405. }
  28406. return function queueNextTick (cb, ctx) {
  28407. var _resolve;
  28408. callbacks.push(function () {
  28409. if (cb) {
  28410. try {
  28411. cb.call(ctx);
  28412. } catch (e) {
  28413. handleError(e, ctx, 'nextTick');
  28414. }
  28415. } else if (_resolve) {
  28416. _resolve(ctx);
  28417. }
  28418. });
  28419. if (!pending) {
  28420. pending = true;
  28421. timerFunc();
  28422. }
  28423. if (!cb && typeof Promise !== 'undefined') {
  28424. return new Promise(function (resolve, reject) {
  28425. _resolve = resolve;
  28426. })
  28427. }
  28428. }
  28429. })();
  28430. var _Set;
  28431. /* istanbul ignore if */
  28432. if (typeof Set !== 'undefined' && isNative(Set)) {
  28433. // use native Set when available.
  28434. _Set = Set;
  28435. } else {
  28436. // a non-standard Set polyfill that only works with primitive keys.
  28437. _Set = (function () {
  28438. function Set () {
  28439. this.set = Object.create(null);
  28440. }
  28441. Set.prototype.has = function has (key) {
  28442. return this.set[key] === true
  28443. };
  28444. Set.prototype.add = function add (key) {
  28445. this.set[key] = true;
  28446. };
  28447. Set.prototype.clear = function clear () {
  28448. this.set = Object.create(null);
  28449. };
  28450. return Set;
  28451. }());
  28452. }
  28453. /* */
  28454. var uid = 0;
  28455. /**
  28456. * A dep is an observable that can have multiple
  28457. * directives subscribing to it.
  28458. */
  28459. var Dep = function Dep () {
  28460. this.id = uid++;
  28461. this.subs = [];
  28462. };
  28463. Dep.prototype.addSub = function addSub (sub) {
  28464. this.subs.push(sub);
  28465. };
  28466. Dep.prototype.removeSub = function removeSub (sub) {
  28467. remove(this.subs, sub);
  28468. };
  28469. Dep.prototype.depend = function depend () {
  28470. if (Dep.target) {
  28471. Dep.target.addDep(this);
  28472. }
  28473. };
  28474. Dep.prototype.notify = function notify () {
  28475. // stabilize the subscriber list first
  28476. var subs = this.subs.slice();
  28477. for (var i = 0, l = subs.length; i < l; i++) {
  28478. subs[i].update();
  28479. }
  28480. };
  28481. // the current target watcher being evaluated.
  28482. // this is globally unique because there could be only one
  28483. // watcher being evaluated at any time.
  28484. Dep.target = null;
  28485. var targetStack = [];
  28486. function pushTarget (_target) {
  28487. if (Dep.target) { targetStack.push(Dep.target); }
  28488. Dep.target = _target;
  28489. }
  28490. function popTarget () {
  28491. Dep.target = targetStack.pop();
  28492. }
  28493. /*
  28494. * not type checking this file because flow doesn't play well with
  28495. * dynamically accessing methods on Array prototype
  28496. */
  28497. var arrayProto = Array.prototype;
  28498. var arrayMethods = Object.create(arrayProto);[
  28499. 'push',
  28500. 'pop',
  28501. 'shift',
  28502. 'unshift',
  28503. 'splice',
  28504. 'sort',
  28505. 'reverse'
  28506. ]
  28507. .forEach(function (method) {
  28508. // cache original method
  28509. var original = arrayProto[method];
  28510. def(arrayMethods, method, function mutator () {
  28511. var args = [], len = arguments.length;
  28512. while ( len-- ) args[ len ] = arguments[ len ];
  28513. var result = original.apply(this, args);
  28514. var ob = this.__ob__;
  28515. var inserted;
  28516. switch (method) {
  28517. case 'push':
  28518. case 'unshift':
  28519. inserted = args;
  28520. break
  28521. case 'splice':
  28522. inserted = args.slice(2);
  28523. break
  28524. }
  28525. if (inserted) { ob.observeArray(inserted); }
  28526. // notify change
  28527. ob.dep.notify();
  28528. return result
  28529. });
  28530. });
  28531. /* */
  28532. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  28533. /**
  28534. * By default, when a reactive property is set, the new value is
  28535. * also converted to become reactive. However when passing down props,
  28536. * we don't want to force conversion because the value may be a nested value
  28537. * under a frozen data structure. Converting it would defeat the optimization.
  28538. */
  28539. var observerState = {
  28540. shouldConvert: true
  28541. };
  28542. /**
  28543. * Observer class that are attached to each observed
  28544. * object. Once attached, the observer converts target
  28545. * object's property keys into getter/setters that
  28546. * collect dependencies and dispatches updates.
  28547. */
  28548. var Observer = function Observer (value) {
  28549. this.value = value;
  28550. this.dep = new Dep();
  28551. this.vmCount = 0;
  28552. def(value, '__ob__', this);
  28553. if (Array.isArray(value)) {
  28554. var augment = hasProto
  28555. ? protoAugment
  28556. : copyAugment;
  28557. augment(value, arrayMethods, arrayKeys);
  28558. this.observeArray(value);
  28559. } else {
  28560. this.walk(value);
  28561. }
  28562. };
  28563. /**
  28564. * Walk through each property and convert them into
  28565. * getter/setters. This method should only be called when
  28566. * value type is Object.
  28567. */
  28568. Observer.prototype.walk = function walk (obj) {
  28569. var keys = Object.keys(obj);
  28570. for (var i = 0; i < keys.length; i++) {
  28571. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  28572. }
  28573. };
  28574. /**
  28575. * Observe a list of Array items.
  28576. */
  28577. Observer.prototype.observeArray = function observeArray (items) {
  28578. for (var i = 0, l = items.length; i < l; i++) {
  28579. observe(items[i]);
  28580. }
  28581. };
  28582. // helpers
  28583. /**
  28584. * Augment an target Object or Array by intercepting
  28585. * the prototype chain using __proto__
  28586. */
  28587. function protoAugment (target, src, keys) {
  28588. /* eslint-disable no-proto */
  28589. target.__proto__ = src;
  28590. /* eslint-enable no-proto */
  28591. }
  28592. /**
  28593. * Augment an target Object or Array by defining
  28594. * hidden properties.
  28595. */
  28596. /* istanbul ignore next */
  28597. function copyAugment (target, src, keys) {
  28598. for (var i = 0, l = keys.length; i < l; i++) {
  28599. var key = keys[i];
  28600. def(target, key, src[key]);
  28601. }
  28602. }
  28603. /**
  28604. * Attempt to create an observer instance for a value,
  28605. * returns the new observer if successfully observed,
  28606. * or the existing observer if the value already has one.
  28607. */
  28608. function observe (value, asRootData) {
  28609. if (!isObject(value)) {
  28610. return
  28611. }
  28612. var ob;
  28613. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  28614. ob = value.__ob__;
  28615. } else if (
  28616. observerState.shouldConvert &&
  28617. !isServerRendering() &&
  28618. (Array.isArray(value) || isPlainObject(value)) &&
  28619. Object.isExtensible(value) &&
  28620. !value._isVue
  28621. ) {
  28622. ob = new Observer(value);
  28623. }
  28624. if (asRootData && ob) {
  28625. ob.vmCount++;
  28626. }
  28627. return ob
  28628. }
  28629. /**
  28630. * Define a reactive property on an Object.
  28631. */
  28632. function defineReactive$$1 (
  28633. obj,
  28634. key,
  28635. val,
  28636. customSetter,
  28637. shallow
  28638. ) {
  28639. var dep = new Dep();
  28640. var property = Object.getOwnPropertyDescriptor(obj, key);
  28641. if (property && property.configurable === false) {
  28642. return
  28643. }
  28644. // cater for pre-defined getter/setters
  28645. var getter = property && property.get;
  28646. var setter = property && property.set;
  28647. var childOb = !shallow && observe(val);
  28648. Object.defineProperty(obj, key, {
  28649. enumerable: true,
  28650. configurable: true,
  28651. get: function reactiveGetter () {
  28652. var value = getter ? getter.call(obj) : val;
  28653. if (Dep.target) {
  28654. dep.depend();
  28655. if (childOb) {
  28656. childOb.dep.depend();
  28657. }
  28658. if (Array.isArray(value)) {
  28659. dependArray(value);
  28660. }
  28661. }
  28662. return value
  28663. },
  28664. set: function reactiveSetter (newVal) {
  28665. var value = getter ? getter.call(obj) : val;
  28666. /* eslint-disable no-self-compare */
  28667. if (newVal === value || (newVal !== newVal && value !== value)) {
  28668. return
  28669. }
  28670. /* eslint-enable no-self-compare */
  28671. if ("development" !== 'production' && customSetter) {
  28672. customSetter();
  28673. }
  28674. if (setter) {
  28675. setter.call(obj, newVal);
  28676. } else {
  28677. val = newVal;
  28678. }
  28679. childOb = !shallow && observe(newVal);
  28680. dep.notify();
  28681. }
  28682. });
  28683. }
  28684. /**
  28685. * Set a property on an object. Adds the new property and
  28686. * triggers change notification if the property doesn't
  28687. * already exist.
  28688. */
  28689. function set (target, key, val) {
  28690. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28691. target.length = Math.max(target.length, key);
  28692. target.splice(key, 1, val);
  28693. return val
  28694. }
  28695. if (hasOwn(target, key)) {
  28696. target[key] = val;
  28697. return val
  28698. }
  28699. var ob = (target).__ob__;
  28700. if (target._isVue || (ob && ob.vmCount)) {
  28701. "development" !== 'production' && warn(
  28702. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  28703. 'at runtime - declare it upfront in the data option.'
  28704. );
  28705. return val
  28706. }
  28707. if (!ob) {
  28708. target[key] = val;
  28709. return val
  28710. }
  28711. defineReactive$$1(ob.value, key, val);
  28712. ob.dep.notify();
  28713. return val
  28714. }
  28715. /**
  28716. * Delete a property and trigger change if necessary.
  28717. */
  28718. function del (target, key) {
  28719. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28720. target.splice(key, 1);
  28721. return
  28722. }
  28723. var ob = (target).__ob__;
  28724. if (target._isVue || (ob && ob.vmCount)) {
  28725. "development" !== 'production' && warn(
  28726. 'Avoid deleting properties on a Vue instance or its root $data ' +
  28727. '- just set it to null.'
  28728. );
  28729. return
  28730. }
  28731. if (!hasOwn(target, key)) {
  28732. return
  28733. }
  28734. delete target[key];
  28735. if (!ob) {
  28736. return
  28737. }
  28738. ob.dep.notify();
  28739. }
  28740. /**
  28741. * Collect dependencies on array elements when the array is touched, since
  28742. * we cannot intercept array element access like property getters.
  28743. */
  28744. function dependArray (value) {
  28745. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  28746. e = value[i];
  28747. e && e.__ob__ && e.__ob__.dep.depend();
  28748. if (Array.isArray(e)) {
  28749. dependArray(e);
  28750. }
  28751. }
  28752. }
  28753. /* */
  28754. /**
  28755. * Option overwriting strategies are functions that handle
  28756. * how to merge a parent option value and a child option
  28757. * value into the final value.
  28758. */
  28759. var strats = config.optionMergeStrategies;
  28760. /**
  28761. * Options with restrictions
  28762. */
  28763. if (true) {
  28764. strats.el = strats.propsData = function (parent, child, vm, key) {
  28765. if (!vm) {
  28766. warn(
  28767. "option \"" + key + "\" can only be used during instance " +
  28768. 'creation with the `new` keyword.'
  28769. );
  28770. }
  28771. return defaultStrat(parent, child)
  28772. };
  28773. }
  28774. /**
  28775. * Helper that recursively merges two data objects together.
  28776. */
  28777. function mergeData (to, from) {
  28778. if (!from) { return to }
  28779. var key, toVal, fromVal;
  28780. var keys = Object.keys(from);
  28781. for (var i = 0; i < keys.length; i++) {
  28782. key = keys[i];
  28783. toVal = to[key];
  28784. fromVal = from[key];
  28785. if (!hasOwn(to, key)) {
  28786. set(to, key, fromVal);
  28787. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  28788. mergeData(toVal, fromVal);
  28789. }
  28790. }
  28791. return to
  28792. }
  28793. /**
  28794. * Data
  28795. */
  28796. function mergeDataOrFn (
  28797. parentVal,
  28798. childVal,
  28799. vm
  28800. ) {
  28801. if (!vm) {
  28802. // in a Vue.extend merge, both should be functions
  28803. if (!childVal) {
  28804. return parentVal
  28805. }
  28806. if (!parentVal) {
  28807. return childVal
  28808. }
  28809. // when parentVal & childVal are both present,
  28810. // we need to return a function that returns the
  28811. // merged result of both functions... no need to
  28812. // check if parentVal is a function here because
  28813. // it has to be a function to pass previous merges.
  28814. return function mergedDataFn () {
  28815. return mergeData(
  28816. typeof childVal === 'function' ? childVal.call(this) : childVal,
  28817. typeof parentVal === 'function' ? parentVal.call(this) : parentVal
  28818. )
  28819. }
  28820. } else if (parentVal || childVal) {
  28821. return function mergedInstanceDataFn () {
  28822. // instance merge
  28823. var instanceData = typeof childVal === 'function'
  28824. ? childVal.call(vm)
  28825. : childVal;
  28826. var defaultData = typeof parentVal === 'function'
  28827. ? parentVal.call(vm)
  28828. : undefined;
  28829. if (instanceData) {
  28830. return mergeData(instanceData, defaultData)
  28831. } else {
  28832. return defaultData
  28833. }
  28834. }
  28835. }
  28836. }
  28837. strats.data = function (
  28838. parentVal,
  28839. childVal,
  28840. vm
  28841. ) {
  28842. if (!vm) {
  28843. if (childVal && typeof childVal !== 'function') {
  28844. "development" !== 'production' && warn(
  28845. 'The "data" option should be a function ' +
  28846. 'that returns a per-instance value in component ' +
  28847. 'definitions.',
  28848. vm
  28849. );
  28850. return parentVal
  28851. }
  28852. return mergeDataOrFn.call(this, parentVal, childVal)
  28853. }
  28854. return mergeDataOrFn(parentVal, childVal, vm)
  28855. };
  28856. /**
  28857. * Hooks and props are merged as arrays.
  28858. */
  28859. function mergeHook (
  28860. parentVal,
  28861. childVal
  28862. ) {
  28863. return childVal
  28864. ? parentVal
  28865. ? parentVal.concat(childVal)
  28866. : Array.isArray(childVal)
  28867. ? childVal
  28868. : [childVal]
  28869. : parentVal
  28870. }
  28871. LIFECYCLE_HOOKS.forEach(function (hook) {
  28872. strats[hook] = mergeHook;
  28873. });
  28874. /**
  28875. * Assets
  28876. *
  28877. * When a vm is present (instance creation), we need to do
  28878. * a three-way merge between constructor options, instance
  28879. * options and parent options.
  28880. */
  28881. function mergeAssets (parentVal, childVal) {
  28882. var res = Object.create(parentVal || null);
  28883. return childVal
  28884. ? extend(res, childVal)
  28885. : res
  28886. }
  28887. ASSET_TYPES.forEach(function (type) {
  28888. strats[type + 's'] = mergeAssets;
  28889. });
  28890. /**
  28891. * Watchers.
  28892. *
  28893. * Watchers hashes should not overwrite one
  28894. * another, so we merge them as arrays.
  28895. */
  28896. strats.watch = function (parentVal, childVal) {
  28897. // work around Firefox's Object.prototype.watch...
  28898. if (parentVal === nativeWatch) { parentVal = undefined; }
  28899. if (childVal === nativeWatch) { childVal = undefined; }
  28900. /* istanbul ignore if */
  28901. if (!childVal) { return Object.create(parentVal || null) }
  28902. if (!parentVal) { return childVal }
  28903. var ret = {};
  28904. extend(ret, parentVal);
  28905. for (var key in childVal) {
  28906. var parent = ret[key];
  28907. var child = childVal[key];
  28908. if (parent && !Array.isArray(parent)) {
  28909. parent = [parent];
  28910. }
  28911. ret[key] = parent
  28912. ? parent.concat(child)
  28913. : Array.isArray(child) ? child : [child];
  28914. }
  28915. return ret
  28916. };
  28917. /**
  28918. * Other object hashes.
  28919. */
  28920. strats.props =
  28921. strats.methods =
  28922. strats.inject =
  28923. strats.computed = function (parentVal, childVal) {
  28924. if (!parentVal) { return childVal }
  28925. var ret = Object.create(null);
  28926. extend(ret, parentVal);
  28927. if (childVal) { extend(ret, childVal); }
  28928. return ret
  28929. };
  28930. strats.provide = mergeDataOrFn;
  28931. /**
  28932. * Default strategy.
  28933. */
  28934. var defaultStrat = function (parentVal, childVal) {
  28935. return childVal === undefined
  28936. ? parentVal
  28937. : childVal
  28938. };
  28939. /**
  28940. * Validate component names
  28941. */
  28942. function checkComponents (options) {
  28943. for (var key in options.components) {
  28944. var lower = key.toLowerCase();
  28945. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  28946. warn(
  28947. 'Do not use built-in or reserved HTML elements as component ' +
  28948. 'id: ' + key
  28949. );
  28950. }
  28951. }
  28952. }
  28953. /**
  28954. * Ensure all props option syntax are normalized into the
  28955. * Object-based format.
  28956. */
  28957. function normalizeProps (options) {
  28958. var props = options.props;
  28959. if (!props) { return }
  28960. var res = {};
  28961. var i, val, name;
  28962. if (Array.isArray(props)) {
  28963. i = props.length;
  28964. while (i--) {
  28965. val = props[i];
  28966. if (typeof val === 'string') {
  28967. name = camelize(val);
  28968. res[name] = { type: null };
  28969. } else if (true) {
  28970. warn('props must be strings when using array syntax.');
  28971. }
  28972. }
  28973. } else if (isPlainObject(props)) {
  28974. for (var key in props) {
  28975. val = props[key];
  28976. name = camelize(key);
  28977. res[name] = isPlainObject(val)
  28978. ? val
  28979. : { type: val };
  28980. }
  28981. }
  28982. options.props = res;
  28983. }
  28984. /**
  28985. * Normalize all injections into Object-based format
  28986. */
  28987. function normalizeInject (options) {
  28988. var inject = options.inject;
  28989. if (Array.isArray(inject)) {
  28990. var normalized = options.inject = {};
  28991. for (var i = 0; i < inject.length; i++) {
  28992. normalized[inject[i]] = inject[i];
  28993. }
  28994. }
  28995. }
  28996. /**
  28997. * Normalize raw function directives into object format.
  28998. */
  28999. function normalizeDirectives (options) {
  29000. var dirs = options.directives;
  29001. if (dirs) {
  29002. for (var key in dirs) {
  29003. var def = dirs[key];
  29004. if (typeof def === 'function') {
  29005. dirs[key] = { bind: def, update: def };
  29006. }
  29007. }
  29008. }
  29009. }
  29010. /**
  29011. * Merge two option objects into a new one.
  29012. * Core utility used in both instantiation and inheritance.
  29013. */
  29014. function mergeOptions (
  29015. parent,
  29016. child,
  29017. vm
  29018. ) {
  29019. if (true) {
  29020. checkComponents(child);
  29021. }
  29022. if (typeof child === 'function') {
  29023. child = child.options;
  29024. }
  29025. normalizeProps(child);
  29026. normalizeInject(child);
  29027. normalizeDirectives(child);
  29028. var extendsFrom = child.extends;
  29029. if (extendsFrom) {
  29030. parent = mergeOptions(parent, extendsFrom, vm);
  29031. }
  29032. if (child.mixins) {
  29033. for (var i = 0, l = child.mixins.length; i < l; i++) {
  29034. parent = mergeOptions(parent, child.mixins[i], vm);
  29035. }
  29036. }
  29037. var options = {};
  29038. var key;
  29039. for (key in parent) {
  29040. mergeField(key);
  29041. }
  29042. for (key in child) {
  29043. if (!hasOwn(parent, key)) {
  29044. mergeField(key);
  29045. }
  29046. }
  29047. function mergeField (key) {
  29048. var strat = strats[key] || defaultStrat;
  29049. options[key] = strat(parent[key], child[key], vm, key);
  29050. }
  29051. return options
  29052. }
  29053. /**
  29054. * Resolve an asset.
  29055. * This function is used because child instances need access
  29056. * to assets defined in its ancestor chain.
  29057. */
  29058. function resolveAsset (
  29059. options,
  29060. type,
  29061. id,
  29062. warnMissing
  29063. ) {
  29064. /* istanbul ignore if */
  29065. if (typeof id !== 'string') {
  29066. return
  29067. }
  29068. var assets = options[type];
  29069. // check local registration variations first
  29070. if (hasOwn(assets, id)) { return assets[id] }
  29071. var camelizedId = camelize(id);
  29072. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  29073. var PascalCaseId = capitalize(camelizedId);
  29074. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  29075. // fallback to prototype chain
  29076. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  29077. if ("development" !== 'production' && warnMissing && !res) {
  29078. warn(
  29079. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  29080. options
  29081. );
  29082. }
  29083. return res
  29084. }
  29085. /* */
  29086. function validateProp (
  29087. key,
  29088. propOptions,
  29089. propsData,
  29090. vm
  29091. ) {
  29092. var prop = propOptions[key];
  29093. var absent = !hasOwn(propsData, key);
  29094. var value = propsData[key];
  29095. // handle boolean props
  29096. if (isType(Boolean, prop.type)) {
  29097. if (absent && !hasOwn(prop, 'default')) {
  29098. value = false;
  29099. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  29100. value = true;
  29101. }
  29102. }
  29103. // check default value
  29104. if (value === undefined) {
  29105. value = getPropDefaultValue(vm, prop, key);
  29106. // since the default value is a fresh copy,
  29107. // make sure to observe it.
  29108. var prevShouldConvert = observerState.shouldConvert;
  29109. observerState.shouldConvert = true;
  29110. observe(value);
  29111. observerState.shouldConvert = prevShouldConvert;
  29112. }
  29113. if (true) {
  29114. assertProp(prop, key, value, vm, absent);
  29115. }
  29116. return value
  29117. }
  29118. /**
  29119. * Get the default value of a prop.
  29120. */
  29121. function getPropDefaultValue (vm, prop, key) {
  29122. // no default, return undefined
  29123. if (!hasOwn(prop, 'default')) {
  29124. return undefined
  29125. }
  29126. var def = prop.default;
  29127. // warn against non-factory defaults for Object & Array
  29128. if ("development" !== 'production' && isObject(def)) {
  29129. warn(
  29130. 'Invalid default value for prop "' + key + '": ' +
  29131. 'Props with type Object/Array must use a factory function ' +
  29132. 'to return the default value.',
  29133. vm
  29134. );
  29135. }
  29136. // the raw prop value was also undefined from previous render,
  29137. // return previous default value to avoid unnecessary watcher trigger
  29138. if (vm && vm.$options.propsData &&
  29139. vm.$options.propsData[key] === undefined &&
  29140. vm._props[key] !== undefined
  29141. ) {
  29142. return vm._props[key]
  29143. }
  29144. // call factory function for non-Function types
  29145. // a value is Function if its prototype is function even across different execution context
  29146. return typeof def === 'function' && getType(prop.type) !== 'Function'
  29147. ? def.call(vm)
  29148. : def
  29149. }
  29150. /**
  29151. * Assert whether a prop is valid.
  29152. */
  29153. function assertProp (
  29154. prop,
  29155. name,
  29156. value,
  29157. vm,
  29158. absent
  29159. ) {
  29160. if (prop.required && absent) {
  29161. warn(
  29162. 'Missing required prop: "' + name + '"',
  29163. vm
  29164. );
  29165. return
  29166. }
  29167. if (value == null && !prop.required) {
  29168. return
  29169. }
  29170. var type = prop.type;
  29171. var valid = !type || type === true;
  29172. var expectedTypes = [];
  29173. if (type) {
  29174. if (!Array.isArray(type)) {
  29175. type = [type];
  29176. }
  29177. for (var i = 0; i < type.length && !valid; i++) {
  29178. var assertedType = assertType(value, type[i]);
  29179. expectedTypes.push(assertedType.expectedType || '');
  29180. valid = assertedType.valid;
  29181. }
  29182. }
  29183. if (!valid) {
  29184. warn(
  29185. 'Invalid prop: type check failed for prop "' + name + '".' +
  29186. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  29187. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  29188. vm
  29189. );
  29190. return
  29191. }
  29192. var validator = prop.validator;
  29193. if (validator) {
  29194. if (!validator(value)) {
  29195. warn(
  29196. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  29197. vm
  29198. );
  29199. }
  29200. }
  29201. }
  29202. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  29203. function assertType (value, type) {
  29204. var valid;
  29205. var expectedType = getType(type);
  29206. if (simpleCheckRE.test(expectedType)) {
  29207. valid = typeof value === expectedType.toLowerCase();
  29208. } else if (expectedType === 'Object') {
  29209. valid = isPlainObject(value);
  29210. } else if (expectedType === 'Array') {
  29211. valid = Array.isArray(value);
  29212. } else {
  29213. valid = value instanceof type;
  29214. }
  29215. return {
  29216. valid: valid,
  29217. expectedType: expectedType
  29218. }
  29219. }
  29220. /**
  29221. * Use function string name to check built-in types,
  29222. * because a simple equality check will fail when running
  29223. * across different vms / iframes.
  29224. */
  29225. function getType (fn) {
  29226. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  29227. return match ? match[1] : ''
  29228. }
  29229. function isType (type, fn) {
  29230. if (!Array.isArray(fn)) {
  29231. return getType(fn) === getType(type)
  29232. }
  29233. for (var i = 0, len = fn.length; i < len; i++) {
  29234. if (getType(fn[i]) === getType(type)) {
  29235. return true
  29236. }
  29237. }
  29238. /* istanbul ignore next */
  29239. return false
  29240. }
  29241. /* */
  29242. var mark;
  29243. var measure;
  29244. if (true) {
  29245. var perf = inBrowser && window.performance;
  29246. /* istanbul ignore if */
  29247. if (
  29248. perf &&
  29249. perf.mark &&
  29250. perf.measure &&
  29251. perf.clearMarks &&
  29252. perf.clearMeasures
  29253. ) {
  29254. mark = function (tag) { return perf.mark(tag); };
  29255. measure = function (name, startTag, endTag) {
  29256. perf.measure(name, startTag, endTag);
  29257. perf.clearMarks(startTag);
  29258. perf.clearMarks(endTag);
  29259. perf.clearMeasures(name);
  29260. };
  29261. }
  29262. }
  29263. /* not type checking this file because flow doesn't play well with Proxy */
  29264. var initProxy;
  29265. if (true) {
  29266. var allowedGlobals = makeMap(
  29267. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  29268. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  29269. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  29270. 'require' // for Webpack/Browserify
  29271. );
  29272. var warnNonPresent = function (target, key) {
  29273. warn(
  29274. "Property or method \"" + key + "\" is not defined on the instance but " +
  29275. "referenced during render. Make sure to declare reactive data " +
  29276. "properties in the data option.",
  29277. target
  29278. );
  29279. };
  29280. var hasProxy =
  29281. typeof Proxy !== 'undefined' &&
  29282. Proxy.toString().match(/native code/);
  29283. if (hasProxy) {
  29284. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
  29285. config.keyCodes = new Proxy(config.keyCodes, {
  29286. set: function set (target, key, value) {
  29287. if (isBuiltInModifier(key)) {
  29288. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  29289. return false
  29290. } else {
  29291. target[key] = value;
  29292. return true
  29293. }
  29294. }
  29295. });
  29296. }
  29297. var hasHandler = {
  29298. has: function has (target, key) {
  29299. var has = key in target;
  29300. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  29301. if (!has && !isAllowed) {
  29302. warnNonPresent(target, key);
  29303. }
  29304. return has || !isAllowed
  29305. }
  29306. };
  29307. var getHandler = {
  29308. get: function get (target, key) {
  29309. if (typeof key === 'string' && !(key in target)) {
  29310. warnNonPresent(target, key);
  29311. }
  29312. return target[key]
  29313. }
  29314. };
  29315. initProxy = function initProxy (vm) {
  29316. if (hasProxy) {
  29317. // determine which proxy handler to use
  29318. var options = vm.$options;
  29319. var handlers = options.render && options.render._withStripped
  29320. ? getHandler
  29321. : hasHandler;
  29322. vm._renderProxy = new Proxy(vm, handlers);
  29323. } else {
  29324. vm._renderProxy = vm;
  29325. }
  29326. };
  29327. }
  29328. /* */
  29329. var VNode = function VNode (
  29330. tag,
  29331. data,
  29332. children,
  29333. text,
  29334. elm,
  29335. context,
  29336. componentOptions,
  29337. asyncFactory
  29338. ) {
  29339. this.tag = tag;
  29340. this.data = data;
  29341. this.children = children;
  29342. this.text = text;
  29343. this.elm = elm;
  29344. this.ns = undefined;
  29345. this.context = context;
  29346. this.functionalContext = undefined;
  29347. this.key = data && data.key;
  29348. this.componentOptions = componentOptions;
  29349. this.componentInstance = undefined;
  29350. this.parent = undefined;
  29351. this.raw = false;
  29352. this.isStatic = false;
  29353. this.isRootInsert = true;
  29354. this.isComment = false;
  29355. this.isCloned = false;
  29356. this.isOnce = false;
  29357. this.asyncFactory = asyncFactory;
  29358. this.asyncMeta = undefined;
  29359. this.isAsyncPlaceholder = false;
  29360. };
  29361. var prototypeAccessors = { child: {} };
  29362. // DEPRECATED: alias for componentInstance for backwards compat.
  29363. /* istanbul ignore next */
  29364. prototypeAccessors.child.get = function () {
  29365. return this.componentInstance
  29366. };
  29367. Object.defineProperties( VNode.prototype, prototypeAccessors );
  29368. var createEmptyVNode = function (text) {
  29369. if ( text === void 0 ) text = '';
  29370. var node = new VNode();
  29371. node.text = text;
  29372. node.isComment = true;
  29373. return node
  29374. };
  29375. function createTextVNode (val) {
  29376. return new VNode(undefined, undefined, undefined, String(val))
  29377. }
  29378. // optimized shallow clone
  29379. // used for static nodes and slot nodes because they may be reused across
  29380. // multiple renders, cloning them avoids errors when DOM manipulations rely
  29381. // on their elm reference.
  29382. function cloneVNode (vnode) {
  29383. var cloned = new VNode(
  29384. vnode.tag,
  29385. vnode.data,
  29386. vnode.children,
  29387. vnode.text,
  29388. vnode.elm,
  29389. vnode.context,
  29390. vnode.componentOptions,
  29391. vnode.asyncFactory
  29392. );
  29393. cloned.ns = vnode.ns;
  29394. cloned.isStatic = vnode.isStatic;
  29395. cloned.key = vnode.key;
  29396. cloned.isComment = vnode.isComment;
  29397. cloned.isCloned = true;
  29398. return cloned
  29399. }
  29400. function cloneVNodes (vnodes) {
  29401. var len = vnodes.length;
  29402. var res = new Array(len);
  29403. for (var i = 0; i < len; i++) {
  29404. res[i] = cloneVNode(vnodes[i]);
  29405. }
  29406. return res
  29407. }
  29408. /* */
  29409. var normalizeEvent = cached(function (name) {
  29410. var passive = name.charAt(0) === '&';
  29411. name = passive ? name.slice(1) : name;
  29412. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  29413. name = once$$1 ? name.slice(1) : name;
  29414. var capture = name.charAt(0) === '!';
  29415. name = capture ? name.slice(1) : name;
  29416. return {
  29417. name: name,
  29418. once: once$$1,
  29419. capture: capture,
  29420. passive: passive
  29421. }
  29422. });
  29423. function createFnInvoker (fns) {
  29424. function invoker () {
  29425. var arguments$1 = arguments;
  29426. var fns = invoker.fns;
  29427. if (Array.isArray(fns)) {
  29428. var cloned = fns.slice();
  29429. for (var i = 0; i < cloned.length; i++) {
  29430. cloned[i].apply(null, arguments$1);
  29431. }
  29432. } else {
  29433. // return handler return value for single handlers
  29434. return fns.apply(null, arguments)
  29435. }
  29436. }
  29437. invoker.fns = fns;
  29438. return invoker
  29439. }
  29440. function updateListeners (
  29441. on,
  29442. oldOn,
  29443. add,
  29444. remove$$1,
  29445. vm
  29446. ) {
  29447. var name, cur, old, event;
  29448. for (name in on) {
  29449. cur = on[name];
  29450. old = oldOn[name];
  29451. event = normalizeEvent(name);
  29452. if (isUndef(cur)) {
  29453. "development" !== 'production' && warn(
  29454. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  29455. vm
  29456. );
  29457. } else if (isUndef(old)) {
  29458. if (isUndef(cur.fns)) {
  29459. cur = on[name] = createFnInvoker(cur);
  29460. }
  29461. add(event.name, cur, event.once, event.capture, event.passive);
  29462. } else if (cur !== old) {
  29463. old.fns = cur;
  29464. on[name] = old;
  29465. }
  29466. }
  29467. for (name in oldOn) {
  29468. if (isUndef(on[name])) {
  29469. event = normalizeEvent(name);
  29470. remove$$1(event.name, oldOn[name], event.capture);
  29471. }
  29472. }
  29473. }
  29474. /* */
  29475. function mergeVNodeHook (def, hookKey, hook) {
  29476. var invoker;
  29477. var oldHook = def[hookKey];
  29478. function wrappedHook () {
  29479. hook.apply(this, arguments);
  29480. // important: remove merged hook to ensure it's called only once
  29481. // and prevent memory leak
  29482. remove(invoker.fns, wrappedHook);
  29483. }
  29484. if (isUndef(oldHook)) {
  29485. // no existing hook
  29486. invoker = createFnInvoker([wrappedHook]);
  29487. } else {
  29488. /* istanbul ignore if */
  29489. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  29490. // already a merged invoker
  29491. invoker = oldHook;
  29492. invoker.fns.push(wrappedHook);
  29493. } else {
  29494. // existing plain hook
  29495. invoker = createFnInvoker([oldHook, wrappedHook]);
  29496. }
  29497. }
  29498. invoker.merged = true;
  29499. def[hookKey] = invoker;
  29500. }
  29501. /* */
  29502. function extractPropsFromVNodeData (
  29503. data,
  29504. Ctor,
  29505. tag
  29506. ) {
  29507. // we are only extracting raw values here.
  29508. // validation and default values are handled in the child
  29509. // component itself.
  29510. var propOptions = Ctor.options.props;
  29511. if (isUndef(propOptions)) {
  29512. return
  29513. }
  29514. var res = {};
  29515. var attrs = data.attrs;
  29516. var props = data.props;
  29517. if (isDef(attrs) || isDef(props)) {
  29518. for (var key in propOptions) {
  29519. var altKey = hyphenate(key);
  29520. if (true) {
  29521. var keyInLowerCase = key.toLowerCase();
  29522. if (
  29523. key !== keyInLowerCase &&
  29524. attrs && hasOwn(attrs, keyInLowerCase)
  29525. ) {
  29526. tip(
  29527. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  29528. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  29529. " \"" + key + "\". " +
  29530. "Note that HTML attributes are case-insensitive and camelCased " +
  29531. "props need to use their kebab-case equivalents when using in-DOM " +
  29532. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  29533. );
  29534. }
  29535. }
  29536. checkProp(res, props, key, altKey, true) ||
  29537. checkProp(res, attrs, key, altKey, false);
  29538. }
  29539. }
  29540. return res
  29541. }
  29542. function checkProp (
  29543. res,
  29544. hash,
  29545. key,
  29546. altKey,
  29547. preserve
  29548. ) {
  29549. if (isDef(hash)) {
  29550. if (hasOwn(hash, key)) {
  29551. res[key] = hash[key];
  29552. if (!preserve) {
  29553. delete hash[key];
  29554. }
  29555. return true
  29556. } else if (hasOwn(hash, altKey)) {
  29557. res[key] = hash[altKey];
  29558. if (!preserve) {
  29559. delete hash[altKey];
  29560. }
  29561. return true
  29562. }
  29563. }
  29564. return false
  29565. }
  29566. /* */
  29567. // The template compiler attempts to minimize the need for normalization by
  29568. // statically analyzing the template at compile time.
  29569. //
  29570. // For plain HTML markup, normalization can be completely skipped because the
  29571. // generated render function is guaranteed to return Array<VNode>. There are
  29572. // two cases where extra normalization is needed:
  29573. // 1. When the children contains components - because a functional component
  29574. // may return an Array instead of a single root. In this case, just a simple
  29575. // normalization is needed - if any child is an Array, we flatten the whole
  29576. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  29577. // because functional components already normalize their own children.
  29578. function simpleNormalizeChildren (children) {
  29579. for (var i = 0; i < children.length; i++) {
  29580. if (Array.isArray(children[i])) {
  29581. return Array.prototype.concat.apply([], children)
  29582. }
  29583. }
  29584. return children
  29585. }
  29586. // 2. When the children contains constructs that always generated nested Arrays,
  29587. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  29588. // with hand-written render functions / JSX. In such cases a full normalization
  29589. // is needed to cater to all possible types of children values.
  29590. function normalizeChildren (children) {
  29591. return isPrimitive(children)
  29592. ? [createTextVNode(children)]
  29593. : Array.isArray(children)
  29594. ? normalizeArrayChildren(children)
  29595. : undefined
  29596. }
  29597. function isTextNode (node) {
  29598. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  29599. }
  29600. function normalizeArrayChildren (children, nestedIndex) {
  29601. var res = [];
  29602. var i, c, last;
  29603. for (i = 0; i < children.length; i++) {
  29604. c = children[i];
  29605. if (isUndef(c) || typeof c === 'boolean') { continue }
  29606. last = res[res.length - 1];
  29607. // nested
  29608. if (Array.isArray(c)) {
  29609. res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
  29610. } else if (isPrimitive(c)) {
  29611. if (isTextNode(last)) {
  29612. // merge adjacent text nodes
  29613. // this is necessary for SSR hydration because text nodes are
  29614. // essentially merged when rendered to HTML strings
  29615. (last).text += String(c);
  29616. } else if (c !== '') {
  29617. // convert primitive to vnode
  29618. res.push(createTextVNode(c));
  29619. }
  29620. } else {
  29621. if (isTextNode(c) && isTextNode(last)) {
  29622. // merge adjacent text nodes
  29623. res[res.length - 1] = createTextVNode(last.text + c.text);
  29624. } else {
  29625. // default key for nested array children (likely generated by v-for)
  29626. if (isTrue(children._isVList) &&
  29627. isDef(c.tag) &&
  29628. isUndef(c.key) &&
  29629. isDef(nestedIndex)) {
  29630. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  29631. }
  29632. res.push(c);
  29633. }
  29634. }
  29635. }
  29636. return res
  29637. }
  29638. /* */
  29639. function ensureCtor (comp, base) {
  29640. if (comp.__esModule && comp.default) {
  29641. comp = comp.default;
  29642. }
  29643. return isObject(comp)
  29644. ? base.extend(comp)
  29645. : comp
  29646. }
  29647. function createAsyncPlaceholder (
  29648. factory,
  29649. data,
  29650. context,
  29651. children,
  29652. tag
  29653. ) {
  29654. var node = createEmptyVNode();
  29655. node.asyncFactory = factory;
  29656. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  29657. return node
  29658. }
  29659. function resolveAsyncComponent (
  29660. factory,
  29661. baseCtor,
  29662. context
  29663. ) {
  29664. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  29665. return factory.errorComp
  29666. }
  29667. if (isDef(factory.resolved)) {
  29668. return factory.resolved
  29669. }
  29670. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  29671. return factory.loadingComp
  29672. }
  29673. if (isDef(factory.contexts)) {
  29674. // already pending
  29675. factory.contexts.push(context);
  29676. } else {
  29677. var contexts = factory.contexts = [context];
  29678. var sync = true;
  29679. var forceRender = function () {
  29680. for (var i = 0, l = contexts.length; i < l; i++) {
  29681. contexts[i].$forceUpdate();
  29682. }
  29683. };
  29684. var resolve = once(function (res) {
  29685. // cache resolved
  29686. factory.resolved = ensureCtor(res, baseCtor);
  29687. // invoke callbacks only if this is not a synchronous resolve
  29688. // (async resolves are shimmed as synchronous during SSR)
  29689. if (!sync) {
  29690. forceRender();
  29691. }
  29692. });
  29693. var reject = once(function (reason) {
  29694. "development" !== 'production' && warn(
  29695. "Failed to resolve async component: " + (String(factory)) +
  29696. (reason ? ("\nReason: " + reason) : '')
  29697. );
  29698. if (isDef(factory.errorComp)) {
  29699. factory.error = true;
  29700. forceRender();
  29701. }
  29702. });
  29703. var res = factory(resolve, reject);
  29704. if (isObject(res)) {
  29705. if (typeof res.then === 'function') {
  29706. // () => Promise
  29707. if (isUndef(factory.resolved)) {
  29708. res.then(resolve, reject);
  29709. }
  29710. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  29711. res.component.then(resolve, reject);
  29712. if (isDef(res.error)) {
  29713. factory.errorComp = ensureCtor(res.error, baseCtor);
  29714. }
  29715. if (isDef(res.loading)) {
  29716. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  29717. if (res.delay === 0) {
  29718. factory.loading = true;
  29719. } else {
  29720. setTimeout(function () {
  29721. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  29722. factory.loading = true;
  29723. forceRender();
  29724. }
  29725. }, res.delay || 200);
  29726. }
  29727. }
  29728. if (isDef(res.timeout)) {
  29729. setTimeout(function () {
  29730. if (isUndef(factory.resolved)) {
  29731. reject(
  29732. true
  29733. ? ("timeout (" + (res.timeout) + "ms)")
  29734. : null
  29735. );
  29736. }
  29737. }, res.timeout);
  29738. }
  29739. }
  29740. }
  29741. sync = false;
  29742. // return in case resolved synchronously
  29743. return factory.loading
  29744. ? factory.loadingComp
  29745. : factory.resolved
  29746. }
  29747. }
  29748. /* */
  29749. function getFirstComponentChild (children) {
  29750. if (Array.isArray(children)) {
  29751. for (var i = 0; i < children.length; i++) {
  29752. var c = children[i];
  29753. if (isDef(c) && isDef(c.componentOptions)) {
  29754. return c
  29755. }
  29756. }
  29757. }
  29758. }
  29759. /* */
  29760. /* */
  29761. function initEvents (vm) {
  29762. vm._events = Object.create(null);
  29763. vm._hasHookEvent = false;
  29764. // init parent attached events
  29765. var listeners = vm.$options._parentListeners;
  29766. if (listeners) {
  29767. updateComponentListeners(vm, listeners);
  29768. }
  29769. }
  29770. var target;
  29771. function add (event, fn, once$$1) {
  29772. if (once$$1) {
  29773. target.$once(event, fn);
  29774. } else {
  29775. target.$on(event, fn);
  29776. }
  29777. }
  29778. function remove$1 (event, fn) {
  29779. target.$off(event, fn);
  29780. }
  29781. function updateComponentListeners (
  29782. vm,
  29783. listeners,
  29784. oldListeners
  29785. ) {
  29786. target = vm;
  29787. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  29788. }
  29789. function eventsMixin (Vue) {
  29790. var hookRE = /^hook:/;
  29791. Vue.prototype.$on = function (event, fn) {
  29792. var this$1 = this;
  29793. var vm = this;
  29794. if (Array.isArray(event)) {
  29795. for (var i = 0, l = event.length; i < l; i++) {
  29796. this$1.$on(event[i], fn);
  29797. }
  29798. } else {
  29799. (vm._events[event] || (vm._events[event] = [])).push(fn);
  29800. // optimize hook:event cost by using a boolean flag marked at registration
  29801. // instead of a hash lookup
  29802. if (hookRE.test(event)) {
  29803. vm._hasHookEvent = true;
  29804. }
  29805. }
  29806. return vm
  29807. };
  29808. Vue.prototype.$once = function (event, fn) {
  29809. var vm = this;
  29810. function on () {
  29811. vm.$off(event, on);
  29812. fn.apply(vm, arguments);
  29813. }
  29814. on.fn = fn;
  29815. vm.$on(event, on);
  29816. return vm
  29817. };
  29818. Vue.prototype.$off = function (event, fn) {
  29819. var this$1 = this;
  29820. var vm = this;
  29821. // all
  29822. if (!arguments.length) {
  29823. vm._events = Object.create(null);
  29824. return vm
  29825. }
  29826. // array of events
  29827. if (Array.isArray(event)) {
  29828. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  29829. this$1.$off(event[i$1], fn);
  29830. }
  29831. return vm
  29832. }
  29833. // specific event
  29834. var cbs = vm._events[event];
  29835. if (!cbs) {
  29836. return vm
  29837. }
  29838. if (arguments.length === 1) {
  29839. vm._events[event] = null;
  29840. return vm
  29841. }
  29842. // specific handler
  29843. var cb;
  29844. var i = cbs.length;
  29845. while (i--) {
  29846. cb = cbs[i];
  29847. if (cb === fn || cb.fn === fn) {
  29848. cbs.splice(i, 1);
  29849. break
  29850. }
  29851. }
  29852. return vm
  29853. };
  29854. Vue.prototype.$emit = function (event) {
  29855. var vm = this;
  29856. if (true) {
  29857. var lowerCaseEvent = event.toLowerCase();
  29858. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  29859. tip(
  29860. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  29861. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  29862. "Note that HTML attributes are case-insensitive and you cannot use " +
  29863. "v-on to listen to camelCase events when using in-DOM templates. " +
  29864. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  29865. );
  29866. }
  29867. }
  29868. var cbs = vm._events[event];
  29869. if (cbs) {
  29870. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  29871. var args = toArray(arguments, 1);
  29872. for (var i = 0, l = cbs.length; i < l; i++) {
  29873. try {
  29874. cbs[i].apply(vm, args);
  29875. } catch (e) {
  29876. handleError(e, vm, ("event handler for \"" + event + "\""));
  29877. }
  29878. }
  29879. }
  29880. return vm
  29881. };
  29882. }
  29883. /* */
  29884. /**
  29885. * Runtime helper for resolving raw children VNodes into a slot object.
  29886. */
  29887. function resolveSlots (
  29888. children,
  29889. context
  29890. ) {
  29891. var slots = {};
  29892. if (!children) {
  29893. return slots
  29894. }
  29895. var defaultSlot = [];
  29896. for (var i = 0, l = children.length; i < l; i++) {
  29897. var child = children[i];
  29898. // named slots should only be respected if the vnode was rendered in the
  29899. // same context.
  29900. if ((child.context === context || child.functionalContext === context) &&
  29901. child.data && child.data.slot != null
  29902. ) {
  29903. var name = child.data.slot;
  29904. var slot = (slots[name] || (slots[name] = []));
  29905. if (child.tag === 'template') {
  29906. slot.push.apply(slot, child.children);
  29907. } else {
  29908. slot.push(child);
  29909. }
  29910. } else {
  29911. defaultSlot.push(child);
  29912. }
  29913. }
  29914. // ignore whitespace
  29915. if (!defaultSlot.every(isWhitespace)) {
  29916. slots.default = defaultSlot;
  29917. }
  29918. return slots
  29919. }
  29920. function isWhitespace (node) {
  29921. return node.isComment || node.text === ' '
  29922. }
  29923. function resolveScopedSlots (
  29924. fns, // see flow/vnode
  29925. res
  29926. ) {
  29927. res = res || {};
  29928. for (var i = 0; i < fns.length; i++) {
  29929. if (Array.isArray(fns[i])) {
  29930. resolveScopedSlots(fns[i], res);
  29931. } else {
  29932. res[fns[i].key] = fns[i].fn;
  29933. }
  29934. }
  29935. return res
  29936. }
  29937. /* */
  29938. var activeInstance = null;
  29939. var isUpdatingChildComponent = false;
  29940. function initLifecycle (vm) {
  29941. var options = vm.$options;
  29942. // locate first non-abstract parent
  29943. var parent = options.parent;
  29944. if (parent && !options.abstract) {
  29945. while (parent.$options.abstract && parent.$parent) {
  29946. parent = parent.$parent;
  29947. }
  29948. parent.$children.push(vm);
  29949. }
  29950. vm.$parent = parent;
  29951. vm.$root = parent ? parent.$root : vm;
  29952. vm.$children = [];
  29953. vm.$refs = {};
  29954. vm._watcher = null;
  29955. vm._inactive = null;
  29956. vm._directInactive = false;
  29957. vm._isMounted = false;
  29958. vm._isDestroyed = false;
  29959. vm._isBeingDestroyed = false;
  29960. }
  29961. function lifecycleMixin (Vue) {
  29962. Vue.prototype._update = function (vnode, hydrating) {
  29963. var vm = this;
  29964. if (vm._isMounted) {
  29965. callHook(vm, 'beforeUpdate');
  29966. }
  29967. var prevEl = vm.$el;
  29968. var prevVnode = vm._vnode;
  29969. var prevActiveInstance = activeInstance;
  29970. activeInstance = vm;
  29971. vm._vnode = vnode;
  29972. // Vue.prototype.__patch__ is injected in entry points
  29973. // based on the rendering backend used.
  29974. if (!prevVnode) {
  29975. // initial render
  29976. vm.$el = vm.__patch__(
  29977. vm.$el, vnode, hydrating, false /* removeOnly */,
  29978. vm.$options._parentElm,
  29979. vm.$options._refElm
  29980. );
  29981. // no need for the ref nodes after initial patch
  29982. // this prevents keeping a detached DOM tree in memory (#5851)
  29983. vm.$options._parentElm = vm.$options._refElm = null;
  29984. } else {
  29985. // updates
  29986. vm.$el = vm.__patch__(prevVnode, vnode);
  29987. }
  29988. activeInstance = prevActiveInstance;
  29989. // update __vue__ reference
  29990. if (prevEl) {
  29991. prevEl.__vue__ = null;
  29992. }
  29993. if (vm.$el) {
  29994. vm.$el.__vue__ = vm;
  29995. }
  29996. // if parent is an HOC, update its $el as well
  29997. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  29998. vm.$parent.$el = vm.$el;
  29999. }
  30000. // updated hook is called by the scheduler to ensure that children are
  30001. // updated in a parent's updated hook.
  30002. };
  30003. Vue.prototype.$forceUpdate = function () {
  30004. var vm = this;
  30005. if (vm._watcher) {
  30006. vm._watcher.update();
  30007. }
  30008. };
  30009. Vue.prototype.$destroy = function () {
  30010. var vm = this;
  30011. if (vm._isBeingDestroyed) {
  30012. return
  30013. }
  30014. callHook(vm, 'beforeDestroy');
  30015. vm._isBeingDestroyed = true;
  30016. // remove self from parent
  30017. var parent = vm.$parent;
  30018. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  30019. remove(parent.$children, vm);
  30020. }
  30021. // teardown watchers
  30022. if (vm._watcher) {
  30023. vm._watcher.teardown();
  30024. }
  30025. var i = vm._watchers.length;
  30026. while (i--) {
  30027. vm._watchers[i].teardown();
  30028. }
  30029. // remove reference from data ob
  30030. // frozen object may not have observer.
  30031. if (vm._data.__ob__) {
  30032. vm._data.__ob__.vmCount--;
  30033. }
  30034. // call the last hook...
  30035. vm._isDestroyed = true;
  30036. // invoke destroy hooks on current rendered tree
  30037. vm.__patch__(vm._vnode, null);
  30038. // fire destroyed hook
  30039. callHook(vm, 'destroyed');
  30040. // turn off all instance listeners.
  30041. vm.$off();
  30042. // remove __vue__ reference
  30043. if (vm.$el) {
  30044. vm.$el.__vue__ = null;
  30045. }
  30046. };
  30047. }
  30048. function mountComponent (
  30049. vm,
  30050. el,
  30051. hydrating
  30052. ) {
  30053. vm.$el = el;
  30054. if (!vm.$options.render) {
  30055. vm.$options.render = createEmptyVNode;
  30056. if (true) {
  30057. /* istanbul ignore if */
  30058. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  30059. vm.$options.el || el) {
  30060. warn(
  30061. 'You are using the runtime-only build of Vue where the template ' +
  30062. 'compiler is not available. Either pre-compile the templates into ' +
  30063. 'render functions, or use the compiler-included build.',
  30064. vm
  30065. );
  30066. } else {
  30067. warn(
  30068. 'Failed to mount component: template or render function not defined.',
  30069. vm
  30070. );
  30071. }
  30072. }
  30073. }
  30074. callHook(vm, 'beforeMount');
  30075. var updateComponent;
  30076. /* istanbul ignore if */
  30077. if ("development" !== 'production' && config.performance && mark) {
  30078. updateComponent = function () {
  30079. var name = vm._name;
  30080. var id = vm._uid;
  30081. var startTag = "vue-perf-start:" + id;
  30082. var endTag = "vue-perf-end:" + id;
  30083. mark(startTag);
  30084. var vnode = vm._render();
  30085. mark(endTag);
  30086. measure((name + " render"), startTag, endTag);
  30087. mark(startTag);
  30088. vm._update(vnode, hydrating);
  30089. mark(endTag);
  30090. measure((name + " patch"), startTag, endTag);
  30091. };
  30092. } else {
  30093. updateComponent = function () {
  30094. vm._update(vm._render(), hydrating);
  30095. };
  30096. }
  30097. vm._watcher = new Watcher(vm, updateComponent, noop);
  30098. hydrating = false;
  30099. // manually mounted instance, call mounted on self
  30100. // mounted is called for render-created child components in its inserted hook
  30101. if (vm.$vnode == null) {
  30102. vm._isMounted = true;
  30103. callHook(vm, 'mounted');
  30104. }
  30105. return vm
  30106. }
  30107. function updateChildComponent (
  30108. vm,
  30109. propsData,
  30110. listeners,
  30111. parentVnode,
  30112. renderChildren
  30113. ) {
  30114. if (true) {
  30115. isUpdatingChildComponent = true;
  30116. }
  30117. // determine whether component has slot children
  30118. // we need to do this before overwriting $options._renderChildren
  30119. var hasChildren = !!(
  30120. renderChildren || // has new static slots
  30121. vm.$options._renderChildren || // has old static slots
  30122. parentVnode.data.scopedSlots || // has new scoped slots
  30123. vm.$scopedSlots !== emptyObject // has old scoped slots
  30124. );
  30125. vm.$options._parentVnode = parentVnode;
  30126. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  30127. if (vm._vnode) { // update child tree's parent
  30128. vm._vnode.parent = parentVnode;
  30129. }
  30130. vm.$options._renderChildren = renderChildren;
  30131. // update $attrs and $listensers hash
  30132. // these are also reactive so they may trigger child update if the child
  30133. // used them during render
  30134. vm.$attrs = parentVnode.data && parentVnode.data.attrs;
  30135. vm.$listeners = listeners;
  30136. // update props
  30137. if (propsData && vm.$options.props) {
  30138. observerState.shouldConvert = false;
  30139. var props = vm._props;
  30140. var propKeys = vm.$options._propKeys || [];
  30141. for (var i = 0; i < propKeys.length; i++) {
  30142. var key = propKeys[i];
  30143. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  30144. }
  30145. observerState.shouldConvert = true;
  30146. // keep a copy of raw propsData
  30147. vm.$options.propsData = propsData;
  30148. }
  30149. // update listeners
  30150. if (listeners) {
  30151. var oldListeners = vm.$options._parentListeners;
  30152. vm.$options._parentListeners = listeners;
  30153. updateComponentListeners(vm, listeners, oldListeners);
  30154. }
  30155. // resolve slots + force update if has children
  30156. if (hasChildren) {
  30157. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  30158. vm.$forceUpdate();
  30159. }
  30160. if (true) {
  30161. isUpdatingChildComponent = false;
  30162. }
  30163. }
  30164. function isInInactiveTree (vm) {
  30165. while (vm && (vm = vm.$parent)) {
  30166. if (vm._inactive) { return true }
  30167. }
  30168. return false
  30169. }
  30170. function activateChildComponent (vm, direct) {
  30171. if (direct) {
  30172. vm._directInactive = false;
  30173. if (isInInactiveTree(vm)) {
  30174. return
  30175. }
  30176. } else if (vm._directInactive) {
  30177. return
  30178. }
  30179. if (vm._inactive || vm._inactive === null) {
  30180. vm._inactive = false;
  30181. for (var i = 0; i < vm.$children.length; i++) {
  30182. activateChildComponent(vm.$children[i]);
  30183. }
  30184. callHook(vm, 'activated');
  30185. }
  30186. }
  30187. function deactivateChildComponent (vm, direct) {
  30188. if (direct) {
  30189. vm._directInactive = true;
  30190. if (isInInactiveTree(vm)) {
  30191. return
  30192. }
  30193. }
  30194. if (!vm._inactive) {
  30195. vm._inactive = true;
  30196. for (var i = 0; i < vm.$children.length; i++) {
  30197. deactivateChildComponent(vm.$children[i]);
  30198. }
  30199. callHook(vm, 'deactivated');
  30200. }
  30201. }
  30202. function callHook (vm, hook) {
  30203. var handlers = vm.$options[hook];
  30204. if (handlers) {
  30205. for (var i = 0, j = handlers.length; i < j; i++) {
  30206. try {
  30207. handlers[i].call(vm);
  30208. } catch (e) {
  30209. handleError(e, vm, (hook + " hook"));
  30210. }
  30211. }
  30212. }
  30213. if (vm._hasHookEvent) {
  30214. vm.$emit('hook:' + hook);
  30215. }
  30216. }
  30217. /* */
  30218. var MAX_UPDATE_COUNT = 100;
  30219. var queue = [];
  30220. var activatedChildren = [];
  30221. var has = {};
  30222. var circular = {};
  30223. var waiting = false;
  30224. var flushing = false;
  30225. var index = 0;
  30226. /**
  30227. * Reset the scheduler's state.
  30228. */
  30229. function resetSchedulerState () {
  30230. index = queue.length = activatedChildren.length = 0;
  30231. has = {};
  30232. if (true) {
  30233. circular = {};
  30234. }
  30235. waiting = flushing = false;
  30236. }
  30237. /**
  30238. * Flush both queues and run the watchers.
  30239. */
  30240. function flushSchedulerQueue () {
  30241. flushing = true;
  30242. var watcher, id;
  30243. // Sort queue before flush.
  30244. // This ensures that:
  30245. // 1. Components are updated from parent to child. (because parent is always
  30246. // created before the child)
  30247. // 2. A component's user watchers are run before its render watcher (because
  30248. // user watchers are created before the render watcher)
  30249. // 3. If a component is destroyed during a parent component's watcher run,
  30250. // its watchers can be skipped.
  30251. queue.sort(function (a, b) { return a.id - b.id; });
  30252. // do not cache length because more watchers might be pushed
  30253. // as we run existing watchers
  30254. for (index = 0; index < queue.length; index++) {
  30255. watcher = queue[index];
  30256. id = watcher.id;
  30257. has[id] = null;
  30258. watcher.run();
  30259. // in dev build, check and stop circular updates.
  30260. if ("development" !== 'production' && has[id] != null) {
  30261. circular[id] = (circular[id] || 0) + 1;
  30262. if (circular[id] > MAX_UPDATE_COUNT) {
  30263. warn(
  30264. 'You may have an infinite update loop ' + (
  30265. watcher.user
  30266. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  30267. : "in a component render function."
  30268. ),
  30269. watcher.vm
  30270. );
  30271. break
  30272. }
  30273. }
  30274. }
  30275. // keep copies of post queues before resetting state
  30276. var activatedQueue = activatedChildren.slice();
  30277. var updatedQueue = queue.slice();
  30278. resetSchedulerState();
  30279. // call component updated and activated hooks
  30280. callActivatedHooks(activatedQueue);
  30281. callUpdatedHooks(updatedQueue);
  30282. // devtool hook
  30283. /* istanbul ignore if */
  30284. if (devtools && config.devtools) {
  30285. devtools.emit('flush');
  30286. }
  30287. }
  30288. function callUpdatedHooks (queue) {
  30289. var i = queue.length;
  30290. while (i--) {
  30291. var watcher = queue[i];
  30292. var vm = watcher.vm;
  30293. if (vm._watcher === watcher && vm._isMounted) {
  30294. callHook(vm, 'updated');
  30295. }
  30296. }
  30297. }
  30298. /**
  30299. * Queue a kept-alive component that was activated during patch.
  30300. * The queue will be processed after the entire tree has been patched.
  30301. */
  30302. function queueActivatedComponent (vm) {
  30303. // setting _inactive to false here so that a render function can
  30304. // rely on checking whether it's in an inactive tree (e.g. router-view)
  30305. vm._inactive = false;
  30306. activatedChildren.push(vm);
  30307. }
  30308. function callActivatedHooks (queue) {
  30309. for (var i = 0; i < queue.length; i++) {
  30310. queue[i]._inactive = true;
  30311. activateChildComponent(queue[i], true /* true */);
  30312. }
  30313. }
  30314. /**
  30315. * Push a watcher into the watcher queue.
  30316. * Jobs with duplicate IDs will be skipped unless it's
  30317. * pushed when the queue is being flushed.
  30318. */
  30319. function queueWatcher (watcher) {
  30320. var id = watcher.id;
  30321. if (has[id] == null) {
  30322. has[id] = true;
  30323. if (!flushing) {
  30324. queue.push(watcher);
  30325. } else {
  30326. // if already flushing, splice the watcher based on its id
  30327. // if already past its id, it will be run next immediately.
  30328. var i = queue.length - 1;
  30329. while (i > index && queue[i].id > watcher.id) {
  30330. i--;
  30331. }
  30332. queue.splice(i + 1, 0, watcher);
  30333. }
  30334. // queue the flush
  30335. if (!waiting) {
  30336. waiting = true;
  30337. nextTick(flushSchedulerQueue);
  30338. }
  30339. }
  30340. }
  30341. /* */
  30342. var uid$2 = 0;
  30343. /**
  30344. * A watcher parses an expression, collects dependencies,
  30345. * and fires callback when the expression value changes.
  30346. * This is used for both the $watch() api and directives.
  30347. */
  30348. var Watcher = function Watcher (
  30349. vm,
  30350. expOrFn,
  30351. cb,
  30352. options
  30353. ) {
  30354. this.vm = vm;
  30355. vm._watchers.push(this);
  30356. // options
  30357. if (options) {
  30358. this.deep = !!options.deep;
  30359. this.user = !!options.user;
  30360. this.lazy = !!options.lazy;
  30361. this.sync = !!options.sync;
  30362. } else {
  30363. this.deep = this.user = this.lazy = this.sync = false;
  30364. }
  30365. this.cb = cb;
  30366. this.id = ++uid$2; // uid for batching
  30367. this.active = true;
  30368. this.dirty = this.lazy; // for lazy watchers
  30369. this.deps = [];
  30370. this.newDeps = [];
  30371. this.depIds = new _Set();
  30372. this.newDepIds = new _Set();
  30373. this.expression = true
  30374. ? expOrFn.toString()
  30375. : '';
  30376. // parse expression for getter
  30377. if (typeof expOrFn === 'function') {
  30378. this.getter = expOrFn;
  30379. } else {
  30380. this.getter = parsePath(expOrFn);
  30381. if (!this.getter) {
  30382. this.getter = function () {};
  30383. "development" !== 'production' && warn(
  30384. "Failed watching path: \"" + expOrFn + "\" " +
  30385. 'Watcher only accepts simple dot-delimited paths. ' +
  30386. 'For full control, use a function instead.',
  30387. vm
  30388. );
  30389. }
  30390. }
  30391. this.value = this.lazy
  30392. ? undefined
  30393. : this.get();
  30394. };
  30395. /**
  30396. * Evaluate the getter, and re-collect dependencies.
  30397. */
  30398. Watcher.prototype.get = function get () {
  30399. pushTarget(this);
  30400. var value;
  30401. var vm = this.vm;
  30402. try {
  30403. value = this.getter.call(vm, vm);
  30404. } catch (e) {
  30405. if (this.user) {
  30406. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  30407. } else {
  30408. throw e
  30409. }
  30410. } finally {
  30411. // "touch" every property so they are all tracked as
  30412. // dependencies for deep watching
  30413. if (this.deep) {
  30414. traverse(value);
  30415. }
  30416. popTarget();
  30417. this.cleanupDeps();
  30418. }
  30419. return value
  30420. };
  30421. /**
  30422. * Add a dependency to this directive.
  30423. */
  30424. Watcher.prototype.addDep = function addDep (dep) {
  30425. var id = dep.id;
  30426. if (!this.newDepIds.has(id)) {
  30427. this.newDepIds.add(id);
  30428. this.newDeps.push(dep);
  30429. if (!this.depIds.has(id)) {
  30430. dep.addSub(this);
  30431. }
  30432. }
  30433. };
  30434. /**
  30435. * Clean up for dependency collection.
  30436. */
  30437. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  30438. var this$1 = this;
  30439. var i = this.deps.length;
  30440. while (i--) {
  30441. var dep = this$1.deps[i];
  30442. if (!this$1.newDepIds.has(dep.id)) {
  30443. dep.removeSub(this$1);
  30444. }
  30445. }
  30446. var tmp = this.depIds;
  30447. this.depIds = this.newDepIds;
  30448. this.newDepIds = tmp;
  30449. this.newDepIds.clear();
  30450. tmp = this.deps;
  30451. this.deps = this.newDeps;
  30452. this.newDeps = tmp;
  30453. this.newDeps.length = 0;
  30454. };
  30455. /**
  30456. * Subscriber interface.
  30457. * Will be called when a dependency changes.
  30458. */
  30459. Watcher.prototype.update = function update () {
  30460. /* istanbul ignore else */
  30461. if (this.lazy) {
  30462. this.dirty = true;
  30463. } else if (this.sync) {
  30464. this.run();
  30465. } else {
  30466. queueWatcher(this);
  30467. }
  30468. };
  30469. /**
  30470. * Scheduler job interface.
  30471. * Will be called by the scheduler.
  30472. */
  30473. Watcher.prototype.run = function run () {
  30474. if (this.active) {
  30475. var value = this.get();
  30476. if (
  30477. value !== this.value ||
  30478. // Deep watchers and watchers on Object/Arrays should fire even
  30479. // when the value is the same, because the value may
  30480. // have mutated.
  30481. isObject(value) ||
  30482. this.deep
  30483. ) {
  30484. // set new value
  30485. var oldValue = this.value;
  30486. this.value = value;
  30487. if (this.user) {
  30488. try {
  30489. this.cb.call(this.vm, value, oldValue);
  30490. } catch (e) {
  30491. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  30492. }
  30493. } else {
  30494. this.cb.call(this.vm, value, oldValue);
  30495. }
  30496. }
  30497. }
  30498. };
  30499. /**
  30500. * Evaluate the value of the watcher.
  30501. * This only gets called for lazy watchers.
  30502. */
  30503. Watcher.prototype.evaluate = function evaluate () {
  30504. this.value = this.get();
  30505. this.dirty = false;
  30506. };
  30507. /**
  30508. * Depend on all deps collected by this watcher.
  30509. */
  30510. Watcher.prototype.depend = function depend () {
  30511. var this$1 = this;
  30512. var i = this.deps.length;
  30513. while (i--) {
  30514. this$1.deps[i].depend();
  30515. }
  30516. };
  30517. /**
  30518. * Remove self from all dependencies' subscriber list.
  30519. */
  30520. Watcher.prototype.teardown = function teardown () {
  30521. var this$1 = this;
  30522. if (this.active) {
  30523. // remove self from vm's watcher list
  30524. // this is a somewhat expensive operation so we skip it
  30525. // if the vm is being destroyed.
  30526. if (!this.vm._isBeingDestroyed) {
  30527. remove(this.vm._watchers, this);
  30528. }
  30529. var i = this.deps.length;
  30530. while (i--) {
  30531. this$1.deps[i].removeSub(this$1);
  30532. }
  30533. this.active = false;
  30534. }
  30535. };
  30536. /**
  30537. * Recursively traverse an object to evoke all converted
  30538. * getters, so that every nested property inside the object
  30539. * is collected as a "deep" dependency.
  30540. */
  30541. var seenObjects = new _Set();
  30542. function traverse (val) {
  30543. seenObjects.clear();
  30544. _traverse(val, seenObjects);
  30545. }
  30546. function _traverse (val, seen) {
  30547. var i, keys;
  30548. var isA = Array.isArray(val);
  30549. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  30550. return
  30551. }
  30552. if (val.__ob__) {
  30553. var depId = val.__ob__.dep.id;
  30554. if (seen.has(depId)) {
  30555. return
  30556. }
  30557. seen.add(depId);
  30558. }
  30559. if (isA) {
  30560. i = val.length;
  30561. while (i--) { _traverse(val[i], seen); }
  30562. } else {
  30563. keys = Object.keys(val);
  30564. i = keys.length;
  30565. while (i--) { _traverse(val[keys[i]], seen); }
  30566. }
  30567. }
  30568. /* */
  30569. var sharedPropertyDefinition = {
  30570. enumerable: true,
  30571. configurable: true,
  30572. get: noop,
  30573. set: noop
  30574. };
  30575. function proxy (target, sourceKey, key) {
  30576. sharedPropertyDefinition.get = function proxyGetter () {
  30577. return this[sourceKey][key]
  30578. };
  30579. sharedPropertyDefinition.set = function proxySetter (val) {
  30580. this[sourceKey][key] = val;
  30581. };
  30582. Object.defineProperty(target, key, sharedPropertyDefinition);
  30583. }
  30584. function initState (vm) {
  30585. vm._watchers = [];
  30586. var opts = vm.$options;
  30587. if (opts.props) { initProps(vm, opts.props); }
  30588. if (opts.methods) { initMethods(vm, opts.methods); }
  30589. if (opts.data) {
  30590. initData(vm);
  30591. } else {
  30592. observe(vm._data = {}, true /* asRootData */);
  30593. }
  30594. if (opts.computed) { initComputed(vm, opts.computed); }
  30595. if (opts.watch && opts.watch !== nativeWatch) {
  30596. initWatch(vm, opts.watch);
  30597. }
  30598. }
  30599. function checkOptionType (vm, name) {
  30600. var option = vm.$options[name];
  30601. if (!isPlainObject(option)) {
  30602. warn(
  30603. ("component option \"" + name + "\" should be an object."),
  30604. vm
  30605. );
  30606. }
  30607. }
  30608. function initProps (vm, propsOptions) {
  30609. var propsData = vm.$options.propsData || {};
  30610. var props = vm._props = {};
  30611. // cache prop keys so that future props updates can iterate using Array
  30612. // instead of dynamic object key enumeration.
  30613. var keys = vm.$options._propKeys = [];
  30614. var isRoot = !vm.$parent;
  30615. // root instance props should be converted
  30616. observerState.shouldConvert = isRoot;
  30617. var loop = function ( key ) {
  30618. keys.push(key);
  30619. var value = validateProp(key, propsOptions, propsData, vm);
  30620. /* istanbul ignore else */
  30621. if (true) {
  30622. if (isReservedAttribute(key) || config.isReservedAttr(key)) {
  30623. warn(
  30624. ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
  30625. vm
  30626. );
  30627. }
  30628. defineReactive$$1(props, key, value, function () {
  30629. if (vm.$parent && !isUpdatingChildComponent) {
  30630. warn(
  30631. "Avoid mutating a prop directly since the value will be " +
  30632. "overwritten whenever the parent component re-renders. " +
  30633. "Instead, use a data or computed property based on the prop's " +
  30634. "value. Prop being mutated: \"" + key + "\"",
  30635. vm
  30636. );
  30637. }
  30638. });
  30639. } else {
  30640. defineReactive$$1(props, key, value);
  30641. }
  30642. // static props are already proxied on the component's prototype
  30643. // during Vue.extend(). We only need to proxy props defined at
  30644. // instantiation here.
  30645. if (!(key in vm)) {
  30646. proxy(vm, "_props", key);
  30647. }
  30648. };
  30649. for (var key in propsOptions) loop( key );
  30650. observerState.shouldConvert = true;
  30651. }
  30652. function initData (vm) {
  30653. var data = vm.$options.data;
  30654. data = vm._data = typeof data === 'function'
  30655. ? getData(data, vm)
  30656. : data || {};
  30657. if (!isPlainObject(data)) {
  30658. data = {};
  30659. "development" !== 'production' && warn(
  30660. 'data functions should return an object:\n' +
  30661. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  30662. vm
  30663. );
  30664. }
  30665. // proxy data on instance
  30666. var keys = Object.keys(data);
  30667. var props = vm.$options.props;
  30668. var methods = vm.$options.methods;
  30669. var i = keys.length;
  30670. while (i--) {
  30671. var key = keys[i];
  30672. if (true) {
  30673. if (methods && hasOwn(methods, key)) {
  30674. warn(
  30675. ("method \"" + key + "\" has already been defined as a data property."),
  30676. vm
  30677. );
  30678. }
  30679. }
  30680. if (props && hasOwn(props, key)) {
  30681. "development" !== 'production' && warn(
  30682. "The data property \"" + key + "\" is already declared as a prop. " +
  30683. "Use prop default value instead.",
  30684. vm
  30685. );
  30686. } else if (!isReserved(key)) {
  30687. proxy(vm, "_data", key);
  30688. }
  30689. }
  30690. // observe data
  30691. observe(data, true /* asRootData */);
  30692. }
  30693. function getData (data, vm) {
  30694. try {
  30695. return data.call(vm)
  30696. } catch (e) {
  30697. handleError(e, vm, "data()");
  30698. return {}
  30699. }
  30700. }
  30701. var computedWatcherOptions = { lazy: true };
  30702. function initComputed (vm, computed) {
  30703. "development" !== 'production' && checkOptionType(vm, 'computed');
  30704. var watchers = vm._computedWatchers = Object.create(null);
  30705. for (var key in computed) {
  30706. var userDef = computed[key];
  30707. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  30708. if ("development" !== 'production' && getter == null) {
  30709. warn(
  30710. ("Getter is missing for computed property \"" + key + "\"."),
  30711. vm
  30712. );
  30713. }
  30714. // create internal watcher for the computed property.
  30715. watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
  30716. // component-defined computed properties are already defined on the
  30717. // component prototype. We only need to define computed properties defined
  30718. // at instantiation here.
  30719. if (!(key in vm)) {
  30720. defineComputed(vm, key, userDef);
  30721. } else if (true) {
  30722. if (key in vm.$data) {
  30723. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  30724. } else if (vm.$options.props && key in vm.$options.props) {
  30725. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  30726. }
  30727. }
  30728. }
  30729. }
  30730. function defineComputed (target, key, userDef) {
  30731. if (typeof userDef === 'function') {
  30732. sharedPropertyDefinition.get = createComputedGetter(key);
  30733. sharedPropertyDefinition.set = noop;
  30734. } else {
  30735. sharedPropertyDefinition.get = userDef.get
  30736. ? userDef.cache !== false
  30737. ? createComputedGetter(key)
  30738. : userDef.get
  30739. : noop;
  30740. sharedPropertyDefinition.set = userDef.set
  30741. ? userDef.set
  30742. : noop;
  30743. }
  30744. if ("development" !== 'production' &&
  30745. sharedPropertyDefinition.set === noop) {
  30746. sharedPropertyDefinition.set = function () {
  30747. warn(
  30748. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  30749. this
  30750. );
  30751. };
  30752. }
  30753. Object.defineProperty(target, key, sharedPropertyDefinition);
  30754. }
  30755. function createComputedGetter (key) {
  30756. return function computedGetter () {
  30757. var watcher = this._computedWatchers && this._computedWatchers[key];
  30758. if (watcher) {
  30759. if (watcher.dirty) {
  30760. watcher.evaluate();
  30761. }
  30762. if (Dep.target) {
  30763. watcher.depend();
  30764. }
  30765. return watcher.value
  30766. }
  30767. }
  30768. }
  30769. function initMethods (vm, methods) {
  30770. "development" !== 'production' && checkOptionType(vm, 'methods');
  30771. var props = vm.$options.props;
  30772. for (var key in methods) {
  30773. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  30774. if (true) {
  30775. if (methods[key] == null) {
  30776. warn(
  30777. "method \"" + key + "\" has an undefined value in the component definition. " +
  30778. "Did you reference the function correctly?",
  30779. vm
  30780. );
  30781. }
  30782. if (props && hasOwn(props, key)) {
  30783. warn(
  30784. ("method \"" + key + "\" has already been defined as a prop."),
  30785. vm
  30786. );
  30787. }
  30788. }
  30789. }
  30790. }
  30791. function initWatch (vm, watch) {
  30792. "development" !== 'production' && checkOptionType(vm, 'watch');
  30793. for (var key in watch) {
  30794. var handler = watch[key];
  30795. if (Array.isArray(handler)) {
  30796. for (var i = 0; i < handler.length; i++) {
  30797. createWatcher(vm, key, handler[i]);
  30798. }
  30799. } else {
  30800. createWatcher(vm, key, handler);
  30801. }
  30802. }
  30803. }
  30804. function createWatcher (
  30805. vm,
  30806. keyOrFn,
  30807. handler,
  30808. options
  30809. ) {
  30810. if (isPlainObject(handler)) {
  30811. options = handler;
  30812. handler = handler.handler;
  30813. }
  30814. if (typeof handler === 'string') {
  30815. handler = vm[handler];
  30816. }
  30817. return vm.$watch(keyOrFn, handler, options)
  30818. }
  30819. function stateMixin (Vue) {
  30820. // flow somehow has problems with directly declared definition object
  30821. // when using Object.defineProperty, so we have to procedurally build up
  30822. // the object here.
  30823. var dataDef = {};
  30824. dataDef.get = function () { return this._data };
  30825. var propsDef = {};
  30826. propsDef.get = function () { return this._props };
  30827. if (true) {
  30828. dataDef.set = function (newData) {
  30829. warn(
  30830. 'Avoid replacing instance root $data. ' +
  30831. 'Use nested data properties instead.',
  30832. this
  30833. );
  30834. };
  30835. propsDef.set = function () {
  30836. warn("$props is readonly.", this);
  30837. };
  30838. }
  30839. Object.defineProperty(Vue.prototype, '$data', dataDef);
  30840. Object.defineProperty(Vue.prototype, '$props', propsDef);
  30841. Vue.prototype.$set = set;
  30842. Vue.prototype.$delete = del;
  30843. Vue.prototype.$watch = function (
  30844. expOrFn,
  30845. cb,
  30846. options
  30847. ) {
  30848. var vm = this;
  30849. if (isPlainObject(cb)) {
  30850. return createWatcher(vm, expOrFn, cb, options)
  30851. }
  30852. options = options || {};
  30853. options.user = true;
  30854. var watcher = new Watcher(vm, expOrFn, cb, options);
  30855. if (options.immediate) {
  30856. cb.call(vm, watcher.value);
  30857. }
  30858. return function unwatchFn () {
  30859. watcher.teardown();
  30860. }
  30861. };
  30862. }
  30863. /* */
  30864. function initProvide (vm) {
  30865. var provide = vm.$options.provide;
  30866. if (provide) {
  30867. vm._provided = typeof provide === 'function'
  30868. ? provide.call(vm)
  30869. : provide;
  30870. }
  30871. }
  30872. function initInjections (vm) {
  30873. var result = resolveInject(vm.$options.inject, vm);
  30874. if (result) {
  30875. observerState.shouldConvert = false;
  30876. Object.keys(result).forEach(function (key) {
  30877. /* istanbul ignore else */
  30878. if (true) {
  30879. defineReactive$$1(vm, key, result[key], function () {
  30880. warn(
  30881. "Avoid mutating an injected value directly since the changes will be " +
  30882. "overwritten whenever the provided component re-renders. " +
  30883. "injection being mutated: \"" + key + "\"",
  30884. vm
  30885. );
  30886. });
  30887. } else {
  30888. defineReactive$$1(vm, key, result[key]);
  30889. }
  30890. });
  30891. observerState.shouldConvert = true;
  30892. }
  30893. }
  30894. function resolveInject (inject, vm) {
  30895. if (inject) {
  30896. // inject is :any because flow is not smart enough to figure out cached
  30897. var result = Object.create(null);
  30898. var keys = hasSymbol
  30899. ? Reflect.ownKeys(inject)
  30900. : Object.keys(inject);
  30901. for (var i = 0; i < keys.length; i++) {
  30902. var key = keys[i];
  30903. var provideKey = inject[key];
  30904. var source = vm;
  30905. while (source) {
  30906. if (source._provided && provideKey in source._provided) {
  30907. result[key] = source._provided[provideKey];
  30908. break
  30909. }
  30910. source = source.$parent;
  30911. }
  30912. if ("development" !== 'production' && !source) {
  30913. warn(("Injection \"" + key + "\" not found"), vm);
  30914. }
  30915. }
  30916. return result
  30917. }
  30918. }
  30919. /* */
  30920. function createFunctionalComponent (
  30921. Ctor,
  30922. propsData,
  30923. data,
  30924. context,
  30925. children
  30926. ) {
  30927. var props = {};
  30928. var propOptions = Ctor.options.props;
  30929. if (isDef(propOptions)) {
  30930. for (var key in propOptions) {
  30931. props[key] = validateProp(key, propOptions, propsData || {});
  30932. }
  30933. } else {
  30934. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  30935. if (isDef(data.props)) { mergeProps(props, data.props); }
  30936. }
  30937. // ensure the createElement function in functional components
  30938. // gets a unique context - this is necessary for correct named slot check
  30939. var _context = Object.create(context);
  30940. var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
  30941. var vnode = Ctor.options.render.call(null, h, {
  30942. data: data,
  30943. props: props,
  30944. children: children,
  30945. parent: context,
  30946. listeners: data.on || {},
  30947. injections: resolveInject(Ctor.options.inject, context),
  30948. slots: function () { return resolveSlots(children, context); }
  30949. });
  30950. if (vnode instanceof VNode) {
  30951. vnode.functionalContext = context;
  30952. vnode.functionalOptions = Ctor.options;
  30953. if (data.slot) {
  30954. (vnode.data || (vnode.data = {})).slot = data.slot;
  30955. }
  30956. }
  30957. return vnode
  30958. }
  30959. function mergeProps (to, from) {
  30960. for (var key in from) {
  30961. to[camelize(key)] = from[key];
  30962. }
  30963. }
  30964. /* */
  30965. // hooks to be invoked on component VNodes during patch
  30966. var componentVNodeHooks = {
  30967. init: function init (
  30968. vnode,
  30969. hydrating,
  30970. parentElm,
  30971. refElm
  30972. ) {
  30973. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  30974. var child = vnode.componentInstance = createComponentInstanceForVnode(
  30975. vnode,
  30976. activeInstance,
  30977. parentElm,
  30978. refElm
  30979. );
  30980. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  30981. } else if (vnode.data.keepAlive) {
  30982. // kept-alive components, treat as a patch
  30983. var mountedNode = vnode; // work around flow
  30984. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  30985. }
  30986. },
  30987. prepatch: function prepatch (oldVnode, vnode) {
  30988. var options = vnode.componentOptions;
  30989. var child = vnode.componentInstance = oldVnode.componentInstance;
  30990. updateChildComponent(
  30991. child,
  30992. options.propsData, // updated props
  30993. options.listeners, // updated listeners
  30994. vnode, // new parent vnode
  30995. options.children // new children
  30996. );
  30997. },
  30998. insert: function insert (vnode) {
  30999. var context = vnode.context;
  31000. var componentInstance = vnode.componentInstance;
  31001. if (!componentInstance._isMounted) {
  31002. componentInstance._isMounted = true;
  31003. callHook(componentInstance, 'mounted');
  31004. }
  31005. if (vnode.data.keepAlive) {
  31006. if (context._isMounted) {
  31007. // vue-router#1212
  31008. // During updates, a kept-alive component's child components may
  31009. // change, so directly walking the tree here may call activated hooks
  31010. // on incorrect children. Instead we push them into a queue which will
  31011. // be processed after the whole patch process ended.
  31012. queueActivatedComponent(componentInstance);
  31013. } else {
  31014. activateChildComponent(componentInstance, true /* direct */);
  31015. }
  31016. }
  31017. },
  31018. destroy: function destroy (vnode) {
  31019. var componentInstance = vnode.componentInstance;
  31020. if (!componentInstance._isDestroyed) {
  31021. if (!vnode.data.keepAlive) {
  31022. componentInstance.$destroy();
  31023. } else {
  31024. deactivateChildComponent(componentInstance, true /* direct */);
  31025. }
  31026. }
  31027. }
  31028. };
  31029. var hooksToMerge = Object.keys(componentVNodeHooks);
  31030. function createComponent (
  31031. Ctor,
  31032. data,
  31033. context,
  31034. children,
  31035. tag
  31036. ) {
  31037. if (isUndef(Ctor)) {
  31038. return
  31039. }
  31040. var baseCtor = context.$options._base;
  31041. // plain options object: turn it into a constructor
  31042. if (isObject(Ctor)) {
  31043. Ctor = baseCtor.extend(Ctor);
  31044. }
  31045. // if at this stage it's not a constructor or an async component factory,
  31046. // reject.
  31047. if (typeof Ctor !== 'function') {
  31048. if (true) {
  31049. warn(("Invalid Component definition: " + (String(Ctor))), context);
  31050. }
  31051. return
  31052. }
  31053. // async component
  31054. var asyncFactory;
  31055. if (isUndef(Ctor.cid)) {
  31056. asyncFactory = Ctor;
  31057. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  31058. if (Ctor === undefined) {
  31059. // return a placeholder node for async component, which is rendered
  31060. // as a comment node but preserves all the raw information for the node.
  31061. // the information will be used for async server-rendering and hydration.
  31062. return createAsyncPlaceholder(
  31063. asyncFactory,
  31064. data,
  31065. context,
  31066. children,
  31067. tag
  31068. )
  31069. }
  31070. }
  31071. data = data || {};
  31072. // resolve constructor options in case global mixins are applied after
  31073. // component constructor creation
  31074. resolveConstructorOptions(Ctor);
  31075. // transform component v-model data into props & events
  31076. if (isDef(data.model)) {
  31077. transformModel(Ctor.options, data);
  31078. }
  31079. // extract props
  31080. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  31081. // functional component
  31082. if (isTrue(Ctor.options.functional)) {
  31083. return createFunctionalComponent(Ctor, propsData, data, context, children)
  31084. }
  31085. // extract listeners, since these needs to be treated as
  31086. // child component listeners instead of DOM listeners
  31087. var listeners = data.on;
  31088. // replace with listeners with .native modifier
  31089. // so it gets processed during parent component patch.
  31090. data.on = data.nativeOn;
  31091. if (isTrue(Ctor.options.abstract)) {
  31092. // abstract components do not keep anything
  31093. // other than props & listeners & slot
  31094. // work around flow
  31095. var slot = data.slot;
  31096. data = {};
  31097. if (slot) {
  31098. data.slot = slot;
  31099. }
  31100. }
  31101. // merge component management hooks onto the placeholder node
  31102. mergeHooks(data);
  31103. // return a placeholder vnode
  31104. var name = Ctor.options.name || tag;
  31105. var vnode = new VNode(
  31106. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  31107. data, undefined, undefined, undefined, context,
  31108. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  31109. asyncFactory
  31110. );
  31111. return vnode
  31112. }
  31113. function createComponentInstanceForVnode (
  31114. vnode, // we know it's MountedComponentVNode but flow doesn't
  31115. parent, // activeInstance in lifecycle state
  31116. parentElm,
  31117. refElm
  31118. ) {
  31119. var vnodeComponentOptions = vnode.componentOptions;
  31120. var options = {
  31121. _isComponent: true,
  31122. parent: parent,
  31123. propsData: vnodeComponentOptions.propsData,
  31124. _componentTag: vnodeComponentOptions.tag,
  31125. _parentVnode: vnode,
  31126. _parentListeners: vnodeComponentOptions.listeners,
  31127. _renderChildren: vnodeComponentOptions.children,
  31128. _parentElm: parentElm || null,
  31129. _refElm: refElm || null
  31130. };
  31131. // check inline-template render functions
  31132. var inlineTemplate = vnode.data.inlineTemplate;
  31133. if (isDef(inlineTemplate)) {
  31134. options.render = inlineTemplate.render;
  31135. options.staticRenderFns = inlineTemplate.staticRenderFns;
  31136. }
  31137. return new vnodeComponentOptions.Ctor(options)
  31138. }
  31139. function mergeHooks (data) {
  31140. if (!data.hook) {
  31141. data.hook = {};
  31142. }
  31143. for (var i = 0; i < hooksToMerge.length; i++) {
  31144. var key = hooksToMerge[i];
  31145. var fromParent = data.hook[key];
  31146. var ours = componentVNodeHooks[key];
  31147. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  31148. }
  31149. }
  31150. function mergeHook$1 (one, two) {
  31151. return function (a, b, c, d) {
  31152. one(a, b, c, d);
  31153. two(a, b, c, d);
  31154. }
  31155. }
  31156. // transform component v-model info (value and callback) into
  31157. // prop and event handler respectively.
  31158. function transformModel (options, data) {
  31159. var prop = (options.model && options.model.prop) || 'value';
  31160. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  31161. var on = data.on || (data.on = {});
  31162. if (isDef(on[event])) {
  31163. on[event] = [data.model.callback].concat(on[event]);
  31164. } else {
  31165. on[event] = data.model.callback;
  31166. }
  31167. }
  31168. /* */
  31169. var SIMPLE_NORMALIZE = 1;
  31170. var ALWAYS_NORMALIZE = 2;
  31171. // wrapper function for providing a more flexible interface
  31172. // without getting yelled at by flow
  31173. function createElement (
  31174. context,
  31175. tag,
  31176. data,
  31177. children,
  31178. normalizationType,
  31179. alwaysNormalize
  31180. ) {
  31181. if (Array.isArray(data) || isPrimitive(data)) {
  31182. normalizationType = children;
  31183. children = data;
  31184. data = undefined;
  31185. }
  31186. if (isTrue(alwaysNormalize)) {
  31187. normalizationType = ALWAYS_NORMALIZE;
  31188. }
  31189. return _createElement(context, tag, data, children, normalizationType)
  31190. }
  31191. function _createElement (
  31192. context,
  31193. tag,
  31194. data,
  31195. children,
  31196. normalizationType
  31197. ) {
  31198. if (isDef(data) && isDef((data).__ob__)) {
  31199. "development" !== 'production' && warn(
  31200. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  31201. 'Always create fresh vnode data objects in each render!',
  31202. context
  31203. );
  31204. return createEmptyVNode()
  31205. }
  31206. // object syntax in v-bind
  31207. if (isDef(data) && isDef(data.is)) {
  31208. tag = data.is;
  31209. }
  31210. if (!tag) {
  31211. // in case of component :is set to falsy value
  31212. return createEmptyVNode()
  31213. }
  31214. // warn against non-primitive key
  31215. if ("development" !== 'production' &&
  31216. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  31217. ) {
  31218. warn(
  31219. 'Avoid using non-primitive value as key, ' +
  31220. 'use string/number value instead.',
  31221. context
  31222. );
  31223. }
  31224. // support single function children as default scoped slot
  31225. if (Array.isArray(children) &&
  31226. typeof children[0] === 'function'
  31227. ) {
  31228. data = data || {};
  31229. data.scopedSlots = { default: children[0] };
  31230. children.length = 0;
  31231. }
  31232. if (normalizationType === ALWAYS_NORMALIZE) {
  31233. children = normalizeChildren(children);
  31234. } else if (normalizationType === SIMPLE_NORMALIZE) {
  31235. children = simpleNormalizeChildren(children);
  31236. }
  31237. var vnode, ns;
  31238. if (typeof tag === 'string') {
  31239. var Ctor;
  31240. ns = config.getTagNamespace(tag);
  31241. if (config.isReservedTag(tag)) {
  31242. // platform built-in elements
  31243. vnode = new VNode(
  31244. config.parsePlatformTagName(tag), data, children,
  31245. undefined, undefined, context
  31246. );
  31247. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  31248. // component
  31249. vnode = createComponent(Ctor, data, context, children, tag);
  31250. } else {
  31251. // unknown or unlisted namespaced elements
  31252. // check at runtime because it may get assigned a namespace when its
  31253. // parent normalizes children
  31254. vnode = new VNode(
  31255. tag, data, children,
  31256. undefined, undefined, context
  31257. );
  31258. }
  31259. } else {
  31260. // direct component options / constructor
  31261. vnode = createComponent(tag, data, context, children);
  31262. }
  31263. if (isDef(vnode)) {
  31264. if (ns) { applyNS(vnode, ns); }
  31265. return vnode
  31266. } else {
  31267. return createEmptyVNode()
  31268. }
  31269. }
  31270. function applyNS (vnode, ns) {
  31271. vnode.ns = ns;
  31272. if (vnode.tag === 'foreignObject') {
  31273. // use default namespace inside foreignObject
  31274. return
  31275. }
  31276. if (isDef(vnode.children)) {
  31277. for (var i = 0, l = vnode.children.length; i < l; i++) {
  31278. var child = vnode.children[i];
  31279. if (isDef(child.tag) && isUndef(child.ns)) {
  31280. applyNS(child, ns);
  31281. }
  31282. }
  31283. }
  31284. }
  31285. /* */
  31286. /**
  31287. * Runtime helper for rendering v-for lists.
  31288. */
  31289. function renderList (
  31290. val,
  31291. render
  31292. ) {
  31293. var ret, i, l, keys, key;
  31294. if (Array.isArray(val) || typeof val === 'string') {
  31295. ret = new Array(val.length);
  31296. for (i = 0, l = val.length; i < l; i++) {
  31297. ret[i] = render(val[i], i);
  31298. }
  31299. } else if (typeof val === 'number') {
  31300. ret = new Array(val);
  31301. for (i = 0; i < val; i++) {
  31302. ret[i] = render(i + 1, i);
  31303. }
  31304. } else if (isObject(val)) {
  31305. keys = Object.keys(val);
  31306. ret = new Array(keys.length);
  31307. for (i = 0, l = keys.length; i < l; i++) {
  31308. key = keys[i];
  31309. ret[i] = render(val[key], key, i);
  31310. }
  31311. }
  31312. if (isDef(ret)) {
  31313. (ret)._isVList = true;
  31314. }
  31315. return ret
  31316. }
  31317. /* */
  31318. /**
  31319. * Runtime helper for rendering <slot>
  31320. */
  31321. function renderSlot (
  31322. name,
  31323. fallback,
  31324. props,
  31325. bindObject
  31326. ) {
  31327. var scopedSlotFn = this.$scopedSlots[name];
  31328. if (scopedSlotFn) { // scoped slot
  31329. props = props || {};
  31330. if (bindObject) {
  31331. props = extend(extend({}, bindObject), props);
  31332. }
  31333. return scopedSlotFn(props) || fallback
  31334. } else {
  31335. var slotNodes = this.$slots[name];
  31336. // warn duplicate slot usage
  31337. if (slotNodes && "development" !== 'production') {
  31338. slotNodes._rendered && warn(
  31339. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  31340. "- this will likely cause render errors.",
  31341. this
  31342. );
  31343. slotNodes._rendered = true;
  31344. }
  31345. return slotNodes || fallback
  31346. }
  31347. }
  31348. /* */
  31349. /**
  31350. * Runtime helper for resolving filters
  31351. */
  31352. function resolveFilter (id) {
  31353. return resolveAsset(this.$options, 'filters', id, true) || identity
  31354. }
  31355. /* */
  31356. /**
  31357. * Runtime helper for checking keyCodes from config.
  31358. */
  31359. function checkKeyCodes (
  31360. eventKeyCode,
  31361. key,
  31362. builtInAlias
  31363. ) {
  31364. var keyCodes = config.keyCodes[key] || builtInAlias;
  31365. if (Array.isArray(keyCodes)) {
  31366. return keyCodes.indexOf(eventKeyCode) === -1
  31367. } else {
  31368. return keyCodes !== eventKeyCode
  31369. }
  31370. }
  31371. /* */
  31372. /**
  31373. * Runtime helper for merging v-bind="object" into a VNode's data.
  31374. */
  31375. function bindObjectProps (
  31376. data,
  31377. tag,
  31378. value,
  31379. asProp,
  31380. isSync
  31381. ) {
  31382. if (value) {
  31383. if (!isObject(value)) {
  31384. "development" !== 'production' && warn(
  31385. 'v-bind without argument expects an Object or Array value',
  31386. this
  31387. );
  31388. } else {
  31389. if (Array.isArray(value)) {
  31390. value = toObject(value);
  31391. }
  31392. var hash;
  31393. var loop = function ( key ) {
  31394. if (
  31395. key === 'class' ||
  31396. key === 'style' ||
  31397. isReservedAttribute(key)
  31398. ) {
  31399. hash = data;
  31400. } else {
  31401. var type = data.attrs && data.attrs.type;
  31402. hash = asProp || config.mustUseProp(tag, type, key)
  31403. ? data.domProps || (data.domProps = {})
  31404. : data.attrs || (data.attrs = {});
  31405. }
  31406. if (!(key in hash)) {
  31407. hash[key] = value[key];
  31408. if (isSync) {
  31409. var on = data.on || (data.on = {});
  31410. on[("update:" + key)] = function ($event) {
  31411. value[key] = $event;
  31412. };
  31413. }
  31414. }
  31415. };
  31416. for (var key in value) loop( key );
  31417. }
  31418. }
  31419. return data
  31420. }
  31421. /* */
  31422. /**
  31423. * Runtime helper for rendering static trees.
  31424. */
  31425. function renderStatic (
  31426. index,
  31427. isInFor
  31428. ) {
  31429. var tree = this._staticTrees[index];
  31430. // if has already-rendered static tree and not inside v-for,
  31431. // we can reuse the same tree by doing a shallow clone.
  31432. if (tree && !isInFor) {
  31433. return Array.isArray(tree)
  31434. ? cloneVNodes(tree)
  31435. : cloneVNode(tree)
  31436. }
  31437. // otherwise, render a fresh tree.
  31438. tree = this._staticTrees[index] =
  31439. this.$options.staticRenderFns[index].call(this._renderProxy);
  31440. markStatic(tree, ("__static__" + index), false);
  31441. return tree
  31442. }
  31443. /**
  31444. * Runtime helper for v-once.
  31445. * Effectively it means marking the node as static with a unique key.
  31446. */
  31447. function markOnce (
  31448. tree,
  31449. index,
  31450. key
  31451. ) {
  31452. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  31453. return tree
  31454. }
  31455. function markStatic (
  31456. tree,
  31457. key,
  31458. isOnce
  31459. ) {
  31460. if (Array.isArray(tree)) {
  31461. for (var i = 0; i < tree.length; i++) {
  31462. if (tree[i] && typeof tree[i] !== 'string') {
  31463. markStaticNode(tree[i], (key + "_" + i), isOnce);
  31464. }
  31465. }
  31466. } else {
  31467. markStaticNode(tree, key, isOnce);
  31468. }
  31469. }
  31470. function markStaticNode (node, key, isOnce) {
  31471. node.isStatic = true;
  31472. node.key = key;
  31473. node.isOnce = isOnce;
  31474. }
  31475. /* */
  31476. function bindObjectListeners (data, value) {
  31477. if (value) {
  31478. if (!isPlainObject(value)) {
  31479. "development" !== 'production' && warn(
  31480. 'v-on without argument expects an Object value',
  31481. this
  31482. );
  31483. } else {
  31484. var on = data.on = data.on ? extend({}, data.on) : {};
  31485. for (var key in value) {
  31486. var existing = on[key];
  31487. var ours = value[key];
  31488. on[key] = existing ? [].concat(ours, existing) : ours;
  31489. }
  31490. }
  31491. }
  31492. return data
  31493. }
  31494. /* */
  31495. function initRender (vm) {
  31496. vm._vnode = null; // the root of the child tree
  31497. vm._staticTrees = null;
  31498. var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
  31499. var renderContext = parentVnode && parentVnode.context;
  31500. vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
  31501. vm.$scopedSlots = emptyObject;
  31502. // bind the createElement fn to this instance
  31503. // so that we get proper render context inside it.
  31504. // args order: tag, data, children, normalizationType, alwaysNormalize
  31505. // internal version is used by render functions compiled from templates
  31506. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  31507. // normalization is always applied for the public version, used in
  31508. // user-written render functions.
  31509. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  31510. // $attrs & $listeners are exposed for easier HOC creation.
  31511. // they need to be reactive so that HOCs using them are always updated
  31512. var parentData = parentVnode && parentVnode.data;
  31513. /* istanbul ignore else */
  31514. if (true) {
  31515. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
  31516. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  31517. }, true);
  31518. defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, function () {
  31519. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  31520. }, true);
  31521. } else {
  31522. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, null, true);
  31523. defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, null, true);
  31524. }
  31525. }
  31526. function renderMixin (Vue) {
  31527. Vue.prototype.$nextTick = function (fn) {
  31528. return nextTick(fn, this)
  31529. };
  31530. Vue.prototype._render = function () {
  31531. var vm = this;
  31532. var ref = vm.$options;
  31533. var render = ref.render;
  31534. var staticRenderFns = ref.staticRenderFns;
  31535. var _parentVnode = ref._parentVnode;
  31536. if (vm._isMounted) {
  31537. // clone slot nodes on re-renders
  31538. for (var key in vm.$slots) {
  31539. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  31540. }
  31541. }
  31542. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  31543. if (staticRenderFns && !vm._staticTrees) {
  31544. vm._staticTrees = [];
  31545. }
  31546. // set parent vnode. this allows render functions to have access
  31547. // to the data on the placeholder node.
  31548. vm.$vnode = _parentVnode;
  31549. // render self
  31550. var vnode;
  31551. try {
  31552. vnode = render.call(vm._renderProxy, vm.$createElement);
  31553. } catch (e) {
  31554. handleError(e, vm, "render function");
  31555. // return error render result,
  31556. // or previous vnode to prevent render error causing blank component
  31557. /* istanbul ignore else */
  31558. if (true) {
  31559. vnode = vm.$options.renderError
  31560. ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
  31561. : vm._vnode;
  31562. } else {
  31563. vnode = vm._vnode;
  31564. }
  31565. }
  31566. // return empty vnode in case the render function errored out
  31567. if (!(vnode instanceof VNode)) {
  31568. if ("development" !== 'production' && Array.isArray(vnode)) {
  31569. warn(
  31570. 'Multiple root nodes returned from render function. Render function ' +
  31571. 'should return a single root node.',
  31572. vm
  31573. );
  31574. }
  31575. vnode = createEmptyVNode();
  31576. }
  31577. // set parent
  31578. vnode.parent = _parentVnode;
  31579. return vnode
  31580. };
  31581. // internal render helpers.
  31582. // these are exposed on the instance prototype to reduce generated render
  31583. // code size.
  31584. Vue.prototype._o = markOnce;
  31585. Vue.prototype._n = toNumber;
  31586. Vue.prototype._s = toString;
  31587. Vue.prototype._l = renderList;
  31588. Vue.prototype._t = renderSlot;
  31589. Vue.prototype._q = looseEqual;
  31590. Vue.prototype._i = looseIndexOf;
  31591. Vue.prototype._m = renderStatic;
  31592. Vue.prototype._f = resolveFilter;
  31593. Vue.prototype._k = checkKeyCodes;
  31594. Vue.prototype._b = bindObjectProps;
  31595. Vue.prototype._v = createTextVNode;
  31596. Vue.prototype._e = createEmptyVNode;
  31597. Vue.prototype._u = resolveScopedSlots;
  31598. Vue.prototype._g = bindObjectListeners;
  31599. }
  31600. /* */
  31601. var uid$1 = 0;
  31602. function initMixin (Vue) {
  31603. Vue.prototype._init = function (options) {
  31604. var vm = this;
  31605. // a uid
  31606. vm._uid = uid$1++;
  31607. var startTag, endTag;
  31608. /* istanbul ignore if */
  31609. if ("development" !== 'production' && config.performance && mark) {
  31610. startTag = "vue-perf-init:" + (vm._uid);
  31611. endTag = "vue-perf-end:" + (vm._uid);
  31612. mark(startTag);
  31613. }
  31614. // a flag to avoid this being observed
  31615. vm._isVue = true;
  31616. // merge options
  31617. if (options && options._isComponent) {
  31618. // optimize internal component instantiation
  31619. // since dynamic options merging is pretty slow, and none of the
  31620. // internal component options needs special treatment.
  31621. initInternalComponent(vm, options);
  31622. } else {
  31623. vm.$options = mergeOptions(
  31624. resolveConstructorOptions(vm.constructor),
  31625. options || {},
  31626. vm
  31627. );
  31628. }
  31629. /* istanbul ignore else */
  31630. if (true) {
  31631. initProxy(vm);
  31632. } else {
  31633. vm._renderProxy = vm;
  31634. }
  31635. // expose real self
  31636. vm._self = vm;
  31637. initLifecycle(vm);
  31638. initEvents(vm);
  31639. initRender(vm);
  31640. callHook(vm, 'beforeCreate');
  31641. initInjections(vm); // resolve injections before data/props
  31642. initState(vm);
  31643. initProvide(vm); // resolve provide after data/props
  31644. callHook(vm, 'created');
  31645. /* istanbul ignore if */
  31646. if ("development" !== 'production' && config.performance && mark) {
  31647. vm._name = formatComponentName(vm, false);
  31648. mark(endTag);
  31649. measure(((vm._name) + " init"), startTag, endTag);
  31650. }
  31651. if (vm.$options.el) {
  31652. vm.$mount(vm.$options.el);
  31653. }
  31654. };
  31655. }
  31656. function initInternalComponent (vm, options) {
  31657. var opts = vm.$options = Object.create(vm.constructor.options);
  31658. // doing this because it's faster than dynamic enumeration.
  31659. opts.parent = options.parent;
  31660. opts.propsData = options.propsData;
  31661. opts._parentVnode = options._parentVnode;
  31662. opts._parentListeners = options._parentListeners;
  31663. opts._renderChildren = options._renderChildren;
  31664. opts._componentTag = options._componentTag;
  31665. opts._parentElm = options._parentElm;
  31666. opts._refElm = options._refElm;
  31667. if (options.render) {
  31668. opts.render = options.render;
  31669. opts.staticRenderFns = options.staticRenderFns;
  31670. }
  31671. }
  31672. function resolveConstructorOptions (Ctor) {
  31673. var options = Ctor.options;
  31674. if (Ctor.super) {
  31675. var superOptions = resolveConstructorOptions(Ctor.super);
  31676. var cachedSuperOptions = Ctor.superOptions;
  31677. if (superOptions !== cachedSuperOptions) {
  31678. // super option changed,
  31679. // need to resolve new options.
  31680. Ctor.superOptions = superOptions;
  31681. // check if there are any late-modified/attached options (#4976)
  31682. var modifiedOptions = resolveModifiedOptions(Ctor);
  31683. // update base extend options
  31684. if (modifiedOptions) {
  31685. extend(Ctor.extendOptions, modifiedOptions);
  31686. }
  31687. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  31688. if (options.name) {
  31689. options.components[options.name] = Ctor;
  31690. }
  31691. }
  31692. }
  31693. return options
  31694. }
  31695. function resolveModifiedOptions (Ctor) {
  31696. var modified;
  31697. var latest = Ctor.options;
  31698. var extended = Ctor.extendOptions;
  31699. var sealed = Ctor.sealedOptions;
  31700. for (var key in latest) {
  31701. if (latest[key] !== sealed[key]) {
  31702. if (!modified) { modified = {}; }
  31703. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  31704. }
  31705. }
  31706. return modified
  31707. }
  31708. function dedupe (latest, extended, sealed) {
  31709. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  31710. // between merges
  31711. if (Array.isArray(latest)) {
  31712. var res = [];
  31713. sealed = Array.isArray(sealed) ? sealed : [sealed];
  31714. extended = Array.isArray(extended) ? extended : [extended];
  31715. for (var i = 0; i < latest.length; i++) {
  31716. // push original options and not sealed options to exclude duplicated options
  31717. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  31718. res.push(latest[i]);
  31719. }
  31720. }
  31721. return res
  31722. } else {
  31723. return latest
  31724. }
  31725. }
  31726. function Vue$3 (options) {
  31727. if ("development" !== 'production' &&
  31728. !(this instanceof Vue$3)
  31729. ) {
  31730. warn('Vue is a constructor and should be called with the `new` keyword');
  31731. }
  31732. this._init(options);
  31733. }
  31734. initMixin(Vue$3);
  31735. stateMixin(Vue$3);
  31736. eventsMixin(Vue$3);
  31737. lifecycleMixin(Vue$3);
  31738. renderMixin(Vue$3);
  31739. /* */
  31740. function initUse (Vue) {
  31741. Vue.use = function (plugin) {
  31742. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  31743. if (installedPlugins.indexOf(plugin) > -1) {
  31744. return this
  31745. }
  31746. // additional parameters
  31747. var args = toArray(arguments, 1);
  31748. args.unshift(this);
  31749. if (typeof plugin.install === 'function') {
  31750. plugin.install.apply(plugin, args);
  31751. } else if (typeof plugin === 'function') {
  31752. plugin.apply(null, args);
  31753. }
  31754. installedPlugins.push(plugin);
  31755. return this
  31756. };
  31757. }
  31758. /* */
  31759. function initMixin$1 (Vue) {
  31760. Vue.mixin = function (mixin) {
  31761. this.options = mergeOptions(this.options, mixin);
  31762. return this
  31763. };
  31764. }
  31765. /* */
  31766. function initExtend (Vue) {
  31767. /**
  31768. * Each instance constructor, including Vue, has a unique
  31769. * cid. This enables us to create wrapped "child
  31770. * constructors" for prototypal inheritance and cache them.
  31771. */
  31772. Vue.cid = 0;
  31773. var cid = 1;
  31774. /**
  31775. * Class inheritance
  31776. */
  31777. Vue.extend = function (extendOptions) {
  31778. extendOptions = extendOptions || {};
  31779. var Super = this;
  31780. var SuperId = Super.cid;
  31781. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  31782. if (cachedCtors[SuperId]) {
  31783. return cachedCtors[SuperId]
  31784. }
  31785. var name = extendOptions.name || Super.options.name;
  31786. if (true) {
  31787. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  31788. warn(
  31789. 'Invalid component name: "' + name + '". Component names ' +
  31790. 'can only contain alphanumeric characters and the hyphen, ' +
  31791. 'and must start with a letter.'
  31792. );
  31793. }
  31794. }
  31795. var Sub = function VueComponent (options) {
  31796. this._init(options);
  31797. };
  31798. Sub.prototype = Object.create(Super.prototype);
  31799. Sub.prototype.constructor = Sub;
  31800. Sub.cid = cid++;
  31801. Sub.options = mergeOptions(
  31802. Super.options,
  31803. extendOptions
  31804. );
  31805. Sub['super'] = Super;
  31806. // For props and computed properties, we define the proxy getters on
  31807. // the Vue instances at extension time, on the extended prototype. This
  31808. // avoids Object.defineProperty calls for each instance created.
  31809. if (Sub.options.props) {
  31810. initProps$1(Sub);
  31811. }
  31812. if (Sub.options.computed) {
  31813. initComputed$1(Sub);
  31814. }
  31815. // allow further extension/mixin/plugin usage
  31816. Sub.extend = Super.extend;
  31817. Sub.mixin = Super.mixin;
  31818. Sub.use = Super.use;
  31819. // create asset registers, so extended classes
  31820. // can have their private assets too.
  31821. ASSET_TYPES.forEach(function (type) {
  31822. Sub[type] = Super[type];
  31823. });
  31824. // enable recursive self-lookup
  31825. if (name) {
  31826. Sub.options.components[name] = Sub;
  31827. }
  31828. // keep a reference to the super options at extension time.
  31829. // later at instantiation we can check if Super's options have
  31830. // been updated.
  31831. Sub.superOptions = Super.options;
  31832. Sub.extendOptions = extendOptions;
  31833. Sub.sealedOptions = extend({}, Sub.options);
  31834. // cache constructor
  31835. cachedCtors[SuperId] = Sub;
  31836. return Sub
  31837. };
  31838. }
  31839. function initProps$1 (Comp) {
  31840. var props = Comp.options.props;
  31841. for (var key in props) {
  31842. proxy(Comp.prototype, "_props", key);
  31843. }
  31844. }
  31845. function initComputed$1 (Comp) {
  31846. var computed = Comp.options.computed;
  31847. for (var key in computed) {
  31848. defineComputed(Comp.prototype, key, computed[key]);
  31849. }
  31850. }
  31851. /* */
  31852. function initAssetRegisters (Vue) {
  31853. /**
  31854. * Create asset registration methods.
  31855. */
  31856. ASSET_TYPES.forEach(function (type) {
  31857. Vue[type] = function (
  31858. id,
  31859. definition
  31860. ) {
  31861. if (!definition) {
  31862. return this.options[type + 's'][id]
  31863. } else {
  31864. /* istanbul ignore if */
  31865. if (true) {
  31866. if (type === 'component' && config.isReservedTag(id)) {
  31867. warn(
  31868. 'Do not use built-in or reserved HTML elements as component ' +
  31869. 'id: ' + id
  31870. );
  31871. }
  31872. }
  31873. if (type === 'component' && isPlainObject(definition)) {
  31874. definition.name = definition.name || id;
  31875. definition = this.options._base.extend(definition);
  31876. }
  31877. if (type === 'directive' && typeof definition === 'function') {
  31878. definition = { bind: definition, update: definition };
  31879. }
  31880. this.options[type + 's'][id] = definition;
  31881. return definition
  31882. }
  31883. };
  31884. });
  31885. }
  31886. /* */
  31887. var patternTypes = [String, RegExp, Array];
  31888. function getComponentName (opts) {
  31889. return opts && (opts.Ctor.options.name || opts.tag)
  31890. }
  31891. function matches (pattern, name) {
  31892. if (Array.isArray(pattern)) {
  31893. return pattern.indexOf(name) > -1
  31894. } else if (typeof pattern === 'string') {
  31895. return pattern.split(',').indexOf(name) > -1
  31896. } else if (isRegExp(pattern)) {
  31897. return pattern.test(name)
  31898. }
  31899. /* istanbul ignore next */
  31900. return false
  31901. }
  31902. function pruneCache (cache, current, filter) {
  31903. for (var key in cache) {
  31904. var cachedNode = cache[key];
  31905. if (cachedNode) {
  31906. var name = getComponentName(cachedNode.componentOptions);
  31907. if (name && !filter(name)) {
  31908. if (cachedNode !== current) {
  31909. pruneCacheEntry(cachedNode);
  31910. }
  31911. cache[key] = null;
  31912. }
  31913. }
  31914. }
  31915. }
  31916. function pruneCacheEntry (vnode) {
  31917. if (vnode) {
  31918. vnode.componentInstance.$destroy();
  31919. }
  31920. }
  31921. var KeepAlive = {
  31922. name: 'keep-alive',
  31923. abstract: true,
  31924. props: {
  31925. include: patternTypes,
  31926. exclude: patternTypes
  31927. },
  31928. created: function created () {
  31929. this.cache = Object.create(null);
  31930. },
  31931. destroyed: function destroyed () {
  31932. var this$1 = this;
  31933. for (var key in this$1.cache) {
  31934. pruneCacheEntry(this$1.cache[key]);
  31935. }
  31936. },
  31937. watch: {
  31938. include: function include (val) {
  31939. pruneCache(this.cache, this._vnode, function (name) { return matches(val, name); });
  31940. },
  31941. exclude: function exclude (val) {
  31942. pruneCache(this.cache, this._vnode, function (name) { return !matches(val, name); });
  31943. }
  31944. },
  31945. render: function render () {
  31946. var vnode = getFirstComponentChild(this.$slots.default);
  31947. var componentOptions = vnode && vnode.componentOptions;
  31948. if (componentOptions) {
  31949. // check pattern
  31950. var name = getComponentName(componentOptions);
  31951. if (name && (
  31952. (this.include && !matches(this.include, name)) ||
  31953. (this.exclude && matches(this.exclude, name))
  31954. )) {
  31955. return vnode
  31956. }
  31957. var key = vnode.key == null
  31958. // same constructor may get registered as different local components
  31959. // so cid alone is not enough (#3269)
  31960. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  31961. : vnode.key;
  31962. if (this.cache[key]) {
  31963. vnode.componentInstance = this.cache[key].componentInstance;
  31964. } else {
  31965. this.cache[key] = vnode;
  31966. }
  31967. vnode.data.keepAlive = true;
  31968. }
  31969. return vnode
  31970. }
  31971. };
  31972. var builtInComponents = {
  31973. KeepAlive: KeepAlive
  31974. };
  31975. /* */
  31976. function initGlobalAPI (Vue) {
  31977. // config
  31978. var configDef = {};
  31979. configDef.get = function () { return config; };
  31980. if (true) {
  31981. configDef.set = function () {
  31982. warn(
  31983. 'Do not replace the Vue.config object, set individual fields instead.'
  31984. );
  31985. };
  31986. }
  31987. Object.defineProperty(Vue, 'config', configDef);
  31988. // exposed util methods.
  31989. // NOTE: these are not considered part of the public API - avoid relying on
  31990. // them unless you are aware of the risk.
  31991. Vue.util = {
  31992. warn: warn,
  31993. extend: extend,
  31994. mergeOptions: mergeOptions,
  31995. defineReactive: defineReactive$$1
  31996. };
  31997. Vue.set = set;
  31998. Vue.delete = del;
  31999. Vue.nextTick = nextTick;
  32000. Vue.options = Object.create(null);
  32001. ASSET_TYPES.forEach(function (type) {
  32002. Vue.options[type + 's'] = Object.create(null);
  32003. });
  32004. // this is used to identify the "base" constructor to extend all plain-object
  32005. // components with in Weex's multi-instance scenarios.
  32006. Vue.options._base = Vue;
  32007. extend(Vue.options.components, builtInComponents);
  32008. initUse(Vue);
  32009. initMixin$1(Vue);
  32010. initExtend(Vue);
  32011. initAssetRegisters(Vue);
  32012. }
  32013. initGlobalAPI(Vue$3);
  32014. Object.defineProperty(Vue$3.prototype, '$isServer', {
  32015. get: isServerRendering
  32016. });
  32017. Object.defineProperty(Vue$3.prototype, '$ssrContext', {
  32018. get: function get () {
  32019. /* istanbul ignore next */
  32020. return this.$vnode && this.$vnode.ssrContext
  32021. }
  32022. });
  32023. Vue$3.version = '2.4.2';
  32024. /* */
  32025. // these are reserved for web because they are directly compiled away
  32026. // during template compilation
  32027. var isReservedAttr = makeMap('style,class');
  32028. // attributes that should be using props for binding
  32029. var acceptValue = makeMap('input,textarea,option,select');
  32030. var mustUseProp = function (tag, type, attr) {
  32031. return (
  32032. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  32033. (attr === 'selected' && tag === 'option') ||
  32034. (attr === 'checked' && tag === 'input') ||
  32035. (attr === 'muted' && tag === 'video')
  32036. )
  32037. };
  32038. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  32039. var isBooleanAttr = makeMap(
  32040. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  32041. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  32042. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  32043. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  32044. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  32045. 'truespeed,typemustmatch,visible'
  32046. );
  32047. var xlinkNS = 'http://www.w3.org/1999/xlink';
  32048. var isXlink = function (name) {
  32049. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  32050. };
  32051. var getXlinkProp = function (name) {
  32052. return isXlink(name) ? name.slice(6, name.length) : ''
  32053. };
  32054. var isFalsyAttrValue = function (val) {
  32055. return val == null || val === false
  32056. };
  32057. /* */
  32058. function genClassForVnode (vnode) {
  32059. var data = vnode.data;
  32060. var parentNode = vnode;
  32061. var childNode = vnode;
  32062. while (isDef(childNode.componentInstance)) {
  32063. childNode = childNode.componentInstance._vnode;
  32064. if (childNode.data) {
  32065. data = mergeClassData(childNode.data, data);
  32066. }
  32067. }
  32068. while (isDef(parentNode = parentNode.parent)) {
  32069. if (parentNode.data) {
  32070. data = mergeClassData(data, parentNode.data);
  32071. }
  32072. }
  32073. return renderClass(data.staticClass, data.class)
  32074. }
  32075. function mergeClassData (child, parent) {
  32076. return {
  32077. staticClass: concat(child.staticClass, parent.staticClass),
  32078. class: isDef(child.class)
  32079. ? [child.class, parent.class]
  32080. : parent.class
  32081. }
  32082. }
  32083. function renderClass (
  32084. staticClass,
  32085. dynamicClass
  32086. ) {
  32087. if (isDef(staticClass) || isDef(dynamicClass)) {
  32088. return concat(staticClass, stringifyClass(dynamicClass))
  32089. }
  32090. /* istanbul ignore next */
  32091. return ''
  32092. }
  32093. function concat (a, b) {
  32094. return a ? b ? (a + ' ' + b) : a : (b || '')
  32095. }
  32096. function stringifyClass (value) {
  32097. if (Array.isArray(value)) {
  32098. return stringifyArray(value)
  32099. }
  32100. if (isObject(value)) {
  32101. return stringifyObject(value)
  32102. }
  32103. if (typeof value === 'string') {
  32104. return value
  32105. }
  32106. /* istanbul ignore next */
  32107. return ''
  32108. }
  32109. function stringifyArray (value) {
  32110. var res = '';
  32111. var stringified;
  32112. for (var i = 0, l = value.length; i < l; i++) {
  32113. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  32114. if (res) { res += ' '; }
  32115. res += stringified;
  32116. }
  32117. }
  32118. return res
  32119. }
  32120. function stringifyObject (value) {
  32121. var res = '';
  32122. for (var key in value) {
  32123. if (value[key]) {
  32124. if (res) { res += ' '; }
  32125. res += key;
  32126. }
  32127. }
  32128. return res
  32129. }
  32130. /* */
  32131. var namespaceMap = {
  32132. svg: 'http://www.w3.org/2000/svg',
  32133. math: 'http://www.w3.org/1998/Math/MathML'
  32134. };
  32135. var isHTMLTag = makeMap(
  32136. 'html,body,base,head,link,meta,style,title,' +
  32137. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  32138. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  32139. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  32140. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  32141. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  32142. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  32143. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  32144. 'output,progress,select,textarea,' +
  32145. 'details,dialog,menu,menuitem,summary,' +
  32146. 'content,element,shadow,template,blockquote,iframe,tfoot'
  32147. );
  32148. // this map is intentionally selective, only covering SVG elements that may
  32149. // contain child elements.
  32150. var isSVG = makeMap(
  32151. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  32152. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  32153. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  32154. true
  32155. );
  32156. var isPreTag = function (tag) { return tag === 'pre'; };
  32157. var isReservedTag = function (tag) {
  32158. return isHTMLTag(tag) || isSVG(tag)
  32159. };
  32160. function getTagNamespace (tag) {
  32161. if (isSVG(tag)) {
  32162. return 'svg'
  32163. }
  32164. // basic support for MathML
  32165. // note it doesn't support other MathML elements being component roots
  32166. if (tag === 'math') {
  32167. return 'math'
  32168. }
  32169. }
  32170. var unknownElementCache = Object.create(null);
  32171. function isUnknownElement (tag) {
  32172. /* istanbul ignore if */
  32173. if (!inBrowser) {
  32174. return true
  32175. }
  32176. if (isReservedTag(tag)) {
  32177. return false
  32178. }
  32179. tag = tag.toLowerCase();
  32180. /* istanbul ignore if */
  32181. if (unknownElementCache[tag] != null) {
  32182. return unknownElementCache[tag]
  32183. }
  32184. var el = document.createElement(tag);
  32185. if (tag.indexOf('-') > -1) {
  32186. // http://stackoverflow.com/a/28210364/1070244
  32187. return (unknownElementCache[tag] = (
  32188. el.constructor === window.HTMLUnknownElement ||
  32189. el.constructor === window.HTMLElement
  32190. ))
  32191. } else {
  32192. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  32193. }
  32194. }
  32195. /* */
  32196. /**
  32197. * Query an element selector if it's not an element already.
  32198. */
  32199. function query (el) {
  32200. if (typeof el === 'string') {
  32201. var selected = document.querySelector(el);
  32202. if (!selected) {
  32203. "development" !== 'production' && warn(
  32204. 'Cannot find element: ' + el
  32205. );
  32206. return document.createElement('div')
  32207. }
  32208. return selected
  32209. } else {
  32210. return el
  32211. }
  32212. }
  32213. /* */
  32214. function createElement$1 (tagName, vnode) {
  32215. var elm = document.createElement(tagName);
  32216. if (tagName !== 'select') {
  32217. return elm
  32218. }
  32219. // false or null will remove the attribute but undefined will not
  32220. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  32221. elm.setAttribute('multiple', 'multiple');
  32222. }
  32223. return elm
  32224. }
  32225. function createElementNS (namespace, tagName) {
  32226. return document.createElementNS(namespaceMap[namespace], tagName)
  32227. }
  32228. function createTextNode (text) {
  32229. return document.createTextNode(text)
  32230. }
  32231. function createComment (text) {
  32232. return document.createComment(text)
  32233. }
  32234. function insertBefore (parentNode, newNode, referenceNode) {
  32235. parentNode.insertBefore(newNode, referenceNode);
  32236. }
  32237. function removeChild (node, child) {
  32238. node.removeChild(child);
  32239. }
  32240. function appendChild (node, child) {
  32241. node.appendChild(child);
  32242. }
  32243. function parentNode (node) {
  32244. return node.parentNode
  32245. }
  32246. function nextSibling (node) {
  32247. return node.nextSibling
  32248. }
  32249. function tagName (node) {
  32250. return node.tagName
  32251. }
  32252. function setTextContent (node, text) {
  32253. node.textContent = text;
  32254. }
  32255. function setAttribute (node, key, val) {
  32256. node.setAttribute(key, val);
  32257. }
  32258. var nodeOps = Object.freeze({
  32259. createElement: createElement$1,
  32260. createElementNS: createElementNS,
  32261. createTextNode: createTextNode,
  32262. createComment: createComment,
  32263. insertBefore: insertBefore,
  32264. removeChild: removeChild,
  32265. appendChild: appendChild,
  32266. parentNode: parentNode,
  32267. nextSibling: nextSibling,
  32268. tagName: tagName,
  32269. setTextContent: setTextContent,
  32270. setAttribute: setAttribute
  32271. });
  32272. /* */
  32273. var ref = {
  32274. create: function create (_, vnode) {
  32275. registerRef(vnode);
  32276. },
  32277. update: function update (oldVnode, vnode) {
  32278. if (oldVnode.data.ref !== vnode.data.ref) {
  32279. registerRef(oldVnode, true);
  32280. registerRef(vnode);
  32281. }
  32282. },
  32283. destroy: function destroy (vnode) {
  32284. registerRef(vnode, true);
  32285. }
  32286. };
  32287. function registerRef (vnode, isRemoval) {
  32288. var key = vnode.data.ref;
  32289. if (!key) { return }
  32290. var vm = vnode.context;
  32291. var ref = vnode.componentInstance || vnode.elm;
  32292. var refs = vm.$refs;
  32293. if (isRemoval) {
  32294. if (Array.isArray(refs[key])) {
  32295. remove(refs[key], ref);
  32296. } else if (refs[key] === ref) {
  32297. refs[key] = undefined;
  32298. }
  32299. } else {
  32300. if (vnode.data.refInFor) {
  32301. if (!Array.isArray(refs[key])) {
  32302. refs[key] = [ref];
  32303. } else if (refs[key].indexOf(ref) < 0) {
  32304. // $flow-disable-line
  32305. refs[key].push(ref);
  32306. }
  32307. } else {
  32308. refs[key] = ref;
  32309. }
  32310. }
  32311. }
  32312. /**
  32313. * Virtual DOM patching algorithm based on Snabbdom by
  32314. * Simon Friis Vindum (@paldepind)
  32315. * Licensed under the MIT License
  32316. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  32317. *
  32318. * modified by Evan You (@yyx990803)
  32319. *
  32320. /*
  32321. * Not type-checking this because this file is perf-critical and the cost
  32322. * of making flow understand it is not worth it.
  32323. */
  32324. var emptyNode = new VNode('', {}, []);
  32325. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  32326. function sameVnode (a, b) {
  32327. return (
  32328. a.key === b.key && (
  32329. (
  32330. a.tag === b.tag &&
  32331. a.isComment === b.isComment &&
  32332. isDef(a.data) === isDef(b.data) &&
  32333. sameInputType(a, b)
  32334. ) || (
  32335. isTrue(a.isAsyncPlaceholder) &&
  32336. a.asyncFactory === b.asyncFactory &&
  32337. isUndef(b.asyncFactory.error)
  32338. )
  32339. )
  32340. )
  32341. }
  32342. // Some browsers do not support dynamically changing type for <input>
  32343. // so they need to be treated as different nodes
  32344. function sameInputType (a, b) {
  32345. if (a.tag !== 'input') { return true }
  32346. var i;
  32347. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  32348. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  32349. return typeA === typeB
  32350. }
  32351. function createKeyToOldIdx (children, beginIdx, endIdx) {
  32352. var i, key;
  32353. var map = {};
  32354. for (i = beginIdx; i <= endIdx; ++i) {
  32355. key = children[i].key;
  32356. if (isDef(key)) { map[key] = i; }
  32357. }
  32358. return map
  32359. }
  32360. function createPatchFunction (backend) {
  32361. var i, j;
  32362. var cbs = {};
  32363. var modules = backend.modules;
  32364. var nodeOps = backend.nodeOps;
  32365. for (i = 0; i < hooks.length; ++i) {
  32366. cbs[hooks[i]] = [];
  32367. for (j = 0; j < modules.length; ++j) {
  32368. if (isDef(modules[j][hooks[i]])) {
  32369. cbs[hooks[i]].push(modules[j][hooks[i]]);
  32370. }
  32371. }
  32372. }
  32373. function emptyNodeAt (elm) {
  32374. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  32375. }
  32376. function createRmCb (childElm, listeners) {
  32377. function remove$$1 () {
  32378. if (--remove$$1.listeners === 0) {
  32379. removeNode(childElm);
  32380. }
  32381. }
  32382. remove$$1.listeners = listeners;
  32383. return remove$$1
  32384. }
  32385. function removeNode (el) {
  32386. var parent = nodeOps.parentNode(el);
  32387. // element may have already been removed due to v-html / v-text
  32388. if (isDef(parent)) {
  32389. nodeOps.removeChild(parent, el);
  32390. }
  32391. }
  32392. var inPre = 0;
  32393. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  32394. vnode.isRootInsert = !nested; // for transition enter check
  32395. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  32396. return
  32397. }
  32398. var data = vnode.data;
  32399. var children = vnode.children;
  32400. var tag = vnode.tag;
  32401. if (isDef(tag)) {
  32402. if (true) {
  32403. if (data && data.pre) {
  32404. inPre++;
  32405. }
  32406. if (
  32407. !inPre &&
  32408. !vnode.ns &&
  32409. !(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
  32410. config.isUnknownElement(tag)
  32411. ) {
  32412. warn(
  32413. 'Unknown custom element: <' + tag + '> - did you ' +
  32414. 'register the component correctly? For recursive components, ' +
  32415. 'make sure to provide the "name" option.',
  32416. vnode.context
  32417. );
  32418. }
  32419. }
  32420. vnode.elm = vnode.ns
  32421. ? nodeOps.createElementNS(vnode.ns, tag)
  32422. : nodeOps.createElement(tag, vnode);
  32423. setScope(vnode);
  32424. /* istanbul ignore if */
  32425. {
  32426. createChildren(vnode, children, insertedVnodeQueue);
  32427. if (isDef(data)) {
  32428. invokeCreateHooks(vnode, insertedVnodeQueue);
  32429. }
  32430. insert(parentElm, vnode.elm, refElm);
  32431. }
  32432. if ("development" !== 'production' && data && data.pre) {
  32433. inPre--;
  32434. }
  32435. } else if (isTrue(vnode.isComment)) {
  32436. vnode.elm = nodeOps.createComment(vnode.text);
  32437. insert(parentElm, vnode.elm, refElm);
  32438. } else {
  32439. vnode.elm = nodeOps.createTextNode(vnode.text);
  32440. insert(parentElm, vnode.elm, refElm);
  32441. }
  32442. }
  32443. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32444. var i = vnode.data;
  32445. if (isDef(i)) {
  32446. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  32447. if (isDef(i = i.hook) && isDef(i = i.init)) {
  32448. i(vnode, false /* hydrating */, parentElm, refElm);
  32449. }
  32450. // after calling the init hook, if the vnode is a child component
  32451. // it should've created a child instance and mounted it. the child
  32452. // component also has set the placeholder vnode's elm.
  32453. // in that case we can just return the element and be done.
  32454. if (isDef(vnode.componentInstance)) {
  32455. initComponent(vnode, insertedVnodeQueue);
  32456. if (isTrue(isReactivated)) {
  32457. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  32458. }
  32459. return true
  32460. }
  32461. }
  32462. }
  32463. function initComponent (vnode, insertedVnodeQueue) {
  32464. if (isDef(vnode.data.pendingInsert)) {
  32465. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  32466. vnode.data.pendingInsert = null;
  32467. }
  32468. vnode.elm = vnode.componentInstance.$el;
  32469. if (isPatchable(vnode)) {
  32470. invokeCreateHooks(vnode, insertedVnodeQueue);
  32471. setScope(vnode);
  32472. } else {
  32473. // empty component root.
  32474. // skip all element-related modules except for ref (#3455)
  32475. registerRef(vnode);
  32476. // make sure to invoke the insert hook
  32477. insertedVnodeQueue.push(vnode);
  32478. }
  32479. }
  32480. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32481. var i;
  32482. // hack for #4339: a reactivated component with inner transition
  32483. // does not trigger because the inner node's created hooks are not called
  32484. // again. It's not ideal to involve module-specific logic in here but
  32485. // there doesn't seem to be a better way to do it.
  32486. var innerNode = vnode;
  32487. while (innerNode.componentInstance) {
  32488. innerNode = innerNode.componentInstance._vnode;
  32489. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  32490. for (i = 0; i < cbs.activate.length; ++i) {
  32491. cbs.activate[i](emptyNode, innerNode);
  32492. }
  32493. insertedVnodeQueue.push(innerNode);
  32494. break
  32495. }
  32496. }
  32497. // unlike a newly created component,
  32498. // a reactivated keep-alive component doesn't insert itself
  32499. insert(parentElm, vnode.elm, refElm);
  32500. }
  32501. function insert (parent, elm, ref$$1) {
  32502. if (isDef(parent)) {
  32503. if (isDef(ref$$1)) {
  32504. if (ref$$1.parentNode === parent) {
  32505. nodeOps.insertBefore(parent, elm, ref$$1);
  32506. }
  32507. } else {
  32508. nodeOps.appendChild(parent, elm);
  32509. }
  32510. }
  32511. }
  32512. function createChildren (vnode, children, insertedVnodeQueue) {
  32513. if (Array.isArray(children)) {
  32514. for (var i = 0; i < children.length; ++i) {
  32515. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  32516. }
  32517. } else if (isPrimitive(vnode.text)) {
  32518. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  32519. }
  32520. }
  32521. function isPatchable (vnode) {
  32522. while (vnode.componentInstance) {
  32523. vnode = vnode.componentInstance._vnode;
  32524. }
  32525. return isDef(vnode.tag)
  32526. }
  32527. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  32528. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  32529. cbs.create[i$1](emptyNode, vnode);
  32530. }
  32531. i = vnode.data.hook; // Reuse variable
  32532. if (isDef(i)) {
  32533. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  32534. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  32535. }
  32536. }
  32537. // set scope id attribute for scoped CSS.
  32538. // this is implemented as a special case to avoid the overhead
  32539. // of going through the normal attribute patching process.
  32540. function setScope (vnode) {
  32541. var i;
  32542. var ancestor = vnode;
  32543. while (ancestor) {
  32544. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  32545. nodeOps.setAttribute(vnode.elm, i, '');
  32546. }
  32547. ancestor = ancestor.parent;
  32548. }
  32549. // for slot content they should also get the scopeId from the host instance.
  32550. if (isDef(i = activeInstance) &&
  32551. i !== vnode.context &&
  32552. isDef(i = i.$options._scopeId)
  32553. ) {
  32554. nodeOps.setAttribute(vnode.elm, i, '');
  32555. }
  32556. }
  32557. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  32558. for (; startIdx <= endIdx; ++startIdx) {
  32559. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  32560. }
  32561. }
  32562. function invokeDestroyHook (vnode) {
  32563. var i, j;
  32564. var data = vnode.data;
  32565. if (isDef(data)) {
  32566. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  32567. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  32568. }
  32569. if (isDef(i = vnode.children)) {
  32570. for (j = 0; j < vnode.children.length; ++j) {
  32571. invokeDestroyHook(vnode.children[j]);
  32572. }
  32573. }
  32574. }
  32575. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  32576. for (; startIdx <= endIdx; ++startIdx) {
  32577. var ch = vnodes[startIdx];
  32578. if (isDef(ch)) {
  32579. if (isDef(ch.tag)) {
  32580. removeAndInvokeRemoveHook(ch);
  32581. invokeDestroyHook(ch);
  32582. } else { // Text node
  32583. removeNode(ch.elm);
  32584. }
  32585. }
  32586. }
  32587. }
  32588. function removeAndInvokeRemoveHook (vnode, rm) {
  32589. if (isDef(rm) || isDef(vnode.data)) {
  32590. var i;
  32591. var listeners = cbs.remove.length + 1;
  32592. if (isDef(rm)) {
  32593. // we have a recursively passed down rm callback
  32594. // increase the listeners count
  32595. rm.listeners += listeners;
  32596. } else {
  32597. // directly removing
  32598. rm = createRmCb(vnode.elm, listeners);
  32599. }
  32600. // recursively invoke hooks on child component root node
  32601. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  32602. removeAndInvokeRemoveHook(i, rm);
  32603. }
  32604. for (i = 0; i < cbs.remove.length; ++i) {
  32605. cbs.remove[i](vnode, rm);
  32606. }
  32607. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  32608. i(vnode, rm);
  32609. } else {
  32610. rm();
  32611. }
  32612. } else {
  32613. removeNode(vnode.elm);
  32614. }
  32615. }
  32616. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  32617. var oldStartIdx = 0;
  32618. var newStartIdx = 0;
  32619. var oldEndIdx = oldCh.length - 1;
  32620. var oldStartVnode = oldCh[0];
  32621. var oldEndVnode = oldCh[oldEndIdx];
  32622. var newEndIdx = newCh.length - 1;
  32623. var newStartVnode = newCh[0];
  32624. var newEndVnode = newCh[newEndIdx];
  32625. var oldKeyToIdx, idxInOld, elmToMove, refElm;
  32626. // removeOnly is a special flag used only by <transition-group>
  32627. // to ensure removed elements stay in correct relative positions
  32628. // during leaving transitions
  32629. var canMove = !removeOnly;
  32630. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  32631. if (isUndef(oldStartVnode)) {
  32632. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  32633. } else if (isUndef(oldEndVnode)) {
  32634. oldEndVnode = oldCh[--oldEndIdx];
  32635. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  32636. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  32637. oldStartVnode = oldCh[++oldStartIdx];
  32638. newStartVnode = newCh[++newStartIdx];
  32639. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  32640. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  32641. oldEndVnode = oldCh[--oldEndIdx];
  32642. newEndVnode = newCh[--newEndIdx];
  32643. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  32644. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  32645. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  32646. oldStartVnode = oldCh[++oldStartIdx];
  32647. newEndVnode = newCh[--newEndIdx];
  32648. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  32649. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  32650. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  32651. oldEndVnode = oldCh[--oldEndIdx];
  32652. newStartVnode = newCh[++newStartIdx];
  32653. } else {
  32654. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  32655. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  32656. if (isUndef(idxInOld)) { // New element
  32657. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  32658. newStartVnode = newCh[++newStartIdx];
  32659. } else {
  32660. elmToMove = oldCh[idxInOld];
  32661. /* istanbul ignore if */
  32662. if ("development" !== 'production' && !elmToMove) {
  32663. warn(
  32664. 'It seems there are duplicate keys that is causing an update error. ' +
  32665. 'Make sure each v-for item has a unique key.'
  32666. );
  32667. }
  32668. if (sameVnode(elmToMove, newStartVnode)) {
  32669. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  32670. oldCh[idxInOld] = undefined;
  32671. canMove && nodeOps.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
  32672. newStartVnode = newCh[++newStartIdx];
  32673. } else {
  32674. // same key but different element. treat as new element
  32675. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  32676. newStartVnode = newCh[++newStartIdx];
  32677. }
  32678. }
  32679. }
  32680. }
  32681. if (oldStartIdx > oldEndIdx) {
  32682. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  32683. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  32684. } else if (newStartIdx > newEndIdx) {
  32685. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  32686. }
  32687. }
  32688. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  32689. if (oldVnode === vnode) {
  32690. return
  32691. }
  32692. var elm = vnode.elm = oldVnode.elm;
  32693. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  32694. if (isDef(vnode.asyncFactory.resolved)) {
  32695. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  32696. } else {
  32697. vnode.isAsyncPlaceholder = true;
  32698. }
  32699. return
  32700. }
  32701. // reuse element for static trees.
  32702. // note we only do this if the vnode is cloned -
  32703. // if the new node is not cloned it means the render functions have been
  32704. // reset by the hot-reload-api and we need to do a proper re-render.
  32705. if (isTrue(vnode.isStatic) &&
  32706. isTrue(oldVnode.isStatic) &&
  32707. vnode.key === oldVnode.key &&
  32708. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  32709. ) {
  32710. vnode.componentInstance = oldVnode.componentInstance;
  32711. return
  32712. }
  32713. var i;
  32714. var data = vnode.data;
  32715. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  32716. i(oldVnode, vnode);
  32717. }
  32718. var oldCh = oldVnode.children;
  32719. var ch = vnode.children;
  32720. if (isDef(data) && isPatchable(vnode)) {
  32721. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  32722. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  32723. }
  32724. if (isUndef(vnode.text)) {
  32725. if (isDef(oldCh) && isDef(ch)) {
  32726. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  32727. } else if (isDef(ch)) {
  32728. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  32729. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  32730. } else if (isDef(oldCh)) {
  32731. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  32732. } else if (isDef(oldVnode.text)) {
  32733. nodeOps.setTextContent(elm, '');
  32734. }
  32735. } else if (oldVnode.text !== vnode.text) {
  32736. nodeOps.setTextContent(elm, vnode.text);
  32737. }
  32738. if (isDef(data)) {
  32739. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  32740. }
  32741. }
  32742. function invokeInsertHook (vnode, queue, initial) {
  32743. // delay insert hooks for component root nodes, invoke them after the
  32744. // element is really inserted
  32745. if (isTrue(initial) && isDef(vnode.parent)) {
  32746. vnode.parent.data.pendingInsert = queue;
  32747. } else {
  32748. for (var i = 0; i < queue.length; ++i) {
  32749. queue[i].data.hook.insert(queue[i]);
  32750. }
  32751. }
  32752. }
  32753. var bailed = false;
  32754. // list of modules that can skip create hook during hydration because they
  32755. // are already rendered on the client or has no need for initialization
  32756. var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
  32757. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  32758. function hydrate (elm, vnode, insertedVnodeQueue) {
  32759. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  32760. vnode.elm = elm;
  32761. vnode.isAsyncPlaceholder = true;
  32762. return true
  32763. }
  32764. if (true) {
  32765. if (!assertNodeMatch(elm, vnode)) {
  32766. return false
  32767. }
  32768. }
  32769. vnode.elm = elm;
  32770. var tag = vnode.tag;
  32771. var data = vnode.data;
  32772. var children = vnode.children;
  32773. if (isDef(data)) {
  32774. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  32775. if (isDef(i = vnode.componentInstance)) {
  32776. // child component. it should have hydrated its own tree.
  32777. initComponent(vnode, insertedVnodeQueue);
  32778. return true
  32779. }
  32780. }
  32781. if (isDef(tag)) {
  32782. if (isDef(children)) {
  32783. // empty element, allow client to pick up and populate children
  32784. if (!elm.hasChildNodes()) {
  32785. createChildren(vnode, children, insertedVnodeQueue);
  32786. } else {
  32787. var childrenMatch = true;
  32788. var childNode = elm.firstChild;
  32789. for (var i$1 = 0; i$1 < children.length; i$1++) {
  32790. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
  32791. childrenMatch = false;
  32792. break
  32793. }
  32794. childNode = childNode.nextSibling;
  32795. }
  32796. // if childNode is not null, it means the actual childNodes list is
  32797. // longer than the virtual children list.
  32798. if (!childrenMatch || childNode) {
  32799. if ("development" !== 'production' &&
  32800. typeof console !== 'undefined' &&
  32801. !bailed
  32802. ) {
  32803. bailed = true;
  32804. console.warn('Parent: ', elm);
  32805. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  32806. }
  32807. return false
  32808. }
  32809. }
  32810. }
  32811. if (isDef(data)) {
  32812. for (var key in data) {
  32813. if (!isRenderedModule(key)) {
  32814. invokeCreateHooks(vnode, insertedVnodeQueue);
  32815. break
  32816. }
  32817. }
  32818. }
  32819. } else if (elm.data !== vnode.text) {
  32820. elm.data = vnode.text;
  32821. }
  32822. return true
  32823. }
  32824. function assertNodeMatch (node, vnode) {
  32825. if (isDef(vnode.tag)) {
  32826. return (
  32827. vnode.tag.indexOf('vue-component') === 0 ||
  32828. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  32829. )
  32830. } else {
  32831. return node.nodeType === (vnode.isComment ? 8 : 3)
  32832. }
  32833. }
  32834. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  32835. if (isUndef(vnode)) {
  32836. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  32837. return
  32838. }
  32839. var isInitialPatch = false;
  32840. var insertedVnodeQueue = [];
  32841. if (isUndef(oldVnode)) {
  32842. // empty mount (likely as component), create new root element
  32843. isInitialPatch = true;
  32844. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  32845. } else {
  32846. var isRealElement = isDef(oldVnode.nodeType);
  32847. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  32848. // patch existing root node
  32849. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  32850. } else {
  32851. if (isRealElement) {
  32852. // mounting to a real element
  32853. // check if this is server-rendered content and if we can perform
  32854. // a successful hydration.
  32855. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  32856. oldVnode.removeAttribute(SSR_ATTR);
  32857. hydrating = true;
  32858. }
  32859. if (isTrue(hydrating)) {
  32860. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  32861. invokeInsertHook(vnode, insertedVnodeQueue, true);
  32862. return oldVnode
  32863. } else if (true) {
  32864. warn(
  32865. 'The client-side rendered virtual DOM tree is not matching ' +
  32866. 'server-rendered content. This is likely caused by incorrect ' +
  32867. 'HTML markup, for example nesting block-level elements inside ' +
  32868. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  32869. 'full client-side render.'
  32870. );
  32871. }
  32872. }
  32873. // either not server-rendered, or hydration failed.
  32874. // create an empty node and replace it
  32875. oldVnode = emptyNodeAt(oldVnode);
  32876. }
  32877. // replacing existing element
  32878. var oldElm = oldVnode.elm;
  32879. var parentElm$1 = nodeOps.parentNode(oldElm);
  32880. createElm(
  32881. vnode,
  32882. insertedVnodeQueue,
  32883. // extremely rare edge case: do not insert if old element is in a
  32884. // leaving transition. Only happens when combining transition +
  32885. // keep-alive + HOCs. (#4590)
  32886. oldElm._leaveCb ? null : parentElm$1,
  32887. nodeOps.nextSibling(oldElm)
  32888. );
  32889. if (isDef(vnode.parent)) {
  32890. // component root element replaced.
  32891. // update parent placeholder node element, recursively
  32892. var ancestor = vnode.parent;
  32893. while (ancestor) {
  32894. ancestor.elm = vnode.elm;
  32895. ancestor = ancestor.parent;
  32896. }
  32897. if (isPatchable(vnode)) {
  32898. for (var i = 0; i < cbs.create.length; ++i) {
  32899. cbs.create[i](emptyNode, vnode.parent);
  32900. }
  32901. }
  32902. }
  32903. if (isDef(parentElm$1)) {
  32904. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  32905. } else if (isDef(oldVnode.tag)) {
  32906. invokeDestroyHook(oldVnode);
  32907. }
  32908. }
  32909. }
  32910. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  32911. return vnode.elm
  32912. }
  32913. }
  32914. /* */
  32915. var directives = {
  32916. create: updateDirectives,
  32917. update: updateDirectives,
  32918. destroy: function unbindDirectives (vnode) {
  32919. updateDirectives(vnode, emptyNode);
  32920. }
  32921. };
  32922. function updateDirectives (oldVnode, vnode) {
  32923. if (oldVnode.data.directives || vnode.data.directives) {
  32924. _update(oldVnode, vnode);
  32925. }
  32926. }
  32927. function _update (oldVnode, vnode) {
  32928. var isCreate = oldVnode === emptyNode;
  32929. var isDestroy = vnode === emptyNode;
  32930. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  32931. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  32932. var dirsWithInsert = [];
  32933. var dirsWithPostpatch = [];
  32934. var key, oldDir, dir;
  32935. for (key in newDirs) {
  32936. oldDir = oldDirs[key];
  32937. dir = newDirs[key];
  32938. if (!oldDir) {
  32939. // new directive, bind
  32940. callHook$1(dir, 'bind', vnode, oldVnode);
  32941. if (dir.def && dir.def.inserted) {
  32942. dirsWithInsert.push(dir);
  32943. }
  32944. } else {
  32945. // existing directive, update
  32946. dir.oldValue = oldDir.value;
  32947. callHook$1(dir, 'update', vnode, oldVnode);
  32948. if (dir.def && dir.def.componentUpdated) {
  32949. dirsWithPostpatch.push(dir);
  32950. }
  32951. }
  32952. }
  32953. if (dirsWithInsert.length) {
  32954. var callInsert = function () {
  32955. for (var i = 0; i < dirsWithInsert.length; i++) {
  32956. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  32957. }
  32958. };
  32959. if (isCreate) {
  32960. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
  32961. } else {
  32962. callInsert();
  32963. }
  32964. }
  32965. if (dirsWithPostpatch.length) {
  32966. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  32967. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  32968. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  32969. }
  32970. });
  32971. }
  32972. if (!isCreate) {
  32973. for (key in oldDirs) {
  32974. if (!newDirs[key]) {
  32975. // no longer present, unbind
  32976. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  32977. }
  32978. }
  32979. }
  32980. }
  32981. var emptyModifiers = Object.create(null);
  32982. function normalizeDirectives$1 (
  32983. dirs,
  32984. vm
  32985. ) {
  32986. var res = Object.create(null);
  32987. if (!dirs) {
  32988. return res
  32989. }
  32990. var i, dir;
  32991. for (i = 0; i < dirs.length; i++) {
  32992. dir = dirs[i];
  32993. if (!dir.modifiers) {
  32994. dir.modifiers = emptyModifiers;
  32995. }
  32996. res[getRawDirName(dir)] = dir;
  32997. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  32998. }
  32999. return res
  33000. }
  33001. function getRawDirName (dir) {
  33002. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  33003. }
  33004. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  33005. var fn = dir.def && dir.def[hook];
  33006. if (fn) {
  33007. try {
  33008. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  33009. } catch (e) {
  33010. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  33011. }
  33012. }
  33013. }
  33014. var baseModules = [
  33015. ref,
  33016. directives
  33017. ];
  33018. /* */
  33019. function updateAttrs (oldVnode, vnode) {
  33020. var opts = vnode.componentOptions;
  33021. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  33022. return
  33023. }
  33024. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  33025. return
  33026. }
  33027. var key, cur, old;
  33028. var elm = vnode.elm;
  33029. var oldAttrs = oldVnode.data.attrs || {};
  33030. var attrs = vnode.data.attrs || {};
  33031. // clone observed objects, as the user probably wants to mutate it
  33032. if (isDef(attrs.__ob__)) {
  33033. attrs = vnode.data.attrs = extend({}, attrs);
  33034. }
  33035. for (key in attrs) {
  33036. cur = attrs[key];
  33037. old = oldAttrs[key];
  33038. if (old !== cur) {
  33039. setAttr(elm, key, cur);
  33040. }
  33041. }
  33042. // #4391: in IE9, setting type can reset value for input[type=radio]
  33043. /* istanbul ignore if */
  33044. if (isIE9 && attrs.value !== oldAttrs.value) {
  33045. setAttr(elm, 'value', attrs.value);
  33046. }
  33047. for (key in oldAttrs) {
  33048. if (isUndef(attrs[key])) {
  33049. if (isXlink(key)) {
  33050. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  33051. } else if (!isEnumeratedAttr(key)) {
  33052. elm.removeAttribute(key);
  33053. }
  33054. }
  33055. }
  33056. }
  33057. function setAttr (el, key, value) {
  33058. if (isBooleanAttr(key)) {
  33059. // set attribute for blank value
  33060. // e.g. <option disabled>Select one</option>
  33061. if (isFalsyAttrValue(value)) {
  33062. el.removeAttribute(key);
  33063. } else {
  33064. el.setAttribute(key, key);
  33065. }
  33066. } else if (isEnumeratedAttr(key)) {
  33067. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  33068. } else if (isXlink(key)) {
  33069. if (isFalsyAttrValue(value)) {
  33070. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  33071. } else {
  33072. el.setAttributeNS(xlinkNS, key, value);
  33073. }
  33074. } else {
  33075. if (isFalsyAttrValue(value)) {
  33076. el.removeAttribute(key);
  33077. } else {
  33078. el.setAttribute(key, value);
  33079. }
  33080. }
  33081. }
  33082. var attrs = {
  33083. create: updateAttrs,
  33084. update: updateAttrs
  33085. };
  33086. /* */
  33087. function updateClass (oldVnode, vnode) {
  33088. var el = vnode.elm;
  33089. var data = vnode.data;
  33090. var oldData = oldVnode.data;
  33091. if (
  33092. isUndef(data.staticClass) &&
  33093. isUndef(data.class) && (
  33094. isUndef(oldData) || (
  33095. isUndef(oldData.staticClass) &&
  33096. isUndef(oldData.class)
  33097. )
  33098. )
  33099. ) {
  33100. return
  33101. }
  33102. var cls = genClassForVnode(vnode);
  33103. // handle transition classes
  33104. var transitionClass = el._transitionClasses;
  33105. if (isDef(transitionClass)) {
  33106. cls = concat(cls, stringifyClass(transitionClass));
  33107. }
  33108. // set the class
  33109. if (cls !== el._prevClass) {
  33110. el.setAttribute('class', cls);
  33111. el._prevClass = cls;
  33112. }
  33113. }
  33114. var klass = {
  33115. create: updateClass,
  33116. update: updateClass
  33117. };
  33118. /* */
  33119. var validDivisionCharRE = /[\w).+\-_$\]]/;
  33120. function parseFilters (exp) {
  33121. var inSingle = false;
  33122. var inDouble = false;
  33123. var inTemplateString = false;
  33124. var inRegex = false;
  33125. var curly = 0;
  33126. var square = 0;
  33127. var paren = 0;
  33128. var lastFilterIndex = 0;
  33129. var c, prev, i, expression, filters;
  33130. for (i = 0; i < exp.length; i++) {
  33131. prev = c;
  33132. c = exp.charCodeAt(i);
  33133. if (inSingle) {
  33134. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  33135. } else if (inDouble) {
  33136. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  33137. } else if (inTemplateString) {
  33138. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  33139. } else if (inRegex) {
  33140. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  33141. } else if (
  33142. c === 0x7C && // pipe
  33143. exp.charCodeAt(i + 1) !== 0x7C &&
  33144. exp.charCodeAt(i - 1) !== 0x7C &&
  33145. !curly && !square && !paren
  33146. ) {
  33147. if (expression === undefined) {
  33148. // first filter, end of expression
  33149. lastFilterIndex = i + 1;
  33150. expression = exp.slice(0, i).trim();
  33151. } else {
  33152. pushFilter();
  33153. }
  33154. } else {
  33155. switch (c) {
  33156. case 0x22: inDouble = true; break // "
  33157. case 0x27: inSingle = true; break // '
  33158. case 0x60: inTemplateString = true; break // `
  33159. case 0x28: paren++; break // (
  33160. case 0x29: paren--; break // )
  33161. case 0x5B: square++; break // [
  33162. case 0x5D: square--; break // ]
  33163. case 0x7B: curly++; break // {
  33164. case 0x7D: curly--; break // }
  33165. }
  33166. if (c === 0x2f) { // /
  33167. var j = i - 1;
  33168. var p = (void 0);
  33169. // find first non-whitespace prev char
  33170. for (; j >= 0; j--) {
  33171. p = exp.charAt(j);
  33172. if (p !== ' ') { break }
  33173. }
  33174. if (!p || !validDivisionCharRE.test(p)) {
  33175. inRegex = true;
  33176. }
  33177. }
  33178. }
  33179. }
  33180. if (expression === undefined) {
  33181. expression = exp.slice(0, i).trim();
  33182. } else if (lastFilterIndex !== 0) {
  33183. pushFilter();
  33184. }
  33185. function pushFilter () {
  33186. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  33187. lastFilterIndex = i + 1;
  33188. }
  33189. if (filters) {
  33190. for (i = 0; i < filters.length; i++) {
  33191. expression = wrapFilter(expression, filters[i]);
  33192. }
  33193. }
  33194. return expression
  33195. }
  33196. function wrapFilter (exp, filter) {
  33197. var i = filter.indexOf('(');
  33198. if (i < 0) {
  33199. // _f: resolveFilter
  33200. return ("_f(\"" + filter + "\")(" + exp + ")")
  33201. } else {
  33202. var name = filter.slice(0, i);
  33203. var args = filter.slice(i + 1);
  33204. return ("_f(\"" + name + "\")(" + exp + "," + args)
  33205. }
  33206. }
  33207. /* */
  33208. function baseWarn (msg) {
  33209. console.error(("[Vue compiler]: " + msg));
  33210. }
  33211. function pluckModuleFunction (
  33212. modules,
  33213. key
  33214. ) {
  33215. return modules
  33216. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  33217. : []
  33218. }
  33219. function addProp (el, name, value) {
  33220. (el.props || (el.props = [])).push({ name: name, value: value });
  33221. }
  33222. function addAttr (el, name, value) {
  33223. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  33224. }
  33225. function addDirective (
  33226. el,
  33227. name,
  33228. rawName,
  33229. value,
  33230. arg,
  33231. modifiers
  33232. ) {
  33233. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  33234. }
  33235. function addHandler (
  33236. el,
  33237. name,
  33238. value,
  33239. modifiers,
  33240. important,
  33241. warn
  33242. ) {
  33243. // warn prevent and passive modifier
  33244. /* istanbul ignore if */
  33245. if (
  33246. "development" !== 'production' && warn &&
  33247. modifiers && modifiers.prevent && modifiers.passive
  33248. ) {
  33249. warn(
  33250. 'passive and prevent can\'t be used together. ' +
  33251. 'Passive handler can\'t prevent default event.'
  33252. );
  33253. }
  33254. // check capture modifier
  33255. if (modifiers && modifiers.capture) {
  33256. delete modifiers.capture;
  33257. name = '!' + name; // mark the event as captured
  33258. }
  33259. if (modifiers && modifiers.once) {
  33260. delete modifiers.once;
  33261. name = '~' + name; // mark the event as once
  33262. }
  33263. /* istanbul ignore if */
  33264. if (modifiers && modifiers.passive) {
  33265. delete modifiers.passive;
  33266. name = '&' + name; // mark the event as passive
  33267. }
  33268. var events;
  33269. if (modifiers && modifiers.native) {
  33270. delete modifiers.native;
  33271. events = el.nativeEvents || (el.nativeEvents = {});
  33272. } else {
  33273. events = el.events || (el.events = {});
  33274. }
  33275. var newHandler = { value: value, modifiers: modifiers };
  33276. var handlers = events[name];
  33277. /* istanbul ignore if */
  33278. if (Array.isArray(handlers)) {
  33279. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  33280. } else if (handlers) {
  33281. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  33282. } else {
  33283. events[name] = newHandler;
  33284. }
  33285. }
  33286. function getBindingAttr (
  33287. el,
  33288. name,
  33289. getStatic
  33290. ) {
  33291. var dynamicValue =
  33292. getAndRemoveAttr(el, ':' + name) ||
  33293. getAndRemoveAttr(el, 'v-bind:' + name);
  33294. if (dynamicValue != null) {
  33295. return parseFilters(dynamicValue)
  33296. } else if (getStatic !== false) {
  33297. var staticValue = getAndRemoveAttr(el, name);
  33298. if (staticValue != null) {
  33299. return JSON.stringify(staticValue)
  33300. }
  33301. }
  33302. }
  33303. function getAndRemoveAttr (el, name) {
  33304. var val;
  33305. if ((val = el.attrsMap[name]) != null) {
  33306. var list = el.attrsList;
  33307. for (var i = 0, l = list.length; i < l; i++) {
  33308. if (list[i].name === name) {
  33309. list.splice(i, 1);
  33310. break
  33311. }
  33312. }
  33313. }
  33314. return val
  33315. }
  33316. /* */
  33317. /**
  33318. * Cross-platform code generation for component v-model
  33319. */
  33320. function genComponentModel (
  33321. el,
  33322. value,
  33323. modifiers
  33324. ) {
  33325. var ref = modifiers || {};
  33326. var number = ref.number;
  33327. var trim = ref.trim;
  33328. var baseValueExpression = '$$v';
  33329. var valueExpression = baseValueExpression;
  33330. if (trim) {
  33331. valueExpression =
  33332. "(typeof " + baseValueExpression + " === 'string'" +
  33333. "? " + baseValueExpression + ".trim()" +
  33334. ": " + baseValueExpression + ")";
  33335. }
  33336. if (number) {
  33337. valueExpression = "_n(" + valueExpression + ")";
  33338. }
  33339. var assignment = genAssignmentCode(value, valueExpression);
  33340. el.model = {
  33341. value: ("(" + value + ")"),
  33342. expression: ("\"" + value + "\""),
  33343. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  33344. };
  33345. }
  33346. /**
  33347. * Cross-platform codegen helper for generating v-model value assignment code.
  33348. */
  33349. function genAssignmentCode (
  33350. value,
  33351. assignment
  33352. ) {
  33353. var modelRs = parseModel(value);
  33354. if (modelRs.idx === null) {
  33355. return (value + "=" + assignment)
  33356. } else {
  33357. return ("$set(" + (modelRs.exp) + ", " + (modelRs.idx) + ", " + assignment + ")")
  33358. }
  33359. }
  33360. /**
  33361. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  33362. *
  33363. * for loop possible cases:
  33364. *
  33365. * - test
  33366. * - test[idx]
  33367. * - test[test1[idx]]
  33368. * - test["a"][idx]
  33369. * - xxx.test[a[a].test1[idx]]
  33370. * - test.xxx.a["asa"][test1[idx]]
  33371. *
  33372. */
  33373. var len;
  33374. var str;
  33375. var chr;
  33376. var index$1;
  33377. var expressionPos;
  33378. var expressionEndPos;
  33379. function parseModel (val) {
  33380. str = val;
  33381. len = str.length;
  33382. index$1 = expressionPos = expressionEndPos = 0;
  33383. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  33384. return {
  33385. exp: val,
  33386. idx: null
  33387. }
  33388. }
  33389. while (!eof()) {
  33390. chr = next();
  33391. /* istanbul ignore if */
  33392. if (isStringStart(chr)) {
  33393. parseString(chr);
  33394. } else if (chr === 0x5B) {
  33395. parseBracket(chr);
  33396. }
  33397. }
  33398. return {
  33399. exp: val.substring(0, expressionPos),
  33400. idx: val.substring(expressionPos + 1, expressionEndPos)
  33401. }
  33402. }
  33403. function next () {
  33404. return str.charCodeAt(++index$1)
  33405. }
  33406. function eof () {
  33407. return index$1 >= len
  33408. }
  33409. function isStringStart (chr) {
  33410. return chr === 0x22 || chr === 0x27
  33411. }
  33412. function parseBracket (chr) {
  33413. var inBracket = 1;
  33414. expressionPos = index$1;
  33415. while (!eof()) {
  33416. chr = next();
  33417. if (isStringStart(chr)) {
  33418. parseString(chr);
  33419. continue
  33420. }
  33421. if (chr === 0x5B) { inBracket++; }
  33422. if (chr === 0x5D) { inBracket--; }
  33423. if (inBracket === 0) {
  33424. expressionEndPos = index$1;
  33425. break
  33426. }
  33427. }
  33428. }
  33429. function parseString (chr) {
  33430. var stringQuote = chr;
  33431. while (!eof()) {
  33432. chr = next();
  33433. if (chr === stringQuote) {
  33434. break
  33435. }
  33436. }
  33437. }
  33438. /* */
  33439. var warn$1;
  33440. // in some cases, the event used has to be determined at runtime
  33441. // so we used some reserved tokens during compile.
  33442. var RANGE_TOKEN = '__r';
  33443. var CHECKBOX_RADIO_TOKEN = '__c';
  33444. function model (
  33445. el,
  33446. dir,
  33447. _warn
  33448. ) {
  33449. warn$1 = _warn;
  33450. var value = dir.value;
  33451. var modifiers = dir.modifiers;
  33452. var tag = el.tag;
  33453. var type = el.attrsMap.type;
  33454. if (true) {
  33455. var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  33456. if (tag === 'input' && dynamicType) {
  33457. warn$1(
  33458. "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
  33459. "v-model does not support dynamic input types. Use v-if branches instead."
  33460. );
  33461. }
  33462. // inputs with type="file" are read only and setting the input's
  33463. // value will throw an error.
  33464. if (tag === 'input' && type === 'file') {
  33465. warn$1(
  33466. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  33467. "File inputs are read only. Use a v-on:change listener instead."
  33468. );
  33469. }
  33470. }
  33471. if (el.component) {
  33472. genComponentModel(el, value, modifiers);
  33473. // component v-model doesn't need extra runtime
  33474. return false
  33475. } else if (tag === 'select') {
  33476. genSelect(el, value, modifiers);
  33477. } else if (tag === 'input' && type === 'checkbox') {
  33478. genCheckboxModel(el, value, modifiers);
  33479. } else if (tag === 'input' && type === 'radio') {
  33480. genRadioModel(el, value, modifiers);
  33481. } else if (tag === 'input' || tag === 'textarea') {
  33482. genDefaultModel(el, value, modifiers);
  33483. } else if (!config.isReservedTag(tag)) {
  33484. genComponentModel(el, value, modifiers);
  33485. // component v-model doesn't need extra runtime
  33486. return false
  33487. } else if (true) {
  33488. warn$1(
  33489. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  33490. "v-model is not supported on this element type. " +
  33491. 'If you are working with contenteditable, it\'s recommended to ' +
  33492. 'wrap a library dedicated for that purpose inside a custom component.'
  33493. );
  33494. }
  33495. // ensure runtime directive metadata
  33496. return true
  33497. }
  33498. function genCheckboxModel (
  33499. el,
  33500. value,
  33501. modifiers
  33502. ) {
  33503. var number = modifiers && modifiers.number;
  33504. var valueBinding = getBindingAttr(el, 'value') || 'null';
  33505. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  33506. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  33507. addProp(el, 'checked',
  33508. "Array.isArray(" + value + ")" +
  33509. "?_i(" + value + "," + valueBinding + ")>-1" + (
  33510. trueValueBinding === 'true'
  33511. ? (":(" + value + ")")
  33512. : (":_q(" + value + "," + trueValueBinding + ")")
  33513. )
  33514. );
  33515. addHandler(el, CHECKBOX_RADIO_TOKEN,
  33516. "var $$a=" + value + "," +
  33517. '$$el=$event.target,' +
  33518. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  33519. 'if(Array.isArray($$a)){' +
  33520. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  33521. '$$i=_i($$a,$$v);' +
  33522. "if($$el.checked){$$i<0&&(" + value + "=$$a.concat($$v))}" +
  33523. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  33524. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  33525. null, true
  33526. );
  33527. }
  33528. function genRadioModel (
  33529. el,
  33530. value,
  33531. modifiers
  33532. ) {
  33533. var number = modifiers && modifiers.number;
  33534. var valueBinding = getBindingAttr(el, 'value') || 'null';
  33535. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  33536. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  33537. addHandler(el, CHECKBOX_RADIO_TOKEN, genAssignmentCode(value, valueBinding), null, true);
  33538. }
  33539. function genSelect (
  33540. el,
  33541. value,
  33542. modifiers
  33543. ) {
  33544. var number = modifiers && modifiers.number;
  33545. var selectedVal = "Array.prototype.filter" +
  33546. ".call($event.target.options,function(o){return o.selected})" +
  33547. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  33548. "return " + (number ? '_n(val)' : 'val') + "})";
  33549. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  33550. var code = "var $$selectedVal = " + selectedVal + ";";
  33551. code = code + " " + (genAssignmentCode(value, assignment));
  33552. addHandler(el, 'change', code, null, true);
  33553. }
  33554. function genDefaultModel (
  33555. el,
  33556. value,
  33557. modifiers
  33558. ) {
  33559. var type = el.attrsMap.type;
  33560. var ref = modifiers || {};
  33561. var lazy = ref.lazy;
  33562. var number = ref.number;
  33563. var trim = ref.trim;
  33564. var needCompositionGuard = !lazy && type !== 'range';
  33565. var event = lazy
  33566. ? 'change'
  33567. : type === 'range'
  33568. ? RANGE_TOKEN
  33569. : 'input';
  33570. var valueExpression = '$event.target.value';
  33571. if (trim) {
  33572. valueExpression = "$event.target.value.trim()";
  33573. }
  33574. if (number) {
  33575. valueExpression = "_n(" + valueExpression + ")";
  33576. }
  33577. var code = genAssignmentCode(value, valueExpression);
  33578. if (needCompositionGuard) {
  33579. code = "if($event.target.composing)return;" + code;
  33580. }
  33581. addProp(el, 'value', ("(" + value + ")"));
  33582. addHandler(el, event, code, null, true);
  33583. if (trim || number) {
  33584. addHandler(el, 'blur', '$forceUpdate()');
  33585. }
  33586. }
  33587. /* */
  33588. // normalize v-model event tokens that can only be determined at runtime.
  33589. // it's important to place the event as the first in the array because
  33590. // the whole point is ensuring the v-model callback gets called before
  33591. // user-attached handlers.
  33592. function normalizeEvents (on) {
  33593. var event;
  33594. /* istanbul ignore if */
  33595. if (isDef(on[RANGE_TOKEN])) {
  33596. // IE input[type=range] only supports `change` event
  33597. event = isIE ? 'change' : 'input';
  33598. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  33599. delete on[RANGE_TOKEN];
  33600. }
  33601. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  33602. // Chrome fires microtasks in between click/change, leads to #4521
  33603. event = isChrome ? 'click' : 'change';
  33604. on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
  33605. delete on[CHECKBOX_RADIO_TOKEN];
  33606. }
  33607. }
  33608. var target$1;
  33609. function add$1 (
  33610. event,
  33611. handler,
  33612. once$$1,
  33613. capture,
  33614. passive
  33615. ) {
  33616. if (once$$1) {
  33617. var oldHandler = handler;
  33618. var _target = target$1; // save current target element in closure
  33619. handler = function (ev) {
  33620. var res = arguments.length === 1
  33621. ? oldHandler(ev)
  33622. : oldHandler.apply(null, arguments);
  33623. if (res !== null) {
  33624. remove$2(event, handler, capture, _target);
  33625. }
  33626. };
  33627. }
  33628. target$1.addEventListener(
  33629. event,
  33630. handler,
  33631. supportsPassive
  33632. ? { capture: capture, passive: passive }
  33633. : capture
  33634. );
  33635. }
  33636. function remove$2 (
  33637. event,
  33638. handler,
  33639. capture,
  33640. _target
  33641. ) {
  33642. (_target || target$1).removeEventListener(event, handler, capture);
  33643. }
  33644. function updateDOMListeners (oldVnode, vnode) {
  33645. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  33646. return
  33647. }
  33648. var on = vnode.data.on || {};
  33649. var oldOn = oldVnode.data.on || {};
  33650. target$1 = vnode.elm;
  33651. normalizeEvents(on);
  33652. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  33653. }
  33654. var events = {
  33655. create: updateDOMListeners,
  33656. update: updateDOMListeners
  33657. };
  33658. /* */
  33659. function updateDOMProps (oldVnode, vnode) {
  33660. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  33661. return
  33662. }
  33663. var key, cur;
  33664. var elm = vnode.elm;
  33665. var oldProps = oldVnode.data.domProps || {};
  33666. var props = vnode.data.domProps || {};
  33667. // clone observed objects, as the user probably wants to mutate it
  33668. if (isDef(props.__ob__)) {
  33669. props = vnode.data.domProps = extend({}, props);
  33670. }
  33671. for (key in oldProps) {
  33672. if (isUndef(props[key])) {
  33673. elm[key] = '';
  33674. }
  33675. }
  33676. for (key in props) {
  33677. cur = props[key];
  33678. // ignore children if the node has textContent or innerHTML,
  33679. // as these will throw away existing DOM nodes and cause removal errors
  33680. // on subsequent patches (#3360)
  33681. if (key === 'textContent' || key === 'innerHTML') {
  33682. if (vnode.children) { vnode.children.length = 0; }
  33683. if (cur === oldProps[key]) { continue }
  33684. }
  33685. if (key === 'value') {
  33686. // store value as _value as well since
  33687. // non-string values will be stringified
  33688. elm._value = cur;
  33689. // avoid resetting cursor position when value is the same
  33690. var strCur = isUndef(cur) ? '' : String(cur);
  33691. if (shouldUpdateValue(elm, vnode, strCur)) {
  33692. elm.value = strCur;
  33693. }
  33694. } else {
  33695. elm[key] = cur;
  33696. }
  33697. }
  33698. }
  33699. // check platforms/web/util/attrs.js acceptValue
  33700. function shouldUpdateValue (
  33701. elm,
  33702. vnode,
  33703. checkVal
  33704. ) {
  33705. return (!elm.composing && (
  33706. vnode.tag === 'option' ||
  33707. isDirty(elm, checkVal) ||
  33708. isInputChanged(elm, checkVal)
  33709. ))
  33710. }
  33711. function isDirty (elm, checkVal) {
  33712. // return true when textbox (.number and .trim) loses focus and its value is
  33713. // not equal to the updated value
  33714. var notInFocus = true;
  33715. // #6157
  33716. // work around IE bug when accessing document.activeElement in an iframe
  33717. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  33718. return notInFocus && elm.value !== checkVal
  33719. }
  33720. function isInputChanged (elm, newVal) {
  33721. var value = elm.value;
  33722. var modifiers = elm._vModifiers; // injected by v-model runtime
  33723. if (isDef(modifiers) && modifiers.number) {
  33724. return toNumber(value) !== toNumber(newVal)
  33725. }
  33726. if (isDef(modifiers) && modifiers.trim) {
  33727. return value.trim() !== newVal.trim()
  33728. }
  33729. return value !== newVal
  33730. }
  33731. var domProps = {
  33732. create: updateDOMProps,
  33733. update: updateDOMProps
  33734. };
  33735. /* */
  33736. var parseStyleText = cached(function (cssText) {
  33737. var res = {};
  33738. var listDelimiter = /;(?![^(]*\))/g;
  33739. var propertyDelimiter = /:(.+)/;
  33740. cssText.split(listDelimiter).forEach(function (item) {
  33741. if (item) {
  33742. var tmp = item.split(propertyDelimiter);
  33743. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  33744. }
  33745. });
  33746. return res
  33747. });
  33748. // merge static and dynamic style data on the same vnode
  33749. function normalizeStyleData (data) {
  33750. var style = normalizeStyleBinding(data.style);
  33751. // static style is pre-processed into an object during compilation
  33752. // and is always a fresh object, so it's safe to merge into it
  33753. return data.staticStyle
  33754. ? extend(data.staticStyle, style)
  33755. : style
  33756. }
  33757. // normalize possible array / string values into Object
  33758. function normalizeStyleBinding (bindingStyle) {
  33759. if (Array.isArray(bindingStyle)) {
  33760. return toObject(bindingStyle)
  33761. }
  33762. if (typeof bindingStyle === 'string') {
  33763. return parseStyleText(bindingStyle)
  33764. }
  33765. return bindingStyle
  33766. }
  33767. /**
  33768. * parent component style should be after child's
  33769. * so that parent component's style could override it
  33770. */
  33771. function getStyle (vnode, checkChild) {
  33772. var res = {};
  33773. var styleData;
  33774. if (checkChild) {
  33775. var childNode = vnode;
  33776. while (childNode.componentInstance) {
  33777. childNode = childNode.componentInstance._vnode;
  33778. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  33779. extend(res, styleData);
  33780. }
  33781. }
  33782. }
  33783. if ((styleData = normalizeStyleData(vnode.data))) {
  33784. extend(res, styleData);
  33785. }
  33786. var parentNode = vnode;
  33787. while ((parentNode = parentNode.parent)) {
  33788. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  33789. extend(res, styleData);
  33790. }
  33791. }
  33792. return res
  33793. }
  33794. /* */
  33795. var cssVarRE = /^--/;
  33796. var importantRE = /\s*!important$/;
  33797. var setProp = function (el, name, val) {
  33798. /* istanbul ignore if */
  33799. if (cssVarRE.test(name)) {
  33800. el.style.setProperty(name, val);
  33801. } else if (importantRE.test(val)) {
  33802. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  33803. } else {
  33804. var normalizedName = normalize(name);
  33805. if (Array.isArray(val)) {
  33806. // Support values array created by autoprefixer, e.g.
  33807. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  33808. // Set them one by one, and the browser will only set those it can recognize
  33809. for (var i = 0, len = val.length; i < len; i++) {
  33810. el.style[normalizedName] = val[i];
  33811. }
  33812. } else {
  33813. el.style[normalizedName] = val;
  33814. }
  33815. }
  33816. };
  33817. var vendorNames = ['Webkit', 'Moz', 'ms'];
  33818. var emptyStyle;
  33819. var normalize = cached(function (prop) {
  33820. emptyStyle = emptyStyle || document.createElement('div').style;
  33821. prop = camelize(prop);
  33822. if (prop !== 'filter' && (prop in emptyStyle)) {
  33823. return prop
  33824. }
  33825. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  33826. for (var i = 0; i < vendorNames.length; i++) {
  33827. var name = vendorNames[i] + capName;
  33828. if (name in emptyStyle) {
  33829. return name
  33830. }
  33831. }
  33832. });
  33833. function updateStyle (oldVnode, vnode) {
  33834. var data = vnode.data;
  33835. var oldData = oldVnode.data;
  33836. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  33837. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  33838. ) {
  33839. return
  33840. }
  33841. var cur, name;
  33842. var el = vnode.elm;
  33843. var oldStaticStyle = oldData.staticStyle;
  33844. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  33845. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  33846. var oldStyle = oldStaticStyle || oldStyleBinding;
  33847. var style = normalizeStyleBinding(vnode.data.style) || {};
  33848. // store normalized style under a different key for next diff
  33849. // make sure to clone it if it's reactive, since the user likley wants
  33850. // to mutate it.
  33851. vnode.data.normalizedStyle = isDef(style.__ob__)
  33852. ? extend({}, style)
  33853. : style;
  33854. var newStyle = getStyle(vnode, true);
  33855. for (name in oldStyle) {
  33856. if (isUndef(newStyle[name])) {
  33857. setProp(el, name, '');
  33858. }
  33859. }
  33860. for (name in newStyle) {
  33861. cur = newStyle[name];
  33862. if (cur !== oldStyle[name]) {
  33863. // ie9 setting to null has no effect, must use empty string
  33864. setProp(el, name, cur == null ? '' : cur);
  33865. }
  33866. }
  33867. }
  33868. var style = {
  33869. create: updateStyle,
  33870. update: updateStyle
  33871. };
  33872. /* */
  33873. /**
  33874. * Add class with compatibility for SVG since classList is not supported on
  33875. * SVG elements in IE
  33876. */
  33877. function addClass (el, cls) {
  33878. /* istanbul ignore if */
  33879. if (!cls || !(cls = cls.trim())) {
  33880. return
  33881. }
  33882. /* istanbul ignore else */
  33883. if (el.classList) {
  33884. if (cls.indexOf(' ') > -1) {
  33885. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  33886. } else {
  33887. el.classList.add(cls);
  33888. }
  33889. } else {
  33890. var cur = " " + (el.getAttribute('class') || '') + " ";
  33891. if (cur.indexOf(' ' + cls + ' ') < 0) {
  33892. el.setAttribute('class', (cur + cls).trim());
  33893. }
  33894. }
  33895. }
  33896. /**
  33897. * Remove class with compatibility for SVG since classList is not supported on
  33898. * SVG elements in IE
  33899. */
  33900. function removeClass (el, cls) {
  33901. /* istanbul ignore if */
  33902. if (!cls || !(cls = cls.trim())) {
  33903. return
  33904. }
  33905. /* istanbul ignore else */
  33906. if (el.classList) {
  33907. if (cls.indexOf(' ') > -1) {
  33908. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  33909. } else {
  33910. el.classList.remove(cls);
  33911. }
  33912. if (!el.classList.length) {
  33913. el.removeAttribute('class');
  33914. }
  33915. } else {
  33916. var cur = " " + (el.getAttribute('class') || '') + " ";
  33917. var tar = ' ' + cls + ' ';
  33918. while (cur.indexOf(tar) >= 0) {
  33919. cur = cur.replace(tar, ' ');
  33920. }
  33921. cur = cur.trim();
  33922. if (cur) {
  33923. el.setAttribute('class', cur);
  33924. } else {
  33925. el.removeAttribute('class');
  33926. }
  33927. }
  33928. }
  33929. /* */
  33930. function resolveTransition (def$$1) {
  33931. if (!def$$1) {
  33932. return
  33933. }
  33934. /* istanbul ignore else */
  33935. if (typeof def$$1 === 'object') {
  33936. var res = {};
  33937. if (def$$1.css !== false) {
  33938. extend(res, autoCssTransition(def$$1.name || 'v'));
  33939. }
  33940. extend(res, def$$1);
  33941. return res
  33942. } else if (typeof def$$1 === 'string') {
  33943. return autoCssTransition(def$$1)
  33944. }
  33945. }
  33946. var autoCssTransition = cached(function (name) {
  33947. return {
  33948. enterClass: (name + "-enter"),
  33949. enterToClass: (name + "-enter-to"),
  33950. enterActiveClass: (name + "-enter-active"),
  33951. leaveClass: (name + "-leave"),
  33952. leaveToClass: (name + "-leave-to"),
  33953. leaveActiveClass: (name + "-leave-active")
  33954. }
  33955. });
  33956. var hasTransition = inBrowser && !isIE9;
  33957. var TRANSITION = 'transition';
  33958. var ANIMATION = 'animation';
  33959. // Transition property/event sniffing
  33960. var transitionProp = 'transition';
  33961. var transitionEndEvent = 'transitionend';
  33962. var animationProp = 'animation';
  33963. var animationEndEvent = 'animationend';
  33964. if (hasTransition) {
  33965. /* istanbul ignore if */
  33966. if (window.ontransitionend === undefined &&
  33967. window.onwebkittransitionend !== undefined
  33968. ) {
  33969. transitionProp = 'WebkitTransition';
  33970. transitionEndEvent = 'webkitTransitionEnd';
  33971. }
  33972. if (window.onanimationend === undefined &&
  33973. window.onwebkitanimationend !== undefined
  33974. ) {
  33975. animationProp = 'WebkitAnimation';
  33976. animationEndEvent = 'webkitAnimationEnd';
  33977. }
  33978. }
  33979. // binding to window is necessary to make hot reload work in IE in strict mode
  33980. var raf = inBrowser && window.requestAnimationFrame
  33981. ? window.requestAnimationFrame.bind(window)
  33982. : setTimeout;
  33983. function nextFrame (fn) {
  33984. raf(function () {
  33985. raf(fn);
  33986. });
  33987. }
  33988. function addTransitionClass (el, cls) {
  33989. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  33990. if (transitionClasses.indexOf(cls) < 0) {
  33991. transitionClasses.push(cls);
  33992. addClass(el, cls);
  33993. }
  33994. }
  33995. function removeTransitionClass (el, cls) {
  33996. if (el._transitionClasses) {
  33997. remove(el._transitionClasses, cls);
  33998. }
  33999. removeClass(el, cls);
  34000. }
  34001. function whenTransitionEnds (
  34002. el,
  34003. expectedType,
  34004. cb
  34005. ) {
  34006. var ref = getTransitionInfo(el, expectedType);
  34007. var type = ref.type;
  34008. var timeout = ref.timeout;
  34009. var propCount = ref.propCount;
  34010. if (!type) { return cb() }
  34011. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  34012. var ended = 0;
  34013. var end = function () {
  34014. el.removeEventListener(event, onEnd);
  34015. cb();
  34016. };
  34017. var onEnd = function (e) {
  34018. if (e.target === el) {
  34019. if (++ended >= propCount) {
  34020. end();
  34021. }
  34022. }
  34023. };
  34024. setTimeout(function () {
  34025. if (ended < propCount) {
  34026. end();
  34027. }
  34028. }, timeout + 1);
  34029. el.addEventListener(event, onEnd);
  34030. }
  34031. var transformRE = /\b(transform|all)(,|$)/;
  34032. function getTransitionInfo (el, expectedType) {
  34033. var styles = window.getComputedStyle(el);
  34034. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  34035. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  34036. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  34037. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  34038. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  34039. var animationTimeout = getTimeout(animationDelays, animationDurations);
  34040. var type;
  34041. var timeout = 0;
  34042. var propCount = 0;
  34043. /* istanbul ignore if */
  34044. if (expectedType === TRANSITION) {
  34045. if (transitionTimeout > 0) {
  34046. type = TRANSITION;
  34047. timeout = transitionTimeout;
  34048. propCount = transitionDurations.length;
  34049. }
  34050. } else if (expectedType === ANIMATION) {
  34051. if (animationTimeout > 0) {
  34052. type = ANIMATION;
  34053. timeout = animationTimeout;
  34054. propCount = animationDurations.length;
  34055. }
  34056. } else {
  34057. timeout = Math.max(transitionTimeout, animationTimeout);
  34058. type = timeout > 0
  34059. ? transitionTimeout > animationTimeout
  34060. ? TRANSITION
  34061. : ANIMATION
  34062. : null;
  34063. propCount = type
  34064. ? type === TRANSITION
  34065. ? transitionDurations.length
  34066. : animationDurations.length
  34067. : 0;
  34068. }
  34069. var hasTransform =
  34070. type === TRANSITION &&
  34071. transformRE.test(styles[transitionProp + 'Property']);
  34072. return {
  34073. type: type,
  34074. timeout: timeout,
  34075. propCount: propCount,
  34076. hasTransform: hasTransform
  34077. }
  34078. }
  34079. function getTimeout (delays, durations) {
  34080. /* istanbul ignore next */
  34081. while (delays.length < durations.length) {
  34082. delays = delays.concat(delays);
  34083. }
  34084. return Math.max.apply(null, durations.map(function (d, i) {
  34085. return toMs(d) + toMs(delays[i])
  34086. }))
  34087. }
  34088. function toMs (s) {
  34089. return Number(s.slice(0, -1)) * 1000
  34090. }
  34091. /* */
  34092. function enter (vnode, toggleDisplay) {
  34093. var el = vnode.elm;
  34094. // call leave callback now
  34095. if (isDef(el._leaveCb)) {
  34096. el._leaveCb.cancelled = true;
  34097. el._leaveCb();
  34098. }
  34099. var data = resolveTransition(vnode.data.transition);
  34100. if (isUndef(data)) {
  34101. return
  34102. }
  34103. /* istanbul ignore if */
  34104. if (isDef(el._enterCb) || el.nodeType !== 1) {
  34105. return
  34106. }
  34107. var css = data.css;
  34108. var type = data.type;
  34109. var enterClass = data.enterClass;
  34110. var enterToClass = data.enterToClass;
  34111. var enterActiveClass = data.enterActiveClass;
  34112. var appearClass = data.appearClass;
  34113. var appearToClass = data.appearToClass;
  34114. var appearActiveClass = data.appearActiveClass;
  34115. var beforeEnter = data.beforeEnter;
  34116. var enter = data.enter;
  34117. var afterEnter = data.afterEnter;
  34118. var enterCancelled = data.enterCancelled;
  34119. var beforeAppear = data.beforeAppear;
  34120. var appear = data.appear;
  34121. var afterAppear = data.afterAppear;
  34122. var appearCancelled = data.appearCancelled;
  34123. var duration = data.duration;
  34124. // activeInstance will always be the <transition> component managing this
  34125. // transition. One edge case to check is when the <transition> is placed
  34126. // as the root node of a child component. In that case we need to check
  34127. // <transition>'s parent for appear check.
  34128. var context = activeInstance;
  34129. var transitionNode = activeInstance.$vnode;
  34130. while (transitionNode && transitionNode.parent) {
  34131. transitionNode = transitionNode.parent;
  34132. context = transitionNode.context;
  34133. }
  34134. var isAppear = !context._isMounted || !vnode.isRootInsert;
  34135. if (isAppear && !appear && appear !== '') {
  34136. return
  34137. }
  34138. var startClass = isAppear && appearClass
  34139. ? appearClass
  34140. : enterClass;
  34141. var activeClass = isAppear && appearActiveClass
  34142. ? appearActiveClass
  34143. : enterActiveClass;
  34144. var toClass = isAppear && appearToClass
  34145. ? appearToClass
  34146. : enterToClass;
  34147. var beforeEnterHook = isAppear
  34148. ? (beforeAppear || beforeEnter)
  34149. : beforeEnter;
  34150. var enterHook = isAppear
  34151. ? (typeof appear === 'function' ? appear : enter)
  34152. : enter;
  34153. var afterEnterHook = isAppear
  34154. ? (afterAppear || afterEnter)
  34155. : afterEnter;
  34156. var enterCancelledHook = isAppear
  34157. ? (appearCancelled || enterCancelled)
  34158. : enterCancelled;
  34159. var explicitEnterDuration = toNumber(
  34160. isObject(duration)
  34161. ? duration.enter
  34162. : duration
  34163. );
  34164. if ("development" !== 'production' && explicitEnterDuration != null) {
  34165. checkDuration(explicitEnterDuration, 'enter', vnode);
  34166. }
  34167. var expectsCSS = css !== false && !isIE9;
  34168. var userWantsControl = getHookArgumentsLength(enterHook);
  34169. var cb = el._enterCb = once(function () {
  34170. if (expectsCSS) {
  34171. removeTransitionClass(el, toClass);
  34172. removeTransitionClass(el, activeClass);
  34173. }
  34174. if (cb.cancelled) {
  34175. if (expectsCSS) {
  34176. removeTransitionClass(el, startClass);
  34177. }
  34178. enterCancelledHook && enterCancelledHook(el);
  34179. } else {
  34180. afterEnterHook && afterEnterHook(el);
  34181. }
  34182. el._enterCb = null;
  34183. });
  34184. if (!vnode.data.show) {
  34185. // remove pending leave element on enter by injecting an insert hook
  34186. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  34187. var parent = el.parentNode;
  34188. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  34189. if (pendingNode &&
  34190. pendingNode.tag === vnode.tag &&
  34191. pendingNode.elm._leaveCb
  34192. ) {
  34193. pendingNode.elm._leaveCb();
  34194. }
  34195. enterHook && enterHook(el, cb);
  34196. });
  34197. }
  34198. // start enter transition
  34199. beforeEnterHook && beforeEnterHook(el);
  34200. if (expectsCSS) {
  34201. addTransitionClass(el, startClass);
  34202. addTransitionClass(el, activeClass);
  34203. nextFrame(function () {
  34204. addTransitionClass(el, toClass);
  34205. removeTransitionClass(el, startClass);
  34206. if (!cb.cancelled && !userWantsControl) {
  34207. if (isValidDuration(explicitEnterDuration)) {
  34208. setTimeout(cb, explicitEnterDuration);
  34209. } else {
  34210. whenTransitionEnds(el, type, cb);
  34211. }
  34212. }
  34213. });
  34214. }
  34215. if (vnode.data.show) {
  34216. toggleDisplay && toggleDisplay();
  34217. enterHook && enterHook(el, cb);
  34218. }
  34219. if (!expectsCSS && !userWantsControl) {
  34220. cb();
  34221. }
  34222. }
  34223. function leave (vnode, rm) {
  34224. var el = vnode.elm;
  34225. // call enter callback now
  34226. if (isDef(el._enterCb)) {
  34227. el._enterCb.cancelled = true;
  34228. el._enterCb();
  34229. }
  34230. var data = resolveTransition(vnode.data.transition);
  34231. if (isUndef(data)) {
  34232. return rm()
  34233. }
  34234. /* istanbul ignore if */
  34235. if (isDef(el._leaveCb) || el.nodeType !== 1) {
  34236. return
  34237. }
  34238. var css = data.css;
  34239. var type = data.type;
  34240. var leaveClass = data.leaveClass;
  34241. var leaveToClass = data.leaveToClass;
  34242. var leaveActiveClass = data.leaveActiveClass;
  34243. var beforeLeave = data.beforeLeave;
  34244. var leave = data.leave;
  34245. var afterLeave = data.afterLeave;
  34246. var leaveCancelled = data.leaveCancelled;
  34247. var delayLeave = data.delayLeave;
  34248. var duration = data.duration;
  34249. var expectsCSS = css !== false && !isIE9;
  34250. var userWantsControl = getHookArgumentsLength(leave);
  34251. var explicitLeaveDuration = toNumber(
  34252. isObject(duration)
  34253. ? duration.leave
  34254. : duration
  34255. );
  34256. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  34257. checkDuration(explicitLeaveDuration, 'leave', vnode);
  34258. }
  34259. var cb = el._leaveCb = once(function () {
  34260. if (el.parentNode && el.parentNode._pending) {
  34261. el.parentNode._pending[vnode.key] = null;
  34262. }
  34263. if (expectsCSS) {
  34264. removeTransitionClass(el, leaveToClass);
  34265. removeTransitionClass(el, leaveActiveClass);
  34266. }
  34267. if (cb.cancelled) {
  34268. if (expectsCSS) {
  34269. removeTransitionClass(el, leaveClass);
  34270. }
  34271. leaveCancelled && leaveCancelled(el);
  34272. } else {
  34273. rm();
  34274. afterLeave && afterLeave(el);
  34275. }
  34276. el._leaveCb = null;
  34277. });
  34278. if (delayLeave) {
  34279. delayLeave(performLeave);
  34280. } else {
  34281. performLeave();
  34282. }
  34283. function performLeave () {
  34284. // the delayed leave may have already been cancelled
  34285. if (cb.cancelled) {
  34286. return
  34287. }
  34288. // record leaving element
  34289. if (!vnode.data.show) {
  34290. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  34291. }
  34292. beforeLeave && beforeLeave(el);
  34293. if (expectsCSS) {
  34294. addTransitionClass(el, leaveClass);
  34295. addTransitionClass(el, leaveActiveClass);
  34296. nextFrame(function () {
  34297. addTransitionClass(el, leaveToClass);
  34298. removeTransitionClass(el, leaveClass);
  34299. if (!cb.cancelled && !userWantsControl) {
  34300. if (isValidDuration(explicitLeaveDuration)) {
  34301. setTimeout(cb, explicitLeaveDuration);
  34302. } else {
  34303. whenTransitionEnds(el, type, cb);
  34304. }
  34305. }
  34306. });
  34307. }
  34308. leave && leave(el, cb);
  34309. if (!expectsCSS && !userWantsControl) {
  34310. cb();
  34311. }
  34312. }
  34313. }
  34314. // only used in dev mode
  34315. function checkDuration (val, name, vnode) {
  34316. if (typeof val !== 'number') {
  34317. warn(
  34318. "<transition> explicit " + name + " duration is not a valid number - " +
  34319. "got " + (JSON.stringify(val)) + ".",
  34320. vnode.context
  34321. );
  34322. } else if (isNaN(val)) {
  34323. warn(
  34324. "<transition> explicit " + name + " duration is NaN - " +
  34325. 'the duration expression might be incorrect.',
  34326. vnode.context
  34327. );
  34328. }
  34329. }
  34330. function isValidDuration (val) {
  34331. return typeof val === 'number' && !isNaN(val)
  34332. }
  34333. /**
  34334. * Normalize a transition hook's argument length. The hook may be:
  34335. * - a merged hook (invoker) with the original in .fns
  34336. * - a wrapped component method (check ._length)
  34337. * - a plain function (.length)
  34338. */
  34339. function getHookArgumentsLength (fn) {
  34340. if (isUndef(fn)) {
  34341. return false
  34342. }
  34343. var invokerFns = fn.fns;
  34344. if (isDef(invokerFns)) {
  34345. // invoker
  34346. return getHookArgumentsLength(
  34347. Array.isArray(invokerFns)
  34348. ? invokerFns[0]
  34349. : invokerFns
  34350. )
  34351. } else {
  34352. return (fn._length || fn.length) > 1
  34353. }
  34354. }
  34355. function _enter (_, vnode) {
  34356. if (vnode.data.show !== true) {
  34357. enter(vnode);
  34358. }
  34359. }
  34360. var transition = inBrowser ? {
  34361. create: _enter,
  34362. activate: _enter,
  34363. remove: function remove$$1 (vnode, rm) {
  34364. /* istanbul ignore else */
  34365. if (vnode.data.show !== true) {
  34366. leave(vnode, rm);
  34367. } else {
  34368. rm();
  34369. }
  34370. }
  34371. } : {};
  34372. var platformModules = [
  34373. attrs,
  34374. klass,
  34375. events,
  34376. domProps,
  34377. style,
  34378. transition
  34379. ];
  34380. /* */
  34381. // the directive module should be applied last, after all
  34382. // built-in modules have been applied.
  34383. var modules = platformModules.concat(baseModules);
  34384. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  34385. /**
  34386. * Not type checking this file because flow doesn't like attaching
  34387. * properties to Elements.
  34388. */
  34389. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  34390. /* istanbul ignore if */
  34391. if (isIE9) {
  34392. // http://www.matts411.com/post/internet-explorer-9-oninput/
  34393. document.addEventListener('selectionchange', function () {
  34394. var el = document.activeElement;
  34395. if (el && el.vmodel) {
  34396. trigger(el, 'input');
  34397. }
  34398. });
  34399. }
  34400. var model$1 = {
  34401. inserted: function inserted (el, binding, vnode) {
  34402. if (vnode.tag === 'select') {
  34403. var cb = function () {
  34404. setSelected(el, binding, vnode.context);
  34405. };
  34406. cb();
  34407. /* istanbul ignore if */
  34408. if (isIE || isEdge) {
  34409. setTimeout(cb, 0);
  34410. }
  34411. el._vOptions = [].map.call(el.options, getValue);
  34412. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  34413. el._vModifiers = binding.modifiers;
  34414. if (!binding.modifiers.lazy) {
  34415. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  34416. // switching focus before confirming composition choice
  34417. // this also fixes the issue where some browsers e.g. iOS Chrome
  34418. // fires "change" instead of "input" on autocomplete.
  34419. el.addEventListener('change', onCompositionEnd);
  34420. if (!isAndroid) {
  34421. el.addEventListener('compositionstart', onCompositionStart);
  34422. el.addEventListener('compositionend', onCompositionEnd);
  34423. }
  34424. /* istanbul ignore if */
  34425. if (isIE9) {
  34426. el.vmodel = true;
  34427. }
  34428. }
  34429. }
  34430. },
  34431. componentUpdated: function componentUpdated (el, binding, vnode) {
  34432. if (vnode.tag === 'select') {
  34433. setSelected(el, binding, vnode.context);
  34434. // in case the options rendered by v-for have changed,
  34435. // it's possible that the value is out-of-sync with the rendered options.
  34436. // detect such cases and filter out values that no longer has a matching
  34437. // option in the DOM.
  34438. var prevOptions = el._vOptions;
  34439. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  34440. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  34441. trigger(el, 'change');
  34442. }
  34443. }
  34444. }
  34445. };
  34446. function setSelected (el, binding, vm) {
  34447. var value = binding.value;
  34448. var isMultiple = el.multiple;
  34449. if (isMultiple && !Array.isArray(value)) {
  34450. "development" !== 'production' && warn(
  34451. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  34452. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  34453. vm
  34454. );
  34455. return
  34456. }
  34457. var selected, option;
  34458. for (var i = 0, l = el.options.length; i < l; i++) {
  34459. option = el.options[i];
  34460. if (isMultiple) {
  34461. selected = looseIndexOf(value, getValue(option)) > -1;
  34462. if (option.selected !== selected) {
  34463. option.selected = selected;
  34464. }
  34465. } else {
  34466. if (looseEqual(getValue(option), value)) {
  34467. if (el.selectedIndex !== i) {
  34468. el.selectedIndex = i;
  34469. }
  34470. return
  34471. }
  34472. }
  34473. }
  34474. if (!isMultiple) {
  34475. el.selectedIndex = -1;
  34476. }
  34477. }
  34478. function getValue (option) {
  34479. return '_value' in option
  34480. ? option._value
  34481. : option.value
  34482. }
  34483. function onCompositionStart (e) {
  34484. e.target.composing = true;
  34485. }
  34486. function onCompositionEnd (e) {
  34487. // prevent triggering an input event for no reason
  34488. if (!e.target.composing) { return }
  34489. e.target.composing = false;
  34490. trigger(e.target, 'input');
  34491. }
  34492. function trigger (el, type) {
  34493. var e = document.createEvent('HTMLEvents');
  34494. e.initEvent(type, true, true);
  34495. el.dispatchEvent(e);
  34496. }
  34497. /* */
  34498. // recursively search for possible transition defined inside the component root
  34499. function locateNode (vnode) {
  34500. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  34501. ? locateNode(vnode.componentInstance._vnode)
  34502. : vnode
  34503. }
  34504. var show = {
  34505. bind: function bind (el, ref, vnode) {
  34506. var value = ref.value;
  34507. vnode = locateNode(vnode);
  34508. var transition$$1 = vnode.data && vnode.data.transition;
  34509. var originalDisplay = el.__vOriginalDisplay =
  34510. el.style.display === 'none' ? '' : el.style.display;
  34511. if (value && transition$$1) {
  34512. vnode.data.show = true;
  34513. enter(vnode, function () {
  34514. el.style.display = originalDisplay;
  34515. });
  34516. } else {
  34517. el.style.display = value ? originalDisplay : 'none';
  34518. }
  34519. },
  34520. update: function update (el, ref, vnode) {
  34521. var value = ref.value;
  34522. var oldValue = ref.oldValue;
  34523. /* istanbul ignore if */
  34524. if (value === oldValue) { return }
  34525. vnode = locateNode(vnode);
  34526. var transition$$1 = vnode.data && vnode.data.transition;
  34527. if (transition$$1) {
  34528. vnode.data.show = true;
  34529. if (value) {
  34530. enter(vnode, function () {
  34531. el.style.display = el.__vOriginalDisplay;
  34532. });
  34533. } else {
  34534. leave(vnode, function () {
  34535. el.style.display = 'none';
  34536. });
  34537. }
  34538. } else {
  34539. el.style.display = value ? el.__vOriginalDisplay : 'none';
  34540. }
  34541. },
  34542. unbind: function unbind (
  34543. el,
  34544. binding,
  34545. vnode,
  34546. oldVnode,
  34547. isDestroy
  34548. ) {
  34549. if (!isDestroy) {
  34550. el.style.display = el.__vOriginalDisplay;
  34551. }
  34552. }
  34553. };
  34554. var platformDirectives = {
  34555. model: model$1,
  34556. show: show
  34557. };
  34558. /* */
  34559. // Provides transition support for a single element/component.
  34560. // supports transition mode (out-in / in-out)
  34561. var transitionProps = {
  34562. name: String,
  34563. appear: Boolean,
  34564. css: Boolean,
  34565. mode: String,
  34566. type: String,
  34567. enterClass: String,
  34568. leaveClass: String,
  34569. enterToClass: String,
  34570. leaveToClass: String,
  34571. enterActiveClass: String,
  34572. leaveActiveClass: String,
  34573. appearClass: String,
  34574. appearActiveClass: String,
  34575. appearToClass: String,
  34576. duration: [Number, String, Object]
  34577. };
  34578. // in case the child is also an abstract component, e.g. <keep-alive>
  34579. // we want to recursively retrieve the real component to be rendered
  34580. function getRealChild (vnode) {
  34581. var compOptions = vnode && vnode.componentOptions;
  34582. if (compOptions && compOptions.Ctor.options.abstract) {
  34583. return getRealChild(getFirstComponentChild(compOptions.children))
  34584. } else {
  34585. return vnode
  34586. }
  34587. }
  34588. function extractTransitionData (comp) {
  34589. var data = {};
  34590. var options = comp.$options;
  34591. // props
  34592. for (var key in options.propsData) {
  34593. data[key] = comp[key];
  34594. }
  34595. // events.
  34596. // extract listeners and pass them directly to the transition methods
  34597. var listeners = options._parentListeners;
  34598. for (var key$1 in listeners) {
  34599. data[camelize(key$1)] = listeners[key$1];
  34600. }
  34601. return data
  34602. }
  34603. function placeholder (h, rawChild) {
  34604. if (/\d-keep-alive$/.test(rawChild.tag)) {
  34605. return h('keep-alive', {
  34606. props: rawChild.componentOptions.propsData
  34607. })
  34608. }
  34609. }
  34610. function hasParentTransition (vnode) {
  34611. while ((vnode = vnode.parent)) {
  34612. if (vnode.data.transition) {
  34613. return true
  34614. }
  34615. }
  34616. }
  34617. function isSameChild (child, oldChild) {
  34618. return oldChild.key === child.key && oldChild.tag === child.tag
  34619. }
  34620. function isAsyncPlaceholder (node) {
  34621. return node.isComment && node.asyncFactory
  34622. }
  34623. var Transition = {
  34624. name: 'transition',
  34625. props: transitionProps,
  34626. abstract: true,
  34627. render: function render (h) {
  34628. var this$1 = this;
  34629. var children = this.$options._renderChildren;
  34630. if (!children) {
  34631. return
  34632. }
  34633. // filter out text nodes (possible whitespaces)
  34634. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  34635. /* istanbul ignore if */
  34636. if (!children.length) {
  34637. return
  34638. }
  34639. // warn multiple elements
  34640. if ("development" !== 'production' && children.length > 1) {
  34641. warn(
  34642. '<transition> can only be used on a single element. Use ' +
  34643. '<transition-group> for lists.',
  34644. this.$parent
  34645. );
  34646. }
  34647. var mode = this.mode;
  34648. // warn invalid mode
  34649. if ("development" !== 'production' &&
  34650. mode && mode !== 'in-out' && mode !== 'out-in'
  34651. ) {
  34652. warn(
  34653. 'invalid <transition> mode: ' + mode,
  34654. this.$parent
  34655. );
  34656. }
  34657. var rawChild = children[0];
  34658. // if this is a component root node and the component's
  34659. // parent container node also has transition, skip.
  34660. if (hasParentTransition(this.$vnode)) {
  34661. return rawChild
  34662. }
  34663. // apply transition data to child
  34664. // use getRealChild() to ignore abstract components e.g. keep-alive
  34665. var child = getRealChild(rawChild);
  34666. /* istanbul ignore if */
  34667. if (!child) {
  34668. return rawChild
  34669. }
  34670. if (this._leaving) {
  34671. return placeholder(h, rawChild)
  34672. }
  34673. // ensure a key that is unique to the vnode type and to this transition
  34674. // component instance. This key will be used to remove pending leaving nodes
  34675. // during entering.
  34676. var id = "__transition-" + (this._uid) + "-";
  34677. child.key = child.key == null
  34678. ? child.isComment
  34679. ? id + 'comment'
  34680. : id + child.tag
  34681. : isPrimitive(child.key)
  34682. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  34683. : child.key;
  34684. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  34685. var oldRawChild = this._vnode;
  34686. var oldChild = getRealChild(oldRawChild);
  34687. // mark v-show
  34688. // so that the transition module can hand over the control to the directive
  34689. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  34690. child.data.show = true;
  34691. }
  34692. if (
  34693. oldChild &&
  34694. oldChild.data &&
  34695. !isSameChild(child, oldChild) &&
  34696. !isAsyncPlaceholder(oldChild)
  34697. ) {
  34698. // replace old child transition data with fresh one
  34699. // important for dynamic transitions!
  34700. var oldData = oldChild && (oldChild.data.transition = extend({}, data));
  34701. // handle transition mode
  34702. if (mode === 'out-in') {
  34703. // return placeholder node and queue update when leave finishes
  34704. this._leaving = true;
  34705. mergeVNodeHook(oldData, 'afterLeave', function () {
  34706. this$1._leaving = false;
  34707. this$1.$forceUpdate();
  34708. });
  34709. return placeholder(h, rawChild)
  34710. } else if (mode === 'in-out') {
  34711. if (isAsyncPlaceholder(child)) {
  34712. return oldRawChild
  34713. }
  34714. var delayedLeave;
  34715. var performLeave = function () { delayedLeave(); };
  34716. mergeVNodeHook(data, 'afterEnter', performLeave);
  34717. mergeVNodeHook(data, 'enterCancelled', performLeave);
  34718. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  34719. }
  34720. }
  34721. return rawChild
  34722. }
  34723. };
  34724. /* */
  34725. // Provides transition support for list items.
  34726. // supports move transitions using the FLIP technique.
  34727. // Because the vdom's children update algorithm is "unstable" - i.e.
  34728. // it doesn't guarantee the relative positioning of removed elements,
  34729. // we force transition-group to update its children into two passes:
  34730. // in the first pass, we remove all nodes that need to be removed,
  34731. // triggering their leaving transition; in the second pass, we insert/move
  34732. // into the final desired state. This way in the second pass removed
  34733. // nodes will remain where they should be.
  34734. var props = extend({
  34735. tag: String,
  34736. moveClass: String
  34737. }, transitionProps);
  34738. delete props.mode;
  34739. var TransitionGroup = {
  34740. props: props,
  34741. render: function render (h) {
  34742. var tag = this.tag || this.$vnode.data.tag || 'span';
  34743. var map = Object.create(null);
  34744. var prevChildren = this.prevChildren = this.children;
  34745. var rawChildren = this.$slots.default || [];
  34746. var children = this.children = [];
  34747. var transitionData = extractTransitionData(this);
  34748. for (var i = 0; i < rawChildren.length; i++) {
  34749. var c = rawChildren[i];
  34750. if (c.tag) {
  34751. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  34752. children.push(c);
  34753. map[c.key] = c
  34754. ;(c.data || (c.data = {})).transition = transitionData;
  34755. } else if (true) {
  34756. var opts = c.componentOptions;
  34757. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  34758. warn(("<transition-group> children must be keyed: <" + name + ">"));
  34759. }
  34760. }
  34761. }
  34762. if (prevChildren) {
  34763. var kept = [];
  34764. var removed = [];
  34765. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  34766. var c$1 = prevChildren[i$1];
  34767. c$1.data.transition = transitionData;
  34768. c$1.data.pos = c$1.elm.getBoundingClientRect();
  34769. if (map[c$1.key]) {
  34770. kept.push(c$1);
  34771. } else {
  34772. removed.push(c$1);
  34773. }
  34774. }
  34775. this.kept = h(tag, null, kept);
  34776. this.removed = removed;
  34777. }
  34778. return h(tag, null, children)
  34779. },
  34780. beforeUpdate: function beforeUpdate () {
  34781. // force removing pass
  34782. this.__patch__(
  34783. this._vnode,
  34784. this.kept,
  34785. false, // hydrating
  34786. true // removeOnly (!important, avoids unnecessary moves)
  34787. );
  34788. this._vnode = this.kept;
  34789. },
  34790. updated: function updated () {
  34791. var children = this.prevChildren;
  34792. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  34793. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  34794. return
  34795. }
  34796. // we divide the work into three loops to avoid mixing DOM reads and writes
  34797. // in each iteration - which helps prevent layout thrashing.
  34798. children.forEach(callPendingCbs);
  34799. children.forEach(recordPosition);
  34800. children.forEach(applyTranslation);
  34801. // force reflow to put everything in position
  34802. var body = document.body;
  34803. var f = body.offsetHeight; // eslint-disable-line
  34804. children.forEach(function (c) {
  34805. if (c.data.moved) {
  34806. var el = c.elm;
  34807. var s = el.style;
  34808. addTransitionClass(el, moveClass);
  34809. s.transform = s.WebkitTransform = s.transitionDuration = '';
  34810. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  34811. if (!e || /transform$/.test(e.propertyName)) {
  34812. el.removeEventListener(transitionEndEvent, cb);
  34813. el._moveCb = null;
  34814. removeTransitionClass(el, moveClass);
  34815. }
  34816. });
  34817. }
  34818. });
  34819. },
  34820. methods: {
  34821. hasMove: function hasMove (el, moveClass) {
  34822. /* istanbul ignore if */
  34823. if (!hasTransition) {
  34824. return false
  34825. }
  34826. /* istanbul ignore if */
  34827. if (this._hasMove) {
  34828. return this._hasMove
  34829. }
  34830. // Detect whether an element with the move class applied has
  34831. // CSS transitions. Since the element may be inside an entering
  34832. // transition at this very moment, we make a clone of it and remove
  34833. // all other transition classes applied to ensure only the move class
  34834. // is applied.
  34835. var clone = el.cloneNode();
  34836. if (el._transitionClasses) {
  34837. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  34838. }
  34839. addClass(clone, moveClass);
  34840. clone.style.display = 'none';
  34841. this.$el.appendChild(clone);
  34842. var info = getTransitionInfo(clone);
  34843. this.$el.removeChild(clone);
  34844. return (this._hasMove = info.hasTransform)
  34845. }
  34846. }
  34847. };
  34848. function callPendingCbs (c) {
  34849. /* istanbul ignore if */
  34850. if (c.elm._moveCb) {
  34851. c.elm._moveCb();
  34852. }
  34853. /* istanbul ignore if */
  34854. if (c.elm._enterCb) {
  34855. c.elm._enterCb();
  34856. }
  34857. }
  34858. function recordPosition (c) {
  34859. c.data.newPos = c.elm.getBoundingClientRect();
  34860. }
  34861. function applyTranslation (c) {
  34862. var oldPos = c.data.pos;
  34863. var newPos = c.data.newPos;
  34864. var dx = oldPos.left - newPos.left;
  34865. var dy = oldPos.top - newPos.top;
  34866. if (dx || dy) {
  34867. c.data.moved = true;
  34868. var s = c.elm.style;
  34869. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  34870. s.transitionDuration = '0s';
  34871. }
  34872. }
  34873. var platformComponents = {
  34874. Transition: Transition,
  34875. TransitionGroup: TransitionGroup
  34876. };
  34877. /* */
  34878. // install platform specific utils
  34879. Vue$3.config.mustUseProp = mustUseProp;
  34880. Vue$3.config.isReservedTag = isReservedTag;
  34881. Vue$3.config.isReservedAttr = isReservedAttr;
  34882. Vue$3.config.getTagNamespace = getTagNamespace;
  34883. Vue$3.config.isUnknownElement = isUnknownElement;
  34884. // install platform runtime directives & components
  34885. extend(Vue$3.options.directives, platformDirectives);
  34886. extend(Vue$3.options.components, platformComponents);
  34887. // install platform patch function
  34888. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  34889. // public mount method
  34890. Vue$3.prototype.$mount = function (
  34891. el,
  34892. hydrating
  34893. ) {
  34894. el = el && inBrowser ? query(el) : undefined;
  34895. return mountComponent(this, el, hydrating)
  34896. };
  34897. // devtools global hook
  34898. /* istanbul ignore next */
  34899. setTimeout(function () {
  34900. if (config.devtools) {
  34901. if (devtools) {
  34902. devtools.emit('init', Vue$3);
  34903. } else if ("development" !== 'production' && isChrome) {
  34904. console[console.info ? 'info' : 'log'](
  34905. 'Download the Vue Devtools extension for a better development experience:\n' +
  34906. 'https://github.com/vuejs/vue-devtools'
  34907. );
  34908. }
  34909. }
  34910. if ("development" !== 'production' &&
  34911. config.productionTip !== false &&
  34912. inBrowser && typeof console !== 'undefined'
  34913. ) {
  34914. console[console.info ? 'info' : 'log'](
  34915. "You are running Vue in development mode.\n" +
  34916. "Make sure to turn on production mode when deploying for production.\n" +
  34917. "See more tips at https://vuejs.org/guide/deployment.html"
  34918. );
  34919. }
  34920. }, 0);
  34921. /* */
  34922. // check whether current browser encodes a char inside attribute values
  34923. function shouldDecode (content, encoded) {
  34924. var div = document.createElement('div');
  34925. div.innerHTML = "<div a=\"" + content + "\"/>";
  34926. return div.innerHTML.indexOf(encoded) > 0
  34927. }
  34928. // #3663
  34929. // IE encodes newlines inside attribute values while other browsers don't
  34930. var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
  34931. /* */
  34932. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  34933. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  34934. var buildRegex = cached(function (delimiters) {
  34935. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  34936. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  34937. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  34938. });
  34939. function parseText (
  34940. text,
  34941. delimiters
  34942. ) {
  34943. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  34944. if (!tagRE.test(text)) {
  34945. return
  34946. }
  34947. var tokens = [];
  34948. var lastIndex = tagRE.lastIndex = 0;
  34949. var match, index;
  34950. while ((match = tagRE.exec(text))) {
  34951. index = match.index;
  34952. // push text token
  34953. if (index > lastIndex) {
  34954. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  34955. }
  34956. // tag token
  34957. var exp = parseFilters(match[1].trim());
  34958. tokens.push(("_s(" + exp + ")"));
  34959. lastIndex = index + match[0].length;
  34960. }
  34961. if (lastIndex < text.length) {
  34962. tokens.push(JSON.stringify(text.slice(lastIndex)));
  34963. }
  34964. return tokens.join('+')
  34965. }
  34966. /* */
  34967. function transformNode (el, options) {
  34968. var warn = options.warn || baseWarn;
  34969. var staticClass = getAndRemoveAttr(el, 'class');
  34970. if ("development" !== 'production' && staticClass) {
  34971. var expression = parseText(staticClass, options.delimiters);
  34972. if (expression) {
  34973. warn(
  34974. "class=\"" + staticClass + "\": " +
  34975. 'Interpolation inside attributes has been removed. ' +
  34976. 'Use v-bind or the colon shorthand instead. For example, ' +
  34977. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  34978. );
  34979. }
  34980. }
  34981. if (staticClass) {
  34982. el.staticClass = JSON.stringify(staticClass);
  34983. }
  34984. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  34985. if (classBinding) {
  34986. el.classBinding = classBinding;
  34987. }
  34988. }
  34989. function genData (el) {
  34990. var data = '';
  34991. if (el.staticClass) {
  34992. data += "staticClass:" + (el.staticClass) + ",";
  34993. }
  34994. if (el.classBinding) {
  34995. data += "class:" + (el.classBinding) + ",";
  34996. }
  34997. return data
  34998. }
  34999. var klass$1 = {
  35000. staticKeys: ['staticClass'],
  35001. transformNode: transformNode,
  35002. genData: genData
  35003. };
  35004. /* */
  35005. function transformNode$1 (el, options) {
  35006. var warn = options.warn || baseWarn;
  35007. var staticStyle = getAndRemoveAttr(el, 'style');
  35008. if (staticStyle) {
  35009. /* istanbul ignore if */
  35010. if (true) {
  35011. var expression = parseText(staticStyle, options.delimiters);
  35012. if (expression) {
  35013. warn(
  35014. "style=\"" + staticStyle + "\": " +
  35015. 'Interpolation inside attributes has been removed. ' +
  35016. 'Use v-bind or the colon shorthand instead. For example, ' +
  35017. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  35018. );
  35019. }
  35020. }
  35021. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  35022. }
  35023. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  35024. if (styleBinding) {
  35025. el.styleBinding = styleBinding;
  35026. }
  35027. }
  35028. function genData$1 (el) {
  35029. var data = '';
  35030. if (el.staticStyle) {
  35031. data += "staticStyle:" + (el.staticStyle) + ",";
  35032. }
  35033. if (el.styleBinding) {
  35034. data += "style:(" + (el.styleBinding) + "),";
  35035. }
  35036. return data
  35037. }
  35038. var style$1 = {
  35039. staticKeys: ['staticStyle'],
  35040. transformNode: transformNode$1,
  35041. genData: genData$1
  35042. };
  35043. var modules$1 = [
  35044. klass$1,
  35045. style$1
  35046. ];
  35047. /* */
  35048. function text (el, dir) {
  35049. if (dir.value) {
  35050. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  35051. }
  35052. }
  35053. /* */
  35054. function html (el, dir) {
  35055. if (dir.value) {
  35056. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  35057. }
  35058. }
  35059. var directives$1 = {
  35060. model: model,
  35061. text: text,
  35062. html: html
  35063. };
  35064. /* */
  35065. var isUnaryTag = makeMap(
  35066. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  35067. 'link,meta,param,source,track,wbr'
  35068. );
  35069. // Elements that you can, intentionally, leave open
  35070. // (and which close themselves)
  35071. var canBeLeftOpenTag = makeMap(
  35072. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  35073. );
  35074. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  35075. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  35076. var isNonPhrasingTag = makeMap(
  35077. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  35078. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  35079. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  35080. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  35081. 'title,tr,track'
  35082. );
  35083. /* */
  35084. var baseOptions = {
  35085. expectHTML: true,
  35086. modules: modules$1,
  35087. directives: directives$1,
  35088. isPreTag: isPreTag,
  35089. isUnaryTag: isUnaryTag,
  35090. mustUseProp: mustUseProp,
  35091. canBeLeftOpenTag: canBeLeftOpenTag,
  35092. isReservedTag: isReservedTag,
  35093. getTagNamespace: getTagNamespace,
  35094. staticKeys: genStaticKeys(modules$1)
  35095. };
  35096. /* */
  35097. var decoder;
  35098. var he = {
  35099. decode: function decode (html) {
  35100. decoder = decoder || document.createElement('div');
  35101. decoder.innerHTML = html;
  35102. return decoder.textContent
  35103. }
  35104. };
  35105. /**
  35106. * Not type-checking this file because it's mostly vendor code.
  35107. */
  35108. /*!
  35109. * HTML Parser By John Resig (ejohn.org)
  35110. * Modified by Juriy "kangax" Zaytsev
  35111. * Original code by Erik Arvidsson, Mozilla Public License
  35112. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  35113. */
  35114. // Regular Expressions for parsing tags and attributes
  35115. var singleAttrIdentifier = /([^\s"'<>/=]+)/;
  35116. var singleAttrAssign = /(?:=)/;
  35117. var singleAttrValues = [
  35118. // attr value double quotes
  35119. /"([^"]*)"+/.source,
  35120. // attr value, single quotes
  35121. /'([^']*)'+/.source,
  35122. // attr value, no quotes
  35123. /([^\s"'=<>`]+)/.source
  35124. ];
  35125. var attribute = new RegExp(
  35126. '^\\s*' + singleAttrIdentifier.source +
  35127. '(?:\\s*(' + singleAttrAssign.source + ')' +
  35128. '\\s*(?:' + singleAttrValues.join('|') + '))?'
  35129. );
  35130. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  35131. // but for Vue templates we can enforce a simple charset
  35132. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  35133. var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
  35134. var startTagOpen = new RegExp('^<' + qnameCapture);
  35135. var startTagClose = /^\s*(\/?)>/;
  35136. var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
  35137. var doctype = /^<!DOCTYPE [^>]+>/i;
  35138. var comment = /^<!--/;
  35139. var conditionalComment = /^<!\[/;
  35140. var IS_REGEX_CAPTURING_BROKEN = false;
  35141. 'x'.replace(/x(.)?/g, function (m, g) {
  35142. IS_REGEX_CAPTURING_BROKEN = g === '';
  35143. });
  35144. // Special Elements (can contain anything)
  35145. var isPlainTextElement = makeMap('script,style,textarea', true);
  35146. var reCache = {};
  35147. var decodingMap = {
  35148. '&lt;': '<',
  35149. '&gt;': '>',
  35150. '&quot;': '"',
  35151. '&amp;': '&',
  35152. '&#10;': '\n'
  35153. };
  35154. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  35155. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;
  35156. // #5992
  35157. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  35158. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  35159. function decodeAttr (value, shouldDecodeNewlines) {
  35160. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  35161. return value.replace(re, function (match) { return decodingMap[match]; })
  35162. }
  35163. function parseHTML (html, options) {
  35164. var stack = [];
  35165. var expectHTML = options.expectHTML;
  35166. var isUnaryTag$$1 = options.isUnaryTag || no;
  35167. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  35168. var index = 0;
  35169. var last, lastTag;
  35170. while (html) {
  35171. last = html;
  35172. // Make sure we're not in a plaintext content element like script/style
  35173. if (!lastTag || !isPlainTextElement(lastTag)) {
  35174. var textEnd = html.indexOf('<');
  35175. if (textEnd === 0) {
  35176. // Comment:
  35177. if (comment.test(html)) {
  35178. var commentEnd = html.indexOf('-->');
  35179. if (commentEnd >= 0) {
  35180. if (options.shouldKeepComment) {
  35181. options.comment(html.substring(4, commentEnd));
  35182. }
  35183. advance(commentEnd + 3);
  35184. continue
  35185. }
  35186. }
  35187. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  35188. if (conditionalComment.test(html)) {
  35189. var conditionalEnd = html.indexOf(']>');
  35190. if (conditionalEnd >= 0) {
  35191. advance(conditionalEnd + 2);
  35192. continue
  35193. }
  35194. }
  35195. // Doctype:
  35196. var doctypeMatch = html.match(doctype);
  35197. if (doctypeMatch) {
  35198. advance(doctypeMatch[0].length);
  35199. continue
  35200. }
  35201. // End tag:
  35202. var endTagMatch = html.match(endTag);
  35203. if (endTagMatch) {
  35204. var curIndex = index;
  35205. advance(endTagMatch[0].length);
  35206. parseEndTag(endTagMatch[1], curIndex, index);
  35207. continue
  35208. }
  35209. // Start tag:
  35210. var startTagMatch = parseStartTag();
  35211. if (startTagMatch) {
  35212. handleStartTag(startTagMatch);
  35213. if (shouldIgnoreFirstNewline(lastTag, html)) {
  35214. advance(1);
  35215. }
  35216. continue
  35217. }
  35218. }
  35219. var text = (void 0), rest = (void 0), next = (void 0);
  35220. if (textEnd >= 0) {
  35221. rest = html.slice(textEnd);
  35222. while (
  35223. !endTag.test(rest) &&
  35224. !startTagOpen.test(rest) &&
  35225. !comment.test(rest) &&
  35226. !conditionalComment.test(rest)
  35227. ) {
  35228. // < in plain text, be forgiving and treat it as text
  35229. next = rest.indexOf('<', 1);
  35230. if (next < 0) { break }
  35231. textEnd += next;
  35232. rest = html.slice(textEnd);
  35233. }
  35234. text = html.substring(0, textEnd);
  35235. advance(textEnd);
  35236. }
  35237. if (textEnd < 0) {
  35238. text = html;
  35239. html = '';
  35240. }
  35241. if (options.chars && text) {
  35242. options.chars(text);
  35243. }
  35244. } else {
  35245. var endTagLength = 0;
  35246. var stackedTag = lastTag.toLowerCase();
  35247. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  35248. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  35249. endTagLength = endTag.length;
  35250. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  35251. text = text
  35252. .replace(/<!--([\s\S]*?)-->/g, '$1')
  35253. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  35254. }
  35255. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  35256. text = text.slice(1);
  35257. }
  35258. if (options.chars) {
  35259. options.chars(text);
  35260. }
  35261. return ''
  35262. });
  35263. index += html.length - rest$1.length;
  35264. html = rest$1;
  35265. parseEndTag(stackedTag, index - endTagLength, index);
  35266. }
  35267. if (html === last) {
  35268. options.chars && options.chars(html);
  35269. if ("development" !== 'production' && !stack.length && options.warn) {
  35270. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  35271. }
  35272. break
  35273. }
  35274. }
  35275. // Clean up any remaining tags
  35276. parseEndTag();
  35277. function advance (n) {
  35278. index += n;
  35279. html = html.substring(n);
  35280. }
  35281. function parseStartTag () {
  35282. var start = html.match(startTagOpen);
  35283. if (start) {
  35284. var match = {
  35285. tagName: start[1],
  35286. attrs: [],
  35287. start: index
  35288. };
  35289. advance(start[0].length);
  35290. var end, attr;
  35291. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  35292. advance(attr[0].length);
  35293. match.attrs.push(attr);
  35294. }
  35295. if (end) {
  35296. match.unarySlash = end[1];
  35297. advance(end[0].length);
  35298. match.end = index;
  35299. return match
  35300. }
  35301. }
  35302. }
  35303. function handleStartTag (match) {
  35304. var tagName = match.tagName;
  35305. var unarySlash = match.unarySlash;
  35306. if (expectHTML) {
  35307. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  35308. parseEndTag(lastTag);
  35309. }
  35310. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  35311. parseEndTag(tagName);
  35312. }
  35313. }
  35314. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  35315. var l = match.attrs.length;
  35316. var attrs = new Array(l);
  35317. for (var i = 0; i < l; i++) {
  35318. var args = match.attrs[i];
  35319. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  35320. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  35321. if (args[3] === '') { delete args[3]; }
  35322. if (args[4] === '') { delete args[4]; }
  35323. if (args[5] === '') { delete args[5]; }
  35324. }
  35325. var value = args[3] || args[4] || args[5] || '';
  35326. attrs[i] = {
  35327. name: args[1],
  35328. value: decodeAttr(
  35329. value,
  35330. options.shouldDecodeNewlines
  35331. )
  35332. };
  35333. }
  35334. if (!unary) {
  35335. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  35336. lastTag = tagName;
  35337. }
  35338. if (options.start) {
  35339. options.start(tagName, attrs, unary, match.start, match.end);
  35340. }
  35341. }
  35342. function parseEndTag (tagName, start, end) {
  35343. var pos, lowerCasedTagName;
  35344. if (start == null) { start = index; }
  35345. if (end == null) { end = index; }
  35346. if (tagName) {
  35347. lowerCasedTagName = tagName.toLowerCase();
  35348. }
  35349. // Find the closest opened tag of the same type
  35350. if (tagName) {
  35351. for (pos = stack.length - 1; pos >= 0; pos--) {
  35352. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  35353. break
  35354. }
  35355. }
  35356. } else {
  35357. // If no tag name is provided, clean shop
  35358. pos = 0;
  35359. }
  35360. if (pos >= 0) {
  35361. // Close all the open elements, up the stack
  35362. for (var i = stack.length - 1; i >= pos; i--) {
  35363. if ("development" !== 'production' &&
  35364. (i > pos || !tagName) &&
  35365. options.warn
  35366. ) {
  35367. options.warn(
  35368. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  35369. );
  35370. }
  35371. if (options.end) {
  35372. options.end(stack[i].tag, start, end);
  35373. }
  35374. }
  35375. // Remove the open elements from the stack
  35376. stack.length = pos;
  35377. lastTag = pos && stack[pos - 1].tag;
  35378. } else if (lowerCasedTagName === 'br') {
  35379. if (options.start) {
  35380. options.start(tagName, [], true, start, end);
  35381. }
  35382. } else if (lowerCasedTagName === 'p') {
  35383. if (options.start) {
  35384. options.start(tagName, [], false, start, end);
  35385. }
  35386. if (options.end) {
  35387. options.end(tagName, start, end);
  35388. }
  35389. }
  35390. }
  35391. }
  35392. /* */
  35393. var onRE = /^@|^v-on:/;
  35394. var dirRE = /^v-|^@|^:/;
  35395. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  35396. var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
  35397. var argRE = /:(.*)$/;
  35398. var bindRE = /^:|^v-bind:/;
  35399. var modifierRE = /\.[^.]+/g;
  35400. var decodeHTMLCached = cached(he.decode);
  35401. // configurable state
  35402. var warn$2;
  35403. var delimiters;
  35404. var transforms;
  35405. var preTransforms;
  35406. var postTransforms;
  35407. var platformIsPreTag;
  35408. var platformMustUseProp;
  35409. var platformGetTagNamespace;
  35410. /**
  35411. * Convert HTML string to AST.
  35412. */
  35413. function parse (
  35414. template,
  35415. options
  35416. ) {
  35417. warn$2 = options.warn || baseWarn;
  35418. platformIsPreTag = options.isPreTag || no;
  35419. platformMustUseProp = options.mustUseProp || no;
  35420. platformGetTagNamespace = options.getTagNamespace || no;
  35421. transforms = pluckModuleFunction(options.modules, 'transformNode');
  35422. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  35423. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  35424. delimiters = options.delimiters;
  35425. var stack = [];
  35426. var preserveWhitespace = options.preserveWhitespace !== false;
  35427. var root;
  35428. var currentParent;
  35429. var inVPre = false;
  35430. var inPre = false;
  35431. var warned = false;
  35432. function warnOnce (msg) {
  35433. if (!warned) {
  35434. warned = true;
  35435. warn$2(msg);
  35436. }
  35437. }
  35438. function endPre (element) {
  35439. // check pre state
  35440. if (element.pre) {
  35441. inVPre = false;
  35442. }
  35443. if (platformIsPreTag(element.tag)) {
  35444. inPre = false;
  35445. }
  35446. }
  35447. parseHTML(template, {
  35448. warn: warn$2,
  35449. expectHTML: options.expectHTML,
  35450. isUnaryTag: options.isUnaryTag,
  35451. canBeLeftOpenTag: options.canBeLeftOpenTag,
  35452. shouldDecodeNewlines: options.shouldDecodeNewlines,
  35453. shouldKeepComment: options.comments,
  35454. start: function start (tag, attrs, unary) {
  35455. // check namespace.
  35456. // inherit parent ns if there is one
  35457. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  35458. // handle IE svg bug
  35459. /* istanbul ignore if */
  35460. if (isIE && ns === 'svg') {
  35461. attrs = guardIESVGBug(attrs);
  35462. }
  35463. var element = {
  35464. type: 1,
  35465. tag: tag,
  35466. attrsList: attrs,
  35467. attrsMap: makeAttrsMap(attrs),
  35468. parent: currentParent,
  35469. children: []
  35470. };
  35471. if (ns) {
  35472. element.ns = ns;
  35473. }
  35474. if (isForbiddenTag(element) && !isServerRendering()) {
  35475. element.forbidden = true;
  35476. "development" !== 'production' && warn$2(
  35477. 'Templates should only be responsible for mapping the state to the ' +
  35478. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  35479. "<" + tag + ">" + ', as they will not be parsed.'
  35480. );
  35481. }
  35482. // apply pre-transforms
  35483. for (var i = 0; i < preTransforms.length; i++) {
  35484. preTransforms[i](element, options);
  35485. }
  35486. if (!inVPre) {
  35487. processPre(element);
  35488. if (element.pre) {
  35489. inVPre = true;
  35490. }
  35491. }
  35492. if (platformIsPreTag(element.tag)) {
  35493. inPre = true;
  35494. }
  35495. if (inVPre) {
  35496. processRawAttrs(element);
  35497. } else {
  35498. processFor(element);
  35499. processIf(element);
  35500. processOnce(element);
  35501. processKey(element);
  35502. // determine whether this is a plain element after
  35503. // removing structural attributes
  35504. element.plain = !element.key && !attrs.length;
  35505. processRef(element);
  35506. processSlot(element);
  35507. processComponent(element);
  35508. for (var i$1 = 0; i$1 < transforms.length; i$1++) {
  35509. transforms[i$1](element, options);
  35510. }
  35511. processAttrs(element);
  35512. }
  35513. function checkRootConstraints (el) {
  35514. if (true) {
  35515. if (el.tag === 'slot' || el.tag === 'template') {
  35516. warnOnce(
  35517. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  35518. 'contain multiple nodes.'
  35519. );
  35520. }
  35521. if (el.attrsMap.hasOwnProperty('v-for')) {
  35522. warnOnce(
  35523. 'Cannot use v-for on stateful component root element because ' +
  35524. 'it renders multiple elements.'
  35525. );
  35526. }
  35527. }
  35528. }
  35529. // tree management
  35530. if (!root) {
  35531. root = element;
  35532. checkRootConstraints(root);
  35533. } else if (!stack.length) {
  35534. // allow root elements with v-if, v-else-if and v-else
  35535. if (root.if && (element.elseif || element.else)) {
  35536. checkRootConstraints(element);
  35537. addIfCondition(root, {
  35538. exp: element.elseif,
  35539. block: element
  35540. });
  35541. } else if (true) {
  35542. warnOnce(
  35543. "Component template should contain exactly one root element. " +
  35544. "If you are using v-if on multiple elements, " +
  35545. "use v-else-if to chain them instead."
  35546. );
  35547. }
  35548. }
  35549. if (currentParent && !element.forbidden) {
  35550. if (element.elseif || element.else) {
  35551. processIfConditions(element, currentParent);
  35552. } else if (element.slotScope) { // scoped slot
  35553. currentParent.plain = false;
  35554. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  35555. } else {
  35556. currentParent.children.push(element);
  35557. element.parent = currentParent;
  35558. }
  35559. }
  35560. if (!unary) {
  35561. currentParent = element;
  35562. stack.push(element);
  35563. } else {
  35564. endPre(element);
  35565. }
  35566. // apply post-transforms
  35567. for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
  35568. postTransforms[i$2](element, options);
  35569. }
  35570. },
  35571. end: function end () {
  35572. // remove trailing whitespace
  35573. var element = stack[stack.length - 1];
  35574. var lastNode = element.children[element.children.length - 1];
  35575. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  35576. element.children.pop();
  35577. }
  35578. // pop stack
  35579. stack.length -= 1;
  35580. currentParent = stack[stack.length - 1];
  35581. endPre(element);
  35582. },
  35583. chars: function chars (text) {
  35584. if (!currentParent) {
  35585. if (true) {
  35586. if (text === template) {
  35587. warnOnce(
  35588. 'Component template requires a root element, rather than just text.'
  35589. );
  35590. } else if ((text = text.trim())) {
  35591. warnOnce(
  35592. ("text \"" + text + "\" outside root element will be ignored.")
  35593. );
  35594. }
  35595. }
  35596. return
  35597. }
  35598. // IE textarea placeholder bug
  35599. /* istanbul ignore if */
  35600. if (isIE &&
  35601. currentParent.tag === 'textarea' &&
  35602. currentParent.attrsMap.placeholder === text
  35603. ) {
  35604. return
  35605. }
  35606. var children = currentParent.children;
  35607. text = inPre || text.trim()
  35608. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  35609. // only preserve whitespace if its not right after a starting tag
  35610. : preserveWhitespace && children.length ? ' ' : '';
  35611. if (text) {
  35612. var expression;
  35613. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  35614. children.push({
  35615. type: 2,
  35616. expression: expression,
  35617. text: text
  35618. });
  35619. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  35620. children.push({
  35621. type: 3,
  35622. text: text
  35623. });
  35624. }
  35625. }
  35626. },
  35627. comment: function comment (text) {
  35628. currentParent.children.push({
  35629. type: 3,
  35630. text: text,
  35631. isComment: true
  35632. });
  35633. }
  35634. });
  35635. return root
  35636. }
  35637. function processPre (el) {
  35638. if (getAndRemoveAttr(el, 'v-pre') != null) {
  35639. el.pre = true;
  35640. }
  35641. }
  35642. function processRawAttrs (el) {
  35643. var l = el.attrsList.length;
  35644. if (l) {
  35645. var attrs = el.attrs = new Array(l);
  35646. for (var i = 0; i < l; i++) {
  35647. attrs[i] = {
  35648. name: el.attrsList[i].name,
  35649. value: JSON.stringify(el.attrsList[i].value)
  35650. };
  35651. }
  35652. } else if (!el.pre) {
  35653. // non root node in pre blocks with no attributes
  35654. el.plain = true;
  35655. }
  35656. }
  35657. function processKey (el) {
  35658. var exp = getBindingAttr(el, 'key');
  35659. if (exp) {
  35660. if ("development" !== 'production' && el.tag === 'template') {
  35661. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  35662. }
  35663. el.key = exp;
  35664. }
  35665. }
  35666. function processRef (el) {
  35667. var ref = getBindingAttr(el, 'ref');
  35668. if (ref) {
  35669. el.ref = ref;
  35670. el.refInFor = checkInFor(el);
  35671. }
  35672. }
  35673. function processFor (el) {
  35674. var exp;
  35675. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  35676. var inMatch = exp.match(forAliasRE);
  35677. if (!inMatch) {
  35678. "development" !== 'production' && warn$2(
  35679. ("Invalid v-for expression: " + exp)
  35680. );
  35681. return
  35682. }
  35683. el.for = inMatch[2].trim();
  35684. var alias = inMatch[1].trim();
  35685. var iteratorMatch = alias.match(forIteratorRE);
  35686. if (iteratorMatch) {
  35687. el.alias = iteratorMatch[1].trim();
  35688. el.iterator1 = iteratorMatch[2].trim();
  35689. if (iteratorMatch[3]) {
  35690. el.iterator2 = iteratorMatch[3].trim();
  35691. }
  35692. } else {
  35693. el.alias = alias;
  35694. }
  35695. }
  35696. }
  35697. function processIf (el) {
  35698. var exp = getAndRemoveAttr(el, 'v-if');
  35699. if (exp) {
  35700. el.if = exp;
  35701. addIfCondition(el, {
  35702. exp: exp,
  35703. block: el
  35704. });
  35705. } else {
  35706. if (getAndRemoveAttr(el, 'v-else') != null) {
  35707. el.else = true;
  35708. }
  35709. var elseif = getAndRemoveAttr(el, 'v-else-if');
  35710. if (elseif) {
  35711. el.elseif = elseif;
  35712. }
  35713. }
  35714. }
  35715. function processIfConditions (el, parent) {
  35716. var prev = findPrevElement(parent.children);
  35717. if (prev && prev.if) {
  35718. addIfCondition(prev, {
  35719. exp: el.elseif,
  35720. block: el
  35721. });
  35722. } else if (true) {
  35723. warn$2(
  35724. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  35725. "used on element <" + (el.tag) + "> without corresponding v-if."
  35726. );
  35727. }
  35728. }
  35729. function findPrevElement (children) {
  35730. var i = children.length;
  35731. while (i--) {
  35732. if (children[i].type === 1) {
  35733. return children[i]
  35734. } else {
  35735. if ("development" !== 'production' && children[i].text !== ' ') {
  35736. warn$2(
  35737. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  35738. "will be ignored."
  35739. );
  35740. }
  35741. children.pop();
  35742. }
  35743. }
  35744. }
  35745. function addIfCondition (el, condition) {
  35746. if (!el.ifConditions) {
  35747. el.ifConditions = [];
  35748. }
  35749. el.ifConditions.push(condition);
  35750. }
  35751. function processOnce (el) {
  35752. var once$$1 = getAndRemoveAttr(el, 'v-once');
  35753. if (once$$1 != null) {
  35754. el.once = true;
  35755. }
  35756. }
  35757. function processSlot (el) {
  35758. if (el.tag === 'slot') {
  35759. el.slotName = getBindingAttr(el, 'name');
  35760. if ("development" !== 'production' && el.key) {
  35761. warn$2(
  35762. "`key` does not work on <slot> because slots are abstract outlets " +
  35763. "and can possibly expand into multiple elements. " +
  35764. "Use the key on a wrapping element instead."
  35765. );
  35766. }
  35767. } else {
  35768. var slotTarget = getBindingAttr(el, 'slot');
  35769. if (slotTarget) {
  35770. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  35771. }
  35772. if (el.tag === 'template') {
  35773. el.slotScope = getAndRemoveAttr(el, 'scope');
  35774. }
  35775. }
  35776. }
  35777. function processComponent (el) {
  35778. var binding;
  35779. if ((binding = getBindingAttr(el, 'is'))) {
  35780. el.component = binding;
  35781. }
  35782. if (getAndRemoveAttr(el, 'inline-template') != null) {
  35783. el.inlineTemplate = true;
  35784. }
  35785. }
  35786. function processAttrs (el) {
  35787. var list = el.attrsList;
  35788. var i, l, name, rawName, value, modifiers, isProp;
  35789. for (i = 0, l = list.length; i < l; i++) {
  35790. name = rawName = list[i].name;
  35791. value = list[i].value;
  35792. if (dirRE.test(name)) {
  35793. // mark element as dynamic
  35794. el.hasBindings = true;
  35795. // modifiers
  35796. modifiers = parseModifiers(name);
  35797. if (modifiers) {
  35798. name = name.replace(modifierRE, '');
  35799. }
  35800. if (bindRE.test(name)) { // v-bind
  35801. name = name.replace(bindRE, '');
  35802. value = parseFilters(value);
  35803. isProp = false;
  35804. if (modifiers) {
  35805. if (modifiers.prop) {
  35806. isProp = true;
  35807. name = camelize(name);
  35808. if (name === 'innerHtml') { name = 'innerHTML'; }
  35809. }
  35810. if (modifiers.camel) {
  35811. name = camelize(name);
  35812. }
  35813. if (modifiers.sync) {
  35814. addHandler(
  35815. el,
  35816. ("update:" + (camelize(name))),
  35817. genAssignmentCode(value, "$event")
  35818. );
  35819. }
  35820. }
  35821. if (isProp || (
  35822. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  35823. )) {
  35824. addProp(el, name, value);
  35825. } else {
  35826. addAttr(el, name, value);
  35827. }
  35828. } else if (onRE.test(name)) { // v-on
  35829. name = name.replace(onRE, '');
  35830. addHandler(el, name, value, modifiers, false, warn$2);
  35831. } else { // normal directives
  35832. name = name.replace(dirRE, '');
  35833. // parse arg
  35834. var argMatch = name.match(argRE);
  35835. var arg = argMatch && argMatch[1];
  35836. if (arg) {
  35837. name = name.slice(0, -(arg.length + 1));
  35838. }
  35839. addDirective(el, name, rawName, value, arg, modifiers);
  35840. if ("development" !== 'production' && name === 'model') {
  35841. checkForAliasModel(el, value);
  35842. }
  35843. }
  35844. } else {
  35845. // literal attribute
  35846. if (true) {
  35847. var expression = parseText(value, delimiters);
  35848. if (expression) {
  35849. warn$2(
  35850. name + "=\"" + value + "\": " +
  35851. 'Interpolation inside attributes has been removed. ' +
  35852. 'Use v-bind or the colon shorthand instead. For example, ' +
  35853. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  35854. );
  35855. }
  35856. }
  35857. addAttr(el, name, JSON.stringify(value));
  35858. }
  35859. }
  35860. }
  35861. function checkInFor (el) {
  35862. var parent = el;
  35863. while (parent) {
  35864. if (parent.for !== undefined) {
  35865. return true
  35866. }
  35867. parent = parent.parent;
  35868. }
  35869. return false
  35870. }
  35871. function parseModifiers (name) {
  35872. var match = name.match(modifierRE);
  35873. if (match) {
  35874. var ret = {};
  35875. match.forEach(function (m) { ret[m.slice(1)] = true; });
  35876. return ret
  35877. }
  35878. }
  35879. function makeAttrsMap (attrs) {
  35880. var map = {};
  35881. for (var i = 0, l = attrs.length; i < l; i++) {
  35882. if (
  35883. "development" !== 'production' &&
  35884. map[attrs[i].name] && !isIE && !isEdge
  35885. ) {
  35886. warn$2('duplicate attribute: ' + attrs[i].name);
  35887. }
  35888. map[attrs[i].name] = attrs[i].value;
  35889. }
  35890. return map
  35891. }
  35892. // for script (e.g. type="x/template") or style, do not decode content
  35893. function isTextTag (el) {
  35894. return el.tag === 'script' || el.tag === 'style'
  35895. }
  35896. function isForbiddenTag (el) {
  35897. return (
  35898. el.tag === 'style' ||
  35899. (el.tag === 'script' && (
  35900. !el.attrsMap.type ||
  35901. el.attrsMap.type === 'text/javascript'
  35902. ))
  35903. )
  35904. }
  35905. var ieNSBug = /^xmlns:NS\d+/;
  35906. var ieNSPrefix = /^NS\d+:/;
  35907. /* istanbul ignore next */
  35908. function guardIESVGBug (attrs) {
  35909. var res = [];
  35910. for (var i = 0; i < attrs.length; i++) {
  35911. var attr = attrs[i];
  35912. if (!ieNSBug.test(attr.name)) {
  35913. attr.name = attr.name.replace(ieNSPrefix, '');
  35914. res.push(attr);
  35915. }
  35916. }
  35917. return res
  35918. }
  35919. function checkForAliasModel (el, value) {
  35920. var _el = el;
  35921. while (_el) {
  35922. if (_el.for && _el.alias === value) {
  35923. warn$2(
  35924. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  35925. "You are binding v-model directly to a v-for iteration alias. " +
  35926. "This will not be able to modify the v-for source array because " +
  35927. "writing to the alias is like modifying a function local variable. " +
  35928. "Consider using an array of objects and use v-model on an object property instead."
  35929. );
  35930. }
  35931. _el = _el.parent;
  35932. }
  35933. }
  35934. /* */
  35935. var isStaticKey;
  35936. var isPlatformReservedTag;
  35937. var genStaticKeysCached = cached(genStaticKeys$1);
  35938. /**
  35939. * Goal of the optimizer: walk the generated template AST tree
  35940. * and detect sub-trees that are purely static, i.e. parts of
  35941. * the DOM that never needs to change.
  35942. *
  35943. * Once we detect these sub-trees, we can:
  35944. *
  35945. * 1. Hoist them into constants, so that we no longer need to
  35946. * create fresh nodes for them on each re-render;
  35947. * 2. Completely skip them in the patching process.
  35948. */
  35949. function optimize (root, options) {
  35950. if (!root) { return }
  35951. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  35952. isPlatformReservedTag = options.isReservedTag || no;
  35953. // first pass: mark all non-static nodes.
  35954. markStatic$1(root);
  35955. // second pass: mark static roots.
  35956. markStaticRoots(root, false);
  35957. }
  35958. function genStaticKeys$1 (keys) {
  35959. return makeMap(
  35960. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  35961. (keys ? ',' + keys : '')
  35962. )
  35963. }
  35964. function markStatic$1 (node) {
  35965. node.static = isStatic(node);
  35966. if (node.type === 1) {
  35967. // do not make component slot content static. this avoids
  35968. // 1. components not able to mutate slot nodes
  35969. // 2. static slot content fails for hot-reloading
  35970. if (
  35971. !isPlatformReservedTag(node.tag) &&
  35972. node.tag !== 'slot' &&
  35973. node.attrsMap['inline-template'] == null
  35974. ) {
  35975. return
  35976. }
  35977. for (var i = 0, l = node.children.length; i < l; i++) {
  35978. var child = node.children[i];
  35979. markStatic$1(child);
  35980. if (!child.static) {
  35981. node.static = false;
  35982. }
  35983. }
  35984. if (node.ifConditions) {
  35985. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  35986. var block = node.ifConditions[i$1].block;
  35987. markStatic$1(block);
  35988. if (!block.static) {
  35989. node.static = false;
  35990. }
  35991. }
  35992. }
  35993. }
  35994. }
  35995. function markStaticRoots (node, isInFor) {
  35996. if (node.type === 1) {
  35997. if (node.static || node.once) {
  35998. node.staticInFor = isInFor;
  35999. }
  36000. // For a node to qualify as a static root, it should have children that
  36001. // are not just static text. Otherwise the cost of hoisting out will
  36002. // outweigh the benefits and it's better off to just always render it fresh.
  36003. if (node.static && node.children.length && !(
  36004. node.children.length === 1 &&
  36005. node.children[0].type === 3
  36006. )) {
  36007. node.staticRoot = true;
  36008. return
  36009. } else {
  36010. node.staticRoot = false;
  36011. }
  36012. if (node.children) {
  36013. for (var i = 0, l = node.children.length; i < l; i++) {
  36014. markStaticRoots(node.children[i], isInFor || !!node.for);
  36015. }
  36016. }
  36017. if (node.ifConditions) {
  36018. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  36019. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  36020. }
  36021. }
  36022. }
  36023. }
  36024. function isStatic (node) {
  36025. if (node.type === 2) { // expression
  36026. return false
  36027. }
  36028. if (node.type === 3) { // text
  36029. return true
  36030. }
  36031. return !!(node.pre || (
  36032. !node.hasBindings && // no dynamic bindings
  36033. !node.if && !node.for && // not v-if or v-for or v-else
  36034. !isBuiltInTag(node.tag) && // not a built-in
  36035. isPlatformReservedTag(node.tag) && // not a component
  36036. !isDirectChildOfTemplateFor(node) &&
  36037. Object.keys(node).every(isStaticKey)
  36038. ))
  36039. }
  36040. function isDirectChildOfTemplateFor (node) {
  36041. while (node.parent) {
  36042. node = node.parent;
  36043. if (node.tag !== 'template') {
  36044. return false
  36045. }
  36046. if (node.for) {
  36047. return true
  36048. }
  36049. }
  36050. return false
  36051. }
  36052. /* */
  36053. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  36054. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  36055. // keyCode aliases
  36056. var keyCodes = {
  36057. esc: 27,
  36058. tab: 9,
  36059. enter: 13,
  36060. space: 32,
  36061. up: 38,
  36062. left: 37,
  36063. right: 39,
  36064. down: 40,
  36065. 'delete': [8, 46]
  36066. };
  36067. // #4868: modifiers that prevent the execution of the listener
  36068. // need to explicitly return null so that we can determine whether to remove
  36069. // the listener for .once
  36070. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  36071. var modifierCode = {
  36072. stop: '$event.stopPropagation();',
  36073. prevent: '$event.preventDefault();',
  36074. self: genGuard("$event.target !== $event.currentTarget"),
  36075. ctrl: genGuard("!$event.ctrlKey"),
  36076. shift: genGuard("!$event.shiftKey"),
  36077. alt: genGuard("!$event.altKey"),
  36078. meta: genGuard("!$event.metaKey"),
  36079. left: genGuard("'button' in $event && $event.button !== 0"),
  36080. middle: genGuard("'button' in $event && $event.button !== 1"),
  36081. right: genGuard("'button' in $event && $event.button !== 2")
  36082. };
  36083. function genHandlers (
  36084. events,
  36085. isNative,
  36086. warn
  36087. ) {
  36088. var res = isNative ? 'nativeOn:{' : 'on:{';
  36089. for (var name in events) {
  36090. var handler = events[name];
  36091. // #5330: warn click.right, since right clicks do not actually fire click events.
  36092. if ("development" !== 'production' &&
  36093. name === 'click' &&
  36094. handler && handler.modifiers && handler.modifiers.right
  36095. ) {
  36096. warn(
  36097. "Use \"contextmenu\" instead of \"click.right\" since right clicks " +
  36098. "do not actually fire \"click\" events."
  36099. );
  36100. }
  36101. res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
  36102. }
  36103. return res.slice(0, -1) + '}'
  36104. }
  36105. function genHandler (
  36106. name,
  36107. handler
  36108. ) {
  36109. if (!handler) {
  36110. return 'function(){}'
  36111. }
  36112. if (Array.isArray(handler)) {
  36113. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  36114. }
  36115. var isMethodPath = simplePathRE.test(handler.value);
  36116. var isFunctionExpression = fnExpRE.test(handler.value);
  36117. if (!handler.modifiers) {
  36118. return isMethodPath || isFunctionExpression
  36119. ? handler.value
  36120. : ("function($event){" + (handler.value) + "}") // inline statement
  36121. } else {
  36122. var code = '';
  36123. var genModifierCode = '';
  36124. var keys = [];
  36125. for (var key in handler.modifiers) {
  36126. if (modifierCode[key]) {
  36127. genModifierCode += modifierCode[key];
  36128. // left/right
  36129. if (keyCodes[key]) {
  36130. keys.push(key);
  36131. }
  36132. } else {
  36133. keys.push(key);
  36134. }
  36135. }
  36136. if (keys.length) {
  36137. code += genKeyFilter(keys);
  36138. }
  36139. // Make sure modifiers like prevent and stop get executed after key filtering
  36140. if (genModifierCode) {
  36141. code += genModifierCode;
  36142. }
  36143. var handlerCode = isMethodPath
  36144. ? handler.value + '($event)'
  36145. : isFunctionExpression
  36146. ? ("(" + (handler.value) + ")($event)")
  36147. : handler.value;
  36148. return ("function($event){" + code + handlerCode + "}")
  36149. }
  36150. }
  36151. function genKeyFilter (keys) {
  36152. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  36153. }
  36154. function genFilterCode (key) {
  36155. var keyVal = parseInt(key, 10);
  36156. if (keyVal) {
  36157. return ("$event.keyCode!==" + keyVal)
  36158. }
  36159. var alias = keyCodes[key];
  36160. return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
  36161. }
  36162. /* */
  36163. function on (el, dir) {
  36164. if ("development" !== 'production' && dir.modifiers) {
  36165. warn("v-on without argument does not support modifiers.");
  36166. }
  36167. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  36168. }
  36169. /* */
  36170. function bind$1 (el, dir) {
  36171. el.wrapData = function (code) {
  36172. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  36173. };
  36174. }
  36175. /* */
  36176. var baseDirectives = {
  36177. on: on,
  36178. bind: bind$1,
  36179. cloak: noop
  36180. };
  36181. /* */
  36182. var CodegenState = function CodegenState (options) {
  36183. this.options = options;
  36184. this.warn = options.warn || baseWarn;
  36185. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  36186. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  36187. this.directives = extend(extend({}, baseDirectives), options.directives);
  36188. var isReservedTag = options.isReservedTag || no;
  36189. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  36190. this.onceId = 0;
  36191. this.staticRenderFns = [];
  36192. };
  36193. function generate (
  36194. ast,
  36195. options
  36196. ) {
  36197. var state = new CodegenState(options);
  36198. var code = ast ? genElement(ast, state) : '_c("div")';
  36199. return {
  36200. render: ("with(this){return " + code + "}"),
  36201. staticRenderFns: state.staticRenderFns
  36202. }
  36203. }
  36204. function genElement (el, state) {
  36205. if (el.staticRoot && !el.staticProcessed) {
  36206. return genStatic(el, state)
  36207. } else if (el.once && !el.onceProcessed) {
  36208. return genOnce(el, state)
  36209. } else if (el.for && !el.forProcessed) {
  36210. return genFor(el, state)
  36211. } else if (el.if && !el.ifProcessed) {
  36212. return genIf(el, state)
  36213. } else if (el.tag === 'template' && !el.slotTarget) {
  36214. return genChildren(el, state) || 'void 0'
  36215. } else if (el.tag === 'slot') {
  36216. return genSlot(el, state)
  36217. } else {
  36218. // component or element
  36219. var code;
  36220. if (el.component) {
  36221. code = genComponent(el.component, el, state);
  36222. } else {
  36223. var data = el.plain ? undefined : genData$2(el, state);
  36224. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36225. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  36226. }
  36227. // module transforms
  36228. for (var i = 0; i < state.transforms.length; i++) {
  36229. code = state.transforms[i](el, code);
  36230. }
  36231. return code
  36232. }
  36233. }
  36234. // hoist static sub-trees out
  36235. function genStatic (el, state) {
  36236. el.staticProcessed = true;
  36237. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  36238. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  36239. }
  36240. // v-once
  36241. function genOnce (el, state) {
  36242. el.onceProcessed = true;
  36243. if (el.if && !el.ifProcessed) {
  36244. return genIf(el, state)
  36245. } else if (el.staticInFor) {
  36246. var key = '';
  36247. var parent = el.parent;
  36248. while (parent) {
  36249. if (parent.for) {
  36250. key = parent.key;
  36251. break
  36252. }
  36253. parent = parent.parent;
  36254. }
  36255. if (!key) {
  36256. "development" !== 'production' && state.warn(
  36257. "v-once can only be used inside v-for that is keyed. "
  36258. );
  36259. return genElement(el, state)
  36260. }
  36261. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + (key ? ("," + key) : "") + ")")
  36262. } else {
  36263. return genStatic(el, state)
  36264. }
  36265. }
  36266. function genIf (
  36267. el,
  36268. state,
  36269. altGen,
  36270. altEmpty
  36271. ) {
  36272. el.ifProcessed = true; // avoid recursion
  36273. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  36274. }
  36275. function genIfConditions (
  36276. conditions,
  36277. state,
  36278. altGen,
  36279. altEmpty
  36280. ) {
  36281. if (!conditions.length) {
  36282. return altEmpty || '_e()'
  36283. }
  36284. var condition = conditions.shift();
  36285. if (condition.exp) {
  36286. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  36287. } else {
  36288. return ("" + (genTernaryExp(condition.block)))
  36289. }
  36290. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  36291. function genTernaryExp (el) {
  36292. return altGen
  36293. ? altGen(el, state)
  36294. : el.once
  36295. ? genOnce(el, state)
  36296. : genElement(el, state)
  36297. }
  36298. }
  36299. function genFor (
  36300. el,
  36301. state,
  36302. altGen,
  36303. altHelper
  36304. ) {
  36305. var exp = el.for;
  36306. var alias = el.alias;
  36307. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  36308. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  36309. if ("development" !== 'production' &&
  36310. state.maybeComponent(el) &&
  36311. el.tag !== 'slot' &&
  36312. el.tag !== 'template' &&
  36313. !el.key
  36314. ) {
  36315. state.warn(
  36316. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  36317. "v-for should have explicit keys. " +
  36318. "See https://vuejs.org/guide/list.html#key for more info.",
  36319. true /* tip */
  36320. );
  36321. }
  36322. el.forProcessed = true; // avoid recursion
  36323. return (altHelper || '_l') + "((" + exp + ")," +
  36324. "function(" + alias + iterator1 + iterator2 + "){" +
  36325. "return " + ((altGen || genElement)(el, state)) +
  36326. '})'
  36327. }
  36328. function genData$2 (el, state) {
  36329. var data = '{';
  36330. // directives first.
  36331. // directives may mutate the el's other properties before they are generated.
  36332. var dirs = genDirectives(el, state);
  36333. if (dirs) { data += dirs + ','; }
  36334. // key
  36335. if (el.key) {
  36336. data += "key:" + (el.key) + ",";
  36337. }
  36338. // ref
  36339. if (el.ref) {
  36340. data += "ref:" + (el.ref) + ",";
  36341. }
  36342. if (el.refInFor) {
  36343. data += "refInFor:true,";
  36344. }
  36345. // pre
  36346. if (el.pre) {
  36347. data += "pre:true,";
  36348. }
  36349. // record original tag name for components using "is" attribute
  36350. if (el.component) {
  36351. data += "tag:\"" + (el.tag) + "\",";
  36352. }
  36353. // module data generation functions
  36354. for (var i = 0; i < state.dataGenFns.length; i++) {
  36355. data += state.dataGenFns[i](el);
  36356. }
  36357. // attributes
  36358. if (el.attrs) {
  36359. data += "attrs:{" + (genProps(el.attrs)) + "},";
  36360. }
  36361. // DOM props
  36362. if (el.props) {
  36363. data += "domProps:{" + (genProps(el.props)) + "},";
  36364. }
  36365. // event handlers
  36366. if (el.events) {
  36367. data += (genHandlers(el.events, false, state.warn)) + ",";
  36368. }
  36369. if (el.nativeEvents) {
  36370. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  36371. }
  36372. // slot target
  36373. if (el.slotTarget) {
  36374. data += "slot:" + (el.slotTarget) + ",";
  36375. }
  36376. // scoped slots
  36377. if (el.scopedSlots) {
  36378. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  36379. }
  36380. // component v-model
  36381. if (el.model) {
  36382. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  36383. }
  36384. // inline-template
  36385. if (el.inlineTemplate) {
  36386. var inlineTemplate = genInlineTemplate(el, state);
  36387. if (inlineTemplate) {
  36388. data += inlineTemplate + ",";
  36389. }
  36390. }
  36391. data = data.replace(/,$/, '') + '}';
  36392. // v-bind data wrap
  36393. if (el.wrapData) {
  36394. data = el.wrapData(data);
  36395. }
  36396. // v-on data wrap
  36397. if (el.wrapListeners) {
  36398. data = el.wrapListeners(data);
  36399. }
  36400. return data
  36401. }
  36402. function genDirectives (el, state) {
  36403. var dirs = el.directives;
  36404. if (!dirs) { return }
  36405. var res = 'directives:[';
  36406. var hasRuntime = false;
  36407. var i, l, dir, needRuntime;
  36408. for (i = 0, l = dirs.length; i < l; i++) {
  36409. dir = dirs[i];
  36410. needRuntime = true;
  36411. var gen = state.directives[dir.name];
  36412. if (gen) {
  36413. // compile-time directive that manipulates AST.
  36414. // returns true if it also needs a runtime counterpart.
  36415. needRuntime = !!gen(el, dir, state.warn);
  36416. }
  36417. if (needRuntime) {
  36418. hasRuntime = true;
  36419. 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))) : '') + "},";
  36420. }
  36421. }
  36422. if (hasRuntime) {
  36423. return res.slice(0, -1) + ']'
  36424. }
  36425. }
  36426. function genInlineTemplate (el, state) {
  36427. var ast = el.children[0];
  36428. if ("development" !== 'production' && (
  36429. el.children.length > 1 || ast.type !== 1
  36430. )) {
  36431. state.warn('Inline-template components must have exactly one child element.');
  36432. }
  36433. if (ast.type === 1) {
  36434. var inlineRenderFns = generate(ast, state.options);
  36435. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  36436. }
  36437. }
  36438. function genScopedSlots (
  36439. slots,
  36440. state
  36441. ) {
  36442. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  36443. return genScopedSlot(key, slots[key], state)
  36444. }).join(',')) + "])")
  36445. }
  36446. function genScopedSlot (
  36447. key,
  36448. el,
  36449. state
  36450. ) {
  36451. if (el.for && !el.forProcessed) {
  36452. return genForScopedSlot(key, el, state)
  36453. }
  36454. return "{key:" + key + ",fn:function(" + (String(el.attrsMap.scope)) + "){" +
  36455. "return " + (el.tag === 'template'
  36456. ? genChildren(el, state) || 'void 0'
  36457. : genElement(el, state)) + "}}"
  36458. }
  36459. function genForScopedSlot (
  36460. key,
  36461. el,
  36462. state
  36463. ) {
  36464. var exp = el.for;
  36465. var alias = el.alias;
  36466. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  36467. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  36468. el.forProcessed = true; // avoid recursion
  36469. return "_l((" + exp + ")," +
  36470. "function(" + alias + iterator1 + iterator2 + "){" +
  36471. "return " + (genScopedSlot(key, el, state)) +
  36472. '})'
  36473. }
  36474. function genChildren (
  36475. el,
  36476. state,
  36477. checkSkip,
  36478. altGenElement,
  36479. altGenNode
  36480. ) {
  36481. var children = el.children;
  36482. if (children.length) {
  36483. var el$1 = children[0];
  36484. // optimize single v-for
  36485. if (children.length === 1 &&
  36486. el$1.for &&
  36487. el$1.tag !== 'template' &&
  36488. el$1.tag !== 'slot'
  36489. ) {
  36490. return (altGenElement || genElement)(el$1, state)
  36491. }
  36492. var normalizationType = checkSkip
  36493. ? getNormalizationType(children, state.maybeComponent)
  36494. : 0;
  36495. var gen = altGenNode || genNode;
  36496. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  36497. }
  36498. }
  36499. // determine the normalization needed for the children array.
  36500. // 0: no normalization needed
  36501. // 1: simple normalization needed (possible 1-level deep nested array)
  36502. // 2: full normalization needed
  36503. function getNormalizationType (
  36504. children,
  36505. maybeComponent
  36506. ) {
  36507. var res = 0;
  36508. for (var i = 0; i < children.length; i++) {
  36509. var el = children[i];
  36510. if (el.type !== 1) {
  36511. continue
  36512. }
  36513. if (needsNormalization(el) ||
  36514. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  36515. res = 2;
  36516. break
  36517. }
  36518. if (maybeComponent(el) ||
  36519. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  36520. res = 1;
  36521. }
  36522. }
  36523. return res
  36524. }
  36525. function needsNormalization (el) {
  36526. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  36527. }
  36528. function genNode (node, state) {
  36529. if (node.type === 1) {
  36530. return genElement(node, state)
  36531. } if (node.type === 3 && node.isComment) {
  36532. return genComment(node)
  36533. } else {
  36534. return genText(node)
  36535. }
  36536. }
  36537. function genText (text) {
  36538. return ("_v(" + (text.type === 2
  36539. ? text.expression // no need for () because already wrapped in _s()
  36540. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  36541. }
  36542. function genComment (comment) {
  36543. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  36544. }
  36545. function genSlot (el, state) {
  36546. var slotName = el.slotName || '"default"';
  36547. var children = genChildren(el, state);
  36548. var res = "_t(" + slotName + (children ? ("," + children) : '');
  36549. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  36550. var bind$$1 = el.attrsMap['v-bind'];
  36551. if ((attrs || bind$$1) && !children) {
  36552. res += ",null";
  36553. }
  36554. if (attrs) {
  36555. res += "," + attrs;
  36556. }
  36557. if (bind$$1) {
  36558. res += (attrs ? '' : ',null') + "," + bind$$1;
  36559. }
  36560. return res + ')'
  36561. }
  36562. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  36563. function genComponent (
  36564. componentName,
  36565. el,
  36566. state
  36567. ) {
  36568. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36569. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  36570. }
  36571. function genProps (props) {
  36572. var res = '';
  36573. for (var i = 0; i < props.length; i++) {
  36574. var prop = props[i];
  36575. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  36576. }
  36577. return res.slice(0, -1)
  36578. }
  36579. // #3895, #4268
  36580. function transformSpecialNewlines (text) {
  36581. return text
  36582. .replace(/\u2028/g, '\\u2028')
  36583. .replace(/\u2029/g, '\\u2029')
  36584. }
  36585. /* */
  36586. // these keywords should not appear inside expressions, but operators like
  36587. // typeof, instanceof and in are allowed
  36588. var prohibitedKeywordRE = new RegExp('\\b' + (
  36589. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  36590. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  36591. 'extends,finally,continue,debugger,function,arguments'
  36592. ).split(',').join('\\b|\\b') + '\\b');
  36593. // these unary operators should not be used as property/method names
  36594. var unaryOperatorsRE = new RegExp('\\b' + (
  36595. 'delete,typeof,void'
  36596. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  36597. // check valid identifier for v-for
  36598. var identRE = /[A-Za-z_$][\w$]*/;
  36599. // strip strings in expressions
  36600. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  36601. // detect problematic expressions in a template
  36602. function detectErrors (ast) {
  36603. var errors = [];
  36604. if (ast) {
  36605. checkNode(ast, errors);
  36606. }
  36607. return errors
  36608. }
  36609. function checkNode (node, errors) {
  36610. if (node.type === 1) {
  36611. for (var name in node.attrsMap) {
  36612. if (dirRE.test(name)) {
  36613. var value = node.attrsMap[name];
  36614. if (value) {
  36615. if (name === 'v-for') {
  36616. checkFor(node, ("v-for=\"" + value + "\""), errors);
  36617. } else if (onRE.test(name)) {
  36618. checkEvent(value, (name + "=\"" + value + "\""), errors);
  36619. } else {
  36620. checkExpression(value, (name + "=\"" + value + "\""), errors);
  36621. }
  36622. }
  36623. }
  36624. }
  36625. if (node.children) {
  36626. for (var i = 0; i < node.children.length; i++) {
  36627. checkNode(node.children[i], errors);
  36628. }
  36629. }
  36630. } else if (node.type === 2) {
  36631. checkExpression(node.expression, node.text, errors);
  36632. }
  36633. }
  36634. function checkEvent (exp, text, errors) {
  36635. var stipped = exp.replace(stripStringRE, '');
  36636. var keywordMatch = stipped.match(unaryOperatorsRE);
  36637. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  36638. errors.push(
  36639. "avoid using JavaScript unary operator as property name: " +
  36640. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  36641. );
  36642. }
  36643. checkExpression(exp, text, errors);
  36644. }
  36645. function checkFor (node, text, errors) {
  36646. checkExpression(node.for || '', text, errors);
  36647. checkIdentifier(node.alias, 'v-for alias', text, errors);
  36648. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  36649. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  36650. }
  36651. function checkIdentifier (ident, type, text, errors) {
  36652. if (typeof ident === 'string' && !identRE.test(ident)) {
  36653. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  36654. }
  36655. }
  36656. function checkExpression (exp, text, errors) {
  36657. try {
  36658. new Function(("return " + exp));
  36659. } catch (e) {
  36660. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  36661. if (keywordMatch) {
  36662. errors.push(
  36663. "avoid using JavaScript keyword as property name: " +
  36664. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  36665. );
  36666. } else {
  36667. errors.push(("invalid expression: " + (text.trim())));
  36668. }
  36669. }
  36670. }
  36671. /* */
  36672. function createFunction (code, errors) {
  36673. try {
  36674. return new Function(code)
  36675. } catch (err) {
  36676. errors.push({ err: err, code: code });
  36677. return noop
  36678. }
  36679. }
  36680. function createCompileToFunctionFn (compile) {
  36681. var cache = Object.create(null);
  36682. return function compileToFunctions (
  36683. template,
  36684. options,
  36685. vm
  36686. ) {
  36687. options = options || {};
  36688. /* istanbul ignore if */
  36689. if (true) {
  36690. // detect possible CSP restriction
  36691. try {
  36692. new Function('return 1');
  36693. } catch (e) {
  36694. if (e.toString().match(/unsafe-eval|CSP/)) {
  36695. warn(
  36696. 'It seems you are using the standalone build of Vue.js in an ' +
  36697. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  36698. 'The template compiler cannot work in this environment. Consider ' +
  36699. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  36700. 'templates into render functions.'
  36701. );
  36702. }
  36703. }
  36704. }
  36705. // check cache
  36706. var key = options.delimiters
  36707. ? String(options.delimiters) + template
  36708. : template;
  36709. if (cache[key]) {
  36710. return cache[key]
  36711. }
  36712. // compile
  36713. var compiled = compile(template, options);
  36714. // check compilation errors/tips
  36715. if (true) {
  36716. if (compiled.errors && compiled.errors.length) {
  36717. warn(
  36718. "Error compiling template:\n\n" + template + "\n\n" +
  36719. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  36720. vm
  36721. );
  36722. }
  36723. if (compiled.tips && compiled.tips.length) {
  36724. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  36725. }
  36726. }
  36727. // turn code into functions
  36728. var res = {};
  36729. var fnGenErrors = [];
  36730. res.render = createFunction(compiled.render, fnGenErrors);
  36731. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  36732. return createFunction(code, fnGenErrors)
  36733. });
  36734. // check function generation errors.
  36735. // this should only happen if there is a bug in the compiler itself.
  36736. // mostly for codegen development use
  36737. /* istanbul ignore if */
  36738. if (true) {
  36739. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  36740. warn(
  36741. "Failed to generate render function:\n\n" +
  36742. fnGenErrors.map(function (ref) {
  36743. var err = ref.err;
  36744. var code = ref.code;
  36745. return ((err.toString()) + " in\n\n" + code + "\n");
  36746. }).join('\n'),
  36747. vm
  36748. );
  36749. }
  36750. }
  36751. return (cache[key] = res)
  36752. }
  36753. }
  36754. /* */
  36755. function createCompilerCreator (baseCompile) {
  36756. return function createCompiler (baseOptions) {
  36757. function compile (
  36758. template,
  36759. options
  36760. ) {
  36761. var finalOptions = Object.create(baseOptions);
  36762. var errors = [];
  36763. var tips = [];
  36764. finalOptions.warn = function (msg, tip) {
  36765. (tip ? tips : errors).push(msg);
  36766. };
  36767. if (options) {
  36768. // merge custom modules
  36769. if (options.modules) {
  36770. finalOptions.modules =
  36771. (baseOptions.modules || []).concat(options.modules);
  36772. }
  36773. // merge custom directives
  36774. if (options.directives) {
  36775. finalOptions.directives = extend(
  36776. Object.create(baseOptions.directives),
  36777. options.directives
  36778. );
  36779. }
  36780. // copy other options
  36781. for (var key in options) {
  36782. if (key !== 'modules' && key !== 'directives') {
  36783. finalOptions[key] = options[key];
  36784. }
  36785. }
  36786. }
  36787. var compiled = baseCompile(template, finalOptions);
  36788. if (true) {
  36789. errors.push.apply(errors, detectErrors(compiled.ast));
  36790. }
  36791. compiled.errors = errors;
  36792. compiled.tips = tips;
  36793. return compiled
  36794. }
  36795. return {
  36796. compile: compile,
  36797. compileToFunctions: createCompileToFunctionFn(compile)
  36798. }
  36799. }
  36800. }
  36801. /* */
  36802. // `createCompilerCreator` allows creating compilers that use alternative
  36803. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  36804. // Here we just export a default compiler using the default parts.
  36805. var createCompiler = createCompilerCreator(function baseCompile (
  36806. template,
  36807. options
  36808. ) {
  36809. var ast = parse(template.trim(), options);
  36810. optimize(ast, options);
  36811. var code = generate(ast, options);
  36812. return {
  36813. ast: ast,
  36814. render: code.render,
  36815. staticRenderFns: code.staticRenderFns
  36816. }
  36817. });
  36818. /* */
  36819. var ref$1 = createCompiler(baseOptions);
  36820. var compileToFunctions = ref$1.compileToFunctions;
  36821. /* */
  36822. var idToTemplate = cached(function (id) {
  36823. var el = query(id);
  36824. return el && el.innerHTML
  36825. });
  36826. var mount = Vue$3.prototype.$mount;
  36827. Vue$3.prototype.$mount = function (
  36828. el,
  36829. hydrating
  36830. ) {
  36831. el = el && query(el);
  36832. /* istanbul ignore if */
  36833. if (el === document.body || el === document.documentElement) {
  36834. "development" !== 'production' && warn(
  36835. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  36836. );
  36837. return this
  36838. }
  36839. var options = this.$options;
  36840. // resolve template/el and convert to render function
  36841. if (!options.render) {
  36842. var template = options.template;
  36843. if (template) {
  36844. if (typeof template === 'string') {
  36845. if (template.charAt(0) === '#') {
  36846. template = idToTemplate(template);
  36847. /* istanbul ignore if */
  36848. if ("development" !== 'production' && !template) {
  36849. warn(
  36850. ("Template element not found or is empty: " + (options.template)),
  36851. this
  36852. );
  36853. }
  36854. }
  36855. } else if (template.nodeType) {
  36856. template = template.innerHTML;
  36857. } else {
  36858. if (true) {
  36859. warn('invalid template option:' + template, this);
  36860. }
  36861. return this
  36862. }
  36863. } else if (el) {
  36864. template = getOuterHTML(el);
  36865. }
  36866. if (template) {
  36867. /* istanbul ignore if */
  36868. if ("development" !== 'production' && config.performance && mark) {
  36869. mark('compile');
  36870. }
  36871. var ref = compileToFunctions(template, {
  36872. shouldDecodeNewlines: shouldDecodeNewlines,
  36873. delimiters: options.delimiters,
  36874. comments: options.comments
  36875. }, this);
  36876. var render = ref.render;
  36877. var staticRenderFns = ref.staticRenderFns;
  36878. options.render = render;
  36879. options.staticRenderFns = staticRenderFns;
  36880. /* istanbul ignore if */
  36881. if ("development" !== 'production' && config.performance && mark) {
  36882. mark('compile end');
  36883. measure(((this._name) + " compile"), 'compile', 'compile end');
  36884. }
  36885. }
  36886. }
  36887. return mount.call(this, el, hydrating)
  36888. };
  36889. /**
  36890. * Get outerHTML of elements, taking care
  36891. * of SVG elements in IE as well.
  36892. */
  36893. function getOuterHTML (el) {
  36894. if (el.outerHTML) {
  36895. return el.outerHTML
  36896. } else {
  36897. var container = document.createElement('div');
  36898. container.appendChild(el.cloneNode(true));
  36899. return container.innerHTML
  36900. }
  36901. }
  36902. Vue$3.compile = compileToFunctions;
  36903. module.exports = Vue$3;
  36904. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
  36905. /***/ }),
  36906. /* 36 */
  36907. /***/ (function(module, exports, __webpack_require__) {
  36908. var disposed = false
  36909. var Component = __webpack_require__(37)(
  36910. /* script */
  36911. __webpack_require__(38),
  36912. /* template */
  36913. __webpack_require__(39),
  36914. /* styles */
  36915. null,
  36916. /* scopeId */
  36917. null,
  36918. /* moduleIdentifier (server only) */
  36919. null
  36920. )
  36921. Component.options.__file = "/Users/fgm/src/PHP/Laravel/blog/resources/assets/js/components/Example.vue"
  36922. if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key.substr(0, 2) !== "__"})) {console.error("named exports are not supported in *.vue files.")}
  36923. if (Component.options.functional) {console.error("[vue-loader] Example.vue: functional components are not supported with templates, they should use render functions.")}
  36924. /* hot reload */
  36925. if (false) {(function () {
  36926. var hotAPI = require("vue-hot-reload-api")
  36927. hotAPI.install(require("vue"), false)
  36928. if (!hotAPI.compatible) return
  36929. module.hot.accept()
  36930. if (!module.hot.data) {
  36931. hotAPI.createRecord("data-v-5e8d45e4", Component.options)
  36932. } else {
  36933. hotAPI.reload("data-v-5e8d45e4", Component.options)
  36934. }
  36935. module.hot.dispose(function (data) {
  36936. disposed = true
  36937. })
  36938. })()}
  36939. module.exports = Component.exports
  36940. /***/ }),
  36941. /* 37 */
  36942. /***/ (function(module, exports) {
  36943. /* globals __VUE_SSR_CONTEXT__ */
  36944. // this module is a runtime utility for cleaner component module output and will
  36945. // be included in the final webpack user bundle
  36946. module.exports = function normalizeComponent (
  36947. rawScriptExports,
  36948. compiledTemplate,
  36949. injectStyles,
  36950. scopeId,
  36951. moduleIdentifier /* server only */
  36952. ) {
  36953. var esModule
  36954. var scriptExports = rawScriptExports = rawScriptExports || {}
  36955. // ES6 modules interop
  36956. var type = typeof rawScriptExports.default
  36957. if (type === 'object' || type === 'function') {
  36958. esModule = rawScriptExports
  36959. scriptExports = rawScriptExports.default
  36960. }
  36961. // Vue.extend constructor export interop
  36962. var options = typeof scriptExports === 'function'
  36963. ? scriptExports.options
  36964. : scriptExports
  36965. // render functions
  36966. if (compiledTemplate) {
  36967. options.render = compiledTemplate.render
  36968. options.staticRenderFns = compiledTemplate.staticRenderFns
  36969. }
  36970. // scopedId
  36971. if (scopeId) {
  36972. options._scopeId = scopeId
  36973. }
  36974. var hook
  36975. if (moduleIdentifier) { // server build
  36976. hook = function (context) {
  36977. // 2.3 injection
  36978. context =
  36979. context || // cached call
  36980. (this.$vnode && this.$vnode.ssrContext) || // stateful
  36981. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  36982. // 2.2 with runInNewContext: true
  36983. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  36984. context = __VUE_SSR_CONTEXT__
  36985. }
  36986. // inject component styles
  36987. if (injectStyles) {
  36988. injectStyles.call(this, context)
  36989. }
  36990. // register component module identifier for async chunk inferrence
  36991. if (context && context._registeredComponents) {
  36992. context._registeredComponents.add(moduleIdentifier)
  36993. }
  36994. }
  36995. // used by ssr in case component is cached and beforeCreate
  36996. // never gets called
  36997. options._ssrRegister = hook
  36998. } else if (injectStyles) {
  36999. hook = injectStyles
  37000. }
  37001. if (hook) {
  37002. var functional = options.functional
  37003. var existing = functional
  37004. ? options.render
  37005. : options.beforeCreate
  37006. if (!functional) {
  37007. // inject component registration as beforeCreate hook
  37008. options.beforeCreate = existing
  37009. ? [].concat(existing, hook)
  37010. : [hook]
  37011. } else {
  37012. // register for functioal component in vue file
  37013. options.render = function renderWithStyleInjection (h, context) {
  37014. hook.call(context)
  37015. return existing(h, context)
  37016. }
  37017. }
  37018. }
  37019. return {
  37020. esModule: esModule,
  37021. exports: scriptExports,
  37022. options: options
  37023. }
  37024. }
  37025. /***/ }),
  37026. /* 38 */
  37027. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37028. "use strict";
  37029. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  37030. //
  37031. //
  37032. //
  37033. //
  37034. //
  37035. //
  37036. //
  37037. //
  37038. //
  37039. //
  37040. //
  37041. //
  37042. //
  37043. //
  37044. //
  37045. //
  37046. /* harmony default export */ __webpack_exports__["default"] = ({
  37047. mounted: function mounted() {
  37048. console.log('Component mounted.');
  37049. }
  37050. });
  37051. /***/ }),
  37052. /* 39 */
  37053. /***/ (function(module, exports, __webpack_require__) {
  37054. module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  37055. return _vm._m(0)
  37056. },staticRenderFns: [function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  37057. return _c('div', {
  37058. staticClass: "container"
  37059. }, [_c('div', {
  37060. staticClass: "row"
  37061. }, [_c('div', {
  37062. staticClass: "col-md-8 col-md-offset-2"
  37063. }, [_c('div', {
  37064. staticClass: "panel panel-default"
  37065. }, [_c('div', {
  37066. staticClass: "panel-heading"
  37067. }, [_vm._v("Example Component")]), _vm._v(" "), _c('div', {
  37068. staticClass: "panel-body"
  37069. }, [_vm._v("\n I'm an example component!\n ")])])])])])
  37070. }]}
  37071. module.exports.render._withStripped = true
  37072. if (false) {
  37073. module.hot.accept()
  37074. if (module.hot.data) {
  37075. require("vue-hot-reload-api").rerender("data-v-5e8d45e4", module.exports)
  37076. }
  37077. }
  37078. /***/ }),
  37079. /* 40 */
  37080. /***/ (function(module, exports) {
  37081. // removed by extract-text-webpack-plugin
  37082. /***/ })
  37083. /******/ ]);