app.js 1.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120
  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 = 9);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69. "use strict";
  70. var bind = __webpack_require__(4);
  71. var isBuffer = __webpack_require__(21);
  72. /*global toString:true*/
  73. // utils is a library of generic helper functions non-specific to axios
  74. var toString = Object.prototype.toString;
  75. /**
  76. * Determine if a value is an Array
  77. *
  78. * @param {Object} val The value to test
  79. * @returns {boolean} True if value is an Array, otherwise false
  80. */
  81. function isArray(val) {
  82. return toString.call(val) === '[object Array]';
  83. }
  84. /**
  85. * Determine if a value is an ArrayBuffer
  86. *
  87. * @param {Object} val The value to test
  88. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  89. */
  90. function isArrayBuffer(val) {
  91. return toString.call(val) === '[object ArrayBuffer]';
  92. }
  93. /**
  94. * Determine if a value is a FormData
  95. *
  96. * @param {Object} val The value to test
  97. * @returns {boolean} True if value is an FormData, otherwise false
  98. */
  99. function isFormData(val) {
  100. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  101. }
  102. /**
  103. * Determine if a value is a view on an ArrayBuffer
  104. *
  105. * @param {Object} val The value to test
  106. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  107. */
  108. function isArrayBufferView(val) {
  109. var result;
  110. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  111. result = ArrayBuffer.isView(val);
  112. } else {
  113. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  114. }
  115. return result;
  116. }
  117. /**
  118. * Determine if a value is a String
  119. *
  120. * @param {Object} val The value to test
  121. * @returns {boolean} True if value is a String, otherwise false
  122. */
  123. function isString(val) {
  124. return typeof val === 'string';
  125. }
  126. /**
  127. * Determine if a value is a Number
  128. *
  129. * @param {Object} val The value to test
  130. * @returns {boolean} True if value is a Number, otherwise false
  131. */
  132. function isNumber(val) {
  133. return typeof val === 'number';
  134. }
  135. /**
  136. * Determine if a value is undefined
  137. *
  138. * @param {Object} val The value to test
  139. * @returns {boolean} True if the value is undefined, otherwise false
  140. */
  141. function isUndefined(val) {
  142. return typeof val === 'undefined';
  143. }
  144. /**
  145. * Determine if a value is an Object
  146. *
  147. * @param {Object} val The value to test
  148. * @returns {boolean} True if value is an Object, otherwise false
  149. */
  150. function isObject(val) {
  151. return val !== null && typeof val === 'object';
  152. }
  153. /**
  154. * Determine if a value is a Date
  155. *
  156. * @param {Object} val The value to test
  157. * @returns {boolean} True if value is a Date, otherwise false
  158. */
  159. function isDate(val) {
  160. return toString.call(val) === '[object Date]';
  161. }
  162. /**
  163. * Determine if a value is a File
  164. *
  165. * @param {Object} val The value to test
  166. * @returns {boolean} True if value is a File, otherwise false
  167. */
  168. function isFile(val) {
  169. return toString.call(val) === '[object File]';
  170. }
  171. /**
  172. * Determine if a value is a Blob
  173. *
  174. * @param {Object} val The value to test
  175. * @returns {boolean} True if value is a Blob, otherwise false
  176. */
  177. function isBlob(val) {
  178. return toString.call(val) === '[object Blob]';
  179. }
  180. /**
  181. * Determine if a value is a Function
  182. *
  183. * @param {Object} val The value to test
  184. * @returns {boolean} True if value is a Function, otherwise false
  185. */
  186. function isFunction(val) {
  187. return toString.call(val) === '[object Function]';
  188. }
  189. /**
  190. * Determine if a value is a Stream
  191. *
  192. * @param {Object} val The value to test
  193. * @returns {boolean} True if value is a Stream, otherwise false
  194. */
  195. function isStream(val) {
  196. return isObject(val) && isFunction(val.pipe);
  197. }
  198. /**
  199. * Determine if a value is a URLSearchParams object
  200. *
  201. * @param {Object} val The value to test
  202. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  203. */
  204. function isURLSearchParams(val) {
  205. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  206. }
  207. /**
  208. * Trim excess whitespace off the beginning and end of a string
  209. *
  210. * @param {String} str The String to trim
  211. * @returns {String} The String freed of excess whitespace
  212. */
  213. function trim(str) {
  214. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  215. }
  216. /**
  217. * Determine if we're running in a standard browser environment
  218. *
  219. * This allows axios to run in a web worker, and react-native.
  220. * Both environments support XMLHttpRequest, but not fully standard globals.
  221. *
  222. * web workers:
  223. * typeof window -> undefined
  224. * typeof document -> undefined
  225. *
  226. * react-native:
  227. * navigator.product -> 'ReactNative'
  228. */
  229. function isStandardBrowserEnv() {
  230. if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
  231. return false;
  232. }
  233. return (
  234. typeof window !== 'undefined' &&
  235. typeof document !== 'undefined'
  236. );
  237. }
  238. /**
  239. * Iterate over an Array or an Object invoking a function for each item.
  240. *
  241. * If `obj` is an Array callback will be called passing
  242. * the value, index, and complete array for each item.
  243. *
  244. * If 'obj' is an Object callback will be called passing
  245. * the value, key, and complete object for each property.
  246. *
  247. * @param {Object|Array} obj The object to iterate
  248. * @param {Function} fn The callback to invoke for each item
  249. */
  250. function forEach(obj, fn) {
  251. // Don't bother if no value provided
  252. if (obj === null || typeof obj === 'undefined') {
  253. return;
  254. }
  255. // Force an array if not already something iterable
  256. if (typeof obj !== 'object' && !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) {
  348. var g;
  349. // This works in non-strict mode
  350. g = (function() {
  351. return this;
  352. })();
  353. try {
  354. // This works if eval is allowed (see CSP)
  355. g = g || Function("return this")() || (1,eval)("this");
  356. } catch(e) {
  357. // This works if the window reference is available
  358. if(typeof window === "object")
  359. g = window;
  360. }
  361. // g can still be undefined, but nothing to do about it...
  362. // We return undefined, instead of nothing here, so it's
  363. // easier to handle this case. if(!global) { ...}
  364. module.exports = g;
  365. /***/ }),
  366. /* 2 */
  367. /***/ (function(module, exports, __webpack_require__) {
  368. "use strict";
  369. /* WEBPACK VAR INJECTION */(function(process) {
  370. var utils = __webpack_require__(0);
  371. var normalizeHeaderName = __webpack_require__(23);
  372. var DEFAULT_CONTENT_TYPE = {
  373. 'Content-Type': 'application/x-www-form-urlencoded'
  374. };
  375. function setContentTypeIfUnset(headers, value) {
  376. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  377. headers['Content-Type'] = value;
  378. }
  379. }
  380. function getDefaultAdapter() {
  381. var adapter;
  382. if (typeof XMLHttpRequest !== 'undefined') {
  383. // For browsers use XHR adapter
  384. adapter = __webpack_require__(5);
  385. } else if (typeof process !== 'undefined') {
  386. // For node use HTTP adapter
  387. adapter = __webpack_require__(5);
  388. }
  389. return adapter;
  390. }
  391. var defaults = {
  392. adapter: getDefaultAdapter(),
  393. transformRequest: [function transformRequest(data, headers) {
  394. normalizeHeaderName(headers, 'Content-Type');
  395. if (utils.isFormData(data) ||
  396. utils.isArrayBuffer(data) ||
  397. utils.isBuffer(data) ||
  398. utils.isStream(data) ||
  399. utils.isFile(data) ||
  400. utils.isBlob(data)
  401. ) {
  402. return data;
  403. }
  404. if (utils.isArrayBufferView(data)) {
  405. return data.buffer;
  406. }
  407. if (utils.isURLSearchParams(data)) {
  408. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  409. return data.toString();
  410. }
  411. if (utils.isObject(data)) {
  412. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  413. return JSON.stringify(data);
  414. }
  415. return data;
  416. }],
  417. transformResponse: [function transformResponse(data) {
  418. /*eslint no-param-reassign:0*/
  419. if (typeof data === 'string') {
  420. try {
  421. data = JSON.parse(data);
  422. } catch (e) { /* Ignore */ }
  423. }
  424. return data;
  425. }],
  426. timeout: 0,
  427. xsrfCookieName: 'XSRF-TOKEN',
  428. xsrfHeaderName: 'X-XSRF-TOKEN',
  429. maxContentLength: -1,
  430. validateStatus: function validateStatus(status) {
  431. return status >= 200 && status < 300;
  432. }
  433. };
  434. defaults.headers = {
  435. common: {
  436. 'Accept': 'application/json, text/plain, */*'
  437. }
  438. };
  439. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  440. defaults.headers[method] = {};
  441. });
  442. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  443. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  444. });
  445. module.exports = defaults;
  446. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  447. /***/ }),
  448. /* 3 */
  449. /***/ (function(module, exports) {
  450. // shim for using process in browser
  451. var process = module.exports = {};
  452. // cached from whatever global is present so that test runners that stub it
  453. // don't break things. But we need to wrap it in a try catch in case it is
  454. // wrapped in strict mode code which doesn't define any globals. It's inside a
  455. // function because try/catches deoptimize in certain engines.
  456. var cachedSetTimeout;
  457. var cachedClearTimeout;
  458. function defaultSetTimout() {
  459. throw new Error('setTimeout has not been defined');
  460. }
  461. function defaultClearTimeout () {
  462. throw new Error('clearTimeout has not been defined');
  463. }
  464. (function () {
  465. try {
  466. if (typeof setTimeout === 'function') {
  467. cachedSetTimeout = setTimeout;
  468. } else {
  469. cachedSetTimeout = defaultSetTimout;
  470. }
  471. } catch (e) {
  472. cachedSetTimeout = defaultSetTimout;
  473. }
  474. try {
  475. if (typeof clearTimeout === 'function') {
  476. cachedClearTimeout = clearTimeout;
  477. } else {
  478. cachedClearTimeout = defaultClearTimeout;
  479. }
  480. } catch (e) {
  481. cachedClearTimeout = defaultClearTimeout;
  482. }
  483. } ())
  484. function runTimeout(fun) {
  485. if (cachedSetTimeout === setTimeout) {
  486. //normal enviroments in sane situations
  487. return setTimeout(fun, 0);
  488. }
  489. // if setTimeout wasn't available but was latter defined
  490. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  491. cachedSetTimeout = setTimeout;
  492. return setTimeout(fun, 0);
  493. }
  494. try {
  495. // when when somebody has screwed with setTimeout but no I.E. maddness
  496. return cachedSetTimeout(fun, 0);
  497. } catch(e){
  498. try {
  499. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  500. return cachedSetTimeout.call(null, fun, 0);
  501. } catch(e){
  502. // 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
  503. return cachedSetTimeout.call(this, fun, 0);
  504. }
  505. }
  506. }
  507. function runClearTimeout(marker) {
  508. if (cachedClearTimeout === clearTimeout) {
  509. //normal enviroments in sane situations
  510. return clearTimeout(marker);
  511. }
  512. // if clearTimeout wasn't available but was latter defined
  513. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  514. cachedClearTimeout = clearTimeout;
  515. return clearTimeout(marker);
  516. }
  517. try {
  518. // when when somebody has screwed with setTimeout but no I.E. maddness
  519. return cachedClearTimeout(marker);
  520. } catch (e){
  521. try {
  522. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  523. return cachedClearTimeout.call(null, marker);
  524. } catch (e){
  525. // 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.
  526. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  527. return cachedClearTimeout.call(this, marker);
  528. }
  529. }
  530. }
  531. var queue = [];
  532. var draining = false;
  533. var currentQueue;
  534. var queueIndex = -1;
  535. function cleanUpNextTick() {
  536. if (!draining || !currentQueue) {
  537. return;
  538. }
  539. draining = false;
  540. if (currentQueue.length) {
  541. queue = currentQueue.concat(queue);
  542. } else {
  543. queueIndex = -1;
  544. }
  545. if (queue.length) {
  546. drainQueue();
  547. }
  548. }
  549. function drainQueue() {
  550. if (draining) {
  551. return;
  552. }
  553. var timeout = runTimeout(cleanUpNextTick);
  554. draining = true;
  555. var len = queue.length;
  556. while(len) {
  557. currentQueue = queue;
  558. queue = [];
  559. while (++queueIndex < len) {
  560. if (currentQueue) {
  561. currentQueue[queueIndex].run();
  562. }
  563. }
  564. queueIndex = -1;
  565. len = queue.length;
  566. }
  567. currentQueue = null;
  568. draining = false;
  569. runClearTimeout(timeout);
  570. }
  571. process.nextTick = function (fun) {
  572. var args = new Array(arguments.length - 1);
  573. if (arguments.length > 1) {
  574. for (var i = 1; i < arguments.length; i++) {
  575. args[i - 1] = arguments[i];
  576. }
  577. }
  578. queue.push(new Item(fun, args));
  579. if (queue.length === 1 && !draining) {
  580. runTimeout(drainQueue);
  581. }
  582. };
  583. // v8 likes predictible objects
  584. function Item(fun, array) {
  585. this.fun = fun;
  586. this.array = array;
  587. }
  588. Item.prototype.run = function () {
  589. this.fun.apply(null, this.array);
  590. };
  591. process.title = 'browser';
  592. process.browser = true;
  593. process.env = {};
  594. process.argv = [];
  595. process.version = ''; // empty string to avoid regexp issues
  596. process.versions = {};
  597. function noop() {}
  598. process.on = noop;
  599. process.addListener = noop;
  600. process.once = noop;
  601. process.off = noop;
  602. process.removeListener = noop;
  603. process.removeAllListeners = noop;
  604. process.emit = noop;
  605. process.prependListener = noop;
  606. process.prependOnceListener = noop;
  607. process.listeners = function (name) { return [] }
  608. process.binding = function (name) {
  609. throw new Error('process.binding is not supported');
  610. };
  611. process.cwd = function () { return '/' };
  612. process.chdir = function (dir) {
  613. throw new Error('process.chdir is not supported');
  614. };
  615. process.umask = function() { return 0; };
  616. /***/ }),
  617. /* 4 */
  618. /***/ (function(module, exports, __webpack_require__) {
  619. "use strict";
  620. module.exports = function bind(fn, thisArg) {
  621. return function wrap() {
  622. var args = new Array(arguments.length);
  623. for (var i = 0; i < args.length; i++) {
  624. args[i] = arguments[i];
  625. }
  626. return fn.apply(thisArg, args);
  627. };
  628. };
  629. /***/ }),
  630. /* 5 */
  631. /***/ (function(module, exports, __webpack_require__) {
  632. "use strict";
  633. var utils = __webpack_require__(0);
  634. var settle = __webpack_require__(24);
  635. var buildURL = __webpack_require__(26);
  636. var parseHeaders = __webpack_require__(27);
  637. var isURLSameOrigin = __webpack_require__(28);
  638. var createError = __webpack_require__(6);
  639. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(29);
  640. module.exports = function xhrAdapter(config) {
  641. return new Promise(function dispatchXhrRequest(resolve, reject) {
  642. var requestData = config.data;
  643. var requestHeaders = config.headers;
  644. if (utils.isFormData(requestData)) {
  645. delete requestHeaders['Content-Type']; // Let the browser set it
  646. }
  647. var request = new XMLHttpRequest();
  648. var loadEvent = 'onreadystatechange';
  649. var xDomain = false;
  650. // For IE 8/9 CORS support
  651. // Only supports POST and GET calls and doesn't returns the response headers.
  652. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  653. if ("development" !== 'test' &&
  654. typeof window !== 'undefined' &&
  655. window.XDomainRequest && !('withCredentials' in request) &&
  656. !isURLSameOrigin(config.url)) {
  657. request = new window.XDomainRequest();
  658. loadEvent = 'onload';
  659. xDomain = true;
  660. request.onprogress = function handleProgress() {};
  661. request.ontimeout = function handleTimeout() {};
  662. }
  663. // HTTP basic authentication
  664. if (config.auth) {
  665. var username = config.auth.username || '';
  666. var password = config.auth.password || '';
  667. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  668. }
  669. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  670. // Set the request timeout in MS
  671. request.timeout = config.timeout;
  672. // Listen for ready state
  673. request[loadEvent] = function handleLoad() {
  674. if (!request || (request.readyState !== 4 && !xDomain)) {
  675. return;
  676. }
  677. // The request errored out and we didn't get a response, this will be
  678. // handled by onerror instead
  679. // With one exception: request that using file: protocol, most browsers
  680. // will return status as 0 even though it's a successful request
  681. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  682. return;
  683. }
  684. // Prepare the response
  685. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  686. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  687. var response = {
  688. data: responseData,
  689. // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  690. status: request.status === 1223 ? 204 : request.status,
  691. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  692. headers: responseHeaders,
  693. config: config,
  694. request: request
  695. };
  696. settle(resolve, reject, response);
  697. // Clean up request
  698. request = null;
  699. };
  700. // Handle low level network errors
  701. request.onerror = function handleError() {
  702. // Real errors are hidden from us by the browser
  703. // onerror should only fire if it's a network error
  704. reject(createError('Network Error', config, null, request));
  705. // Clean up request
  706. request = null;
  707. };
  708. // Handle timeout
  709. request.ontimeout = function handleTimeout() {
  710. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
  711. request));
  712. // Clean up request
  713. request = null;
  714. };
  715. // Add xsrf header
  716. // This is only done if running in a standard browser environment.
  717. // Specifically not if we're in a web worker, or react-native.
  718. if (utils.isStandardBrowserEnv()) {
  719. var cookies = __webpack_require__(30);
  720. // Add xsrf header
  721. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  722. cookies.read(config.xsrfCookieName) :
  723. undefined;
  724. if (xsrfValue) {
  725. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  726. }
  727. }
  728. // Add headers to the request
  729. if ('setRequestHeader' in request) {
  730. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  731. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  732. // Remove Content-Type if data is undefined
  733. delete requestHeaders[key];
  734. } else {
  735. // Otherwise add header to the request
  736. request.setRequestHeader(key, val);
  737. }
  738. });
  739. }
  740. // Add withCredentials to request if needed
  741. if (config.withCredentials) {
  742. request.withCredentials = true;
  743. }
  744. // Add responseType to request if needed
  745. if (config.responseType) {
  746. try {
  747. request.responseType = config.responseType;
  748. } catch (e) {
  749. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  750. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  751. if (config.responseType !== 'json') {
  752. throw e;
  753. }
  754. }
  755. }
  756. // Handle progress if needed
  757. if (typeof config.onDownloadProgress === 'function') {
  758. request.addEventListener('progress', config.onDownloadProgress);
  759. }
  760. // Not all browsers support upload events
  761. if (typeof config.onUploadProgress === 'function' && request.upload) {
  762. request.upload.addEventListener('progress', config.onUploadProgress);
  763. }
  764. if (config.cancelToken) {
  765. // Handle cancellation
  766. config.cancelToken.promise.then(function onCanceled(cancel) {
  767. if (!request) {
  768. return;
  769. }
  770. request.abort();
  771. reject(cancel);
  772. // Clean up request
  773. request = null;
  774. });
  775. }
  776. if (requestData === undefined) {
  777. requestData = null;
  778. }
  779. // Send the request
  780. request.send(requestData);
  781. });
  782. };
  783. /***/ }),
  784. /* 6 */
  785. /***/ (function(module, exports, __webpack_require__) {
  786. "use strict";
  787. var enhanceError = __webpack_require__(25);
  788. /**
  789. * Create an Error with the specified message, config, error code, request and response.
  790. *
  791. * @param {string} message The error message.
  792. * @param {Object} config The config.
  793. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  794. * @param {Object} [request] The request.
  795. * @param {Object} [response] The response.
  796. * @returns {Error} The created error.
  797. */
  798. module.exports = function createError(message, config, code, request, response) {
  799. var error = new Error(message);
  800. return enhanceError(error, config, code, request, response);
  801. };
  802. /***/ }),
  803. /* 7 */
  804. /***/ (function(module, exports, __webpack_require__) {
  805. "use strict";
  806. module.exports = function isCancel(value) {
  807. return !!(value && value.__CANCEL__);
  808. };
  809. /***/ }),
  810. /* 8 */
  811. /***/ (function(module, exports, __webpack_require__) {
  812. "use strict";
  813. /**
  814. * A `Cancel` is an object that is thrown when an operation is canceled.
  815. *
  816. * @class
  817. * @param {string=} message The message.
  818. */
  819. function Cancel(message) {
  820. this.message = message;
  821. }
  822. Cancel.prototype.toString = function toString() {
  823. return 'Cancel' + (this.message ? ': ' + this.message : '');
  824. };
  825. Cancel.prototype.__CANCEL__ = true;
  826. module.exports = Cancel;
  827. /***/ }),
  828. /* 9 */
  829. /***/ (function(module, exports, __webpack_require__) {
  830. __webpack_require__(10);
  831. module.exports = __webpack_require__(42);
  832. /***/ }),
  833. /* 10 */
  834. /***/ (function(module, exports, __webpack_require__) {
  835. /**
  836. * First we will load all of this project's JavaScript dependencies which
  837. * includes Vue and other libraries. It is a great starting point when
  838. * building robust, powerful web applications using Vue and Laravel.
  839. */
  840. __webpack_require__(11);
  841. /**
  842. * Next, we will create a fresh Vue application instance and attach it to
  843. * the page. Then, you may begin adding components to this application
  844. * or customize the JavaScript scaffolding to fit your unique needs.
  845. */
  846. Vue.component('example', __webpack_require__(38));
  847. var app = new Vue({
  848. el: '#app'
  849. });
  850. /***/ }),
  851. /* 11 */
  852. /***/ (function(module, exports, __webpack_require__) {
  853. window._ = __webpack_require__(12);
  854. /**
  855. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  856. * for JavaScript based Bootstrap features such as modals and tabs. This
  857. * code may be modified to fit the specific needs of your application.
  858. */
  859. window.$ = window.jQuery = __webpack_require__(14);
  860. __webpack_require__(15);
  861. /**
  862. * Vue is a modern JavaScript library for building interactive web interfaces
  863. * using reactive data binding and reusable components. Vue's API is clean
  864. * and simple, leaving you to focus on building your next great project.
  865. */
  866. window.Vue = __webpack_require__(16);
  867. /**
  868. * We'll load the axios HTTP library which allows us to easily issue requests
  869. * to our Laravel back-end. This library automatically handles sending the
  870. * CSRF token as a header based on the value of the "XSRF" token cookie.
  871. */
  872. window.axios = __webpack_require__(19);
  873. window.axios.defaults.headers.common = {
  874. 'X-CSRF-TOKEN': window.Laravel.csrfToken,
  875. 'X-Requested-With': 'XMLHttpRequest'
  876. };
  877. /**
  878. * Echo exposes an expressive API for subscribing to channels and listening
  879. * for events that are broadcast by Laravel. Echo and event broadcasting
  880. * allows your team to easily build robust real-time web applications.
  881. */
  882. // import Echo from 'laravel-echo'
  883. // window.Pusher = require('pusher-js');
  884. // window.Echo = new Echo({
  885. // broadcaster: 'pusher',
  886. // key: 'your-pusher-key'
  887. // });
  888. /***/ }),
  889. /* 12 */
  890. /***/ (function(module, exports, __webpack_require__) {
  891. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  892. * @license
  893. * Lodash <https://lodash.com/>
  894. * Copyright JS Foundation and other contributors <https://js.foundation/>
  895. * Released under MIT license <https://lodash.com/license>
  896. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  897. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  898. */
  899. ;(function() {
  900. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  901. var undefined;
  902. /** Used as the semantic version number. */
  903. var VERSION = '4.17.5';
  904. /** Used as the size to enable large array optimizations. */
  905. var LARGE_ARRAY_SIZE = 200;
  906. /** Error message constants. */
  907. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  908. FUNC_ERROR_TEXT = 'Expected a function';
  909. /** Used to stand-in for `undefined` hash values. */
  910. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  911. /** Used as the maximum memoize cache size. */
  912. var MAX_MEMOIZE_SIZE = 500;
  913. /** Used as the internal argument placeholder. */
  914. var PLACEHOLDER = '__lodash_placeholder__';
  915. /** Used to compose bitmasks for cloning. */
  916. var CLONE_DEEP_FLAG = 1,
  917. CLONE_FLAT_FLAG = 2,
  918. CLONE_SYMBOLS_FLAG = 4;
  919. /** Used to compose bitmasks for value comparisons. */
  920. var COMPARE_PARTIAL_FLAG = 1,
  921. COMPARE_UNORDERED_FLAG = 2;
  922. /** Used to compose bitmasks for function metadata. */
  923. var WRAP_BIND_FLAG = 1,
  924. WRAP_BIND_KEY_FLAG = 2,
  925. WRAP_CURRY_BOUND_FLAG = 4,
  926. WRAP_CURRY_FLAG = 8,
  927. WRAP_CURRY_RIGHT_FLAG = 16,
  928. WRAP_PARTIAL_FLAG = 32,
  929. WRAP_PARTIAL_RIGHT_FLAG = 64,
  930. WRAP_ARY_FLAG = 128,
  931. WRAP_REARG_FLAG = 256,
  932. WRAP_FLIP_FLAG = 512;
  933. /** Used as default options for `_.truncate`. */
  934. var DEFAULT_TRUNC_LENGTH = 30,
  935. DEFAULT_TRUNC_OMISSION = '...';
  936. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  937. var HOT_COUNT = 800,
  938. HOT_SPAN = 16;
  939. /** Used to indicate the type of lazy iteratees. */
  940. var LAZY_FILTER_FLAG = 1,
  941. LAZY_MAP_FLAG = 2,
  942. LAZY_WHILE_FLAG = 3;
  943. /** Used as references for various `Number` constants. */
  944. var INFINITY = 1 / 0,
  945. MAX_SAFE_INTEGER = 9007199254740991,
  946. MAX_INTEGER = 1.7976931348623157e+308,
  947. NAN = 0 / 0;
  948. /** Used as references for the maximum length and index of an array. */
  949. var MAX_ARRAY_LENGTH = 4294967295,
  950. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  951. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  952. /** Used to associate wrap methods with their bit flags. */
  953. var wrapFlags = [
  954. ['ary', WRAP_ARY_FLAG],
  955. ['bind', WRAP_BIND_FLAG],
  956. ['bindKey', WRAP_BIND_KEY_FLAG],
  957. ['curry', WRAP_CURRY_FLAG],
  958. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  959. ['flip', WRAP_FLIP_FLAG],
  960. ['partial', WRAP_PARTIAL_FLAG],
  961. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  962. ['rearg', WRAP_REARG_FLAG]
  963. ];
  964. /** `Object#toString` result references. */
  965. var argsTag = '[object Arguments]',
  966. arrayTag = '[object Array]',
  967. asyncTag = '[object AsyncFunction]',
  968. boolTag = '[object Boolean]',
  969. dateTag = '[object Date]',
  970. domExcTag = '[object DOMException]',
  971. errorTag = '[object Error]',
  972. funcTag = '[object Function]',
  973. genTag = '[object GeneratorFunction]',
  974. mapTag = '[object Map]',
  975. numberTag = '[object Number]',
  976. nullTag = '[object Null]',
  977. objectTag = '[object Object]',
  978. promiseTag = '[object Promise]',
  979. proxyTag = '[object Proxy]',
  980. regexpTag = '[object RegExp]',
  981. setTag = '[object Set]',
  982. stringTag = '[object String]',
  983. symbolTag = '[object Symbol]',
  984. undefinedTag = '[object Undefined]',
  985. weakMapTag = '[object WeakMap]',
  986. weakSetTag = '[object WeakSet]';
  987. var arrayBufferTag = '[object ArrayBuffer]',
  988. dataViewTag = '[object DataView]',
  989. float32Tag = '[object Float32Array]',
  990. float64Tag = '[object Float64Array]',
  991. int8Tag = '[object Int8Array]',
  992. int16Tag = '[object Int16Array]',
  993. int32Tag = '[object Int32Array]',
  994. uint8Tag = '[object Uint8Array]',
  995. uint8ClampedTag = '[object Uint8ClampedArray]',
  996. uint16Tag = '[object Uint16Array]',
  997. uint32Tag = '[object Uint32Array]';
  998. /** Used to match empty string literals in compiled template source. */
  999. var reEmptyStringLeading = /\b__p \+= '';/g,
  1000. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  1001. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  1002. /** Used to match HTML entities and HTML characters. */
  1003. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  1004. reUnescapedHtml = /[&<>"']/g,
  1005. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  1006. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  1007. /** Used to match template delimiters. */
  1008. var reEscape = /<%-([\s\S]+?)%>/g,
  1009. reEvaluate = /<%([\s\S]+?)%>/g,
  1010. reInterpolate = /<%=([\s\S]+?)%>/g;
  1011. /** Used to match property names within property paths. */
  1012. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1013. reIsPlainProp = /^\w*$/,
  1014. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1015. /**
  1016. * Used to match `RegExp`
  1017. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1018. */
  1019. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  1020. reHasRegExpChar = RegExp(reRegExpChar.source);
  1021. /** Used to match leading and trailing whitespace. */
  1022. var reTrim = /^\s+|\s+$/g,
  1023. reTrimStart = /^\s+/,
  1024. reTrimEnd = /\s+$/;
  1025. /** Used to match wrap detail comments. */
  1026. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  1027. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  1028. reSplitDetails = /,? & /;
  1029. /** Used to match words composed of alphanumeric characters. */
  1030. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1031. /** Used to match backslashes in property paths. */
  1032. var reEscapeChar = /\\(\\)?/g;
  1033. /**
  1034. * Used to match
  1035. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  1036. */
  1037. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  1038. /** Used to match `RegExp` flags from their coerced string values. */
  1039. var reFlags = /\w*$/;
  1040. /** Used to detect bad signed hexadecimal string values. */
  1041. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1042. /** Used to detect binary string values. */
  1043. var reIsBinary = /^0b[01]+$/i;
  1044. /** Used to detect host constructors (Safari). */
  1045. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1046. /** Used to detect octal string values. */
  1047. var reIsOctal = /^0o[0-7]+$/i;
  1048. /** Used to detect unsigned integer values. */
  1049. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1050. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  1051. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1052. /** Used to ensure capturing order of template delimiters. */
  1053. var reNoMatch = /($^)/;
  1054. /** Used to match unescaped characters in compiled string literals. */
  1055. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  1056. /** Used to compose unicode character classes. */
  1057. var rsAstralRange = '\\ud800-\\udfff',
  1058. rsComboMarksRange = '\\u0300-\\u036f',
  1059. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  1060. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  1061. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  1062. rsDingbatRange = '\\u2700-\\u27bf',
  1063. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  1064. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  1065. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  1066. rsPunctuationRange = '\\u2000-\\u206f',
  1067. 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',
  1068. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  1069. rsVarRange = '\\ufe0e\\ufe0f',
  1070. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1071. /** Used to compose unicode capture groups. */
  1072. var rsApos = "['\u2019]",
  1073. rsAstral = '[' + rsAstralRange + ']',
  1074. rsBreak = '[' + rsBreakRange + ']',
  1075. rsCombo = '[' + rsComboRange + ']',
  1076. rsDigits = '\\d+',
  1077. rsDingbat = '[' + rsDingbatRange + ']',
  1078. rsLower = '[' + rsLowerRange + ']',
  1079. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  1080. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  1081. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  1082. rsNonAstral = '[^' + rsAstralRange + ']',
  1083. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  1084. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  1085. rsUpper = '[' + rsUpperRange + ']',
  1086. rsZWJ = '\\u200d';
  1087. /** Used to compose unicode regexes. */
  1088. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  1089. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  1090. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  1091. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  1092. reOptMod = rsModifier + '?',
  1093. rsOptVar = '[' + rsVarRange + ']?',
  1094. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  1095. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  1096. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  1097. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  1098. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  1099. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  1100. /** Used to match apostrophes. */
  1101. var reApos = RegExp(rsApos, 'g');
  1102. /**
  1103. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  1104. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  1105. */
  1106. var reComboMark = RegExp(rsCombo, 'g');
  1107. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  1108. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  1109. /** Used to match complex or compound words. */
  1110. var reUnicodeWord = RegExp([
  1111. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  1112. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  1113. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  1114. rsUpper + '+' + rsOptContrUpper,
  1115. rsOrdUpper,
  1116. rsOrdLower,
  1117. rsDigits,
  1118. rsEmoji
  1119. ].join('|'), 'g');
  1120. /** 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/). */
  1121. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  1122. /** Used to detect strings that need a more robust regexp to match words. */
  1123. 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 ]/;
  1124. /** Used to assign default `context` object properties. */
  1125. var contextProps = [
  1126. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  1127. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  1128. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  1129. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  1130. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  1131. ];
  1132. /** Used to make template sourceURLs easier to identify. */
  1133. var templateCounter = -1;
  1134. /** Used to identify `toStringTag` values of typed arrays. */
  1135. var typedArrayTags = {};
  1136. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1137. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1138. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1139. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1140. typedArrayTags[uint32Tag] = true;
  1141. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1142. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1143. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1144. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1145. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1146. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1147. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1148. typedArrayTags[weakMapTag] = false;
  1149. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1150. var cloneableTags = {};
  1151. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1152. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1153. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1154. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1155. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1156. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1157. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1158. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1159. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1160. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1161. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1162. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1163. cloneableTags[weakMapTag] = false;
  1164. /** Used to map Latin Unicode letters to basic Latin letters. */
  1165. var deburredLetters = {
  1166. // Latin-1 Supplement block.
  1167. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1168. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1169. '\xc7': 'C', '\xe7': 'c',
  1170. '\xd0': 'D', '\xf0': 'd',
  1171. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1172. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1173. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1174. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1175. '\xd1': 'N', '\xf1': 'n',
  1176. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1177. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1178. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1179. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1180. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1181. '\xc6': 'Ae', '\xe6': 'ae',
  1182. '\xde': 'Th', '\xfe': 'th',
  1183. '\xdf': 'ss',
  1184. // Latin Extended-A block.
  1185. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1186. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1187. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1188. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1189. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1190. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1191. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1192. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1193. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1194. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1195. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1196. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1197. '\u0134': 'J', '\u0135': 'j',
  1198. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1199. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1200. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1201. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1202. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1203. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1204. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  1205. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  1206. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  1207. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  1208. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  1209. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  1210. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  1211. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  1212. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  1213. '\u0174': 'W', '\u0175': 'w',
  1214. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  1215. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  1216. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  1217. '\u0132': 'IJ', '\u0133': 'ij',
  1218. '\u0152': 'Oe', '\u0153': 'oe',
  1219. '\u0149': "'n", '\u017f': 's'
  1220. };
  1221. /** Used to map characters to HTML entities. */
  1222. var htmlEscapes = {
  1223. '&': '&amp;',
  1224. '<': '&lt;',
  1225. '>': '&gt;',
  1226. '"': '&quot;',
  1227. "'": '&#39;'
  1228. };
  1229. /** Used to map HTML entities to characters. */
  1230. var htmlUnescapes = {
  1231. '&amp;': '&',
  1232. '&lt;': '<',
  1233. '&gt;': '>',
  1234. '&quot;': '"',
  1235. '&#39;': "'"
  1236. };
  1237. /** Used to escape characters for inclusion in compiled string literals. */
  1238. var stringEscapes = {
  1239. '\\': '\\',
  1240. "'": "'",
  1241. '\n': 'n',
  1242. '\r': 'r',
  1243. '\u2028': 'u2028',
  1244. '\u2029': 'u2029'
  1245. };
  1246. /** Built-in method references without a dependency on `root`. */
  1247. var freeParseFloat = parseFloat,
  1248. freeParseInt = parseInt;
  1249. /** Detect free variable `global` from Node.js. */
  1250. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  1251. /** Detect free variable `self`. */
  1252. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1253. /** Used as a reference to the global object. */
  1254. var root = freeGlobal || freeSelf || Function('return this')();
  1255. /** Detect free variable `exports`. */
  1256. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  1257. /** Detect free variable `module`. */
  1258. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  1259. /** Detect the popular CommonJS extension `module.exports`. */
  1260. var moduleExports = freeModule && freeModule.exports === freeExports;
  1261. /** Detect free variable `process` from Node.js. */
  1262. var freeProcess = moduleExports && freeGlobal.process;
  1263. /** Used to access faster Node.js helpers. */
  1264. var nodeUtil = (function() {
  1265. try {
  1266. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  1267. } catch (e) {}
  1268. }());
  1269. /* Node.js helper references. */
  1270. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  1271. nodeIsDate = nodeUtil && nodeUtil.isDate,
  1272. nodeIsMap = nodeUtil && nodeUtil.isMap,
  1273. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  1274. nodeIsSet = nodeUtil && nodeUtil.isSet,
  1275. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1276. /*--------------------------------------------------------------------------*/
  1277. /**
  1278. * A faster alternative to `Function#apply`, this function invokes `func`
  1279. * with the `this` binding of `thisArg` and the arguments of `args`.
  1280. *
  1281. * @private
  1282. * @param {Function} func The function to invoke.
  1283. * @param {*} thisArg The `this` binding of `func`.
  1284. * @param {Array} args The arguments to invoke `func` with.
  1285. * @returns {*} Returns the result of `func`.
  1286. */
  1287. function apply(func, thisArg, args) {
  1288. switch (args.length) {
  1289. case 0: return func.call(thisArg);
  1290. case 1: return func.call(thisArg, args[0]);
  1291. case 2: return func.call(thisArg, args[0], args[1]);
  1292. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1293. }
  1294. return func.apply(thisArg, args);
  1295. }
  1296. /**
  1297. * A specialized version of `baseAggregator` for arrays.
  1298. *
  1299. * @private
  1300. * @param {Array} [array] The array to iterate over.
  1301. * @param {Function} setter The function to set `accumulator` values.
  1302. * @param {Function} iteratee The iteratee to transform keys.
  1303. * @param {Object} accumulator The initial aggregated object.
  1304. * @returns {Function} Returns `accumulator`.
  1305. */
  1306. function arrayAggregator(array, setter, iteratee, accumulator) {
  1307. var index = -1,
  1308. length = array == null ? 0 : array.length;
  1309. while (++index < length) {
  1310. var value = array[index];
  1311. setter(accumulator, value, iteratee(value), array);
  1312. }
  1313. return accumulator;
  1314. }
  1315. /**
  1316. * A specialized version of `_.forEach` for arrays without support for
  1317. * iteratee shorthands.
  1318. *
  1319. * @private
  1320. * @param {Array} [array] The array to iterate over.
  1321. * @param {Function} iteratee The function invoked per iteration.
  1322. * @returns {Array} Returns `array`.
  1323. */
  1324. function arrayEach(array, iteratee) {
  1325. var index = -1,
  1326. length = array == null ? 0 : array.length;
  1327. while (++index < length) {
  1328. if (iteratee(array[index], index, array) === false) {
  1329. break;
  1330. }
  1331. }
  1332. return array;
  1333. }
  1334. /**
  1335. * A specialized version of `_.forEachRight` for arrays without support for
  1336. * iteratee shorthands.
  1337. *
  1338. * @private
  1339. * @param {Array} [array] The array to iterate over.
  1340. * @param {Function} iteratee The function invoked per iteration.
  1341. * @returns {Array} Returns `array`.
  1342. */
  1343. function arrayEachRight(array, iteratee) {
  1344. var length = array == null ? 0 : array.length;
  1345. while (length--) {
  1346. if (iteratee(array[length], length, array) === false) {
  1347. break;
  1348. }
  1349. }
  1350. return array;
  1351. }
  1352. /**
  1353. * A specialized version of `_.every` for arrays without support for
  1354. * iteratee shorthands.
  1355. *
  1356. * @private
  1357. * @param {Array} [array] The array to iterate over.
  1358. * @param {Function} predicate The function invoked per iteration.
  1359. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1360. * else `false`.
  1361. */
  1362. function arrayEvery(array, predicate) {
  1363. var index = -1,
  1364. length = array == null ? 0 : array.length;
  1365. while (++index < length) {
  1366. if (!predicate(array[index], index, array)) {
  1367. return false;
  1368. }
  1369. }
  1370. return true;
  1371. }
  1372. /**
  1373. * A specialized version of `_.filter` for arrays without support for
  1374. * iteratee shorthands.
  1375. *
  1376. * @private
  1377. * @param {Array} [array] The array to iterate over.
  1378. * @param {Function} predicate The function invoked per iteration.
  1379. * @returns {Array} Returns the new filtered array.
  1380. */
  1381. function arrayFilter(array, predicate) {
  1382. var index = -1,
  1383. length = array == null ? 0 : array.length,
  1384. resIndex = 0,
  1385. result = [];
  1386. while (++index < length) {
  1387. var value = array[index];
  1388. if (predicate(value, index, array)) {
  1389. result[resIndex++] = value;
  1390. }
  1391. }
  1392. return result;
  1393. }
  1394. /**
  1395. * A specialized version of `_.includes` for arrays without support for
  1396. * specifying an index to search from.
  1397. *
  1398. * @private
  1399. * @param {Array} [array] The array to inspect.
  1400. * @param {*} target The value to search for.
  1401. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1402. */
  1403. function arrayIncludes(array, value) {
  1404. var length = array == null ? 0 : array.length;
  1405. return !!length && baseIndexOf(array, value, 0) > -1;
  1406. }
  1407. /**
  1408. * This function is like `arrayIncludes` except that it accepts a comparator.
  1409. *
  1410. * @private
  1411. * @param {Array} [array] The array to inspect.
  1412. * @param {*} target The value to search for.
  1413. * @param {Function} comparator The comparator invoked per element.
  1414. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1415. */
  1416. function arrayIncludesWith(array, value, comparator) {
  1417. var index = -1,
  1418. length = array == null ? 0 : array.length;
  1419. while (++index < length) {
  1420. if (comparator(value, array[index])) {
  1421. return true;
  1422. }
  1423. }
  1424. return false;
  1425. }
  1426. /**
  1427. * A specialized version of `_.map` for arrays without support for iteratee
  1428. * shorthands.
  1429. *
  1430. * @private
  1431. * @param {Array} [array] The array to iterate over.
  1432. * @param {Function} iteratee The function invoked per iteration.
  1433. * @returns {Array} Returns the new mapped array.
  1434. */
  1435. function arrayMap(array, iteratee) {
  1436. var index = -1,
  1437. length = array == null ? 0 : array.length,
  1438. result = Array(length);
  1439. while (++index < length) {
  1440. result[index] = iteratee(array[index], index, array);
  1441. }
  1442. return result;
  1443. }
  1444. /**
  1445. * Appends the elements of `values` to `array`.
  1446. *
  1447. * @private
  1448. * @param {Array} array The array to modify.
  1449. * @param {Array} values The values to append.
  1450. * @returns {Array} Returns `array`.
  1451. */
  1452. function arrayPush(array, values) {
  1453. var index = -1,
  1454. length = values.length,
  1455. offset = array.length;
  1456. while (++index < length) {
  1457. array[offset + index] = values[index];
  1458. }
  1459. return array;
  1460. }
  1461. /**
  1462. * A specialized version of `_.reduce` for arrays without support for
  1463. * iteratee shorthands.
  1464. *
  1465. * @private
  1466. * @param {Array} [array] The array to iterate over.
  1467. * @param {Function} iteratee The function invoked per iteration.
  1468. * @param {*} [accumulator] The initial value.
  1469. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1470. * the initial value.
  1471. * @returns {*} Returns the accumulated value.
  1472. */
  1473. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1474. var index = -1,
  1475. length = array == null ? 0 : array.length;
  1476. if (initAccum && length) {
  1477. accumulator = array[++index];
  1478. }
  1479. while (++index < length) {
  1480. accumulator = iteratee(accumulator, array[index], index, array);
  1481. }
  1482. return accumulator;
  1483. }
  1484. /**
  1485. * A specialized version of `_.reduceRight` for arrays without support for
  1486. * iteratee shorthands.
  1487. *
  1488. * @private
  1489. * @param {Array} [array] The array to iterate over.
  1490. * @param {Function} iteratee The function invoked per iteration.
  1491. * @param {*} [accumulator] The initial value.
  1492. * @param {boolean} [initAccum] Specify using the last element of `array` as
  1493. * the initial value.
  1494. * @returns {*} Returns the accumulated value.
  1495. */
  1496. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  1497. var length = array == null ? 0 : array.length;
  1498. if (initAccum && length) {
  1499. accumulator = array[--length];
  1500. }
  1501. while (length--) {
  1502. accumulator = iteratee(accumulator, array[length], length, array);
  1503. }
  1504. return accumulator;
  1505. }
  1506. /**
  1507. * A specialized version of `_.some` for arrays without support for iteratee
  1508. * shorthands.
  1509. *
  1510. * @private
  1511. * @param {Array} [array] The array to iterate over.
  1512. * @param {Function} predicate The function invoked per iteration.
  1513. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1514. * else `false`.
  1515. */
  1516. function arraySome(array, predicate) {
  1517. var index = -1,
  1518. length = array == null ? 0 : array.length;
  1519. while (++index < length) {
  1520. if (predicate(array[index], index, array)) {
  1521. return true;
  1522. }
  1523. }
  1524. return false;
  1525. }
  1526. /**
  1527. * Gets the size of an ASCII `string`.
  1528. *
  1529. * @private
  1530. * @param {string} string The string inspect.
  1531. * @returns {number} Returns the string size.
  1532. */
  1533. var asciiSize = baseProperty('length');
  1534. /**
  1535. * Converts an ASCII `string` to an array.
  1536. *
  1537. * @private
  1538. * @param {string} string The string to convert.
  1539. * @returns {Array} Returns the converted array.
  1540. */
  1541. function asciiToArray(string) {
  1542. return string.split('');
  1543. }
  1544. /**
  1545. * Splits an ASCII `string` into an array of its words.
  1546. *
  1547. * @private
  1548. * @param {string} The string to inspect.
  1549. * @returns {Array} Returns the words of `string`.
  1550. */
  1551. function asciiWords(string) {
  1552. return string.match(reAsciiWord) || [];
  1553. }
  1554. /**
  1555. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  1556. * without support for iteratee shorthands, which iterates over `collection`
  1557. * using `eachFunc`.
  1558. *
  1559. * @private
  1560. * @param {Array|Object} collection The collection to inspect.
  1561. * @param {Function} predicate The function invoked per iteration.
  1562. * @param {Function} eachFunc The function to iterate over `collection`.
  1563. * @returns {*} Returns the found element or its key, else `undefined`.
  1564. */
  1565. function baseFindKey(collection, predicate, eachFunc) {
  1566. var result;
  1567. eachFunc(collection, function(value, key, collection) {
  1568. if (predicate(value, key, collection)) {
  1569. result = key;
  1570. return false;
  1571. }
  1572. });
  1573. return result;
  1574. }
  1575. /**
  1576. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  1577. * support for iteratee shorthands.
  1578. *
  1579. * @private
  1580. * @param {Array} array The array to inspect.
  1581. * @param {Function} predicate The function invoked per iteration.
  1582. * @param {number} fromIndex The index to search from.
  1583. * @param {boolean} [fromRight] Specify iterating from right to left.
  1584. * @returns {number} Returns the index of the matched value, else `-1`.
  1585. */
  1586. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1587. var length = array.length,
  1588. index = fromIndex + (fromRight ? 1 : -1);
  1589. while ((fromRight ? index-- : ++index < length)) {
  1590. if (predicate(array[index], index, array)) {
  1591. return index;
  1592. }
  1593. }
  1594. return -1;
  1595. }
  1596. /**
  1597. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  1598. *
  1599. * @private
  1600. * @param {Array} array The array to inspect.
  1601. * @param {*} value The value to search for.
  1602. * @param {number} fromIndex The index to search from.
  1603. * @returns {number} Returns the index of the matched value, else `-1`.
  1604. */
  1605. function baseIndexOf(array, value, fromIndex) {
  1606. return value === value
  1607. ? strictIndexOf(array, value, fromIndex)
  1608. : baseFindIndex(array, baseIsNaN, fromIndex);
  1609. }
  1610. /**
  1611. * This function is like `baseIndexOf` except that it accepts a comparator.
  1612. *
  1613. * @private
  1614. * @param {Array} array The array to inspect.
  1615. * @param {*} value The value to search for.
  1616. * @param {number} fromIndex The index to search from.
  1617. * @param {Function} comparator The comparator invoked per element.
  1618. * @returns {number} Returns the index of the matched value, else `-1`.
  1619. */
  1620. function baseIndexOfWith(array, value, fromIndex, comparator) {
  1621. var index = fromIndex - 1,
  1622. length = array.length;
  1623. while (++index < length) {
  1624. if (comparator(array[index], value)) {
  1625. return index;
  1626. }
  1627. }
  1628. return -1;
  1629. }
  1630. /**
  1631. * The base implementation of `_.isNaN` without support for number objects.
  1632. *
  1633. * @private
  1634. * @param {*} value The value to check.
  1635. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  1636. */
  1637. function baseIsNaN(value) {
  1638. return value !== value;
  1639. }
  1640. /**
  1641. * The base implementation of `_.mean` and `_.meanBy` without support for
  1642. * iteratee shorthands.
  1643. *
  1644. * @private
  1645. * @param {Array} array The array to iterate over.
  1646. * @param {Function} iteratee The function invoked per iteration.
  1647. * @returns {number} Returns the mean.
  1648. */
  1649. function baseMean(array, iteratee) {
  1650. var length = array == null ? 0 : array.length;
  1651. return length ? (baseSum(array, iteratee) / length) : NAN;
  1652. }
  1653. /**
  1654. * The base implementation of `_.property` without support for deep paths.
  1655. *
  1656. * @private
  1657. * @param {string} key The key of the property to get.
  1658. * @returns {Function} Returns the new accessor function.
  1659. */
  1660. function baseProperty(key) {
  1661. return function(object) {
  1662. return object == null ? undefined : object[key];
  1663. };
  1664. }
  1665. /**
  1666. * The base implementation of `_.propertyOf` without support for deep paths.
  1667. *
  1668. * @private
  1669. * @param {Object} object The object to query.
  1670. * @returns {Function} Returns the new accessor function.
  1671. */
  1672. function basePropertyOf(object) {
  1673. return function(key) {
  1674. return object == null ? undefined : object[key];
  1675. };
  1676. }
  1677. /**
  1678. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  1679. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  1680. *
  1681. * @private
  1682. * @param {Array|Object} collection The collection to iterate over.
  1683. * @param {Function} iteratee The function invoked per iteration.
  1684. * @param {*} accumulator The initial value.
  1685. * @param {boolean} initAccum Specify using the first or last element of
  1686. * `collection` as the initial value.
  1687. * @param {Function} eachFunc The function to iterate over `collection`.
  1688. * @returns {*} Returns the accumulated value.
  1689. */
  1690. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  1691. eachFunc(collection, function(value, index, collection) {
  1692. accumulator = initAccum
  1693. ? (initAccum = false, value)
  1694. : iteratee(accumulator, value, index, collection);
  1695. });
  1696. return accumulator;
  1697. }
  1698. /**
  1699. * The base implementation of `_.sortBy` which uses `comparer` to define the
  1700. * sort order of `array` and replaces criteria objects with their corresponding
  1701. * values.
  1702. *
  1703. * @private
  1704. * @param {Array} array The array to sort.
  1705. * @param {Function} comparer The function to define sort order.
  1706. * @returns {Array} Returns `array`.
  1707. */
  1708. function baseSortBy(array, comparer) {
  1709. var length = array.length;
  1710. array.sort(comparer);
  1711. while (length--) {
  1712. array[length] = array[length].value;
  1713. }
  1714. return array;
  1715. }
  1716. /**
  1717. * The base implementation of `_.sum` and `_.sumBy` without support for
  1718. * iteratee shorthands.
  1719. *
  1720. * @private
  1721. * @param {Array} array The array to iterate over.
  1722. * @param {Function} iteratee The function invoked per iteration.
  1723. * @returns {number} Returns the sum.
  1724. */
  1725. function baseSum(array, iteratee) {
  1726. var result,
  1727. index = -1,
  1728. length = array.length;
  1729. while (++index < length) {
  1730. var current = iteratee(array[index]);
  1731. if (current !== undefined) {
  1732. result = result === undefined ? current : (result + current);
  1733. }
  1734. }
  1735. return result;
  1736. }
  1737. /**
  1738. * The base implementation of `_.times` without support for iteratee shorthands
  1739. * or max array length checks.
  1740. *
  1741. * @private
  1742. * @param {number} n The number of times to invoke `iteratee`.
  1743. * @param {Function} iteratee The function invoked per iteration.
  1744. * @returns {Array} Returns the array of results.
  1745. */
  1746. function baseTimes(n, iteratee) {
  1747. var index = -1,
  1748. result = Array(n);
  1749. while (++index < n) {
  1750. result[index] = iteratee(index);
  1751. }
  1752. return result;
  1753. }
  1754. /**
  1755. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  1756. * of key-value pairs for `object` corresponding to the property names of `props`.
  1757. *
  1758. * @private
  1759. * @param {Object} object The object to query.
  1760. * @param {Array} props The property names to get values for.
  1761. * @returns {Object} Returns the key-value pairs.
  1762. */
  1763. function baseToPairs(object, props) {
  1764. return arrayMap(props, function(key) {
  1765. return [key, object[key]];
  1766. });
  1767. }
  1768. /**
  1769. * The base implementation of `_.unary` without support for storing metadata.
  1770. *
  1771. * @private
  1772. * @param {Function} func The function to cap arguments for.
  1773. * @returns {Function} Returns the new capped function.
  1774. */
  1775. function baseUnary(func) {
  1776. return function(value) {
  1777. return func(value);
  1778. };
  1779. }
  1780. /**
  1781. * The base implementation of `_.values` and `_.valuesIn` which creates an
  1782. * array of `object` property values corresponding to the property names
  1783. * of `props`.
  1784. *
  1785. * @private
  1786. * @param {Object} object The object to query.
  1787. * @param {Array} props The property names to get values for.
  1788. * @returns {Object} Returns the array of property values.
  1789. */
  1790. function baseValues(object, props) {
  1791. return arrayMap(props, function(key) {
  1792. return object[key];
  1793. });
  1794. }
  1795. /**
  1796. * Checks if a `cache` value for `key` exists.
  1797. *
  1798. * @private
  1799. * @param {Object} cache The cache to query.
  1800. * @param {string} key The key of the entry to check.
  1801. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1802. */
  1803. function cacheHas(cache, key) {
  1804. return cache.has(key);
  1805. }
  1806. /**
  1807. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  1808. * that is not found in the character symbols.
  1809. *
  1810. * @private
  1811. * @param {Array} strSymbols The string symbols to inspect.
  1812. * @param {Array} chrSymbols The character symbols to find.
  1813. * @returns {number} Returns the index of the first unmatched string symbol.
  1814. */
  1815. function charsStartIndex(strSymbols, chrSymbols) {
  1816. var index = -1,
  1817. length = strSymbols.length;
  1818. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1819. return index;
  1820. }
  1821. /**
  1822. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  1823. * that is not found in the character symbols.
  1824. *
  1825. * @private
  1826. * @param {Array} strSymbols The string symbols to inspect.
  1827. * @param {Array} chrSymbols The character symbols to find.
  1828. * @returns {number} Returns the index of the last unmatched string symbol.
  1829. */
  1830. function charsEndIndex(strSymbols, chrSymbols) {
  1831. var index = strSymbols.length;
  1832. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1833. return index;
  1834. }
  1835. /**
  1836. * Gets the number of `placeholder` occurrences in `array`.
  1837. *
  1838. * @private
  1839. * @param {Array} array The array to inspect.
  1840. * @param {*} placeholder The placeholder to search for.
  1841. * @returns {number} Returns the placeholder count.
  1842. */
  1843. function countHolders(array, placeholder) {
  1844. var length = array.length,
  1845. result = 0;
  1846. while (length--) {
  1847. if (array[length] === placeholder) {
  1848. ++result;
  1849. }
  1850. }
  1851. return result;
  1852. }
  1853. /**
  1854. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  1855. * letters to basic Latin letters.
  1856. *
  1857. * @private
  1858. * @param {string} letter The matched letter to deburr.
  1859. * @returns {string} Returns the deburred letter.
  1860. */
  1861. var deburrLetter = basePropertyOf(deburredLetters);
  1862. /**
  1863. * Used by `_.escape` to convert characters to HTML entities.
  1864. *
  1865. * @private
  1866. * @param {string} chr The matched character to escape.
  1867. * @returns {string} Returns the escaped character.
  1868. */
  1869. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  1870. /**
  1871. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  1872. *
  1873. * @private
  1874. * @param {string} chr The matched character to escape.
  1875. * @returns {string} Returns the escaped character.
  1876. */
  1877. function escapeStringChar(chr) {
  1878. return '\\' + stringEscapes[chr];
  1879. }
  1880. /**
  1881. * Gets the value at `key` of `object`.
  1882. *
  1883. * @private
  1884. * @param {Object} [object] The object to query.
  1885. * @param {string} key The key of the property to get.
  1886. * @returns {*} Returns the property value.
  1887. */
  1888. function getValue(object, key) {
  1889. return object == null ? undefined : object[key];
  1890. }
  1891. /**
  1892. * Checks if `string` contains Unicode symbols.
  1893. *
  1894. * @private
  1895. * @param {string} string The string to inspect.
  1896. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  1897. */
  1898. function hasUnicode(string) {
  1899. return reHasUnicode.test(string);
  1900. }
  1901. /**
  1902. * Checks if `string` contains a word composed of Unicode symbols.
  1903. *
  1904. * @private
  1905. * @param {string} string The string to inspect.
  1906. * @returns {boolean} Returns `true` if a word is found, else `false`.
  1907. */
  1908. function hasUnicodeWord(string) {
  1909. return reHasUnicodeWord.test(string);
  1910. }
  1911. /**
  1912. * Converts `iterator` to an array.
  1913. *
  1914. * @private
  1915. * @param {Object} iterator The iterator to convert.
  1916. * @returns {Array} Returns the converted array.
  1917. */
  1918. function iteratorToArray(iterator) {
  1919. var data,
  1920. result = [];
  1921. while (!(data = iterator.next()).done) {
  1922. result.push(data.value);
  1923. }
  1924. return result;
  1925. }
  1926. /**
  1927. * Converts `map` to its key-value pairs.
  1928. *
  1929. * @private
  1930. * @param {Object} map The map to convert.
  1931. * @returns {Array} Returns the key-value pairs.
  1932. */
  1933. function mapToArray(map) {
  1934. var index = -1,
  1935. result = Array(map.size);
  1936. map.forEach(function(value, key) {
  1937. result[++index] = [key, value];
  1938. });
  1939. return result;
  1940. }
  1941. /**
  1942. * Creates a unary function that invokes `func` with its argument transformed.
  1943. *
  1944. * @private
  1945. * @param {Function} func The function to wrap.
  1946. * @param {Function} transform The argument transform.
  1947. * @returns {Function} Returns the new function.
  1948. */
  1949. function overArg(func, transform) {
  1950. return function(arg) {
  1951. return func(transform(arg));
  1952. };
  1953. }
  1954. /**
  1955. * Replaces all `placeholder` elements in `array` with an internal placeholder
  1956. * and returns an array of their indexes.
  1957. *
  1958. * @private
  1959. * @param {Array} array The array to modify.
  1960. * @param {*} placeholder The placeholder to replace.
  1961. * @returns {Array} Returns the new array of placeholder indexes.
  1962. */
  1963. function replaceHolders(array, placeholder) {
  1964. var index = -1,
  1965. length = array.length,
  1966. resIndex = 0,
  1967. result = [];
  1968. while (++index < length) {
  1969. var value = array[index];
  1970. if (value === placeholder || value === PLACEHOLDER) {
  1971. array[index] = PLACEHOLDER;
  1972. result[resIndex++] = index;
  1973. }
  1974. }
  1975. return result;
  1976. }
  1977. /**
  1978. * Gets the value at `key`, unless `key` is "__proto__".
  1979. *
  1980. * @private
  1981. * @param {Object} object The object to query.
  1982. * @param {string} key The key of the property to get.
  1983. * @returns {*} Returns the property value.
  1984. */
  1985. function safeGet(object, key) {
  1986. return key == '__proto__'
  1987. ? undefined
  1988. : object[key];
  1989. }
  1990. /**
  1991. * Converts `set` to an array of its values.
  1992. *
  1993. * @private
  1994. * @param {Object} set The set to convert.
  1995. * @returns {Array} Returns the values.
  1996. */
  1997. function setToArray(set) {
  1998. var index = -1,
  1999. result = Array(set.size);
  2000. set.forEach(function(value) {
  2001. result[++index] = value;
  2002. });
  2003. return result;
  2004. }
  2005. /**
  2006. * Converts `set` to its value-value pairs.
  2007. *
  2008. * @private
  2009. * @param {Object} set The set to convert.
  2010. * @returns {Array} Returns the value-value pairs.
  2011. */
  2012. function setToPairs(set) {
  2013. var index = -1,
  2014. result = Array(set.size);
  2015. set.forEach(function(value) {
  2016. result[++index] = [value, value];
  2017. });
  2018. return result;
  2019. }
  2020. /**
  2021. * A specialized version of `_.indexOf` which performs strict equality
  2022. * comparisons of values, i.e. `===`.
  2023. *
  2024. * @private
  2025. * @param {Array} array The array to inspect.
  2026. * @param {*} value The value to search for.
  2027. * @param {number} fromIndex The index to search from.
  2028. * @returns {number} Returns the index of the matched value, else `-1`.
  2029. */
  2030. function strictIndexOf(array, value, fromIndex) {
  2031. var index = fromIndex - 1,
  2032. length = array.length;
  2033. while (++index < length) {
  2034. if (array[index] === value) {
  2035. return index;
  2036. }
  2037. }
  2038. return -1;
  2039. }
  2040. /**
  2041. * A specialized version of `_.lastIndexOf` which performs strict equality
  2042. * comparisons of values, i.e. `===`.
  2043. *
  2044. * @private
  2045. * @param {Array} array The array to inspect.
  2046. * @param {*} value The value to search for.
  2047. * @param {number} fromIndex The index to search from.
  2048. * @returns {number} Returns the index of the matched value, else `-1`.
  2049. */
  2050. function strictLastIndexOf(array, value, fromIndex) {
  2051. var index = fromIndex + 1;
  2052. while (index--) {
  2053. if (array[index] === value) {
  2054. return index;
  2055. }
  2056. }
  2057. return index;
  2058. }
  2059. /**
  2060. * Gets the number of symbols in `string`.
  2061. *
  2062. * @private
  2063. * @param {string} string The string to inspect.
  2064. * @returns {number} Returns the string size.
  2065. */
  2066. function stringSize(string) {
  2067. return hasUnicode(string)
  2068. ? unicodeSize(string)
  2069. : asciiSize(string);
  2070. }
  2071. /**
  2072. * Converts `string` to an array.
  2073. *
  2074. * @private
  2075. * @param {string} string The string to convert.
  2076. * @returns {Array} Returns the converted array.
  2077. */
  2078. function stringToArray(string) {
  2079. return hasUnicode(string)
  2080. ? unicodeToArray(string)
  2081. : asciiToArray(string);
  2082. }
  2083. /**
  2084. * Used by `_.unescape` to convert HTML entities to characters.
  2085. *
  2086. * @private
  2087. * @param {string} chr The matched character to unescape.
  2088. * @returns {string} Returns the unescaped character.
  2089. */
  2090. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  2091. /**
  2092. * Gets the size of a Unicode `string`.
  2093. *
  2094. * @private
  2095. * @param {string} string The string inspect.
  2096. * @returns {number} Returns the string size.
  2097. */
  2098. function unicodeSize(string) {
  2099. var result = reUnicode.lastIndex = 0;
  2100. while (reUnicode.test(string)) {
  2101. ++result;
  2102. }
  2103. return result;
  2104. }
  2105. /**
  2106. * Converts a Unicode `string` to an array.
  2107. *
  2108. * @private
  2109. * @param {string} string The string to convert.
  2110. * @returns {Array} Returns the converted array.
  2111. */
  2112. function unicodeToArray(string) {
  2113. return string.match(reUnicode) || [];
  2114. }
  2115. /**
  2116. * Splits a Unicode `string` into an array of its words.
  2117. *
  2118. * @private
  2119. * @param {string} The string to inspect.
  2120. * @returns {Array} Returns the words of `string`.
  2121. */
  2122. function unicodeWords(string) {
  2123. return string.match(reUnicodeWord) || [];
  2124. }
  2125. /*--------------------------------------------------------------------------*/
  2126. /**
  2127. * Create a new pristine `lodash` function using the `context` object.
  2128. *
  2129. * @static
  2130. * @memberOf _
  2131. * @since 1.1.0
  2132. * @category Util
  2133. * @param {Object} [context=root] The context object.
  2134. * @returns {Function} Returns a new `lodash` function.
  2135. * @example
  2136. *
  2137. * _.mixin({ 'foo': _.constant('foo') });
  2138. *
  2139. * var lodash = _.runInContext();
  2140. * lodash.mixin({ 'bar': lodash.constant('bar') });
  2141. *
  2142. * _.isFunction(_.foo);
  2143. * // => true
  2144. * _.isFunction(_.bar);
  2145. * // => false
  2146. *
  2147. * lodash.isFunction(lodash.foo);
  2148. * // => false
  2149. * lodash.isFunction(lodash.bar);
  2150. * // => true
  2151. *
  2152. * // Create a suped-up `defer` in Node.js.
  2153. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2154. */
  2155. var runInContext = (function runInContext(context) {
  2156. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2157. /** Built-in constructor references. */
  2158. var Array = context.Array,
  2159. Date = context.Date,
  2160. Error = context.Error,
  2161. Function = context.Function,
  2162. Math = context.Math,
  2163. Object = context.Object,
  2164. RegExp = context.RegExp,
  2165. String = context.String,
  2166. TypeError = context.TypeError;
  2167. /** Used for built-in method references. */
  2168. var arrayProto = Array.prototype,
  2169. funcProto = Function.prototype,
  2170. objectProto = Object.prototype;
  2171. /** Used to detect overreaching core-js shims. */
  2172. var coreJsData = context['__core-js_shared__'];
  2173. /** Used to resolve the decompiled source of functions. */
  2174. var funcToString = funcProto.toString;
  2175. /** Used to check objects for own properties. */
  2176. var hasOwnProperty = objectProto.hasOwnProperty;
  2177. /** Used to generate unique IDs. */
  2178. var idCounter = 0;
  2179. /** Used to detect methods masquerading as native. */
  2180. var maskSrcKey = (function() {
  2181. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2182. return uid ? ('Symbol(src)_1.' + uid) : '';
  2183. }());
  2184. /**
  2185. * Used to resolve the
  2186. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2187. * of values.
  2188. */
  2189. var nativeObjectToString = objectProto.toString;
  2190. /** Used to infer the `Object` constructor. */
  2191. var objectCtorString = funcToString.call(Object);
  2192. /** Used to restore the original `_` reference in `_.noConflict`. */
  2193. var oldDash = root._;
  2194. /** Used to detect if a method is native. */
  2195. var reIsNative = RegExp('^' +
  2196. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2197. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2198. );
  2199. /** Built-in value references. */
  2200. var Buffer = moduleExports ? context.Buffer : undefined,
  2201. Symbol = context.Symbol,
  2202. Uint8Array = context.Uint8Array,
  2203. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  2204. getPrototype = overArg(Object.getPrototypeOf, Object),
  2205. objectCreate = Object.create,
  2206. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  2207. splice = arrayProto.splice,
  2208. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  2209. symIterator = Symbol ? Symbol.iterator : undefined,
  2210. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  2211. var defineProperty = (function() {
  2212. try {
  2213. var func = getNative(Object, 'defineProperty');
  2214. func({}, '', {});
  2215. return func;
  2216. } catch (e) {}
  2217. }());
  2218. /** Mocked built-ins. */
  2219. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  2220. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  2221. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  2222. /* Built-in method references for those with the same name as other `lodash` methods. */
  2223. var nativeCeil = Math.ceil,
  2224. nativeFloor = Math.floor,
  2225. nativeGetSymbols = Object.getOwnPropertySymbols,
  2226. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  2227. nativeIsFinite = context.isFinite,
  2228. nativeJoin = arrayProto.join,
  2229. nativeKeys = overArg(Object.keys, Object),
  2230. nativeMax = Math.max,
  2231. nativeMin = Math.min,
  2232. nativeNow = Date.now,
  2233. nativeParseInt = context.parseInt,
  2234. nativeRandom = Math.random,
  2235. nativeReverse = arrayProto.reverse;
  2236. /* Built-in method references that are verified to be native. */
  2237. var DataView = getNative(context, 'DataView'),
  2238. Map = getNative(context, 'Map'),
  2239. Promise = getNative(context, 'Promise'),
  2240. Set = getNative(context, 'Set'),
  2241. WeakMap = getNative(context, 'WeakMap'),
  2242. nativeCreate = getNative(Object, 'create');
  2243. /** Used to store function metadata. */
  2244. var metaMap = WeakMap && new WeakMap;
  2245. /** Used to lookup unminified function names. */
  2246. var realNames = {};
  2247. /** Used to detect maps, sets, and weakmaps. */
  2248. var dataViewCtorString = toSource(DataView),
  2249. mapCtorString = toSource(Map),
  2250. promiseCtorString = toSource(Promise),
  2251. setCtorString = toSource(Set),
  2252. weakMapCtorString = toSource(WeakMap);
  2253. /** Used to convert symbols to primitives and strings. */
  2254. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2255. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  2256. symbolToString = symbolProto ? symbolProto.toString : undefined;
  2257. /*------------------------------------------------------------------------*/
  2258. /**
  2259. * Creates a `lodash` object which wraps `value` to enable implicit method
  2260. * chain sequences. Methods that operate on and return arrays, collections,
  2261. * and functions can be chained together. Methods that retrieve a single value
  2262. * or may return a primitive value will automatically end the chain sequence
  2263. * and return the unwrapped value. Otherwise, the value must be unwrapped
  2264. * with `_#value`.
  2265. *
  2266. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  2267. * enabled using `_.chain`.
  2268. *
  2269. * The execution of chained methods is lazy, that is, it's deferred until
  2270. * `_#value` is implicitly or explicitly called.
  2271. *
  2272. * Lazy evaluation allows several methods to support shortcut fusion.
  2273. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  2274. * the creation of intermediate arrays and can greatly reduce the number of
  2275. * iteratee executions. Sections of a chain sequence qualify for shortcut
  2276. * fusion if the section is applied to an array and iteratees accept only
  2277. * one argument. The heuristic for whether a section qualifies for shortcut
  2278. * fusion is subject to change.
  2279. *
  2280. * Chaining is supported in custom builds as long as the `_#value` method is
  2281. * directly or indirectly included in the build.
  2282. *
  2283. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  2284. *
  2285. * The wrapper `Array` methods are:
  2286. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  2287. *
  2288. * The wrapper `String` methods are:
  2289. * `replace` and `split`
  2290. *
  2291. * The wrapper methods that support shortcut fusion are:
  2292. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  2293. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  2294. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  2295. *
  2296. * The chainable wrapper methods are:
  2297. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  2298. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  2299. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  2300. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  2301. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  2302. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  2303. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  2304. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  2305. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  2306. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  2307. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  2308. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  2309. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  2310. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  2311. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  2312. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  2313. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  2314. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  2315. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  2316. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  2317. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  2318. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  2319. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  2320. * `zipObject`, `zipObjectDeep`, and `zipWith`
  2321. *
  2322. * The wrapper methods that are **not** chainable by default are:
  2323. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  2324. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  2325. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  2326. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  2327. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  2328. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  2329. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  2330. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  2331. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  2332. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  2333. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  2334. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  2335. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  2336. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  2337. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  2338. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  2339. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  2340. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  2341. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  2342. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  2343. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  2344. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  2345. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  2346. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  2347. * `upperFirst`, `value`, and `words`
  2348. *
  2349. * @name _
  2350. * @constructor
  2351. * @category Seq
  2352. * @param {*} value The value to wrap in a `lodash` instance.
  2353. * @returns {Object} Returns the new `lodash` wrapper instance.
  2354. * @example
  2355. *
  2356. * function square(n) {
  2357. * return n * n;
  2358. * }
  2359. *
  2360. * var wrapped = _([1, 2, 3]);
  2361. *
  2362. * // Returns an unwrapped value.
  2363. * wrapped.reduce(_.add);
  2364. * // => 6
  2365. *
  2366. * // Returns a wrapped value.
  2367. * var squares = wrapped.map(square);
  2368. *
  2369. * _.isArray(squares);
  2370. * // => false
  2371. *
  2372. * _.isArray(squares.value());
  2373. * // => true
  2374. */
  2375. function lodash(value) {
  2376. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  2377. if (value instanceof LodashWrapper) {
  2378. return value;
  2379. }
  2380. if (hasOwnProperty.call(value, '__wrapped__')) {
  2381. return wrapperClone(value);
  2382. }
  2383. }
  2384. return new LodashWrapper(value);
  2385. }
  2386. /**
  2387. * The base implementation of `_.create` without support for assigning
  2388. * properties to the created object.
  2389. *
  2390. * @private
  2391. * @param {Object} proto The object to inherit from.
  2392. * @returns {Object} Returns the new object.
  2393. */
  2394. var baseCreate = (function() {
  2395. function object() {}
  2396. return function(proto) {
  2397. if (!isObject(proto)) {
  2398. return {};
  2399. }
  2400. if (objectCreate) {
  2401. return objectCreate(proto);
  2402. }
  2403. object.prototype = proto;
  2404. var result = new object;
  2405. object.prototype = undefined;
  2406. return result;
  2407. };
  2408. }());
  2409. /**
  2410. * The function whose prototype chain sequence wrappers inherit from.
  2411. *
  2412. * @private
  2413. */
  2414. function baseLodash() {
  2415. // No operation performed.
  2416. }
  2417. /**
  2418. * The base constructor for creating `lodash` wrapper objects.
  2419. *
  2420. * @private
  2421. * @param {*} value The value to wrap.
  2422. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  2423. */
  2424. function LodashWrapper(value, chainAll) {
  2425. this.__wrapped__ = value;
  2426. this.__actions__ = [];
  2427. this.__chain__ = !!chainAll;
  2428. this.__index__ = 0;
  2429. this.__values__ = undefined;
  2430. }
  2431. /**
  2432. * By default, the template delimiters used by lodash are like those in
  2433. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  2434. * following template settings to use alternative delimiters.
  2435. *
  2436. * @static
  2437. * @memberOf _
  2438. * @type {Object}
  2439. */
  2440. lodash.templateSettings = {
  2441. /**
  2442. * Used to detect `data` property values to be HTML-escaped.
  2443. *
  2444. * @memberOf _.templateSettings
  2445. * @type {RegExp}
  2446. */
  2447. 'escape': reEscape,
  2448. /**
  2449. * Used to detect code to be evaluated.
  2450. *
  2451. * @memberOf _.templateSettings
  2452. * @type {RegExp}
  2453. */
  2454. 'evaluate': reEvaluate,
  2455. /**
  2456. * Used to detect `data` property values to inject.
  2457. *
  2458. * @memberOf _.templateSettings
  2459. * @type {RegExp}
  2460. */
  2461. 'interpolate': reInterpolate,
  2462. /**
  2463. * Used to reference the data object in the template text.
  2464. *
  2465. * @memberOf _.templateSettings
  2466. * @type {string}
  2467. */
  2468. 'variable': '',
  2469. /**
  2470. * Used to import variables into the compiled template.
  2471. *
  2472. * @memberOf _.templateSettings
  2473. * @type {Object}
  2474. */
  2475. 'imports': {
  2476. /**
  2477. * A reference to the `lodash` function.
  2478. *
  2479. * @memberOf _.templateSettings.imports
  2480. * @type {Function}
  2481. */
  2482. '_': lodash
  2483. }
  2484. };
  2485. // Ensure wrappers are instances of `baseLodash`.
  2486. lodash.prototype = baseLodash.prototype;
  2487. lodash.prototype.constructor = lodash;
  2488. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  2489. LodashWrapper.prototype.constructor = LodashWrapper;
  2490. /*------------------------------------------------------------------------*/
  2491. /**
  2492. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  2493. *
  2494. * @private
  2495. * @constructor
  2496. * @param {*} value The value to wrap.
  2497. */
  2498. function LazyWrapper(value) {
  2499. this.__wrapped__ = value;
  2500. this.__actions__ = [];
  2501. this.__dir__ = 1;
  2502. this.__filtered__ = false;
  2503. this.__iteratees__ = [];
  2504. this.__takeCount__ = MAX_ARRAY_LENGTH;
  2505. this.__views__ = [];
  2506. }
  2507. /**
  2508. * Creates a clone of the lazy wrapper object.
  2509. *
  2510. * @private
  2511. * @name clone
  2512. * @memberOf LazyWrapper
  2513. * @returns {Object} Returns the cloned `LazyWrapper` object.
  2514. */
  2515. function lazyClone() {
  2516. var result = new LazyWrapper(this.__wrapped__);
  2517. result.__actions__ = copyArray(this.__actions__);
  2518. result.__dir__ = this.__dir__;
  2519. result.__filtered__ = this.__filtered__;
  2520. result.__iteratees__ = copyArray(this.__iteratees__);
  2521. result.__takeCount__ = this.__takeCount__;
  2522. result.__views__ = copyArray(this.__views__);
  2523. return result;
  2524. }
  2525. /**
  2526. * Reverses the direction of lazy iteration.
  2527. *
  2528. * @private
  2529. * @name reverse
  2530. * @memberOf LazyWrapper
  2531. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  2532. */
  2533. function lazyReverse() {
  2534. if (this.__filtered__) {
  2535. var result = new LazyWrapper(this);
  2536. result.__dir__ = -1;
  2537. result.__filtered__ = true;
  2538. } else {
  2539. result = this.clone();
  2540. result.__dir__ *= -1;
  2541. }
  2542. return result;
  2543. }
  2544. /**
  2545. * Extracts the unwrapped value from its lazy wrapper.
  2546. *
  2547. * @private
  2548. * @name value
  2549. * @memberOf LazyWrapper
  2550. * @returns {*} Returns the unwrapped value.
  2551. */
  2552. function lazyValue() {
  2553. var array = this.__wrapped__.value(),
  2554. dir = this.__dir__,
  2555. isArr = isArray(array),
  2556. isRight = dir < 0,
  2557. arrLength = isArr ? array.length : 0,
  2558. view = getView(0, arrLength, this.__views__),
  2559. start = view.start,
  2560. end = view.end,
  2561. length = end - start,
  2562. index = isRight ? end : (start - 1),
  2563. iteratees = this.__iteratees__,
  2564. iterLength = iteratees.length,
  2565. resIndex = 0,
  2566. takeCount = nativeMin(length, this.__takeCount__);
  2567. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  2568. return baseWrapperValue(array, this.__actions__);
  2569. }
  2570. var result = [];
  2571. outer:
  2572. while (length-- && resIndex < takeCount) {
  2573. index += dir;
  2574. var iterIndex = -1,
  2575. value = array[index];
  2576. while (++iterIndex < iterLength) {
  2577. var data = iteratees[iterIndex],
  2578. iteratee = data.iteratee,
  2579. type = data.type,
  2580. computed = iteratee(value);
  2581. if (type == LAZY_MAP_FLAG) {
  2582. value = computed;
  2583. } else if (!computed) {
  2584. if (type == LAZY_FILTER_FLAG) {
  2585. continue outer;
  2586. } else {
  2587. break outer;
  2588. }
  2589. }
  2590. }
  2591. result[resIndex++] = value;
  2592. }
  2593. return result;
  2594. }
  2595. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  2596. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  2597. LazyWrapper.prototype.constructor = LazyWrapper;
  2598. /*------------------------------------------------------------------------*/
  2599. /**
  2600. * Creates a hash object.
  2601. *
  2602. * @private
  2603. * @constructor
  2604. * @param {Array} [entries] The key-value pairs to cache.
  2605. */
  2606. function Hash(entries) {
  2607. var index = -1,
  2608. length = entries == null ? 0 : entries.length;
  2609. this.clear();
  2610. while (++index < length) {
  2611. var entry = entries[index];
  2612. this.set(entry[0], entry[1]);
  2613. }
  2614. }
  2615. /**
  2616. * Removes all key-value entries from the hash.
  2617. *
  2618. * @private
  2619. * @name clear
  2620. * @memberOf Hash
  2621. */
  2622. function hashClear() {
  2623. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2624. this.size = 0;
  2625. }
  2626. /**
  2627. * Removes `key` and its value from the hash.
  2628. *
  2629. * @private
  2630. * @name delete
  2631. * @memberOf Hash
  2632. * @param {Object} hash The hash to modify.
  2633. * @param {string} key The key of the value to remove.
  2634. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2635. */
  2636. function hashDelete(key) {
  2637. var result = this.has(key) && delete this.__data__[key];
  2638. this.size -= result ? 1 : 0;
  2639. return result;
  2640. }
  2641. /**
  2642. * Gets the hash value for `key`.
  2643. *
  2644. * @private
  2645. * @name get
  2646. * @memberOf Hash
  2647. * @param {string} key The key of the value to get.
  2648. * @returns {*} Returns the entry value.
  2649. */
  2650. function hashGet(key) {
  2651. var data = this.__data__;
  2652. if (nativeCreate) {
  2653. var result = data[key];
  2654. return result === HASH_UNDEFINED ? undefined : result;
  2655. }
  2656. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  2657. }
  2658. /**
  2659. * Checks if a hash value for `key` exists.
  2660. *
  2661. * @private
  2662. * @name has
  2663. * @memberOf Hash
  2664. * @param {string} key The key of the entry to check.
  2665. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2666. */
  2667. function hashHas(key) {
  2668. var data = this.__data__;
  2669. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  2670. }
  2671. /**
  2672. * Sets the hash `key` to `value`.
  2673. *
  2674. * @private
  2675. * @name set
  2676. * @memberOf Hash
  2677. * @param {string} key The key of the value to set.
  2678. * @param {*} value The value to set.
  2679. * @returns {Object} Returns the hash instance.
  2680. */
  2681. function hashSet(key, value) {
  2682. var data = this.__data__;
  2683. this.size += this.has(key) ? 0 : 1;
  2684. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  2685. return this;
  2686. }
  2687. // Add methods to `Hash`.
  2688. Hash.prototype.clear = hashClear;
  2689. Hash.prototype['delete'] = hashDelete;
  2690. Hash.prototype.get = hashGet;
  2691. Hash.prototype.has = hashHas;
  2692. Hash.prototype.set = hashSet;
  2693. /*------------------------------------------------------------------------*/
  2694. /**
  2695. * Creates an list cache object.
  2696. *
  2697. * @private
  2698. * @constructor
  2699. * @param {Array} [entries] The key-value pairs to cache.
  2700. */
  2701. function ListCache(entries) {
  2702. var index = -1,
  2703. length = entries == null ? 0 : entries.length;
  2704. this.clear();
  2705. while (++index < length) {
  2706. var entry = entries[index];
  2707. this.set(entry[0], entry[1]);
  2708. }
  2709. }
  2710. /**
  2711. * Removes all key-value entries from the list cache.
  2712. *
  2713. * @private
  2714. * @name clear
  2715. * @memberOf ListCache
  2716. */
  2717. function listCacheClear() {
  2718. this.__data__ = [];
  2719. this.size = 0;
  2720. }
  2721. /**
  2722. * Removes `key` and its value from the list cache.
  2723. *
  2724. * @private
  2725. * @name delete
  2726. * @memberOf ListCache
  2727. * @param {string} key The key of the value to remove.
  2728. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2729. */
  2730. function listCacheDelete(key) {
  2731. var data = this.__data__,
  2732. index = assocIndexOf(data, key);
  2733. if (index < 0) {
  2734. return false;
  2735. }
  2736. var lastIndex = data.length - 1;
  2737. if (index == lastIndex) {
  2738. data.pop();
  2739. } else {
  2740. splice.call(data, index, 1);
  2741. }
  2742. --this.size;
  2743. return true;
  2744. }
  2745. /**
  2746. * Gets the list cache value for `key`.
  2747. *
  2748. * @private
  2749. * @name get
  2750. * @memberOf ListCache
  2751. * @param {string} key The key of the value to get.
  2752. * @returns {*} Returns the entry value.
  2753. */
  2754. function listCacheGet(key) {
  2755. var data = this.__data__,
  2756. index = assocIndexOf(data, key);
  2757. return index < 0 ? undefined : data[index][1];
  2758. }
  2759. /**
  2760. * Checks if a list cache value for `key` exists.
  2761. *
  2762. * @private
  2763. * @name has
  2764. * @memberOf ListCache
  2765. * @param {string} key The key of the entry to check.
  2766. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2767. */
  2768. function listCacheHas(key) {
  2769. return assocIndexOf(this.__data__, key) > -1;
  2770. }
  2771. /**
  2772. * Sets the list cache `key` to `value`.
  2773. *
  2774. * @private
  2775. * @name set
  2776. * @memberOf ListCache
  2777. * @param {string} key The key of the value to set.
  2778. * @param {*} value The value to set.
  2779. * @returns {Object} Returns the list cache instance.
  2780. */
  2781. function listCacheSet(key, value) {
  2782. var data = this.__data__,
  2783. index = assocIndexOf(data, key);
  2784. if (index < 0) {
  2785. ++this.size;
  2786. data.push([key, value]);
  2787. } else {
  2788. data[index][1] = value;
  2789. }
  2790. return this;
  2791. }
  2792. // Add methods to `ListCache`.
  2793. ListCache.prototype.clear = listCacheClear;
  2794. ListCache.prototype['delete'] = listCacheDelete;
  2795. ListCache.prototype.get = listCacheGet;
  2796. ListCache.prototype.has = listCacheHas;
  2797. ListCache.prototype.set = listCacheSet;
  2798. /*------------------------------------------------------------------------*/
  2799. /**
  2800. * Creates a map cache object to store key-value pairs.
  2801. *
  2802. * @private
  2803. * @constructor
  2804. * @param {Array} [entries] The key-value pairs to cache.
  2805. */
  2806. function MapCache(entries) {
  2807. var index = -1,
  2808. length = entries == null ? 0 : entries.length;
  2809. this.clear();
  2810. while (++index < length) {
  2811. var entry = entries[index];
  2812. this.set(entry[0], entry[1]);
  2813. }
  2814. }
  2815. /**
  2816. * Removes all key-value entries from the map.
  2817. *
  2818. * @private
  2819. * @name clear
  2820. * @memberOf MapCache
  2821. */
  2822. function mapCacheClear() {
  2823. this.size = 0;
  2824. this.__data__ = {
  2825. 'hash': new Hash,
  2826. 'map': new (Map || ListCache),
  2827. 'string': new Hash
  2828. };
  2829. }
  2830. /**
  2831. * Removes `key` and its value from the map.
  2832. *
  2833. * @private
  2834. * @name delete
  2835. * @memberOf MapCache
  2836. * @param {string} key The key of the value to remove.
  2837. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2838. */
  2839. function mapCacheDelete(key) {
  2840. var result = getMapData(this, key)['delete'](key);
  2841. this.size -= result ? 1 : 0;
  2842. return result;
  2843. }
  2844. /**
  2845. * Gets the map value for `key`.
  2846. *
  2847. * @private
  2848. * @name get
  2849. * @memberOf MapCache
  2850. * @param {string} key The key of the value to get.
  2851. * @returns {*} Returns the entry value.
  2852. */
  2853. function mapCacheGet(key) {
  2854. return getMapData(this, key).get(key);
  2855. }
  2856. /**
  2857. * Checks if a map value for `key` exists.
  2858. *
  2859. * @private
  2860. * @name has
  2861. * @memberOf MapCache
  2862. * @param {string} key The key of the entry to check.
  2863. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2864. */
  2865. function mapCacheHas(key) {
  2866. return getMapData(this, key).has(key);
  2867. }
  2868. /**
  2869. * Sets the map `key` to `value`.
  2870. *
  2871. * @private
  2872. * @name set
  2873. * @memberOf MapCache
  2874. * @param {string} key The key of the value to set.
  2875. * @param {*} value The value to set.
  2876. * @returns {Object} Returns the map cache instance.
  2877. */
  2878. function mapCacheSet(key, value) {
  2879. var data = getMapData(this, key),
  2880. size = data.size;
  2881. data.set(key, value);
  2882. this.size += data.size == size ? 0 : 1;
  2883. return this;
  2884. }
  2885. // Add methods to `MapCache`.
  2886. MapCache.prototype.clear = mapCacheClear;
  2887. MapCache.prototype['delete'] = mapCacheDelete;
  2888. MapCache.prototype.get = mapCacheGet;
  2889. MapCache.prototype.has = mapCacheHas;
  2890. MapCache.prototype.set = mapCacheSet;
  2891. /*------------------------------------------------------------------------*/
  2892. /**
  2893. *
  2894. * Creates an array cache object to store unique values.
  2895. *
  2896. * @private
  2897. * @constructor
  2898. * @param {Array} [values] The values to cache.
  2899. */
  2900. function SetCache(values) {
  2901. var index = -1,
  2902. length = values == null ? 0 : values.length;
  2903. this.__data__ = new MapCache;
  2904. while (++index < length) {
  2905. this.add(values[index]);
  2906. }
  2907. }
  2908. /**
  2909. * Adds `value` to the array cache.
  2910. *
  2911. * @private
  2912. * @name add
  2913. * @memberOf SetCache
  2914. * @alias push
  2915. * @param {*} value The value to cache.
  2916. * @returns {Object} Returns the cache instance.
  2917. */
  2918. function setCacheAdd(value) {
  2919. this.__data__.set(value, HASH_UNDEFINED);
  2920. return this;
  2921. }
  2922. /**
  2923. * Checks if `value` is in the array cache.
  2924. *
  2925. * @private
  2926. * @name has
  2927. * @memberOf SetCache
  2928. * @param {*} value The value to search for.
  2929. * @returns {number} Returns `true` if `value` is found, else `false`.
  2930. */
  2931. function setCacheHas(value) {
  2932. return this.__data__.has(value);
  2933. }
  2934. // Add methods to `SetCache`.
  2935. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2936. SetCache.prototype.has = setCacheHas;
  2937. /*------------------------------------------------------------------------*/
  2938. /**
  2939. * Creates a stack cache object to store key-value pairs.
  2940. *
  2941. * @private
  2942. * @constructor
  2943. * @param {Array} [entries] The key-value pairs to cache.
  2944. */
  2945. function Stack(entries) {
  2946. var data = this.__data__ = new ListCache(entries);
  2947. this.size = data.size;
  2948. }
  2949. /**
  2950. * Removes all key-value entries from the stack.
  2951. *
  2952. * @private
  2953. * @name clear
  2954. * @memberOf Stack
  2955. */
  2956. function stackClear() {
  2957. this.__data__ = new ListCache;
  2958. this.size = 0;
  2959. }
  2960. /**
  2961. * Removes `key` and its value from the stack.
  2962. *
  2963. * @private
  2964. * @name delete
  2965. * @memberOf Stack
  2966. * @param {string} key The key of the value to remove.
  2967. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2968. */
  2969. function stackDelete(key) {
  2970. var data = this.__data__,
  2971. result = data['delete'](key);
  2972. this.size = data.size;
  2973. return result;
  2974. }
  2975. /**
  2976. * Gets the stack value for `key`.
  2977. *
  2978. * @private
  2979. * @name get
  2980. * @memberOf Stack
  2981. * @param {string} key The key of the value to get.
  2982. * @returns {*} Returns the entry value.
  2983. */
  2984. function stackGet(key) {
  2985. return this.__data__.get(key);
  2986. }
  2987. /**
  2988. * Checks if a stack value for `key` exists.
  2989. *
  2990. * @private
  2991. * @name has
  2992. * @memberOf Stack
  2993. * @param {string} key The key of the entry to check.
  2994. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2995. */
  2996. function stackHas(key) {
  2997. return this.__data__.has(key);
  2998. }
  2999. /**
  3000. * Sets the stack `key` to `value`.
  3001. *
  3002. * @private
  3003. * @name set
  3004. * @memberOf Stack
  3005. * @param {string} key The key of the value to set.
  3006. * @param {*} value The value to set.
  3007. * @returns {Object} Returns the stack cache instance.
  3008. */
  3009. function stackSet(key, value) {
  3010. var data = this.__data__;
  3011. if (data instanceof ListCache) {
  3012. var pairs = data.__data__;
  3013. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3014. pairs.push([key, value]);
  3015. this.size = ++data.size;
  3016. return this;
  3017. }
  3018. data = this.__data__ = new MapCache(pairs);
  3019. }
  3020. data.set(key, value);
  3021. this.size = data.size;
  3022. return this;
  3023. }
  3024. // Add methods to `Stack`.
  3025. Stack.prototype.clear = stackClear;
  3026. Stack.prototype['delete'] = stackDelete;
  3027. Stack.prototype.get = stackGet;
  3028. Stack.prototype.has = stackHas;
  3029. Stack.prototype.set = stackSet;
  3030. /*------------------------------------------------------------------------*/
  3031. /**
  3032. * Creates an array of the enumerable property names of the array-like `value`.
  3033. *
  3034. * @private
  3035. * @param {*} value The value to query.
  3036. * @param {boolean} inherited Specify returning inherited property names.
  3037. * @returns {Array} Returns the array of property names.
  3038. */
  3039. function arrayLikeKeys(value, inherited) {
  3040. var isArr = isArray(value),
  3041. isArg = !isArr && isArguments(value),
  3042. isBuff = !isArr && !isArg && isBuffer(value),
  3043. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  3044. skipIndexes = isArr || isArg || isBuff || isType,
  3045. result = skipIndexes ? baseTimes(value.length, String) : [],
  3046. length = result.length;
  3047. for (var key in value) {
  3048. if ((inherited || hasOwnProperty.call(value, key)) &&
  3049. !(skipIndexes && (
  3050. // Safari 9 has enumerable `arguments.length` in strict mode.
  3051. key == 'length' ||
  3052. // Node.js 0.10 has enumerable non-index properties on buffers.
  3053. (isBuff && (key == 'offset' || key == 'parent')) ||
  3054. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3055. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  3056. // Skip index properties.
  3057. isIndex(key, length)
  3058. ))) {
  3059. result.push(key);
  3060. }
  3061. }
  3062. return result;
  3063. }
  3064. /**
  3065. * A specialized version of `_.sample` for arrays.
  3066. *
  3067. * @private
  3068. * @param {Array} array The array to sample.
  3069. * @returns {*} Returns the random element.
  3070. */
  3071. function arraySample(array) {
  3072. var length = array.length;
  3073. return length ? array[baseRandom(0, length - 1)] : undefined;
  3074. }
  3075. /**
  3076. * A specialized version of `_.sampleSize` for arrays.
  3077. *
  3078. * @private
  3079. * @param {Array} array The array to sample.
  3080. * @param {number} n The number of elements to sample.
  3081. * @returns {Array} Returns the random elements.
  3082. */
  3083. function arraySampleSize(array, n) {
  3084. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  3085. }
  3086. /**
  3087. * A specialized version of `_.shuffle` for arrays.
  3088. *
  3089. * @private
  3090. * @param {Array} array The array to shuffle.
  3091. * @returns {Array} Returns the new shuffled array.
  3092. */
  3093. function arrayShuffle(array) {
  3094. return shuffleSelf(copyArray(array));
  3095. }
  3096. /**
  3097. * This function is like `assignValue` except that it doesn't assign
  3098. * `undefined` values.
  3099. *
  3100. * @private
  3101. * @param {Object} object The object to modify.
  3102. * @param {string} key The key of the property to assign.
  3103. * @param {*} value The value to assign.
  3104. */
  3105. function assignMergeValue(object, key, value) {
  3106. if ((value !== undefined && !eq(object[key], value)) ||
  3107. (value === undefined && !(key in object))) {
  3108. baseAssignValue(object, key, value);
  3109. }
  3110. }
  3111. /**
  3112. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3113. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3114. * for equality comparisons.
  3115. *
  3116. * @private
  3117. * @param {Object} object The object to modify.
  3118. * @param {string} key The key of the property to assign.
  3119. * @param {*} value The value to assign.
  3120. */
  3121. function assignValue(object, key, value) {
  3122. var objValue = object[key];
  3123. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3124. (value === undefined && !(key in object))) {
  3125. baseAssignValue(object, key, value);
  3126. }
  3127. }
  3128. /**
  3129. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3130. *
  3131. * @private
  3132. * @param {Array} array The array to inspect.
  3133. * @param {*} key The key to search for.
  3134. * @returns {number} Returns the index of the matched value, else `-1`.
  3135. */
  3136. function assocIndexOf(array, key) {
  3137. var length = array.length;
  3138. while (length--) {
  3139. if (eq(array[length][0], key)) {
  3140. return length;
  3141. }
  3142. }
  3143. return -1;
  3144. }
  3145. /**
  3146. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3147. * by `iteratee` and values set by `setter`.
  3148. *
  3149. * @private
  3150. * @param {Array|Object} collection The collection to iterate over.
  3151. * @param {Function} setter The function to set `accumulator` values.
  3152. * @param {Function} iteratee The iteratee to transform keys.
  3153. * @param {Object} accumulator The initial aggregated object.
  3154. * @returns {Function} Returns `accumulator`.
  3155. */
  3156. function baseAggregator(collection, setter, iteratee, accumulator) {
  3157. baseEach(collection, function(value, key, collection) {
  3158. setter(accumulator, value, iteratee(value), collection);
  3159. });
  3160. return accumulator;
  3161. }
  3162. /**
  3163. * The base implementation of `_.assign` without support for multiple sources
  3164. * or `customizer` functions.
  3165. *
  3166. * @private
  3167. * @param {Object} object The destination object.
  3168. * @param {Object} source The source object.
  3169. * @returns {Object} Returns `object`.
  3170. */
  3171. function baseAssign(object, source) {
  3172. return object && copyObject(source, keys(source), object);
  3173. }
  3174. /**
  3175. * The base implementation of `_.assignIn` without support for multiple sources
  3176. * or `customizer` functions.
  3177. *
  3178. * @private
  3179. * @param {Object} object The destination object.
  3180. * @param {Object} source The source object.
  3181. * @returns {Object} Returns `object`.
  3182. */
  3183. function baseAssignIn(object, source) {
  3184. return object && copyObject(source, keysIn(source), object);
  3185. }
  3186. /**
  3187. * The base implementation of `assignValue` and `assignMergeValue` without
  3188. * value checks.
  3189. *
  3190. * @private
  3191. * @param {Object} object The object to modify.
  3192. * @param {string} key The key of the property to assign.
  3193. * @param {*} value The value to assign.
  3194. */
  3195. function baseAssignValue(object, key, value) {
  3196. if (key == '__proto__' && defineProperty) {
  3197. defineProperty(object, key, {
  3198. 'configurable': true,
  3199. 'enumerable': true,
  3200. 'value': value,
  3201. 'writable': true
  3202. });
  3203. } else {
  3204. object[key] = value;
  3205. }
  3206. }
  3207. /**
  3208. * The base implementation of `_.at` without support for individual paths.
  3209. *
  3210. * @private
  3211. * @param {Object} object The object to iterate over.
  3212. * @param {string[]} paths The property paths to pick.
  3213. * @returns {Array} Returns the picked elements.
  3214. */
  3215. function baseAt(object, paths) {
  3216. var index = -1,
  3217. length = paths.length,
  3218. result = Array(length),
  3219. skip = object == null;
  3220. while (++index < length) {
  3221. result[index] = skip ? undefined : get(object, paths[index]);
  3222. }
  3223. return result;
  3224. }
  3225. /**
  3226. * The base implementation of `_.clamp` which doesn't coerce arguments.
  3227. *
  3228. * @private
  3229. * @param {number} number The number to clamp.
  3230. * @param {number} [lower] The lower bound.
  3231. * @param {number} upper The upper bound.
  3232. * @returns {number} Returns the clamped number.
  3233. */
  3234. function baseClamp(number, lower, upper) {
  3235. if (number === number) {
  3236. if (upper !== undefined) {
  3237. number = number <= upper ? number : upper;
  3238. }
  3239. if (lower !== undefined) {
  3240. number = number >= lower ? number : lower;
  3241. }
  3242. }
  3243. return number;
  3244. }
  3245. /**
  3246. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3247. * traversed objects.
  3248. *
  3249. * @private
  3250. * @param {*} value The value to clone.
  3251. * @param {boolean} bitmask The bitmask flags.
  3252. * 1 - Deep clone
  3253. * 2 - Flatten inherited properties
  3254. * 4 - Clone symbols
  3255. * @param {Function} [customizer] The function to customize cloning.
  3256. * @param {string} [key] The key of `value`.
  3257. * @param {Object} [object] The parent object of `value`.
  3258. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3259. * @returns {*} Returns the cloned value.
  3260. */
  3261. function baseClone(value, bitmask, customizer, key, object, stack) {
  3262. var result,
  3263. isDeep = bitmask & CLONE_DEEP_FLAG,
  3264. isFlat = bitmask & CLONE_FLAT_FLAG,
  3265. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  3266. if (customizer) {
  3267. result = object ? customizer(value, key, object, stack) : customizer(value);
  3268. }
  3269. if (result !== undefined) {
  3270. return result;
  3271. }
  3272. if (!isObject(value)) {
  3273. return value;
  3274. }
  3275. var isArr = isArray(value);
  3276. if (isArr) {
  3277. result = initCloneArray(value);
  3278. if (!isDeep) {
  3279. return copyArray(value, result);
  3280. }
  3281. } else {
  3282. var tag = getTag(value),
  3283. isFunc = tag == funcTag || tag == genTag;
  3284. if (isBuffer(value)) {
  3285. return cloneBuffer(value, isDeep);
  3286. }
  3287. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  3288. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  3289. if (!isDeep) {
  3290. return isFlat
  3291. ? copySymbolsIn(value, baseAssignIn(result, value))
  3292. : copySymbols(value, baseAssign(result, value));
  3293. }
  3294. } else {
  3295. if (!cloneableTags[tag]) {
  3296. return object ? value : {};
  3297. }
  3298. result = initCloneByTag(value, tag, isDeep);
  3299. }
  3300. }
  3301. // Check for circular references and return its corresponding clone.
  3302. stack || (stack = new Stack);
  3303. var stacked = stack.get(value);
  3304. if (stacked) {
  3305. return stacked;
  3306. }
  3307. stack.set(value, result);
  3308. if (isSet(value)) {
  3309. value.forEach(function(subValue) {
  3310. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  3311. });
  3312. return result;
  3313. }
  3314. if (isMap(value)) {
  3315. value.forEach(function(subValue, key) {
  3316. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3317. });
  3318. return result;
  3319. }
  3320. var keysFunc = isFull
  3321. ? (isFlat ? getAllKeysIn : getAllKeys)
  3322. : (isFlat ? keysIn : keys);
  3323. var props = isArr ? undefined : keysFunc(value);
  3324. arrayEach(props || value, function(subValue, key) {
  3325. if (props) {
  3326. key = subValue;
  3327. subValue = value[key];
  3328. }
  3329. // Recursively populate clone (susceptible to call stack limits).
  3330. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3331. });
  3332. return result;
  3333. }
  3334. /**
  3335. * The base implementation of `_.conforms` which doesn't clone `source`.
  3336. *
  3337. * @private
  3338. * @param {Object} source The object of property predicates to conform to.
  3339. * @returns {Function} Returns the new spec function.
  3340. */
  3341. function baseConforms(source) {
  3342. var props = keys(source);
  3343. return function(object) {
  3344. return baseConformsTo(object, source, props);
  3345. };
  3346. }
  3347. /**
  3348. * The base implementation of `_.conformsTo` which accepts `props` to check.
  3349. *
  3350. * @private
  3351. * @param {Object} object The object to inspect.
  3352. * @param {Object} source The object of property predicates to conform to.
  3353. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  3354. */
  3355. function baseConformsTo(object, source, props) {
  3356. var length = props.length;
  3357. if (object == null) {
  3358. return !length;
  3359. }
  3360. object = Object(object);
  3361. while (length--) {
  3362. var key = props[length],
  3363. predicate = source[key],
  3364. value = object[key];
  3365. if ((value === undefined && !(key in object)) || !predicate(value)) {
  3366. return false;
  3367. }
  3368. }
  3369. return true;
  3370. }
  3371. /**
  3372. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  3373. * to provide to `func`.
  3374. *
  3375. * @private
  3376. * @param {Function} func The function to delay.
  3377. * @param {number} wait The number of milliseconds to delay invocation.
  3378. * @param {Array} args The arguments to provide to `func`.
  3379. * @returns {number|Object} Returns the timer id or timeout object.
  3380. */
  3381. function baseDelay(func, wait, args) {
  3382. if (typeof func != 'function') {
  3383. throw new TypeError(FUNC_ERROR_TEXT);
  3384. }
  3385. return setTimeout(function() { func.apply(undefined, args); }, wait);
  3386. }
  3387. /**
  3388. * The base implementation of methods like `_.difference` without support
  3389. * for excluding multiple arrays or iteratee shorthands.
  3390. *
  3391. * @private
  3392. * @param {Array} array The array to inspect.
  3393. * @param {Array} values The values to exclude.
  3394. * @param {Function} [iteratee] The iteratee invoked per element.
  3395. * @param {Function} [comparator] The comparator invoked per element.
  3396. * @returns {Array} Returns the new array of filtered values.
  3397. */
  3398. function baseDifference(array, values, iteratee, comparator) {
  3399. var index = -1,
  3400. includes = arrayIncludes,
  3401. isCommon = true,
  3402. length = array.length,
  3403. result = [],
  3404. valuesLength = values.length;
  3405. if (!length) {
  3406. return result;
  3407. }
  3408. if (iteratee) {
  3409. values = arrayMap(values, baseUnary(iteratee));
  3410. }
  3411. if (comparator) {
  3412. includes = arrayIncludesWith;
  3413. isCommon = false;
  3414. }
  3415. else if (values.length >= LARGE_ARRAY_SIZE) {
  3416. includes = cacheHas;
  3417. isCommon = false;
  3418. values = new SetCache(values);
  3419. }
  3420. outer:
  3421. while (++index < length) {
  3422. var value = array[index],
  3423. computed = iteratee == null ? value : iteratee(value);
  3424. value = (comparator || value !== 0) ? value : 0;
  3425. if (isCommon && computed === computed) {
  3426. var valuesIndex = valuesLength;
  3427. while (valuesIndex--) {
  3428. if (values[valuesIndex] === computed) {
  3429. continue outer;
  3430. }
  3431. }
  3432. result.push(value);
  3433. }
  3434. else if (!includes(values, computed, comparator)) {
  3435. result.push(value);
  3436. }
  3437. }
  3438. return result;
  3439. }
  3440. /**
  3441. * The base implementation of `_.forEach` without support for iteratee shorthands.
  3442. *
  3443. * @private
  3444. * @param {Array|Object} collection The collection to iterate over.
  3445. * @param {Function} iteratee The function invoked per iteration.
  3446. * @returns {Array|Object} Returns `collection`.
  3447. */
  3448. var baseEach = createBaseEach(baseForOwn);
  3449. /**
  3450. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  3451. *
  3452. * @private
  3453. * @param {Array|Object} collection The collection to iterate over.
  3454. * @param {Function} iteratee The function invoked per iteration.
  3455. * @returns {Array|Object} Returns `collection`.
  3456. */
  3457. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3458. /**
  3459. * The base implementation of `_.every` without support for iteratee shorthands.
  3460. *
  3461. * @private
  3462. * @param {Array|Object} collection The collection to iterate over.
  3463. * @param {Function} predicate The function invoked per iteration.
  3464. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  3465. * else `false`
  3466. */
  3467. function baseEvery(collection, predicate) {
  3468. var result = true;
  3469. baseEach(collection, function(value, index, collection) {
  3470. result = !!predicate(value, index, collection);
  3471. return result;
  3472. });
  3473. return result;
  3474. }
  3475. /**
  3476. * The base implementation of methods like `_.max` and `_.min` which accepts a
  3477. * `comparator` to determine the extremum value.
  3478. *
  3479. * @private
  3480. * @param {Array} array The array to iterate over.
  3481. * @param {Function} iteratee The iteratee invoked per iteration.
  3482. * @param {Function} comparator The comparator used to compare values.
  3483. * @returns {*} Returns the extremum value.
  3484. */
  3485. function baseExtremum(array, iteratee, comparator) {
  3486. var index = -1,
  3487. length = array.length;
  3488. while (++index < length) {
  3489. var value = array[index],
  3490. current = iteratee(value);
  3491. if (current != null && (computed === undefined
  3492. ? (current === current && !isSymbol(current))
  3493. : comparator(current, computed)
  3494. )) {
  3495. var computed = current,
  3496. result = value;
  3497. }
  3498. }
  3499. return result;
  3500. }
  3501. /**
  3502. * The base implementation of `_.fill` without an iteratee call guard.
  3503. *
  3504. * @private
  3505. * @param {Array} array The array to fill.
  3506. * @param {*} value The value to fill `array` with.
  3507. * @param {number} [start=0] The start position.
  3508. * @param {number} [end=array.length] The end position.
  3509. * @returns {Array} Returns `array`.
  3510. */
  3511. function baseFill(array, value, start, end) {
  3512. var length = array.length;
  3513. start = toInteger(start);
  3514. if (start < 0) {
  3515. start = -start > length ? 0 : (length + start);
  3516. }
  3517. end = (end === undefined || end > length) ? length : toInteger(end);
  3518. if (end < 0) {
  3519. end += length;
  3520. }
  3521. end = start > end ? 0 : toLength(end);
  3522. while (start < end) {
  3523. array[start++] = value;
  3524. }
  3525. return array;
  3526. }
  3527. /**
  3528. * The base implementation of `_.filter` without support for iteratee shorthands.
  3529. *
  3530. * @private
  3531. * @param {Array|Object} collection The collection to iterate over.
  3532. * @param {Function} predicate The function invoked per iteration.
  3533. * @returns {Array} Returns the new filtered array.
  3534. */
  3535. function baseFilter(collection, predicate) {
  3536. var result = [];
  3537. baseEach(collection, function(value, index, collection) {
  3538. if (predicate(value, index, collection)) {
  3539. result.push(value);
  3540. }
  3541. });
  3542. return result;
  3543. }
  3544. /**
  3545. * The base implementation of `_.flatten` with support for restricting flattening.
  3546. *
  3547. * @private
  3548. * @param {Array} array The array to flatten.
  3549. * @param {number} depth The maximum recursion depth.
  3550. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  3551. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  3552. * @param {Array} [result=[]] The initial result value.
  3553. * @returns {Array} Returns the new flattened array.
  3554. */
  3555. function baseFlatten(array, depth, predicate, isStrict, result) {
  3556. var index = -1,
  3557. length = array.length;
  3558. predicate || (predicate = isFlattenable);
  3559. result || (result = []);
  3560. while (++index < length) {
  3561. var value = array[index];
  3562. if (depth > 0 && predicate(value)) {
  3563. if (depth > 1) {
  3564. // Recursively flatten arrays (susceptible to call stack limits).
  3565. baseFlatten(value, depth - 1, predicate, isStrict, result);
  3566. } else {
  3567. arrayPush(result, value);
  3568. }
  3569. } else if (!isStrict) {
  3570. result[result.length] = value;
  3571. }
  3572. }
  3573. return result;
  3574. }
  3575. /**
  3576. * The base implementation of `baseForOwn` which iterates over `object`
  3577. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  3578. * Iteratee functions may exit iteration early by explicitly returning `false`.
  3579. *
  3580. * @private
  3581. * @param {Object} object The object to iterate over.
  3582. * @param {Function} iteratee The function invoked per iteration.
  3583. * @param {Function} keysFunc The function to get the keys of `object`.
  3584. * @returns {Object} Returns `object`.
  3585. */
  3586. var baseFor = createBaseFor();
  3587. /**
  3588. * This function is like `baseFor` except that it iterates over properties
  3589. * in the opposite order.
  3590. *
  3591. * @private
  3592. * @param {Object} object The object to iterate over.
  3593. * @param {Function} iteratee The function invoked per iteration.
  3594. * @param {Function} keysFunc The function to get the keys of `object`.
  3595. * @returns {Object} Returns `object`.
  3596. */
  3597. var baseForRight = createBaseFor(true);
  3598. /**
  3599. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  3600. *
  3601. * @private
  3602. * @param {Object} object The object to iterate over.
  3603. * @param {Function} iteratee The function invoked per iteration.
  3604. * @returns {Object} Returns `object`.
  3605. */
  3606. function baseForOwn(object, iteratee) {
  3607. return object && baseFor(object, iteratee, keys);
  3608. }
  3609. /**
  3610. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  3611. *
  3612. * @private
  3613. * @param {Object} object The object to iterate over.
  3614. * @param {Function} iteratee The function invoked per iteration.
  3615. * @returns {Object} Returns `object`.
  3616. */
  3617. function baseForOwnRight(object, iteratee) {
  3618. return object && baseForRight(object, iteratee, keys);
  3619. }
  3620. /**
  3621. * The base implementation of `_.functions` which creates an array of
  3622. * `object` function property names filtered from `props`.
  3623. *
  3624. * @private
  3625. * @param {Object} object The object to inspect.
  3626. * @param {Array} props The property names to filter.
  3627. * @returns {Array} Returns the function names.
  3628. */
  3629. function baseFunctions(object, props) {
  3630. return arrayFilter(props, function(key) {
  3631. return isFunction(object[key]);
  3632. });
  3633. }
  3634. /**
  3635. * The base implementation of `_.get` without support for default values.
  3636. *
  3637. * @private
  3638. * @param {Object} object The object to query.
  3639. * @param {Array|string} path The path of the property to get.
  3640. * @returns {*} Returns the resolved value.
  3641. */
  3642. function baseGet(object, path) {
  3643. path = castPath(path, object);
  3644. var index = 0,
  3645. length = path.length;
  3646. while (object != null && index < length) {
  3647. object = object[toKey(path[index++])];
  3648. }
  3649. return (index && index == length) ? object : undefined;
  3650. }
  3651. /**
  3652. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  3653. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  3654. * symbols of `object`.
  3655. *
  3656. * @private
  3657. * @param {Object} object The object to query.
  3658. * @param {Function} keysFunc The function to get the keys of `object`.
  3659. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  3660. * @returns {Array} Returns the array of property names and symbols.
  3661. */
  3662. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3663. var result = keysFunc(object);
  3664. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3665. }
  3666. /**
  3667. * The base implementation of `getTag` without fallbacks for buggy environments.
  3668. *
  3669. * @private
  3670. * @param {*} value The value to query.
  3671. * @returns {string} Returns the `toStringTag`.
  3672. */
  3673. function baseGetTag(value) {
  3674. if (value == null) {
  3675. return value === undefined ? undefinedTag : nullTag;
  3676. }
  3677. return (symToStringTag && symToStringTag in Object(value))
  3678. ? getRawTag(value)
  3679. : objectToString(value);
  3680. }
  3681. /**
  3682. * The base implementation of `_.gt` which doesn't coerce arguments.
  3683. *
  3684. * @private
  3685. * @param {*} value The value to compare.
  3686. * @param {*} other The other value to compare.
  3687. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  3688. * else `false`.
  3689. */
  3690. function baseGt(value, other) {
  3691. return value > other;
  3692. }
  3693. /**
  3694. * The base implementation of `_.has` without support for deep paths.
  3695. *
  3696. * @private
  3697. * @param {Object} [object] The object to query.
  3698. * @param {Array|string} key The key to check.
  3699. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3700. */
  3701. function baseHas(object, key) {
  3702. return object != null && hasOwnProperty.call(object, key);
  3703. }
  3704. /**
  3705. * The base implementation of `_.hasIn` without support for deep paths.
  3706. *
  3707. * @private
  3708. * @param {Object} [object] The object to query.
  3709. * @param {Array|string} key The key to check.
  3710. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3711. */
  3712. function baseHasIn(object, key) {
  3713. return object != null && key in Object(object);
  3714. }
  3715. /**
  3716. * The base implementation of `_.inRange` which doesn't coerce arguments.
  3717. *
  3718. * @private
  3719. * @param {number} number The number to check.
  3720. * @param {number} start The start of the range.
  3721. * @param {number} end The end of the range.
  3722. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  3723. */
  3724. function baseInRange(number, start, end) {
  3725. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  3726. }
  3727. /**
  3728. * The base implementation of methods like `_.intersection`, without support
  3729. * for iteratee shorthands, that accepts an array of arrays to inspect.
  3730. *
  3731. * @private
  3732. * @param {Array} arrays The arrays to inspect.
  3733. * @param {Function} [iteratee] The iteratee invoked per element.
  3734. * @param {Function} [comparator] The comparator invoked per element.
  3735. * @returns {Array} Returns the new array of shared values.
  3736. */
  3737. function baseIntersection(arrays, iteratee, comparator) {
  3738. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  3739. length = arrays[0].length,
  3740. othLength = arrays.length,
  3741. othIndex = othLength,
  3742. caches = Array(othLength),
  3743. maxLength = Infinity,
  3744. result = [];
  3745. while (othIndex--) {
  3746. var array = arrays[othIndex];
  3747. if (othIndex && iteratee) {
  3748. array = arrayMap(array, baseUnary(iteratee));
  3749. }
  3750. maxLength = nativeMin(array.length, maxLength);
  3751. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  3752. ? new SetCache(othIndex && array)
  3753. : undefined;
  3754. }
  3755. array = arrays[0];
  3756. var index = -1,
  3757. seen = caches[0];
  3758. outer:
  3759. while (++index < length && result.length < maxLength) {
  3760. var value = array[index],
  3761. computed = iteratee ? iteratee(value) : value;
  3762. value = (comparator || value !== 0) ? value : 0;
  3763. if (!(seen
  3764. ? cacheHas(seen, computed)
  3765. : includes(result, computed, comparator)
  3766. )) {
  3767. othIndex = othLength;
  3768. while (--othIndex) {
  3769. var cache = caches[othIndex];
  3770. if (!(cache
  3771. ? cacheHas(cache, computed)
  3772. : includes(arrays[othIndex], computed, comparator))
  3773. ) {
  3774. continue outer;
  3775. }
  3776. }
  3777. if (seen) {
  3778. seen.push(computed);
  3779. }
  3780. result.push(value);
  3781. }
  3782. }
  3783. return result;
  3784. }
  3785. /**
  3786. * The base implementation of `_.invert` and `_.invertBy` which inverts
  3787. * `object` with values transformed by `iteratee` and set by `setter`.
  3788. *
  3789. * @private
  3790. * @param {Object} object The object to iterate over.
  3791. * @param {Function} setter The function to set `accumulator` values.
  3792. * @param {Function} iteratee The iteratee to transform values.
  3793. * @param {Object} accumulator The initial inverted object.
  3794. * @returns {Function} Returns `accumulator`.
  3795. */
  3796. function baseInverter(object, setter, iteratee, accumulator) {
  3797. baseForOwn(object, function(value, key, object) {
  3798. setter(accumulator, iteratee(value), key, object);
  3799. });
  3800. return accumulator;
  3801. }
  3802. /**
  3803. * The base implementation of `_.invoke` without support for individual
  3804. * method arguments.
  3805. *
  3806. * @private
  3807. * @param {Object} object The object to query.
  3808. * @param {Array|string} path The path of the method to invoke.
  3809. * @param {Array} args The arguments to invoke the method with.
  3810. * @returns {*} Returns the result of the invoked method.
  3811. */
  3812. function baseInvoke(object, path, args) {
  3813. path = castPath(path, object);
  3814. object = parent(object, path);
  3815. var func = object == null ? object : object[toKey(last(path))];
  3816. return func == null ? undefined : apply(func, object, args);
  3817. }
  3818. /**
  3819. * The base implementation of `_.isArguments`.
  3820. *
  3821. * @private
  3822. * @param {*} value The value to check.
  3823. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3824. */
  3825. function baseIsArguments(value) {
  3826. return isObjectLike(value) && baseGetTag(value) == argsTag;
  3827. }
  3828. /**
  3829. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  3830. *
  3831. * @private
  3832. * @param {*} value The value to check.
  3833. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  3834. */
  3835. function baseIsArrayBuffer(value) {
  3836. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  3837. }
  3838. /**
  3839. * The base implementation of `_.isDate` without Node.js optimizations.
  3840. *
  3841. * @private
  3842. * @param {*} value The value to check.
  3843. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  3844. */
  3845. function baseIsDate(value) {
  3846. return isObjectLike(value) && baseGetTag(value) == dateTag;
  3847. }
  3848. /**
  3849. * The base implementation of `_.isEqual` which supports partial comparisons
  3850. * and tracks traversed objects.
  3851. *
  3852. * @private
  3853. * @param {*} value The value to compare.
  3854. * @param {*} other The other value to compare.
  3855. * @param {boolean} bitmask The bitmask flags.
  3856. * 1 - Unordered comparison
  3857. * 2 - Partial comparison
  3858. * @param {Function} [customizer] The function to customize comparisons.
  3859. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  3860. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3861. */
  3862. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3863. if (value === other) {
  3864. return true;
  3865. }
  3866. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  3867. return value !== value && other !== other;
  3868. }
  3869. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3870. }
  3871. /**
  3872. * A specialized version of `baseIsEqual` for arrays and objects which performs
  3873. * deep comparisons and tracks traversed objects enabling objects with circular
  3874. * references to be compared.
  3875. *
  3876. * @private
  3877. * @param {Object} object The object to compare.
  3878. * @param {Object} other The other object to compare.
  3879. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  3880. * @param {Function} customizer The function to customize comparisons.
  3881. * @param {Function} equalFunc The function to determine equivalents of values.
  3882. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  3883. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  3884. */
  3885. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3886. var objIsArr = isArray(object),
  3887. othIsArr = isArray(other),
  3888. objTag = objIsArr ? arrayTag : getTag(object),
  3889. othTag = othIsArr ? arrayTag : getTag(other);
  3890. objTag = objTag == argsTag ? objectTag : objTag;
  3891. othTag = othTag == argsTag ? objectTag : othTag;
  3892. var objIsObj = objTag == objectTag,
  3893. othIsObj = othTag == objectTag,
  3894. isSameTag = objTag == othTag;
  3895. if (isSameTag && isBuffer(object)) {
  3896. if (!isBuffer(other)) {
  3897. return false;
  3898. }
  3899. objIsArr = true;
  3900. objIsObj = false;
  3901. }
  3902. if (isSameTag && !objIsObj) {
  3903. stack || (stack = new Stack);
  3904. return (objIsArr || isTypedArray(object))
  3905. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  3906. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3907. }
  3908. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  3909. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  3910. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  3911. if (objIsWrapped || othIsWrapped) {
  3912. var objUnwrapped = objIsWrapped ? object.value() : object,
  3913. othUnwrapped = othIsWrapped ? other.value() : other;
  3914. stack || (stack = new Stack);
  3915. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3916. }
  3917. }
  3918. if (!isSameTag) {
  3919. return false;
  3920. }
  3921. stack || (stack = new Stack);
  3922. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3923. }
  3924. /**
  3925. * The base implementation of `_.isMap` without Node.js optimizations.
  3926. *
  3927. * @private
  3928. * @param {*} value The value to check.
  3929. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  3930. */
  3931. function baseIsMap(value) {
  3932. return isObjectLike(value) && getTag(value) == mapTag;
  3933. }
  3934. /**
  3935. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  3936. *
  3937. * @private
  3938. * @param {Object} object The object to inspect.
  3939. * @param {Object} source The object of property values to match.
  3940. * @param {Array} matchData The property names, values, and compare flags to match.
  3941. * @param {Function} [customizer] The function to customize comparisons.
  3942. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  3943. */
  3944. function baseIsMatch(object, source, matchData, customizer) {
  3945. var index = matchData.length,
  3946. length = index,
  3947. noCustomizer = !customizer;
  3948. if (object == null) {
  3949. return !length;
  3950. }
  3951. object = Object(object);
  3952. while (index--) {
  3953. var data = matchData[index];
  3954. if ((noCustomizer && data[2])
  3955. ? data[1] !== object[data[0]]
  3956. : !(data[0] in object)
  3957. ) {
  3958. return false;
  3959. }
  3960. }
  3961. while (++index < length) {
  3962. data = matchData[index];
  3963. var key = data[0],
  3964. objValue = object[key],
  3965. srcValue = data[1];
  3966. if (noCustomizer && data[2]) {
  3967. if (objValue === undefined && !(key in object)) {
  3968. return false;
  3969. }
  3970. } else {
  3971. var stack = new Stack;
  3972. if (customizer) {
  3973. var result = customizer(objValue, srcValue, key, object, source, stack);
  3974. }
  3975. if (!(result === undefined
  3976. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  3977. : result
  3978. )) {
  3979. return false;
  3980. }
  3981. }
  3982. }
  3983. return true;
  3984. }
  3985. /**
  3986. * The base implementation of `_.isNative` without bad shim checks.
  3987. *
  3988. * @private
  3989. * @param {*} value The value to check.
  3990. * @returns {boolean} Returns `true` if `value` is a native function,
  3991. * else `false`.
  3992. */
  3993. function baseIsNative(value) {
  3994. if (!isObject(value) || isMasked(value)) {
  3995. return false;
  3996. }
  3997. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  3998. return pattern.test(toSource(value));
  3999. }
  4000. /**
  4001. * The base implementation of `_.isRegExp` without Node.js optimizations.
  4002. *
  4003. * @private
  4004. * @param {*} value The value to check.
  4005. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  4006. */
  4007. function baseIsRegExp(value) {
  4008. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4009. }
  4010. /**
  4011. * The base implementation of `_.isSet` without Node.js optimizations.
  4012. *
  4013. * @private
  4014. * @param {*} value The value to check.
  4015. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  4016. */
  4017. function baseIsSet(value) {
  4018. return isObjectLike(value) && getTag(value) == setTag;
  4019. }
  4020. /**
  4021. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4022. *
  4023. * @private
  4024. * @param {*} value The value to check.
  4025. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4026. */
  4027. function baseIsTypedArray(value) {
  4028. return isObjectLike(value) &&
  4029. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  4030. }
  4031. /**
  4032. * The base implementation of `_.iteratee`.
  4033. *
  4034. * @private
  4035. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4036. * @returns {Function} Returns the iteratee.
  4037. */
  4038. function baseIteratee(value) {
  4039. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4040. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4041. if (typeof value == 'function') {
  4042. return value;
  4043. }
  4044. if (value == null) {
  4045. return identity;
  4046. }
  4047. if (typeof value == 'object') {
  4048. return isArray(value)
  4049. ? baseMatchesProperty(value[0], value[1])
  4050. : baseMatches(value);
  4051. }
  4052. return property(value);
  4053. }
  4054. /**
  4055. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4056. *
  4057. * @private
  4058. * @param {Object} object The object to query.
  4059. * @returns {Array} Returns the array of property names.
  4060. */
  4061. function baseKeys(object) {
  4062. if (!isPrototype(object)) {
  4063. return nativeKeys(object);
  4064. }
  4065. var result = [];
  4066. for (var key in Object(object)) {
  4067. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4068. result.push(key);
  4069. }
  4070. }
  4071. return result;
  4072. }
  4073. /**
  4074. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  4075. *
  4076. * @private
  4077. * @param {Object} object The object to query.
  4078. * @returns {Array} Returns the array of property names.
  4079. */
  4080. function baseKeysIn(object) {
  4081. if (!isObject(object)) {
  4082. return nativeKeysIn(object);
  4083. }
  4084. var isProto = isPrototype(object),
  4085. result = [];
  4086. for (var key in object) {
  4087. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  4088. result.push(key);
  4089. }
  4090. }
  4091. return result;
  4092. }
  4093. /**
  4094. * The base implementation of `_.lt` which doesn't coerce arguments.
  4095. *
  4096. * @private
  4097. * @param {*} value The value to compare.
  4098. * @param {*} other The other value to compare.
  4099. * @returns {boolean} Returns `true` if `value` is less than `other`,
  4100. * else `false`.
  4101. */
  4102. function baseLt(value, other) {
  4103. return value < other;
  4104. }
  4105. /**
  4106. * The base implementation of `_.map` without support for iteratee shorthands.
  4107. *
  4108. * @private
  4109. * @param {Array|Object} collection The collection to iterate over.
  4110. * @param {Function} iteratee The function invoked per iteration.
  4111. * @returns {Array} Returns the new mapped array.
  4112. */
  4113. function baseMap(collection, iteratee) {
  4114. var index = -1,
  4115. result = isArrayLike(collection) ? Array(collection.length) : [];
  4116. baseEach(collection, function(value, key, collection) {
  4117. result[++index] = iteratee(value, key, collection);
  4118. });
  4119. return result;
  4120. }
  4121. /**
  4122. * The base implementation of `_.matches` which doesn't clone `source`.
  4123. *
  4124. * @private
  4125. * @param {Object} source The object of property values to match.
  4126. * @returns {Function} Returns the new spec function.
  4127. */
  4128. function baseMatches(source) {
  4129. var matchData = getMatchData(source);
  4130. if (matchData.length == 1 && matchData[0][2]) {
  4131. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4132. }
  4133. return function(object) {
  4134. return object === source || baseIsMatch(object, source, matchData);
  4135. };
  4136. }
  4137. /**
  4138. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4139. *
  4140. * @private
  4141. * @param {string} path The path of the property to get.
  4142. * @param {*} srcValue The value to match.
  4143. * @returns {Function} Returns the new spec function.
  4144. */
  4145. function baseMatchesProperty(path, srcValue) {
  4146. if (isKey(path) && isStrictComparable(srcValue)) {
  4147. return matchesStrictComparable(toKey(path), srcValue);
  4148. }
  4149. return function(object) {
  4150. var objValue = get(object, path);
  4151. return (objValue === undefined && objValue === srcValue)
  4152. ? hasIn(object, path)
  4153. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4154. };
  4155. }
  4156. /**
  4157. * The base implementation of `_.merge` without support for multiple sources.
  4158. *
  4159. * @private
  4160. * @param {Object} object The destination object.
  4161. * @param {Object} source The source object.
  4162. * @param {number} srcIndex The index of `source`.
  4163. * @param {Function} [customizer] The function to customize merged values.
  4164. * @param {Object} [stack] Tracks traversed source values and their merged
  4165. * counterparts.
  4166. */
  4167. function baseMerge(object, source, srcIndex, customizer, stack) {
  4168. if (object === source) {
  4169. return;
  4170. }
  4171. baseFor(source, function(srcValue, key) {
  4172. if (isObject(srcValue)) {
  4173. stack || (stack = new Stack);
  4174. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4175. }
  4176. else {
  4177. var newValue = customizer
  4178. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  4179. : undefined;
  4180. if (newValue === undefined) {
  4181. newValue = srcValue;
  4182. }
  4183. assignMergeValue(object, key, newValue);
  4184. }
  4185. }, keysIn);
  4186. }
  4187. /**
  4188. * A specialized version of `baseMerge` for arrays and objects which performs
  4189. * deep merges and tracks traversed objects enabling objects with circular
  4190. * references to be merged.
  4191. *
  4192. * @private
  4193. * @param {Object} object The destination object.
  4194. * @param {Object} source The source object.
  4195. * @param {string} key The key of the value to merge.
  4196. * @param {number} srcIndex The index of `source`.
  4197. * @param {Function} mergeFunc The function to merge values.
  4198. * @param {Function} [customizer] The function to customize assigned values.
  4199. * @param {Object} [stack] Tracks traversed source values and their merged
  4200. * counterparts.
  4201. */
  4202. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  4203. var objValue = safeGet(object, key),
  4204. srcValue = safeGet(source, key),
  4205. stacked = stack.get(srcValue);
  4206. if (stacked) {
  4207. assignMergeValue(object, key, stacked);
  4208. return;
  4209. }
  4210. var newValue = customizer
  4211. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  4212. : undefined;
  4213. var isCommon = newValue === undefined;
  4214. if (isCommon) {
  4215. var isArr = isArray(srcValue),
  4216. isBuff = !isArr && isBuffer(srcValue),
  4217. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  4218. newValue = srcValue;
  4219. if (isArr || isBuff || isTyped) {
  4220. if (isArray(objValue)) {
  4221. newValue = objValue;
  4222. }
  4223. else if (isArrayLikeObject(objValue)) {
  4224. newValue = copyArray(objValue);
  4225. }
  4226. else if (isBuff) {
  4227. isCommon = false;
  4228. newValue = cloneBuffer(srcValue, true);
  4229. }
  4230. else if (isTyped) {
  4231. isCommon = false;
  4232. newValue = cloneTypedArray(srcValue, true);
  4233. }
  4234. else {
  4235. newValue = [];
  4236. }
  4237. }
  4238. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4239. newValue = objValue;
  4240. if (isArguments(objValue)) {
  4241. newValue = toPlainObject(objValue);
  4242. }
  4243. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  4244. newValue = initCloneObject(srcValue);
  4245. }
  4246. }
  4247. else {
  4248. isCommon = false;
  4249. }
  4250. }
  4251. if (isCommon) {
  4252. // Recursively merge objects and arrays (susceptible to call stack limits).
  4253. stack.set(srcValue, newValue);
  4254. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4255. stack['delete'](srcValue);
  4256. }
  4257. assignMergeValue(object, key, newValue);
  4258. }
  4259. /**
  4260. * The base implementation of `_.nth` which doesn't coerce arguments.
  4261. *
  4262. * @private
  4263. * @param {Array} array The array to query.
  4264. * @param {number} n The index of the element to return.
  4265. * @returns {*} Returns the nth element of `array`.
  4266. */
  4267. function baseNth(array, n) {
  4268. var length = array.length;
  4269. if (!length) {
  4270. return;
  4271. }
  4272. n += n < 0 ? length : 0;
  4273. return isIndex(n, length) ? array[n] : undefined;
  4274. }
  4275. /**
  4276. * The base implementation of `_.orderBy` without param guards.
  4277. *
  4278. * @private
  4279. * @param {Array|Object} collection The collection to iterate over.
  4280. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  4281. * @param {string[]} orders The sort orders of `iteratees`.
  4282. * @returns {Array} Returns the new sorted array.
  4283. */
  4284. function baseOrderBy(collection, iteratees, orders) {
  4285. var index = -1;
  4286. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  4287. var result = baseMap(collection, function(value, key, collection) {
  4288. var criteria = arrayMap(iteratees, function(iteratee) {
  4289. return iteratee(value);
  4290. });
  4291. return { 'criteria': criteria, 'index': ++index, 'value': value };
  4292. });
  4293. return baseSortBy(result, function(object, other) {
  4294. return compareMultiple(object, other, orders);
  4295. });
  4296. }
  4297. /**
  4298. * The base implementation of `_.pick` without support for individual
  4299. * property identifiers.
  4300. *
  4301. * @private
  4302. * @param {Object} object The source object.
  4303. * @param {string[]} paths The property paths to pick.
  4304. * @returns {Object} Returns the new object.
  4305. */
  4306. function basePick(object, paths) {
  4307. return basePickBy(object, paths, function(value, path) {
  4308. return hasIn(object, path);
  4309. });
  4310. }
  4311. /**
  4312. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  4313. *
  4314. * @private
  4315. * @param {Object} object The source object.
  4316. * @param {string[]} paths The property paths to pick.
  4317. * @param {Function} predicate The function invoked per property.
  4318. * @returns {Object} Returns the new object.
  4319. */
  4320. function basePickBy(object, paths, predicate) {
  4321. var index = -1,
  4322. length = paths.length,
  4323. result = {};
  4324. while (++index < length) {
  4325. var path = paths[index],
  4326. value = baseGet(object, path);
  4327. if (predicate(value, path)) {
  4328. baseSet(result, castPath(path, object), value);
  4329. }
  4330. }
  4331. return result;
  4332. }
  4333. /**
  4334. * A specialized version of `baseProperty` which supports deep paths.
  4335. *
  4336. * @private
  4337. * @param {Array|string} path The path of the property to get.
  4338. * @returns {Function} Returns the new accessor function.
  4339. */
  4340. function basePropertyDeep(path) {
  4341. return function(object) {
  4342. return baseGet(object, path);
  4343. };
  4344. }
  4345. /**
  4346. * The base implementation of `_.pullAllBy` without support for iteratee
  4347. * shorthands.
  4348. *
  4349. * @private
  4350. * @param {Array} array The array to modify.
  4351. * @param {Array} values The values to remove.
  4352. * @param {Function} [iteratee] The iteratee invoked per element.
  4353. * @param {Function} [comparator] The comparator invoked per element.
  4354. * @returns {Array} Returns `array`.
  4355. */
  4356. function basePullAll(array, values, iteratee, comparator) {
  4357. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  4358. index = -1,
  4359. length = values.length,
  4360. seen = array;
  4361. if (array === values) {
  4362. values = copyArray(values);
  4363. }
  4364. if (iteratee) {
  4365. seen = arrayMap(array, baseUnary(iteratee));
  4366. }
  4367. while (++index < length) {
  4368. var fromIndex = 0,
  4369. value = values[index],
  4370. computed = iteratee ? iteratee(value) : value;
  4371. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4372. if (seen !== array) {
  4373. splice.call(seen, fromIndex, 1);
  4374. }
  4375. splice.call(array, fromIndex, 1);
  4376. }
  4377. }
  4378. return array;
  4379. }
  4380. /**
  4381. * The base implementation of `_.pullAt` without support for individual
  4382. * indexes or capturing the removed elements.
  4383. *
  4384. * @private
  4385. * @param {Array} array The array to modify.
  4386. * @param {number[]} indexes The indexes of elements to remove.
  4387. * @returns {Array} Returns `array`.
  4388. */
  4389. function basePullAt(array, indexes) {
  4390. var length = array ? indexes.length : 0,
  4391. lastIndex = length - 1;
  4392. while (length--) {
  4393. var index = indexes[length];
  4394. if (length == lastIndex || index !== previous) {
  4395. var previous = index;
  4396. if (isIndex(index)) {
  4397. splice.call(array, index, 1);
  4398. } else {
  4399. baseUnset(array, index);
  4400. }
  4401. }
  4402. }
  4403. return array;
  4404. }
  4405. /**
  4406. * The base implementation of `_.random` without support for returning
  4407. * floating-point numbers.
  4408. *
  4409. * @private
  4410. * @param {number} lower The lower bound.
  4411. * @param {number} upper The upper bound.
  4412. * @returns {number} Returns the random number.
  4413. */
  4414. function baseRandom(lower, upper) {
  4415. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  4416. }
  4417. /**
  4418. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  4419. * coerce arguments.
  4420. *
  4421. * @private
  4422. * @param {number} start The start of the range.
  4423. * @param {number} end The end of the range.
  4424. * @param {number} step The value to increment or decrement by.
  4425. * @param {boolean} [fromRight] Specify iterating from right to left.
  4426. * @returns {Array} Returns the range of numbers.
  4427. */
  4428. function baseRange(start, end, step, fromRight) {
  4429. var index = -1,
  4430. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  4431. result = Array(length);
  4432. while (length--) {
  4433. result[fromRight ? length : ++index] = start;
  4434. start += step;
  4435. }
  4436. return result;
  4437. }
  4438. /**
  4439. * The base implementation of `_.repeat` which doesn't coerce arguments.
  4440. *
  4441. * @private
  4442. * @param {string} string The string to repeat.
  4443. * @param {number} n The number of times to repeat the string.
  4444. * @returns {string} Returns the repeated string.
  4445. */
  4446. function baseRepeat(string, n) {
  4447. var result = '';
  4448. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  4449. return result;
  4450. }
  4451. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  4452. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  4453. do {
  4454. if (n % 2) {
  4455. result += string;
  4456. }
  4457. n = nativeFloor(n / 2);
  4458. if (n) {
  4459. string += string;
  4460. }
  4461. } while (n);
  4462. return result;
  4463. }
  4464. /**
  4465. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  4466. *
  4467. * @private
  4468. * @param {Function} func The function to apply a rest parameter to.
  4469. * @param {number} [start=func.length-1] The start position of the rest parameter.
  4470. * @returns {Function} Returns the new function.
  4471. */
  4472. function baseRest(func, start) {
  4473. return setToString(overRest(func, start, identity), func + '');
  4474. }
  4475. /**
  4476. * The base implementation of `_.sample`.
  4477. *
  4478. * @private
  4479. * @param {Array|Object} collection The collection to sample.
  4480. * @returns {*} Returns the random element.
  4481. */
  4482. function baseSample(collection) {
  4483. return arraySample(values(collection));
  4484. }
  4485. /**
  4486. * The base implementation of `_.sampleSize` without param guards.
  4487. *
  4488. * @private
  4489. * @param {Array|Object} collection The collection to sample.
  4490. * @param {number} n The number of elements to sample.
  4491. * @returns {Array} Returns the random elements.
  4492. */
  4493. function baseSampleSize(collection, n) {
  4494. var array = values(collection);
  4495. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4496. }
  4497. /**
  4498. * The base implementation of `_.set`.
  4499. *
  4500. * @private
  4501. * @param {Object} object The object to modify.
  4502. * @param {Array|string} path The path of the property to set.
  4503. * @param {*} value The value to set.
  4504. * @param {Function} [customizer] The function to customize path creation.
  4505. * @returns {Object} Returns `object`.
  4506. */
  4507. function baseSet(object, path, value, customizer) {
  4508. if (!isObject(object)) {
  4509. return object;
  4510. }
  4511. path = castPath(path, object);
  4512. var index = -1,
  4513. length = path.length,
  4514. lastIndex = length - 1,
  4515. nested = object;
  4516. while (nested != null && ++index < length) {
  4517. var key = toKey(path[index]),
  4518. newValue = value;
  4519. if (index != lastIndex) {
  4520. var objValue = nested[key];
  4521. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  4522. if (newValue === undefined) {
  4523. newValue = isObject(objValue)
  4524. ? objValue
  4525. : (isIndex(path[index + 1]) ? [] : {});
  4526. }
  4527. }
  4528. assignValue(nested, key, newValue);
  4529. nested = nested[key];
  4530. }
  4531. return object;
  4532. }
  4533. /**
  4534. * The base implementation of `setData` without support for hot loop shorting.
  4535. *
  4536. * @private
  4537. * @param {Function} func The function to associate metadata with.
  4538. * @param {*} data The metadata.
  4539. * @returns {Function} Returns `func`.
  4540. */
  4541. var baseSetData = !metaMap ? identity : function(func, data) {
  4542. metaMap.set(func, data);
  4543. return func;
  4544. };
  4545. /**
  4546. * The base implementation of `setToString` without support for hot loop shorting.
  4547. *
  4548. * @private
  4549. * @param {Function} func The function to modify.
  4550. * @param {Function} string The `toString` result.
  4551. * @returns {Function} Returns `func`.
  4552. */
  4553. var baseSetToString = !defineProperty ? identity : function(func, string) {
  4554. return defineProperty(func, 'toString', {
  4555. 'configurable': true,
  4556. 'enumerable': false,
  4557. 'value': constant(string),
  4558. 'writable': true
  4559. });
  4560. };
  4561. /**
  4562. * The base implementation of `_.shuffle`.
  4563. *
  4564. * @private
  4565. * @param {Array|Object} collection The collection to shuffle.
  4566. * @returns {Array} Returns the new shuffled array.
  4567. */
  4568. function baseShuffle(collection) {
  4569. return shuffleSelf(values(collection));
  4570. }
  4571. /**
  4572. * The base implementation of `_.slice` without an iteratee call guard.
  4573. *
  4574. * @private
  4575. * @param {Array} array The array to slice.
  4576. * @param {number} [start=0] The start position.
  4577. * @param {number} [end=array.length] The end position.
  4578. * @returns {Array} Returns the slice of `array`.
  4579. */
  4580. function baseSlice(array, start, end) {
  4581. var index = -1,
  4582. length = array.length;
  4583. if (start < 0) {
  4584. start = -start > length ? 0 : (length + start);
  4585. }
  4586. end = end > length ? length : end;
  4587. if (end < 0) {
  4588. end += length;
  4589. }
  4590. length = start > end ? 0 : ((end - start) >>> 0);
  4591. start >>>= 0;
  4592. var result = Array(length);
  4593. while (++index < length) {
  4594. result[index] = array[index + start];
  4595. }
  4596. return result;
  4597. }
  4598. /**
  4599. * The base implementation of `_.some` without support for iteratee shorthands.
  4600. *
  4601. * @private
  4602. * @param {Array|Object} collection The collection to iterate over.
  4603. * @param {Function} predicate The function invoked per iteration.
  4604. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4605. * else `false`.
  4606. */
  4607. function baseSome(collection, predicate) {
  4608. var result;
  4609. baseEach(collection, function(value, index, collection) {
  4610. result = predicate(value, index, collection);
  4611. return !result;
  4612. });
  4613. return !!result;
  4614. }
  4615. /**
  4616. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  4617. * performs a binary search of `array` to determine the index at which `value`
  4618. * should be inserted into `array` in order to maintain its sort order.
  4619. *
  4620. * @private
  4621. * @param {Array} array The sorted array to inspect.
  4622. * @param {*} value The value to evaluate.
  4623. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4624. * @returns {number} Returns the index at which `value` should be inserted
  4625. * into `array`.
  4626. */
  4627. function baseSortedIndex(array, value, retHighest) {
  4628. var low = 0,
  4629. high = array == null ? low : array.length;
  4630. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  4631. while (low < high) {
  4632. var mid = (low + high) >>> 1,
  4633. computed = array[mid];
  4634. if (computed !== null && !isSymbol(computed) &&
  4635. (retHighest ? (computed <= value) : (computed < value))) {
  4636. low = mid + 1;
  4637. } else {
  4638. high = mid;
  4639. }
  4640. }
  4641. return high;
  4642. }
  4643. return baseSortedIndexBy(array, value, identity, retHighest);
  4644. }
  4645. /**
  4646. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  4647. * which invokes `iteratee` for `value` and each element of `array` to compute
  4648. * their sort ranking. The iteratee is invoked with one argument; (value).
  4649. *
  4650. * @private
  4651. * @param {Array} array The sorted array to inspect.
  4652. * @param {*} value The value to evaluate.
  4653. * @param {Function} iteratee The iteratee invoked per element.
  4654. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4655. * @returns {number} Returns the index at which `value` should be inserted
  4656. * into `array`.
  4657. */
  4658. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  4659. value = iteratee(value);
  4660. var low = 0,
  4661. high = array == null ? 0 : array.length,
  4662. valIsNaN = value !== value,
  4663. valIsNull = value === null,
  4664. valIsSymbol = isSymbol(value),
  4665. valIsUndefined = value === undefined;
  4666. while (low < high) {
  4667. var mid = nativeFloor((low + high) / 2),
  4668. computed = iteratee(array[mid]),
  4669. othIsDefined = computed !== undefined,
  4670. othIsNull = computed === null,
  4671. othIsReflexive = computed === computed,
  4672. othIsSymbol = isSymbol(computed);
  4673. if (valIsNaN) {
  4674. var setLow = retHighest || othIsReflexive;
  4675. } else if (valIsUndefined) {
  4676. setLow = othIsReflexive && (retHighest || othIsDefined);
  4677. } else if (valIsNull) {
  4678. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  4679. } else if (valIsSymbol) {
  4680. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  4681. } else if (othIsNull || othIsSymbol) {
  4682. setLow = false;
  4683. } else {
  4684. setLow = retHighest ? (computed <= value) : (computed < value);
  4685. }
  4686. if (setLow) {
  4687. low = mid + 1;
  4688. } else {
  4689. high = mid;
  4690. }
  4691. }
  4692. return nativeMin(high, MAX_ARRAY_INDEX);
  4693. }
  4694. /**
  4695. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  4696. * support for iteratee shorthands.
  4697. *
  4698. * @private
  4699. * @param {Array} array The array to inspect.
  4700. * @param {Function} [iteratee] The iteratee invoked per element.
  4701. * @returns {Array} Returns the new duplicate free array.
  4702. */
  4703. function baseSortedUniq(array, iteratee) {
  4704. var index = -1,
  4705. length = array.length,
  4706. resIndex = 0,
  4707. result = [];
  4708. while (++index < length) {
  4709. var value = array[index],
  4710. computed = iteratee ? iteratee(value) : value;
  4711. if (!index || !eq(computed, seen)) {
  4712. var seen = computed;
  4713. result[resIndex++] = value === 0 ? 0 : value;
  4714. }
  4715. }
  4716. return result;
  4717. }
  4718. /**
  4719. * The base implementation of `_.toNumber` which doesn't ensure correct
  4720. * conversions of binary, hexadecimal, or octal string values.
  4721. *
  4722. * @private
  4723. * @param {*} value The value to process.
  4724. * @returns {number} Returns the number.
  4725. */
  4726. function baseToNumber(value) {
  4727. if (typeof value == 'number') {
  4728. return value;
  4729. }
  4730. if (isSymbol(value)) {
  4731. return NAN;
  4732. }
  4733. return +value;
  4734. }
  4735. /**
  4736. * The base implementation of `_.toString` which doesn't convert nullish
  4737. * values to empty strings.
  4738. *
  4739. * @private
  4740. * @param {*} value The value to process.
  4741. * @returns {string} Returns the string.
  4742. */
  4743. function baseToString(value) {
  4744. // Exit early for strings to avoid a performance hit in some environments.
  4745. if (typeof value == 'string') {
  4746. return value;
  4747. }
  4748. if (isArray(value)) {
  4749. // Recursively convert values (susceptible to call stack limits).
  4750. return arrayMap(value, baseToString) + '';
  4751. }
  4752. if (isSymbol(value)) {
  4753. return symbolToString ? symbolToString.call(value) : '';
  4754. }
  4755. var result = (value + '');
  4756. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  4757. }
  4758. /**
  4759. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  4760. *
  4761. * @private
  4762. * @param {Array} array The array to inspect.
  4763. * @param {Function} [iteratee] The iteratee invoked per element.
  4764. * @param {Function} [comparator] The comparator invoked per element.
  4765. * @returns {Array} Returns the new duplicate free array.
  4766. */
  4767. function baseUniq(array, iteratee, comparator) {
  4768. var index = -1,
  4769. includes = arrayIncludes,
  4770. length = array.length,
  4771. isCommon = true,
  4772. result = [],
  4773. seen = result;
  4774. if (comparator) {
  4775. isCommon = false;
  4776. includes = arrayIncludesWith;
  4777. }
  4778. else if (length >= LARGE_ARRAY_SIZE) {
  4779. var set = iteratee ? null : createSet(array);
  4780. if (set) {
  4781. return setToArray(set);
  4782. }
  4783. isCommon = false;
  4784. includes = cacheHas;
  4785. seen = new SetCache;
  4786. }
  4787. else {
  4788. seen = iteratee ? [] : result;
  4789. }
  4790. outer:
  4791. while (++index < length) {
  4792. var value = array[index],
  4793. computed = iteratee ? iteratee(value) : value;
  4794. value = (comparator || value !== 0) ? value : 0;
  4795. if (isCommon && computed === computed) {
  4796. var seenIndex = seen.length;
  4797. while (seenIndex--) {
  4798. if (seen[seenIndex] === computed) {
  4799. continue outer;
  4800. }
  4801. }
  4802. if (iteratee) {
  4803. seen.push(computed);
  4804. }
  4805. result.push(value);
  4806. }
  4807. else if (!includes(seen, computed, comparator)) {
  4808. if (seen !== result) {
  4809. seen.push(computed);
  4810. }
  4811. result.push(value);
  4812. }
  4813. }
  4814. return result;
  4815. }
  4816. /**
  4817. * The base implementation of `_.unset`.
  4818. *
  4819. * @private
  4820. * @param {Object} object The object to modify.
  4821. * @param {Array|string} path The property path to unset.
  4822. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  4823. */
  4824. function baseUnset(object, path) {
  4825. path = castPath(path, object);
  4826. object = parent(object, path);
  4827. return object == null || delete object[toKey(last(path))];
  4828. }
  4829. /**
  4830. * The base implementation of `_.update`.
  4831. *
  4832. * @private
  4833. * @param {Object} object The object to modify.
  4834. * @param {Array|string} path The path of the property to update.
  4835. * @param {Function} updater The function to produce the updated value.
  4836. * @param {Function} [customizer] The function to customize path creation.
  4837. * @returns {Object} Returns `object`.
  4838. */
  4839. function baseUpdate(object, path, updater, customizer) {
  4840. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  4841. }
  4842. /**
  4843. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  4844. * without support for iteratee shorthands.
  4845. *
  4846. * @private
  4847. * @param {Array} array The array to query.
  4848. * @param {Function} predicate The function invoked per iteration.
  4849. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  4850. * @param {boolean} [fromRight] Specify iterating from right to left.
  4851. * @returns {Array} Returns the slice of `array`.
  4852. */
  4853. function baseWhile(array, predicate, isDrop, fromRight) {
  4854. var length = array.length,
  4855. index = fromRight ? length : -1;
  4856. while ((fromRight ? index-- : ++index < length) &&
  4857. predicate(array[index], index, array)) {}
  4858. return isDrop
  4859. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  4860. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  4861. }
  4862. /**
  4863. * The base implementation of `wrapperValue` which returns the result of
  4864. * performing a sequence of actions on the unwrapped `value`, where each
  4865. * successive action is supplied the return value of the previous.
  4866. *
  4867. * @private
  4868. * @param {*} value The unwrapped value.
  4869. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  4870. * @returns {*} Returns the resolved value.
  4871. */
  4872. function baseWrapperValue(value, actions) {
  4873. var result = value;
  4874. if (result instanceof LazyWrapper) {
  4875. result = result.value();
  4876. }
  4877. return arrayReduce(actions, function(result, action) {
  4878. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  4879. }, result);
  4880. }
  4881. /**
  4882. * The base implementation of methods like `_.xor`, without support for
  4883. * iteratee shorthands, that accepts an array of arrays to inspect.
  4884. *
  4885. * @private
  4886. * @param {Array} arrays The arrays to inspect.
  4887. * @param {Function} [iteratee] The iteratee invoked per element.
  4888. * @param {Function} [comparator] The comparator invoked per element.
  4889. * @returns {Array} Returns the new array of values.
  4890. */
  4891. function baseXor(arrays, iteratee, comparator) {
  4892. var length = arrays.length;
  4893. if (length < 2) {
  4894. return length ? baseUniq(arrays[0]) : [];
  4895. }
  4896. var index = -1,
  4897. result = Array(length);
  4898. while (++index < length) {
  4899. var array = arrays[index],
  4900. othIndex = -1;
  4901. while (++othIndex < length) {
  4902. if (othIndex != index) {
  4903. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  4904. }
  4905. }
  4906. }
  4907. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  4908. }
  4909. /**
  4910. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  4911. *
  4912. * @private
  4913. * @param {Array} props The property identifiers.
  4914. * @param {Array} values The property values.
  4915. * @param {Function} assignFunc The function to assign values.
  4916. * @returns {Object} Returns the new object.
  4917. */
  4918. function baseZipObject(props, values, assignFunc) {
  4919. var index = -1,
  4920. length = props.length,
  4921. valsLength = values.length,
  4922. result = {};
  4923. while (++index < length) {
  4924. var value = index < valsLength ? values[index] : undefined;
  4925. assignFunc(result, props[index], value);
  4926. }
  4927. return result;
  4928. }
  4929. /**
  4930. * Casts `value` to an empty array if it's not an array like object.
  4931. *
  4932. * @private
  4933. * @param {*} value The value to inspect.
  4934. * @returns {Array|Object} Returns the cast array-like object.
  4935. */
  4936. function castArrayLikeObject(value) {
  4937. return isArrayLikeObject(value) ? value : [];
  4938. }
  4939. /**
  4940. * Casts `value` to `identity` if it's not a function.
  4941. *
  4942. * @private
  4943. * @param {*} value The value to inspect.
  4944. * @returns {Function} Returns cast function.
  4945. */
  4946. function castFunction(value) {
  4947. return typeof value == 'function' ? value : identity;
  4948. }
  4949. /**
  4950. * Casts `value` to a path array if it's not one.
  4951. *
  4952. * @private
  4953. * @param {*} value The value to inspect.
  4954. * @param {Object} [object] The object to query keys on.
  4955. * @returns {Array} Returns the cast property path array.
  4956. */
  4957. function castPath(value, object) {
  4958. if (isArray(value)) {
  4959. return value;
  4960. }
  4961. return isKey(value, object) ? [value] : stringToPath(toString(value));
  4962. }
  4963. /**
  4964. * A `baseRest` alias which can be replaced with `identity` by module
  4965. * replacement plugins.
  4966. *
  4967. * @private
  4968. * @type {Function}
  4969. * @param {Function} func The function to apply a rest parameter to.
  4970. * @returns {Function} Returns the new function.
  4971. */
  4972. var castRest = baseRest;
  4973. /**
  4974. * Casts `array` to a slice if it's needed.
  4975. *
  4976. * @private
  4977. * @param {Array} array The array to inspect.
  4978. * @param {number} start The start position.
  4979. * @param {number} [end=array.length] The end position.
  4980. * @returns {Array} Returns the cast slice.
  4981. */
  4982. function castSlice(array, start, end) {
  4983. var length = array.length;
  4984. end = end === undefined ? length : end;
  4985. return (!start && end >= length) ? array : baseSlice(array, start, end);
  4986. }
  4987. /**
  4988. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  4989. *
  4990. * @private
  4991. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  4992. */
  4993. var clearTimeout = ctxClearTimeout || function(id) {
  4994. return root.clearTimeout(id);
  4995. };
  4996. /**
  4997. * Creates a clone of `buffer`.
  4998. *
  4999. * @private
  5000. * @param {Buffer} buffer The buffer to clone.
  5001. * @param {boolean} [isDeep] Specify a deep clone.
  5002. * @returns {Buffer} Returns the cloned buffer.
  5003. */
  5004. function cloneBuffer(buffer, isDeep) {
  5005. if (isDeep) {
  5006. return buffer.slice();
  5007. }
  5008. var length = buffer.length,
  5009. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5010. buffer.copy(result);
  5011. return result;
  5012. }
  5013. /**
  5014. * Creates a clone of `arrayBuffer`.
  5015. *
  5016. * @private
  5017. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5018. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5019. */
  5020. function cloneArrayBuffer(arrayBuffer) {
  5021. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5022. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  5023. return result;
  5024. }
  5025. /**
  5026. * Creates a clone of `dataView`.
  5027. *
  5028. * @private
  5029. * @param {Object} dataView The data view to clone.
  5030. * @param {boolean} [isDeep] Specify a deep clone.
  5031. * @returns {Object} Returns the cloned data view.
  5032. */
  5033. function cloneDataView(dataView, isDeep) {
  5034. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5035. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5036. }
  5037. /**
  5038. * Creates a clone of `regexp`.
  5039. *
  5040. * @private
  5041. * @param {Object} regexp The regexp to clone.
  5042. * @returns {Object} Returns the cloned regexp.
  5043. */
  5044. function cloneRegExp(regexp) {
  5045. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5046. result.lastIndex = regexp.lastIndex;
  5047. return result;
  5048. }
  5049. /**
  5050. * Creates a clone of the `symbol` object.
  5051. *
  5052. * @private
  5053. * @param {Object} symbol The symbol object to clone.
  5054. * @returns {Object} Returns the cloned symbol object.
  5055. */
  5056. function cloneSymbol(symbol) {
  5057. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5058. }
  5059. /**
  5060. * Creates a clone of `typedArray`.
  5061. *
  5062. * @private
  5063. * @param {Object} typedArray The typed array to clone.
  5064. * @param {boolean} [isDeep] Specify a deep clone.
  5065. * @returns {Object} Returns the cloned typed array.
  5066. */
  5067. function cloneTypedArray(typedArray, isDeep) {
  5068. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5069. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5070. }
  5071. /**
  5072. * Compares values to sort them in ascending order.
  5073. *
  5074. * @private
  5075. * @param {*} value The value to compare.
  5076. * @param {*} other The other value to compare.
  5077. * @returns {number} Returns the sort order indicator for `value`.
  5078. */
  5079. function compareAscending(value, other) {
  5080. if (value !== other) {
  5081. var valIsDefined = value !== undefined,
  5082. valIsNull = value === null,
  5083. valIsReflexive = value === value,
  5084. valIsSymbol = isSymbol(value);
  5085. var othIsDefined = other !== undefined,
  5086. othIsNull = other === null,
  5087. othIsReflexive = other === other,
  5088. othIsSymbol = isSymbol(other);
  5089. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  5090. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  5091. (valIsNull && othIsDefined && othIsReflexive) ||
  5092. (!valIsDefined && othIsReflexive) ||
  5093. !valIsReflexive) {
  5094. return 1;
  5095. }
  5096. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  5097. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  5098. (othIsNull && valIsDefined && valIsReflexive) ||
  5099. (!othIsDefined && valIsReflexive) ||
  5100. !othIsReflexive) {
  5101. return -1;
  5102. }
  5103. }
  5104. return 0;
  5105. }
  5106. /**
  5107. * Used by `_.orderBy` to compare multiple properties of a value to another
  5108. * and stable sort them.
  5109. *
  5110. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  5111. * specify an order of "desc" for descending or "asc" for ascending sort order
  5112. * of corresponding values.
  5113. *
  5114. * @private
  5115. * @param {Object} object The object to compare.
  5116. * @param {Object} other The other object to compare.
  5117. * @param {boolean[]|string[]} orders The order to sort by for each property.
  5118. * @returns {number} Returns the sort order indicator for `object`.
  5119. */
  5120. function compareMultiple(object, other, orders) {
  5121. var index = -1,
  5122. objCriteria = object.criteria,
  5123. othCriteria = other.criteria,
  5124. length = objCriteria.length,
  5125. ordersLength = orders.length;
  5126. while (++index < length) {
  5127. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5128. if (result) {
  5129. if (index >= ordersLength) {
  5130. return result;
  5131. }
  5132. var order = orders[index];
  5133. return result * (order == 'desc' ? -1 : 1);
  5134. }
  5135. }
  5136. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5137. // that causes it, under certain circumstances, to provide the same value for
  5138. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5139. // for more details.
  5140. //
  5141. // This also ensures a stable sort in V8 and other engines.
  5142. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5143. return object.index - other.index;
  5144. }
  5145. /**
  5146. * Creates an array that is the composition of partially applied arguments,
  5147. * placeholders, and provided arguments into a single array of arguments.
  5148. *
  5149. * @private
  5150. * @param {Array} args The provided arguments.
  5151. * @param {Array} partials The arguments to prepend to those provided.
  5152. * @param {Array} holders The `partials` placeholder indexes.
  5153. * @params {boolean} [isCurried] Specify composing for a curried function.
  5154. * @returns {Array} Returns the new array of composed arguments.
  5155. */
  5156. function composeArgs(args, partials, holders, isCurried) {
  5157. var argsIndex = -1,
  5158. argsLength = args.length,
  5159. holdersLength = holders.length,
  5160. leftIndex = -1,
  5161. leftLength = partials.length,
  5162. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5163. result = Array(leftLength + rangeLength),
  5164. isUncurried = !isCurried;
  5165. while (++leftIndex < leftLength) {
  5166. result[leftIndex] = partials[leftIndex];
  5167. }
  5168. while (++argsIndex < holdersLength) {
  5169. if (isUncurried || argsIndex < argsLength) {
  5170. result[holders[argsIndex]] = args[argsIndex];
  5171. }
  5172. }
  5173. while (rangeLength--) {
  5174. result[leftIndex++] = args[argsIndex++];
  5175. }
  5176. return result;
  5177. }
  5178. /**
  5179. * This function is like `composeArgs` except that the arguments composition
  5180. * is tailored for `_.partialRight`.
  5181. *
  5182. * @private
  5183. * @param {Array} args The provided arguments.
  5184. * @param {Array} partials The arguments to append to those provided.
  5185. * @param {Array} holders The `partials` placeholder indexes.
  5186. * @params {boolean} [isCurried] Specify composing for a curried function.
  5187. * @returns {Array} Returns the new array of composed arguments.
  5188. */
  5189. function composeArgsRight(args, partials, holders, isCurried) {
  5190. var argsIndex = -1,
  5191. argsLength = args.length,
  5192. holdersIndex = -1,
  5193. holdersLength = holders.length,
  5194. rightIndex = -1,
  5195. rightLength = partials.length,
  5196. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5197. result = Array(rangeLength + rightLength),
  5198. isUncurried = !isCurried;
  5199. while (++argsIndex < rangeLength) {
  5200. result[argsIndex] = args[argsIndex];
  5201. }
  5202. var offset = argsIndex;
  5203. while (++rightIndex < rightLength) {
  5204. result[offset + rightIndex] = partials[rightIndex];
  5205. }
  5206. while (++holdersIndex < holdersLength) {
  5207. if (isUncurried || argsIndex < argsLength) {
  5208. result[offset + holders[holdersIndex]] = args[argsIndex++];
  5209. }
  5210. }
  5211. return result;
  5212. }
  5213. /**
  5214. * Copies the values of `source` to `array`.
  5215. *
  5216. * @private
  5217. * @param {Array} source The array to copy values from.
  5218. * @param {Array} [array=[]] The array to copy values to.
  5219. * @returns {Array} Returns `array`.
  5220. */
  5221. function copyArray(source, array) {
  5222. var index = -1,
  5223. length = source.length;
  5224. array || (array = Array(length));
  5225. while (++index < length) {
  5226. array[index] = source[index];
  5227. }
  5228. return array;
  5229. }
  5230. /**
  5231. * Copies properties of `source` to `object`.
  5232. *
  5233. * @private
  5234. * @param {Object} source The object to copy properties from.
  5235. * @param {Array} props The property identifiers to copy.
  5236. * @param {Object} [object={}] The object to copy properties to.
  5237. * @param {Function} [customizer] The function to customize copied values.
  5238. * @returns {Object} Returns `object`.
  5239. */
  5240. function copyObject(source, props, object, customizer) {
  5241. var isNew = !object;
  5242. object || (object = {});
  5243. var index = -1,
  5244. length = props.length;
  5245. while (++index < length) {
  5246. var key = props[index];
  5247. var newValue = customizer
  5248. ? customizer(object[key], source[key], key, object, source)
  5249. : undefined;
  5250. if (newValue === undefined) {
  5251. newValue = source[key];
  5252. }
  5253. if (isNew) {
  5254. baseAssignValue(object, key, newValue);
  5255. } else {
  5256. assignValue(object, key, newValue);
  5257. }
  5258. }
  5259. return object;
  5260. }
  5261. /**
  5262. * Copies own symbols of `source` to `object`.
  5263. *
  5264. * @private
  5265. * @param {Object} source The object to copy symbols from.
  5266. * @param {Object} [object={}] The object to copy symbols to.
  5267. * @returns {Object} Returns `object`.
  5268. */
  5269. function copySymbols(source, object) {
  5270. return copyObject(source, getSymbols(source), object);
  5271. }
  5272. /**
  5273. * Copies own and inherited symbols of `source` to `object`.
  5274. *
  5275. * @private
  5276. * @param {Object} source The object to copy symbols from.
  5277. * @param {Object} [object={}] The object to copy symbols to.
  5278. * @returns {Object} Returns `object`.
  5279. */
  5280. function copySymbolsIn(source, object) {
  5281. return copyObject(source, getSymbolsIn(source), object);
  5282. }
  5283. /**
  5284. * Creates a function like `_.groupBy`.
  5285. *
  5286. * @private
  5287. * @param {Function} setter The function to set accumulator values.
  5288. * @param {Function} [initializer] The accumulator object initializer.
  5289. * @returns {Function} Returns the new aggregator function.
  5290. */
  5291. function createAggregator(setter, initializer) {
  5292. return function(collection, iteratee) {
  5293. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  5294. accumulator = initializer ? initializer() : {};
  5295. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  5296. };
  5297. }
  5298. /**
  5299. * Creates a function like `_.assign`.
  5300. *
  5301. * @private
  5302. * @param {Function} assigner The function to assign values.
  5303. * @returns {Function} Returns the new assigner function.
  5304. */
  5305. function createAssigner(assigner) {
  5306. return baseRest(function(object, sources) {
  5307. var index = -1,
  5308. length = sources.length,
  5309. customizer = length > 1 ? sources[length - 1] : undefined,
  5310. guard = length > 2 ? sources[2] : undefined;
  5311. customizer = (assigner.length > 3 && typeof customizer == 'function')
  5312. ? (length--, customizer)
  5313. : undefined;
  5314. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  5315. customizer = length < 3 ? undefined : customizer;
  5316. length = 1;
  5317. }
  5318. object = Object(object);
  5319. while (++index < length) {
  5320. var source = sources[index];
  5321. if (source) {
  5322. assigner(object, source, index, customizer);
  5323. }
  5324. }
  5325. return object;
  5326. });
  5327. }
  5328. /**
  5329. * Creates a `baseEach` or `baseEachRight` function.
  5330. *
  5331. * @private
  5332. * @param {Function} eachFunc The function to iterate over a collection.
  5333. * @param {boolean} [fromRight] Specify iterating from right to left.
  5334. * @returns {Function} Returns the new base function.
  5335. */
  5336. function createBaseEach(eachFunc, fromRight) {
  5337. return function(collection, iteratee) {
  5338. if (collection == null) {
  5339. return collection;
  5340. }
  5341. if (!isArrayLike(collection)) {
  5342. return eachFunc(collection, iteratee);
  5343. }
  5344. var length = collection.length,
  5345. index = fromRight ? length : -1,
  5346. iterable = Object(collection);
  5347. while ((fromRight ? index-- : ++index < length)) {
  5348. if (iteratee(iterable[index], index, iterable) === false) {
  5349. break;
  5350. }
  5351. }
  5352. return collection;
  5353. };
  5354. }
  5355. /**
  5356. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  5357. *
  5358. * @private
  5359. * @param {boolean} [fromRight] Specify iterating from right to left.
  5360. * @returns {Function} Returns the new base function.
  5361. */
  5362. function createBaseFor(fromRight) {
  5363. return function(object, iteratee, keysFunc) {
  5364. var index = -1,
  5365. iterable = Object(object),
  5366. props = keysFunc(object),
  5367. length = props.length;
  5368. while (length--) {
  5369. var key = props[fromRight ? length : ++index];
  5370. if (iteratee(iterable[key], key, iterable) === false) {
  5371. break;
  5372. }
  5373. }
  5374. return object;
  5375. };
  5376. }
  5377. /**
  5378. * Creates a function that wraps `func` to invoke it with the optional `this`
  5379. * binding of `thisArg`.
  5380. *
  5381. * @private
  5382. * @param {Function} func The function to wrap.
  5383. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5384. * @param {*} [thisArg] The `this` binding of `func`.
  5385. * @returns {Function} Returns the new wrapped function.
  5386. */
  5387. function createBind(func, bitmask, thisArg) {
  5388. var isBind = bitmask & WRAP_BIND_FLAG,
  5389. Ctor = createCtor(func);
  5390. function wrapper() {
  5391. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5392. return fn.apply(isBind ? thisArg : this, arguments);
  5393. }
  5394. return wrapper;
  5395. }
  5396. /**
  5397. * Creates a function like `_.lowerFirst`.
  5398. *
  5399. * @private
  5400. * @param {string} methodName The name of the `String` case method to use.
  5401. * @returns {Function} Returns the new case function.
  5402. */
  5403. function createCaseFirst(methodName) {
  5404. return function(string) {
  5405. string = toString(string);
  5406. var strSymbols = hasUnicode(string)
  5407. ? stringToArray(string)
  5408. : undefined;
  5409. var chr = strSymbols
  5410. ? strSymbols[0]
  5411. : string.charAt(0);
  5412. var trailing = strSymbols
  5413. ? castSlice(strSymbols, 1).join('')
  5414. : string.slice(1);
  5415. return chr[methodName]() + trailing;
  5416. };
  5417. }
  5418. /**
  5419. * Creates a function like `_.camelCase`.
  5420. *
  5421. * @private
  5422. * @param {Function} callback The function to combine each word.
  5423. * @returns {Function} Returns the new compounder function.
  5424. */
  5425. function createCompounder(callback) {
  5426. return function(string) {
  5427. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  5428. };
  5429. }
  5430. /**
  5431. * Creates a function that produces an instance of `Ctor` regardless of
  5432. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  5433. *
  5434. * @private
  5435. * @param {Function} Ctor The constructor to wrap.
  5436. * @returns {Function} Returns the new wrapped function.
  5437. */
  5438. function createCtor(Ctor) {
  5439. return function() {
  5440. // Use a `switch` statement to work with class constructors. See
  5441. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  5442. // for more details.
  5443. var args = arguments;
  5444. switch (args.length) {
  5445. case 0: return new Ctor;
  5446. case 1: return new Ctor(args[0]);
  5447. case 2: return new Ctor(args[0], args[1]);
  5448. case 3: return new Ctor(args[0], args[1], args[2]);
  5449. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  5450. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  5451. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  5452. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  5453. }
  5454. var thisBinding = baseCreate(Ctor.prototype),
  5455. result = Ctor.apply(thisBinding, args);
  5456. // Mimic the constructor's `return` behavior.
  5457. // See https://es5.github.io/#x13.2.2 for more details.
  5458. return isObject(result) ? result : thisBinding;
  5459. };
  5460. }
  5461. /**
  5462. * Creates a function that wraps `func` to enable currying.
  5463. *
  5464. * @private
  5465. * @param {Function} func The function to wrap.
  5466. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5467. * @param {number} arity The arity of `func`.
  5468. * @returns {Function} Returns the new wrapped function.
  5469. */
  5470. function createCurry(func, bitmask, arity) {
  5471. var Ctor = createCtor(func);
  5472. function wrapper() {
  5473. var length = arguments.length,
  5474. args = Array(length),
  5475. index = length,
  5476. placeholder = getHolder(wrapper);
  5477. while (index--) {
  5478. args[index] = arguments[index];
  5479. }
  5480. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  5481. ? []
  5482. : replaceHolders(args, placeholder);
  5483. length -= holders.length;
  5484. if (length < arity) {
  5485. return createRecurry(
  5486. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  5487. args, holders, undefined, undefined, arity - length);
  5488. }
  5489. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5490. return apply(fn, this, args);
  5491. }
  5492. return wrapper;
  5493. }
  5494. /**
  5495. * Creates a `_.find` or `_.findLast` function.
  5496. *
  5497. * @private
  5498. * @param {Function} findIndexFunc The function to find the collection index.
  5499. * @returns {Function} Returns the new find function.
  5500. */
  5501. function createFind(findIndexFunc) {
  5502. return function(collection, predicate, fromIndex) {
  5503. var iterable = Object(collection);
  5504. if (!isArrayLike(collection)) {
  5505. var iteratee = getIteratee(predicate, 3);
  5506. collection = keys(collection);
  5507. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  5508. }
  5509. var index = findIndexFunc(collection, predicate, fromIndex);
  5510. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  5511. };
  5512. }
  5513. /**
  5514. * Creates a `_.flow` or `_.flowRight` function.
  5515. *
  5516. * @private
  5517. * @param {boolean} [fromRight] Specify iterating from right to left.
  5518. * @returns {Function} Returns the new flow function.
  5519. */
  5520. function createFlow(fromRight) {
  5521. return flatRest(function(funcs) {
  5522. var length = funcs.length,
  5523. index = length,
  5524. prereq = LodashWrapper.prototype.thru;
  5525. if (fromRight) {
  5526. funcs.reverse();
  5527. }
  5528. while (index--) {
  5529. var func = funcs[index];
  5530. if (typeof func != 'function') {
  5531. throw new TypeError(FUNC_ERROR_TEXT);
  5532. }
  5533. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  5534. var wrapper = new LodashWrapper([], true);
  5535. }
  5536. }
  5537. index = wrapper ? index : length;
  5538. while (++index < length) {
  5539. func = funcs[index];
  5540. var funcName = getFuncName(func),
  5541. data = funcName == 'wrapper' ? getData(func) : undefined;
  5542. if (data && isLaziable(data[0]) &&
  5543. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  5544. !data[4].length && data[9] == 1
  5545. ) {
  5546. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  5547. } else {
  5548. wrapper = (func.length == 1 && isLaziable(func))
  5549. ? wrapper[funcName]()
  5550. : wrapper.thru(func);
  5551. }
  5552. }
  5553. return function() {
  5554. var args = arguments,
  5555. value = args[0];
  5556. if (wrapper && args.length == 1 && isArray(value)) {
  5557. return wrapper.plant(value).value();
  5558. }
  5559. var index = 0,
  5560. result = length ? funcs[index].apply(this, args) : value;
  5561. while (++index < length) {
  5562. result = funcs[index].call(this, result);
  5563. }
  5564. return result;
  5565. };
  5566. });
  5567. }
  5568. /**
  5569. * Creates a function that wraps `func` to invoke it with optional `this`
  5570. * binding of `thisArg`, partial application, and currying.
  5571. *
  5572. * @private
  5573. * @param {Function|string} func The function or method name to wrap.
  5574. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5575. * @param {*} [thisArg] The `this` binding of `func`.
  5576. * @param {Array} [partials] The arguments to prepend to those provided to
  5577. * the new function.
  5578. * @param {Array} [holders] The `partials` placeholder indexes.
  5579. * @param {Array} [partialsRight] The arguments to append to those provided
  5580. * to the new function.
  5581. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  5582. * @param {Array} [argPos] The argument positions of the new function.
  5583. * @param {number} [ary] The arity cap of `func`.
  5584. * @param {number} [arity] The arity of `func`.
  5585. * @returns {Function} Returns the new wrapped function.
  5586. */
  5587. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  5588. var isAry = bitmask & WRAP_ARY_FLAG,
  5589. isBind = bitmask & WRAP_BIND_FLAG,
  5590. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  5591. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  5592. isFlip = bitmask & WRAP_FLIP_FLAG,
  5593. Ctor = isBindKey ? undefined : createCtor(func);
  5594. function wrapper() {
  5595. var length = arguments.length,
  5596. args = Array(length),
  5597. index = length;
  5598. while (index--) {
  5599. args[index] = arguments[index];
  5600. }
  5601. if (isCurried) {
  5602. var placeholder = getHolder(wrapper),
  5603. holdersCount = countHolders(args, placeholder);
  5604. }
  5605. if (partials) {
  5606. args = composeArgs(args, partials, holders, isCurried);
  5607. }
  5608. if (partialsRight) {
  5609. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  5610. }
  5611. length -= holdersCount;
  5612. if (isCurried && length < arity) {
  5613. var newHolders = replaceHolders(args, placeholder);
  5614. return createRecurry(
  5615. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  5616. args, newHolders, argPos, ary, arity - length
  5617. );
  5618. }
  5619. var thisBinding = isBind ? thisArg : this,
  5620. fn = isBindKey ? thisBinding[func] : func;
  5621. length = args.length;
  5622. if (argPos) {
  5623. args = reorder(args, argPos);
  5624. } else if (isFlip && length > 1) {
  5625. args.reverse();
  5626. }
  5627. if (isAry && ary < length) {
  5628. args.length = ary;
  5629. }
  5630. if (this && this !== root && this instanceof wrapper) {
  5631. fn = Ctor || createCtor(fn);
  5632. }
  5633. return fn.apply(thisBinding, args);
  5634. }
  5635. return wrapper;
  5636. }
  5637. /**
  5638. * Creates a function like `_.invertBy`.
  5639. *
  5640. * @private
  5641. * @param {Function} setter The function to set accumulator values.
  5642. * @param {Function} toIteratee The function to resolve iteratees.
  5643. * @returns {Function} Returns the new inverter function.
  5644. */
  5645. function createInverter(setter, toIteratee) {
  5646. return function(object, iteratee) {
  5647. return baseInverter(object, setter, toIteratee(iteratee), {});
  5648. };
  5649. }
  5650. /**
  5651. * Creates a function that performs a mathematical operation on two values.
  5652. *
  5653. * @private
  5654. * @param {Function} operator The function to perform the operation.
  5655. * @param {number} [defaultValue] The value used for `undefined` arguments.
  5656. * @returns {Function} Returns the new mathematical operation function.
  5657. */
  5658. function createMathOperation(operator, defaultValue) {
  5659. return function(value, other) {
  5660. var result;
  5661. if (value === undefined && other === undefined) {
  5662. return defaultValue;
  5663. }
  5664. if (value !== undefined) {
  5665. result = value;
  5666. }
  5667. if (other !== undefined) {
  5668. if (result === undefined) {
  5669. return other;
  5670. }
  5671. if (typeof value == 'string' || typeof other == 'string') {
  5672. value = baseToString(value);
  5673. other = baseToString(other);
  5674. } else {
  5675. value = baseToNumber(value);
  5676. other = baseToNumber(other);
  5677. }
  5678. result = operator(value, other);
  5679. }
  5680. return result;
  5681. };
  5682. }
  5683. /**
  5684. * Creates a function like `_.over`.
  5685. *
  5686. * @private
  5687. * @param {Function} arrayFunc The function to iterate over iteratees.
  5688. * @returns {Function} Returns the new over function.
  5689. */
  5690. function createOver(arrayFunc) {
  5691. return flatRest(function(iteratees) {
  5692. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  5693. return baseRest(function(args) {
  5694. var thisArg = this;
  5695. return arrayFunc(iteratees, function(iteratee) {
  5696. return apply(iteratee, thisArg, args);
  5697. });
  5698. });
  5699. });
  5700. }
  5701. /**
  5702. * Creates the padding for `string` based on `length`. The `chars` string
  5703. * is truncated if the number of characters exceeds `length`.
  5704. *
  5705. * @private
  5706. * @param {number} length The padding length.
  5707. * @param {string} [chars=' '] The string used as padding.
  5708. * @returns {string} Returns the padding for `string`.
  5709. */
  5710. function createPadding(length, chars) {
  5711. chars = chars === undefined ? ' ' : baseToString(chars);
  5712. var charsLength = chars.length;
  5713. if (charsLength < 2) {
  5714. return charsLength ? baseRepeat(chars, length) : chars;
  5715. }
  5716. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  5717. return hasUnicode(chars)
  5718. ? castSlice(stringToArray(result), 0, length).join('')
  5719. : result.slice(0, length);
  5720. }
  5721. /**
  5722. * Creates a function that wraps `func` to invoke it with the `this` binding
  5723. * of `thisArg` and `partials` prepended to the arguments it receives.
  5724. *
  5725. * @private
  5726. * @param {Function} func The function to wrap.
  5727. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5728. * @param {*} thisArg The `this` binding of `func`.
  5729. * @param {Array} partials The arguments to prepend to those provided to
  5730. * the new function.
  5731. * @returns {Function} Returns the new wrapped function.
  5732. */
  5733. function createPartial(func, bitmask, thisArg, partials) {
  5734. var isBind = bitmask & WRAP_BIND_FLAG,
  5735. Ctor = createCtor(func);
  5736. function wrapper() {
  5737. var argsIndex = -1,
  5738. argsLength = arguments.length,
  5739. leftIndex = -1,
  5740. leftLength = partials.length,
  5741. args = Array(leftLength + argsLength),
  5742. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5743. while (++leftIndex < leftLength) {
  5744. args[leftIndex] = partials[leftIndex];
  5745. }
  5746. while (argsLength--) {
  5747. args[leftIndex++] = arguments[++argsIndex];
  5748. }
  5749. return apply(fn, isBind ? thisArg : this, args);
  5750. }
  5751. return wrapper;
  5752. }
  5753. /**
  5754. * Creates a `_.range` or `_.rangeRight` function.
  5755. *
  5756. * @private
  5757. * @param {boolean} [fromRight] Specify iterating from right to left.
  5758. * @returns {Function} Returns the new range function.
  5759. */
  5760. function createRange(fromRight) {
  5761. return function(start, end, step) {
  5762. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  5763. end = step = undefined;
  5764. }
  5765. // Ensure the sign of `-0` is preserved.
  5766. start = toFinite(start);
  5767. if (end === undefined) {
  5768. end = start;
  5769. start = 0;
  5770. } else {
  5771. end = toFinite(end);
  5772. }
  5773. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  5774. return baseRange(start, end, step, fromRight);
  5775. };
  5776. }
  5777. /**
  5778. * Creates a function that performs a relational operation on two values.
  5779. *
  5780. * @private
  5781. * @param {Function} operator The function to perform the operation.
  5782. * @returns {Function} Returns the new relational operation function.
  5783. */
  5784. function createRelationalOperation(operator) {
  5785. return function(value, other) {
  5786. if (!(typeof value == 'string' && typeof other == 'string')) {
  5787. value = toNumber(value);
  5788. other = toNumber(other);
  5789. }
  5790. return operator(value, other);
  5791. };
  5792. }
  5793. /**
  5794. * Creates a function that wraps `func` to continue currying.
  5795. *
  5796. * @private
  5797. * @param {Function} func The function to wrap.
  5798. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5799. * @param {Function} wrapFunc The function to create the `func` wrapper.
  5800. * @param {*} placeholder The placeholder value.
  5801. * @param {*} [thisArg] The `this` binding of `func`.
  5802. * @param {Array} [partials] The arguments to prepend to those provided to
  5803. * the new function.
  5804. * @param {Array} [holders] The `partials` placeholder indexes.
  5805. * @param {Array} [argPos] The argument positions of the new function.
  5806. * @param {number} [ary] The arity cap of `func`.
  5807. * @param {number} [arity] The arity of `func`.
  5808. * @returns {Function} Returns the new wrapped function.
  5809. */
  5810. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  5811. var isCurry = bitmask & WRAP_CURRY_FLAG,
  5812. newHolders = isCurry ? holders : undefined,
  5813. newHoldersRight = isCurry ? undefined : holders,
  5814. newPartials = isCurry ? partials : undefined,
  5815. newPartialsRight = isCurry ? undefined : partials;
  5816. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  5817. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  5818. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  5819. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  5820. }
  5821. var newData = [
  5822. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  5823. newHoldersRight, argPos, ary, arity
  5824. ];
  5825. var result = wrapFunc.apply(undefined, newData);
  5826. if (isLaziable(func)) {
  5827. setData(result, newData);
  5828. }
  5829. result.placeholder = placeholder;
  5830. return setWrapToString(result, func, bitmask);
  5831. }
  5832. /**
  5833. * Creates a function like `_.round`.
  5834. *
  5835. * @private
  5836. * @param {string} methodName The name of the `Math` method to use when rounding.
  5837. * @returns {Function} Returns the new round function.
  5838. */
  5839. function createRound(methodName) {
  5840. var func = Math[methodName];
  5841. return function(number, precision) {
  5842. number = toNumber(number);
  5843. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  5844. if (precision) {
  5845. // Shift with exponential notation to avoid floating-point issues.
  5846. // See [MDN](https://mdn.io/round#Examples) for more details.
  5847. var pair = (toString(number) + 'e').split('e'),
  5848. value = func(pair[0] + 'e' + (+pair[1] + precision));
  5849. pair = (toString(value) + 'e').split('e');
  5850. return +(pair[0] + 'e' + (+pair[1] - precision));
  5851. }
  5852. return func(number);
  5853. };
  5854. }
  5855. /**
  5856. * Creates a set object of `values`.
  5857. *
  5858. * @private
  5859. * @param {Array} values The values to add to the set.
  5860. * @returns {Object} Returns the new set.
  5861. */
  5862. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  5863. return new Set(values);
  5864. };
  5865. /**
  5866. * Creates a `_.toPairs` or `_.toPairsIn` function.
  5867. *
  5868. * @private
  5869. * @param {Function} keysFunc The function to get the keys of a given object.
  5870. * @returns {Function} Returns the new pairs function.
  5871. */
  5872. function createToPairs(keysFunc) {
  5873. return function(object) {
  5874. var tag = getTag(object);
  5875. if (tag == mapTag) {
  5876. return mapToArray(object);
  5877. }
  5878. if (tag == setTag) {
  5879. return setToPairs(object);
  5880. }
  5881. return baseToPairs(object, keysFunc(object));
  5882. };
  5883. }
  5884. /**
  5885. * Creates a function that either curries or invokes `func` with optional
  5886. * `this` binding and partially applied arguments.
  5887. *
  5888. * @private
  5889. * @param {Function|string} func The function or method name to wrap.
  5890. * @param {number} bitmask The bitmask flags.
  5891. * 1 - `_.bind`
  5892. * 2 - `_.bindKey`
  5893. * 4 - `_.curry` or `_.curryRight` of a bound function
  5894. * 8 - `_.curry`
  5895. * 16 - `_.curryRight`
  5896. * 32 - `_.partial`
  5897. * 64 - `_.partialRight`
  5898. * 128 - `_.rearg`
  5899. * 256 - `_.ary`
  5900. * 512 - `_.flip`
  5901. * @param {*} [thisArg] The `this` binding of `func`.
  5902. * @param {Array} [partials] The arguments to be partially applied.
  5903. * @param {Array} [holders] The `partials` placeholder indexes.
  5904. * @param {Array} [argPos] The argument positions of the new function.
  5905. * @param {number} [ary] The arity cap of `func`.
  5906. * @param {number} [arity] The arity of `func`.
  5907. * @returns {Function} Returns the new wrapped function.
  5908. */
  5909. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  5910. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  5911. if (!isBindKey && typeof func != 'function') {
  5912. throw new TypeError(FUNC_ERROR_TEXT);
  5913. }
  5914. var length = partials ? partials.length : 0;
  5915. if (!length) {
  5916. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  5917. partials = holders = undefined;
  5918. }
  5919. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  5920. arity = arity === undefined ? arity : toInteger(arity);
  5921. length -= holders ? holders.length : 0;
  5922. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  5923. var partialsRight = partials,
  5924. holdersRight = holders;
  5925. partials = holders = undefined;
  5926. }
  5927. var data = isBindKey ? undefined : getData(func);
  5928. var newData = [
  5929. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  5930. argPos, ary, arity
  5931. ];
  5932. if (data) {
  5933. mergeData(newData, data);
  5934. }
  5935. func = newData[0];
  5936. bitmask = newData[1];
  5937. thisArg = newData[2];
  5938. partials = newData[3];
  5939. holders = newData[4];
  5940. arity = newData[9] = newData[9] === undefined
  5941. ? (isBindKey ? 0 : func.length)
  5942. : nativeMax(newData[9] - length, 0);
  5943. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  5944. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  5945. }
  5946. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  5947. var result = createBind(func, bitmask, thisArg);
  5948. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  5949. result = createCurry(func, bitmask, arity);
  5950. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  5951. result = createPartial(func, bitmask, thisArg, partials);
  5952. } else {
  5953. result = createHybrid.apply(undefined, newData);
  5954. }
  5955. var setter = data ? baseSetData : setData;
  5956. return setWrapToString(setter(result, newData), func, bitmask);
  5957. }
  5958. /**
  5959. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  5960. * of source objects to the destination object for all destination properties
  5961. * that resolve to `undefined`.
  5962. *
  5963. * @private
  5964. * @param {*} objValue The destination value.
  5965. * @param {*} srcValue The source value.
  5966. * @param {string} key The key of the property to assign.
  5967. * @param {Object} object The parent object of `objValue`.
  5968. * @returns {*} Returns the value to assign.
  5969. */
  5970. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5971. if (objValue === undefined ||
  5972. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  5973. return srcValue;
  5974. }
  5975. return objValue;
  5976. }
  5977. /**
  5978. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  5979. * objects into destination objects that are passed thru.
  5980. *
  5981. * @private
  5982. * @param {*} objValue The destination value.
  5983. * @param {*} srcValue The source value.
  5984. * @param {string} key The key of the property to merge.
  5985. * @param {Object} object The parent object of `objValue`.
  5986. * @param {Object} source The parent object of `srcValue`.
  5987. * @param {Object} [stack] Tracks traversed source values and their merged
  5988. * counterparts.
  5989. * @returns {*} Returns the value to assign.
  5990. */
  5991. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  5992. if (isObject(objValue) && isObject(srcValue)) {
  5993. // Recursively merge objects and arrays (susceptible to call stack limits).
  5994. stack.set(srcValue, objValue);
  5995. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  5996. stack['delete'](srcValue);
  5997. }
  5998. return objValue;
  5999. }
  6000. /**
  6001. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  6002. * objects.
  6003. *
  6004. * @private
  6005. * @param {*} value The value to inspect.
  6006. * @param {string} key The key of the property to inspect.
  6007. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  6008. */
  6009. function customOmitClone(value) {
  6010. return isPlainObject(value) ? undefined : value;
  6011. }
  6012. /**
  6013. * A specialized version of `baseIsEqualDeep` for arrays with support for
  6014. * partial deep comparisons.
  6015. *
  6016. * @private
  6017. * @param {Array} array The array to compare.
  6018. * @param {Array} other The other array to compare.
  6019. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6020. * @param {Function} customizer The function to customize comparisons.
  6021. * @param {Function} equalFunc The function to determine equivalents of values.
  6022. * @param {Object} stack Tracks traversed `array` and `other` objects.
  6023. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  6024. */
  6025. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  6026. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6027. arrLength = array.length,
  6028. othLength = other.length;
  6029. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  6030. return false;
  6031. }
  6032. // Assume cyclic values are equal.
  6033. var stacked = stack.get(array);
  6034. if (stacked && stack.get(other)) {
  6035. return stacked == other;
  6036. }
  6037. var index = -1,
  6038. result = true,
  6039. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  6040. stack.set(array, other);
  6041. stack.set(other, array);
  6042. // Ignore non-index properties.
  6043. while (++index < arrLength) {
  6044. var arrValue = array[index],
  6045. othValue = other[index];
  6046. if (customizer) {
  6047. var compared = isPartial
  6048. ? customizer(othValue, arrValue, index, other, array, stack)
  6049. : customizer(arrValue, othValue, index, array, other, stack);
  6050. }
  6051. if (compared !== undefined) {
  6052. if (compared) {
  6053. continue;
  6054. }
  6055. result = false;
  6056. break;
  6057. }
  6058. // Recursively compare arrays (susceptible to call stack limits).
  6059. if (seen) {
  6060. if (!arraySome(other, function(othValue, othIndex) {
  6061. if (!cacheHas(seen, othIndex) &&
  6062. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  6063. return seen.push(othIndex);
  6064. }
  6065. })) {
  6066. result = false;
  6067. break;
  6068. }
  6069. } else if (!(
  6070. arrValue === othValue ||
  6071. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  6072. )) {
  6073. result = false;
  6074. break;
  6075. }
  6076. }
  6077. stack['delete'](array);
  6078. stack['delete'](other);
  6079. return result;
  6080. }
  6081. /**
  6082. * A specialized version of `baseIsEqualDeep` for comparing objects of
  6083. * the same `toStringTag`.
  6084. *
  6085. * **Note:** This function only supports comparing values with tags of
  6086. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6087. *
  6088. * @private
  6089. * @param {Object} object The object to compare.
  6090. * @param {Object} other The other object to compare.
  6091. * @param {string} tag The `toStringTag` of the objects to compare.
  6092. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6093. * @param {Function} customizer The function to customize comparisons.
  6094. * @param {Function} equalFunc The function to determine equivalents of values.
  6095. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6096. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6097. */
  6098. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  6099. switch (tag) {
  6100. case dataViewTag:
  6101. if ((object.byteLength != other.byteLength) ||
  6102. (object.byteOffset != other.byteOffset)) {
  6103. return false;
  6104. }
  6105. object = object.buffer;
  6106. other = other.buffer;
  6107. case arrayBufferTag:
  6108. if ((object.byteLength != other.byteLength) ||
  6109. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  6110. return false;
  6111. }
  6112. return true;
  6113. case boolTag:
  6114. case dateTag:
  6115. case numberTag:
  6116. // Coerce booleans to `1` or `0` and dates to milliseconds.
  6117. // Invalid dates are coerced to `NaN`.
  6118. return eq(+object, +other);
  6119. case errorTag:
  6120. return object.name == other.name && object.message == other.message;
  6121. case regexpTag:
  6122. case stringTag:
  6123. // Coerce regexes to strings and treat strings, primitives and objects,
  6124. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  6125. // for more details.
  6126. return object == (other + '');
  6127. case mapTag:
  6128. var convert = mapToArray;
  6129. case setTag:
  6130. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6131. convert || (convert = setToArray);
  6132. if (object.size != other.size && !isPartial) {
  6133. return false;
  6134. }
  6135. // Assume cyclic values are equal.
  6136. var stacked = stack.get(object);
  6137. if (stacked) {
  6138. return stacked == other;
  6139. }
  6140. bitmask |= COMPARE_UNORDERED_FLAG;
  6141. // Recursively compare objects (susceptible to call stack limits).
  6142. stack.set(object, other);
  6143. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6144. stack['delete'](object);
  6145. return result;
  6146. case symbolTag:
  6147. if (symbolValueOf) {
  6148. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6149. }
  6150. }
  6151. return false;
  6152. }
  6153. /**
  6154. * A specialized version of `baseIsEqualDeep` for objects with support for
  6155. * partial deep comparisons.
  6156. *
  6157. * @private
  6158. * @param {Object} object The object to compare.
  6159. * @param {Object} other The other object to compare.
  6160. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6161. * @param {Function} customizer The function to customize comparisons.
  6162. * @param {Function} equalFunc The function to determine equivalents of values.
  6163. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6164. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6165. */
  6166. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6167. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6168. objProps = getAllKeys(object),
  6169. objLength = objProps.length,
  6170. othProps = getAllKeys(other),
  6171. othLength = othProps.length;
  6172. if (objLength != othLength && !isPartial) {
  6173. return false;
  6174. }
  6175. var index = objLength;
  6176. while (index--) {
  6177. var key = objProps[index];
  6178. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  6179. return false;
  6180. }
  6181. }
  6182. // Assume cyclic values are equal.
  6183. var stacked = stack.get(object);
  6184. if (stacked && stack.get(other)) {
  6185. return stacked == other;
  6186. }
  6187. var result = true;
  6188. stack.set(object, other);
  6189. stack.set(other, object);
  6190. var skipCtor = isPartial;
  6191. while (++index < objLength) {
  6192. key = objProps[index];
  6193. var objValue = object[key],
  6194. othValue = other[key];
  6195. if (customizer) {
  6196. var compared = isPartial
  6197. ? customizer(othValue, objValue, key, other, object, stack)
  6198. : customizer(objValue, othValue, key, object, other, stack);
  6199. }
  6200. // Recursively compare objects (susceptible to call stack limits).
  6201. if (!(compared === undefined
  6202. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  6203. : compared
  6204. )) {
  6205. result = false;
  6206. break;
  6207. }
  6208. skipCtor || (skipCtor = key == 'constructor');
  6209. }
  6210. if (result && !skipCtor) {
  6211. var objCtor = object.constructor,
  6212. othCtor = other.constructor;
  6213. // Non `Object` object instances with different constructors are not equal.
  6214. if (objCtor != othCtor &&
  6215. ('constructor' in object && 'constructor' in other) &&
  6216. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  6217. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  6218. result = false;
  6219. }
  6220. }
  6221. stack['delete'](object);
  6222. stack['delete'](other);
  6223. return result;
  6224. }
  6225. /**
  6226. * A specialized version of `baseRest` which flattens the rest array.
  6227. *
  6228. * @private
  6229. * @param {Function} func The function to apply a rest parameter to.
  6230. * @returns {Function} Returns the new function.
  6231. */
  6232. function flatRest(func) {
  6233. return setToString(overRest(func, undefined, flatten), func + '');
  6234. }
  6235. /**
  6236. * Creates an array of own enumerable property names and symbols of `object`.
  6237. *
  6238. * @private
  6239. * @param {Object} object The object to query.
  6240. * @returns {Array} Returns the array of property names and symbols.
  6241. */
  6242. function getAllKeys(object) {
  6243. return baseGetAllKeys(object, keys, getSymbols);
  6244. }
  6245. /**
  6246. * Creates an array of own and inherited enumerable property names and
  6247. * symbols of `object`.
  6248. *
  6249. * @private
  6250. * @param {Object} object The object to query.
  6251. * @returns {Array} Returns the array of property names and symbols.
  6252. */
  6253. function getAllKeysIn(object) {
  6254. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  6255. }
  6256. /**
  6257. * Gets metadata for `func`.
  6258. *
  6259. * @private
  6260. * @param {Function} func The function to query.
  6261. * @returns {*} Returns the metadata for `func`.
  6262. */
  6263. var getData = !metaMap ? noop : function(func) {
  6264. return metaMap.get(func);
  6265. };
  6266. /**
  6267. * Gets the name of `func`.
  6268. *
  6269. * @private
  6270. * @param {Function} func The function to query.
  6271. * @returns {string} Returns the function name.
  6272. */
  6273. function getFuncName(func) {
  6274. var result = (func.name + ''),
  6275. array = realNames[result],
  6276. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  6277. while (length--) {
  6278. var data = array[length],
  6279. otherFunc = data.func;
  6280. if (otherFunc == null || otherFunc == func) {
  6281. return data.name;
  6282. }
  6283. }
  6284. return result;
  6285. }
  6286. /**
  6287. * Gets the argument placeholder value for `func`.
  6288. *
  6289. * @private
  6290. * @param {Function} func The function to inspect.
  6291. * @returns {*} Returns the placeholder value.
  6292. */
  6293. function getHolder(func) {
  6294. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  6295. return object.placeholder;
  6296. }
  6297. /**
  6298. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  6299. * this function returns the custom method, otherwise it returns `baseIteratee`.
  6300. * If arguments are provided, the chosen function is invoked with them and
  6301. * its result is returned.
  6302. *
  6303. * @private
  6304. * @param {*} [value] The value to convert to an iteratee.
  6305. * @param {number} [arity] The arity of the created iteratee.
  6306. * @returns {Function} Returns the chosen function or its result.
  6307. */
  6308. function getIteratee() {
  6309. var result = lodash.iteratee || iteratee;
  6310. result = result === iteratee ? baseIteratee : result;
  6311. return arguments.length ? result(arguments[0], arguments[1]) : result;
  6312. }
  6313. /**
  6314. * Gets the data for `map`.
  6315. *
  6316. * @private
  6317. * @param {Object} map The map to query.
  6318. * @param {string} key The reference key.
  6319. * @returns {*} Returns the map data.
  6320. */
  6321. function getMapData(map, key) {
  6322. var data = map.__data__;
  6323. return isKeyable(key)
  6324. ? data[typeof key == 'string' ? 'string' : 'hash']
  6325. : data.map;
  6326. }
  6327. /**
  6328. * Gets the property names, values, and compare flags of `object`.
  6329. *
  6330. * @private
  6331. * @param {Object} object The object to query.
  6332. * @returns {Array} Returns the match data of `object`.
  6333. */
  6334. function getMatchData(object) {
  6335. var result = keys(object),
  6336. length = result.length;
  6337. while (length--) {
  6338. var key = result[length],
  6339. value = object[key];
  6340. result[length] = [key, value, isStrictComparable(value)];
  6341. }
  6342. return result;
  6343. }
  6344. /**
  6345. * Gets the native function at `key` of `object`.
  6346. *
  6347. * @private
  6348. * @param {Object} object The object to query.
  6349. * @param {string} key The key of the method to get.
  6350. * @returns {*} Returns the function if it's native, else `undefined`.
  6351. */
  6352. function getNative(object, key) {
  6353. var value = getValue(object, key);
  6354. return baseIsNative(value) ? value : undefined;
  6355. }
  6356. /**
  6357. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6358. *
  6359. * @private
  6360. * @param {*} value The value to query.
  6361. * @returns {string} Returns the raw `toStringTag`.
  6362. */
  6363. function getRawTag(value) {
  6364. var isOwn = hasOwnProperty.call(value, symToStringTag),
  6365. tag = value[symToStringTag];
  6366. try {
  6367. value[symToStringTag] = undefined;
  6368. var unmasked = true;
  6369. } catch (e) {}
  6370. var result = nativeObjectToString.call(value);
  6371. if (unmasked) {
  6372. if (isOwn) {
  6373. value[symToStringTag] = tag;
  6374. } else {
  6375. delete value[symToStringTag];
  6376. }
  6377. }
  6378. return result;
  6379. }
  6380. /**
  6381. * Creates an array of the own enumerable symbols of `object`.
  6382. *
  6383. * @private
  6384. * @param {Object} object The object to query.
  6385. * @returns {Array} Returns the array of symbols.
  6386. */
  6387. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  6388. if (object == null) {
  6389. return [];
  6390. }
  6391. object = Object(object);
  6392. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  6393. return propertyIsEnumerable.call(object, symbol);
  6394. });
  6395. };
  6396. /**
  6397. * Creates an array of the own and inherited enumerable symbols of `object`.
  6398. *
  6399. * @private
  6400. * @param {Object} object The object to query.
  6401. * @returns {Array} Returns the array of symbols.
  6402. */
  6403. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  6404. var result = [];
  6405. while (object) {
  6406. arrayPush(result, getSymbols(object));
  6407. object = getPrototype(object);
  6408. }
  6409. return result;
  6410. };
  6411. /**
  6412. * Gets the `toStringTag` of `value`.
  6413. *
  6414. * @private
  6415. * @param {*} value The value to query.
  6416. * @returns {string} Returns the `toStringTag`.
  6417. */
  6418. var getTag = baseGetTag;
  6419. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  6420. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6421. (Map && getTag(new Map) != mapTag) ||
  6422. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6423. (Set && getTag(new Set) != setTag) ||
  6424. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6425. getTag = function(value) {
  6426. var result = baseGetTag(value),
  6427. Ctor = result == objectTag ? value.constructor : undefined,
  6428. ctorString = Ctor ? toSource(Ctor) : '';
  6429. if (ctorString) {
  6430. switch (ctorString) {
  6431. case dataViewCtorString: return dataViewTag;
  6432. case mapCtorString: return mapTag;
  6433. case promiseCtorString: return promiseTag;
  6434. case setCtorString: return setTag;
  6435. case weakMapCtorString: return weakMapTag;
  6436. }
  6437. }
  6438. return result;
  6439. };
  6440. }
  6441. /**
  6442. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  6443. *
  6444. * @private
  6445. * @param {number} start The start of the view.
  6446. * @param {number} end The end of the view.
  6447. * @param {Array} transforms The transformations to apply to the view.
  6448. * @returns {Object} Returns an object containing the `start` and `end`
  6449. * positions of the view.
  6450. */
  6451. function getView(start, end, transforms) {
  6452. var index = -1,
  6453. length = transforms.length;
  6454. while (++index < length) {
  6455. var data = transforms[index],
  6456. size = data.size;
  6457. switch (data.type) {
  6458. case 'drop': start += size; break;
  6459. case 'dropRight': end -= size; break;
  6460. case 'take': end = nativeMin(end, start + size); break;
  6461. case 'takeRight': start = nativeMax(start, end - size); break;
  6462. }
  6463. }
  6464. return { 'start': start, 'end': end };
  6465. }
  6466. /**
  6467. * Extracts wrapper details from the `source` body comment.
  6468. *
  6469. * @private
  6470. * @param {string} source The source to inspect.
  6471. * @returns {Array} Returns the wrapper details.
  6472. */
  6473. function getWrapDetails(source) {
  6474. var match = source.match(reWrapDetails);
  6475. return match ? match[1].split(reSplitDetails) : [];
  6476. }
  6477. /**
  6478. * Checks if `path` exists on `object`.
  6479. *
  6480. * @private
  6481. * @param {Object} object The object to query.
  6482. * @param {Array|string} path The path to check.
  6483. * @param {Function} hasFunc The function to check properties.
  6484. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6485. */
  6486. function hasPath(object, path, hasFunc) {
  6487. path = castPath(path, object);
  6488. var index = -1,
  6489. length = path.length,
  6490. result = false;
  6491. while (++index < length) {
  6492. var key = toKey(path[index]);
  6493. if (!(result = object != null && hasFunc(object, key))) {
  6494. break;
  6495. }
  6496. object = object[key];
  6497. }
  6498. if (result || ++index != length) {
  6499. return result;
  6500. }
  6501. length = object == null ? 0 : object.length;
  6502. return !!length && isLength(length) && isIndex(key, length) &&
  6503. (isArray(object) || isArguments(object));
  6504. }
  6505. /**
  6506. * Initializes an array clone.
  6507. *
  6508. * @private
  6509. * @param {Array} array The array to clone.
  6510. * @returns {Array} Returns the initialized clone.
  6511. */
  6512. function initCloneArray(array) {
  6513. var length = array.length,
  6514. result = new array.constructor(length);
  6515. // Add properties assigned by `RegExp#exec`.
  6516. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  6517. result.index = array.index;
  6518. result.input = array.input;
  6519. }
  6520. return result;
  6521. }
  6522. /**
  6523. * Initializes an object clone.
  6524. *
  6525. * @private
  6526. * @param {Object} object The object to clone.
  6527. * @returns {Object} Returns the initialized clone.
  6528. */
  6529. function initCloneObject(object) {
  6530. return (typeof object.constructor == 'function' && !isPrototype(object))
  6531. ? baseCreate(getPrototype(object))
  6532. : {};
  6533. }
  6534. /**
  6535. * Initializes an object clone based on its `toStringTag`.
  6536. *
  6537. * **Note:** This function only supports cloning values with tags of
  6538. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  6539. *
  6540. * @private
  6541. * @param {Object} object The object to clone.
  6542. * @param {string} tag The `toStringTag` of the object to clone.
  6543. * @param {boolean} [isDeep] Specify a deep clone.
  6544. * @returns {Object} Returns the initialized clone.
  6545. */
  6546. function initCloneByTag(object, tag, isDeep) {
  6547. var Ctor = object.constructor;
  6548. switch (tag) {
  6549. case arrayBufferTag:
  6550. return cloneArrayBuffer(object);
  6551. case boolTag:
  6552. case dateTag:
  6553. return new Ctor(+object);
  6554. case dataViewTag:
  6555. return cloneDataView(object, isDeep);
  6556. case float32Tag: case float64Tag:
  6557. case int8Tag: case int16Tag: case int32Tag:
  6558. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  6559. return cloneTypedArray(object, isDeep);
  6560. case mapTag:
  6561. return new Ctor;
  6562. case numberTag:
  6563. case stringTag:
  6564. return new Ctor(object);
  6565. case regexpTag:
  6566. return cloneRegExp(object);
  6567. case setTag:
  6568. return new Ctor;
  6569. case symbolTag:
  6570. return cloneSymbol(object);
  6571. }
  6572. }
  6573. /**
  6574. * Inserts wrapper `details` in a comment at the top of the `source` body.
  6575. *
  6576. * @private
  6577. * @param {string} source The source to modify.
  6578. * @returns {Array} details The details to insert.
  6579. * @returns {string} Returns the modified source.
  6580. */
  6581. function insertWrapDetails(source, details) {
  6582. var length = details.length;
  6583. if (!length) {
  6584. return source;
  6585. }
  6586. var lastIndex = length - 1;
  6587. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  6588. details = details.join(length > 2 ? ', ' : ' ');
  6589. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  6590. }
  6591. /**
  6592. * Checks if `value` is a flattenable `arguments` object or array.
  6593. *
  6594. * @private
  6595. * @param {*} value The value to check.
  6596. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  6597. */
  6598. function isFlattenable(value) {
  6599. return isArray(value) || isArguments(value) ||
  6600. !!(spreadableSymbol && value && value[spreadableSymbol]);
  6601. }
  6602. /**
  6603. * Checks if `value` is a valid array-like index.
  6604. *
  6605. * @private
  6606. * @param {*} value The value to check.
  6607. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  6608. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  6609. */
  6610. function isIndex(value, length) {
  6611. var type = typeof value;
  6612. length = length == null ? MAX_SAFE_INTEGER : length;
  6613. return !!length &&
  6614. (type == 'number' ||
  6615. (type != 'symbol' && reIsUint.test(value))) &&
  6616. (value > -1 && value % 1 == 0 && value < length);
  6617. }
  6618. /**
  6619. * Checks if the given arguments are from an iteratee call.
  6620. *
  6621. * @private
  6622. * @param {*} value The potential iteratee value argument.
  6623. * @param {*} index The potential iteratee index or key argument.
  6624. * @param {*} object The potential iteratee object argument.
  6625. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  6626. * else `false`.
  6627. */
  6628. function isIterateeCall(value, index, object) {
  6629. if (!isObject(object)) {
  6630. return false;
  6631. }
  6632. var type = typeof index;
  6633. if (type == 'number'
  6634. ? (isArrayLike(object) && isIndex(index, object.length))
  6635. : (type == 'string' && index in object)
  6636. ) {
  6637. return eq(object[index], value);
  6638. }
  6639. return false;
  6640. }
  6641. /**
  6642. * Checks if `value` is a property name and not a property path.
  6643. *
  6644. * @private
  6645. * @param {*} value The value to check.
  6646. * @param {Object} [object] The object to query keys on.
  6647. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  6648. */
  6649. function isKey(value, object) {
  6650. if (isArray(value)) {
  6651. return false;
  6652. }
  6653. var type = typeof value;
  6654. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  6655. value == null || isSymbol(value)) {
  6656. return true;
  6657. }
  6658. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  6659. (object != null && value in Object(object));
  6660. }
  6661. /**
  6662. * Checks if `value` is suitable for use as unique object key.
  6663. *
  6664. * @private
  6665. * @param {*} value The value to check.
  6666. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  6667. */
  6668. function isKeyable(value) {
  6669. var type = typeof value;
  6670. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  6671. ? (value !== '__proto__')
  6672. : (value === null);
  6673. }
  6674. /**
  6675. * Checks if `func` has a lazy counterpart.
  6676. *
  6677. * @private
  6678. * @param {Function} func The function to check.
  6679. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  6680. * else `false`.
  6681. */
  6682. function isLaziable(func) {
  6683. var funcName = getFuncName(func),
  6684. other = lodash[funcName];
  6685. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  6686. return false;
  6687. }
  6688. if (func === other) {
  6689. return true;
  6690. }
  6691. var data = getData(other);
  6692. return !!data && func === data[0];
  6693. }
  6694. /**
  6695. * Checks if `func` has its source masked.
  6696. *
  6697. * @private
  6698. * @param {Function} func The function to check.
  6699. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  6700. */
  6701. function isMasked(func) {
  6702. return !!maskSrcKey && (maskSrcKey in func);
  6703. }
  6704. /**
  6705. * Checks if `func` is capable of being masked.
  6706. *
  6707. * @private
  6708. * @param {*} value The value to check.
  6709. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  6710. */
  6711. var isMaskable = coreJsData ? isFunction : stubFalse;
  6712. /**
  6713. * Checks if `value` is likely a prototype object.
  6714. *
  6715. * @private
  6716. * @param {*} value The value to check.
  6717. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  6718. */
  6719. function isPrototype(value) {
  6720. var Ctor = value && value.constructor,
  6721. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  6722. return value === proto;
  6723. }
  6724. /**
  6725. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  6726. *
  6727. * @private
  6728. * @param {*} value The value to check.
  6729. * @returns {boolean} Returns `true` if `value` if suitable for strict
  6730. * equality comparisons, else `false`.
  6731. */
  6732. function isStrictComparable(value) {
  6733. return value === value && !isObject(value);
  6734. }
  6735. /**
  6736. * A specialized version of `matchesProperty` for source values suitable
  6737. * for strict equality comparisons, i.e. `===`.
  6738. *
  6739. * @private
  6740. * @param {string} key The key of the property to get.
  6741. * @param {*} srcValue The value to match.
  6742. * @returns {Function} Returns the new spec function.
  6743. */
  6744. function matchesStrictComparable(key, srcValue) {
  6745. return function(object) {
  6746. if (object == null) {
  6747. return false;
  6748. }
  6749. return object[key] === srcValue &&
  6750. (srcValue !== undefined || (key in Object(object)));
  6751. };
  6752. }
  6753. /**
  6754. * A specialized version of `_.memoize` which clears the memoized function's
  6755. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  6756. *
  6757. * @private
  6758. * @param {Function} func The function to have its output memoized.
  6759. * @returns {Function} Returns the new memoized function.
  6760. */
  6761. function memoizeCapped(func) {
  6762. var result = memoize(func, function(key) {
  6763. if (cache.size === MAX_MEMOIZE_SIZE) {
  6764. cache.clear();
  6765. }
  6766. return key;
  6767. });
  6768. var cache = result.cache;
  6769. return result;
  6770. }
  6771. /**
  6772. * Merges the function metadata of `source` into `data`.
  6773. *
  6774. * Merging metadata reduces the number of wrappers used to invoke a function.
  6775. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  6776. * may be applied regardless of execution order. Methods like `_.ary` and
  6777. * `_.rearg` modify function arguments, making the order in which they are
  6778. * executed important, preventing the merging of metadata. However, we make
  6779. * an exception for a safe combined case where curried functions have `_.ary`
  6780. * and or `_.rearg` applied.
  6781. *
  6782. * @private
  6783. * @param {Array} data The destination metadata.
  6784. * @param {Array} source The source metadata.
  6785. * @returns {Array} Returns `data`.
  6786. */
  6787. function mergeData(data, source) {
  6788. var bitmask = data[1],
  6789. srcBitmask = source[1],
  6790. newBitmask = bitmask | srcBitmask,
  6791. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  6792. var isCombo =
  6793. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  6794. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  6795. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  6796. // Exit early if metadata can't be merged.
  6797. if (!(isCommon || isCombo)) {
  6798. return data;
  6799. }
  6800. // Use source `thisArg` if available.
  6801. if (srcBitmask & WRAP_BIND_FLAG) {
  6802. data[2] = source[2];
  6803. // Set when currying a bound function.
  6804. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  6805. }
  6806. // Compose partial arguments.
  6807. var value = source[3];
  6808. if (value) {
  6809. var partials = data[3];
  6810. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  6811. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  6812. }
  6813. // Compose partial right arguments.
  6814. value = source[5];
  6815. if (value) {
  6816. partials = data[5];
  6817. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  6818. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  6819. }
  6820. // Use source `argPos` if available.
  6821. value = source[7];
  6822. if (value) {
  6823. data[7] = value;
  6824. }
  6825. // Use source `ary` if it's smaller.
  6826. if (srcBitmask & WRAP_ARY_FLAG) {
  6827. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  6828. }
  6829. // Use source `arity` if one is not provided.
  6830. if (data[9] == null) {
  6831. data[9] = source[9];
  6832. }
  6833. // Use source `func` and merge bitmasks.
  6834. data[0] = source[0];
  6835. data[1] = newBitmask;
  6836. return data;
  6837. }
  6838. /**
  6839. * This function is like
  6840. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  6841. * except that it includes inherited enumerable properties.
  6842. *
  6843. * @private
  6844. * @param {Object} object The object to query.
  6845. * @returns {Array} Returns the array of property names.
  6846. */
  6847. function nativeKeysIn(object) {
  6848. var result = [];
  6849. if (object != null) {
  6850. for (var key in Object(object)) {
  6851. result.push(key);
  6852. }
  6853. }
  6854. return result;
  6855. }
  6856. /**
  6857. * Converts `value` to a string using `Object.prototype.toString`.
  6858. *
  6859. * @private
  6860. * @param {*} value The value to convert.
  6861. * @returns {string} Returns the converted string.
  6862. */
  6863. function objectToString(value) {
  6864. return nativeObjectToString.call(value);
  6865. }
  6866. /**
  6867. * A specialized version of `baseRest` which transforms the rest array.
  6868. *
  6869. * @private
  6870. * @param {Function} func The function to apply a rest parameter to.
  6871. * @param {number} [start=func.length-1] The start position of the rest parameter.
  6872. * @param {Function} transform The rest array transform.
  6873. * @returns {Function} Returns the new function.
  6874. */
  6875. function overRest(func, start, transform) {
  6876. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  6877. return function() {
  6878. var args = arguments,
  6879. index = -1,
  6880. length = nativeMax(args.length - start, 0),
  6881. array = Array(length);
  6882. while (++index < length) {
  6883. array[index] = args[start + index];
  6884. }
  6885. index = -1;
  6886. var otherArgs = Array(start + 1);
  6887. while (++index < start) {
  6888. otherArgs[index] = args[index];
  6889. }
  6890. otherArgs[start] = transform(array);
  6891. return apply(func, this, otherArgs);
  6892. };
  6893. }
  6894. /**
  6895. * Gets the parent value at `path` of `object`.
  6896. *
  6897. * @private
  6898. * @param {Object} object The object to query.
  6899. * @param {Array} path The path to get the parent value of.
  6900. * @returns {*} Returns the parent value.
  6901. */
  6902. function parent(object, path) {
  6903. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  6904. }
  6905. /**
  6906. * Reorder `array` according to the specified indexes where the element at
  6907. * the first index is assigned as the first element, the element at
  6908. * the second index is assigned as the second element, and so on.
  6909. *
  6910. * @private
  6911. * @param {Array} array The array to reorder.
  6912. * @param {Array} indexes The arranged array indexes.
  6913. * @returns {Array} Returns `array`.
  6914. */
  6915. function reorder(array, indexes) {
  6916. var arrLength = array.length,
  6917. length = nativeMin(indexes.length, arrLength),
  6918. oldArray = copyArray(array);
  6919. while (length--) {
  6920. var index = indexes[length];
  6921. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  6922. }
  6923. return array;
  6924. }
  6925. /**
  6926. * Sets metadata for `func`.
  6927. *
  6928. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  6929. * period of time, it will trip its breaker and transition to an identity
  6930. * function to avoid garbage collection pauses in V8. See
  6931. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  6932. * for more details.
  6933. *
  6934. * @private
  6935. * @param {Function} func The function to associate metadata with.
  6936. * @param {*} data The metadata.
  6937. * @returns {Function} Returns `func`.
  6938. */
  6939. var setData = shortOut(baseSetData);
  6940. /**
  6941. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  6942. *
  6943. * @private
  6944. * @param {Function} func The function to delay.
  6945. * @param {number} wait The number of milliseconds to delay invocation.
  6946. * @returns {number|Object} Returns the timer id or timeout object.
  6947. */
  6948. var setTimeout = ctxSetTimeout || function(func, wait) {
  6949. return root.setTimeout(func, wait);
  6950. };
  6951. /**
  6952. * Sets the `toString` method of `func` to return `string`.
  6953. *
  6954. * @private
  6955. * @param {Function} func The function to modify.
  6956. * @param {Function} string The `toString` result.
  6957. * @returns {Function} Returns `func`.
  6958. */
  6959. var setToString = shortOut(baseSetToString);
  6960. /**
  6961. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  6962. * with wrapper details in a comment at the top of the source body.
  6963. *
  6964. * @private
  6965. * @param {Function} wrapper The function to modify.
  6966. * @param {Function} reference The reference function.
  6967. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  6968. * @returns {Function} Returns `wrapper`.
  6969. */
  6970. function setWrapToString(wrapper, reference, bitmask) {
  6971. var source = (reference + '');
  6972. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  6973. }
  6974. /**
  6975. * Creates a function that'll short out and invoke `identity` instead
  6976. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  6977. * milliseconds.
  6978. *
  6979. * @private
  6980. * @param {Function} func The function to restrict.
  6981. * @returns {Function} Returns the new shortable function.
  6982. */
  6983. function shortOut(func) {
  6984. var count = 0,
  6985. lastCalled = 0;
  6986. return function() {
  6987. var stamp = nativeNow(),
  6988. remaining = HOT_SPAN - (stamp - lastCalled);
  6989. lastCalled = stamp;
  6990. if (remaining > 0) {
  6991. if (++count >= HOT_COUNT) {
  6992. return arguments[0];
  6993. }
  6994. } else {
  6995. count = 0;
  6996. }
  6997. return func.apply(undefined, arguments);
  6998. };
  6999. }
  7000. /**
  7001. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  7002. *
  7003. * @private
  7004. * @param {Array} array The array to shuffle.
  7005. * @param {number} [size=array.length] The size of `array`.
  7006. * @returns {Array} Returns `array`.
  7007. */
  7008. function shuffleSelf(array, size) {
  7009. var index = -1,
  7010. length = array.length,
  7011. lastIndex = length - 1;
  7012. size = size === undefined ? length : size;
  7013. while (++index < size) {
  7014. var rand = baseRandom(index, lastIndex),
  7015. value = array[rand];
  7016. array[rand] = array[index];
  7017. array[index] = value;
  7018. }
  7019. array.length = size;
  7020. return array;
  7021. }
  7022. /**
  7023. * Converts `string` to a property path array.
  7024. *
  7025. * @private
  7026. * @param {string} string The string to convert.
  7027. * @returns {Array} Returns the property path array.
  7028. */
  7029. var stringToPath = memoizeCapped(function(string) {
  7030. var result = [];
  7031. if (string.charCodeAt(0) === 46 /* . */) {
  7032. result.push('');
  7033. }
  7034. string.replace(rePropName, function(match, number, quote, subString) {
  7035. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  7036. });
  7037. return result;
  7038. });
  7039. /**
  7040. * Converts `value` to a string key if it's not a string or symbol.
  7041. *
  7042. * @private
  7043. * @param {*} value The value to inspect.
  7044. * @returns {string|symbol} Returns the key.
  7045. */
  7046. function toKey(value) {
  7047. if (typeof value == 'string' || isSymbol(value)) {
  7048. return value;
  7049. }
  7050. var result = (value + '');
  7051. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  7052. }
  7053. /**
  7054. * Converts `func` to its source code.
  7055. *
  7056. * @private
  7057. * @param {Function} func The function to convert.
  7058. * @returns {string} Returns the source code.
  7059. */
  7060. function toSource(func) {
  7061. if (func != null) {
  7062. try {
  7063. return funcToString.call(func);
  7064. } catch (e) {}
  7065. try {
  7066. return (func + '');
  7067. } catch (e) {}
  7068. }
  7069. return '';
  7070. }
  7071. /**
  7072. * Updates wrapper `details` based on `bitmask` flags.
  7073. *
  7074. * @private
  7075. * @returns {Array} details The details to modify.
  7076. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7077. * @returns {Array} Returns `details`.
  7078. */
  7079. function updateWrapDetails(details, bitmask) {
  7080. arrayEach(wrapFlags, function(pair) {
  7081. var value = '_.' + pair[0];
  7082. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  7083. details.push(value);
  7084. }
  7085. });
  7086. return details.sort();
  7087. }
  7088. /**
  7089. * Creates a clone of `wrapper`.
  7090. *
  7091. * @private
  7092. * @param {Object} wrapper The wrapper to clone.
  7093. * @returns {Object} Returns the cloned wrapper.
  7094. */
  7095. function wrapperClone(wrapper) {
  7096. if (wrapper instanceof LazyWrapper) {
  7097. return wrapper.clone();
  7098. }
  7099. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  7100. result.__actions__ = copyArray(wrapper.__actions__);
  7101. result.__index__ = wrapper.__index__;
  7102. result.__values__ = wrapper.__values__;
  7103. return result;
  7104. }
  7105. /*------------------------------------------------------------------------*/
  7106. /**
  7107. * Creates an array of elements split into groups the length of `size`.
  7108. * If `array` can't be split evenly, the final chunk will be the remaining
  7109. * elements.
  7110. *
  7111. * @static
  7112. * @memberOf _
  7113. * @since 3.0.0
  7114. * @category Array
  7115. * @param {Array} array The array to process.
  7116. * @param {number} [size=1] The length of each chunk
  7117. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7118. * @returns {Array} Returns the new array of chunks.
  7119. * @example
  7120. *
  7121. * _.chunk(['a', 'b', 'c', 'd'], 2);
  7122. * // => [['a', 'b'], ['c', 'd']]
  7123. *
  7124. * _.chunk(['a', 'b', 'c', 'd'], 3);
  7125. * // => [['a', 'b', 'c'], ['d']]
  7126. */
  7127. function chunk(array, size, guard) {
  7128. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  7129. size = 1;
  7130. } else {
  7131. size = nativeMax(toInteger(size), 0);
  7132. }
  7133. var length = array == null ? 0 : array.length;
  7134. if (!length || size < 1) {
  7135. return [];
  7136. }
  7137. var index = 0,
  7138. resIndex = 0,
  7139. result = Array(nativeCeil(length / size));
  7140. while (index < length) {
  7141. result[resIndex++] = baseSlice(array, index, (index += size));
  7142. }
  7143. return result;
  7144. }
  7145. /**
  7146. * Creates an array with all falsey values removed. The values `false`, `null`,
  7147. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7148. *
  7149. * @static
  7150. * @memberOf _
  7151. * @since 0.1.0
  7152. * @category Array
  7153. * @param {Array} array The array to compact.
  7154. * @returns {Array} Returns the new array of filtered values.
  7155. * @example
  7156. *
  7157. * _.compact([0, 1, false, 2, '', 3]);
  7158. * // => [1, 2, 3]
  7159. */
  7160. function compact(array) {
  7161. var index = -1,
  7162. length = array == null ? 0 : array.length,
  7163. resIndex = 0,
  7164. result = [];
  7165. while (++index < length) {
  7166. var value = array[index];
  7167. if (value) {
  7168. result[resIndex++] = value;
  7169. }
  7170. }
  7171. return result;
  7172. }
  7173. /**
  7174. * Creates a new array concatenating `array` with any additional arrays
  7175. * and/or values.
  7176. *
  7177. * @static
  7178. * @memberOf _
  7179. * @since 4.0.0
  7180. * @category Array
  7181. * @param {Array} array The array to concatenate.
  7182. * @param {...*} [values] The values to concatenate.
  7183. * @returns {Array} Returns the new concatenated array.
  7184. * @example
  7185. *
  7186. * var array = [1];
  7187. * var other = _.concat(array, 2, [3], [[4]]);
  7188. *
  7189. * console.log(other);
  7190. * // => [1, 2, 3, [4]]
  7191. *
  7192. * console.log(array);
  7193. * // => [1]
  7194. */
  7195. function concat() {
  7196. var length = arguments.length;
  7197. if (!length) {
  7198. return [];
  7199. }
  7200. var args = Array(length - 1),
  7201. array = arguments[0],
  7202. index = length;
  7203. while (index--) {
  7204. args[index - 1] = arguments[index];
  7205. }
  7206. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  7207. }
  7208. /**
  7209. * Creates an array of `array` values not included in the other given arrays
  7210. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7211. * for equality comparisons. The order and references of result values are
  7212. * determined by the first array.
  7213. *
  7214. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  7215. *
  7216. * @static
  7217. * @memberOf _
  7218. * @since 0.1.0
  7219. * @category Array
  7220. * @param {Array} array The array to inspect.
  7221. * @param {...Array} [values] The values to exclude.
  7222. * @returns {Array} Returns the new array of filtered values.
  7223. * @see _.without, _.xor
  7224. * @example
  7225. *
  7226. * _.difference([2, 1], [2, 3]);
  7227. * // => [1]
  7228. */
  7229. var difference = baseRest(function(array, values) {
  7230. return isArrayLikeObject(array)
  7231. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  7232. : [];
  7233. });
  7234. /**
  7235. * This method is like `_.difference` except that it accepts `iteratee` which
  7236. * is invoked for each element of `array` and `values` to generate the criterion
  7237. * by which they're compared. The order and references of result values are
  7238. * determined by the first array. The iteratee is invoked with one argument:
  7239. * (value).
  7240. *
  7241. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  7242. *
  7243. * @static
  7244. * @memberOf _
  7245. * @since 4.0.0
  7246. * @category Array
  7247. * @param {Array} array The array to inspect.
  7248. * @param {...Array} [values] The values to exclude.
  7249. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7250. * @returns {Array} Returns the new array of filtered values.
  7251. * @example
  7252. *
  7253. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7254. * // => [1.2]
  7255. *
  7256. * // The `_.property` iteratee shorthand.
  7257. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  7258. * // => [{ 'x': 2 }]
  7259. */
  7260. var differenceBy = baseRest(function(array, values) {
  7261. var iteratee = last(values);
  7262. if (isArrayLikeObject(iteratee)) {
  7263. iteratee = undefined;
  7264. }
  7265. return isArrayLikeObject(array)
  7266. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  7267. : [];
  7268. });
  7269. /**
  7270. * This method is like `_.difference` except that it accepts `comparator`
  7271. * which is invoked to compare elements of `array` to `values`. The order and
  7272. * references of result values are determined by the first array. The comparator
  7273. * is invoked with two arguments: (arrVal, othVal).
  7274. *
  7275. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  7276. *
  7277. * @static
  7278. * @memberOf _
  7279. * @since 4.0.0
  7280. * @category Array
  7281. * @param {Array} array The array to inspect.
  7282. * @param {...Array} [values] The values to exclude.
  7283. * @param {Function} [comparator] The comparator invoked per element.
  7284. * @returns {Array} Returns the new array of filtered values.
  7285. * @example
  7286. *
  7287. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7288. *
  7289. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  7290. * // => [{ 'x': 2, 'y': 1 }]
  7291. */
  7292. var differenceWith = baseRest(function(array, values) {
  7293. var comparator = last(values);
  7294. if (isArrayLikeObject(comparator)) {
  7295. comparator = undefined;
  7296. }
  7297. return isArrayLikeObject(array)
  7298. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  7299. : [];
  7300. });
  7301. /**
  7302. * Creates a slice of `array` with `n` elements dropped from the beginning.
  7303. *
  7304. * @static
  7305. * @memberOf _
  7306. * @since 0.5.0
  7307. * @category Array
  7308. * @param {Array} array The array to query.
  7309. * @param {number} [n=1] The number of elements to drop.
  7310. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7311. * @returns {Array} Returns the slice of `array`.
  7312. * @example
  7313. *
  7314. * _.drop([1, 2, 3]);
  7315. * // => [2, 3]
  7316. *
  7317. * _.drop([1, 2, 3], 2);
  7318. * // => [3]
  7319. *
  7320. * _.drop([1, 2, 3], 5);
  7321. * // => []
  7322. *
  7323. * _.drop([1, 2, 3], 0);
  7324. * // => [1, 2, 3]
  7325. */
  7326. function drop(array, n, guard) {
  7327. var length = array == null ? 0 : array.length;
  7328. if (!length) {
  7329. return [];
  7330. }
  7331. n = (guard || n === undefined) ? 1 : toInteger(n);
  7332. return baseSlice(array, n < 0 ? 0 : n, length);
  7333. }
  7334. /**
  7335. * Creates a slice of `array` with `n` elements dropped from the end.
  7336. *
  7337. * @static
  7338. * @memberOf _
  7339. * @since 3.0.0
  7340. * @category Array
  7341. * @param {Array} array The array to query.
  7342. * @param {number} [n=1] The number of elements to drop.
  7343. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7344. * @returns {Array} Returns the slice of `array`.
  7345. * @example
  7346. *
  7347. * _.dropRight([1, 2, 3]);
  7348. * // => [1, 2]
  7349. *
  7350. * _.dropRight([1, 2, 3], 2);
  7351. * // => [1]
  7352. *
  7353. * _.dropRight([1, 2, 3], 5);
  7354. * // => []
  7355. *
  7356. * _.dropRight([1, 2, 3], 0);
  7357. * // => [1, 2, 3]
  7358. */
  7359. function dropRight(array, n, guard) {
  7360. var length = array == null ? 0 : array.length;
  7361. if (!length) {
  7362. return [];
  7363. }
  7364. n = (guard || n === undefined) ? 1 : toInteger(n);
  7365. n = length - n;
  7366. return baseSlice(array, 0, n < 0 ? 0 : n);
  7367. }
  7368. /**
  7369. * Creates a slice of `array` excluding elements dropped from the end.
  7370. * Elements are dropped until `predicate` returns falsey. The predicate is
  7371. * invoked with three arguments: (value, index, array).
  7372. *
  7373. * @static
  7374. * @memberOf _
  7375. * @since 3.0.0
  7376. * @category Array
  7377. * @param {Array} array The array to query.
  7378. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7379. * @returns {Array} Returns the slice of `array`.
  7380. * @example
  7381. *
  7382. * var users = [
  7383. * { 'user': 'barney', 'active': true },
  7384. * { 'user': 'fred', 'active': false },
  7385. * { 'user': 'pebbles', 'active': false }
  7386. * ];
  7387. *
  7388. * _.dropRightWhile(users, function(o) { return !o.active; });
  7389. * // => objects for ['barney']
  7390. *
  7391. * // The `_.matches` iteratee shorthand.
  7392. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  7393. * // => objects for ['barney', 'fred']
  7394. *
  7395. * // The `_.matchesProperty` iteratee shorthand.
  7396. * _.dropRightWhile(users, ['active', false]);
  7397. * // => objects for ['barney']
  7398. *
  7399. * // The `_.property` iteratee shorthand.
  7400. * _.dropRightWhile(users, 'active');
  7401. * // => objects for ['barney', 'fred', 'pebbles']
  7402. */
  7403. function dropRightWhile(array, predicate) {
  7404. return (array && array.length)
  7405. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  7406. : [];
  7407. }
  7408. /**
  7409. * Creates a slice of `array` excluding elements dropped from the beginning.
  7410. * Elements are dropped until `predicate` returns falsey. The predicate is
  7411. * invoked with three arguments: (value, index, array).
  7412. *
  7413. * @static
  7414. * @memberOf _
  7415. * @since 3.0.0
  7416. * @category Array
  7417. * @param {Array} array The array to query.
  7418. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7419. * @returns {Array} Returns the slice of `array`.
  7420. * @example
  7421. *
  7422. * var users = [
  7423. * { 'user': 'barney', 'active': false },
  7424. * { 'user': 'fred', 'active': false },
  7425. * { 'user': 'pebbles', 'active': true }
  7426. * ];
  7427. *
  7428. * _.dropWhile(users, function(o) { return !o.active; });
  7429. * // => objects for ['pebbles']
  7430. *
  7431. * // The `_.matches` iteratee shorthand.
  7432. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  7433. * // => objects for ['fred', 'pebbles']
  7434. *
  7435. * // The `_.matchesProperty` iteratee shorthand.
  7436. * _.dropWhile(users, ['active', false]);
  7437. * // => objects for ['pebbles']
  7438. *
  7439. * // The `_.property` iteratee shorthand.
  7440. * _.dropWhile(users, 'active');
  7441. * // => objects for ['barney', 'fred', 'pebbles']
  7442. */
  7443. function dropWhile(array, predicate) {
  7444. return (array && array.length)
  7445. ? baseWhile(array, getIteratee(predicate, 3), true)
  7446. : [];
  7447. }
  7448. /**
  7449. * Fills elements of `array` with `value` from `start` up to, but not
  7450. * including, `end`.
  7451. *
  7452. * **Note:** This method mutates `array`.
  7453. *
  7454. * @static
  7455. * @memberOf _
  7456. * @since 3.2.0
  7457. * @category Array
  7458. * @param {Array} array The array to fill.
  7459. * @param {*} value The value to fill `array` with.
  7460. * @param {number} [start=0] The start position.
  7461. * @param {number} [end=array.length] The end position.
  7462. * @returns {Array} Returns `array`.
  7463. * @example
  7464. *
  7465. * var array = [1, 2, 3];
  7466. *
  7467. * _.fill(array, 'a');
  7468. * console.log(array);
  7469. * // => ['a', 'a', 'a']
  7470. *
  7471. * _.fill(Array(3), 2);
  7472. * // => [2, 2, 2]
  7473. *
  7474. * _.fill([4, 6, 8, 10], '*', 1, 3);
  7475. * // => [4, '*', '*', 10]
  7476. */
  7477. function fill(array, value, start, end) {
  7478. var length = array == null ? 0 : array.length;
  7479. if (!length) {
  7480. return [];
  7481. }
  7482. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  7483. start = 0;
  7484. end = length;
  7485. }
  7486. return baseFill(array, value, start, end);
  7487. }
  7488. /**
  7489. * This method is like `_.find` except that it returns the index of the first
  7490. * element `predicate` returns truthy for instead of the element itself.
  7491. *
  7492. * @static
  7493. * @memberOf _
  7494. * @since 1.1.0
  7495. * @category Array
  7496. * @param {Array} array The array to inspect.
  7497. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7498. * @param {number} [fromIndex=0] The index to search from.
  7499. * @returns {number} Returns the index of the found element, else `-1`.
  7500. * @example
  7501. *
  7502. * var users = [
  7503. * { 'user': 'barney', 'active': false },
  7504. * { 'user': 'fred', 'active': false },
  7505. * { 'user': 'pebbles', 'active': true }
  7506. * ];
  7507. *
  7508. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  7509. * // => 0
  7510. *
  7511. * // The `_.matches` iteratee shorthand.
  7512. * _.findIndex(users, { 'user': 'fred', 'active': false });
  7513. * // => 1
  7514. *
  7515. * // The `_.matchesProperty` iteratee shorthand.
  7516. * _.findIndex(users, ['active', false]);
  7517. * // => 0
  7518. *
  7519. * // The `_.property` iteratee shorthand.
  7520. * _.findIndex(users, 'active');
  7521. * // => 2
  7522. */
  7523. function findIndex(array, predicate, fromIndex) {
  7524. var length = array == null ? 0 : array.length;
  7525. if (!length) {
  7526. return -1;
  7527. }
  7528. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7529. if (index < 0) {
  7530. index = nativeMax(length + index, 0);
  7531. }
  7532. return baseFindIndex(array, getIteratee(predicate, 3), index);
  7533. }
  7534. /**
  7535. * This method is like `_.findIndex` except that it iterates over elements
  7536. * of `collection` from right to left.
  7537. *
  7538. * @static
  7539. * @memberOf _
  7540. * @since 2.0.0
  7541. * @category Array
  7542. * @param {Array} array The array to inspect.
  7543. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7544. * @param {number} [fromIndex=array.length-1] The index to search from.
  7545. * @returns {number} Returns the index of the found element, else `-1`.
  7546. * @example
  7547. *
  7548. * var users = [
  7549. * { 'user': 'barney', 'active': true },
  7550. * { 'user': 'fred', 'active': false },
  7551. * { 'user': 'pebbles', 'active': false }
  7552. * ];
  7553. *
  7554. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  7555. * // => 2
  7556. *
  7557. * // The `_.matches` iteratee shorthand.
  7558. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  7559. * // => 0
  7560. *
  7561. * // The `_.matchesProperty` iteratee shorthand.
  7562. * _.findLastIndex(users, ['active', false]);
  7563. * // => 2
  7564. *
  7565. * // The `_.property` iteratee shorthand.
  7566. * _.findLastIndex(users, 'active');
  7567. * // => 0
  7568. */
  7569. function findLastIndex(array, predicate, fromIndex) {
  7570. var length = array == null ? 0 : array.length;
  7571. if (!length) {
  7572. return -1;
  7573. }
  7574. var index = length - 1;
  7575. if (fromIndex !== undefined) {
  7576. index = toInteger(fromIndex);
  7577. index = fromIndex < 0
  7578. ? nativeMax(length + index, 0)
  7579. : nativeMin(index, length - 1);
  7580. }
  7581. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  7582. }
  7583. /**
  7584. * Flattens `array` a single level deep.
  7585. *
  7586. * @static
  7587. * @memberOf _
  7588. * @since 0.1.0
  7589. * @category Array
  7590. * @param {Array} array The array to flatten.
  7591. * @returns {Array} Returns the new flattened array.
  7592. * @example
  7593. *
  7594. * _.flatten([1, [2, [3, [4]], 5]]);
  7595. * // => [1, 2, [3, [4]], 5]
  7596. */
  7597. function flatten(array) {
  7598. var length = array == null ? 0 : array.length;
  7599. return length ? baseFlatten(array, 1) : [];
  7600. }
  7601. /**
  7602. * Recursively flattens `array`.
  7603. *
  7604. * @static
  7605. * @memberOf _
  7606. * @since 3.0.0
  7607. * @category Array
  7608. * @param {Array} array The array to flatten.
  7609. * @returns {Array} Returns the new flattened array.
  7610. * @example
  7611. *
  7612. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  7613. * // => [1, 2, 3, 4, 5]
  7614. */
  7615. function flattenDeep(array) {
  7616. var length = array == null ? 0 : array.length;
  7617. return length ? baseFlatten(array, INFINITY) : [];
  7618. }
  7619. /**
  7620. * Recursively flatten `array` up to `depth` times.
  7621. *
  7622. * @static
  7623. * @memberOf _
  7624. * @since 4.4.0
  7625. * @category Array
  7626. * @param {Array} array The array to flatten.
  7627. * @param {number} [depth=1] The maximum recursion depth.
  7628. * @returns {Array} Returns the new flattened array.
  7629. * @example
  7630. *
  7631. * var array = [1, [2, [3, [4]], 5]];
  7632. *
  7633. * _.flattenDepth(array, 1);
  7634. * // => [1, 2, [3, [4]], 5]
  7635. *
  7636. * _.flattenDepth(array, 2);
  7637. * // => [1, 2, 3, [4], 5]
  7638. */
  7639. function flattenDepth(array, depth) {
  7640. var length = array == null ? 0 : array.length;
  7641. if (!length) {
  7642. return [];
  7643. }
  7644. depth = depth === undefined ? 1 : toInteger(depth);
  7645. return baseFlatten(array, depth);
  7646. }
  7647. /**
  7648. * The inverse of `_.toPairs`; this method returns an object composed
  7649. * from key-value `pairs`.
  7650. *
  7651. * @static
  7652. * @memberOf _
  7653. * @since 4.0.0
  7654. * @category Array
  7655. * @param {Array} pairs The key-value pairs.
  7656. * @returns {Object} Returns the new object.
  7657. * @example
  7658. *
  7659. * _.fromPairs([['a', 1], ['b', 2]]);
  7660. * // => { 'a': 1, 'b': 2 }
  7661. */
  7662. function fromPairs(pairs) {
  7663. var index = -1,
  7664. length = pairs == null ? 0 : pairs.length,
  7665. result = {};
  7666. while (++index < length) {
  7667. var pair = pairs[index];
  7668. result[pair[0]] = pair[1];
  7669. }
  7670. return result;
  7671. }
  7672. /**
  7673. * Gets the first element of `array`.
  7674. *
  7675. * @static
  7676. * @memberOf _
  7677. * @since 0.1.0
  7678. * @alias first
  7679. * @category Array
  7680. * @param {Array} array The array to query.
  7681. * @returns {*} Returns the first element of `array`.
  7682. * @example
  7683. *
  7684. * _.head([1, 2, 3]);
  7685. * // => 1
  7686. *
  7687. * _.head([]);
  7688. * // => undefined
  7689. */
  7690. function head(array) {
  7691. return (array && array.length) ? array[0] : undefined;
  7692. }
  7693. /**
  7694. * Gets the index at which the first occurrence of `value` is found in `array`
  7695. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7696. * for equality comparisons. If `fromIndex` is negative, it's used as the
  7697. * offset from the end of `array`.
  7698. *
  7699. * @static
  7700. * @memberOf _
  7701. * @since 0.1.0
  7702. * @category Array
  7703. * @param {Array} array The array to inspect.
  7704. * @param {*} value The value to search for.
  7705. * @param {number} [fromIndex=0] The index to search from.
  7706. * @returns {number} Returns the index of the matched value, else `-1`.
  7707. * @example
  7708. *
  7709. * _.indexOf([1, 2, 1, 2], 2);
  7710. * // => 1
  7711. *
  7712. * // Search from the `fromIndex`.
  7713. * _.indexOf([1, 2, 1, 2], 2, 2);
  7714. * // => 3
  7715. */
  7716. function indexOf(array, value, fromIndex) {
  7717. var length = array == null ? 0 : array.length;
  7718. if (!length) {
  7719. return -1;
  7720. }
  7721. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7722. if (index < 0) {
  7723. index = nativeMax(length + index, 0);
  7724. }
  7725. return baseIndexOf(array, value, index);
  7726. }
  7727. /**
  7728. * Gets all but the last element of `array`.
  7729. *
  7730. * @static
  7731. * @memberOf _
  7732. * @since 0.1.0
  7733. * @category Array
  7734. * @param {Array} array The array to query.
  7735. * @returns {Array} Returns the slice of `array`.
  7736. * @example
  7737. *
  7738. * _.initial([1, 2, 3]);
  7739. * // => [1, 2]
  7740. */
  7741. function initial(array) {
  7742. var length = array == null ? 0 : array.length;
  7743. return length ? baseSlice(array, 0, -1) : [];
  7744. }
  7745. /**
  7746. * Creates an array of unique values that are included in all given arrays
  7747. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7748. * for equality comparisons. The order and references of result values are
  7749. * determined by the first array.
  7750. *
  7751. * @static
  7752. * @memberOf _
  7753. * @since 0.1.0
  7754. * @category Array
  7755. * @param {...Array} [arrays] The arrays to inspect.
  7756. * @returns {Array} Returns the new array of intersecting values.
  7757. * @example
  7758. *
  7759. * _.intersection([2, 1], [2, 3]);
  7760. * // => [2]
  7761. */
  7762. var intersection = baseRest(function(arrays) {
  7763. var mapped = arrayMap(arrays, castArrayLikeObject);
  7764. return (mapped.length && mapped[0] === arrays[0])
  7765. ? baseIntersection(mapped)
  7766. : [];
  7767. });
  7768. /**
  7769. * This method is like `_.intersection` except that it accepts `iteratee`
  7770. * which is invoked for each element of each `arrays` to generate the criterion
  7771. * by which they're compared. The order and references of result values are
  7772. * determined by the first array. The iteratee is invoked with one argument:
  7773. * (value).
  7774. *
  7775. * @static
  7776. * @memberOf _
  7777. * @since 4.0.0
  7778. * @category Array
  7779. * @param {...Array} [arrays] The arrays to inspect.
  7780. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7781. * @returns {Array} Returns the new array of intersecting values.
  7782. * @example
  7783. *
  7784. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7785. * // => [2.1]
  7786. *
  7787. * // The `_.property` iteratee shorthand.
  7788. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  7789. * // => [{ 'x': 1 }]
  7790. */
  7791. var intersectionBy = baseRest(function(arrays) {
  7792. var iteratee = last(arrays),
  7793. mapped = arrayMap(arrays, castArrayLikeObject);
  7794. if (iteratee === last(mapped)) {
  7795. iteratee = undefined;
  7796. } else {
  7797. mapped.pop();
  7798. }
  7799. return (mapped.length && mapped[0] === arrays[0])
  7800. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  7801. : [];
  7802. });
  7803. /**
  7804. * This method is like `_.intersection` except that it accepts `comparator`
  7805. * which is invoked to compare elements of `arrays`. The order and references
  7806. * of result values are determined by the first array. The comparator is
  7807. * invoked with two arguments: (arrVal, othVal).
  7808. *
  7809. * @static
  7810. * @memberOf _
  7811. * @since 4.0.0
  7812. * @category Array
  7813. * @param {...Array} [arrays] The arrays to inspect.
  7814. * @param {Function} [comparator] The comparator invoked per element.
  7815. * @returns {Array} Returns the new array of intersecting values.
  7816. * @example
  7817. *
  7818. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7819. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  7820. *
  7821. * _.intersectionWith(objects, others, _.isEqual);
  7822. * // => [{ 'x': 1, 'y': 2 }]
  7823. */
  7824. var intersectionWith = baseRest(function(arrays) {
  7825. var comparator = last(arrays),
  7826. mapped = arrayMap(arrays, castArrayLikeObject);
  7827. comparator = typeof comparator == 'function' ? comparator : undefined;
  7828. if (comparator) {
  7829. mapped.pop();
  7830. }
  7831. return (mapped.length && mapped[0] === arrays[0])
  7832. ? baseIntersection(mapped, undefined, comparator)
  7833. : [];
  7834. });
  7835. /**
  7836. * Converts all elements in `array` into a string separated by `separator`.
  7837. *
  7838. * @static
  7839. * @memberOf _
  7840. * @since 4.0.0
  7841. * @category Array
  7842. * @param {Array} array The array to convert.
  7843. * @param {string} [separator=','] The element separator.
  7844. * @returns {string} Returns the joined string.
  7845. * @example
  7846. *
  7847. * _.join(['a', 'b', 'c'], '~');
  7848. * // => 'a~b~c'
  7849. */
  7850. function join(array, separator) {
  7851. return array == null ? '' : nativeJoin.call(array, separator);
  7852. }
  7853. /**
  7854. * Gets the last element of `array`.
  7855. *
  7856. * @static
  7857. * @memberOf _
  7858. * @since 0.1.0
  7859. * @category Array
  7860. * @param {Array} array The array to query.
  7861. * @returns {*} Returns the last element of `array`.
  7862. * @example
  7863. *
  7864. * _.last([1, 2, 3]);
  7865. * // => 3
  7866. */
  7867. function last(array) {
  7868. var length = array == null ? 0 : array.length;
  7869. return length ? array[length - 1] : undefined;
  7870. }
  7871. /**
  7872. * This method is like `_.indexOf` except that it iterates over elements of
  7873. * `array` from right to left.
  7874. *
  7875. * @static
  7876. * @memberOf _
  7877. * @since 0.1.0
  7878. * @category Array
  7879. * @param {Array} array The array to inspect.
  7880. * @param {*} value The value to search for.
  7881. * @param {number} [fromIndex=array.length-1] The index to search from.
  7882. * @returns {number} Returns the index of the matched value, else `-1`.
  7883. * @example
  7884. *
  7885. * _.lastIndexOf([1, 2, 1, 2], 2);
  7886. * // => 3
  7887. *
  7888. * // Search from the `fromIndex`.
  7889. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  7890. * // => 1
  7891. */
  7892. function lastIndexOf(array, value, fromIndex) {
  7893. var length = array == null ? 0 : array.length;
  7894. if (!length) {
  7895. return -1;
  7896. }
  7897. var index = length;
  7898. if (fromIndex !== undefined) {
  7899. index = toInteger(fromIndex);
  7900. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  7901. }
  7902. return value === value
  7903. ? strictLastIndexOf(array, value, index)
  7904. : baseFindIndex(array, baseIsNaN, index, true);
  7905. }
  7906. /**
  7907. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  7908. * element from the end is returned.
  7909. *
  7910. * @static
  7911. * @memberOf _
  7912. * @since 4.11.0
  7913. * @category Array
  7914. * @param {Array} array The array to query.
  7915. * @param {number} [n=0] The index of the element to return.
  7916. * @returns {*} Returns the nth element of `array`.
  7917. * @example
  7918. *
  7919. * var array = ['a', 'b', 'c', 'd'];
  7920. *
  7921. * _.nth(array, 1);
  7922. * // => 'b'
  7923. *
  7924. * _.nth(array, -2);
  7925. * // => 'c';
  7926. */
  7927. function nth(array, n) {
  7928. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  7929. }
  7930. /**
  7931. * Removes all given values from `array` using
  7932. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7933. * for equality comparisons.
  7934. *
  7935. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  7936. * to remove elements from an array by predicate.
  7937. *
  7938. * @static
  7939. * @memberOf _
  7940. * @since 2.0.0
  7941. * @category Array
  7942. * @param {Array} array The array to modify.
  7943. * @param {...*} [values] The values to remove.
  7944. * @returns {Array} Returns `array`.
  7945. * @example
  7946. *
  7947. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  7948. *
  7949. * _.pull(array, 'a', 'c');
  7950. * console.log(array);
  7951. * // => ['b', 'b']
  7952. */
  7953. var pull = baseRest(pullAll);
  7954. /**
  7955. * This method is like `_.pull` except that it accepts an array of values to remove.
  7956. *
  7957. * **Note:** Unlike `_.difference`, this method mutates `array`.
  7958. *
  7959. * @static
  7960. * @memberOf _
  7961. * @since 4.0.0
  7962. * @category Array
  7963. * @param {Array} array The array to modify.
  7964. * @param {Array} values The values to remove.
  7965. * @returns {Array} Returns `array`.
  7966. * @example
  7967. *
  7968. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  7969. *
  7970. * _.pullAll(array, ['a', 'c']);
  7971. * console.log(array);
  7972. * // => ['b', 'b']
  7973. */
  7974. function pullAll(array, values) {
  7975. return (array && array.length && values && values.length)
  7976. ? basePullAll(array, values)
  7977. : array;
  7978. }
  7979. /**
  7980. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  7981. * invoked for each element of `array` and `values` to generate the criterion
  7982. * by which they're compared. The iteratee is invoked with one argument: (value).
  7983. *
  7984. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  7985. *
  7986. * @static
  7987. * @memberOf _
  7988. * @since 4.0.0
  7989. * @category Array
  7990. * @param {Array} array The array to modify.
  7991. * @param {Array} values The values to remove.
  7992. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7993. * @returns {Array} Returns `array`.
  7994. * @example
  7995. *
  7996. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  7997. *
  7998. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  7999. * console.log(array);
  8000. * // => [{ 'x': 2 }]
  8001. */
  8002. function pullAllBy(array, values, iteratee) {
  8003. return (array && array.length && values && values.length)
  8004. ? basePullAll(array, values, getIteratee(iteratee, 2))
  8005. : array;
  8006. }
  8007. /**
  8008. * This method is like `_.pullAll` except that it accepts `comparator` which
  8009. * is invoked to compare elements of `array` to `values`. The comparator is
  8010. * invoked with two arguments: (arrVal, othVal).
  8011. *
  8012. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  8013. *
  8014. * @static
  8015. * @memberOf _
  8016. * @since 4.6.0
  8017. * @category Array
  8018. * @param {Array} array The array to modify.
  8019. * @param {Array} values The values to remove.
  8020. * @param {Function} [comparator] The comparator invoked per element.
  8021. * @returns {Array} Returns `array`.
  8022. * @example
  8023. *
  8024. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  8025. *
  8026. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  8027. * console.log(array);
  8028. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  8029. */
  8030. function pullAllWith(array, values, comparator) {
  8031. return (array && array.length && values && values.length)
  8032. ? basePullAll(array, values, undefined, comparator)
  8033. : array;
  8034. }
  8035. /**
  8036. * Removes elements from `array` corresponding to `indexes` and returns an
  8037. * array of removed elements.
  8038. *
  8039. * **Note:** Unlike `_.at`, this method mutates `array`.
  8040. *
  8041. * @static
  8042. * @memberOf _
  8043. * @since 3.0.0
  8044. * @category Array
  8045. * @param {Array} array The array to modify.
  8046. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  8047. * @returns {Array} Returns the new array of removed elements.
  8048. * @example
  8049. *
  8050. * var array = ['a', 'b', 'c', 'd'];
  8051. * var pulled = _.pullAt(array, [1, 3]);
  8052. *
  8053. * console.log(array);
  8054. * // => ['a', 'c']
  8055. *
  8056. * console.log(pulled);
  8057. * // => ['b', 'd']
  8058. */
  8059. var pullAt = flatRest(function(array, indexes) {
  8060. var length = array == null ? 0 : array.length,
  8061. result = baseAt(array, indexes);
  8062. basePullAt(array, arrayMap(indexes, function(index) {
  8063. return isIndex(index, length) ? +index : index;
  8064. }).sort(compareAscending));
  8065. return result;
  8066. });
  8067. /**
  8068. * Removes all elements from `array` that `predicate` returns truthy for
  8069. * and returns an array of the removed elements. The predicate is invoked
  8070. * with three arguments: (value, index, array).
  8071. *
  8072. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  8073. * to pull elements from an array by value.
  8074. *
  8075. * @static
  8076. * @memberOf _
  8077. * @since 2.0.0
  8078. * @category Array
  8079. * @param {Array} array The array to modify.
  8080. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8081. * @returns {Array} Returns the new array of removed elements.
  8082. * @example
  8083. *
  8084. * var array = [1, 2, 3, 4];
  8085. * var evens = _.remove(array, function(n) {
  8086. * return n % 2 == 0;
  8087. * });
  8088. *
  8089. * console.log(array);
  8090. * // => [1, 3]
  8091. *
  8092. * console.log(evens);
  8093. * // => [2, 4]
  8094. */
  8095. function remove(array, predicate) {
  8096. var result = [];
  8097. if (!(array && array.length)) {
  8098. return result;
  8099. }
  8100. var index = -1,
  8101. indexes = [],
  8102. length = array.length;
  8103. predicate = getIteratee(predicate, 3);
  8104. while (++index < length) {
  8105. var value = array[index];
  8106. if (predicate(value, index, array)) {
  8107. result.push(value);
  8108. indexes.push(index);
  8109. }
  8110. }
  8111. basePullAt(array, indexes);
  8112. return result;
  8113. }
  8114. /**
  8115. * Reverses `array` so that the first element becomes the last, the second
  8116. * element becomes the second to last, and so on.
  8117. *
  8118. * **Note:** This method mutates `array` and is based on
  8119. * [`Array#reverse`](https://mdn.io/Array/reverse).
  8120. *
  8121. * @static
  8122. * @memberOf _
  8123. * @since 4.0.0
  8124. * @category Array
  8125. * @param {Array} array The array to modify.
  8126. * @returns {Array} Returns `array`.
  8127. * @example
  8128. *
  8129. * var array = [1, 2, 3];
  8130. *
  8131. * _.reverse(array);
  8132. * // => [3, 2, 1]
  8133. *
  8134. * console.log(array);
  8135. * // => [3, 2, 1]
  8136. */
  8137. function reverse(array) {
  8138. return array == null ? array : nativeReverse.call(array);
  8139. }
  8140. /**
  8141. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8142. *
  8143. * **Note:** This method is used instead of
  8144. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8145. * returned.
  8146. *
  8147. * @static
  8148. * @memberOf _
  8149. * @since 3.0.0
  8150. * @category Array
  8151. * @param {Array} array The array to slice.
  8152. * @param {number} [start=0] The start position.
  8153. * @param {number} [end=array.length] The end position.
  8154. * @returns {Array} Returns the slice of `array`.
  8155. */
  8156. function slice(array, start, end) {
  8157. var length = array == null ? 0 : array.length;
  8158. if (!length) {
  8159. return [];
  8160. }
  8161. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  8162. start = 0;
  8163. end = length;
  8164. }
  8165. else {
  8166. start = start == null ? 0 : toInteger(start);
  8167. end = end === undefined ? length : toInteger(end);
  8168. }
  8169. return baseSlice(array, start, end);
  8170. }
  8171. /**
  8172. * Uses a binary search to determine the lowest index at which `value`
  8173. * should be inserted into `array` in order to maintain its sort order.
  8174. *
  8175. * @static
  8176. * @memberOf _
  8177. * @since 0.1.0
  8178. * @category Array
  8179. * @param {Array} array The sorted array to inspect.
  8180. * @param {*} value The value to evaluate.
  8181. * @returns {number} Returns the index at which `value` should be inserted
  8182. * into `array`.
  8183. * @example
  8184. *
  8185. * _.sortedIndex([30, 50], 40);
  8186. * // => 1
  8187. */
  8188. function sortedIndex(array, value) {
  8189. return baseSortedIndex(array, value);
  8190. }
  8191. /**
  8192. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  8193. * which is invoked for `value` and each element of `array` to compute their
  8194. * sort ranking. The iteratee is invoked with one argument: (value).
  8195. *
  8196. * @static
  8197. * @memberOf _
  8198. * @since 4.0.0
  8199. * @category Array
  8200. * @param {Array} array The sorted array to inspect.
  8201. * @param {*} value The value to evaluate.
  8202. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8203. * @returns {number} Returns the index at which `value` should be inserted
  8204. * into `array`.
  8205. * @example
  8206. *
  8207. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8208. *
  8209. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8210. * // => 0
  8211. *
  8212. * // The `_.property` iteratee shorthand.
  8213. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  8214. * // => 0
  8215. */
  8216. function sortedIndexBy(array, value, iteratee) {
  8217. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  8218. }
  8219. /**
  8220. * This method is like `_.indexOf` except that it performs a binary
  8221. * search on a sorted `array`.
  8222. *
  8223. * @static
  8224. * @memberOf _
  8225. * @since 4.0.0
  8226. * @category Array
  8227. * @param {Array} array The array to inspect.
  8228. * @param {*} value The value to search for.
  8229. * @returns {number} Returns the index of the matched value, else `-1`.
  8230. * @example
  8231. *
  8232. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  8233. * // => 1
  8234. */
  8235. function sortedIndexOf(array, value) {
  8236. var length = array == null ? 0 : array.length;
  8237. if (length) {
  8238. var index = baseSortedIndex(array, value);
  8239. if (index < length && eq(array[index], value)) {
  8240. return index;
  8241. }
  8242. }
  8243. return -1;
  8244. }
  8245. /**
  8246. * This method is like `_.sortedIndex` except that it returns the highest
  8247. * index at which `value` should be inserted into `array` in order to
  8248. * maintain its sort order.
  8249. *
  8250. * @static
  8251. * @memberOf _
  8252. * @since 3.0.0
  8253. * @category Array
  8254. * @param {Array} array The sorted array to inspect.
  8255. * @param {*} value The value to evaluate.
  8256. * @returns {number} Returns the index at which `value` should be inserted
  8257. * into `array`.
  8258. * @example
  8259. *
  8260. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  8261. * // => 4
  8262. */
  8263. function sortedLastIndex(array, value) {
  8264. return baseSortedIndex(array, value, true);
  8265. }
  8266. /**
  8267. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  8268. * which is invoked for `value` and each element of `array` to compute their
  8269. * sort ranking. The iteratee is invoked with one argument: (value).
  8270. *
  8271. * @static
  8272. * @memberOf _
  8273. * @since 4.0.0
  8274. * @category Array
  8275. * @param {Array} array The sorted array to inspect.
  8276. * @param {*} value The value to evaluate.
  8277. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8278. * @returns {number} Returns the index at which `value` should be inserted
  8279. * into `array`.
  8280. * @example
  8281. *
  8282. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8283. *
  8284. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8285. * // => 1
  8286. *
  8287. * // The `_.property` iteratee shorthand.
  8288. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  8289. * // => 1
  8290. */
  8291. function sortedLastIndexBy(array, value, iteratee) {
  8292. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  8293. }
  8294. /**
  8295. * This method is like `_.lastIndexOf` except that it performs a binary
  8296. * search on a sorted `array`.
  8297. *
  8298. * @static
  8299. * @memberOf _
  8300. * @since 4.0.0
  8301. * @category Array
  8302. * @param {Array} array The array to inspect.
  8303. * @param {*} value The value to search for.
  8304. * @returns {number} Returns the index of the matched value, else `-1`.
  8305. * @example
  8306. *
  8307. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  8308. * // => 3
  8309. */
  8310. function sortedLastIndexOf(array, value) {
  8311. var length = array == null ? 0 : array.length;
  8312. if (length) {
  8313. var index = baseSortedIndex(array, value, true) - 1;
  8314. if (eq(array[index], value)) {
  8315. return index;
  8316. }
  8317. }
  8318. return -1;
  8319. }
  8320. /**
  8321. * This method is like `_.uniq` except that it's designed and optimized
  8322. * for sorted arrays.
  8323. *
  8324. * @static
  8325. * @memberOf _
  8326. * @since 4.0.0
  8327. * @category Array
  8328. * @param {Array} array The array to inspect.
  8329. * @returns {Array} Returns the new duplicate free array.
  8330. * @example
  8331. *
  8332. * _.sortedUniq([1, 1, 2]);
  8333. * // => [1, 2]
  8334. */
  8335. function sortedUniq(array) {
  8336. return (array && array.length)
  8337. ? baseSortedUniq(array)
  8338. : [];
  8339. }
  8340. /**
  8341. * This method is like `_.uniqBy` except that it's designed and optimized
  8342. * for sorted arrays.
  8343. *
  8344. * @static
  8345. * @memberOf _
  8346. * @since 4.0.0
  8347. * @category Array
  8348. * @param {Array} array The array to inspect.
  8349. * @param {Function} [iteratee] The iteratee invoked per element.
  8350. * @returns {Array} Returns the new duplicate free array.
  8351. * @example
  8352. *
  8353. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  8354. * // => [1.1, 2.3]
  8355. */
  8356. function sortedUniqBy(array, iteratee) {
  8357. return (array && array.length)
  8358. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  8359. : [];
  8360. }
  8361. /**
  8362. * Gets all but the first element of `array`.
  8363. *
  8364. * @static
  8365. * @memberOf _
  8366. * @since 4.0.0
  8367. * @category Array
  8368. * @param {Array} array The array to query.
  8369. * @returns {Array} Returns the slice of `array`.
  8370. * @example
  8371. *
  8372. * _.tail([1, 2, 3]);
  8373. * // => [2, 3]
  8374. */
  8375. function tail(array) {
  8376. var length = array == null ? 0 : array.length;
  8377. return length ? baseSlice(array, 1, length) : [];
  8378. }
  8379. /**
  8380. * Creates a slice of `array` with `n` elements taken from the beginning.
  8381. *
  8382. * @static
  8383. * @memberOf _
  8384. * @since 0.1.0
  8385. * @category Array
  8386. * @param {Array} array The array to query.
  8387. * @param {number} [n=1] The number of elements to take.
  8388. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8389. * @returns {Array} Returns the slice of `array`.
  8390. * @example
  8391. *
  8392. * _.take([1, 2, 3]);
  8393. * // => [1]
  8394. *
  8395. * _.take([1, 2, 3], 2);
  8396. * // => [1, 2]
  8397. *
  8398. * _.take([1, 2, 3], 5);
  8399. * // => [1, 2, 3]
  8400. *
  8401. * _.take([1, 2, 3], 0);
  8402. * // => []
  8403. */
  8404. function take(array, n, guard) {
  8405. if (!(array && array.length)) {
  8406. return [];
  8407. }
  8408. n = (guard || n === undefined) ? 1 : toInteger(n);
  8409. return baseSlice(array, 0, n < 0 ? 0 : n);
  8410. }
  8411. /**
  8412. * Creates a slice of `array` with `n` elements taken from the end.
  8413. *
  8414. * @static
  8415. * @memberOf _
  8416. * @since 3.0.0
  8417. * @category Array
  8418. * @param {Array} array The array to query.
  8419. * @param {number} [n=1] The number of elements to take.
  8420. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8421. * @returns {Array} Returns the slice of `array`.
  8422. * @example
  8423. *
  8424. * _.takeRight([1, 2, 3]);
  8425. * // => [3]
  8426. *
  8427. * _.takeRight([1, 2, 3], 2);
  8428. * // => [2, 3]
  8429. *
  8430. * _.takeRight([1, 2, 3], 5);
  8431. * // => [1, 2, 3]
  8432. *
  8433. * _.takeRight([1, 2, 3], 0);
  8434. * // => []
  8435. */
  8436. function takeRight(array, n, guard) {
  8437. var length = array == null ? 0 : array.length;
  8438. if (!length) {
  8439. return [];
  8440. }
  8441. n = (guard || n === undefined) ? 1 : toInteger(n);
  8442. n = length - n;
  8443. return baseSlice(array, n < 0 ? 0 : n, length);
  8444. }
  8445. /**
  8446. * Creates a slice of `array` with elements taken from the end. Elements are
  8447. * taken until `predicate` returns falsey. The predicate is invoked with
  8448. * three arguments: (value, index, array).
  8449. *
  8450. * @static
  8451. * @memberOf _
  8452. * @since 3.0.0
  8453. * @category Array
  8454. * @param {Array} array The array to query.
  8455. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8456. * @returns {Array} Returns the slice of `array`.
  8457. * @example
  8458. *
  8459. * var users = [
  8460. * { 'user': 'barney', 'active': true },
  8461. * { 'user': 'fred', 'active': false },
  8462. * { 'user': 'pebbles', 'active': false }
  8463. * ];
  8464. *
  8465. * _.takeRightWhile(users, function(o) { return !o.active; });
  8466. * // => objects for ['fred', 'pebbles']
  8467. *
  8468. * // The `_.matches` iteratee shorthand.
  8469. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  8470. * // => objects for ['pebbles']
  8471. *
  8472. * // The `_.matchesProperty` iteratee shorthand.
  8473. * _.takeRightWhile(users, ['active', false]);
  8474. * // => objects for ['fred', 'pebbles']
  8475. *
  8476. * // The `_.property` iteratee shorthand.
  8477. * _.takeRightWhile(users, 'active');
  8478. * // => []
  8479. */
  8480. function takeRightWhile(array, predicate) {
  8481. return (array && array.length)
  8482. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  8483. : [];
  8484. }
  8485. /**
  8486. * Creates a slice of `array` with elements taken from the beginning. Elements
  8487. * are taken until `predicate` returns falsey. The predicate is invoked with
  8488. * three arguments: (value, index, array).
  8489. *
  8490. * @static
  8491. * @memberOf _
  8492. * @since 3.0.0
  8493. * @category Array
  8494. * @param {Array} array The array to query.
  8495. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8496. * @returns {Array} Returns the slice of `array`.
  8497. * @example
  8498. *
  8499. * var users = [
  8500. * { 'user': 'barney', 'active': false },
  8501. * { 'user': 'fred', 'active': false },
  8502. * { 'user': 'pebbles', 'active': true }
  8503. * ];
  8504. *
  8505. * _.takeWhile(users, function(o) { return !o.active; });
  8506. * // => objects for ['barney', 'fred']
  8507. *
  8508. * // The `_.matches` iteratee shorthand.
  8509. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  8510. * // => objects for ['barney']
  8511. *
  8512. * // The `_.matchesProperty` iteratee shorthand.
  8513. * _.takeWhile(users, ['active', false]);
  8514. * // => objects for ['barney', 'fred']
  8515. *
  8516. * // The `_.property` iteratee shorthand.
  8517. * _.takeWhile(users, 'active');
  8518. * // => []
  8519. */
  8520. function takeWhile(array, predicate) {
  8521. return (array && array.length)
  8522. ? baseWhile(array, getIteratee(predicate, 3))
  8523. : [];
  8524. }
  8525. /**
  8526. * Creates an array of unique values, in order, from all given arrays using
  8527. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8528. * for equality comparisons.
  8529. *
  8530. * @static
  8531. * @memberOf _
  8532. * @since 0.1.0
  8533. * @category Array
  8534. * @param {...Array} [arrays] The arrays to inspect.
  8535. * @returns {Array} Returns the new array of combined values.
  8536. * @example
  8537. *
  8538. * _.union([2], [1, 2]);
  8539. * // => [2, 1]
  8540. */
  8541. var union = baseRest(function(arrays) {
  8542. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  8543. });
  8544. /**
  8545. * This method is like `_.union` except that it accepts `iteratee` which is
  8546. * invoked for each element of each `arrays` to generate the criterion by
  8547. * which uniqueness is computed. Result values are chosen from the first
  8548. * array in which the value occurs. The iteratee is invoked with one argument:
  8549. * (value).
  8550. *
  8551. * @static
  8552. * @memberOf _
  8553. * @since 4.0.0
  8554. * @category Array
  8555. * @param {...Array} [arrays] The arrays to inspect.
  8556. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8557. * @returns {Array} Returns the new array of combined values.
  8558. * @example
  8559. *
  8560. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  8561. * // => [2.1, 1.2]
  8562. *
  8563. * // The `_.property` iteratee shorthand.
  8564. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8565. * // => [{ 'x': 1 }, { 'x': 2 }]
  8566. */
  8567. var unionBy = baseRest(function(arrays) {
  8568. var iteratee = last(arrays);
  8569. if (isArrayLikeObject(iteratee)) {
  8570. iteratee = undefined;
  8571. }
  8572. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  8573. });
  8574. /**
  8575. * This method is like `_.union` except that it accepts `comparator` which
  8576. * is invoked to compare elements of `arrays`. Result values are chosen from
  8577. * the first array in which the value occurs. The comparator is invoked
  8578. * with two arguments: (arrVal, othVal).
  8579. *
  8580. * @static
  8581. * @memberOf _
  8582. * @since 4.0.0
  8583. * @category Array
  8584. * @param {...Array} [arrays] The arrays to inspect.
  8585. * @param {Function} [comparator] The comparator invoked per element.
  8586. * @returns {Array} Returns the new array of combined values.
  8587. * @example
  8588. *
  8589. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8590. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8591. *
  8592. * _.unionWith(objects, others, _.isEqual);
  8593. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8594. */
  8595. var unionWith = baseRest(function(arrays) {
  8596. var comparator = last(arrays);
  8597. comparator = typeof comparator == 'function' ? comparator : undefined;
  8598. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  8599. });
  8600. /**
  8601. * Creates a duplicate-free version of an array, using
  8602. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8603. * for equality comparisons, in which only the first occurrence of each element
  8604. * is kept. The order of result values is determined by the order they occur
  8605. * in the array.
  8606. *
  8607. * @static
  8608. * @memberOf _
  8609. * @since 0.1.0
  8610. * @category Array
  8611. * @param {Array} array The array to inspect.
  8612. * @returns {Array} Returns the new duplicate free array.
  8613. * @example
  8614. *
  8615. * _.uniq([2, 1, 2]);
  8616. * // => [2, 1]
  8617. */
  8618. function uniq(array) {
  8619. return (array && array.length) ? baseUniq(array) : [];
  8620. }
  8621. /**
  8622. * This method is like `_.uniq` except that it accepts `iteratee` which is
  8623. * invoked for each element in `array` to generate the criterion by which
  8624. * uniqueness is computed. The order of result values is determined by the
  8625. * order they occur in the array. The iteratee is invoked with one argument:
  8626. * (value).
  8627. *
  8628. * @static
  8629. * @memberOf _
  8630. * @since 4.0.0
  8631. * @category Array
  8632. * @param {Array} array The array to inspect.
  8633. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8634. * @returns {Array} Returns the new duplicate free array.
  8635. * @example
  8636. *
  8637. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  8638. * // => [2.1, 1.2]
  8639. *
  8640. * // The `_.property` iteratee shorthand.
  8641. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  8642. * // => [{ 'x': 1 }, { 'x': 2 }]
  8643. */
  8644. function uniqBy(array, iteratee) {
  8645. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  8646. }
  8647. /**
  8648. * This method is like `_.uniq` except that it accepts `comparator` which
  8649. * is invoked to compare elements of `array`. The order of result values is
  8650. * determined by the order they occur in the array.The comparator is invoked
  8651. * with two arguments: (arrVal, othVal).
  8652. *
  8653. * @static
  8654. * @memberOf _
  8655. * @since 4.0.0
  8656. * @category Array
  8657. * @param {Array} array The array to inspect.
  8658. * @param {Function} [comparator] The comparator invoked per element.
  8659. * @returns {Array} Returns the new duplicate free array.
  8660. * @example
  8661. *
  8662. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8663. *
  8664. * _.uniqWith(objects, _.isEqual);
  8665. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  8666. */
  8667. function uniqWith(array, comparator) {
  8668. comparator = typeof comparator == 'function' ? comparator : undefined;
  8669. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  8670. }
  8671. /**
  8672. * This method is like `_.zip` except that it accepts an array of grouped
  8673. * elements and creates an array regrouping the elements to their pre-zip
  8674. * configuration.
  8675. *
  8676. * @static
  8677. * @memberOf _
  8678. * @since 1.2.0
  8679. * @category Array
  8680. * @param {Array} array The array of grouped elements to process.
  8681. * @returns {Array} Returns the new array of regrouped elements.
  8682. * @example
  8683. *
  8684. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  8685. * // => [['a', 1, true], ['b', 2, false]]
  8686. *
  8687. * _.unzip(zipped);
  8688. * // => [['a', 'b'], [1, 2], [true, false]]
  8689. */
  8690. function unzip(array) {
  8691. if (!(array && array.length)) {
  8692. return [];
  8693. }
  8694. var length = 0;
  8695. array = arrayFilter(array, function(group) {
  8696. if (isArrayLikeObject(group)) {
  8697. length = nativeMax(group.length, length);
  8698. return true;
  8699. }
  8700. });
  8701. return baseTimes(length, function(index) {
  8702. return arrayMap(array, baseProperty(index));
  8703. });
  8704. }
  8705. /**
  8706. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  8707. * how regrouped values should be combined. The iteratee is invoked with the
  8708. * elements of each group: (...group).
  8709. *
  8710. * @static
  8711. * @memberOf _
  8712. * @since 3.8.0
  8713. * @category Array
  8714. * @param {Array} array The array of grouped elements to process.
  8715. * @param {Function} [iteratee=_.identity] The function to combine
  8716. * regrouped values.
  8717. * @returns {Array} Returns the new array of regrouped elements.
  8718. * @example
  8719. *
  8720. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  8721. * // => [[1, 10, 100], [2, 20, 200]]
  8722. *
  8723. * _.unzipWith(zipped, _.add);
  8724. * // => [3, 30, 300]
  8725. */
  8726. function unzipWith(array, iteratee) {
  8727. if (!(array && array.length)) {
  8728. return [];
  8729. }
  8730. var result = unzip(array);
  8731. if (iteratee == null) {
  8732. return result;
  8733. }
  8734. return arrayMap(result, function(group) {
  8735. return apply(iteratee, undefined, group);
  8736. });
  8737. }
  8738. /**
  8739. * Creates an array excluding all given values using
  8740. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8741. * for equality comparisons.
  8742. *
  8743. * **Note:** Unlike `_.pull`, this method returns a new array.
  8744. *
  8745. * @static
  8746. * @memberOf _
  8747. * @since 0.1.0
  8748. * @category Array
  8749. * @param {Array} array The array to inspect.
  8750. * @param {...*} [values] The values to exclude.
  8751. * @returns {Array} Returns the new array of filtered values.
  8752. * @see _.difference, _.xor
  8753. * @example
  8754. *
  8755. * _.without([2, 1, 2, 3], 1, 2);
  8756. * // => [3]
  8757. */
  8758. var without = baseRest(function(array, values) {
  8759. return isArrayLikeObject(array)
  8760. ? baseDifference(array, values)
  8761. : [];
  8762. });
  8763. /**
  8764. * Creates an array of unique values that is the
  8765. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  8766. * of the given arrays. The order of result values is determined by the order
  8767. * they occur in the arrays.
  8768. *
  8769. * @static
  8770. * @memberOf _
  8771. * @since 2.4.0
  8772. * @category Array
  8773. * @param {...Array} [arrays] The arrays to inspect.
  8774. * @returns {Array} Returns the new array of filtered values.
  8775. * @see _.difference, _.without
  8776. * @example
  8777. *
  8778. * _.xor([2, 1], [2, 3]);
  8779. * // => [1, 3]
  8780. */
  8781. var xor = baseRest(function(arrays) {
  8782. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  8783. });
  8784. /**
  8785. * This method is like `_.xor` except that it accepts `iteratee` which is
  8786. * invoked for each element of each `arrays` to generate the criterion by
  8787. * which by which they're compared. The order of result values is determined
  8788. * by the order they occur in the arrays. The iteratee is invoked with one
  8789. * argument: (value).
  8790. *
  8791. * @static
  8792. * @memberOf _
  8793. * @since 4.0.0
  8794. * @category Array
  8795. * @param {...Array} [arrays] The arrays to inspect.
  8796. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8797. * @returns {Array} Returns the new array of filtered values.
  8798. * @example
  8799. *
  8800. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8801. * // => [1.2, 3.4]
  8802. *
  8803. * // The `_.property` iteratee shorthand.
  8804. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8805. * // => [{ 'x': 2 }]
  8806. */
  8807. var xorBy = baseRest(function(arrays) {
  8808. var iteratee = last(arrays);
  8809. if (isArrayLikeObject(iteratee)) {
  8810. iteratee = undefined;
  8811. }
  8812. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  8813. });
  8814. /**
  8815. * This method is like `_.xor` except that it accepts `comparator` which is
  8816. * invoked to compare elements of `arrays`. The order of result values is
  8817. * determined by the order they occur in the arrays. The comparator is invoked
  8818. * with two arguments: (arrVal, othVal).
  8819. *
  8820. * @static
  8821. * @memberOf _
  8822. * @since 4.0.0
  8823. * @category Array
  8824. * @param {...Array} [arrays] The arrays to inspect.
  8825. * @param {Function} [comparator] The comparator invoked per element.
  8826. * @returns {Array} Returns the new array of filtered values.
  8827. * @example
  8828. *
  8829. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8830. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8831. *
  8832. * _.xorWith(objects, others, _.isEqual);
  8833. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8834. */
  8835. var xorWith = baseRest(function(arrays) {
  8836. var comparator = last(arrays);
  8837. comparator = typeof comparator == 'function' ? comparator : undefined;
  8838. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  8839. });
  8840. /**
  8841. * Creates an array of grouped elements, the first of which contains the
  8842. * first elements of the given arrays, the second of which contains the
  8843. * second elements of the given arrays, and so on.
  8844. *
  8845. * @static
  8846. * @memberOf _
  8847. * @since 0.1.0
  8848. * @category Array
  8849. * @param {...Array} [arrays] The arrays to process.
  8850. * @returns {Array} Returns the new array of grouped elements.
  8851. * @example
  8852. *
  8853. * _.zip(['a', 'b'], [1, 2], [true, false]);
  8854. * // => [['a', 1, true], ['b', 2, false]]
  8855. */
  8856. var zip = baseRest(unzip);
  8857. /**
  8858. * This method is like `_.fromPairs` except that it accepts two arrays,
  8859. * one of property identifiers and one of corresponding values.
  8860. *
  8861. * @static
  8862. * @memberOf _
  8863. * @since 0.4.0
  8864. * @category Array
  8865. * @param {Array} [props=[]] The property identifiers.
  8866. * @param {Array} [values=[]] The property values.
  8867. * @returns {Object} Returns the new object.
  8868. * @example
  8869. *
  8870. * _.zipObject(['a', 'b'], [1, 2]);
  8871. * // => { 'a': 1, 'b': 2 }
  8872. */
  8873. function zipObject(props, values) {
  8874. return baseZipObject(props || [], values || [], assignValue);
  8875. }
  8876. /**
  8877. * This method is like `_.zipObject` except that it supports property paths.
  8878. *
  8879. * @static
  8880. * @memberOf _
  8881. * @since 4.1.0
  8882. * @category Array
  8883. * @param {Array} [props=[]] The property identifiers.
  8884. * @param {Array} [values=[]] The property values.
  8885. * @returns {Object} Returns the new object.
  8886. * @example
  8887. *
  8888. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  8889. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  8890. */
  8891. function zipObjectDeep(props, values) {
  8892. return baseZipObject(props || [], values || [], baseSet);
  8893. }
  8894. /**
  8895. * This method is like `_.zip` except that it accepts `iteratee` to specify
  8896. * how grouped values should be combined. The iteratee is invoked with the
  8897. * elements of each group: (...group).
  8898. *
  8899. * @static
  8900. * @memberOf _
  8901. * @since 3.8.0
  8902. * @category Array
  8903. * @param {...Array} [arrays] The arrays to process.
  8904. * @param {Function} [iteratee=_.identity] The function to combine
  8905. * grouped values.
  8906. * @returns {Array} Returns the new array of grouped elements.
  8907. * @example
  8908. *
  8909. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  8910. * return a + b + c;
  8911. * });
  8912. * // => [111, 222]
  8913. */
  8914. var zipWith = baseRest(function(arrays) {
  8915. var length = arrays.length,
  8916. iteratee = length > 1 ? arrays[length - 1] : undefined;
  8917. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  8918. return unzipWith(arrays, iteratee);
  8919. });
  8920. /*------------------------------------------------------------------------*/
  8921. /**
  8922. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  8923. * chain sequences enabled. The result of such sequences must be unwrapped
  8924. * with `_#value`.
  8925. *
  8926. * @static
  8927. * @memberOf _
  8928. * @since 1.3.0
  8929. * @category Seq
  8930. * @param {*} value The value to wrap.
  8931. * @returns {Object} Returns the new `lodash` wrapper instance.
  8932. * @example
  8933. *
  8934. * var users = [
  8935. * { 'user': 'barney', 'age': 36 },
  8936. * { 'user': 'fred', 'age': 40 },
  8937. * { 'user': 'pebbles', 'age': 1 }
  8938. * ];
  8939. *
  8940. * var youngest = _
  8941. * .chain(users)
  8942. * .sortBy('age')
  8943. * .map(function(o) {
  8944. * return o.user + ' is ' + o.age;
  8945. * })
  8946. * .head()
  8947. * .value();
  8948. * // => 'pebbles is 1'
  8949. */
  8950. function chain(value) {
  8951. var result = lodash(value);
  8952. result.__chain__ = true;
  8953. return result;
  8954. }
  8955. /**
  8956. * This method invokes `interceptor` and returns `value`. The interceptor
  8957. * is invoked with one argument; (value). The purpose of this method is to
  8958. * "tap into" a method chain sequence in order to modify intermediate results.
  8959. *
  8960. * @static
  8961. * @memberOf _
  8962. * @since 0.1.0
  8963. * @category Seq
  8964. * @param {*} value The value to provide to `interceptor`.
  8965. * @param {Function} interceptor The function to invoke.
  8966. * @returns {*} Returns `value`.
  8967. * @example
  8968. *
  8969. * _([1, 2, 3])
  8970. * .tap(function(array) {
  8971. * // Mutate input array.
  8972. * array.pop();
  8973. * })
  8974. * .reverse()
  8975. * .value();
  8976. * // => [2, 1]
  8977. */
  8978. function tap(value, interceptor) {
  8979. interceptor(value);
  8980. return value;
  8981. }
  8982. /**
  8983. * This method is like `_.tap` except that it returns the result of `interceptor`.
  8984. * The purpose of this method is to "pass thru" values replacing intermediate
  8985. * results in a method chain sequence.
  8986. *
  8987. * @static
  8988. * @memberOf _
  8989. * @since 3.0.0
  8990. * @category Seq
  8991. * @param {*} value The value to provide to `interceptor`.
  8992. * @param {Function} interceptor The function to invoke.
  8993. * @returns {*} Returns the result of `interceptor`.
  8994. * @example
  8995. *
  8996. * _(' abc ')
  8997. * .chain()
  8998. * .trim()
  8999. * .thru(function(value) {
  9000. * return [value];
  9001. * })
  9002. * .value();
  9003. * // => ['abc']
  9004. */
  9005. function thru(value, interceptor) {
  9006. return interceptor(value);
  9007. }
  9008. /**
  9009. * This method is the wrapper version of `_.at`.
  9010. *
  9011. * @name at
  9012. * @memberOf _
  9013. * @since 1.0.0
  9014. * @category Seq
  9015. * @param {...(string|string[])} [paths] The property paths to pick.
  9016. * @returns {Object} Returns the new `lodash` wrapper instance.
  9017. * @example
  9018. *
  9019. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  9020. *
  9021. * _(object).at(['a[0].b.c', 'a[1]']).value();
  9022. * // => [3, 4]
  9023. */
  9024. var wrapperAt = flatRest(function(paths) {
  9025. var length = paths.length,
  9026. start = length ? paths[0] : 0,
  9027. value = this.__wrapped__,
  9028. interceptor = function(object) { return baseAt(object, paths); };
  9029. if (length > 1 || this.__actions__.length ||
  9030. !(value instanceof LazyWrapper) || !isIndex(start)) {
  9031. return this.thru(interceptor);
  9032. }
  9033. value = value.slice(start, +start + (length ? 1 : 0));
  9034. value.__actions__.push({
  9035. 'func': thru,
  9036. 'args': [interceptor],
  9037. 'thisArg': undefined
  9038. });
  9039. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  9040. if (length && !array.length) {
  9041. array.push(undefined);
  9042. }
  9043. return array;
  9044. });
  9045. });
  9046. /**
  9047. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  9048. *
  9049. * @name chain
  9050. * @memberOf _
  9051. * @since 0.1.0
  9052. * @category Seq
  9053. * @returns {Object} Returns the new `lodash` wrapper instance.
  9054. * @example
  9055. *
  9056. * var users = [
  9057. * { 'user': 'barney', 'age': 36 },
  9058. * { 'user': 'fred', 'age': 40 }
  9059. * ];
  9060. *
  9061. * // A sequence without explicit chaining.
  9062. * _(users).head();
  9063. * // => { 'user': 'barney', 'age': 36 }
  9064. *
  9065. * // A sequence with explicit chaining.
  9066. * _(users)
  9067. * .chain()
  9068. * .head()
  9069. * .pick('user')
  9070. * .value();
  9071. * // => { 'user': 'barney' }
  9072. */
  9073. function wrapperChain() {
  9074. return chain(this);
  9075. }
  9076. /**
  9077. * Executes the chain sequence and returns the wrapped result.
  9078. *
  9079. * @name commit
  9080. * @memberOf _
  9081. * @since 3.2.0
  9082. * @category Seq
  9083. * @returns {Object} Returns the new `lodash` wrapper instance.
  9084. * @example
  9085. *
  9086. * var array = [1, 2];
  9087. * var wrapped = _(array).push(3);
  9088. *
  9089. * console.log(array);
  9090. * // => [1, 2]
  9091. *
  9092. * wrapped = wrapped.commit();
  9093. * console.log(array);
  9094. * // => [1, 2, 3]
  9095. *
  9096. * wrapped.last();
  9097. * // => 3
  9098. *
  9099. * console.log(array);
  9100. * // => [1, 2, 3]
  9101. */
  9102. function wrapperCommit() {
  9103. return new LodashWrapper(this.value(), this.__chain__);
  9104. }
  9105. /**
  9106. * Gets the next value on a wrapped object following the
  9107. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  9108. *
  9109. * @name next
  9110. * @memberOf _
  9111. * @since 4.0.0
  9112. * @category Seq
  9113. * @returns {Object} Returns the next iterator value.
  9114. * @example
  9115. *
  9116. * var wrapped = _([1, 2]);
  9117. *
  9118. * wrapped.next();
  9119. * // => { 'done': false, 'value': 1 }
  9120. *
  9121. * wrapped.next();
  9122. * // => { 'done': false, 'value': 2 }
  9123. *
  9124. * wrapped.next();
  9125. * // => { 'done': true, 'value': undefined }
  9126. */
  9127. function wrapperNext() {
  9128. if (this.__values__ === undefined) {
  9129. this.__values__ = toArray(this.value());
  9130. }
  9131. var done = this.__index__ >= this.__values__.length,
  9132. value = done ? undefined : this.__values__[this.__index__++];
  9133. return { 'done': done, 'value': value };
  9134. }
  9135. /**
  9136. * Enables the wrapper to be iterable.
  9137. *
  9138. * @name Symbol.iterator
  9139. * @memberOf _
  9140. * @since 4.0.0
  9141. * @category Seq
  9142. * @returns {Object} Returns the wrapper object.
  9143. * @example
  9144. *
  9145. * var wrapped = _([1, 2]);
  9146. *
  9147. * wrapped[Symbol.iterator]() === wrapped;
  9148. * // => true
  9149. *
  9150. * Array.from(wrapped);
  9151. * // => [1, 2]
  9152. */
  9153. function wrapperToIterator() {
  9154. return this;
  9155. }
  9156. /**
  9157. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  9158. *
  9159. * @name plant
  9160. * @memberOf _
  9161. * @since 3.2.0
  9162. * @category Seq
  9163. * @param {*} value The value to plant.
  9164. * @returns {Object} Returns the new `lodash` wrapper instance.
  9165. * @example
  9166. *
  9167. * function square(n) {
  9168. * return n * n;
  9169. * }
  9170. *
  9171. * var wrapped = _([1, 2]).map(square);
  9172. * var other = wrapped.plant([3, 4]);
  9173. *
  9174. * other.value();
  9175. * // => [9, 16]
  9176. *
  9177. * wrapped.value();
  9178. * // => [1, 4]
  9179. */
  9180. function wrapperPlant(value) {
  9181. var result,
  9182. parent = this;
  9183. while (parent instanceof baseLodash) {
  9184. var clone = wrapperClone(parent);
  9185. clone.__index__ = 0;
  9186. clone.__values__ = undefined;
  9187. if (result) {
  9188. previous.__wrapped__ = clone;
  9189. } else {
  9190. result = clone;
  9191. }
  9192. var previous = clone;
  9193. parent = parent.__wrapped__;
  9194. }
  9195. previous.__wrapped__ = value;
  9196. return result;
  9197. }
  9198. /**
  9199. * This method is the wrapper version of `_.reverse`.
  9200. *
  9201. * **Note:** This method mutates the wrapped array.
  9202. *
  9203. * @name reverse
  9204. * @memberOf _
  9205. * @since 0.1.0
  9206. * @category Seq
  9207. * @returns {Object} Returns the new `lodash` wrapper instance.
  9208. * @example
  9209. *
  9210. * var array = [1, 2, 3];
  9211. *
  9212. * _(array).reverse().value()
  9213. * // => [3, 2, 1]
  9214. *
  9215. * console.log(array);
  9216. * // => [3, 2, 1]
  9217. */
  9218. function wrapperReverse() {
  9219. var value = this.__wrapped__;
  9220. if (value instanceof LazyWrapper) {
  9221. var wrapped = value;
  9222. if (this.__actions__.length) {
  9223. wrapped = new LazyWrapper(this);
  9224. }
  9225. wrapped = wrapped.reverse();
  9226. wrapped.__actions__.push({
  9227. 'func': thru,
  9228. 'args': [reverse],
  9229. 'thisArg': undefined
  9230. });
  9231. return new LodashWrapper(wrapped, this.__chain__);
  9232. }
  9233. return this.thru(reverse);
  9234. }
  9235. /**
  9236. * Executes the chain sequence to resolve the unwrapped value.
  9237. *
  9238. * @name value
  9239. * @memberOf _
  9240. * @since 0.1.0
  9241. * @alias toJSON, valueOf
  9242. * @category Seq
  9243. * @returns {*} Returns the resolved unwrapped value.
  9244. * @example
  9245. *
  9246. * _([1, 2, 3]).value();
  9247. * // => [1, 2, 3]
  9248. */
  9249. function wrapperValue() {
  9250. return baseWrapperValue(this.__wrapped__, this.__actions__);
  9251. }
  9252. /*------------------------------------------------------------------------*/
  9253. /**
  9254. * Creates an object composed of keys generated from the results of running
  9255. * each element of `collection` thru `iteratee`. The corresponding value of
  9256. * each key is the number of times the key was returned by `iteratee`. The
  9257. * iteratee is invoked with one argument: (value).
  9258. *
  9259. * @static
  9260. * @memberOf _
  9261. * @since 0.5.0
  9262. * @category Collection
  9263. * @param {Array|Object} collection The collection to iterate over.
  9264. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9265. * @returns {Object} Returns the composed aggregate object.
  9266. * @example
  9267. *
  9268. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  9269. * // => { '4': 1, '6': 2 }
  9270. *
  9271. * // The `_.property` iteratee shorthand.
  9272. * _.countBy(['one', 'two', 'three'], 'length');
  9273. * // => { '3': 2, '5': 1 }
  9274. */
  9275. var countBy = createAggregator(function(result, value, key) {
  9276. if (hasOwnProperty.call(result, key)) {
  9277. ++result[key];
  9278. } else {
  9279. baseAssignValue(result, key, 1);
  9280. }
  9281. });
  9282. /**
  9283. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  9284. * Iteration is stopped once `predicate` returns falsey. The predicate is
  9285. * invoked with three arguments: (value, index|key, collection).
  9286. *
  9287. * **Note:** This method returns `true` for
  9288. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  9289. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  9290. * elements of empty collections.
  9291. *
  9292. * @static
  9293. * @memberOf _
  9294. * @since 0.1.0
  9295. * @category Collection
  9296. * @param {Array|Object} collection The collection to iterate over.
  9297. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9298. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9299. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9300. * else `false`.
  9301. * @example
  9302. *
  9303. * _.every([true, 1, null, 'yes'], Boolean);
  9304. * // => false
  9305. *
  9306. * var users = [
  9307. * { 'user': 'barney', 'age': 36, 'active': false },
  9308. * { 'user': 'fred', 'age': 40, 'active': false }
  9309. * ];
  9310. *
  9311. * // The `_.matches` iteratee shorthand.
  9312. * _.every(users, { 'user': 'barney', 'active': false });
  9313. * // => false
  9314. *
  9315. * // The `_.matchesProperty` iteratee shorthand.
  9316. * _.every(users, ['active', false]);
  9317. * // => true
  9318. *
  9319. * // The `_.property` iteratee shorthand.
  9320. * _.every(users, 'active');
  9321. * // => false
  9322. */
  9323. function every(collection, predicate, guard) {
  9324. var func = isArray(collection) ? arrayEvery : baseEvery;
  9325. if (guard && isIterateeCall(collection, predicate, guard)) {
  9326. predicate = undefined;
  9327. }
  9328. return func(collection, getIteratee(predicate, 3));
  9329. }
  9330. /**
  9331. * Iterates over elements of `collection`, returning an array of all elements
  9332. * `predicate` returns truthy for. The predicate is invoked with three
  9333. * arguments: (value, index|key, collection).
  9334. *
  9335. * **Note:** Unlike `_.remove`, this method returns a new array.
  9336. *
  9337. * @static
  9338. * @memberOf _
  9339. * @since 0.1.0
  9340. * @category Collection
  9341. * @param {Array|Object} collection The collection to iterate over.
  9342. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9343. * @returns {Array} Returns the new filtered array.
  9344. * @see _.reject
  9345. * @example
  9346. *
  9347. * var users = [
  9348. * { 'user': 'barney', 'age': 36, 'active': true },
  9349. * { 'user': 'fred', 'age': 40, 'active': false }
  9350. * ];
  9351. *
  9352. * _.filter(users, function(o) { return !o.active; });
  9353. * // => objects for ['fred']
  9354. *
  9355. * // The `_.matches` iteratee shorthand.
  9356. * _.filter(users, { 'age': 36, 'active': true });
  9357. * // => objects for ['barney']
  9358. *
  9359. * // The `_.matchesProperty` iteratee shorthand.
  9360. * _.filter(users, ['active', false]);
  9361. * // => objects for ['fred']
  9362. *
  9363. * // The `_.property` iteratee shorthand.
  9364. * _.filter(users, 'active');
  9365. * // => objects for ['barney']
  9366. */
  9367. function filter(collection, predicate) {
  9368. var func = isArray(collection) ? arrayFilter : baseFilter;
  9369. return func(collection, getIteratee(predicate, 3));
  9370. }
  9371. /**
  9372. * Iterates over elements of `collection`, returning the first element
  9373. * `predicate` returns truthy for. The predicate is invoked with three
  9374. * arguments: (value, index|key, collection).
  9375. *
  9376. * @static
  9377. * @memberOf _
  9378. * @since 0.1.0
  9379. * @category Collection
  9380. * @param {Array|Object} collection The collection to inspect.
  9381. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9382. * @param {number} [fromIndex=0] The index to search from.
  9383. * @returns {*} Returns the matched element, else `undefined`.
  9384. * @example
  9385. *
  9386. * var users = [
  9387. * { 'user': 'barney', 'age': 36, 'active': true },
  9388. * { 'user': 'fred', 'age': 40, 'active': false },
  9389. * { 'user': 'pebbles', 'age': 1, 'active': true }
  9390. * ];
  9391. *
  9392. * _.find(users, function(o) { return o.age < 40; });
  9393. * // => object for 'barney'
  9394. *
  9395. * // The `_.matches` iteratee shorthand.
  9396. * _.find(users, { 'age': 1, 'active': true });
  9397. * // => object for 'pebbles'
  9398. *
  9399. * // The `_.matchesProperty` iteratee shorthand.
  9400. * _.find(users, ['active', false]);
  9401. * // => object for 'fred'
  9402. *
  9403. * // The `_.property` iteratee shorthand.
  9404. * _.find(users, 'active');
  9405. * // => object for 'barney'
  9406. */
  9407. var find = createFind(findIndex);
  9408. /**
  9409. * This method is like `_.find` except that it iterates over elements of
  9410. * `collection` from right to left.
  9411. *
  9412. * @static
  9413. * @memberOf _
  9414. * @since 2.0.0
  9415. * @category Collection
  9416. * @param {Array|Object} collection The collection to inspect.
  9417. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9418. * @param {number} [fromIndex=collection.length-1] The index to search from.
  9419. * @returns {*} Returns the matched element, else `undefined`.
  9420. * @example
  9421. *
  9422. * _.findLast([1, 2, 3, 4], function(n) {
  9423. * return n % 2 == 1;
  9424. * });
  9425. * // => 3
  9426. */
  9427. var findLast = createFind(findLastIndex);
  9428. /**
  9429. * Creates a flattened array of values by running each element in `collection`
  9430. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  9431. * with three arguments: (value, index|key, collection).
  9432. *
  9433. * @static
  9434. * @memberOf _
  9435. * @since 4.0.0
  9436. * @category Collection
  9437. * @param {Array|Object} collection The collection to iterate over.
  9438. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9439. * @returns {Array} Returns the new flattened array.
  9440. * @example
  9441. *
  9442. * function duplicate(n) {
  9443. * return [n, n];
  9444. * }
  9445. *
  9446. * _.flatMap([1, 2], duplicate);
  9447. * // => [1, 1, 2, 2]
  9448. */
  9449. function flatMap(collection, iteratee) {
  9450. return baseFlatten(map(collection, iteratee), 1);
  9451. }
  9452. /**
  9453. * This method is like `_.flatMap` except that it recursively flattens the
  9454. * mapped results.
  9455. *
  9456. * @static
  9457. * @memberOf _
  9458. * @since 4.7.0
  9459. * @category Collection
  9460. * @param {Array|Object} collection The collection to iterate over.
  9461. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9462. * @returns {Array} Returns the new flattened array.
  9463. * @example
  9464. *
  9465. * function duplicate(n) {
  9466. * return [[[n, n]]];
  9467. * }
  9468. *
  9469. * _.flatMapDeep([1, 2], duplicate);
  9470. * // => [1, 1, 2, 2]
  9471. */
  9472. function flatMapDeep(collection, iteratee) {
  9473. return baseFlatten(map(collection, iteratee), INFINITY);
  9474. }
  9475. /**
  9476. * This method is like `_.flatMap` except that it recursively flattens the
  9477. * mapped results up to `depth` times.
  9478. *
  9479. * @static
  9480. * @memberOf _
  9481. * @since 4.7.0
  9482. * @category Collection
  9483. * @param {Array|Object} collection The collection to iterate over.
  9484. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9485. * @param {number} [depth=1] The maximum recursion depth.
  9486. * @returns {Array} Returns the new flattened array.
  9487. * @example
  9488. *
  9489. * function duplicate(n) {
  9490. * return [[[n, n]]];
  9491. * }
  9492. *
  9493. * _.flatMapDepth([1, 2], duplicate, 2);
  9494. * // => [[1, 1], [2, 2]]
  9495. */
  9496. function flatMapDepth(collection, iteratee, depth) {
  9497. depth = depth === undefined ? 1 : toInteger(depth);
  9498. return baseFlatten(map(collection, iteratee), depth);
  9499. }
  9500. /**
  9501. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  9502. * The iteratee is invoked with three arguments: (value, index|key, collection).
  9503. * Iteratee functions may exit iteration early by explicitly returning `false`.
  9504. *
  9505. * **Note:** As with other "Collections" methods, objects with a "length"
  9506. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  9507. * or `_.forOwn` for object iteration.
  9508. *
  9509. * @static
  9510. * @memberOf _
  9511. * @since 0.1.0
  9512. * @alias each
  9513. * @category Collection
  9514. * @param {Array|Object} collection The collection to iterate over.
  9515. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9516. * @returns {Array|Object} Returns `collection`.
  9517. * @see _.forEachRight
  9518. * @example
  9519. *
  9520. * _.forEach([1, 2], function(value) {
  9521. * console.log(value);
  9522. * });
  9523. * // => Logs `1` then `2`.
  9524. *
  9525. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  9526. * console.log(key);
  9527. * });
  9528. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  9529. */
  9530. function forEach(collection, iteratee) {
  9531. var func = isArray(collection) ? arrayEach : baseEach;
  9532. return func(collection, getIteratee(iteratee, 3));
  9533. }
  9534. /**
  9535. * This method is like `_.forEach` except that it iterates over elements of
  9536. * `collection` from right to left.
  9537. *
  9538. * @static
  9539. * @memberOf _
  9540. * @since 2.0.0
  9541. * @alias eachRight
  9542. * @category Collection
  9543. * @param {Array|Object} collection The collection to iterate over.
  9544. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9545. * @returns {Array|Object} Returns `collection`.
  9546. * @see _.forEach
  9547. * @example
  9548. *
  9549. * _.forEachRight([1, 2], function(value) {
  9550. * console.log(value);
  9551. * });
  9552. * // => Logs `2` then `1`.
  9553. */
  9554. function forEachRight(collection, iteratee) {
  9555. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  9556. return func(collection, getIteratee(iteratee, 3));
  9557. }
  9558. /**
  9559. * Creates an object composed of keys generated from the results of running
  9560. * each element of `collection` thru `iteratee`. The order of grouped values
  9561. * is determined by the order they occur in `collection`. The corresponding
  9562. * value of each key is an array of elements responsible for generating the
  9563. * key. The iteratee is invoked with one argument: (value).
  9564. *
  9565. * @static
  9566. * @memberOf _
  9567. * @since 0.1.0
  9568. * @category Collection
  9569. * @param {Array|Object} collection The collection to iterate over.
  9570. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9571. * @returns {Object} Returns the composed aggregate object.
  9572. * @example
  9573. *
  9574. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  9575. * // => { '4': [4.2], '6': [6.1, 6.3] }
  9576. *
  9577. * // The `_.property` iteratee shorthand.
  9578. * _.groupBy(['one', 'two', 'three'], 'length');
  9579. * // => { '3': ['one', 'two'], '5': ['three'] }
  9580. */
  9581. var groupBy = createAggregator(function(result, value, key) {
  9582. if (hasOwnProperty.call(result, key)) {
  9583. result[key].push(value);
  9584. } else {
  9585. baseAssignValue(result, key, [value]);
  9586. }
  9587. });
  9588. /**
  9589. * Checks if `value` is in `collection`. If `collection` is a string, it's
  9590. * checked for a substring of `value`, otherwise
  9591. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9592. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  9593. * the offset from the end of `collection`.
  9594. *
  9595. * @static
  9596. * @memberOf _
  9597. * @since 0.1.0
  9598. * @category Collection
  9599. * @param {Array|Object|string} collection The collection to inspect.
  9600. * @param {*} value The value to search for.
  9601. * @param {number} [fromIndex=0] The index to search from.
  9602. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9603. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  9604. * @example
  9605. *
  9606. * _.includes([1, 2, 3], 1);
  9607. * // => true
  9608. *
  9609. * _.includes([1, 2, 3], 1, 2);
  9610. * // => false
  9611. *
  9612. * _.includes({ 'a': 1, 'b': 2 }, 1);
  9613. * // => true
  9614. *
  9615. * _.includes('abcd', 'bc');
  9616. * // => true
  9617. */
  9618. function includes(collection, value, fromIndex, guard) {
  9619. collection = isArrayLike(collection) ? collection : values(collection);
  9620. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  9621. var length = collection.length;
  9622. if (fromIndex < 0) {
  9623. fromIndex = nativeMax(length + fromIndex, 0);
  9624. }
  9625. return isString(collection)
  9626. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  9627. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  9628. }
  9629. /**
  9630. * Invokes the method at `path` of each element in `collection`, returning
  9631. * an array of the results of each invoked method. Any additional arguments
  9632. * are provided to each invoked method. If `path` is a function, it's invoked
  9633. * for, and `this` bound to, each element in `collection`.
  9634. *
  9635. * @static
  9636. * @memberOf _
  9637. * @since 4.0.0
  9638. * @category Collection
  9639. * @param {Array|Object} collection The collection to iterate over.
  9640. * @param {Array|Function|string} path The path of the method to invoke or
  9641. * the function invoked per iteration.
  9642. * @param {...*} [args] The arguments to invoke each method with.
  9643. * @returns {Array} Returns the array of results.
  9644. * @example
  9645. *
  9646. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  9647. * // => [[1, 5, 7], [1, 2, 3]]
  9648. *
  9649. * _.invokeMap([123, 456], String.prototype.split, '');
  9650. * // => [['1', '2', '3'], ['4', '5', '6']]
  9651. */
  9652. var invokeMap = baseRest(function(collection, path, args) {
  9653. var index = -1,
  9654. isFunc = typeof path == 'function',
  9655. result = isArrayLike(collection) ? Array(collection.length) : [];
  9656. baseEach(collection, function(value) {
  9657. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  9658. });
  9659. return result;
  9660. });
  9661. /**
  9662. * Creates an object composed of keys generated from the results of running
  9663. * each element of `collection` thru `iteratee`. The corresponding value of
  9664. * each key is the last element responsible for generating the key. The
  9665. * iteratee is invoked with one argument: (value).
  9666. *
  9667. * @static
  9668. * @memberOf _
  9669. * @since 4.0.0
  9670. * @category Collection
  9671. * @param {Array|Object} collection The collection to iterate over.
  9672. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9673. * @returns {Object} Returns the composed aggregate object.
  9674. * @example
  9675. *
  9676. * var array = [
  9677. * { 'dir': 'left', 'code': 97 },
  9678. * { 'dir': 'right', 'code': 100 }
  9679. * ];
  9680. *
  9681. * _.keyBy(array, function(o) {
  9682. * return String.fromCharCode(o.code);
  9683. * });
  9684. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  9685. *
  9686. * _.keyBy(array, 'dir');
  9687. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  9688. */
  9689. var keyBy = createAggregator(function(result, value, key) {
  9690. baseAssignValue(result, key, value);
  9691. });
  9692. /**
  9693. * Creates an array of values by running each element in `collection` thru
  9694. * `iteratee`. The iteratee is invoked with three arguments:
  9695. * (value, index|key, collection).
  9696. *
  9697. * Many lodash methods are guarded to work as iteratees for methods like
  9698. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  9699. *
  9700. * The guarded methods are:
  9701. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  9702. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  9703. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  9704. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  9705. *
  9706. * @static
  9707. * @memberOf _
  9708. * @since 0.1.0
  9709. * @category Collection
  9710. * @param {Array|Object} collection The collection to iterate over.
  9711. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9712. * @returns {Array} Returns the new mapped array.
  9713. * @example
  9714. *
  9715. * function square(n) {
  9716. * return n * n;
  9717. * }
  9718. *
  9719. * _.map([4, 8], square);
  9720. * // => [16, 64]
  9721. *
  9722. * _.map({ 'a': 4, 'b': 8 }, square);
  9723. * // => [16, 64] (iteration order is not guaranteed)
  9724. *
  9725. * var users = [
  9726. * { 'user': 'barney' },
  9727. * { 'user': 'fred' }
  9728. * ];
  9729. *
  9730. * // The `_.property` iteratee shorthand.
  9731. * _.map(users, 'user');
  9732. * // => ['barney', 'fred']
  9733. */
  9734. function map(collection, iteratee) {
  9735. var func = isArray(collection) ? arrayMap : baseMap;
  9736. return func(collection, getIteratee(iteratee, 3));
  9737. }
  9738. /**
  9739. * This method is like `_.sortBy` except that it allows specifying the sort
  9740. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  9741. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  9742. * descending or "asc" for ascending sort order of corresponding values.
  9743. *
  9744. * @static
  9745. * @memberOf _
  9746. * @since 4.0.0
  9747. * @category Collection
  9748. * @param {Array|Object} collection The collection to iterate over.
  9749. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  9750. * The iteratees to sort by.
  9751. * @param {string[]} [orders] The sort orders of `iteratees`.
  9752. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9753. * @returns {Array} Returns the new sorted array.
  9754. * @example
  9755. *
  9756. * var users = [
  9757. * { 'user': 'fred', 'age': 48 },
  9758. * { 'user': 'barney', 'age': 34 },
  9759. * { 'user': 'fred', 'age': 40 },
  9760. * { 'user': 'barney', 'age': 36 }
  9761. * ];
  9762. *
  9763. * // Sort by `user` in ascending order and by `age` in descending order.
  9764. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  9765. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  9766. */
  9767. function orderBy(collection, iteratees, orders, guard) {
  9768. if (collection == null) {
  9769. return [];
  9770. }
  9771. if (!isArray(iteratees)) {
  9772. iteratees = iteratees == null ? [] : [iteratees];
  9773. }
  9774. orders = guard ? undefined : orders;
  9775. if (!isArray(orders)) {
  9776. orders = orders == null ? [] : [orders];
  9777. }
  9778. return baseOrderBy(collection, iteratees, orders);
  9779. }
  9780. /**
  9781. * Creates an array of elements split into two groups, the first of which
  9782. * contains elements `predicate` returns truthy for, the second of which
  9783. * contains elements `predicate` returns falsey for. The predicate is
  9784. * invoked with one argument: (value).
  9785. *
  9786. * @static
  9787. * @memberOf _
  9788. * @since 3.0.0
  9789. * @category Collection
  9790. * @param {Array|Object} collection The collection to iterate over.
  9791. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9792. * @returns {Array} Returns the array of grouped elements.
  9793. * @example
  9794. *
  9795. * var users = [
  9796. * { 'user': 'barney', 'age': 36, 'active': false },
  9797. * { 'user': 'fred', 'age': 40, 'active': true },
  9798. * { 'user': 'pebbles', 'age': 1, 'active': false }
  9799. * ];
  9800. *
  9801. * _.partition(users, function(o) { return o.active; });
  9802. * // => objects for [['fred'], ['barney', 'pebbles']]
  9803. *
  9804. * // The `_.matches` iteratee shorthand.
  9805. * _.partition(users, { 'age': 1, 'active': false });
  9806. * // => objects for [['pebbles'], ['barney', 'fred']]
  9807. *
  9808. * // The `_.matchesProperty` iteratee shorthand.
  9809. * _.partition(users, ['active', false]);
  9810. * // => objects for [['barney', 'pebbles'], ['fred']]
  9811. *
  9812. * // The `_.property` iteratee shorthand.
  9813. * _.partition(users, 'active');
  9814. * // => objects for [['fred'], ['barney', 'pebbles']]
  9815. */
  9816. var partition = createAggregator(function(result, value, key) {
  9817. result[key ? 0 : 1].push(value);
  9818. }, function() { return [[], []]; });
  9819. /**
  9820. * Reduces `collection` to a value which is the accumulated result of running
  9821. * each element in `collection` thru `iteratee`, where each successive
  9822. * invocation is supplied the return value of the previous. If `accumulator`
  9823. * is not given, the first element of `collection` is used as the initial
  9824. * value. The iteratee is invoked with four arguments:
  9825. * (accumulator, value, index|key, collection).
  9826. *
  9827. * Many lodash methods are guarded to work as iteratees for methods like
  9828. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  9829. *
  9830. * The guarded methods are:
  9831. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  9832. * and `sortBy`
  9833. *
  9834. * @static
  9835. * @memberOf _
  9836. * @since 0.1.0
  9837. * @category Collection
  9838. * @param {Array|Object} collection The collection to iterate over.
  9839. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9840. * @param {*} [accumulator] The initial value.
  9841. * @returns {*} Returns the accumulated value.
  9842. * @see _.reduceRight
  9843. * @example
  9844. *
  9845. * _.reduce([1, 2], function(sum, n) {
  9846. * return sum + n;
  9847. * }, 0);
  9848. * // => 3
  9849. *
  9850. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  9851. * (result[value] || (result[value] = [])).push(key);
  9852. * return result;
  9853. * }, {});
  9854. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  9855. */
  9856. function reduce(collection, iteratee, accumulator) {
  9857. var func = isArray(collection) ? arrayReduce : baseReduce,
  9858. initAccum = arguments.length < 3;
  9859. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  9860. }
  9861. /**
  9862. * This method is like `_.reduce` except that it iterates over elements of
  9863. * `collection` from right to left.
  9864. *
  9865. * @static
  9866. * @memberOf _
  9867. * @since 0.1.0
  9868. * @category Collection
  9869. * @param {Array|Object} collection The collection to iterate over.
  9870. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9871. * @param {*} [accumulator] The initial value.
  9872. * @returns {*} Returns the accumulated value.
  9873. * @see _.reduce
  9874. * @example
  9875. *
  9876. * var array = [[0, 1], [2, 3], [4, 5]];
  9877. *
  9878. * _.reduceRight(array, function(flattened, other) {
  9879. * return flattened.concat(other);
  9880. * }, []);
  9881. * // => [4, 5, 2, 3, 0, 1]
  9882. */
  9883. function reduceRight(collection, iteratee, accumulator) {
  9884. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  9885. initAccum = arguments.length < 3;
  9886. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  9887. }
  9888. /**
  9889. * The opposite of `_.filter`; this method returns the elements of `collection`
  9890. * that `predicate` does **not** return truthy for.
  9891. *
  9892. * @static
  9893. * @memberOf _
  9894. * @since 0.1.0
  9895. * @category Collection
  9896. * @param {Array|Object} collection The collection to iterate over.
  9897. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9898. * @returns {Array} Returns the new filtered array.
  9899. * @see _.filter
  9900. * @example
  9901. *
  9902. * var users = [
  9903. * { 'user': 'barney', 'age': 36, 'active': false },
  9904. * { 'user': 'fred', 'age': 40, 'active': true }
  9905. * ];
  9906. *
  9907. * _.reject(users, function(o) { return !o.active; });
  9908. * // => objects for ['fred']
  9909. *
  9910. * // The `_.matches` iteratee shorthand.
  9911. * _.reject(users, { 'age': 40, 'active': true });
  9912. * // => objects for ['barney']
  9913. *
  9914. * // The `_.matchesProperty` iteratee shorthand.
  9915. * _.reject(users, ['active', false]);
  9916. * // => objects for ['fred']
  9917. *
  9918. * // The `_.property` iteratee shorthand.
  9919. * _.reject(users, 'active');
  9920. * // => objects for ['barney']
  9921. */
  9922. function reject(collection, predicate) {
  9923. var func = isArray(collection) ? arrayFilter : baseFilter;
  9924. return func(collection, negate(getIteratee(predicate, 3)));
  9925. }
  9926. /**
  9927. * Gets a random element from `collection`.
  9928. *
  9929. * @static
  9930. * @memberOf _
  9931. * @since 2.0.0
  9932. * @category Collection
  9933. * @param {Array|Object} collection The collection to sample.
  9934. * @returns {*} Returns the random element.
  9935. * @example
  9936. *
  9937. * _.sample([1, 2, 3, 4]);
  9938. * // => 2
  9939. */
  9940. function sample(collection) {
  9941. var func = isArray(collection) ? arraySample : baseSample;
  9942. return func(collection);
  9943. }
  9944. /**
  9945. * Gets `n` random elements at unique keys from `collection` up to the
  9946. * size of `collection`.
  9947. *
  9948. * @static
  9949. * @memberOf _
  9950. * @since 4.0.0
  9951. * @category Collection
  9952. * @param {Array|Object} collection The collection to sample.
  9953. * @param {number} [n=1] The number of elements to sample.
  9954. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9955. * @returns {Array} Returns the random elements.
  9956. * @example
  9957. *
  9958. * _.sampleSize([1, 2, 3], 2);
  9959. * // => [3, 1]
  9960. *
  9961. * _.sampleSize([1, 2, 3], 4);
  9962. * // => [2, 3, 1]
  9963. */
  9964. function sampleSize(collection, n, guard) {
  9965. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  9966. n = 1;
  9967. } else {
  9968. n = toInteger(n);
  9969. }
  9970. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  9971. return func(collection, n);
  9972. }
  9973. /**
  9974. * Creates an array of shuffled values, using a version of the
  9975. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  9976. *
  9977. * @static
  9978. * @memberOf _
  9979. * @since 0.1.0
  9980. * @category Collection
  9981. * @param {Array|Object} collection The collection to shuffle.
  9982. * @returns {Array} Returns the new shuffled array.
  9983. * @example
  9984. *
  9985. * _.shuffle([1, 2, 3, 4]);
  9986. * // => [4, 1, 3, 2]
  9987. */
  9988. function shuffle(collection) {
  9989. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  9990. return func(collection);
  9991. }
  9992. /**
  9993. * Gets the size of `collection` by returning its length for array-like
  9994. * values or the number of own enumerable string keyed properties for objects.
  9995. *
  9996. * @static
  9997. * @memberOf _
  9998. * @since 0.1.0
  9999. * @category Collection
  10000. * @param {Array|Object|string} collection The collection to inspect.
  10001. * @returns {number} Returns the collection size.
  10002. * @example
  10003. *
  10004. * _.size([1, 2, 3]);
  10005. * // => 3
  10006. *
  10007. * _.size({ 'a': 1, 'b': 2 });
  10008. * // => 2
  10009. *
  10010. * _.size('pebbles');
  10011. * // => 7
  10012. */
  10013. function size(collection) {
  10014. if (collection == null) {
  10015. return 0;
  10016. }
  10017. if (isArrayLike(collection)) {
  10018. return isString(collection) ? stringSize(collection) : collection.length;
  10019. }
  10020. var tag = getTag(collection);
  10021. if (tag == mapTag || tag == setTag) {
  10022. return collection.size;
  10023. }
  10024. return baseKeys(collection).length;
  10025. }
  10026. /**
  10027. * Checks if `predicate` returns truthy for **any** element of `collection`.
  10028. * Iteration is stopped once `predicate` returns truthy. The predicate is
  10029. * invoked with three arguments: (value, index|key, collection).
  10030. *
  10031. * @static
  10032. * @memberOf _
  10033. * @since 0.1.0
  10034. * @category Collection
  10035. * @param {Array|Object} collection The collection to iterate over.
  10036. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10037. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10038. * @returns {boolean} Returns `true` if any element passes the predicate check,
  10039. * else `false`.
  10040. * @example
  10041. *
  10042. * _.some([null, 0, 'yes', false], Boolean);
  10043. * // => true
  10044. *
  10045. * var users = [
  10046. * { 'user': 'barney', 'active': true },
  10047. * { 'user': 'fred', 'active': false }
  10048. * ];
  10049. *
  10050. * // The `_.matches` iteratee shorthand.
  10051. * _.some(users, { 'user': 'barney', 'active': false });
  10052. * // => false
  10053. *
  10054. * // The `_.matchesProperty` iteratee shorthand.
  10055. * _.some(users, ['active', false]);
  10056. * // => true
  10057. *
  10058. * // The `_.property` iteratee shorthand.
  10059. * _.some(users, 'active');
  10060. * // => true
  10061. */
  10062. function some(collection, predicate, guard) {
  10063. var func = isArray(collection) ? arraySome : baseSome;
  10064. if (guard && isIterateeCall(collection, predicate, guard)) {
  10065. predicate = undefined;
  10066. }
  10067. return func(collection, getIteratee(predicate, 3));
  10068. }
  10069. /**
  10070. * Creates an array of elements, sorted in ascending order by the results of
  10071. * running each element in a collection thru each iteratee. This method
  10072. * performs a stable sort, that is, it preserves the original sort order of
  10073. * equal elements. The iteratees are invoked with one argument: (value).
  10074. *
  10075. * @static
  10076. * @memberOf _
  10077. * @since 0.1.0
  10078. * @category Collection
  10079. * @param {Array|Object} collection The collection to iterate over.
  10080. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  10081. * The iteratees to sort by.
  10082. * @returns {Array} Returns the new sorted array.
  10083. * @example
  10084. *
  10085. * var users = [
  10086. * { 'user': 'fred', 'age': 48 },
  10087. * { 'user': 'barney', 'age': 36 },
  10088. * { 'user': 'fred', 'age': 40 },
  10089. * { 'user': 'barney', 'age': 34 }
  10090. * ];
  10091. *
  10092. * _.sortBy(users, [function(o) { return o.user; }]);
  10093. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  10094. *
  10095. * _.sortBy(users, ['user', 'age']);
  10096. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  10097. */
  10098. var sortBy = baseRest(function(collection, iteratees) {
  10099. if (collection == null) {
  10100. return [];
  10101. }
  10102. var length = iteratees.length;
  10103. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  10104. iteratees = [];
  10105. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  10106. iteratees = [iteratees[0]];
  10107. }
  10108. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  10109. });
  10110. /*------------------------------------------------------------------------*/
  10111. /**
  10112. * Gets the timestamp of the number of milliseconds that have elapsed since
  10113. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10114. *
  10115. * @static
  10116. * @memberOf _
  10117. * @since 2.4.0
  10118. * @category Date
  10119. * @returns {number} Returns the timestamp.
  10120. * @example
  10121. *
  10122. * _.defer(function(stamp) {
  10123. * console.log(_.now() - stamp);
  10124. * }, _.now());
  10125. * // => Logs the number of milliseconds it took for the deferred invocation.
  10126. */
  10127. var now = ctxNow || function() {
  10128. return root.Date.now();
  10129. };
  10130. /*------------------------------------------------------------------------*/
  10131. /**
  10132. * The opposite of `_.before`; this method creates a function that invokes
  10133. * `func` once it's called `n` or more times.
  10134. *
  10135. * @static
  10136. * @memberOf _
  10137. * @since 0.1.0
  10138. * @category Function
  10139. * @param {number} n The number of calls before `func` is invoked.
  10140. * @param {Function} func The function to restrict.
  10141. * @returns {Function} Returns the new restricted function.
  10142. * @example
  10143. *
  10144. * var saves = ['profile', 'settings'];
  10145. *
  10146. * var done = _.after(saves.length, function() {
  10147. * console.log('done saving!');
  10148. * });
  10149. *
  10150. * _.forEach(saves, function(type) {
  10151. * asyncSave({ 'type': type, 'complete': done });
  10152. * });
  10153. * // => Logs 'done saving!' after the two async saves have completed.
  10154. */
  10155. function after(n, func) {
  10156. if (typeof func != 'function') {
  10157. throw new TypeError(FUNC_ERROR_TEXT);
  10158. }
  10159. n = toInteger(n);
  10160. return function() {
  10161. if (--n < 1) {
  10162. return func.apply(this, arguments);
  10163. }
  10164. };
  10165. }
  10166. /**
  10167. * Creates a function that invokes `func`, with up to `n` arguments,
  10168. * ignoring any additional arguments.
  10169. *
  10170. * @static
  10171. * @memberOf _
  10172. * @since 3.0.0
  10173. * @category Function
  10174. * @param {Function} func The function to cap arguments for.
  10175. * @param {number} [n=func.length] The arity cap.
  10176. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10177. * @returns {Function} Returns the new capped function.
  10178. * @example
  10179. *
  10180. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  10181. * // => [6, 8, 10]
  10182. */
  10183. function ary(func, n, guard) {
  10184. n = guard ? undefined : n;
  10185. n = (func && n == null) ? func.length : n;
  10186. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  10187. }
  10188. /**
  10189. * Creates a function that invokes `func`, with the `this` binding and arguments
  10190. * of the created function, while it's called less than `n` times. Subsequent
  10191. * calls to the created function return the result of the last `func` invocation.
  10192. *
  10193. * @static
  10194. * @memberOf _
  10195. * @since 3.0.0
  10196. * @category Function
  10197. * @param {number} n The number of calls at which `func` is no longer invoked.
  10198. * @param {Function} func The function to restrict.
  10199. * @returns {Function} Returns the new restricted function.
  10200. * @example
  10201. *
  10202. * jQuery(element).on('click', _.before(5, addContactToList));
  10203. * // => Allows adding up to 4 contacts to the list.
  10204. */
  10205. function before(n, func) {
  10206. var result;
  10207. if (typeof func != 'function') {
  10208. throw new TypeError(FUNC_ERROR_TEXT);
  10209. }
  10210. n = toInteger(n);
  10211. return function() {
  10212. if (--n > 0) {
  10213. result = func.apply(this, arguments);
  10214. }
  10215. if (n <= 1) {
  10216. func = undefined;
  10217. }
  10218. return result;
  10219. };
  10220. }
  10221. /**
  10222. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  10223. * and `partials` prepended to the arguments it receives.
  10224. *
  10225. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  10226. * may be used as a placeholder for partially applied arguments.
  10227. *
  10228. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  10229. * property of bound functions.
  10230. *
  10231. * @static
  10232. * @memberOf _
  10233. * @since 0.1.0
  10234. * @category Function
  10235. * @param {Function} func The function to bind.
  10236. * @param {*} thisArg The `this` binding of `func`.
  10237. * @param {...*} [partials] The arguments to be partially applied.
  10238. * @returns {Function} Returns the new bound function.
  10239. * @example
  10240. *
  10241. * function greet(greeting, punctuation) {
  10242. * return greeting + ' ' + this.user + punctuation;
  10243. * }
  10244. *
  10245. * var object = { 'user': 'fred' };
  10246. *
  10247. * var bound = _.bind(greet, object, 'hi');
  10248. * bound('!');
  10249. * // => 'hi fred!'
  10250. *
  10251. * // Bound with placeholders.
  10252. * var bound = _.bind(greet, object, _, '!');
  10253. * bound('hi');
  10254. * // => 'hi fred!'
  10255. */
  10256. var bind = baseRest(function(func, thisArg, partials) {
  10257. var bitmask = WRAP_BIND_FLAG;
  10258. if (partials.length) {
  10259. var holders = replaceHolders(partials, getHolder(bind));
  10260. bitmask |= WRAP_PARTIAL_FLAG;
  10261. }
  10262. return createWrap(func, bitmask, thisArg, partials, holders);
  10263. });
  10264. /**
  10265. * Creates a function that invokes the method at `object[key]` with `partials`
  10266. * prepended to the arguments it receives.
  10267. *
  10268. * This method differs from `_.bind` by allowing bound functions to reference
  10269. * methods that may be redefined or don't yet exist. See
  10270. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  10271. * for more details.
  10272. *
  10273. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  10274. * builds, may be used as a placeholder for partially applied arguments.
  10275. *
  10276. * @static
  10277. * @memberOf _
  10278. * @since 0.10.0
  10279. * @category Function
  10280. * @param {Object} object The object to invoke the method on.
  10281. * @param {string} key The key of the method.
  10282. * @param {...*} [partials] The arguments to be partially applied.
  10283. * @returns {Function} Returns the new bound function.
  10284. * @example
  10285. *
  10286. * var object = {
  10287. * 'user': 'fred',
  10288. * 'greet': function(greeting, punctuation) {
  10289. * return greeting + ' ' + this.user + punctuation;
  10290. * }
  10291. * };
  10292. *
  10293. * var bound = _.bindKey(object, 'greet', 'hi');
  10294. * bound('!');
  10295. * // => 'hi fred!'
  10296. *
  10297. * object.greet = function(greeting, punctuation) {
  10298. * return greeting + 'ya ' + this.user + punctuation;
  10299. * };
  10300. *
  10301. * bound('!');
  10302. * // => 'hiya fred!'
  10303. *
  10304. * // Bound with placeholders.
  10305. * var bound = _.bindKey(object, 'greet', _, '!');
  10306. * bound('hi');
  10307. * // => 'hiya fred!'
  10308. */
  10309. var bindKey = baseRest(function(object, key, partials) {
  10310. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  10311. if (partials.length) {
  10312. var holders = replaceHolders(partials, getHolder(bindKey));
  10313. bitmask |= WRAP_PARTIAL_FLAG;
  10314. }
  10315. return createWrap(key, bitmask, object, partials, holders);
  10316. });
  10317. /**
  10318. * Creates a function that accepts arguments of `func` and either invokes
  10319. * `func` returning its result, if at least `arity` number of arguments have
  10320. * been provided, or returns a function that accepts the remaining `func`
  10321. * arguments, and so on. The arity of `func` may be specified if `func.length`
  10322. * is not sufficient.
  10323. *
  10324. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  10325. * may be used as a placeholder for provided arguments.
  10326. *
  10327. * **Note:** This method doesn't set the "length" property of curried functions.
  10328. *
  10329. * @static
  10330. * @memberOf _
  10331. * @since 2.0.0
  10332. * @category Function
  10333. * @param {Function} func The function to curry.
  10334. * @param {number} [arity=func.length] The arity of `func`.
  10335. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10336. * @returns {Function} Returns the new curried function.
  10337. * @example
  10338. *
  10339. * var abc = function(a, b, c) {
  10340. * return [a, b, c];
  10341. * };
  10342. *
  10343. * var curried = _.curry(abc);
  10344. *
  10345. * curried(1)(2)(3);
  10346. * // => [1, 2, 3]
  10347. *
  10348. * curried(1, 2)(3);
  10349. * // => [1, 2, 3]
  10350. *
  10351. * curried(1, 2, 3);
  10352. * // => [1, 2, 3]
  10353. *
  10354. * // Curried with placeholders.
  10355. * curried(1)(_, 3)(2);
  10356. * // => [1, 2, 3]
  10357. */
  10358. function curry(func, arity, guard) {
  10359. arity = guard ? undefined : arity;
  10360. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10361. result.placeholder = curry.placeholder;
  10362. return result;
  10363. }
  10364. /**
  10365. * This method is like `_.curry` except that arguments are applied to `func`
  10366. * in the manner of `_.partialRight` instead of `_.partial`.
  10367. *
  10368. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  10369. * builds, may be used as a placeholder for provided arguments.
  10370. *
  10371. * **Note:** This method doesn't set the "length" property of curried functions.
  10372. *
  10373. * @static
  10374. * @memberOf _
  10375. * @since 3.0.0
  10376. * @category Function
  10377. * @param {Function} func The function to curry.
  10378. * @param {number} [arity=func.length] The arity of `func`.
  10379. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10380. * @returns {Function} Returns the new curried function.
  10381. * @example
  10382. *
  10383. * var abc = function(a, b, c) {
  10384. * return [a, b, c];
  10385. * };
  10386. *
  10387. * var curried = _.curryRight(abc);
  10388. *
  10389. * curried(3)(2)(1);
  10390. * // => [1, 2, 3]
  10391. *
  10392. * curried(2, 3)(1);
  10393. * // => [1, 2, 3]
  10394. *
  10395. * curried(1, 2, 3);
  10396. * // => [1, 2, 3]
  10397. *
  10398. * // Curried with placeholders.
  10399. * curried(3)(1, _)(2);
  10400. * // => [1, 2, 3]
  10401. */
  10402. function curryRight(func, arity, guard) {
  10403. arity = guard ? undefined : arity;
  10404. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10405. result.placeholder = curryRight.placeholder;
  10406. return result;
  10407. }
  10408. /**
  10409. * Creates a debounced function that delays invoking `func` until after `wait`
  10410. * milliseconds have elapsed since the last time the debounced function was
  10411. * invoked. The debounced function comes with a `cancel` method to cancel
  10412. * delayed `func` invocations and a `flush` method to immediately invoke them.
  10413. * Provide `options` to indicate whether `func` should be invoked on the
  10414. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  10415. * with the last arguments provided to the debounced function. Subsequent
  10416. * calls to the debounced function return the result of the last `func`
  10417. * invocation.
  10418. *
  10419. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10420. * invoked on the trailing edge of the timeout only if the debounced function
  10421. * is invoked more than once during the `wait` timeout.
  10422. *
  10423. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10424. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10425. *
  10426. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10427. * for details over the differences between `_.debounce` and `_.throttle`.
  10428. *
  10429. * @static
  10430. * @memberOf _
  10431. * @since 0.1.0
  10432. * @category Function
  10433. * @param {Function} func The function to debounce.
  10434. * @param {number} [wait=0] The number of milliseconds to delay.
  10435. * @param {Object} [options={}] The options object.
  10436. * @param {boolean} [options.leading=false]
  10437. * Specify invoking on the leading edge of the timeout.
  10438. * @param {number} [options.maxWait]
  10439. * The maximum time `func` is allowed to be delayed before it's invoked.
  10440. * @param {boolean} [options.trailing=true]
  10441. * Specify invoking on the trailing edge of the timeout.
  10442. * @returns {Function} Returns the new debounced function.
  10443. * @example
  10444. *
  10445. * // Avoid costly calculations while the window size is in flux.
  10446. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  10447. *
  10448. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  10449. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  10450. * 'leading': true,
  10451. * 'trailing': false
  10452. * }));
  10453. *
  10454. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  10455. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  10456. * var source = new EventSource('/stream');
  10457. * jQuery(source).on('message', debounced);
  10458. *
  10459. * // Cancel the trailing debounced invocation.
  10460. * jQuery(window).on('popstate', debounced.cancel);
  10461. */
  10462. function debounce(func, wait, options) {
  10463. var lastArgs,
  10464. lastThis,
  10465. maxWait,
  10466. result,
  10467. timerId,
  10468. lastCallTime,
  10469. lastInvokeTime = 0,
  10470. leading = false,
  10471. maxing = false,
  10472. trailing = true;
  10473. if (typeof func != 'function') {
  10474. throw new TypeError(FUNC_ERROR_TEXT);
  10475. }
  10476. wait = toNumber(wait) || 0;
  10477. if (isObject(options)) {
  10478. leading = !!options.leading;
  10479. maxing = 'maxWait' in options;
  10480. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  10481. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10482. }
  10483. function invokeFunc(time) {
  10484. var args = lastArgs,
  10485. thisArg = lastThis;
  10486. lastArgs = lastThis = undefined;
  10487. lastInvokeTime = time;
  10488. result = func.apply(thisArg, args);
  10489. return result;
  10490. }
  10491. function leadingEdge(time) {
  10492. // Reset any `maxWait` timer.
  10493. lastInvokeTime = time;
  10494. // Start the timer for the trailing edge.
  10495. timerId = setTimeout(timerExpired, wait);
  10496. // Invoke the leading edge.
  10497. return leading ? invokeFunc(time) : result;
  10498. }
  10499. function remainingWait(time) {
  10500. var timeSinceLastCall = time - lastCallTime,
  10501. timeSinceLastInvoke = time - lastInvokeTime,
  10502. timeWaiting = wait - timeSinceLastCall;
  10503. return maxing
  10504. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  10505. : timeWaiting;
  10506. }
  10507. function shouldInvoke(time) {
  10508. var timeSinceLastCall = time - lastCallTime,
  10509. timeSinceLastInvoke = time - lastInvokeTime;
  10510. // Either this is the first call, activity has stopped and we're at the
  10511. // trailing edge, the system time has gone backwards and we're treating
  10512. // it as the trailing edge, or we've hit the `maxWait` limit.
  10513. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  10514. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  10515. }
  10516. function timerExpired() {
  10517. var time = now();
  10518. if (shouldInvoke(time)) {
  10519. return trailingEdge(time);
  10520. }
  10521. // Restart the timer.
  10522. timerId = setTimeout(timerExpired, remainingWait(time));
  10523. }
  10524. function trailingEdge(time) {
  10525. timerId = undefined;
  10526. // Only invoke if we have `lastArgs` which means `func` has been
  10527. // debounced at least once.
  10528. if (trailing && lastArgs) {
  10529. return invokeFunc(time);
  10530. }
  10531. lastArgs = lastThis = undefined;
  10532. return result;
  10533. }
  10534. function cancel() {
  10535. if (timerId !== undefined) {
  10536. clearTimeout(timerId);
  10537. }
  10538. lastInvokeTime = 0;
  10539. lastArgs = lastCallTime = lastThis = timerId = undefined;
  10540. }
  10541. function flush() {
  10542. return timerId === undefined ? result : trailingEdge(now());
  10543. }
  10544. function debounced() {
  10545. var time = now(),
  10546. isInvoking = shouldInvoke(time);
  10547. lastArgs = arguments;
  10548. lastThis = this;
  10549. lastCallTime = time;
  10550. if (isInvoking) {
  10551. if (timerId === undefined) {
  10552. return leadingEdge(lastCallTime);
  10553. }
  10554. if (maxing) {
  10555. // Handle invocations in a tight loop.
  10556. timerId = setTimeout(timerExpired, wait);
  10557. return invokeFunc(lastCallTime);
  10558. }
  10559. }
  10560. if (timerId === undefined) {
  10561. timerId = setTimeout(timerExpired, wait);
  10562. }
  10563. return result;
  10564. }
  10565. debounced.cancel = cancel;
  10566. debounced.flush = flush;
  10567. return debounced;
  10568. }
  10569. /**
  10570. * Defers invoking the `func` until the current call stack has cleared. Any
  10571. * additional arguments are provided to `func` when it's invoked.
  10572. *
  10573. * @static
  10574. * @memberOf _
  10575. * @since 0.1.0
  10576. * @category Function
  10577. * @param {Function} func The function to defer.
  10578. * @param {...*} [args] The arguments to invoke `func` with.
  10579. * @returns {number} Returns the timer id.
  10580. * @example
  10581. *
  10582. * _.defer(function(text) {
  10583. * console.log(text);
  10584. * }, 'deferred');
  10585. * // => Logs 'deferred' after one millisecond.
  10586. */
  10587. var defer = baseRest(function(func, args) {
  10588. return baseDelay(func, 1, args);
  10589. });
  10590. /**
  10591. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  10592. * provided to `func` when it's invoked.
  10593. *
  10594. * @static
  10595. * @memberOf _
  10596. * @since 0.1.0
  10597. * @category Function
  10598. * @param {Function} func The function to delay.
  10599. * @param {number} wait The number of milliseconds to delay invocation.
  10600. * @param {...*} [args] The arguments to invoke `func` with.
  10601. * @returns {number} Returns the timer id.
  10602. * @example
  10603. *
  10604. * _.delay(function(text) {
  10605. * console.log(text);
  10606. * }, 1000, 'later');
  10607. * // => Logs 'later' after one second.
  10608. */
  10609. var delay = baseRest(function(func, wait, args) {
  10610. return baseDelay(func, toNumber(wait) || 0, args);
  10611. });
  10612. /**
  10613. * Creates a function that invokes `func` with arguments reversed.
  10614. *
  10615. * @static
  10616. * @memberOf _
  10617. * @since 4.0.0
  10618. * @category Function
  10619. * @param {Function} func The function to flip arguments for.
  10620. * @returns {Function} Returns the new flipped function.
  10621. * @example
  10622. *
  10623. * var flipped = _.flip(function() {
  10624. * return _.toArray(arguments);
  10625. * });
  10626. *
  10627. * flipped('a', 'b', 'c', 'd');
  10628. * // => ['d', 'c', 'b', 'a']
  10629. */
  10630. function flip(func) {
  10631. return createWrap(func, WRAP_FLIP_FLAG);
  10632. }
  10633. /**
  10634. * Creates a function that memoizes the result of `func`. If `resolver` is
  10635. * provided, it determines the cache key for storing the result based on the
  10636. * arguments provided to the memoized function. By default, the first argument
  10637. * provided to the memoized function is used as the map cache key. The `func`
  10638. * is invoked with the `this` binding of the memoized function.
  10639. *
  10640. * **Note:** The cache is exposed as the `cache` property on the memoized
  10641. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  10642. * constructor with one whose instances implement the
  10643. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  10644. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  10645. *
  10646. * @static
  10647. * @memberOf _
  10648. * @since 0.1.0
  10649. * @category Function
  10650. * @param {Function} func The function to have its output memoized.
  10651. * @param {Function} [resolver] The function to resolve the cache key.
  10652. * @returns {Function} Returns the new memoized function.
  10653. * @example
  10654. *
  10655. * var object = { 'a': 1, 'b': 2 };
  10656. * var other = { 'c': 3, 'd': 4 };
  10657. *
  10658. * var values = _.memoize(_.values);
  10659. * values(object);
  10660. * // => [1, 2]
  10661. *
  10662. * values(other);
  10663. * // => [3, 4]
  10664. *
  10665. * object.a = 2;
  10666. * values(object);
  10667. * // => [1, 2]
  10668. *
  10669. * // Modify the result cache.
  10670. * values.cache.set(object, ['a', 'b']);
  10671. * values(object);
  10672. * // => ['a', 'b']
  10673. *
  10674. * // Replace `_.memoize.Cache`.
  10675. * _.memoize.Cache = WeakMap;
  10676. */
  10677. function memoize(func, resolver) {
  10678. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  10679. throw new TypeError(FUNC_ERROR_TEXT);
  10680. }
  10681. var memoized = function() {
  10682. var args = arguments,
  10683. key = resolver ? resolver.apply(this, args) : args[0],
  10684. cache = memoized.cache;
  10685. if (cache.has(key)) {
  10686. return cache.get(key);
  10687. }
  10688. var result = func.apply(this, args);
  10689. memoized.cache = cache.set(key, result) || cache;
  10690. return result;
  10691. };
  10692. memoized.cache = new (memoize.Cache || MapCache);
  10693. return memoized;
  10694. }
  10695. // Expose `MapCache`.
  10696. memoize.Cache = MapCache;
  10697. /**
  10698. * Creates a function that negates the result of the predicate `func`. The
  10699. * `func` predicate is invoked with the `this` binding and arguments of the
  10700. * created function.
  10701. *
  10702. * @static
  10703. * @memberOf _
  10704. * @since 3.0.0
  10705. * @category Function
  10706. * @param {Function} predicate The predicate to negate.
  10707. * @returns {Function} Returns the new negated function.
  10708. * @example
  10709. *
  10710. * function isEven(n) {
  10711. * return n % 2 == 0;
  10712. * }
  10713. *
  10714. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  10715. * // => [1, 3, 5]
  10716. */
  10717. function negate(predicate) {
  10718. if (typeof predicate != 'function') {
  10719. throw new TypeError(FUNC_ERROR_TEXT);
  10720. }
  10721. return function() {
  10722. var args = arguments;
  10723. switch (args.length) {
  10724. case 0: return !predicate.call(this);
  10725. case 1: return !predicate.call(this, args[0]);
  10726. case 2: return !predicate.call(this, args[0], args[1]);
  10727. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  10728. }
  10729. return !predicate.apply(this, args);
  10730. };
  10731. }
  10732. /**
  10733. * Creates a function that is restricted to invoking `func` once. Repeat calls
  10734. * to the function return the value of the first invocation. The `func` is
  10735. * invoked with the `this` binding and arguments of the created function.
  10736. *
  10737. * @static
  10738. * @memberOf _
  10739. * @since 0.1.0
  10740. * @category Function
  10741. * @param {Function} func The function to restrict.
  10742. * @returns {Function} Returns the new restricted function.
  10743. * @example
  10744. *
  10745. * var initialize = _.once(createApplication);
  10746. * initialize();
  10747. * initialize();
  10748. * // => `createApplication` is invoked once
  10749. */
  10750. function once(func) {
  10751. return before(2, func);
  10752. }
  10753. /**
  10754. * Creates a function that invokes `func` with its arguments transformed.
  10755. *
  10756. * @static
  10757. * @since 4.0.0
  10758. * @memberOf _
  10759. * @category Function
  10760. * @param {Function} func The function to wrap.
  10761. * @param {...(Function|Function[])} [transforms=[_.identity]]
  10762. * The argument transforms.
  10763. * @returns {Function} Returns the new function.
  10764. * @example
  10765. *
  10766. * function doubled(n) {
  10767. * return n * 2;
  10768. * }
  10769. *
  10770. * function square(n) {
  10771. * return n * n;
  10772. * }
  10773. *
  10774. * var func = _.overArgs(function(x, y) {
  10775. * return [x, y];
  10776. * }, [square, doubled]);
  10777. *
  10778. * func(9, 3);
  10779. * // => [81, 6]
  10780. *
  10781. * func(10, 5);
  10782. * // => [100, 10]
  10783. */
  10784. var overArgs = castRest(function(func, transforms) {
  10785. transforms = (transforms.length == 1 && isArray(transforms[0]))
  10786. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  10787. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  10788. var funcsLength = transforms.length;
  10789. return baseRest(function(args) {
  10790. var index = -1,
  10791. length = nativeMin(args.length, funcsLength);
  10792. while (++index < length) {
  10793. args[index] = transforms[index].call(this, args[index]);
  10794. }
  10795. return apply(func, this, args);
  10796. });
  10797. });
  10798. /**
  10799. * Creates a function that invokes `func` with `partials` prepended to the
  10800. * arguments it receives. This method is like `_.bind` except it does **not**
  10801. * alter the `this` binding.
  10802. *
  10803. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  10804. * builds, may be used as a placeholder for partially applied arguments.
  10805. *
  10806. * **Note:** This method doesn't set the "length" property of partially
  10807. * applied functions.
  10808. *
  10809. * @static
  10810. * @memberOf _
  10811. * @since 0.2.0
  10812. * @category Function
  10813. * @param {Function} func The function to partially apply arguments to.
  10814. * @param {...*} [partials] The arguments to be partially applied.
  10815. * @returns {Function} Returns the new partially applied function.
  10816. * @example
  10817. *
  10818. * function greet(greeting, name) {
  10819. * return greeting + ' ' + name;
  10820. * }
  10821. *
  10822. * var sayHelloTo = _.partial(greet, 'hello');
  10823. * sayHelloTo('fred');
  10824. * // => 'hello fred'
  10825. *
  10826. * // Partially applied with placeholders.
  10827. * var greetFred = _.partial(greet, _, 'fred');
  10828. * greetFred('hi');
  10829. * // => 'hi fred'
  10830. */
  10831. var partial = baseRest(function(func, partials) {
  10832. var holders = replaceHolders(partials, getHolder(partial));
  10833. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  10834. });
  10835. /**
  10836. * This method is like `_.partial` except that partially applied arguments
  10837. * are appended to the arguments it receives.
  10838. *
  10839. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  10840. * builds, may be used as a placeholder for partially applied arguments.
  10841. *
  10842. * **Note:** This method doesn't set the "length" property of partially
  10843. * applied functions.
  10844. *
  10845. * @static
  10846. * @memberOf _
  10847. * @since 1.0.0
  10848. * @category Function
  10849. * @param {Function} func The function to partially apply arguments to.
  10850. * @param {...*} [partials] The arguments to be partially applied.
  10851. * @returns {Function} Returns the new partially applied function.
  10852. * @example
  10853. *
  10854. * function greet(greeting, name) {
  10855. * return greeting + ' ' + name;
  10856. * }
  10857. *
  10858. * var greetFred = _.partialRight(greet, 'fred');
  10859. * greetFred('hi');
  10860. * // => 'hi fred'
  10861. *
  10862. * // Partially applied with placeholders.
  10863. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  10864. * sayHelloTo('fred');
  10865. * // => 'hello fred'
  10866. */
  10867. var partialRight = baseRest(function(func, partials) {
  10868. var holders = replaceHolders(partials, getHolder(partialRight));
  10869. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  10870. });
  10871. /**
  10872. * Creates a function that invokes `func` with arguments arranged according
  10873. * to the specified `indexes` where the argument value at the first index is
  10874. * provided as the first argument, the argument value at the second index is
  10875. * provided as the second argument, and so on.
  10876. *
  10877. * @static
  10878. * @memberOf _
  10879. * @since 3.0.0
  10880. * @category Function
  10881. * @param {Function} func The function to rearrange arguments for.
  10882. * @param {...(number|number[])} indexes The arranged argument indexes.
  10883. * @returns {Function} Returns the new function.
  10884. * @example
  10885. *
  10886. * var rearged = _.rearg(function(a, b, c) {
  10887. * return [a, b, c];
  10888. * }, [2, 0, 1]);
  10889. *
  10890. * rearged('b', 'c', 'a')
  10891. * // => ['a', 'b', 'c']
  10892. */
  10893. var rearg = flatRest(function(func, indexes) {
  10894. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  10895. });
  10896. /**
  10897. * Creates a function that invokes `func` with the `this` binding of the
  10898. * created function and arguments from `start` and beyond provided as
  10899. * an array.
  10900. *
  10901. * **Note:** This method is based on the
  10902. * [rest parameter](https://mdn.io/rest_parameters).
  10903. *
  10904. * @static
  10905. * @memberOf _
  10906. * @since 4.0.0
  10907. * @category Function
  10908. * @param {Function} func The function to apply a rest parameter to.
  10909. * @param {number} [start=func.length-1] The start position of the rest parameter.
  10910. * @returns {Function} Returns the new function.
  10911. * @example
  10912. *
  10913. * var say = _.rest(function(what, names) {
  10914. * return what + ' ' + _.initial(names).join(', ') +
  10915. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  10916. * });
  10917. *
  10918. * say('hello', 'fred', 'barney', 'pebbles');
  10919. * // => 'hello fred, barney, & pebbles'
  10920. */
  10921. function rest(func, start) {
  10922. if (typeof func != 'function') {
  10923. throw new TypeError(FUNC_ERROR_TEXT);
  10924. }
  10925. start = start === undefined ? start : toInteger(start);
  10926. return baseRest(func, start);
  10927. }
  10928. /**
  10929. * Creates a function that invokes `func` with the `this` binding of the
  10930. * create function and an array of arguments much like
  10931. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  10932. *
  10933. * **Note:** This method is based on the
  10934. * [spread operator](https://mdn.io/spread_operator).
  10935. *
  10936. * @static
  10937. * @memberOf _
  10938. * @since 3.2.0
  10939. * @category Function
  10940. * @param {Function} func The function to spread arguments over.
  10941. * @param {number} [start=0] The start position of the spread.
  10942. * @returns {Function} Returns the new function.
  10943. * @example
  10944. *
  10945. * var say = _.spread(function(who, what) {
  10946. * return who + ' says ' + what;
  10947. * });
  10948. *
  10949. * say(['fred', 'hello']);
  10950. * // => 'fred says hello'
  10951. *
  10952. * var numbers = Promise.all([
  10953. * Promise.resolve(40),
  10954. * Promise.resolve(36)
  10955. * ]);
  10956. *
  10957. * numbers.then(_.spread(function(x, y) {
  10958. * return x + y;
  10959. * }));
  10960. * // => a Promise of 76
  10961. */
  10962. function spread(func, start) {
  10963. if (typeof func != 'function') {
  10964. throw new TypeError(FUNC_ERROR_TEXT);
  10965. }
  10966. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  10967. return baseRest(function(args) {
  10968. var array = args[start],
  10969. otherArgs = castSlice(args, 0, start);
  10970. if (array) {
  10971. arrayPush(otherArgs, array);
  10972. }
  10973. return apply(func, this, otherArgs);
  10974. });
  10975. }
  10976. /**
  10977. * Creates a throttled function that only invokes `func` at most once per
  10978. * every `wait` milliseconds. The throttled function comes with a `cancel`
  10979. * method to cancel delayed `func` invocations and a `flush` method to
  10980. * immediately invoke them. Provide `options` to indicate whether `func`
  10981. * should be invoked on the leading and/or trailing edge of the `wait`
  10982. * timeout. The `func` is invoked with the last arguments provided to the
  10983. * throttled function. Subsequent calls to the throttled function return the
  10984. * result of the last `func` invocation.
  10985. *
  10986. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10987. * invoked on the trailing edge of the timeout only if the throttled function
  10988. * is invoked more than once during the `wait` timeout.
  10989. *
  10990. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10991. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10992. *
  10993. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10994. * for details over the differences between `_.throttle` and `_.debounce`.
  10995. *
  10996. * @static
  10997. * @memberOf _
  10998. * @since 0.1.0
  10999. * @category Function
  11000. * @param {Function} func The function to throttle.
  11001. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  11002. * @param {Object} [options={}] The options object.
  11003. * @param {boolean} [options.leading=true]
  11004. * Specify invoking on the leading edge of the timeout.
  11005. * @param {boolean} [options.trailing=true]
  11006. * Specify invoking on the trailing edge of the timeout.
  11007. * @returns {Function} Returns the new throttled function.
  11008. * @example
  11009. *
  11010. * // Avoid excessively updating the position while scrolling.
  11011. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  11012. *
  11013. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  11014. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  11015. * jQuery(element).on('click', throttled);
  11016. *
  11017. * // Cancel the trailing throttled invocation.
  11018. * jQuery(window).on('popstate', throttled.cancel);
  11019. */
  11020. function throttle(func, wait, options) {
  11021. var leading = true,
  11022. trailing = true;
  11023. if (typeof func != 'function') {
  11024. throw new TypeError(FUNC_ERROR_TEXT);
  11025. }
  11026. if (isObject(options)) {
  11027. leading = 'leading' in options ? !!options.leading : leading;
  11028. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11029. }
  11030. return debounce(func, wait, {
  11031. 'leading': leading,
  11032. 'maxWait': wait,
  11033. 'trailing': trailing
  11034. });
  11035. }
  11036. /**
  11037. * Creates a function that accepts up to one argument, ignoring any
  11038. * additional arguments.
  11039. *
  11040. * @static
  11041. * @memberOf _
  11042. * @since 4.0.0
  11043. * @category Function
  11044. * @param {Function} func The function to cap arguments for.
  11045. * @returns {Function} Returns the new capped function.
  11046. * @example
  11047. *
  11048. * _.map(['6', '8', '10'], _.unary(parseInt));
  11049. * // => [6, 8, 10]
  11050. */
  11051. function unary(func) {
  11052. return ary(func, 1);
  11053. }
  11054. /**
  11055. * Creates a function that provides `value` to `wrapper` as its first
  11056. * argument. Any additional arguments provided to the function are appended
  11057. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  11058. * binding of the created function.
  11059. *
  11060. * @static
  11061. * @memberOf _
  11062. * @since 0.1.0
  11063. * @category Function
  11064. * @param {*} value The value to wrap.
  11065. * @param {Function} [wrapper=identity] The wrapper function.
  11066. * @returns {Function} Returns the new function.
  11067. * @example
  11068. *
  11069. * var p = _.wrap(_.escape, function(func, text) {
  11070. * return '<p>' + func(text) + '</p>';
  11071. * });
  11072. *
  11073. * p('fred, barney, & pebbles');
  11074. * // => '<p>fred, barney, &amp; pebbles</p>'
  11075. */
  11076. function wrap(value, wrapper) {
  11077. return partial(castFunction(wrapper), value);
  11078. }
  11079. /*------------------------------------------------------------------------*/
  11080. /**
  11081. * Casts `value` as an array if it's not one.
  11082. *
  11083. * @static
  11084. * @memberOf _
  11085. * @since 4.4.0
  11086. * @category Lang
  11087. * @param {*} value The value to inspect.
  11088. * @returns {Array} Returns the cast array.
  11089. * @example
  11090. *
  11091. * _.castArray(1);
  11092. * // => [1]
  11093. *
  11094. * _.castArray({ 'a': 1 });
  11095. * // => [{ 'a': 1 }]
  11096. *
  11097. * _.castArray('abc');
  11098. * // => ['abc']
  11099. *
  11100. * _.castArray(null);
  11101. * // => [null]
  11102. *
  11103. * _.castArray(undefined);
  11104. * // => [undefined]
  11105. *
  11106. * _.castArray();
  11107. * // => []
  11108. *
  11109. * var array = [1, 2, 3];
  11110. * console.log(_.castArray(array) === array);
  11111. * // => true
  11112. */
  11113. function castArray() {
  11114. if (!arguments.length) {
  11115. return [];
  11116. }
  11117. var value = arguments[0];
  11118. return isArray(value) ? value : [value];
  11119. }
  11120. /**
  11121. * Creates a shallow clone of `value`.
  11122. *
  11123. * **Note:** This method is loosely based on the
  11124. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  11125. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  11126. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  11127. * arrays. The own enumerable properties of `arguments` objects are cloned
  11128. * as plain objects. An empty object is returned for uncloneable values such
  11129. * as error objects, functions, DOM nodes, and WeakMaps.
  11130. *
  11131. * @static
  11132. * @memberOf _
  11133. * @since 0.1.0
  11134. * @category Lang
  11135. * @param {*} value The value to clone.
  11136. * @returns {*} Returns the cloned value.
  11137. * @see _.cloneDeep
  11138. * @example
  11139. *
  11140. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11141. *
  11142. * var shallow = _.clone(objects);
  11143. * console.log(shallow[0] === objects[0]);
  11144. * // => true
  11145. */
  11146. function clone(value) {
  11147. return baseClone(value, CLONE_SYMBOLS_FLAG);
  11148. }
  11149. /**
  11150. * This method is like `_.clone` except that it accepts `customizer` which
  11151. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  11152. * cloning is handled by the method instead. The `customizer` is invoked with
  11153. * up to four arguments; (value [, index|key, object, stack]).
  11154. *
  11155. * @static
  11156. * @memberOf _
  11157. * @since 4.0.0
  11158. * @category Lang
  11159. * @param {*} value The value to clone.
  11160. * @param {Function} [customizer] The function to customize cloning.
  11161. * @returns {*} Returns the cloned value.
  11162. * @see _.cloneDeepWith
  11163. * @example
  11164. *
  11165. * function customizer(value) {
  11166. * if (_.isElement(value)) {
  11167. * return value.cloneNode(false);
  11168. * }
  11169. * }
  11170. *
  11171. * var el = _.cloneWith(document.body, customizer);
  11172. *
  11173. * console.log(el === document.body);
  11174. * // => false
  11175. * console.log(el.nodeName);
  11176. * // => 'BODY'
  11177. * console.log(el.childNodes.length);
  11178. * // => 0
  11179. */
  11180. function cloneWith(value, customizer) {
  11181. customizer = typeof customizer == 'function' ? customizer : undefined;
  11182. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  11183. }
  11184. /**
  11185. * This method is like `_.clone` except that it recursively clones `value`.
  11186. *
  11187. * @static
  11188. * @memberOf _
  11189. * @since 1.0.0
  11190. * @category Lang
  11191. * @param {*} value The value to recursively clone.
  11192. * @returns {*} Returns the deep cloned value.
  11193. * @see _.clone
  11194. * @example
  11195. *
  11196. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11197. *
  11198. * var deep = _.cloneDeep(objects);
  11199. * console.log(deep[0] === objects[0]);
  11200. * // => false
  11201. */
  11202. function cloneDeep(value) {
  11203. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  11204. }
  11205. /**
  11206. * This method is like `_.cloneWith` except that it recursively clones `value`.
  11207. *
  11208. * @static
  11209. * @memberOf _
  11210. * @since 4.0.0
  11211. * @category Lang
  11212. * @param {*} value The value to recursively clone.
  11213. * @param {Function} [customizer] The function to customize cloning.
  11214. * @returns {*} Returns the deep cloned value.
  11215. * @see _.cloneWith
  11216. * @example
  11217. *
  11218. * function customizer(value) {
  11219. * if (_.isElement(value)) {
  11220. * return value.cloneNode(true);
  11221. * }
  11222. * }
  11223. *
  11224. * var el = _.cloneDeepWith(document.body, customizer);
  11225. *
  11226. * console.log(el === document.body);
  11227. * // => false
  11228. * console.log(el.nodeName);
  11229. * // => 'BODY'
  11230. * console.log(el.childNodes.length);
  11231. * // => 20
  11232. */
  11233. function cloneDeepWith(value, customizer) {
  11234. customizer = typeof customizer == 'function' ? customizer : undefined;
  11235. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  11236. }
  11237. /**
  11238. * Checks if `object` conforms to `source` by invoking the predicate
  11239. * properties of `source` with the corresponding property values of `object`.
  11240. *
  11241. * **Note:** This method is equivalent to `_.conforms` when `source` is
  11242. * partially applied.
  11243. *
  11244. * @static
  11245. * @memberOf _
  11246. * @since 4.14.0
  11247. * @category Lang
  11248. * @param {Object} object The object to inspect.
  11249. * @param {Object} source The object of property predicates to conform to.
  11250. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11251. * @example
  11252. *
  11253. * var object = { 'a': 1, 'b': 2 };
  11254. *
  11255. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  11256. * // => true
  11257. *
  11258. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  11259. * // => false
  11260. */
  11261. function conformsTo(object, source) {
  11262. return source == null || baseConformsTo(object, source, keys(source));
  11263. }
  11264. /**
  11265. * Performs a
  11266. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11267. * comparison between two values to determine if they are equivalent.
  11268. *
  11269. * @static
  11270. * @memberOf _
  11271. * @since 4.0.0
  11272. * @category Lang
  11273. * @param {*} value The value to compare.
  11274. * @param {*} other The other value to compare.
  11275. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11276. * @example
  11277. *
  11278. * var object = { 'a': 1 };
  11279. * var other = { 'a': 1 };
  11280. *
  11281. * _.eq(object, object);
  11282. * // => true
  11283. *
  11284. * _.eq(object, other);
  11285. * // => false
  11286. *
  11287. * _.eq('a', 'a');
  11288. * // => true
  11289. *
  11290. * _.eq('a', Object('a'));
  11291. * // => false
  11292. *
  11293. * _.eq(NaN, NaN);
  11294. * // => true
  11295. */
  11296. function eq(value, other) {
  11297. return value === other || (value !== value && other !== other);
  11298. }
  11299. /**
  11300. * Checks if `value` is greater than `other`.
  11301. *
  11302. * @static
  11303. * @memberOf _
  11304. * @since 3.9.0
  11305. * @category Lang
  11306. * @param {*} value The value to compare.
  11307. * @param {*} other The other value to compare.
  11308. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11309. * else `false`.
  11310. * @see _.lt
  11311. * @example
  11312. *
  11313. * _.gt(3, 1);
  11314. * // => true
  11315. *
  11316. * _.gt(3, 3);
  11317. * // => false
  11318. *
  11319. * _.gt(1, 3);
  11320. * // => false
  11321. */
  11322. var gt = createRelationalOperation(baseGt);
  11323. /**
  11324. * Checks if `value` is greater than or equal to `other`.
  11325. *
  11326. * @static
  11327. * @memberOf _
  11328. * @since 3.9.0
  11329. * @category Lang
  11330. * @param {*} value The value to compare.
  11331. * @param {*} other The other value to compare.
  11332. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  11333. * `other`, else `false`.
  11334. * @see _.lte
  11335. * @example
  11336. *
  11337. * _.gte(3, 1);
  11338. * // => true
  11339. *
  11340. * _.gte(3, 3);
  11341. * // => true
  11342. *
  11343. * _.gte(1, 3);
  11344. * // => false
  11345. */
  11346. var gte = createRelationalOperation(function(value, other) {
  11347. return value >= other;
  11348. });
  11349. /**
  11350. * Checks if `value` is likely an `arguments` object.
  11351. *
  11352. * @static
  11353. * @memberOf _
  11354. * @since 0.1.0
  11355. * @category Lang
  11356. * @param {*} value The value to check.
  11357. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11358. * else `false`.
  11359. * @example
  11360. *
  11361. * _.isArguments(function() { return arguments; }());
  11362. * // => true
  11363. *
  11364. * _.isArguments([1, 2, 3]);
  11365. * // => false
  11366. */
  11367. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  11368. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  11369. !propertyIsEnumerable.call(value, 'callee');
  11370. };
  11371. /**
  11372. * Checks if `value` is classified as an `Array` object.
  11373. *
  11374. * @static
  11375. * @memberOf _
  11376. * @since 0.1.0
  11377. * @category Lang
  11378. * @param {*} value The value to check.
  11379. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  11380. * @example
  11381. *
  11382. * _.isArray([1, 2, 3]);
  11383. * // => true
  11384. *
  11385. * _.isArray(document.body.children);
  11386. * // => false
  11387. *
  11388. * _.isArray('abc');
  11389. * // => false
  11390. *
  11391. * _.isArray(_.noop);
  11392. * // => false
  11393. */
  11394. var isArray = Array.isArray;
  11395. /**
  11396. * Checks if `value` is classified as an `ArrayBuffer` object.
  11397. *
  11398. * @static
  11399. * @memberOf _
  11400. * @since 4.3.0
  11401. * @category Lang
  11402. * @param {*} value The value to check.
  11403. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  11404. * @example
  11405. *
  11406. * _.isArrayBuffer(new ArrayBuffer(2));
  11407. * // => true
  11408. *
  11409. * _.isArrayBuffer(new Array(2));
  11410. * // => false
  11411. */
  11412. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  11413. /**
  11414. * Checks if `value` is array-like. A value is considered array-like if it's
  11415. * not a function and has a `value.length` that's an integer greater than or
  11416. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  11417. *
  11418. * @static
  11419. * @memberOf _
  11420. * @since 4.0.0
  11421. * @category Lang
  11422. * @param {*} value The value to check.
  11423. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  11424. * @example
  11425. *
  11426. * _.isArrayLike([1, 2, 3]);
  11427. * // => true
  11428. *
  11429. * _.isArrayLike(document.body.children);
  11430. * // => true
  11431. *
  11432. * _.isArrayLike('abc');
  11433. * // => true
  11434. *
  11435. * _.isArrayLike(_.noop);
  11436. * // => false
  11437. */
  11438. function isArrayLike(value) {
  11439. return value != null && isLength(value.length) && !isFunction(value);
  11440. }
  11441. /**
  11442. * This method is like `_.isArrayLike` except that it also checks if `value`
  11443. * is an object.
  11444. *
  11445. * @static
  11446. * @memberOf _
  11447. * @since 4.0.0
  11448. * @category Lang
  11449. * @param {*} value The value to check.
  11450. * @returns {boolean} Returns `true` if `value` is an array-like object,
  11451. * else `false`.
  11452. * @example
  11453. *
  11454. * _.isArrayLikeObject([1, 2, 3]);
  11455. * // => true
  11456. *
  11457. * _.isArrayLikeObject(document.body.children);
  11458. * // => true
  11459. *
  11460. * _.isArrayLikeObject('abc');
  11461. * // => false
  11462. *
  11463. * _.isArrayLikeObject(_.noop);
  11464. * // => false
  11465. */
  11466. function isArrayLikeObject(value) {
  11467. return isObjectLike(value) && isArrayLike(value);
  11468. }
  11469. /**
  11470. * Checks if `value` is classified as a boolean primitive or object.
  11471. *
  11472. * @static
  11473. * @memberOf _
  11474. * @since 0.1.0
  11475. * @category Lang
  11476. * @param {*} value The value to check.
  11477. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  11478. * @example
  11479. *
  11480. * _.isBoolean(false);
  11481. * // => true
  11482. *
  11483. * _.isBoolean(null);
  11484. * // => false
  11485. */
  11486. function isBoolean(value) {
  11487. return value === true || value === false ||
  11488. (isObjectLike(value) && baseGetTag(value) == boolTag);
  11489. }
  11490. /**
  11491. * Checks if `value` is a buffer.
  11492. *
  11493. * @static
  11494. * @memberOf _
  11495. * @since 4.3.0
  11496. * @category Lang
  11497. * @param {*} value The value to check.
  11498. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  11499. * @example
  11500. *
  11501. * _.isBuffer(new Buffer(2));
  11502. * // => true
  11503. *
  11504. * _.isBuffer(new Uint8Array(2));
  11505. * // => false
  11506. */
  11507. var isBuffer = nativeIsBuffer || stubFalse;
  11508. /**
  11509. * Checks if `value` is classified as a `Date` object.
  11510. *
  11511. * @static
  11512. * @memberOf _
  11513. * @since 0.1.0
  11514. * @category Lang
  11515. * @param {*} value The value to check.
  11516. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  11517. * @example
  11518. *
  11519. * _.isDate(new Date);
  11520. * // => true
  11521. *
  11522. * _.isDate('Mon April 23 2012');
  11523. * // => false
  11524. */
  11525. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  11526. /**
  11527. * Checks if `value` is likely a DOM element.
  11528. *
  11529. * @static
  11530. * @memberOf _
  11531. * @since 0.1.0
  11532. * @category Lang
  11533. * @param {*} value The value to check.
  11534. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  11535. * @example
  11536. *
  11537. * _.isElement(document.body);
  11538. * // => true
  11539. *
  11540. * _.isElement('<body>');
  11541. * // => false
  11542. */
  11543. function isElement(value) {
  11544. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  11545. }
  11546. /**
  11547. * Checks if `value` is an empty object, collection, map, or set.
  11548. *
  11549. * Objects are considered empty if they have no own enumerable string keyed
  11550. * properties.
  11551. *
  11552. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  11553. * jQuery-like collections are considered empty if they have a `length` of `0`.
  11554. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  11555. *
  11556. * @static
  11557. * @memberOf _
  11558. * @since 0.1.0
  11559. * @category Lang
  11560. * @param {*} value The value to check.
  11561. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  11562. * @example
  11563. *
  11564. * _.isEmpty(null);
  11565. * // => true
  11566. *
  11567. * _.isEmpty(true);
  11568. * // => true
  11569. *
  11570. * _.isEmpty(1);
  11571. * // => true
  11572. *
  11573. * _.isEmpty([1, 2, 3]);
  11574. * // => false
  11575. *
  11576. * _.isEmpty({ 'a': 1 });
  11577. * // => false
  11578. */
  11579. function isEmpty(value) {
  11580. if (value == null) {
  11581. return true;
  11582. }
  11583. if (isArrayLike(value) &&
  11584. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  11585. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  11586. return !value.length;
  11587. }
  11588. var tag = getTag(value);
  11589. if (tag == mapTag || tag == setTag) {
  11590. return !value.size;
  11591. }
  11592. if (isPrototype(value)) {
  11593. return !baseKeys(value).length;
  11594. }
  11595. for (var key in value) {
  11596. if (hasOwnProperty.call(value, key)) {
  11597. return false;
  11598. }
  11599. }
  11600. return true;
  11601. }
  11602. /**
  11603. * Performs a deep comparison between two values to determine if they are
  11604. * equivalent.
  11605. *
  11606. * **Note:** This method supports comparing arrays, array buffers, booleans,
  11607. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  11608. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  11609. * by their own, not inherited, enumerable properties. Functions and DOM
  11610. * nodes are compared by strict equality, i.e. `===`.
  11611. *
  11612. * @static
  11613. * @memberOf _
  11614. * @since 0.1.0
  11615. * @category Lang
  11616. * @param {*} value The value to compare.
  11617. * @param {*} other The other value to compare.
  11618. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11619. * @example
  11620. *
  11621. * var object = { 'a': 1 };
  11622. * var other = { 'a': 1 };
  11623. *
  11624. * _.isEqual(object, other);
  11625. * // => true
  11626. *
  11627. * object === other;
  11628. * // => false
  11629. */
  11630. function isEqual(value, other) {
  11631. return baseIsEqual(value, other);
  11632. }
  11633. /**
  11634. * This method is like `_.isEqual` except that it accepts `customizer` which
  11635. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11636. * are handled by the method instead. The `customizer` is invoked with up to
  11637. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  11638. *
  11639. * @static
  11640. * @memberOf _
  11641. * @since 4.0.0
  11642. * @category Lang
  11643. * @param {*} value The value to compare.
  11644. * @param {*} other The other value to compare.
  11645. * @param {Function} [customizer] The function to customize comparisons.
  11646. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11647. * @example
  11648. *
  11649. * function isGreeting(value) {
  11650. * return /^h(?:i|ello)$/.test(value);
  11651. * }
  11652. *
  11653. * function customizer(objValue, othValue) {
  11654. * if (isGreeting(objValue) && isGreeting(othValue)) {
  11655. * return true;
  11656. * }
  11657. * }
  11658. *
  11659. * var array = ['hello', 'goodbye'];
  11660. * var other = ['hi', 'goodbye'];
  11661. *
  11662. * _.isEqualWith(array, other, customizer);
  11663. * // => true
  11664. */
  11665. function isEqualWith(value, other, customizer) {
  11666. customizer = typeof customizer == 'function' ? customizer : undefined;
  11667. var result = customizer ? customizer(value, other) : undefined;
  11668. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  11669. }
  11670. /**
  11671. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  11672. * `SyntaxError`, `TypeError`, or `URIError` object.
  11673. *
  11674. * @static
  11675. * @memberOf _
  11676. * @since 3.0.0
  11677. * @category Lang
  11678. * @param {*} value The value to check.
  11679. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  11680. * @example
  11681. *
  11682. * _.isError(new Error);
  11683. * // => true
  11684. *
  11685. * _.isError(Error);
  11686. * // => false
  11687. */
  11688. function isError(value) {
  11689. if (!isObjectLike(value)) {
  11690. return false;
  11691. }
  11692. var tag = baseGetTag(value);
  11693. return tag == errorTag || tag == domExcTag ||
  11694. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  11695. }
  11696. /**
  11697. * Checks if `value` is a finite primitive number.
  11698. *
  11699. * **Note:** This method is based on
  11700. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  11701. *
  11702. * @static
  11703. * @memberOf _
  11704. * @since 0.1.0
  11705. * @category Lang
  11706. * @param {*} value The value to check.
  11707. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  11708. * @example
  11709. *
  11710. * _.isFinite(3);
  11711. * // => true
  11712. *
  11713. * _.isFinite(Number.MIN_VALUE);
  11714. * // => true
  11715. *
  11716. * _.isFinite(Infinity);
  11717. * // => false
  11718. *
  11719. * _.isFinite('3');
  11720. * // => false
  11721. */
  11722. function isFinite(value) {
  11723. return typeof value == 'number' && nativeIsFinite(value);
  11724. }
  11725. /**
  11726. * Checks if `value` is classified as a `Function` object.
  11727. *
  11728. * @static
  11729. * @memberOf _
  11730. * @since 0.1.0
  11731. * @category Lang
  11732. * @param {*} value The value to check.
  11733. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  11734. * @example
  11735. *
  11736. * _.isFunction(_);
  11737. * // => true
  11738. *
  11739. * _.isFunction(/abc/);
  11740. * // => false
  11741. */
  11742. function isFunction(value) {
  11743. if (!isObject(value)) {
  11744. return false;
  11745. }
  11746. // The use of `Object#toString` avoids issues with the `typeof` operator
  11747. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  11748. var tag = baseGetTag(value);
  11749. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  11750. }
  11751. /**
  11752. * Checks if `value` is an integer.
  11753. *
  11754. * **Note:** This method is based on
  11755. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  11756. *
  11757. * @static
  11758. * @memberOf _
  11759. * @since 4.0.0
  11760. * @category Lang
  11761. * @param {*} value The value to check.
  11762. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  11763. * @example
  11764. *
  11765. * _.isInteger(3);
  11766. * // => true
  11767. *
  11768. * _.isInteger(Number.MIN_VALUE);
  11769. * // => false
  11770. *
  11771. * _.isInteger(Infinity);
  11772. * // => false
  11773. *
  11774. * _.isInteger('3');
  11775. * // => false
  11776. */
  11777. function isInteger(value) {
  11778. return typeof value == 'number' && value == toInteger(value);
  11779. }
  11780. /**
  11781. * Checks if `value` is a valid array-like length.
  11782. *
  11783. * **Note:** This method is loosely based on
  11784. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  11785. *
  11786. * @static
  11787. * @memberOf _
  11788. * @since 4.0.0
  11789. * @category Lang
  11790. * @param {*} value The value to check.
  11791. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  11792. * @example
  11793. *
  11794. * _.isLength(3);
  11795. * // => true
  11796. *
  11797. * _.isLength(Number.MIN_VALUE);
  11798. * // => false
  11799. *
  11800. * _.isLength(Infinity);
  11801. * // => false
  11802. *
  11803. * _.isLength('3');
  11804. * // => false
  11805. */
  11806. function isLength(value) {
  11807. return typeof value == 'number' &&
  11808. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  11809. }
  11810. /**
  11811. * Checks if `value` is the
  11812. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  11813. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  11814. *
  11815. * @static
  11816. * @memberOf _
  11817. * @since 0.1.0
  11818. * @category Lang
  11819. * @param {*} value The value to check.
  11820. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  11821. * @example
  11822. *
  11823. * _.isObject({});
  11824. * // => true
  11825. *
  11826. * _.isObject([1, 2, 3]);
  11827. * // => true
  11828. *
  11829. * _.isObject(_.noop);
  11830. * // => true
  11831. *
  11832. * _.isObject(null);
  11833. * // => false
  11834. */
  11835. function isObject(value) {
  11836. var type = typeof value;
  11837. return value != null && (type == 'object' || type == 'function');
  11838. }
  11839. /**
  11840. * Checks if `value` is object-like. A value is object-like if it's not `null`
  11841. * and has a `typeof` result of "object".
  11842. *
  11843. * @static
  11844. * @memberOf _
  11845. * @since 4.0.0
  11846. * @category Lang
  11847. * @param {*} value The value to check.
  11848. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  11849. * @example
  11850. *
  11851. * _.isObjectLike({});
  11852. * // => true
  11853. *
  11854. * _.isObjectLike([1, 2, 3]);
  11855. * // => true
  11856. *
  11857. * _.isObjectLike(_.noop);
  11858. * // => false
  11859. *
  11860. * _.isObjectLike(null);
  11861. * // => false
  11862. */
  11863. function isObjectLike(value) {
  11864. return value != null && typeof value == 'object';
  11865. }
  11866. /**
  11867. * Checks if `value` is classified as a `Map` object.
  11868. *
  11869. * @static
  11870. * @memberOf _
  11871. * @since 4.3.0
  11872. * @category Lang
  11873. * @param {*} value The value to check.
  11874. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  11875. * @example
  11876. *
  11877. * _.isMap(new Map);
  11878. * // => true
  11879. *
  11880. * _.isMap(new WeakMap);
  11881. * // => false
  11882. */
  11883. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  11884. /**
  11885. * Performs a partial deep comparison between `object` and `source` to
  11886. * determine if `object` contains equivalent property values.
  11887. *
  11888. * **Note:** This method is equivalent to `_.matches` when `source` is
  11889. * partially applied.
  11890. *
  11891. * Partial comparisons will match empty array and empty object `source`
  11892. * values against any array or object value, respectively. See `_.isEqual`
  11893. * for a list of supported value comparisons.
  11894. *
  11895. * @static
  11896. * @memberOf _
  11897. * @since 3.0.0
  11898. * @category Lang
  11899. * @param {Object} object The object to inspect.
  11900. * @param {Object} source The object of property values to match.
  11901. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11902. * @example
  11903. *
  11904. * var object = { 'a': 1, 'b': 2 };
  11905. *
  11906. * _.isMatch(object, { 'b': 2 });
  11907. * // => true
  11908. *
  11909. * _.isMatch(object, { 'b': 1 });
  11910. * // => false
  11911. */
  11912. function isMatch(object, source) {
  11913. return object === source || baseIsMatch(object, source, getMatchData(source));
  11914. }
  11915. /**
  11916. * This method is like `_.isMatch` except that it accepts `customizer` which
  11917. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11918. * are handled by the method instead. The `customizer` is invoked with five
  11919. * arguments: (objValue, srcValue, index|key, object, source).
  11920. *
  11921. * @static
  11922. * @memberOf _
  11923. * @since 4.0.0
  11924. * @category Lang
  11925. * @param {Object} object The object to inspect.
  11926. * @param {Object} source The object of property values to match.
  11927. * @param {Function} [customizer] The function to customize comparisons.
  11928. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11929. * @example
  11930. *
  11931. * function isGreeting(value) {
  11932. * return /^h(?:i|ello)$/.test(value);
  11933. * }
  11934. *
  11935. * function customizer(objValue, srcValue) {
  11936. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  11937. * return true;
  11938. * }
  11939. * }
  11940. *
  11941. * var object = { 'greeting': 'hello' };
  11942. * var source = { 'greeting': 'hi' };
  11943. *
  11944. * _.isMatchWith(object, source, customizer);
  11945. * // => true
  11946. */
  11947. function isMatchWith(object, source, customizer) {
  11948. customizer = typeof customizer == 'function' ? customizer : undefined;
  11949. return baseIsMatch(object, source, getMatchData(source), customizer);
  11950. }
  11951. /**
  11952. * Checks if `value` is `NaN`.
  11953. *
  11954. * **Note:** This method is based on
  11955. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  11956. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  11957. * `undefined` and other non-number values.
  11958. *
  11959. * @static
  11960. * @memberOf _
  11961. * @since 0.1.0
  11962. * @category Lang
  11963. * @param {*} value The value to check.
  11964. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  11965. * @example
  11966. *
  11967. * _.isNaN(NaN);
  11968. * // => true
  11969. *
  11970. * _.isNaN(new Number(NaN));
  11971. * // => true
  11972. *
  11973. * isNaN(undefined);
  11974. * // => true
  11975. *
  11976. * _.isNaN(undefined);
  11977. * // => false
  11978. */
  11979. function isNaN(value) {
  11980. // An `NaN` primitive is the only value that is not equal to itself.
  11981. // Perform the `toStringTag` check first to avoid errors with some
  11982. // ActiveX objects in IE.
  11983. return isNumber(value) && value != +value;
  11984. }
  11985. /**
  11986. * Checks if `value` is a pristine native function.
  11987. *
  11988. * **Note:** This method can't reliably detect native functions in the presence
  11989. * of the core-js package because core-js circumvents this kind of detection.
  11990. * Despite multiple requests, the core-js maintainer has made it clear: any
  11991. * attempt to fix the detection will be obstructed. As a result, we're left
  11992. * with little choice but to throw an error. Unfortunately, this also affects
  11993. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  11994. * which rely on core-js.
  11995. *
  11996. * @static
  11997. * @memberOf _
  11998. * @since 3.0.0
  11999. * @category Lang
  12000. * @param {*} value The value to check.
  12001. * @returns {boolean} Returns `true` if `value` is a native function,
  12002. * else `false`.
  12003. * @example
  12004. *
  12005. * _.isNative(Array.prototype.push);
  12006. * // => true
  12007. *
  12008. * _.isNative(_);
  12009. * // => false
  12010. */
  12011. function isNative(value) {
  12012. if (isMaskable(value)) {
  12013. throw new Error(CORE_ERROR_TEXT);
  12014. }
  12015. return baseIsNative(value);
  12016. }
  12017. /**
  12018. * Checks if `value` is `null`.
  12019. *
  12020. * @static
  12021. * @memberOf _
  12022. * @since 0.1.0
  12023. * @category Lang
  12024. * @param {*} value The value to check.
  12025. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  12026. * @example
  12027. *
  12028. * _.isNull(null);
  12029. * // => true
  12030. *
  12031. * _.isNull(void 0);
  12032. * // => false
  12033. */
  12034. function isNull(value) {
  12035. return value === null;
  12036. }
  12037. /**
  12038. * Checks if `value` is `null` or `undefined`.
  12039. *
  12040. * @static
  12041. * @memberOf _
  12042. * @since 4.0.0
  12043. * @category Lang
  12044. * @param {*} value The value to check.
  12045. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  12046. * @example
  12047. *
  12048. * _.isNil(null);
  12049. * // => true
  12050. *
  12051. * _.isNil(void 0);
  12052. * // => true
  12053. *
  12054. * _.isNil(NaN);
  12055. * // => false
  12056. */
  12057. function isNil(value) {
  12058. return value == null;
  12059. }
  12060. /**
  12061. * Checks if `value` is classified as a `Number` primitive or object.
  12062. *
  12063. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  12064. * classified as numbers, use the `_.isFinite` method.
  12065. *
  12066. * @static
  12067. * @memberOf _
  12068. * @since 0.1.0
  12069. * @category Lang
  12070. * @param {*} value The value to check.
  12071. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  12072. * @example
  12073. *
  12074. * _.isNumber(3);
  12075. * // => true
  12076. *
  12077. * _.isNumber(Number.MIN_VALUE);
  12078. * // => true
  12079. *
  12080. * _.isNumber(Infinity);
  12081. * // => true
  12082. *
  12083. * _.isNumber('3');
  12084. * // => false
  12085. */
  12086. function isNumber(value) {
  12087. return typeof value == 'number' ||
  12088. (isObjectLike(value) && baseGetTag(value) == numberTag);
  12089. }
  12090. /**
  12091. * Checks if `value` is a plain object, that is, an object created by the
  12092. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  12093. *
  12094. * @static
  12095. * @memberOf _
  12096. * @since 0.8.0
  12097. * @category Lang
  12098. * @param {*} value The value to check.
  12099. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  12100. * @example
  12101. *
  12102. * function Foo() {
  12103. * this.a = 1;
  12104. * }
  12105. *
  12106. * _.isPlainObject(new Foo);
  12107. * // => false
  12108. *
  12109. * _.isPlainObject([1, 2, 3]);
  12110. * // => false
  12111. *
  12112. * _.isPlainObject({ 'x': 0, 'y': 0 });
  12113. * // => true
  12114. *
  12115. * _.isPlainObject(Object.create(null));
  12116. * // => true
  12117. */
  12118. function isPlainObject(value) {
  12119. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  12120. return false;
  12121. }
  12122. var proto = getPrototype(value);
  12123. if (proto === null) {
  12124. return true;
  12125. }
  12126. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  12127. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  12128. funcToString.call(Ctor) == objectCtorString;
  12129. }
  12130. /**
  12131. * Checks if `value` is classified as a `RegExp` object.
  12132. *
  12133. * @static
  12134. * @memberOf _
  12135. * @since 0.1.0
  12136. * @category Lang
  12137. * @param {*} value The value to check.
  12138. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12139. * @example
  12140. *
  12141. * _.isRegExp(/abc/);
  12142. * // => true
  12143. *
  12144. * _.isRegExp('/abc/');
  12145. * // => false
  12146. */
  12147. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  12148. /**
  12149. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  12150. * double precision number which isn't the result of a rounded unsafe integer.
  12151. *
  12152. * **Note:** This method is based on
  12153. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  12154. *
  12155. * @static
  12156. * @memberOf _
  12157. * @since 4.0.0
  12158. * @category Lang
  12159. * @param {*} value The value to check.
  12160. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  12161. * @example
  12162. *
  12163. * _.isSafeInteger(3);
  12164. * // => true
  12165. *
  12166. * _.isSafeInteger(Number.MIN_VALUE);
  12167. * // => false
  12168. *
  12169. * _.isSafeInteger(Infinity);
  12170. * // => false
  12171. *
  12172. * _.isSafeInteger('3');
  12173. * // => false
  12174. */
  12175. function isSafeInteger(value) {
  12176. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  12177. }
  12178. /**
  12179. * Checks if `value` is classified as a `Set` object.
  12180. *
  12181. * @static
  12182. * @memberOf _
  12183. * @since 4.3.0
  12184. * @category Lang
  12185. * @param {*} value The value to check.
  12186. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12187. * @example
  12188. *
  12189. * _.isSet(new Set);
  12190. * // => true
  12191. *
  12192. * _.isSet(new WeakSet);
  12193. * // => false
  12194. */
  12195. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  12196. /**
  12197. * Checks if `value` is classified as a `String` primitive or object.
  12198. *
  12199. * @static
  12200. * @since 0.1.0
  12201. * @memberOf _
  12202. * @category Lang
  12203. * @param {*} value The value to check.
  12204. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  12205. * @example
  12206. *
  12207. * _.isString('abc');
  12208. * // => true
  12209. *
  12210. * _.isString(1);
  12211. * // => false
  12212. */
  12213. function isString(value) {
  12214. return typeof value == 'string' ||
  12215. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  12216. }
  12217. /**
  12218. * Checks if `value` is classified as a `Symbol` primitive or object.
  12219. *
  12220. * @static
  12221. * @memberOf _
  12222. * @since 4.0.0
  12223. * @category Lang
  12224. * @param {*} value The value to check.
  12225. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12226. * @example
  12227. *
  12228. * _.isSymbol(Symbol.iterator);
  12229. * // => true
  12230. *
  12231. * _.isSymbol('abc');
  12232. * // => false
  12233. */
  12234. function isSymbol(value) {
  12235. return typeof value == 'symbol' ||
  12236. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  12237. }
  12238. /**
  12239. * Checks if `value` is classified as a typed array.
  12240. *
  12241. * @static
  12242. * @memberOf _
  12243. * @since 3.0.0
  12244. * @category Lang
  12245. * @param {*} value The value to check.
  12246. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12247. * @example
  12248. *
  12249. * _.isTypedArray(new Uint8Array);
  12250. * // => true
  12251. *
  12252. * _.isTypedArray([]);
  12253. * // => false
  12254. */
  12255. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  12256. /**
  12257. * Checks if `value` is `undefined`.
  12258. *
  12259. * @static
  12260. * @since 0.1.0
  12261. * @memberOf _
  12262. * @category Lang
  12263. * @param {*} value The value to check.
  12264. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  12265. * @example
  12266. *
  12267. * _.isUndefined(void 0);
  12268. * // => true
  12269. *
  12270. * _.isUndefined(null);
  12271. * // => false
  12272. */
  12273. function isUndefined(value) {
  12274. return value === undefined;
  12275. }
  12276. /**
  12277. * Checks if `value` is classified as a `WeakMap` object.
  12278. *
  12279. * @static
  12280. * @memberOf _
  12281. * @since 4.3.0
  12282. * @category Lang
  12283. * @param {*} value The value to check.
  12284. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  12285. * @example
  12286. *
  12287. * _.isWeakMap(new WeakMap);
  12288. * // => true
  12289. *
  12290. * _.isWeakMap(new Map);
  12291. * // => false
  12292. */
  12293. function isWeakMap(value) {
  12294. return isObjectLike(value) && getTag(value) == weakMapTag;
  12295. }
  12296. /**
  12297. * Checks if `value` is classified as a `WeakSet` object.
  12298. *
  12299. * @static
  12300. * @memberOf _
  12301. * @since 4.3.0
  12302. * @category Lang
  12303. * @param {*} value The value to check.
  12304. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  12305. * @example
  12306. *
  12307. * _.isWeakSet(new WeakSet);
  12308. * // => true
  12309. *
  12310. * _.isWeakSet(new Set);
  12311. * // => false
  12312. */
  12313. function isWeakSet(value) {
  12314. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  12315. }
  12316. /**
  12317. * Checks if `value` is less than `other`.
  12318. *
  12319. * @static
  12320. * @memberOf _
  12321. * @since 3.9.0
  12322. * @category Lang
  12323. * @param {*} value The value to compare.
  12324. * @param {*} other The other value to compare.
  12325. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12326. * else `false`.
  12327. * @see _.gt
  12328. * @example
  12329. *
  12330. * _.lt(1, 3);
  12331. * // => true
  12332. *
  12333. * _.lt(3, 3);
  12334. * // => false
  12335. *
  12336. * _.lt(3, 1);
  12337. * // => false
  12338. */
  12339. var lt = createRelationalOperation(baseLt);
  12340. /**
  12341. * Checks if `value` is less than or equal to `other`.
  12342. *
  12343. * @static
  12344. * @memberOf _
  12345. * @since 3.9.0
  12346. * @category Lang
  12347. * @param {*} value The value to compare.
  12348. * @param {*} other The other value to compare.
  12349. * @returns {boolean} Returns `true` if `value` is less than or equal to
  12350. * `other`, else `false`.
  12351. * @see _.gte
  12352. * @example
  12353. *
  12354. * _.lte(1, 3);
  12355. * // => true
  12356. *
  12357. * _.lte(3, 3);
  12358. * // => true
  12359. *
  12360. * _.lte(3, 1);
  12361. * // => false
  12362. */
  12363. var lte = createRelationalOperation(function(value, other) {
  12364. return value <= other;
  12365. });
  12366. /**
  12367. * Converts `value` to an array.
  12368. *
  12369. * @static
  12370. * @since 0.1.0
  12371. * @memberOf _
  12372. * @category Lang
  12373. * @param {*} value The value to convert.
  12374. * @returns {Array} Returns the converted array.
  12375. * @example
  12376. *
  12377. * _.toArray({ 'a': 1, 'b': 2 });
  12378. * // => [1, 2]
  12379. *
  12380. * _.toArray('abc');
  12381. * // => ['a', 'b', 'c']
  12382. *
  12383. * _.toArray(1);
  12384. * // => []
  12385. *
  12386. * _.toArray(null);
  12387. * // => []
  12388. */
  12389. function toArray(value) {
  12390. if (!value) {
  12391. return [];
  12392. }
  12393. if (isArrayLike(value)) {
  12394. return isString(value) ? stringToArray(value) : copyArray(value);
  12395. }
  12396. if (symIterator && value[symIterator]) {
  12397. return iteratorToArray(value[symIterator]());
  12398. }
  12399. var tag = getTag(value),
  12400. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  12401. return func(value);
  12402. }
  12403. /**
  12404. * Converts `value` to a finite number.
  12405. *
  12406. * @static
  12407. * @memberOf _
  12408. * @since 4.12.0
  12409. * @category Lang
  12410. * @param {*} value The value to convert.
  12411. * @returns {number} Returns the converted number.
  12412. * @example
  12413. *
  12414. * _.toFinite(3.2);
  12415. * // => 3.2
  12416. *
  12417. * _.toFinite(Number.MIN_VALUE);
  12418. * // => 5e-324
  12419. *
  12420. * _.toFinite(Infinity);
  12421. * // => 1.7976931348623157e+308
  12422. *
  12423. * _.toFinite('3.2');
  12424. * // => 3.2
  12425. */
  12426. function toFinite(value) {
  12427. if (!value) {
  12428. return value === 0 ? value : 0;
  12429. }
  12430. value = toNumber(value);
  12431. if (value === INFINITY || value === -INFINITY) {
  12432. var sign = (value < 0 ? -1 : 1);
  12433. return sign * MAX_INTEGER;
  12434. }
  12435. return value === value ? value : 0;
  12436. }
  12437. /**
  12438. * Converts `value` to an integer.
  12439. *
  12440. * **Note:** This method is loosely based on
  12441. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  12442. *
  12443. * @static
  12444. * @memberOf _
  12445. * @since 4.0.0
  12446. * @category Lang
  12447. * @param {*} value The value to convert.
  12448. * @returns {number} Returns the converted integer.
  12449. * @example
  12450. *
  12451. * _.toInteger(3.2);
  12452. * // => 3
  12453. *
  12454. * _.toInteger(Number.MIN_VALUE);
  12455. * // => 0
  12456. *
  12457. * _.toInteger(Infinity);
  12458. * // => 1.7976931348623157e+308
  12459. *
  12460. * _.toInteger('3.2');
  12461. * // => 3
  12462. */
  12463. function toInteger(value) {
  12464. var result = toFinite(value),
  12465. remainder = result % 1;
  12466. return result === result ? (remainder ? result - remainder : result) : 0;
  12467. }
  12468. /**
  12469. * Converts `value` to an integer suitable for use as the length of an
  12470. * array-like object.
  12471. *
  12472. * **Note:** This method is based on
  12473. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12474. *
  12475. * @static
  12476. * @memberOf _
  12477. * @since 4.0.0
  12478. * @category Lang
  12479. * @param {*} value The value to convert.
  12480. * @returns {number} Returns the converted integer.
  12481. * @example
  12482. *
  12483. * _.toLength(3.2);
  12484. * // => 3
  12485. *
  12486. * _.toLength(Number.MIN_VALUE);
  12487. * // => 0
  12488. *
  12489. * _.toLength(Infinity);
  12490. * // => 4294967295
  12491. *
  12492. * _.toLength('3.2');
  12493. * // => 3
  12494. */
  12495. function toLength(value) {
  12496. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  12497. }
  12498. /**
  12499. * Converts `value` to a number.
  12500. *
  12501. * @static
  12502. * @memberOf _
  12503. * @since 4.0.0
  12504. * @category Lang
  12505. * @param {*} value The value to process.
  12506. * @returns {number} Returns the number.
  12507. * @example
  12508. *
  12509. * _.toNumber(3.2);
  12510. * // => 3.2
  12511. *
  12512. * _.toNumber(Number.MIN_VALUE);
  12513. * // => 5e-324
  12514. *
  12515. * _.toNumber(Infinity);
  12516. * // => Infinity
  12517. *
  12518. * _.toNumber('3.2');
  12519. * // => 3.2
  12520. */
  12521. function toNumber(value) {
  12522. if (typeof value == 'number') {
  12523. return value;
  12524. }
  12525. if (isSymbol(value)) {
  12526. return NAN;
  12527. }
  12528. if (isObject(value)) {
  12529. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  12530. value = isObject(other) ? (other + '') : other;
  12531. }
  12532. if (typeof value != 'string') {
  12533. return value === 0 ? value : +value;
  12534. }
  12535. value = value.replace(reTrim, '');
  12536. var isBinary = reIsBinary.test(value);
  12537. return (isBinary || reIsOctal.test(value))
  12538. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  12539. : (reIsBadHex.test(value) ? NAN : +value);
  12540. }
  12541. /**
  12542. * Converts `value` to a plain object flattening inherited enumerable string
  12543. * keyed properties of `value` to own properties of the plain object.
  12544. *
  12545. * @static
  12546. * @memberOf _
  12547. * @since 3.0.0
  12548. * @category Lang
  12549. * @param {*} value The value to convert.
  12550. * @returns {Object} Returns the converted plain object.
  12551. * @example
  12552. *
  12553. * function Foo() {
  12554. * this.b = 2;
  12555. * }
  12556. *
  12557. * Foo.prototype.c = 3;
  12558. *
  12559. * _.assign({ 'a': 1 }, new Foo);
  12560. * // => { 'a': 1, 'b': 2 }
  12561. *
  12562. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  12563. * // => { 'a': 1, 'b': 2, 'c': 3 }
  12564. */
  12565. function toPlainObject(value) {
  12566. return copyObject(value, keysIn(value));
  12567. }
  12568. /**
  12569. * Converts `value` to a safe integer. A safe integer can be compared and
  12570. * represented correctly.
  12571. *
  12572. * @static
  12573. * @memberOf _
  12574. * @since 4.0.0
  12575. * @category Lang
  12576. * @param {*} value The value to convert.
  12577. * @returns {number} Returns the converted integer.
  12578. * @example
  12579. *
  12580. * _.toSafeInteger(3.2);
  12581. * // => 3
  12582. *
  12583. * _.toSafeInteger(Number.MIN_VALUE);
  12584. * // => 0
  12585. *
  12586. * _.toSafeInteger(Infinity);
  12587. * // => 9007199254740991
  12588. *
  12589. * _.toSafeInteger('3.2');
  12590. * // => 3
  12591. */
  12592. function toSafeInteger(value) {
  12593. return value
  12594. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  12595. : (value === 0 ? value : 0);
  12596. }
  12597. /**
  12598. * Converts `value` to a string. An empty string is returned for `null`
  12599. * and `undefined` values. The sign of `-0` is preserved.
  12600. *
  12601. * @static
  12602. * @memberOf _
  12603. * @since 4.0.0
  12604. * @category Lang
  12605. * @param {*} value The value to convert.
  12606. * @returns {string} Returns the converted string.
  12607. * @example
  12608. *
  12609. * _.toString(null);
  12610. * // => ''
  12611. *
  12612. * _.toString(-0);
  12613. * // => '-0'
  12614. *
  12615. * _.toString([1, 2, 3]);
  12616. * // => '1,2,3'
  12617. */
  12618. function toString(value) {
  12619. return value == null ? '' : baseToString(value);
  12620. }
  12621. /*------------------------------------------------------------------------*/
  12622. /**
  12623. * Assigns own enumerable string keyed properties of source objects to the
  12624. * destination object. Source objects are applied from left to right.
  12625. * Subsequent sources overwrite property assignments of previous sources.
  12626. *
  12627. * **Note:** This method mutates `object` and is loosely based on
  12628. * [`Object.assign`](https://mdn.io/Object/assign).
  12629. *
  12630. * @static
  12631. * @memberOf _
  12632. * @since 0.10.0
  12633. * @category Object
  12634. * @param {Object} object The destination object.
  12635. * @param {...Object} [sources] The source objects.
  12636. * @returns {Object} Returns `object`.
  12637. * @see _.assignIn
  12638. * @example
  12639. *
  12640. * function Foo() {
  12641. * this.a = 1;
  12642. * }
  12643. *
  12644. * function Bar() {
  12645. * this.c = 3;
  12646. * }
  12647. *
  12648. * Foo.prototype.b = 2;
  12649. * Bar.prototype.d = 4;
  12650. *
  12651. * _.assign({ 'a': 0 }, new Foo, new Bar);
  12652. * // => { 'a': 1, 'c': 3 }
  12653. */
  12654. var assign = createAssigner(function(object, source) {
  12655. if (isPrototype(source) || isArrayLike(source)) {
  12656. copyObject(source, keys(source), object);
  12657. return;
  12658. }
  12659. for (var key in source) {
  12660. if (hasOwnProperty.call(source, key)) {
  12661. assignValue(object, key, source[key]);
  12662. }
  12663. }
  12664. });
  12665. /**
  12666. * This method is like `_.assign` except that it iterates over own and
  12667. * inherited source properties.
  12668. *
  12669. * **Note:** This method mutates `object`.
  12670. *
  12671. * @static
  12672. * @memberOf _
  12673. * @since 4.0.0
  12674. * @alias extend
  12675. * @category Object
  12676. * @param {Object} object The destination object.
  12677. * @param {...Object} [sources] The source objects.
  12678. * @returns {Object} Returns `object`.
  12679. * @see _.assign
  12680. * @example
  12681. *
  12682. * function Foo() {
  12683. * this.a = 1;
  12684. * }
  12685. *
  12686. * function Bar() {
  12687. * this.c = 3;
  12688. * }
  12689. *
  12690. * Foo.prototype.b = 2;
  12691. * Bar.prototype.d = 4;
  12692. *
  12693. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  12694. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  12695. */
  12696. var assignIn = createAssigner(function(object, source) {
  12697. copyObject(source, keysIn(source), object);
  12698. });
  12699. /**
  12700. * This method is like `_.assignIn` except that it accepts `customizer`
  12701. * which is invoked to produce the assigned values. If `customizer` returns
  12702. * `undefined`, assignment is handled by the method instead. The `customizer`
  12703. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12704. *
  12705. * **Note:** This method mutates `object`.
  12706. *
  12707. * @static
  12708. * @memberOf _
  12709. * @since 4.0.0
  12710. * @alias extendWith
  12711. * @category Object
  12712. * @param {Object} object The destination object.
  12713. * @param {...Object} sources The source objects.
  12714. * @param {Function} [customizer] The function to customize assigned values.
  12715. * @returns {Object} Returns `object`.
  12716. * @see _.assignWith
  12717. * @example
  12718. *
  12719. * function customizer(objValue, srcValue) {
  12720. * return _.isUndefined(objValue) ? srcValue : objValue;
  12721. * }
  12722. *
  12723. * var defaults = _.partialRight(_.assignInWith, customizer);
  12724. *
  12725. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12726. * // => { 'a': 1, 'b': 2 }
  12727. */
  12728. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  12729. copyObject(source, keysIn(source), object, customizer);
  12730. });
  12731. /**
  12732. * This method is like `_.assign` except that it accepts `customizer`
  12733. * which is invoked to produce the assigned values. If `customizer` returns
  12734. * `undefined`, assignment is handled by the method instead. The `customizer`
  12735. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12736. *
  12737. * **Note:** This method mutates `object`.
  12738. *
  12739. * @static
  12740. * @memberOf _
  12741. * @since 4.0.0
  12742. * @category Object
  12743. * @param {Object} object The destination object.
  12744. * @param {...Object} sources The source objects.
  12745. * @param {Function} [customizer] The function to customize assigned values.
  12746. * @returns {Object} Returns `object`.
  12747. * @see _.assignInWith
  12748. * @example
  12749. *
  12750. * function customizer(objValue, srcValue) {
  12751. * return _.isUndefined(objValue) ? srcValue : objValue;
  12752. * }
  12753. *
  12754. * var defaults = _.partialRight(_.assignWith, customizer);
  12755. *
  12756. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12757. * // => { 'a': 1, 'b': 2 }
  12758. */
  12759. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  12760. copyObject(source, keys(source), object, customizer);
  12761. });
  12762. /**
  12763. * Creates an array of values corresponding to `paths` of `object`.
  12764. *
  12765. * @static
  12766. * @memberOf _
  12767. * @since 1.0.0
  12768. * @category Object
  12769. * @param {Object} object The object to iterate over.
  12770. * @param {...(string|string[])} [paths] The property paths to pick.
  12771. * @returns {Array} Returns the picked values.
  12772. * @example
  12773. *
  12774. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  12775. *
  12776. * _.at(object, ['a[0].b.c', 'a[1]']);
  12777. * // => [3, 4]
  12778. */
  12779. var at = flatRest(baseAt);
  12780. /**
  12781. * Creates an object that inherits from the `prototype` object. If a
  12782. * `properties` object is given, its own enumerable string keyed properties
  12783. * are assigned to the created object.
  12784. *
  12785. * @static
  12786. * @memberOf _
  12787. * @since 2.3.0
  12788. * @category Object
  12789. * @param {Object} prototype The object to inherit from.
  12790. * @param {Object} [properties] The properties to assign to the object.
  12791. * @returns {Object} Returns the new object.
  12792. * @example
  12793. *
  12794. * function Shape() {
  12795. * this.x = 0;
  12796. * this.y = 0;
  12797. * }
  12798. *
  12799. * function Circle() {
  12800. * Shape.call(this);
  12801. * }
  12802. *
  12803. * Circle.prototype = _.create(Shape.prototype, {
  12804. * 'constructor': Circle
  12805. * });
  12806. *
  12807. * var circle = new Circle;
  12808. * circle instanceof Circle;
  12809. * // => true
  12810. *
  12811. * circle instanceof Shape;
  12812. * // => true
  12813. */
  12814. function create(prototype, properties) {
  12815. var result = baseCreate(prototype);
  12816. return properties == null ? result : baseAssign(result, properties);
  12817. }
  12818. /**
  12819. * Assigns own and inherited enumerable string keyed properties of source
  12820. * objects to the destination object for all destination properties that
  12821. * resolve to `undefined`. Source objects are applied from left to right.
  12822. * Once a property is set, additional values of the same property are ignored.
  12823. *
  12824. * **Note:** This method mutates `object`.
  12825. *
  12826. * @static
  12827. * @since 0.1.0
  12828. * @memberOf _
  12829. * @category Object
  12830. * @param {Object} object The destination object.
  12831. * @param {...Object} [sources] The source objects.
  12832. * @returns {Object} Returns `object`.
  12833. * @see _.defaultsDeep
  12834. * @example
  12835. *
  12836. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12837. * // => { 'a': 1, 'b': 2 }
  12838. */
  12839. var defaults = baseRest(function(object, sources) {
  12840. object = Object(object);
  12841. var index = -1;
  12842. var length = sources.length;
  12843. var guard = length > 2 ? sources[2] : undefined;
  12844. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  12845. length = 1;
  12846. }
  12847. while (++index < length) {
  12848. var source = sources[index];
  12849. var props = keysIn(source);
  12850. var propsIndex = -1;
  12851. var propsLength = props.length;
  12852. while (++propsIndex < propsLength) {
  12853. var key = props[propsIndex];
  12854. var value = object[key];
  12855. if (value === undefined ||
  12856. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  12857. object[key] = source[key];
  12858. }
  12859. }
  12860. }
  12861. return object;
  12862. });
  12863. /**
  12864. * This method is like `_.defaults` except that it recursively assigns
  12865. * default properties.
  12866. *
  12867. * **Note:** This method mutates `object`.
  12868. *
  12869. * @static
  12870. * @memberOf _
  12871. * @since 3.10.0
  12872. * @category Object
  12873. * @param {Object} object The destination object.
  12874. * @param {...Object} [sources] The source objects.
  12875. * @returns {Object} Returns `object`.
  12876. * @see _.defaults
  12877. * @example
  12878. *
  12879. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  12880. * // => { 'a': { 'b': 2, 'c': 3 } }
  12881. */
  12882. var defaultsDeep = baseRest(function(args) {
  12883. args.push(undefined, customDefaultsMerge);
  12884. return apply(mergeWith, undefined, args);
  12885. });
  12886. /**
  12887. * This method is like `_.find` except that it returns the key of the first
  12888. * element `predicate` returns truthy for instead of the element itself.
  12889. *
  12890. * @static
  12891. * @memberOf _
  12892. * @since 1.1.0
  12893. * @category Object
  12894. * @param {Object} object The object to inspect.
  12895. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12896. * @returns {string|undefined} Returns the key of the matched element,
  12897. * else `undefined`.
  12898. * @example
  12899. *
  12900. * var users = {
  12901. * 'barney': { 'age': 36, 'active': true },
  12902. * 'fred': { 'age': 40, 'active': false },
  12903. * 'pebbles': { 'age': 1, 'active': true }
  12904. * };
  12905. *
  12906. * _.findKey(users, function(o) { return o.age < 40; });
  12907. * // => 'barney' (iteration order is not guaranteed)
  12908. *
  12909. * // The `_.matches` iteratee shorthand.
  12910. * _.findKey(users, { 'age': 1, 'active': true });
  12911. * // => 'pebbles'
  12912. *
  12913. * // The `_.matchesProperty` iteratee shorthand.
  12914. * _.findKey(users, ['active', false]);
  12915. * // => 'fred'
  12916. *
  12917. * // The `_.property` iteratee shorthand.
  12918. * _.findKey(users, 'active');
  12919. * // => 'barney'
  12920. */
  12921. function findKey(object, predicate) {
  12922. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  12923. }
  12924. /**
  12925. * This method is like `_.findKey` except that it iterates over elements of
  12926. * a collection in the opposite order.
  12927. *
  12928. * @static
  12929. * @memberOf _
  12930. * @since 2.0.0
  12931. * @category Object
  12932. * @param {Object} object The object to inspect.
  12933. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12934. * @returns {string|undefined} Returns the key of the matched element,
  12935. * else `undefined`.
  12936. * @example
  12937. *
  12938. * var users = {
  12939. * 'barney': { 'age': 36, 'active': true },
  12940. * 'fred': { 'age': 40, 'active': false },
  12941. * 'pebbles': { 'age': 1, 'active': true }
  12942. * };
  12943. *
  12944. * _.findLastKey(users, function(o) { return o.age < 40; });
  12945. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  12946. *
  12947. * // The `_.matches` iteratee shorthand.
  12948. * _.findLastKey(users, { 'age': 36, 'active': true });
  12949. * // => 'barney'
  12950. *
  12951. * // The `_.matchesProperty` iteratee shorthand.
  12952. * _.findLastKey(users, ['active', false]);
  12953. * // => 'fred'
  12954. *
  12955. * // The `_.property` iteratee shorthand.
  12956. * _.findLastKey(users, 'active');
  12957. * // => 'pebbles'
  12958. */
  12959. function findLastKey(object, predicate) {
  12960. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  12961. }
  12962. /**
  12963. * Iterates over own and inherited enumerable string keyed properties of an
  12964. * object and invokes `iteratee` for each property. The iteratee is invoked
  12965. * with three arguments: (value, key, object). Iteratee functions may exit
  12966. * iteration early by explicitly returning `false`.
  12967. *
  12968. * @static
  12969. * @memberOf _
  12970. * @since 0.3.0
  12971. * @category Object
  12972. * @param {Object} object The object to iterate over.
  12973. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12974. * @returns {Object} Returns `object`.
  12975. * @see _.forInRight
  12976. * @example
  12977. *
  12978. * function Foo() {
  12979. * this.a = 1;
  12980. * this.b = 2;
  12981. * }
  12982. *
  12983. * Foo.prototype.c = 3;
  12984. *
  12985. * _.forIn(new Foo, function(value, key) {
  12986. * console.log(key);
  12987. * });
  12988. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  12989. */
  12990. function forIn(object, iteratee) {
  12991. return object == null
  12992. ? object
  12993. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  12994. }
  12995. /**
  12996. * This method is like `_.forIn` except that it iterates over properties of
  12997. * `object` in the opposite order.
  12998. *
  12999. * @static
  13000. * @memberOf _
  13001. * @since 2.0.0
  13002. * @category Object
  13003. * @param {Object} object The object to iterate over.
  13004. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13005. * @returns {Object} Returns `object`.
  13006. * @see _.forIn
  13007. * @example
  13008. *
  13009. * function Foo() {
  13010. * this.a = 1;
  13011. * this.b = 2;
  13012. * }
  13013. *
  13014. * Foo.prototype.c = 3;
  13015. *
  13016. * _.forInRight(new Foo, function(value, key) {
  13017. * console.log(key);
  13018. * });
  13019. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  13020. */
  13021. function forInRight(object, iteratee) {
  13022. return object == null
  13023. ? object
  13024. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  13025. }
  13026. /**
  13027. * Iterates over own enumerable string keyed properties of an object and
  13028. * invokes `iteratee` for each property. The iteratee is invoked with three
  13029. * arguments: (value, key, object). Iteratee functions may exit iteration
  13030. * early by explicitly returning `false`.
  13031. *
  13032. * @static
  13033. * @memberOf _
  13034. * @since 0.3.0
  13035. * @category Object
  13036. * @param {Object} object The object to iterate over.
  13037. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13038. * @returns {Object} Returns `object`.
  13039. * @see _.forOwnRight
  13040. * @example
  13041. *
  13042. * function Foo() {
  13043. * this.a = 1;
  13044. * this.b = 2;
  13045. * }
  13046. *
  13047. * Foo.prototype.c = 3;
  13048. *
  13049. * _.forOwn(new Foo, function(value, key) {
  13050. * console.log(key);
  13051. * });
  13052. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  13053. */
  13054. function forOwn(object, iteratee) {
  13055. return object && baseForOwn(object, getIteratee(iteratee, 3));
  13056. }
  13057. /**
  13058. * This method is like `_.forOwn` except that it iterates over properties of
  13059. * `object` in the opposite order.
  13060. *
  13061. * @static
  13062. * @memberOf _
  13063. * @since 2.0.0
  13064. * @category Object
  13065. * @param {Object} object The object to iterate over.
  13066. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13067. * @returns {Object} Returns `object`.
  13068. * @see _.forOwn
  13069. * @example
  13070. *
  13071. * function Foo() {
  13072. * this.a = 1;
  13073. * this.b = 2;
  13074. * }
  13075. *
  13076. * Foo.prototype.c = 3;
  13077. *
  13078. * _.forOwnRight(new Foo, function(value, key) {
  13079. * console.log(key);
  13080. * });
  13081. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  13082. */
  13083. function forOwnRight(object, iteratee) {
  13084. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  13085. }
  13086. /**
  13087. * Creates an array of function property names from own enumerable properties
  13088. * of `object`.
  13089. *
  13090. * @static
  13091. * @since 0.1.0
  13092. * @memberOf _
  13093. * @category Object
  13094. * @param {Object} object The object to inspect.
  13095. * @returns {Array} Returns the function names.
  13096. * @see _.functionsIn
  13097. * @example
  13098. *
  13099. * function Foo() {
  13100. * this.a = _.constant('a');
  13101. * this.b = _.constant('b');
  13102. * }
  13103. *
  13104. * Foo.prototype.c = _.constant('c');
  13105. *
  13106. * _.functions(new Foo);
  13107. * // => ['a', 'b']
  13108. */
  13109. function functions(object) {
  13110. return object == null ? [] : baseFunctions(object, keys(object));
  13111. }
  13112. /**
  13113. * Creates an array of function property names from own and inherited
  13114. * enumerable properties of `object`.
  13115. *
  13116. * @static
  13117. * @memberOf _
  13118. * @since 4.0.0
  13119. * @category Object
  13120. * @param {Object} object The object to inspect.
  13121. * @returns {Array} Returns the function names.
  13122. * @see _.functions
  13123. * @example
  13124. *
  13125. * function Foo() {
  13126. * this.a = _.constant('a');
  13127. * this.b = _.constant('b');
  13128. * }
  13129. *
  13130. * Foo.prototype.c = _.constant('c');
  13131. *
  13132. * _.functionsIn(new Foo);
  13133. * // => ['a', 'b', 'c']
  13134. */
  13135. function functionsIn(object) {
  13136. return object == null ? [] : baseFunctions(object, keysIn(object));
  13137. }
  13138. /**
  13139. * Gets the value at `path` of `object`. If the resolved value is
  13140. * `undefined`, the `defaultValue` is returned in its place.
  13141. *
  13142. * @static
  13143. * @memberOf _
  13144. * @since 3.7.0
  13145. * @category Object
  13146. * @param {Object} object The object to query.
  13147. * @param {Array|string} path The path of the property to get.
  13148. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13149. * @returns {*} Returns the resolved value.
  13150. * @example
  13151. *
  13152. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13153. *
  13154. * _.get(object, 'a[0].b.c');
  13155. * // => 3
  13156. *
  13157. * _.get(object, ['a', '0', 'b', 'c']);
  13158. * // => 3
  13159. *
  13160. * _.get(object, 'a.b.c', 'default');
  13161. * // => 'default'
  13162. */
  13163. function get(object, path, defaultValue) {
  13164. var result = object == null ? undefined : baseGet(object, path);
  13165. return result === undefined ? defaultValue : result;
  13166. }
  13167. /**
  13168. * Checks if `path` is a direct property of `object`.
  13169. *
  13170. * @static
  13171. * @since 0.1.0
  13172. * @memberOf _
  13173. * @category Object
  13174. * @param {Object} object The object to query.
  13175. * @param {Array|string} path The path to check.
  13176. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13177. * @example
  13178. *
  13179. * var object = { 'a': { 'b': 2 } };
  13180. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  13181. *
  13182. * _.has(object, 'a');
  13183. * // => true
  13184. *
  13185. * _.has(object, 'a.b');
  13186. * // => true
  13187. *
  13188. * _.has(object, ['a', 'b']);
  13189. * // => true
  13190. *
  13191. * _.has(other, 'a');
  13192. * // => false
  13193. */
  13194. function has(object, path) {
  13195. return object != null && hasPath(object, path, baseHas);
  13196. }
  13197. /**
  13198. * Checks if `path` is a direct or inherited property of `object`.
  13199. *
  13200. * @static
  13201. * @memberOf _
  13202. * @since 4.0.0
  13203. * @category Object
  13204. * @param {Object} object The object to query.
  13205. * @param {Array|string} path The path to check.
  13206. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13207. * @example
  13208. *
  13209. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  13210. *
  13211. * _.hasIn(object, 'a');
  13212. * // => true
  13213. *
  13214. * _.hasIn(object, 'a.b');
  13215. * // => true
  13216. *
  13217. * _.hasIn(object, ['a', 'b']);
  13218. * // => true
  13219. *
  13220. * _.hasIn(object, 'b');
  13221. * // => false
  13222. */
  13223. function hasIn(object, path) {
  13224. return object != null && hasPath(object, path, baseHasIn);
  13225. }
  13226. /**
  13227. * Creates an object composed of the inverted keys and values of `object`.
  13228. * If `object` contains duplicate values, subsequent values overwrite
  13229. * property assignments of previous values.
  13230. *
  13231. * @static
  13232. * @memberOf _
  13233. * @since 0.7.0
  13234. * @category Object
  13235. * @param {Object} object The object to invert.
  13236. * @returns {Object} Returns the new inverted object.
  13237. * @example
  13238. *
  13239. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13240. *
  13241. * _.invert(object);
  13242. * // => { '1': 'c', '2': 'b' }
  13243. */
  13244. var invert = createInverter(function(result, value, key) {
  13245. if (value != null &&
  13246. typeof value.toString != 'function') {
  13247. value = nativeObjectToString.call(value);
  13248. }
  13249. result[value] = key;
  13250. }, constant(identity));
  13251. /**
  13252. * This method is like `_.invert` except that the inverted object is generated
  13253. * from the results of running each element of `object` thru `iteratee`. The
  13254. * corresponding inverted value of each inverted key is an array of keys
  13255. * responsible for generating the inverted value. The iteratee is invoked
  13256. * with one argument: (value).
  13257. *
  13258. * @static
  13259. * @memberOf _
  13260. * @since 4.1.0
  13261. * @category Object
  13262. * @param {Object} object The object to invert.
  13263. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  13264. * @returns {Object} Returns the new inverted object.
  13265. * @example
  13266. *
  13267. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13268. *
  13269. * _.invertBy(object);
  13270. * // => { '1': ['a', 'c'], '2': ['b'] }
  13271. *
  13272. * _.invertBy(object, function(value) {
  13273. * return 'group' + value;
  13274. * });
  13275. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  13276. */
  13277. var invertBy = createInverter(function(result, value, key) {
  13278. if (value != null &&
  13279. typeof value.toString != 'function') {
  13280. value = nativeObjectToString.call(value);
  13281. }
  13282. if (hasOwnProperty.call(result, value)) {
  13283. result[value].push(key);
  13284. } else {
  13285. result[value] = [key];
  13286. }
  13287. }, getIteratee);
  13288. /**
  13289. * Invokes the method at `path` of `object`.
  13290. *
  13291. * @static
  13292. * @memberOf _
  13293. * @since 4.0.0
  13294. * @category Object
  13295. * @param {Object} object The object to query.
  13296. * @param {Array|string} path The path of the method to invoke.
  13297. * @param {...*} [args] The arguments to invoke the method with.
  13298. * @returns {*} Returns the result of the invoked method.
  13299. * @example
  13300. *
  13301. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  13302. *
  13303. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  13304. * // => [2, 3]
  13305. */
  13306. var invoke = baseRest(baseInvoke);
  13307. /**
  13308. * Creates an array of the own enumerable property names of `object`.
  13309. *
  13310. * **Note:** Non-object values are coerced to objects. See the
  13311. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  13312. * for more details.
  13313. *
  13314. * @static
  13315. * @since 0.1.0
  13316. * @memberOf _
  13317. * @category Object
  13318. * @param {Object} object The object to query.
  13319. * @returns {Array} Returns the array of property names.
  13320. * @example
  13321. *
  13322. * function Foo() {
  13323. * this.a = 1;
  13324. * this.b = 2;
  13325. * }
  13326. *
  13327. * Foo.prototype.c = 3;
  13328. *
  13329. * _.keys(new Foo);
  13330. * // => ['a', 'b'] (iteration order is not guaranteed)
  13331. *
  13332. * _.keys('hi');
  13333. * // => ['0', '1']
  13334. */
  13335. function keys(object) {
  13336. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  13337. }
  13338. /**
  13339. * Creates an array of the own and inherited enumerable property names of `object`.
  13340. *
  13341. * **Note:** Non-object values are coerced to objects.
  13342. *
  13343. * @static
  13344. * @memberOf _
  13345. * @since 3.0.0
  13346. * @category Object
  13347. * @param {Object} object The object to query.
  13348. * @returns {Array} Returns the array of property names.
  13349. * @example
  13350. *
  13351. * function Foo() {
  13352. * this.a = 1;
  13353. * this.b = 2;
  13354. * }
  13355. *
  13356. * Foo.prototype.c = 3;
  13357. *
  13358. * _.keysIn(new Foo);
  13359. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  13360. */
  13361. function keysIn(object) {
  13362. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  13363. }
  13364. /**
  13365. * The opposite of `_.mapValues`; this method creates an object with the
  13366. * same values as `object` and keys generated by running each own enumerable
  13367. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  13368. * with three arguments: (value, key, object).
  13369. *
  13370. * @static
  13371. * @memberOf _
  13372. * @since 3.8.0
  13373. * @category Object
  13374. * @param {Object} object The object to iterate over.
  13375. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13376. * @returns {Object} Returns the new mapped object.
  13377. * @see _.mapValues
  13378. * @example
  13379. *
  13380. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  13381. * return key + value;
  13382. * });
  13383. * // => { 'a1': 1, 'b2': 2 }
  13384. */
  13385. function mapKeys(object, iteratee) {
  13386. var result = {};
  13387. iteratee = getIteratee(iteratee, 3);
  13388. baseForOwn(object, function(value, key, object) {
  13389. baseAssignValue(result, iteratee(value, key, object), value);
  13390. });
  13391. return result;
  13392. }
  13393. /**
  13394. * Creates an object with the same keys as `object` and values generated
  13395. * by running each own enumerable string keyed property of `object` thru
  13396. * `iteratee`. The iteratee is invoked with three arguments:
  13397. * (value, key, object).
  13398. *
  13399. * @static
  13400. * @memberOf _
  13401. * @since 2.4.0
  13402. * @category Object
  13403. * @param {Object} object The object to iterate over.
  13404. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13405. * @returns {Object} Returns the new mapped object.
  13406. * @see _.mapKeys
  13407. * @example
  13408. *
  13409. * var users = {
  13410. * 'fred': { 'user': 'fred', 'age': 40 },
  13411. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  13412. * };
  13413. *
  13414. * _.mapValues(users, function(o) { return o.age; });
  13415. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13416. *
  13417. * // The `_.property` iteratee shorthand.
  13418. * _.mapValues(users, 'age');
  13419. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13420. */
  13421. function mapValues(object, iteratee) {
  13422. var result = {};
  13423. iteratee = getIteratee(iteratee, 3);
  13424. baseForOwn(object, function(value, key, object) {
  13425. baseAssignValue(result, key, iteratee(value, key, object));
  13426. });
  13427. return result;
  13428. }
  13429. /**
  13430. * This method is like `_.assign` except that it recursively merges own and
  13431. * inherited enumerable string keyed properties of source objects into the
  13432. * destination object. Source properties that resolve to `undefined` are
  13433. * skipped if a destination value exists. Array and plain object properties
  13434. * are merged recursively. Other objects and value types are overridden by
  13435. * assignment. Source objects are applied from left to right. Subsequent
  13436. * sources overwrite property assignments of previous sources.
  13437. *
  13438. * **Note:** This method mutates `object`.
  13439. *
  13440. * @static
  13441. * @memberOf _
  13442. * @since 0.5.0
  13443. * @category Object
  13444. * @param {Object} object The destination object.
  13445. * @param {...Object} [sources] The source objects.
  13446. * @returns {Object} Returns `object`.
  13447. * @example
  13448. *
  13449. * var object = {
  13450. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  13451. * };
  13452. *
  13453. * var other = {
  13454. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  13455. * };
  13456. *
  13457. * _.merge(object, other);
  13458. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  13459. */
  13460. var merge = createAssigner(function(object, source, srcIndex) {
  13461. baseMerge(object, source, srcIndex);
  13462. });
  13463. /**
  13464. * This method is like `_.merge` except that it accepts `customizer` which
  13465. * is invoked to produce the merged values of the destination and source
  13466. * properties. If `customizer` returns `undefined`, merging is handled by the
  13467. * method instead. The `customizer` is invoked with six arguments:
  13468. * (objValue, srcValue, key, object, source, stack).
  13469. *
  13470. * **Note:** This method mutates `object`.
  13471. *
  13472. * @static
  13473. * @memberOf _
  13474. * @since 4.0.0
  13475. * @category Object
  13476. * @param {Object} object The destination object.
  13477. * @param {...Object} sources The source objects.
  13478. * @param {Function} customizer The function to customize assigned values.
  13479. * @returns {Object} Returns `object`.
  13480. * @example
  13481. *
  13482. * function customizer(objValue, srcValue) {
  13483. * if (_.isArray(objValue)) {
  13484. * return objValue.concat(srcValue);
  13485. * }
  13486. * }
  13487. *
  13488. * var object = { 'a': [1], 'b': [2] };
  13489. * var other = { 'a': [3], 'b': [4] };
  13490. *
  13491. * _.mergeWith(object, other, customizer);
  13492. * // => { 'a': [1, 3], 'b': [2, 4] }
  13493. */
  13494. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  13495. baseMerge(object, source, srcIndex, customizer);
  13496. });
  13497. /**
  13498. * The opposite of `_.pick`; this method creates an object composed of the
  13499. * own and inherited enumerable property paths of `object` that are not omitted.
  13500. *
  13501. * **Note:** This method is considerably slower than `_.pick`.
  13502. *
  13503. * @static
  13504. * @since 0.1.0
  13505. * @memberOf _
  13506. * @category Object
  13507. * @param {Object} object The source object.
  13508. * @param {...(string|string[])} [paths] The property paths to omit.
  13509. * @returns {Object} Returns the new object.
  13510. * @example
  13511. *
  13512. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13513. *
  13514. * _.omit(object, ['a', 'c']);
  13515. * // => { 'b': '2' }
  13516. */
  13517. var omit = flatRest(function(object, paths) {
  13518. var result = {};
  13519. if (object == null) {
  13520. return result;
  13521. }
  13522. var isDeep = false;
  13523. paths = arrayMap(paths, function(path) {
  13524. path = castPath(path, object);
  13525. isDeep || (isDeep = path.length > 1);
  13526. return path;
  13527. });
  13528. copyObject(object, getAllKeysIn(object), result);
  13529. if (isDeep) {
  13530. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  13531. }
  13532. var length = paths.length;
  13533. while (length--) {
  13534. baseUnset(result, paths[length]);
  13535. }
  13536. return result;
  13537. });
  13538. /**
  13539. * The opposite of `_.pickBy`; this method creates an object composed of
  13540. * the own and inherited enumerable string keyed properties of `object` that
  13541. * `predicate` doesn't return truthy for. The predicate is invoked with two
  13542. * arguments: (value, key).
  13543. *
  13544. * @static
  13545. * @memberOf _
  13546. * @since 4.0.0
  13547. * @category Object
  13548. * @param {Object} object The source object.
  13549. * @param {Function} [predicate=_.identity] The function invoked per property.
  13550. * @returns {Object} Returns the new object.
  13551. * @example
  13552. *
  13553. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13554. *
  13555. * _.omitBy(object, _.isNumber);
  13556. * // => { 'b': '2' }
  13557. */
  13558. function omitBy(object, predicate) {
  13559. return pickBy(object, negate(getIteratee(predicate)));
  13560. }
  13561. /**
  13562. * Creates an object composed of the picked `object` properties.
  13563. *
  13564. * @static
  13565. * @since 0.1.0
  13566. * @memberOf _
  13567. * @category Object
  13568. * @param {Object} object The source object.
  13569. * @param {...(string|string[])} [paths] The property paths to pick.
  13570. * @returns {Object} Returns the new object.
  13571. * @example
  13572. *
  13573. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13574. *
  13575. * _.pick(object, ['a', 'c']);
  13576. * // => { 'a': 1, 'c': 3 }
  13577. */
  13578. var pick = flatRest(function(object, paths) {
  13579. return object == null ? {} : basePick(object, paths);
  13580. });
  13581. /**
  13582. * Creates an object composed of the `object` properties `predicate` returns
  13583. * truthy for. The predicate is invoked with two arguments: (value, key).
  13584. *
  13585. * @static
  13586. * @memberOf _
  13587. * @since 4.0.0
  13588. * @category Object
  13589. * @param {Object} object The source object.
  13590. * @param {Function} [predicate=_.identity] The function invoked per property.
  13591. * @returns {Object} Returns the new object.
  13592. * @example
  13593. *
  13594. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13595. *
  13596. * _.pickBy(object, _.isNumber);
  13597. * // => { 'a': 1, 'c': 3 }
  13598. */
  13599. function pickBy(object, predicate) {
  13600. if (object == null) {
  13601. return {};
  13602. }
  13603. var props = arrayMap(getAllKeysIn(object), function(prop) {
  13604. return [prop];
  13605. });
  13606. predicate = getIteratee(predicate);
  13607. return basePickBy(object, props, function(value, path) {
  13608. return predicate(value, path[0]);
  13609. });
  13610. }
  13611. /**
  13612. * This method is like `_.get` except that if the resolved value is a
  13613. * function it's invoked with the `this` binding of its parent object and
  13614. * its result is returned.
  13615. *
  13616. * @static
  13617. * @since 0.1.0
  13618. * @memberOf _
  13619. * @category Object
  13620. * @param {Object} object The object to query.
  13621. * @param {Array|string} path The path of the property to resolve.
  13622. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13623. * @returns {*} Returns the resolved value.
  13624. * @example
  13625. *
  13626. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  13627. *
  13628. * _.result(object, 'a[0].b.c1');
  13629. * // => 3
  13630. *
  13631. * _.result(object, 'a[0].b.c2');
  13632. * // => 4
  13633. *
  13634. * _.result(object, 'a[0].b.c3', 'default');
  13635. * // => 'default'
  13636. *
  13637. * _.result(object, 'a[0].b.c3', _.constant('default'));
  13638. * // => 'default'
  13639. */
  13640. function result(object, path, defaultValue) {
  13641. path = castPath(path, object);
  13642. var index = -1,
  13643. length = path.length;
  13644. // Ensure the loop is entered when path is empty.
  13645. if (!length) {
  13646. length = 1;
  13647. object = undefined;
  13648. }
  13649. while (++index < length) {
  13650. var value = object == null ? undefined : object[toKey(path[index])];
  13651. if (value === undefined) {
  13652. index = length;
  13653. value = defaultValue;
  13654. }
  13655. object = isFunction(value) ? value.call(object) : value;
  13656. }
  13657. return object;
  13658. }
  13659. /**
  13660. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  13661. * it's created. Arrays are created for missing index properties while objects
  13662. * are created for all other missing properties. Use `_.setWith` to customize
  13663. * `path` creation.
  13664. *
  13665. * **Note:** This method mutates `object`.
  13666. *
  13667. * @static
  13668. * @memberOf _
  13669. * @since 3.7.0
  13670. * @category Object
  13671. * @param {Object} object The object to modify.
  13672. * @param {Array|string} path The path of the property to set.
  13673. * @param {*} value The value to set.
  13674. * @returns {Object} Returns `object`.
  13675. * @example
  13676. *
  13677. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13678. *
  13679. * _.set(object, 'a[0].b.c', 4);
  13680. * console.log(object.a[0].b.c);
  13681. * // => 4
  13682. *
  13683. * _.set(object, ['x', '0', 'y', 'z'], 5);
  13684. * console.log(object.x[0].y.z);
  13685. * // => 5
  13686. */
  13687. function set(object, path, value) {
  13688. return object == null ? object : baseSet(object, path, value);
  13689. }
  13690. /**
  13691. * This method is like `_.set` except that it accepts `customizer` which is
  13692. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13693. * path creation is handled by the method instead. The `customizer` is invoked
  13694. * with three arguments: (nsValue, key, nsObject).
  13695. *
  13696. * **Note:** This method mutates `object`.
  13697. *
  13698. * @static
  13699. * @memberOf _
  13700. * @since 4.0.0
  13701. * @category Object
  13702. * @param {Object} object The object to modify.
  13703. * @param {Array|string} path The path of the property to set.
  13704. * @param {*} value The value to set.
  13705. * @param {Function} [customizer] The function to customize assigned values.
  13706. * @returns {Object} Returns `object`.
  13707. * @example
  13708. *
  13709. * var object = {};
  13710. *
  13711. * _.setWith(object, '[0][1]', 'a', Object);
  13712. * // => { '0': { '1': 'a' } }
  13713. */
  13714. function setWith(object, path, value, customizer) {
  13715. customizer = typeof customizer == 'function' ? customizer : undefined;
  13716. return object == null ? object : baseSet(object, path, value, customizer);
  13717. }
  13718. /**
  13719. * Creates an array of own enumerable string keyed-value pairs for `object`
  13720. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  13721. * entries are returned.
  13722. *
  13723. * @static
  13724. * @memberOf _
  13725. * @since 4.0.0
  13726. * @alias entries
  13727. * @category Object
  13728. * @param {Object} object The object to query.
  13729. * @returns {Array} Returns the key-value pairs.
  13730. * @example
  13731. *
  13732. * function Foo() {
  13733. * this.a = 1;
  13734. * this.b = 2;
  13735. * }
  13736. *
  13737. * Foo.prototype.c = 3;
  13738. *
  13739. * _.toPairs(new Foo);
  13740. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  13741. */
  13742. var toPairs = createToPairs(keys);
  13743. /**
  13744. * Creates an array of own and inherited enumerable string keyed-value pairs
  13745. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  13746. * or set, its entries are returned.
  13747. *
  13748. * @static
  13749. * @memberOf _
  13750. * @since 4.0.0
  13751. * @alias entriesIn
  13752. * @category Object
  13753. * @param {Object} object The object to query.
  13754. * @returns {Array} Returns the key-value pairs.
  13755. * @example
  13756. *
  13757. * function Foo() {
  13758. * this.a = 1;
  13759. * this.b = 2;
  13760. * }
  13761. *
  13762. * Foo.prototype.c = 3;
  13763. *
  13764. * _.toPairsIn(new Foo);
  13765. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  13766. */
  13767. var toPairsIn = createToPairs(keysIn);
  13768. /**
  13769. * An alternative to `_.reduce`; this method transforms `object` to a new
  13770. * `accumulator` object which is the result of running each of its own
  13771. * enumerable string keyed properties thru `iteratee`, with each invocation
  13772. * potentially mutating the `accumulator` object. If `accumulator` is not
  13773. * provided, a new object with the same `[[Prototype]]` will be used. The
  13774. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  13775. * Iteratee functions may exit iteration early by explicitly returning `false`.
  13776. *
  13777. * @static
  13778. * @memberOf _
  13779. * @since 1.3.0
  13780. * @category Object
  13781. * @param {Object} object The object to iterate over.
  13782. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13783. * @param {*} [accumulator] The custom accumulator value.
  13784. * @returns {*} Returns the accumulated value.
  13785. * @example
  13786. *
  13787. * _.transform([2, 3, 4], function(result, n) {
  13788. * result.push(n *= n);
  13789. * return n % 2 == 0;
  13790. * }, []);
  13791. * // => [4, 9]
  13792. *
  13793. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  13794. * (result[value] || (result[value] = [])).push(key);
  13795. * }, {});
  13796. * // => { '1': ['a', 'c'], '2': ['b'] }
  13797. */
  13798. function transform(object, iteratee, accumulator) {
  13799. var isArr = isArray(object),
  13800. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  13801. iteratee = getIteratee(iteratee, 4);
  13802. if (accumulator == null) {
  13803. var Ctor = object && object.constructor;
  13804. if (isArrLike) {
  13805. accumulator = isArr ? new Ctor : [];
  13806. }
  13807. else if (isObject(object)) {
  13808. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  13809. }
  13810. else {
  13811. accumulator = {};
  13812. }
  13813. }
  13814. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  13815. return iteratee(accumulator, value, index, object);
  13816. });
  13817. return accumulator;
  13818. }
  13819. /**
  13820. * Removes the property at `path` of `object`.
  13821. *
  13822. * **Note:** This method mutates `object`.
  13823. *
  13824. * @static
  13825. * @memberOf _
  13826. * @since 4.0.0
  13827. * @category Object
  13828. * @param {Object} object The object to modify.
  13829. * @param {Array|string} path The path of the property to unset.
  13830. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  13831. * @example
  13832. *
  13833. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  13834. * _.unset(object, 'a[0].b.c');
  13835. * // => true
  13836. *
  13837. * console.log(object);
  13838. * // => { 'a': [{ 'b': {} }] };
  13839. *
  13840. * _.unset(object, ['a', '0', 'b', 'c']);
  13841. * // => true
  13842. *
  13843. * console.log(object);
  13844. * // => { 'a': [{ 'b': {} }] };
  13845. */
  13846. function unset(object, path) {
  13847. return object == null ? true : baseUnset(object, path);
  13848. }
  13849. /**
  13850. * This method is like `_.set` except that accepts `updater` to produce the
  13851. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  13852. * is invoked with one argument: (value).
  13853. *
  13854. * **Note:** This method mutates `object`.
  13855. *
  13856. * @static
  13857. * @memberOf _
  13858. * @since 4.6.0
  13859. * @category Object
  13860. * @param {Object} object The object to modify.
  13861. * @param {Array|string} path The path of the property to set.
  13862. * @param {Function} updater The function to produce the updated value.
  13863. * @returns {Object} Returns `object`.
  13864. * @example
  13865. *
  13866. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13867. *
  13868. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  13869. * console.log(object.a[0].b.c);
  13870. * // => 9
  13871. *
  13872. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  13873. * console.log(object.x[0].y.z);
  13874. * // => 0
  13875. */
  13876. function update(object, path, updater) {
  13877. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  13878. }
  13879. /**
  13880. * This method is like `_.update` except that it accepts `customizer` which is
  13881. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13882. * path creation is handled by the method instead. The `customizer` is invoked
  13883. * with three arguments: (nsValue, key, nsObject).
  13884. *
  13885. * **Note:** This method mutates `object`.
  13886. *
  13887. * @static
  13888. * @memberOf _
  13889. * @since 4.6.0
  13890. * @category Object
  13891. * @param {Object} object The object to modify.
  13892. * @param {Array|string} path The path of the property to set.
  13893. * @param {Function} updater The function to produce the updated value.
  13894. * @param {Function} [customizer] The function to customize assigned values.
  13895. * @returns {Object} Returns `object`.
  13896. * @example
  13897. *
  13898. * var object = {};
  13899. *
  13900. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  13901. * // => { '0': { '1': 'a' } }
  13902. */
  13903. function updateWith(object, path, updater, customizer) {
  13904. customizer = typeof customizer == 'function' ? customizer : undefined;
  13905. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  13906. }
  13907. /**
  13908. * Creates an array of the own enumerable string keyed property values of `object`.
  13909. *
  13910. * **Note:** Non-object values are coerced to objects.
  13911. *
  13912. * @static
  13913. * @since 0.1.0
  13914. * @memberOf _
  13915. * @category Object
  13916. * @param {Object} object The object to query.
  13917. * @returns {Array} Returns the array of property values.
  13918. * @example
  13919. *
  13920. * function Foo() {
  13921. * this.a = 1;
  13922. * this.b = 2;
  13923. * }
  13924. *
  13925. * Foo.prototype.c = 3;
  13926. *
  13927. * _.values(new Foo);
  13928. * // => [1, 2] (iteration order is not guaranteed)
  13929. *
  13930. * _.values('hi');
  13931. * // => ['h', 'i']
  13932. */
  13933. function values(object) {
  13934. return object == null ? [] : baseValues(object, keys(object));
  13935. }
  13936. /**
  13937. * Creates an array of the own and inherited enumerable string keyed property
  13938. * values of `object`.
  13939. *
  13940. * **Note:** Non-object values are coerced to objects.
  13941. *
  13942. * @static
  13943. * @memberOf _
  13944. * @since 3.0.0
  13945. * @category Object
  13946. * @param {Object} object The object to query.
  13947. * @returns {Array} Returns the array of property values.
  13948. * @example
  13949. *
  13950. * function Foo() {
  13951. * this.a = 1;
  13952. * this.b = 2;
  13953. * }
  13954. *
  13955. * Foo.prototype.c = 3;
  13956. *
  13957. * _.valuesIn(new Foo);
  13958. * // => [1, 2, 3] (iteration order is not guaranteed)
  13959. */
  13960. function valuesIn(object) {
  13961. return object == null ? [] : baseValues(object, keysIn(object));
  13962. }
  13963. /*------------------------------------------------------------------------*/
  13964. /**
  13965. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  13966. *
  13967. * @static
  13968. * @memberOf _
  13969. * @since 4.0.0
  13970. * @category Number
  13971. * @param {number} number The number to clamp.
  13972. * @param {number} [lower] The lower bound.
  13973. * @param {number} upper The upper bound.
  13974. * @returns {number} Returns the clamped number.
  13975. * @example
  13976. *
  13977. * _.clamp(-10, -5, 5);
  13978. * // => -5
  13979. *
  13980. * _.clamp(10, -5, 5);
  13981. * // => 5
  13982. */
  13983. function clamp(number, lower, upper) {
  13984. if (upper === undefined) {
  13985. upper = lower;
  13986. lower = undefined;
  13987. }
  13988. if (upper !== undefined) {
  13989. upper = toNumber(upper);
  13990. upper = upper === upper ? upper : 0;
  13991. }
  13992. if (lower !== undefined) {
  13993. lower = toNumber(lower);
  13994. lower = lower === lower ? lower : 0;
  13995. }
  13996. return baseClamp(toNumber(number), lower, upper);
  13997. }
  13998. /**
  13999. * Checks if `n` is between `start` and up to, but not including, `end`. If
  14000. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  14001. * If `start` is greater than `end` the params are swapped to support
  14002. * negative ranges.
  14003. *
  14004. * @static
  14005. * @memberOf _
  14006. * @since 3.3.0
  14007. * @category Number
  14008. * @param {number} number The number to check.
  14009. * @param {number} [start=0] The start of the range.
  14010. * @param {number} end The end of the range.
  14011. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14012. * @see _.range, _.rangeRight
  14013. * @example
  14014. *
  14015. * _.inRange(3, 2, 4);
  14016. * // => true
  14017. *
  14018. * _.inRange(4, 8);
  14019. * // => true
  14020. *
  14021. * _.inRange(4, 2);
  14022. * // => false
  14023. *
  14024. * _.inRange(2, 2);
  14025. * // => false
  14026. *
  14027. * _.inRange(1.2, 2);
  14028. * // => true
  14029. *
  14030. * _.inRange(5.2, 4);
  14031. * // => false
  14032. *
  14033. * _.inRange(-3, -2, -6);
  14034. * // => true
  14035. */
  14036. function inRange(number, start, end) {
  14037. start = toFinite(start);
  14038. if (end === undefined) {
  14039. end = start;
  14040. start = 0;
  14041. } else {
  14042. end = toFinite(end);
  14043. }
  14044. number = toNumber(number);
  14045. return baseInRange(number, start, end);
  14046. }
  14047. /**
  14048. * Produces a random number between the inclusive `lower` and `upper` bounds.
  14049. * If only one argument is provided a number between `0` and the given number
  14050. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  14051. * floats, a floating-point number is returned instead of an integer.
  14052. *
  14053. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  14054. * floating-point values which can produce unexpected results.
  14055. *
  14056. * @static
  14057. * @memberOf _
  14058. * @since 0.7.0
  14059. * @category Number
  14060. * @param {number} [lower=0] The lower bound.
  14061. * @param {number} [upper=1] The upper bound.
  14062. * @param {boolean} [floating] Specify returning a floating-point number.
  14063. * @returns {number} Returns the random number.
  14064. * @example
  14065. *
  14066. * _.random(0, 5);
  14067. * // => an integer between 0 and 5
  14068. *
  14069. * _.random(5);
  14070. * // => also an integer between 0 and 5
  14071. *
  14072. * _.random(5, true);
  14073. * // => a floating-point number between 0 and 5
  14074. *
  14075. * _.random(1.2, 5.2);
  14076. * // => a floating-point number between 1.2 and 5.2
  14077. */
  14078. function random(lower, upper, floating) {
  14079. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  14080. upper = floating = undefined;
  14081. }
  14082. if (floating === undefined) {
  14083. if (typeof upper == 'boolean') {
  14084. floating = upper;
  14085. upper = undefined;
  14086. }
  14087. else if (typeof lower == 'boolean') {
  14088. floating = lower;
  14089. lower = undefined;
  14090. }
  14091. }
  14092. if (lower === undefined && upper === undefined) {
  14093. lower = 0;
  14094. upper = 1;
  14095. }
  14096. else {
  14097. lower = toFinite(lower);
  14098. if (upper === undefined) {
  14099. upper = lower;
  14100. lower = 0;
  14101. } else {
  14102. upper = toFinite(upper);
  14103. }
  14104. }
  14105. if (lower > upper) {
  14106. var temp = lower;
  14107. lower = upper;
  14108. upper = temp;
  14109. }
  14110. if (floating || lower % 1 || upper % 1) {
  14111. var rand = nativeRandom();
  14112. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  14113. }
  14114. return baseRandom(lower, upper);
  14115. }
  14116. /*------------------------------------------------------------------------*/
  14117. /**
  14118. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  14119. *
  14120. * @static
  14121. * @memberOf _
  14122. * @since 3.0.0
  14123. * @category String
  14124. * @param {string} [string=''] The string to convert.
  14125. * @returns {string} Returns the camel cased string.
  14126. * @example
  14127. *
  14128. * _.camelCase('Foo Bar');
  14129. * // => 'fooBar'
  14130. *
  14131. * _.camelCase('--foo-bar--');
  14132. * // => 'fooBar'
  14133. *
  14134. * _.camelCase('__FOO_BAR__');
  14135. * // => 'fooBar'
  14136. */
  14137. var camelCase = createCompounder(function(result, word, index) {
  14138. word = word.toLowerCase();
  14139. return result + (index ? capitalize(word) : word);
  14140. });
  14141. /**
  14142. * Converts the first character of `string` to upper case and the remaining
  14143. * to lower case.
  14144. *
  14145. * @static
  14146. * @memberOf _
  14147. * @since 3.0.0
  14148. * @category String
  14149. * @param {string} [string=''] The string to capitalize.
  14150. * @returns {string} Returns the capitalized string.
  14151. * @example
  14152. *
  14153. * _.capitalize('FRED');
  14154. * // => 'Fred'
  14155. */
  14156. function capitalize(string) {
  14157. return upperFirst(toString(string).toLowerCase());
  14158. }
  14159. /**
  14160. * Deburrs `string` by converting
  14161. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  14162. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  14163. * letters to basic Latin letters and removing
  14164. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  14165. *
  14166. * @static
  14167. * @memberOf _
  14168. * @since 3.0.0
  14169. * @category String
  14170. * @param {string} [string=''] The string to deburr.
  14171. * @returns {string} Returns the deburred string.
  14172. * @example
  14173. *
  14174. * _.deburr('déjà vu');
  14175. * // => 'deja vu'
  14176. */
  14177. function deburr(string) {
  14178. string = toString(string);
  14179. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  14180. }
  14181. /**
  14182. * Checks if `string` ends with the given target string.
  14183. *
  14184. * @static
  14185. * @memberOf _
  14186. * @since 3.0.0
  14187. * @category String
  14188. * @param {string} [string=''] The string to inspect.
  14189. * @param {string} [target] The string to search for.
  14190. * @param {number} [position=string.length] The position to search up to.
  14191. * @returns {boolean} Returns `true` if `string` ends with `target`,
  14192. * else `false`.
  14193. * @example
  14194. *
  14195. * _.endsWith('abc', 'c');
  14196. * // => true
  14197. *
  14198. * _.endsWith('abc', 'b');
  14199. * // => false
  14200. *
  14201. * _.endsWith('abc', 'b', 2);
  14202. * // => true
  14203. */
  14204. function endsWith(string, target, position) {
  14205. string = toString(string);
  14206. target = baseToString(target);
  14207. var length = string.length;
  14208. position = position === undefined
  14209. ? length
  14210. : baseClamp(toInteger(position), 0, length);
  14211. var end = position;
  14212. position -= target.length;
  14213. return position >= 0 && string.slice(position, end) == target;
  14214. }
  14215. /**
  14216. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  14217. * corresponding HTML entities.
  14218. *
  14219. * **Note:** No other characters are escaped. To escape additional
  14220. * characters use a third-party library like [_he_](https://mths.be/he).
  14221. *
  14222. * Though the ">" character is escaped for symmetry, characters like
  14223. * ">" and "/" don't need escaping in HTML and have no special meaning
  14224. * unless they're part of a tag or unquoted attribute value. See
  14225. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  14226. * (under "semi-related fun fact") for more details.
  14227. *
  14228. * When working with HTML you should always
  14229. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  14230. * XSS vectors.
  14231. *
  14232. * @static
  14233. * @since 0.1.0
  14234. * @memberOf _
  14235. * @category String
  14236. * @param {string} [string=''] The string to escape.
  14237. * @returns {string} Returns the escaped string.
  14238. * @example
  14239. *
  14240. * _.escape('fred, barney, & pebbles');
  14241. * // => 'fred, barney, &amp; pebbles'
  14242. */
  14243. function escape(string) {
  14244. string = toString(string);
  14245. return (string && reHasUnescapedHtml.test(string))
  14246. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  14247. : string;
  14248. }
  14249. /**
  14250. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  14251. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  14252. *
  14253. * @static
  14254. * @memberOf _
  14255. * @since 3.0.0
  14256. * @category String
  14257. * @param {string} [string=''] The string to escape.
  14258. * @returns {string} Returns the escaped string.
  14259. * @example
  14260. *
  14261. * _.escapeRegExp('[lodash](https://lodash.com/)');
  14262. * // => '\[lodash\]\(https://lodash\.com/\)'
  14263. */
  14264. function escapeRegExp(string) {
  14265. string = toString(string);
  14266. return (string && reHasRegExpChar.test(string))
  14267. ? string.replace(reRegExpChar, '\\$&')
  14268. : string;
  14269. }
  14270. /**
  14271. * Converts `string` to
  14272. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  14273. *
  14274. * @static
  14275. * @memberOf _
  14276. * @since 3.0.0
  14277. * @category String
  14278. * @param {string} [string=''] The string to convert.
  14279. * @returns {string} Returns the kebab cased string.
  14280. * @example
  14281. *
  14282. * _.kebabCase('Foo Bar');
  14283. * // => 'foo-bar'
  14284. *
  14285. * _.kebabCase('fooBar');
  14286. * // => 'foo-bar'
  14287. *
  14288. * _.kebabCase('__FOO_BAR__');
  14289. * // => 'foo-bar'
  14290. */
  14291. var kebabCase = createCompounder(function(result, word, index) {
  14292. return result + (index ? '-' : '') + word.toLowerCase();
  14293. });
  14294. /**
  14295. * Converts `string`, as space separated words, to lower case.
  14296. *
  14297. * @static
  14298. * @memberOf _
  14299. * @since 4.0.0
  14300. * @category String
  14301. * @param {string} [string=''] The string to convert.
  14302. * @returns {string} Returns the lower cased string.
  14303. * @example
  14304. *
  14305. * _.lowerCase('--Foo-Bar--');
  14306. * // => 'foo bar'
  14307. *
  14308. * _.lowerCase('fooBar');
  14309. * // => 'foo bar'
  14310. *
  14311. * _.lowerCase('__FOO_BAR__');
  14312. * // => 'foo bar'
  14313. */
  14314. var lowerCase = createCompounder(function(result, word, index) {
  14315. return result + (index ? ' ' : '') + word.toLowerCase();
  14316. });
  14317. /**
  14318. * Converts the first character of `string` to lower case.
  14319. *
  14320. * @static
  14321. * @memberOf _
  14322. * @since 4.0.0
  14323. * @category String
  14324. * @param {string} [string=''] The string to convert.
  14325. * @returns {string} Returns the converted string.
  14326. * @example
  14327. *
  14328. * _.lowerFirst('Fred');
  14329. * // => 'fred'
  14330. *
  14331. * _.lowerFirst('FRED');
  14332. * // => 'fRED'
  14333. */
  14334. var lowerFirst = createCaseFirst('toLowerCase');
  14335. /**
  14336. * Pads `string` on the left and right sides if it's shorter than `length`.
  14337. * Padding characters are truncated if they can't be evenly divided by `length`.
  14338. *
  14339. * @static
  14340. * @memberOf _
  14341. * @since 3.0.0
  14342. * @category String
  14343. * @param {string} [string=''] The string to pad.
  14344. * @param {number} [length=0] The padding length.
  14345. * @param {string} [chars=' '] The string used as padding.
  14346. * @returns {string} Returns the padded string.
  14347. * @example
  14348. *
  14349. * _.pad('abc', 8);
  14350. * // => ' abc '
  14351. *
  14352. * _.pad('abc', 8, '_-');
  14353. * // => '_-abc_-_'
  14354. *
  14355. * _.pad('abc', 3);
  14356. * // => 'abc'
  14357. */
  14358. function pad(string, length, chars) {
  14359. string = toString(string);
  14360. length = toInteger(length);
  14361. var strLength = length ? stringSize(string) : 0;
  14362. if (!length || strLength >= length) {
  14363. return string;
  14364. }
  14365. var mid = (length - strLength) / 2;
  14366. return (
  14367. createPadding(nativeFloor(mid), chars) +
  14368. string +
  14369. createPadding(nativeCeil(mid), chars)
  14370. );
  14371. }
  14372. /**
  14373. * Pads `string` on the right side if it's shorter than `length`. Padding
  14374. * characters are truncated if they exceed `length`.
  14375. *
  14376. * @static
  14377. * @memberOf _
  14378. * @since 4.0.0
  14379. * @category String
  14380. * @param {string} [string=''] The string to pad.
  14381. * @param {number} [length=0] The padding length.
  14382. * @param {string} [chars=' '] The string used as padding.
  14383. * @returns {string} Returns the padded string.
  14384. * @example
  14385. *
  14386. * _.padEnd('abc', 6);
  14387. * // => 'abc '
  14388. *
  14389. * _.padEnd('abc', 6, '_-');
  14390. * // => 'abc_-_'
  14391. *
  14392. * _.padEnd('abc', 3);
  14393. * // => 'abc'
  14394. */
  14395. function padEnd(string, length, chars) {
  14396. string = toString(string);
  14397. length = toInteger(length);
  14398. var strLength = length ? stringSize(string) : 0;
  14399. return (length && strLength < length)
  14400. ? (string + createPadding(length - strLength, chars))
  14401. : string;
  14402. }
  14403. /**
  14404. * Pads `string` on the left side if it's shorter than `length`. Padding
  14405. * characters are truncated if they exceed `length`.
  14406. *
  14407. * @static
  14408. * @memberOf _
  14409. * @since 4.0.0
  14410. * @category String
  14411. * @param {string} [string=''] The string to pad.
  14412. * @param {number} [length=0] The padding length.
  14413. * @param {string} [chars=' '] The string used as padding.
  14414. * @returns {string} Returns the padded string.
  14415. * @example
  14416. *
  14417. * _.padStart('abc', 6);
  14418. * // => ' abc'
  14419. *
  14420. * _.padStart('abc', 6, '_-');
  14421. * // => '_-_abc'
  14422. *
  14423. * _.padStart('abc', 3);
  14424. * // => 'abc'
  14425. */
  14426. function padStart(string, length, chars) {
  14427. string = toString(string);
  14428. length = toInteger(length);
  14429. var strLength = length ? stringSize(string) : 0;
  14430. return (length && strLength < length)
  14431. ? (createPadding(length - strLength, chars) + string)
  14432. : string;
  14433. }
  14434. /**
  14435. * Converts `string` to an integer of the specified radix. If `radix` is
  14436. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  14437. * hexadecimal, in which case a `radix` of `16` is used.
  14438. *
  14439. * **Note:** This method aligns with the
  14440. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  14441. *
  14442. * @static
  14443. * @memberOf _
  14444. * @since 1.1.0
  14445. * @category String
  14446. * @param {string} string The string to convert.
  14447. * @param {number} [radix=10] The radix to interpret `value` by.
  14448. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14449. * @returns {number} Returns the converted integer.
  14450. * @example
  14451. *
  14452. * _.parseInt('08');
  14453. * // => 8
  14454. *
  14455. * _.map(['6', '08', '10'], _.parseInt);
  14456. * // => [6, 8, 10]
  14457. */
  14458. function parseInt(string, radix, guard) {
  14459. if (guard || radix == null) {
  14460. radix = 0;
  14461. } else if (radix) {
  14462. radix = +radix;
  14463. }
  14464. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  14465. }
  14466. /**
  14467. * Repeats the given string `n` times.
  14468. *
  14469. * @static
  14470. * @memberOf _
  14471. * @since 3.0.0
  14472. * @category String
  14473. * @param {string} [string=''] The string to repeat.
  14474. * @param {number} [n=1] The number of times to repeat the string.
  14475. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14476. * @returns {string} Returns the repeated string.
  14477. * @example
  14478. *
  14479. * _.repeat('*', 3);
  14480. * // => '***'
  14481. *
  14482. * _.repeat('abc', 2);
  14483. * // => 'abcabc'
  14484. *
  14485. * _.repeat('abc', 0);
  14486. * // => ''
  14487. */
  14488. function repeat(string, n, guard) {
  14489. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  14490. n = 1;
  14491. } else {
  14492. n = toInteger(n);
  14493. }
  14494. return baseRepeat(toString(string), n);
  14495. }
  14496. /**
  14497. * Replaces matches for `pattern` in `string` with `replacement`.
  14498. *
  14499. * **Note:** This method is based on
  14500. * [`String#replace`](https://mdn.io/String/replace).
  14501. *
  14502. * @static
  14503. * @memberOf _
  14504. * @since 4.0.0
  14505. * @category String
  14506. * @param {string} [string=''] The string to modify.
  14507. * @param {RegExp|string} pattern The pattern to replace.
  14508. * @param {Function|string} replacement The match replacement.
  14509. * @returns {string} Returns the modified string.
  14510. * @example
  14511. *
  14512. * _.replace('Hi Fred', 'Fred', 'Barney');
  14513. * // => 'Hi Barney'
  14514. */
  14515. function replace() {
  14516. var args = arguments,
  14517. string = toString(args[0]);
  14518. return args.length < 3 ? string : string.replace(args[1], args[2]);
  14519. }
  14520. /**
  14521. * Converts `string` to
  14522. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  14523. *
  14524. * @static
  14525. * @memberOf _
  14526. * @since 3.0.0
  14527. * @category String
  14528. * @param {string} [string=''] The string to convert.
  14529. * @returns {string} Returns the snake cased string.
  14530. * @example
  14531. *
  14532. * _.snakeCase('Foo Bar');
  14533. * // => 'foo_bar'
  14534. *
  14535. * _.snakeCase('fooBar');
  14536. * // => 'foo_bar'
  14537. *
  14538. * _.snakeCase('--FOO-BAR--');
  14539. * // => 'foo_bar'
  14540. */
  14541. var snakeCase = createCompounder(function(result, word, index) {
  14542. return result + (index ? '_' : '') + word.toLowerCase();
  14543. });
  14544. /**
  14545. * Splits `string` by `separator`.
  14546. *
  14547. * **Note:** This method is based on
  14548. * [`String#split`](https://mdn.io/String/split).
  14549. *
  14550. * @static
  14551. * @memberOf _
  14552. * @since 4.0.0
  14553. * @category String
  14554. * @param {string} [string=''] The string to split.
  14555. * @param {RegExp|string} separator The separator pattern to split by.
  14556. * @param {number} [limit] The length to truncate results to.
  14557. * @returns {Array} Returns the string segments.
  14558. * @example
  14559. *
  14560. * _.split('a-b-c', '-', 2);
  14561. * // => ['a', 'b']
  14562. */
  14563. function split(string, separator, limit) {
  14564. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  14565. separator = limit = undefined;
  14566. }
  14567. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  14568. if (!limit) {
  14569. return [];
  14570. }
  14571. string = toString(string);
  14572. if (string && (
  14573. typeof separator == 'string' ||
  14574. (separator != null && !isRegExp(separator))
  14575. )) {
  14576. separator = baseToString(separator);
  14577. if (!separator && hasUnicode(string)) {
  14578. return castSlice(stringToArray(string), 0, limit);
  14579. }
  14580. }
  14581. return string.split(separator, limit);
  14582. }
  14583. /**
  14584. * Converts `string` to
  14585. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  14586. *
  14587. * @static
  14588. * @memberOf _
  14589. * @since 3.1.0
  14590. * @category String
  14591. * @param {string} [string=''] The string to convert.
  14592. * @returns {string} Returns the start cased string.
  14593. * @example
  14594. *
  14595. * _.startCase('--foo-bar--');
  14596. * // => 'Foo Bar'
  14597. *
  14598. * _.startCase('fooBar');
  14599. * // => 'Foo Bar'
  14600. *
  14601. * _.startCase('__FOO_BAR__');
  14602. * // => 'FOO BAR'
  14603. */
  14604. var startCase = createCompounder(function(result, word, index) {
  14605. return result + (index ? ' ' : '') + upperFirst(word);
  14606. });
  14607. /**
  14608. * Checks if `string` starts with the given target string.
  14609. *
  14610. * @static
  14611. * @memberOf _
  14612. * @since 3.0.0
  14613. * @category String
  14614. * @param {string} [string=''] The string to inspect.
  14615. * @param {string} [target] The string to search for.
  14616. * @param {number} [position=0] The position to search from.
  14617. * @returns {boolean} Returns `true` if `string` starts with `target`,
  14618. * else `false`.
  14619. * @example
  14620. *
  14621. * _.startsWith('abc', 'a');
  14622. * // => true
  14623. *
  14624. * _.startsWith('abc', 'b');
  14625. * // => false
  14626. *
  14627. * _.startsWith('abc', 'b', 1);
  14628. * // => true
  14629. */
  14630. function startsWith(string, target, position) {
  14631. string = toString(string);
  14632. position = position == null
  14633. ? 0
  14634. : baseClamp(toInteger(position), 0, string.length);
  14635. target = baseToString(target);
  14636. return string.slice(position, position + target.length) == target;
  14637. }
  14638. /**
  14639. * Creates a compiled template function that can interpolate data properties
  14640. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  14641. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  14642. * properties may be accessed as free variables in the template. If a setting
  14643. * object is given, it takes precedence over `_.templateSettings` values.
  14644. *
  14645. * **Note:** In the development build `_.template` utilizes
  14646. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  14647. * for easier debugging.
  14648. *
  14649. * For more information on precompiling templates see
  14650. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  14651. *
  14652. * For more information on Chrome extension sandboxes see
  14653. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  14654. *
  14655. * @static
  14656. * @since 0.1.0
  14657. * @memberOf _
  14658. * @category String
  14659. * @param {string} [string=''] The template string.
  14660. * @param {Object} [options={}] The options object.
  14661. * @param {RegExp} [options.escape=_.templateSettings.escape]
  14662. * The HTML "escape" delimiter.
  14663. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  14664. * The "evaluate" delimiter.
  14665. * @param {Object} [options.imports=_.templateSettings.imports]
  14666. * An object to import into the template as free variables.
  14667. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  14668. * The "interpolate" delimiter.
  14669. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  14670. * The sourceURL of the compiled template.
  14671. * @param {string} [options.variable='obj']
  14672. * The data object variable name.
  14673. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14674. * @returns {Function} Returns the compiled template function.
  14675. * @example
  14676. *
  14677. * // Use the "interpolate" delimiter to create a compiled template.
  14678. * var compiled = _.template('hello <%= user %>!');
  14679. * compiled({ 'user': 'fred' });
  14680. * // => 'hello fred!'
  14681. *
  14682. * // Use the HTML "escape" delimiter to escape data property values.
  14683. * var compiled = _.template('<b><%- value %></b>');
  14684. * compiled({ 'value': '<script>' });
  14685. * // => '<b>&lt;script&gt;</b>'
  14686. *
  14687. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  14688. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  14689. * compiled({ 'users': ['fred', 'barney'] });
  14690. * // => '<li>fred</li><li>barney</li>'
  14691. *
  14692. * // Use the internal `print` function in "evaluate" delimiters.
  14693. * var compiled = _.template('<% print("hello " + user); %>!');
  14694. * compiled({ 'user': 'barney' });
  14695. * // => 'hello barney!'
  14696. *
  14697. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  14698. * // Disable support by replacing the "interpolate" delimiter.
  14699. * var compiled = _.template('hello ${ user }!');
  14700. * compiled({ 'user': 'pebbles' });
  14701. * // => 'hello pebbles!'
  14702. *
  14703. * // Use backslashes to treat delimiters as plain text.
  14704. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  14705. * compiled({ 'value': 'ignored' });
  14706. * // => '<%- value %>'
  14707. *
  14708. * // Use the `imports` option to import `jQuery` as `jq`.
  14709. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  14710. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  14711. * compiled({ 'users': ['fred', 'barney'] });
  14712. * // => '<li>fred</li><li>barney</li>'
  14713. *
  14714. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  14715. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  14716. * compiled(data);
  14717. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  14718. *
  14719. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  14720. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  14721. * compiled.source;
  14722. * // => function(data) {
  14723. * // var __t, __p = '';
  14724. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  14725. * // return __p;
  14726. * // }
  14727. *
  14728. * // Use custom template delimiters.
  14729. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  14730. * var compiled = _.template('hello {{ user }}!');
  14731. * compiled({ 'user': 'mustache' });
  14732. * // => 'hello mustache!'
  14733. *
  14734. * // Use the `source` property to inline compiled templates for meaningful
  14735. * // line numbers in error messages and stack traces.
  14736. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  14737. * var JST = {\
  14738. * "main": ' + _.template(mainText).source + '\
  14739. * };\
  14740. * ');
  14741. */
  14742. function template(string, options, guard) {
  14743. // Based on John Resig's `tmpl` implementation
  14744. // (http://ejohn.org/blog/javascript-micro-templating/)
  14745. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  14746. var settings = lodash.templateSettings;
  14747. if (guard && isIterateeCall(string, options, guard)) {
  14748. options = undefined;
  14749. }
  14750. string = toString(string);
  14751. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  14752. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  14753. importsKeys = keys(imports),
  14754. importsValues = baseValues(imports, importsKeys);
  14755. var isEscaping,
  14756. isEvaluating,
  14757. index = 0,
  14758. interpolate = options.interpolate || reNoMatch,
  14759. source = "__p += '";
  14760. // Compile the regexp to match each delimiter.
  14761. var reDelimiters = RegExp(
  14762. (options.escape || reNoMatch).source + '|' +
  14763. interpolate.source + '|' +
  14764. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  14765. (options.evaluate || reNoMatch).source + '|$'
  14766. , 'g');
  14767. // Use a sourceURL for easier debugging.
  14768. var sourceURL = '//# sourceURL=' +
  14769. ('sourceURL' in options
  14770. ? options.sourceURL
  14771. : ('lodash.templateSources[' + (++templateCounter) + ']')
  14772. ) + '\n';
  14773. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  14774. interpolateValue || (interpolateValue = esTemplateValue);
  14775. // Escape characters that can't be included in string literals.
  14776. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  14777. // Replace delimiters with snippets.
  14778. if (escapeValue) {
  14779. isEscaping = true;
  14780. source += "' +\n__e(" + escapeValue + ") +\n'";
  14781. }
  14782. if (evaluateValue) {
  14783. isEvaluating = true;
  14784. source += "';\n" + evaluateValue + ";\n__p += '";
  14785. }
  14786. if (interpolateValue) {
  14787. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  14788. }
  14789. index = offset + match.length;
  14790. // The JS engine embedded in Adobe products needs `match` returned in
  14791. // order to produce the correct `offset` value.
  14792. return match;
  14793. });
  14794. source += "';\n";
  14795. // If `variable` is not specified wrap a with-statement around the generated
  14796. // code to add the data object to the top of the scope chain.
  14797. var variable = options.variable;
  14798. if (!variable) {
  14799. source = 'with (obj) {\n' + source + '\n}\n';
  14800. }
  14801. // Cleanup code by stripping empty strings.
  14802. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  14803. .replace(reEmptyStringMiddle, '$1')
  14804. .replace(reEmptyStringTrailing, '$1;');
  14805. // Frame code as the function body.
  14806. source = 'function(' + (variable || 'obj') + ') {\n' +
  14807. (variable
  14808. ? ''
  14809. : 'obj || (obj = {});\n'
  14810. ) +
  14811. "var __t, __p = ''" +
  14812. (isEscaping
  14813. ? ', __e = _.escape'
  14814. : ''
  14815. ) +
  14816. (isEvaluating
  14817. ? ', __j = Array.prototype.join;\n' +
  14818. "function print() { __p += __j.call(arguments, '') }\n"
  14819. : ';\n'
  14820. ) +
  14821. source +
  14822. 'return __p\n}';
  14823. var result = attempt(function() {
  14824. return Function(importsKeys, sourceURL + 'return ' + source)
  14825. .apply(undefined, importsValues);
  14826. });
  14827. // Provide the compiled function's source by its `toString` method or
  14828. // the `source` property as a convenience for inlining compiled templates.
  14829. result.source = source;
  14830. if (isError(result)) {
  14831. throw result;
  14832. }
  14833. return result;
  14834. }
  14835. /**
  14836. * Converts `string`, as a whole, to lower case just like
  14837. * [String#toLowerCase](https://mdn.io/toLowerCase).
  14838. *
  14839. * @static
  14840. * @memberOf _
  14841. * @since 4.0.0
  14842. * @category String
  14843. * @param {string} [string=''] The string to convert.
  14844. * @returns {string} Returns the lower cased string.
  14845. * @example
  14846. *
  14847. * _.toLower('--Foo-Bar--');
  14848. * // => '--foo-bar--'
  14849. *
  14850. * _.toLower('fooBar');
  14851. * // => 'foobar'
  14852. *
  14853. * _.toLower('__FOO_BAR__');
  14854. * // => '__foo_bar__'
  14855. */
  14856. function toLower(value) {
  14857. return toString(value).toLowerCase();
  14858. }
  14859. /**
  14860. * Converts `string`, as a whole, to upper case just like
  14861. * [String#toUpperCase](https://mdn.io/toUpperCase).
  14862. *
  14863. * @static
  14864. * @memberOf _
  14865. * @since 4.0.0
  14866. * @category String
  14867. * @param {string} [string=''] The string to convert.
  14868. * @returns {string} Returns the upper cased string.
  14869. * @example
  14870. *
  14871. * _.toUpper('--foo-bar--');
  14872. * // => '--FOO-BAR--'
  14873. *
  14874. * _.toUpper('fooBar');
  14875. * // => 'FOOBAR'
  14876. *
  14877. * _.toUpper('__foo_bar__');
  14878. * // => '__FOO_BAR__'
  14879. */
  14880. function toUpper(value) {
  14881. return toString(value).toUpperCase();
  14882. }
  14883. /**
  14884. * Removes leading and trailing whitespace or specified characters from `string`.
  14885. *
  14886. * @static
  14887. * @memberOf _
  14888. * @since 3.0.0
  14889. * @category String
  14890. * @param {string} [string=''] The string to trim.
  14891. * @param {string} [chars=whitespace] The characters to trim.
  14892. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14893. * @returns {string} Returns the trimmed string.
  14894. * @example
  14895. *
  14896. * _.trim(' abc ');
  14897. * // => 'abc'
  14898. *
  14899. * _.trim('-_-abc-_-', '_-');
  14900. * // => 'abc'
  14901. *
  14902. * _.map([' foo ', ' bar '], _.trim);
  14903. * // => ['foo', 'bar']
  14904. */
  14905. function trim(string, chars, guard) {
  14906. string = toString(string);
  14907. if (string && (guard || chars === undefined)) {
  14908. return string.replace(reTrim, '');
  14909. }
  14910. if (!string || !(chars = baseToString(chars))) {
  14911. return string;
  14912. }
  14913. var strSymbols = stringToArray(string),
  14914. chrSymbols = stringToArray(chars),
  14915. start = charsStartIndex(strSymbols, chrSymbols),
  14916. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  14917. return castSlice(strSymbols, start, end).join('');
  14918. }
  14919. /**
  14920. * Removes trailing whitespace or specified characters from `string`.
  14921. *
  14922. * @static
  14923. * @memberOf _
  14924. * @since 4.0.0
  14925. * @category String
  14926. * @param {string} [string=''] The string to trim.
  14927. * @param {string} [chars=whitespace] The characters to trim.
  14928. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14929. * @returns {string} Returns the trimmed string.
  14930. * @example
  14931. *
  14932. * _.trimEnd(' abc ');
  14933. * // => ' abc'
  14934. *
  14935. * _.trimEnd('-_-abc-_-', '_-');
  14936. * // => '-_-abc'
  14937. */
  14938. function trimEnd(string, chars, guard) {
  14939. string = toString(string);
  14940. if (string && (guard || chars === undefined)) {
  14941. return string.replace(reTrimEnd, '');
  14942. }
  14943. if (!string || !(chars = baseToString(chars))) {
  14944. return string;
  14945. }
  14946. var strSymbols = stringToArray(string),
  14947. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  14948. return castSlice(strSymbols, 0, end).join('');
  14949. }
  14950. /**
  14951. * Removes leading whitespace or specified characters from `string`.
  14952. *
  14953. * @static
  14954. * @memberOf _
  14955. * @since 4.0.0
  14956. * @category String
  14957. * @param {string} [string=''] The string to trim.
  14958. * @param {string} [chars=whitespace] The characters to trim.
  14959. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14960. * @returns {string} Returns the trimmed string.
  14961. * @example
  14962. *
  14963. * _.trimStart(' abc ');
  14964. * // => 'abc '
  14965. *
  14966. * _.trimStart('-_-abc-_-', '_-');
  14967. * // => 'abc-_-'
  14968. */
  14969. function trimStart(string, chars, guard) {
  14970. string = toString(string);
  14971. if (string && (guard || chars === undefined)) {
  14972. return string.replace(reTrimStart, '');
  14973. }
  14974. if (!string || !(chars = baseToString(chars))) {
  14975. return string;
  14976. }
  14977. var strSymbols = stringToArray(string),
  14978. start = charsStartIndex(strSymbols, stringToArray(chars));
  14979. return castSlice(strSymbols, start).join('');
  14980. }
  14981. /**
  14982. * Truncates `string` if it's longer than the given maximum string length.
  14983. * The last characters of the truncated string are replaced with the omission
  14984. * string which defaults to "...".
  14985. *
  14986. * @static
  14987. * @memberOf _
  14988. * @since 4.0.0
  14989. * @category String
  14990. * @param {string} [string=''] The string to truncate.
  14991. * @param {Object} [options={}] The options object.
  14992. * @param {number} [options.length=30] The maximum string length.
  14993. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  14994. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  14995. * @returns {string} Returns the truncated string.
  14996. * @example
  14997. *
  14998. * _.truncate('hi-diddly-ho there, neighborino');
  14999. * // => 'hi-diddly-ho there, neighbo...'
  15000. *
  15001. * _.truncate('hi-diddly-ho there, neighborino', {
  15002. * 'length': 24,
  15003. * 'separator': ' '
  15004. * });
  15005. * // => 'hi-diddly-ho there,...'
  15006. *
  15007. * _.truncate('hi-diddly-ho there, neighborino', {
  15008. * 'length': 24,
  15009. * 'separator': /,? +/
  15010. * });
  15011. * // => 'hi-diddly-ho there...'
  15012. *
  15013. * _.truncate('hi-diddly-ho there, neighborino', {
  15014. * 'omission': ' [...]'
  15015. * });
  15016. * // => 'hi-diddly-ho there, neig [...]'
  15017. */
  15018. function truncate(string, options) {
  15019. var length = DEFAULT_TRUNC_LENGTH,
  15020. omission = DEFAULT_TRUNC_OMISSION;
  15021. if (isObject(options)) {
  15022. var separator = 'separator' in options ? options.separator : separator;
  15023. length = 'length' in options ? toInteger(options.length) : length;
  15024. omission = 'omission' in options ? baseToString(options.omission) : omission;
  15025. }
  15026. string = toString(string);
  15027. var strLength = string.length;
  15028. if (hasUnicode(string)) {
  15029. var strSymbols = stringToArray(string);
  15030. strLength = strSymbols.length;
  15031. }
  15032. if (length >= strLength) {
  15033. return string;
  15034. }
  15035. var end = length - stringSize(omission);
  15036. if (end < 1) {
  15037. return omission;
  15038. }
  15039. var result = strSymbols
  15040. ? castSlice(strSymbols, 0, end).join('')
  15041. : string.slice(0, end);
  15042. if (separator === undefined) {
  15043. return result + omission;
  15044. }
  15045. if (strSymbols) {
  15046. end += (result.length - end);
  15047. }
  15048. if (isRegExp(separator)) {
  15049. if (string.slice(end).search(separator)) {
  15050. var match,
  15051. substring = result;
  15052. if (!separator.global) {
  15053. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  15054. }
  15055. separator.lastIndex = 0;
  15056. while ((match = separator.exec(substring))) {
  15057. var newEnd = match.index;
  15058. }
  15059. result = result.slice(0, newEnd === undefined ? end : newEnd);
  15060. }
  15061. } else if (string.indexOf(baseToString(separator), end) != end) {
  15062. var index = result.lastIndexOf(separator);
  15063. if (index > -1) {
  15064. result = result.slice(0, index);
  15065. }
  15066. }
  15067. return result + omission;
  15068. }
  15069. /**
  15070. * The inverse of `_.escape`; this method converts the HTML entities
  15071. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  15072. * their corresponding characters.
  15073. *
  15074. * **Note:** No other HTML entities are unescaped. To unescape additional
  15075. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  15076. *
  15077. * @static
  15078. * @memberOf _
  15079. * @since 0.6.0
  15080. * @category String
  15081. * @param {string} [string=''] The string to unescape.
  15082. * @returns {string} Returns the unescaped string.
  15083. * @example
  15084. *
  15085. * _.unescape('fred, barney, &amp; pebbles');
  15086. * // => 'fred, barney, & pebbles'
  15087. */
  15088. function unescape(string) {
  15089. string = toString(string);
  15090. return (string && reHasEscapedHtml.test(string))
  15091. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  15092. : string;
  15093. }
  15094. /**
  15095. * Converts `string`, as space separated words, to upper case.
  15096. *
  15097. * @static
  15098. * @memberOf _
  15099. * @since 4.0.0
  15100. * @category String
  15101. * @param {string} [string=''] The string to convert.
  15102. * @returns {string} Returns the upper cased string.
  15103. * @example
  15104. *
  15105. * _.upperCase('--foo-bar');
  15106. * // => 'FOO BAR'
  15107. *
  15108. * _.upperCase('fooBar');
  15109. * // => 'FOO BAR'
  15110. *
  15111. * _.upperCase('__foo_bar__');
  15112. * // => 'FOO BAR'
  15113. */
  15114. var upperCase = createCompounder(function(result, word, index) {
  15115. return result + (index ? ' ' : '') + word.toUpperCase();
  15116. });
  15117. /**
  15118. * Converts the first character of `string` to upper case.
  15119. *
  15120. * @static
  15121. * @memberOf _
  15122. * @since 4.0.0
  15123. * @category String
  15124. * @param {string} [string=''] The string to convert.
  15125. * @returns {string} Returns the converted string.
  15126. * @example
  15127. *
  15128. * _.upperFirst('fred');
  15129. * // => 'Fred'
  15130. *
  15131. * _.upperFirst('FRED');
  15132. * // => 'FRED'
  15133. */
  15134. var upperFirst = createCaseFirst('toUpperCase');
  15135. /**
  15136. * Splits `string` into an array of its words.
  15137. *
  15138. * @static
  15139. * @memberOf _
  15140. * @since 3.0.0
  15141. * @category String
  15142. * @param {string} [string=''] The string to inspect.
  15143. * @param {RegExp|string} [pattern] The pattern to match words.
  15144. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15145. * @returns {Array} Returns the words of `string`.
  15146. * @example
  15147. *
  15148. * _.words('fred, barney, & pebbles');
  15149. * // => ['fred', 'barney', 'pebbles']
  15150. *
  15151. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  15152. * // => ['fred', 'barney', '&', 'pebbles']
  15153. */
  15154. function words(string, pattern, guard) {
  15155. string = toString(string);
  15156. pattern = guard ? undefined : pattern;
  15157. if (pattern === undefined) {
  15158. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  15159. }
  15160. return string.match(pattern) || [];
  15161. }
  15162. /*------------------------------------------------------------------------*/
  15163. /**
  15164. * Attempts to invoke `func`, returning either the result or the caught error
  15165. * object. Any additional arguments are provided to `func` when it's invoked.
  15166. *
  15167. * @static
  15168. * @memberOf _
  15169. * @since 3.0.0
  15170. * @category Util
  15171. * @param {Function} func The function to attempt.
  15172. * @param {...*} [args] The arguments to invoke `func` with.
  15173. * @returns {*} Returns the `func` result or error object.
  15174. * @example
  15175. *
  15176. * // Avoid throwing errors for invalid selectors.
  15177. * var elements = _.attempt(function(selector) {
  15178. * return document.querySelectorAll(selector);
  15179. * }, '>_>');
  15180. *
  15181. * if (_.isError(elements)) {
  15182. * elements = [];
  15183. * }
  15184. */
  15185. var attempt = baseRest(function(func, args) {
  15186. try {
  15187. return apply(func, undefined, args);
  15188. } catch (e) {
  15189. return isError(e) ? e : new Error(e);
  15190. }
  15191. });
  15192. /**
  15193. * Binds methods of an object to the object itself, overwriting the existing
  15194. * method.
  15195. *
  15196. * **Note:** This method doesn't set the "length" property of bound functions.
  15197. *
  15198. * @static
  15199. * @since 0.1.0
  15200. * @memberOf _
  15201. * @category Util
  15202. * @param {Object} object The object to bind and assign the bound methods to.
  15203. * @param {...(string|string[])} methodNames The object method names to bind.
  15204. * @returns {Object} Returns `object`.
  15205. * @example
  15206. *
  15207. * var view = {
  15208. * 'label': 'docs',
  15209. * 'click': function() {
  15210. * console.log('clicked ' + this.label);
  15211. * }
  15212. * };
  15213. *
  15214. * _.bindAll(view, ['click']);
  15215. * jQuery(element).on('click', view.click);
  15216. * // => Logs 'clicked docs' when clicked.
  15217. */
  15218. var bindAll = flatRest(function(object, methodNames) {
  15219. arrayEach(methodNames, function(key) {
  15220. key = toKey(key);
  15221. baseAssignValue(object, key, bind(object[key], object));
  15222. });
  15223. return object;
  15224. });
  15225. /**
  15226. * Creates a function that iterates over `pairs` and invokes the corresponding
  15227. * function of the first predicate to return truthy. The predicate-function
  15228. * pairs are invoked with the `this` binding and arguments of the created
  15229. * function.
  15230. *
  15231. * @static
  15232. * @memberOf _
  15233. * @since 4.0.0
  15234. * @category Util
  15235. * @param {Array} pairs The predicate-function pairs.
  15236. * @returns {Function} Returns the new composite function.
  15237. * @example
  15238. *
  15239. * var func = _.cond([
  15240. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  15241. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  15242. * [_.stubTrue, _.constant('no match')]
  15243. * ]);
  15244. *
  15245. * func({ 'a': 1, 'b': 2 });
  15246. * // => 'matches A'
  15247. *
  15248. * func({ 'a': 0, 'b': 1 });
  15249. * // => 'matches B'
  15250. *
  15251. * func({ 'a': '1', 'b': '2' });
  15252. * // => 'no match'
  15253. */
  15254. function cond(pairs) {
  15255. var length = pairs == null ? 0 : pairs.length,
  15256. toIteratee = getIteratee();
  15257. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  15258. if (typeof pair[1] != 'function') {
  15259. throw new TypeError(FUNC_ERROR_TEXT);
  15260. }
  15261. return [toIteratee(pair[0]), pair[1]];
  15262. });
  15263. return baseRest(function(args) {
  15264. var index = -1;
  15265. while (++index < length) {
  15266. var pair = pairs[index];
  15267. if (apply(pair[0], this, args)) {
  15268. return apply(pair[1], this, args);
  15269. }
  15270. }
  15271. });
  15272. }
  15273. /**
  15274. * Creates a function that invokes the predicate properties of `source` with
  15275. * the corresponding property values of a given object, returning `true` if
  15276. * all predicates return truthy, else `false`.
  15277. *
  15278. * **Note:** The created function is equivalent to `_.conformsTo` with
  15279. * `source` partially applied.
  15280. *
  15281. * @static
  15282. * @memberOf _
  15283. * @since 4.0.0
  15284. * @category Util
  15285. * @param {Object} source The object of property predicates to conform to.
  15286. * @returns {Function} Returns the new spec function.
  15287. * @example
  15288. *
  15289. * var objects = [
  15290. * { 'a': 2, 'b': 1 },
  15291. * { 'a': 1, 'b': 2 }
  15292. * ];
  15293. *
  15294. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  15295. * // => [{ 'a': 1, 'b': 2 }]
  15296. */
  15297. function conforms(source) {
  15298. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  15299. }
  15300. /**
  15301. * Creates a function that returns `value`.
  15302. *
  15303. * @static
  15304. * @memberOf _
  15305. * @since 2.4.0
  15306. * @category Util
  15307. * @param {*} value The value to return from the new function.
  15308. * @returns {Function} Returns the new constant function.
  15309. * @example
  15310. *
  15311. * var objects = _.times(2, _.constant({ 'a': 1 }));
  15312. *
  15313. * console.log(objects);
  15314. * // => [{ 'a': 1 }, { 'a': 1 }]
  15315. *
  15316. * console.log(objects[0] === objects[1]);
  15317. * // => true
  15318. */
  15319. function constant(value) {
  15320. return function() {
  15321. return value;
  15322. };
  15323. }
  15324. /**
  15325. * Checks `value` to determine whether a default value should be returned in
  15326. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  15327. * or `undefined`.
  15328. *
  15329. * @static
  15330. * @memberOf _
  15331. * @since 4.14.0
  15332. * @category Util
  15333. * @param {*} value The value to check.
  15334. * @param {*} defaultValue The default value.
  15335. * @returns {*} Returns the resolved value.
  15336. * @example
  15337. *
  15338. * _.defaultTo(1, 10);
  15339. * // => 1
  15340. *
  15341. * _.defaultTo(undefined, 10);
  15342. * // => 10
  15343. */
  15344. function defaultTo(value, defaultValue) {
  15345. return (value == null || value !== value) ? defaultValue : value;
  15346. }
  15347. /**
  15348. * Creates a function that returns the result of invoking the given functions
  15349. * with the `this` binding of the created function, where each successive
  15350. * invocation is supplied the return value of the previous.
  15351. *
  15352. * @static
  15353. * @memberOf _
  15354. * @since 3.0.0
  15355. * @category Util
  15356. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15357. * @returns {Function} Returns the new composite function.
  15358. * @see _.flowRight
  15359. * @example
  15360. *
  15361. * function square(n) {
  15362. * return n * n;
  15363. * }
  15364. *
  15365. * var addSquare = _.flow([_.add, square]);
  15366. * addSquare(1, 2);
  15367. * // => 9
  15368. */
  15369. var flow = createFlow();
  15370. /**
  15371. * This method is like `_.flow` except that it creates a function that
  15372. * invokes the given functions from right to left.
  15373. *
  15374. * @static
  15375. * @since 3.0.0
  15376. * @memberOf _
  15377. * @category Util
  15378. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15379. * @returns {Function} Returns the new composite function.
  15380. * @see _.flow
  15381. * @example
  15382. *
  15383. * function square(n) {
  15384. * return n * n;
  15385. * }
  15386. *
  15387. * var addSquare = _.flowRight([square, _.add]);
  15388. * addSquare(1, 2);
  15389. * // => 9
  15390. */
  15391. var flowRight = createFlow(true);
  15392. /**
  15393. * This method returns the first argument it receives.
  15394. *
  15395. * @static
  15396. * @since 0.1.0
  15397. * @memberOf _
  15398. * @category Util
  15399. * @param {*} value Any value.
  15400. * @returns {*} Returns `value`.
  15401. * @example
  15402. *
  15403. * var object = { 'a': 1 };
  15404. *
  15405. * console.log(_.identity(object) === object);
  15406. * // => true
  15407. */
  15408. function identity(value) {
  15409. return value;
  15410. }
  15411. /**
  15412. * Creates a function that invokes `func` with the arguments of the created
  15413. * function. If `func` is a property name, the created function returns the
  15414. * property value for a given element. If `func` is an array or object, the
  15415. * created function returns `true` for elements that contain the equivalent
  15416. * source properties, otherwise it returns `false`.
  15417. *
  15418. * @static
  15419. * @since 4.0.0
  15420. * @memberOf _
  15421. * @category Util
  15422. * @param {*} [func=_.identity] The value to convert to a callback.
  15423. * @returns {Function} Returns the callback.
  15424. * @example
  15425. *
  15426. * var users = [
  15427. * { 'user': 'barney', 'age': 36, 'active': true },
  15428. * { 'user': 'fred', 'age': 40, 'active': false }
  15429. * ];
  15430. *
  15431. * // The `_.matches` iteratee shorthand.
  15432. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  15433. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  15434. *
  15435. * // The `_.matchesProperty` iteratee shorthand.
  15436. * _.filter(users, _.iteratee(['user', 'fred']));
  15437. * // => [{ 'user': 'fred', 'age': 40 }]
  15438. *
  15439. * // The `_.property` iteratee shorthand.
  15440. * _.map(users, _.iteratee('user'));
  15441. * // => ['barney', 'fred']
  15442. *
  15443. * // Create custom iteratee shorthands.
  15444. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  15445. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  15446. * return func.test(string);
  15447. * };
  15448. * });
  15449. *
  15450. * _.filter(['abc', 'def'], /ef/);
  15451. * // => ['def']
  15452. */
  15453. function iteratee(func) {
  15454. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  15455. }
  15456. /**
  15457. * Creates a function that performs a partial deep comparison between a given
  15458. * object and `source`, returning `true` if the given object has equivalent
  15459. * property values, else `false`.
  15460. *
  15461. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  15462. * partially applied.
  15463. *
  15464. * Partial comparisons will match empty array and empty object `source`
  15465. * values against any array or object value, respectively. See `_.isEqual`
  15466. * for a list of supported value comparisons.
  15467. *
  15468. * @static
  15469. * @memberOf _
  15470. * @since 3.0.0
  15471. * @category Util
  15472. * @param {Object} source The object of property values to match.
  15473. * @returns {Function} Returns the new spec function.
  15474. * @example
  15475. *
  15476. * var objects = [
  15477. * { 'a': 1, 'b': 2, 'c': 3 },
  15478. * { 'a': 4, 'b': 5, 'c': 6 }
  15479. * ];
  15480. *
  15481. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  15482. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  15483. */
  15484. function matches(source) {
  15485. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  15486. }
  15487. /**
  15488. * Creates a function that performs a partial deep comparison between the
  15489. * value at `path` of a given object to `srcValue`, returning `true` if the
  15490. * object value is equivalent, else `false`.
  15491. *
  15492. * **Note:** Partial comparisons will match empty array and empty object
  15493. * `srcValue` values against any array or object value, respectively. See
  15494. * `_.isEqual` for a list of supported value comparisons.
  15495. *
  15496. * @static
  15497. * @memberOf _
  15498. * @since 3.2.0
  15499. * @category Util
  15500. * @param {Array|string} path The path of the property to get.
  15501. * @param {*} srcValue The value to match.
  15502. * @returns {Function} Returns the new spec function.
  15503. * @example
  15504. *
  15505. * var objects = [
  15506. * { 'a': 1, 'b': 2, 'c': 3 },
  15507. * { 'a': 4, 'b': 5, 'c': 6 }
  15508. * ];
  15509. *
  15510. * _.find(objects, _.matchesProperty('a', 4));
  15511. * // => { 'a': 4, 'b': 5, 'c': 6 }
  15512. */
  15513. function matchesProperty(path, srcValue) {
  15514. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  15515. }
  15516. /**
  15517. * Creates a function that invokes the method at `path` of a given object.
  15518. * Any additional arguments are provided to the invoked method.
  15519. *
  15520. * @static
  15521. * @memberOf _
  15522. * @since 3.7.0
  15523. * @category Util
  15524. * @param {Array|string} path The path of the method to invoke.
  15525. * @param {...*} [args] The arguments to invoke the method with.
  15526. * @returns {Function} Returns the new invoker function.
  15527. * @example
  15528. *
  15529. * var objects = [
  15530. * { 'a': { 'b': _.constant(2) } },
  15531. * { 'a': { 'b': _.constant(1) } }
  15532. * ];
  15533. *
  15534. * _.map(objects, _.method('a.b'));
  15535. * // => [2, 1]
  15536. *
  15537. * _.map(objects, _.method(['a', 'b']));
  15538. * // => [2, 1]
  15539. */
  15540. var method = baseRest(function(path, args) {
  15541. return function(object) {
  15542. return baseInvoke(object, path, args);
  15543. };
  15544. });
  15545. /**
  15546. * The opposite of `_.method`; this method creates a function that invokes
  15547. * the method at a given path of `object`. Any additional arguments are
  15548. * provided to the invoked method.
  15549. *
  15550. * @static
  15551. * @memberOf _
  15552. * @since 3.7.0
  15553. * @category Util
  15554. * @param {Object} object The object to query.
  15555. * @param {...*} [args] The arguments to invoke the method with.
  15556. * @returns {Function} Returns the new invoker function.
  15557. * @example
  15558. *
  15559. * var array = _.times(3, _.constant),
  15560. * object = { 'a': array, 'b': array, 'c': array };
  15561. *
  15562. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  15563. * // => [2, 0]
  15564. *
  15565. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  15566. * // => [2, 0]
  15567. */
  15568. var methodOf = baseRest(function(object, args) {
  15569. return function(path) {
  15570. return baseInvoke(object, path, args);
  15571. };
  15572. });
  15573. /**
  15574. * Adds all own enumerable string keyed function properties of a source
  15575. * object to the destination object. If `object` is a function, then methods
  15576. * are added to its prototype as well.
  15577. *
  15578. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  15579. * avoid conflicts caused by modifying the original.
  15580. *
  15581. * @static
  15582. * @since 0.1.0
  15583. * @memberOf _
  15584. * @category Util
  15585. * @param {Function|Object} [object=lodash] The destination object.
  15586. * @param {Object} source The object of functions to add.
  15587. * @param {Object} [options={}] The options object.
  15588. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  15589. * @returns {Function|Object} Returns `object`.
  15590. * @example
  15591. *
  15592. * function vowels(string) {
  15593. * return _.filter(string, function(v) {
  15594. * return /[aeiou]/i.test(v);
  15595. * });
  15596. * }
  15597. *
  15598. * _.mixin({ 'vowels': vowels });
  15599. * _.vowels('fred');
  15600. * // => ['e']
  15601. *
  15602. * _('fred').vowels().value();
  15603. * // => ['e']
  15604. *
  15605. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  15606. * _('fred').vowels();
  15607. * // => ['e']
  15608. */
  15609. function mixin(object, source, options) {
  15610. var props = keys(source),
  15611. methodNames = baseFunctions(source, props);
  15612. if (options == null &&
  15613. !(isObject(source) && (methodNames.length || !props.length))) {
  15614. options = source;
  15615. source = object;
  15616. object = this;
  15617. methodNames = baseFunctions(source, keys(source));
  15618. }
  15619. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  15620. isFunc = isFunction(object);
  15621. arrayEach(methodNames, function(methodName) {
  15622. var func = source[methodName];
  15623. object[methodName] = func;
  15624. if (isFunc) {
  15625. object.prototype[methodName] = function() {
  15626. var chainAll = this.__chain__;
  15627. if (chain || chainAll) {
  15628. var result = object(this.__wrapped__),
  15629. actions = result.__actions__ = copyArray(this.__actions__);
  15630. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  15631. result.__chain__ = chainAll;
  15632. return result;
  15633. }
  15634. return func.apply(object, arrayPush([this.value()], arguments));
  15635. };
  15636. }
  15637. });
  15638. return object;
  15639. }
  15640. /**
  15641. * Reverts the `_` variable to its previous value and returns a reference to
  15642. * the `lodash` function.
  15643. *
  15644. * @static
  15645. * @since 0.1.0
  15646. * @memberOf _
  15647. * @category Util
  15648. * @returns {Function} Returns the `lodash` function.
  15649. * @example
  15650. *
  15651. * var lodash = _.noConflict();
  15652. */
  15653. function noConflict() {
  15654. if (root._ === this) {
  15655. root._ = oldDash;
  15656. }
  15657. return this;
  15658. }
  15659. /**
  15660. * This method returns `undefined`.
  15661. *
  15662. * @static
  15663. * @memberOf _
  15664. * @since 2.3.0
  15665. * @category Util
  15666. * @example
  15667. *
  15668. * _.times(2, _.noop);
  15669. * // => [undefined, undefined]
  15670. */
  15671. function noop() {
  15672. // No operation performed.
  15673. }
  15674. /**
  15675. * Creates a function that gets the argument at index `n`. If `n` is negative,
  15676. * the nth argument from the end is returned.
  15677. *
  15678. * @static
  15679. * @memberOf _
  15680. * @since 4.0.0
  15681. * @category Util
  15682. * @param {number} [n=0] The index of the argument to return.
  15683. * @returns {Function} Returns the new pass-thru function.
  15684. * @example
  15685. *
  15686. * var func = _.nthArg(1);
  15687. * func('a', 'b', 'c', 'd');
  15688. * // => 'b'
  15689. *
  15690. * var func = _.nthArg(-2);
  15691. * func('a', 'b', 'c', 'd');
  15692. * // => 'c'
  15693. */
  15694. function nthArg(n) {
  15695. n = toInteger(n);
  15696. return baseRest(function(args) {
  15697. return baseNth(args, n);
  15698. });
  15699. }
  15700. /**
  15701. * Creates a function that invokes `iteratees` with the arguments it receives
  15702. * and returns their results.
  15703. *
  15704. * @static
  15705. * @memberOf _
  15706. * @since 4.0.0
  15707. * @category Util
  15708. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  15709. * The iteratees to invoke.
  15710. * @returns {Function} Returns the new function.
  15711. * @example
  15712. *
  15713. * var func = _.over([Math.max, Math.min]);
  15714. *
  15715. * func(1, 2, 3, 4);
  15716. * // => [4, 1]
  15717. */
  15718. var over = createOver(arrayMap);
  15719. /**
  15720. * Creates a function that checks if **all** of the `predicates` return
  15721. * truthy when invoked with the arguments it receives.
  15722. *
  15723. * @static
  15724. * @memberOf _
  15725. * @since 4.0.0
  15726. * @category Util
  15727. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15728. * The predicates to check.
  15729. * @returns {Function} Returns the new function.
  15730. * @example
  15731. *
  15732. * var func = _.overEvery([Boolean, isFinite]);
  15733. *
  15734. * func('1');
  15735. * // => true
  15736. *
  15737. * func(null);
  15738. * // => false
  15739. *
  15740. * func(NaN);
  15741. * // => false
  15742. */
  15743. var overEvery = createOver(arrayEvery);
  15744. /**
  15745. * Creates a function that checks if **any** of the `predicates` return
  15746. * truthy when invoked with the arguments it receives.
  15747. *
  15748. * @static
  15749. * @memberOf _
  15750. * @since 4.0.0
  15751. * @category Util
  15752. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15753. * The predicates to check.
  15754. * @returns {Function} Returns the new function.
  15755. * @example
  15756. *
  15757. * var func = _.overSome([Boolean, isFinite]);
  15758. *
  15759. * func('1');
  15760. * // => true
  15761. *
  15762. * func(null);
  15763. * // => true
  15764. *
  15765. * func(NaN);
  15766. * // => false
  15767. */
  15768. var overSome = createOver(arraySome);
  15769. /**
  15770. * Creates a function that returns the value at `path` of a given object.
  15771. *
  15772. * @static
  15773. * @memberOf _
  15774. * @since 2.4.0
  15775. * @category Util
  15776. * @param {Array|string} path The path of the property to get.
  15777. * @returns {Function} Returns the new accessor function.
  15778. * @example
  15779. *
  15780. * var objects = [
  15781. * { 'a': { 'b': 2 } },
  15782. * { 'a': { 'b': 1 } }
  15783. * ];
  15784. *
  15785. * _.map(objects, _.property('a.b'));
  15786. * // => [2, 1]
  15787. *
  15788. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  15789. * // => [1, 2]
  15790. */
  15791. function property(path) {
  15792. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  15793. }
  15794. /**
  15795. * The opposite of `_.property`; this method creates a function that returns
  15796. * the value at a given path of `object`.
  15797. *
  15798. * @static
  15799. * @memberOf _
  15800. * @since 3.0.0
  15801. * @category Util
  15802. * @param {Object} object The object to query.
  15803. * @returns {Function} Returns the new accessor function.
  15804. * @example
  15805. *
  15806. * var array = [0, 1, 2],
  15807. * object = { 'a': array, 'b': array, 'c': array };
  15808. *
  15809. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  15810. * // => [2, 0]
  15811. *
  15812. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  15813. * // => [2, 0]
  15814. */
  15815. function propertyOf(object) {
  15816. return function(path) {
  15817. return object == null ? undefined : baseGet(object, path);
  15818. };
  15819. }
  15820. /**
  15821. * Creates an array of numbers (positive and/or negative) progressing from
  15822. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  15823. * `start` is specified without an `end` or `step`. If `end` is not specified,
  15824. * it's set to `start` with `start` then set to `0`.
  15825. *
  15826. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  15827. * floating-point values which can produce unexpected results.
  15828. *
  15829. * @static
  15830. * @since 0.1.0
  15831. * @memberOf _
  15832. * @category Util
  15833. * @param {number} [start=0] The start of the range.
  15834. * @param {number} end The end of the range.
  15835. * @param {number} [step=1] The value to increment or decrement by.
  15836. * @returns {Array} Returns the range of numbers.
  15837. * @see _.inRange, _.rangeRight
  15838. * @example
  15839. *
  15840. * _.range(4);
  15841. * // => [0, 1, 2, 3]
  15842. *
  15843. * _.range(-4);
  15844. * // => [0, -1, -2, -3]
  15845. *
  15846. * _.range(1, 5);
  15847. * // => [1, 2, 3, 4]
  15848. *
  15849. * _.range(0, 20, 5);
  15850. * // => [0, 5, 10, 15]
  15851. *
  15852. * _.range(0, -4, -1);
  15853. * // => [0, -1, -2, -3]
  15854. *
  15855. * _.range(1, 4, 0);
  15856. * // => [1, 1, 1]
  15857. *
  15858. * _.range(0);
  15859. * // => []
  15860. */
  15861. var range = createRange();
  15862. /**
  15863. * This method is like `_.range` except that it populates values in
  15864. * descending order.
  15865. *
  15866. * @static
  15867. * @memberOf _
  15868. * @since 4.0.0
  15869. * @category Util
  15870. * @param {number} [start=0] The start of the range.
  15871. * @param {number} end The end of the range.
  15872. * @param {number} [step=1] The value to increment or decrement by.
  15873. * @returns {Array} Returns the range of numbers.
  15874. * @see _.inRange, _.range
  15875. * @example
  15876. *
  15877. * _.rangeRight(4);
  15878. * // => [3, 2, 1, 0]
  15879. *
  15880. * _.rangeRight(-4);
  15881. * // => [-3, -2, -1, 0]
  15882. *
  15883. * _.rangeRight(1, 5);
  15884. * // => [4, 3, 2, 1]
  15885. *
  15886. * _.rangeRight(0, 20, 5);
  15887. * // => [15, 10, 5, 0]
  15888. *
  15889. * _.rangeRight(0, -4, -1);
  15890. * // => [-3, -2, -1, 0]
  15891. *
  15892. * _.rangeRight(1, 4, 0);
  15893. * // => [1, 1, 1]
  15894. *
  15895. * _.rangeRight(0);
  15896. * // => []
  15897. */
  15898. var rangeRight = createRange(true);
  15899. /**
  15900. * This method returns a new empty array.
  15901. *
  15902. * @static
  15903. * @memberOf _
  15904. * @since 4.13.0
  15905. * @category Util
  15906. * @returns {Array} Returns the new empty array.
  15907. * @example
  15908. *
  15909. * var arrays = _.times(2, _.stubArray);
  15910. *
  15911. * console.log(arrays);
  15912. * // => [[], []]
  15913. *
  15914. * console.log(arrays[0] === arrays[1]);
  15915. * // => false
  15916. */
  15917. function stubArray() {
  15918. return [];
  15919. }
  15920. /**
  15921. * This method returns `false`.
  15922. *
  15923. * @static
  15924. * @memberOf _
  15925. * @since 4.13.0
  15926. * @category Util
  15927. * @returns {boolean} Returns `false`.
  15928. * @example
  15929. *
  15930. * _.times(2, _.stubFalse);
  15931. * // => [false, false]
  15932. */
  15933. function stubFalse() {
  15934. return false;
  15935. }
  15936. /**
  15937. * This method returns a new empty object.
  15938. *
  15939. * @static
  15940. * @memberOf _
  15941. * @since 4.13.0
  15942. * @category Util
  15943. * @returns {Object} Returns the new empty object.
  15944. * @example
  15945. *
  15946. * var objects = _.times(2, _.stubObject);
  15947. *
  15948. * console.log(objects);
  15949. * // => [{}, {}]
  15950. *
  15951. * console.log(objects[0] === objects[1]);
  15952. * // => false
  15953. */
  15954. function stubObject() {
  15955. return {};
  15956. }
  15957. /**
  15958. * This method returns an empty string.
  15959. *
  15960. * @static
  15961. * @memberOf _
  15962. * @since 4.13.0
  15963. * @category Util
  15964. * @returns {string} Returns the empty string.
  15965. * @example
  15966. *
  15967. * _.times(2, _.stubString);
  15968. * // => ['', '']
  15969. */
  15970. function stubString() {
  15971. return '';
  15972. }
  15973. /**
  15974. * This method returns `true`.
  15975. *
  15976. * @static
  15977. * @memberOf _
  15978. * @since 4.13.0
  15979. * @category Util
  15980. * @returns {boolean} Returns `true`.
  15981. * @example
  15982. *
  15983. * _.times(2, _.stubTrue);
  15984. * // => [true, true]
  15985. */
  15986. function stubTrue() {
  15987. return true;
  15988. }
  15989. /**
  15990. * Invokes the iteratee `n` times, returning an array of the results of
  15991. * each invocation. The iteratee is invoked with one argument; (index).
  15992. *
  15993. * @static
  15994. * @since 0.1.0
  15995. * @memberOf _
  15996. * @category Util
  15997. * @param {number} n The number of times to invoke `iteratee`.
  15998. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  15999. * @returns {Array} Returns the array of results.
  16000. * @example
  16001. *
  16002. * _.times(3, String);
  16003. * // => ['0', '1', '2']
  16004. *
  16005. * _.times(4, _.constant(0));
  16006. * // => [0, 0, 0, 0]
  16007. */
  16008. function times(n, iteratee) {
  16009. n = toInteger(n);
  16010. if (n < 1 || n > MAX_SAFE_INTEGER) {
  16011. return [];
  16012. }
  16013. var index = MAX_ARRAY_LENGTH,
  16014. length = nativeMin(n, MAX_ARRAY_LENGTH);
  16015. iteratee = getIteratee(iteratee);
  16016. n -= MAX_ARRAY_LENGTH;
  16017. var result = baseTimes(length, iteratee);
  16018. while (++index < n) {
  16019. iteratee(index);
  16020. }
  16021. return result;
  16022. }
  16023. /**
  16024. * Converts `value` to a property path array.
  16025. *
  16026. * @static
  16027. * @memberOf _
  16028. * @since 4.0.0
  16029. * @category Util
  16030. * @param {*} value The value to convert.
  16031. * @returns {Array} Returns the new property path array.
  16032. * @example
  16033. *
  16034. * _.toPath('a.b.c');
  16035. * // => ['a', 'b', 'c']
  16036. *
  16037. * _.toPath('a[0].b.c');
  16038. * // => ['a', '0', 'b', 'c']
  16039. */
  16040. function toPath(value) {
  16041. if (isArray(value)) {
  16042. return arrayMap(value, toKey);
  16043. }
  16044. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  16045. }
  16046. /**
  16047. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  16048. *
  16049. * @static
  16050. * @since 0.1.0
  16051. * @memberOf _
  16052. * @category Util
  16053. * @param {string} [prefix=''] The value to prefix the ID with.
  16054. * @returns {string} Returns the unique ID.
  16055. * @example
  16056. *
  16057. * _.uniqueId('contact_');
  16058. * // => 'contact_104'
  16059. *
  16060. * _.uniqueId();
  16061. * // => '105'
  16062. */
  16063. function uniqueId(prefix) {
  16064. var id = ++idCounter;
  16065. return toString(prefix) + id;
  16066. }
  16067. /*------------------------------------------------------------------------*/
  16068. /**
  16069. * Adds two numbers.
  16070. *
  16071. * @static
  16072. * @memberOf _
  16073. * @since 3.4.0
  16074. * @category Math
  16075. * @param {number} augend The first number in an addition.
  16076. * @param {number} addend The second number in an addition.
  16077. * @returns {number} Returns the total.
  16078. * @example
  16079. *
  16080. * _.add(6, 4);
  16081. * // => 10
  16082. */
  16083. var add = createMathOperation(function(augend, addend) {
  16084. return augend + addend;
  16085. }, 0);
  16086. /**
  16087. * Computes `number` rounded up to `precision`.
  16088. *
  16089. * @static
  16090. * @memberOf _
  16091. * @since 3.10.0
  16092. * @category Math
  16093. * @param {number} number The number to round up.
  16094. * @param {number} [precision=0] The precision to round up to.
  16095. * @returns {number} Returns the rounded up number.
  16096. * @example
  16097. *
  16098. * _.ceil(4.006);
  16099. * // => 5
  16100. *
  16101. * _.ceil(6.004, 2);
  16102. * // => 6.01
  16103. *
  16104. * _.ceil(6040, -2);
  16105. * // => 6100
  16106. */
  16107. var ceil = createRound('ceil');
  16108. /**
  16109. * Divide two numbers.
  16110. *
  16111. * @static
  16112. * @memberOf _
  16113. * @since 4.7.0
  16114. * @category Math
  16115. * @param {number} dividend The first number in a division.
  16116. * @param {number} divisor The second number in a division.
  16117. * @returns {number} Returns the quotient.
  16118. * @example
  16119. *
  16120. * _.divide(6, 4);
  16121. * // => 1.5
  16122. */
  16123. var divide = createMathOperation(function(dividend, divisor) {
  16124. return dividend / divisor;
  16125. }, 1);
  16126. /**
  16127. * Computes `number` rounded down to `precision`.
  16128. *
  16129. * @static
  16130. * @memberOf _
  16131. * @since 3.10.0
  16132. * @category Math
  16133. * @param {number} number The number to round down.
  16134. * @param {number} [precision=0] The precision to round down to.
  16135. * @returns {number} Returns the rounded down number.
  16136. * @example
  16137. *
  16138. * _.floor(4.006);
  16139. * // => 4
  16140. *
  16141. * _.floor(0.046, 2);
  16142. * // => 0.04
  16143. *
  16144. * _.floor(4060, -2);
  16145. * // => 4000
  16146. */
  16147. var floor = createRound('floor');
  16148. /**
  16149. * Computes the maximum value of `array`. If `array` is empty or falsey,
  16150. * `undefined` is returned.
  16151. *
  16152. * @static
  16153. * @since 0.1.0
  16154. * @memberOf _
  16155. * @category Math
  16156. * @param {Array} array The array to iterate over.
  16157. * @returns {*} Returns the maximum value.
  16158. * @example
  16159. *
  16160. * _.max([4, 2, 8, 6]);
  16161. * // => 8
  16162. *
  16163. * _.max([]);
  16164. * // => undefined
  16165. */
  16166. function max(array) {
  16167. return (array && array.length)
  16168. ? baseExtremum(array, identity, baseGt)
  16169. : undefined;
  16170. }
  16171. /**
  16172. * This method is like `_.max` except that it accepts `iteratee` which is
  16173. * invoked for each element in `array` to generate the criterion by which
  16174. * the value is ranked. The iteratee is invoked with one argument: (value).
  16175. *
  16176. * @static
  16177. * @memberOf _
  16178. * @since 4.0.0
  16179. * @category Math
  16180. * @param {Array} array The array to iterate over.
  16181. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16182. * @returns {*} Returns the maximum value.
  16183. * @example
  16184. *
  16185. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16186. *
  16187. * _.maxBy(objects, function(o) { return o.n; });
  16188. * // => { 'n': 2 }
  16189. *
  16190. * // The `_.property` iteratee shorthand.
  16191. * _.maxBy(objects, 'n');
  16192. * // => { 'n': 2 }
  16193. */
  16194. function maxBy(array, iteratee) {
  16195. return (array && array.length)
  16196. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  16197. : undefined;
  16198. }
  16199. /**
  16200. * Computes the mean of the values in `array`.
  16201. *
  16202. * @static
  16203. * @memberOf _
  16204. * @since 4.0.0
  16205. * @category Math
  16206. * @param {Array} array The array to iterate over.
  16207. * @returns {number} Returns the mean.
  16208. * @example
  16209. *
  16210. * _.mean([4, 2, 8, 6]);
  16211. * // => 5
  16212. */
  16213. function mean(array) {
  16214. return baseMean(array, identity);
  16215. }
  16216. /**
  16217. * This method is like `_.mean` except that it accepts `iteratee` which is
  16218. * invoked for each element in `array` to generate the value to be averaged.
  16219. * The iteratee is invoked with one argument: (value).
  16220. *
  16221. * @static
  16222. * @memberOf _
  16223. * @since 4.7.0
  16224. * @category Math
  16225. * @param {Array} array The array to iterate over.
  16226. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16227. * @returns {number} Returns the mean.
  16228. * @example
  16229. *
  16230. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16231. *
  16232. * _.meanBy(objects, function(o) { return o.n; });
  16233. * // => 5
  16234. *
  16235. * // The `_.property` iteratee shorthand.
  16236. * _.meanBy(objects, 'n');
  16237. * // => 5
  16238. */
  16239. function meanBy(array, iteratee) {
  16240. return baseMean(array, getIteratee(iteratee, 2));
  16241. }
  16242. /**
  16243. * Computes the minimum value of `array`. If `array` is empty or falsey,
  16244. * `undefined` is returned.
  16245. *
  16246. * @static
  16247. * @since 0.1.0
  16248. * @memberOf _
  16249. * @category Math
  16250. * @param {Array} array The array to iterate over.
  16251. * @returns {*} Returns the minimum value.
  16252. * @example
  16253. *
  16254. * _.min([4, 2, 8, 6]);
  16255. * // => 2
  16256. *
  16257. * _.min([]);
  16258. * // => undefined
  16259. */
  16260. function min(array) {
  16261. return (array && array.length)
  16262. ? baseExtremum(array, identity, baseLt)
  16263. : undefined;
  16264. }
  16265. /**
  16266. * This method is like `_.min` except that it accepts `iteratee` which is
  16267. * invoked for each element in `array` to generate the criterion by which
  16268. * the value is ranked. The iteratee is invoked with one argument: (value).
  16269. *
  16270. * @static
  16271. * @memberOf _
  16272. * @since 4.0.0
  16273. * @category Math
  16274. * @param {Array} array The array to iterate over.
  16275. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16276. * @returns {*} Returns the minimum value.
  16277. * @example
  16278. *
  16279. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16280. *
  16281. * _.minBy(objects, function(o) { return o.n; });
  16282. * // => { 'n': 1 }
  16283. *
  16284. * // The `_.property` iteratee shorthand.
  16285. * _.minBy(objects, 'n');
  16286. * // => { 'n': 1 }
  16287. */
  16288. function minBy(array, iteratee) {
  16289. return (array && array.length)
  16290. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  16291. : undefined;
  16292. }
  16293. /**
  16294. * Multiply two numbers.
  16295. *
  16296. * @static
  16297. * @memberOf _
  16298. * @since 4.7.0
  16299. * @category Math
  16300. * @param {number} multiplier The first number in a multiplication.
  16301. * @param {number} multiplicand The second number in a multiplication.
  16302. * @returns {number} Returns the product.
  16303. * @example
  16304. *
  16305. * _.multiply(6, 4);
  16306. * // => 24
  16307. */
  16308. var multiply = createMathOperation(function(multiplier, multiplicand) {
  16309. return multiplier * multiplicand;
  16310. }, 1);
  16311. /**
  16312. * Computes `number` rounded to `precision`.
  16313. *
  16314. * @static
  16315. * @memberOf _
  16316. * @since 3.10.0
  16317. * @category Math
  16318. * @param {number} number The number to round.
  16319. * @param {number} [precision=0] The precision to round to.
  16320. * @returns {number} Returns the rounded number.
  16321. * @example
  16322. *
  16323. * _.round(4.006);
  16324. * // => 4
  16325. *
  16326. * _.round(4.006, 2);
  16327. * // => 4.01
  16328. *
  16329. * _.round(4060, -2);
  16330. * // => 4100
  16331. */
  16332. var round = createRound('round');
  16333. /**
  16334. * Subtract two numbers.
  16335. *
  16336. * @static
  16337. * @memberOf _
  16338. * @since 4.0.0
  16339. * @category Math
  16340. * @param {number} minuend The first number in a subtraction.
  16341. * @param {number} subtrahend The second number in a subtraction.
  16342. * @returns {number} Returns the difference.
  16343. * @example
  16344. *
  16345. * _.subtract(6, 4);
  16346. * // => 2
  16347. */
  16348. var subtract = createMathOperation(function(minuend, subtrahend) {
  16349. return minuend - subtrahend;
  16350. }, 0);
  16351. /**
  16352. * Computes the sum of the values in `array`.
  16353. *
  16354. * @static
  16355. * @memberOf _
  16356. * @since 3.4.0
  16357. * @category Math
  16358. * @param {Array} array The array to iterate over.
  16359. * @returns {number} Returns the sum.
  16360. * @example
  16361. *
  16362. * _.sum([4, 2, 8, 6]);
  16363. * // => 20
  16364. */
  16365. function sum(array) {
  16366. return (array && array.length)
  16367. ? baseSum(array, identity)
  16368. : 0;
  16369. }
  16370. /**
  16371. * This method is like `_.sum` except that it accepts `iteratee` which is
  16372. * invoked for each element in `array` to generate the value to be summed.
  16373. * The iteratee is invoked with one argument: (value).
  16374. *
  16375. * @static
  16376. * @memberOf _
  16377. * @since 4.0.0
  16378. * @category Math
  16379. * @param {Array} array The array to iterate over.
  16380. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16381. * @returns {number} Returns the sum.
  16382. * @example
  16383. *
  16384. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16385. *
  16386. * _.sumBy(objects, function(o) { return o.n; });
  16387. * // => 20
  16388. *
  16389. * // The `_.property` iteratee shorthand.
  16390. * _.sumBy(objects, 'n');
  16391. * // => 20
  16392. */
  16393. function sumBy(array, iteratee) {
  16394. return (array && array.length)
  16395. ? baseSum(array, getIteratee(iteratee, 2))
  16396. : 0;
  16397. }
  16398. /*------------------------------------------------------------------------*/
  16399. // Add methods that return wrapped values in chain sequences.
  16400. lodash.after = after;
  16401. lodash.ary = ary;
  16402. lodash.assign = assign;
  16403. lodash.assignIn = assignIn;
  16404. lodash.assignInWith = assignInWith;
  16405. lodash.assignWith = assignWith;
  16406. lodash.at = at;
  16407. lodash.before = before;
  16408. lodash.bind = bind;
  16409. lodash.bindAll = bindAll;
  16410. lodash.bindKey = bindKey;
  16411. lodash.castArray = castArray;
  16412. lodash.chain = chain;
  16413. lodash.chunk = chunk;
  16414. lodash.compact = compact;
  16415. lodash.concat = concat;
  16416. lodash.cond = cond;
  16417. lodash.conforms = conforms;
  16418. lodash.constant = constant;
  16419. lodash.countBy = countBy;
  16420. lodash.create = create;
  16421. lodash.curry = curry;
  16422. lodash.curryRight = curryRight;
  16423. lodash.debounce = debounce;
  16424. lodash.defaults = defaults;
  16425. lodash.defaultsDeep = defaultsDeep;
  16426. lodash.defer = defer;
  16427. lodash.delay = delay;
  16428. lodash.difference = difference;
  16429. lodash.differenceBy = differenceBy;
  16430. lodash.differenceWith = differenceWith;
  16431. lodash.drop = drop;
  16432. lodash.dropRight = dropRight;
  16433. lodash.dropRightWhile = dropRightWhile;
  16434. lodash.dropWhile = dropWhile;
  16435. lodash.fill = fill;
  16436. lodash.filter = filter;
  16437. lodash.flatMap = flatMap;
  16438. lodash.flatMapDeep = flatMapDeep;
  16439. lodash.flatMapDepth = flatMapDepth;
  16440. lodash.flatten = flatten;
  16441. lodash.flattenDeep = flattenDeep;
  16442. lodash.flattenDepth = flattenDepth;
  16443. lodash.flip = flip;
  16444. lodash.flow = flow;
  16445. lodash.flowRight = flowRight;
  16446. lodash.fromPairs = fromPairs;
  16447. lodash.functions = functions;
  16448. lodash.functionsIn = functionsIn;
  16449. lodash.groupBy = groupBy;
  16450. lodash.initial = initial;
  16451. lodash.intersection = intersection;
  16452. lodash.intersectionBy = intersectionBy;
  16453. lodash.intersectionWith = intersectionWith;
  16454. lodash.invert = invert;
  16455. lodash.invertBy = invertBy;
  16456. lodash.invokeMap = invokeMap;
  16457. lodash.iteratee = iteratee;
  16458. lodash.keyBy = keyBy;
  16459. lodash.keys = keys;
  16460. lodash.keysIn = keysIn;
  16461. lodash.map = map;
  16462. lodash.mapKeys = mapKeys;
  16463. lodash.mapValues = mapValues;
  16464. lodash.matches = matches;
  16465. lodash.matchesProperty = matchesProperty;
  16466. lodash.memoize = memoize;
  16467. lodash.merge = merge;
  16468. lodash.mergeWith = mergeWith;
  16469. lodash.method = method;
  16470. lodash.methodOf = methodOf;
  16471. lodash.mixin = mixin;
  16472. lodash.negate = negate;
  16473. lodash.nthArg = nthArg;
  16474. lodash.omit = omit;
  16475. lodash.omitBy = omitBy;
  16476. lodash.once = once;
  16477. lodash.orderBy = orderBy;
  16478. lodash.over = over;
  16479. lodash.overArgs = overArgs;
  16480. lodash.overEvery = overEvery;
  16481. lodash.overSome = overSome;
  16482. lodash.partial = partial;
  16483. lodash.partialRight = partialRight;
  16484. lodash.partition = partition;
  16485. lodash.pick = pick;
  16486. lodash.pickBy = pickBy;
  16487. lodash.property = property;
  16488. lodash.propertyOf = propertyOf;
  16489. lodash.pull = pull;
  16490. lodash.pullAll = pullAll;
  16491. lodash.pullAllBy = pullAllBy;
  16492. lodash.pullAllWith = pullAllWith;
  16493. lodash.pullAt = pullAt;
  16494. lodash.range = range;
  16495. lodash.rangeRight = rangeRight;
  16496. lodash.rearg = rearg;
  16497. lodash.reject = reject;
  16498. lodash.remove = remove;
  16499. lodash.rest = rest;
  16500. lodash.reverse = reverse;
  16501. lodash.sampleSize = sampleSize;
  16502. lodash.set = set;
  16503. lodash.setWith = setWith;
  16504. lodash.shuffle = shuffle;
  16505. lodash.slice = slice;
  16506. lodash.sortBy = sortBy;
  16507. lodash.sortedUniq = sortedUniq;
  16508. lodash.sortedUniqBy = sortedUniqBy;
  16509. lodash.split = split;
  16510. lodash.spread = spread;
  16511. lodash.tail = tail;
  16512. lodash.take = take;
  16513. lodash.takeRight = takeRight;
  16514. lodash.takeRightWhile = takeRightWhile;
  16515. lodash.takeWhile = takeWhile;
  16516. lodash.tap = tap;
  16517. lodash.throttle = throttle;
  16518. lodash.thru = thru;
  16519. lodash.toArray = toArray;
  16520. lodash.toPairs = toPairs;
  16521. lodash.toPairsIn = toPairsIn;
  16522. lodash.toPath = toPath;
  16523. lodash.toPlainObject = toPlainObject;
  16524. lodash.transform = transform;
  16525. lodash.unary = unary;
  16526. lodash.union = union;
  16527. lodash.unionBy = unionBy;
  16528. lodash.unionWith = unionWith;
  16529. lodash.uniq = uniq;
  16530. lodash.uniqBy = uniqBy;
  16531. lodash.uniqWith = uniqWith;
  16532. lodash.unset = unset;
  16533. lodash.unzip = unzip;
  16534. lodash.unzipWith = unzipWith;
  16535. lodash.update = update;
  16536. lodash.updateWith = updateWith;
  16537. lodash.values = values;
  16538. lodash.valuesIn = valuesIn;
  16539. lodash.without = without;
  16540. lodash.words = words;
  16541. lodash.wrap = wrap;
  16542. lodash.xor = xor;
  16543. lodash.xorBy = xorBy;
  16544. lodash.xorWith = xorWith;
  16545. lodash.zip = zip;
  16546. lodash.zipObject = zipObject;
  16547. lodash.zipObjectDeep = zipObjectDeep;
  16548. lodash.zipWith = zipWith;
  16549. // Add aliases.
  16550. lodash.entries = toPairs;
  16551. lodash.entriesIn = toPairsIn;
  16552. lodash.extend = assignIn;
  16553. lodash.extendWith = assignInWith;
  16554. // Add methods to `lodash.prototype`.
  16555. mixin(lodash, lodash);
  16556. /*------------------------------------------------------------------------*/
  16557. // Add methods that return unwrapped values in chain sequences.
  16558. lodash.add = add;
  16559. lodash.attempt = attempt;
  16560. lodash.camelCase = camelCase;
  16561. lodash.capitalize = capitalize;
  16562. lodash.ceil = ceil;
  16563. lodash.clamp = clamp;
  16564. lodash.clone = clone;
  16565. lodash.cloneDeep = cloneDeep;
  16566. lodash.cloneDeepWith = cloneDeepWith;
  16567. lodash.cloneWith = cloneWith;
  16568. lodash.conformsTo = conformsTo;
  16569. lodash.deburr = deburr;
  16570. lodash.defaultTo = defaultTo;
  16571. lodash.divide = divide;
  16572. lodash.endsWith = endsWith;
  16573. lodash.eq = eq;
  16574. lodash.escape = escape;
  16575. lodash.escapeRegExp = escapeRegExp;
  16576. lodash.every = every;
  16577. lodash.find = find;
  16578. lodash.findIndex = findIndex;
  16579. lodash.findKey = findKey;
  16580. lodash.findLast = findLast;
  16581. lodash.findLastIndex = findLastIndex;
  16582. lodash.findLastKey = findLastKey;
  16583. lodash.floor = floor;
  16584. lodash.forEach = forEach;
  16585. lodash.forEachRight = forEachRight;
  16586. lodash.forIn = forIn;
  16587. lodash.forInRight = forInRight;
  16588. lodash.forOwn = forOwn;
  16589. lodash.forOwnRight = forOwnRight;
  16590. lodash.get = get;
  16591. lodash.gt = gt;
  16592. lodash.gte = gte;
  16593. lodash.has = has;
  16594. lodash.hasIn = hasIn;
  16595. lodash.head = head;
  16596. lodash.identity = identity;
  16597. lodash.includes = includes;
  16598. lodash.indexOf = indexOf;
  16599. lodash.inRange = inRange;
  16600. lodash.invoke = invoke;
  16601. lodash.isArguments = isArguments;
  16602. lodash.isArray = isArray;
  16603. lodash.isArrayBuffer = isArrayBuffer;
  16604. lodash.isArrayLike = isArrayLike;
  16605. lodash.isArrayLikeObject = isArrayLikeObject;
  16606. lodash.isBoolean = isBoolean;
  16607. lodash.isBuffer = isBuffer;
  16608. lodash.isDate = isDate;
  16609. lodash.isElement = isElement;
  16610. lodash.isEmpty = isEmpty;
  16611. lodash.isEqual = isEqual;
  16612. lodash.isEqualWith = isEqualWith;
  16613. lodash.isError = isError;
  16614. lodash.isFinite = isFinite;
  16615. lodash.isFunction = isFunction;
  16616. lodash.isInteger = isInteger;
  16617. lodash.isLength = isLength;
  16618. lodash.isMap = isMap;
  16619. lodash.isMatch = isMatch;
  16620. lodash.isMatchWith = isMatchWith;
  16621. lodash.isNaN = isNaN;
  16622. lodash.isNative = isNative;
  16623. lodash.isNil = isNil;
  16624. lodash.isNull = isNull;
  16625. lodash.isNumber = isNumber;
  16626. lodash.isObject = isObject;
  16627. lodash.isObjectLike = isObjectLike;
  16628. lodash.isPlainObject = isPlainObject;
  16629. lodash.isRegExp = isRegExp;
  16630. lodash.isSafeInteger = isSafeInteger;
  16631. lodash.isSet = isSet;
  16632. lodash.isString = isString;
  16633. lodash.isSymbol = isSymbol;
  16634. lodash.isTypedArray = isTypedArray;
  16635. lodash.isUndefined = isUndefined;
  16636. lodash.isWeakMap = isWeakMap;
  16637. lodash.isWeakSet = isWeakSet;
  16638. lodash.join = join;
  16639. lodash.kebabCase = kebabCase;
  16640. lodash.last = last;
  16641. lodash.lastIndexOf = lastIndexOf;
  16642. lodash.lowerCase = lowerCase;
  16643. lodash.lowerFirst = lowerFirst;
  16644. lodash.lt = lt;
  16645. lodash.lte = lte;
  16646. lodash.max = max;
  16647. lodash.maxBy = maxBy;
  16648. lodash.mean = mean;
  16649. lodash.meanBy = meanBy;
  16650. lodash.min = min;
  16651. lodash.minBy = minBy;
  16652. lodash.stubArray = stubArray;
  16653. lodash.stubFalse = stubFalse;
  16654. lodash.stubObject = stubObject;
  16655. lodash.stubString = stubString;
  16656. lodash.stubTrue = stubTrue;
  16657. lodash.multiply = multiply;
  16658. lodash.nth = nth;
  16659. lodash.noConflict = noConflict;
  16660. lodash.noop = noop;
  16661. lodash.now = now;
  16662. lodash.pad = pad;
  16663. lodash.padEnd = padEnd;
  16664. lodash.padStart = padStart;
  16665. lodash.parseInt = parseInt;
  16666. lodash.random = random;
  16667. lodash.reduce = reduce;
  16668. lodash.reduceRight = reduceRight;
  16669. lodash.repeat = repeat;
  16670. lodash.replace = replace;
  16671. lodash.result = result;
  16672. lodash.round = round;
  16673. lodash.runInContext = runInContext;
  16674. lodash.sample = sample;
  16675. lodash.size = size;
  16676. lodash.snakeCase = snakeCase;
  16677. lodash.some = some;
  16678. lodash.sortedIndex = sortedIndex;
  16679. lodash.sortedIndexBy = sortedIndexBy;
  16680. lodash.sortedIndexOf = sortedIndexOf;
  16681. lodash.sortedLastIndex = sortedLastIndex;
  16682. lodash.sortedLastIndexBy = sortedLastIndexBy;
  16683. lodash.sortedLastIndexOf = sortedLastIndexOf;
  16684. lodash.startCase = startCase;
  16685. lodash.startsWith = startsWith;
  16686. lodash.subtract = subtract;
  16687. lodash.sum = sum;
  16688. lodash.sumBy = sumBy;
  16689. lodash.template = template;
  16690. lodash.times = times;
  16691. lodash.toFinite = toFinite;
  16692. lodash.toInteger = toInteger;
  16693. lodash.toLength = toLength;
  16694. lodash.toLower = toLower;
  16695. lodash.toNumber = toNumber;
  16696. lodash.toSafeInteger = toSafeInteger;
  16697. lodash.toString = toString;
  16698. lodash.toUpper = toUpper;
  16699. lodash.trim = trim;
  16700. lodash.trimEnd = trimEnd;
  16701. lodash.trimStart = trimStart;
  16702. lodash.truncate = truncate;
  16703. lodash.unescape = unescape;
  16704. lodash.uniqueId = uniqueId;
  16705. lodash.upperCase = upperCase;
  16706. lodash.upperFirst = upperFirst;
  16707. // Add aliases.
  16708. lodash.each = forEach;
  16709. lodash.eachRight = forEachRight;
  16710. lodash.first = head;
  16711. mixin(lodash, (function() {
  16712. var source = {};
  16713. baseForOwn(lodash, function(func, methodName) {
  16714. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  16715. source[methodName] = func;
  16716. }
  16717. });
  16718. return source;
  16719. }()), { 'chain': false });
  16720. /*------------------------------------------------------------------------*/
  16721. /**
  16722. * The semantic version number.
  16723. *
  16724. * @static
  16725. * @memberOf _
  16726. * @type {string}
  16727. */
  16728. lodash.VERSION = VERSION;
  16729. // Assign default placeholders.
  16730. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  16731. lodash[methodName].placeholder = lodash;
  16732. });
  16733. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  16734. arrayEach(['drop', 'take'], function(methodName, index) {
  16735. LazyWrapper.prototype[methodName] = function(n) {
  16736. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  16737. var result = (this.__filtered__ && !index)
  16738. ? new LazyWrapper(this)
  16739. : this.clone();
  16740. if (result.__filtered__) {
  16741. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  16742. } else {
  16743. result.__views__.push({
  16744. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  16745. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  16746. });
  16747. }
  16748. return result;
  16749. };
  16750. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  16751. return this.reverse()[methodName](n).reverse();
  16752. };
  16753. });
  16754. // Add `LazyWrapper` methods that accept an `iteratee` value.
  16755. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  16756. var type = index + 1,
  16757. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  16758. LazyWrapper.prototype[methodName] = function(iteratee) {
  16759. var result = this.clone();
  16760. result.__iteratees__.push({
  16761. 'iteratee': getIteratee(iteratee, 3),
  16762. 'type': type
  16763. });
  16764. result.__filtered__ = result.__filtered__ || isFilter;
  16765. return result;
  16766. };
  16767. });
  16768. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  16769. arrayEach(['head', 'last'], function(methodName, index) {
  16770. var takeName = 'take' + (index ? 'Right' : '');
  16771. LazyWrapper.prototype[methodName] = function() {
  16772. return this[takeName](1).value()[0];
  16773. };
  16774. });
  16775. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  16776. arrayEach(['initial', 'tail'], function(methodName, index) {
  16777. var dropName = 'drop' + (index ? '' : 'Right');
  16778. LazyWrapper.prototype[methodName] = function() {
  16779. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  16780. };
  16781. });
  16782. LazyWrapper.prototype.compact = function() {
  16783. return this.filter(identity);
  16784. };
  16785. LazyWrapper.prototype.find = function(predicate) {
  16786. return this.filter(predicate).head();
  16787. };
  16788. LazyWrapper.prototype.findLast = function(predicate) {
  16789. return this.reverse().find(predicate);
  16790. };
  16791. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  16792. if (typeof path == 'function') {
  16793. return new LazyWrapper(this);
  16794. }
  16795. return this.map(function(value) {
  16796. return baseInvoke(value, path, args);
  16797. });
  16798. });
  16799. LazyWrapper.prototype.reject = function(predicate) {
  16800. return this.filter(negate(getIteratee(predicate)));
  16801. };
  16802. LazyWrapper.prototype.slice = function(start, end) {
  16803. start = toInteger(start);
  16804. var result = this;
  16805. if (result.__filtered__ && (start > 0 || end < 0)) {
  16806. return new LazyWrapper(result);
  16807. }
  16808. if (start < 0) {
  16809. result = result.takeRight(-start);
  16810. } else if (start) {
  16811. result = result.drop(start);
  16812. }
  16813. if (end !== undefined) {
  16814. end = toInteger(end);
  16815. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  16816. }
  16817. return result;
  16818. };
  16819. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  16820. return this.reverse().takeWhile(predicate).reverse();
  16821. };
  16822. LazyWrapper.prototype.toArray = function() {
  16823. return this.take(MAX_ARRAY_LENGTH);
  16824. };
  16825. // Add `LazyWrapper` methods to `lodash.prototype`.
  16826. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16827. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  16828. isTaker = /^(?:head|last)$/.test(methodName),
  16829. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  16830. retUnwrapped = isTaker || /^find/.test(methodName);
  16831. if (!lodashFunc) {
  16832. return;
  16833. }
  16834. lodash.prototype[methodName] = function() {
  16835. var value = this.__wrapped__,
  16836. args = isTaker ? [1] : arguments,
  16837. isLazy = value instanceof LazyWrapper,
  16838. iteratee = args[0],
  16839. useLazy = isLazy || isArray(value);
  16840. var interceptor = function(value) {
  16841. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  16842. return (isTaker && chainAll) ? result[0] : result;
  16843. };
  16844. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  16845. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  16846. isLazy = useLazy = false;
  16847. }
  16848. var chainAll = this.__chain__,
  16849. isHybrid = !!this.__actions__.length,
  16850. isUnwrapped = retUnwrapped && !chainAll,
  16851. onlyLazy = isLazy && !isHybrid;
  16852. if (!retUnwrapped && useLazy) {
  16853. value = onlyLazy ? value : new LazyWrapper(this);
  16854. var result = func.apply(value, args);
  16855. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  16856. return new LodashWrapper(result, chainAll);
  16857. }
  16858. if (isUnwrapped && onlyLazy) {
  16859. return func.apply(this, args);
  16860. }
  16861. result = this.thru(interceptor);
  16862. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  16863. };
  16864. });
  16865. // Add `Array` methods to `lodash.prototype`.
  16866. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  16867. var func = arrayProto[methodName],
  16868. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  16869. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  16870. lodash.prototype[methodName] = function() {
  16871. var args = arguments;
  16872. if (retUnwrapped && !this.__chain__) {
  16873. var value = this.value();
  16874. return func.apply(isArray(value) ? value : [], args);
  16875. }
  16876. return this[chainName](function(value) {
  16877. return func.apply(isArray(value) ? value : [], args);
  16878. });
  16879. };
  16880. });
  16881. // Map minified method names to their real names.
  16882. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16883. var lodashFunc = lodash[methodName];
  16884. if (lodashFunc) {
  16885. var key = (lodashFunc.name + ''),
  16886. names = realNames[key] || (realNames[key] = []);
  16887. names.push({ 'name': methodName, 'func': lodashFunc });
  16888. }
  16889. });
  16890. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  16891. 'name': 'wrapper',
  16892. 'func': undefined
  16893. }];
  16894. // Add methods to `LazyWrapper`.
  16895. LazyWrapper.prototype.clone = lazyClone;
  16896. LazyWrapper.prototype.reverse = lazyReverse;
  16897. LazyWrapper.prototype.value = lazyValue;
  16898. // Add chain sequence methods to the `lodash` wrapper.
  16899. lodash.prototype.at = wrapperAt;
  16900. lodash.prototype.chain = wrapperChain;
  16901. lodash.prototype.commit = wrapperCommit;
  16902. lodash.prototype.next = wrapperNext;
  16903. lodash.prototype.plant = wrapperPlant;
  16904. lodash.prototype.reverse = wrapperReverse;
  16905. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  16906. // Add lazy aliases.
  16907. lodash.prototype.first = lodash.prototype.head;
  16908. if (symIterator) {
  16909. lodash.prototype[symIterator] = wrapperToIterator;
  16910. }
  16911. return lodash;
  16912. });
  16913. /*--------------------------------------------------------------------------*/
  16914. // Export lodash.
  16915. var _ = runInContext();
  16916. // Some AMD build optimizers, like r.js, check for condition patterns like:
  16917. if (true) {
  16918. // Expose Lodash on the global object to prevent errors when Lodash is
  16919. // loaded by a script tag in the presence of an AMD loader.
  16920. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  16921. // Use `_.noConflict` to remove Lodash from the global object.
  16922. root._ = _;
  16923. // Define as an anonymous module so, through path mapping, it can be
  16924. // referenced as the "underscore" module.
  16925. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16926. return _;
  16927. }).call(exports, __webpack_require__, exports, module),
  16928. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16929. }
  16930. // Check for `exports` after `define` in case a build optimizer adds it.
  16931. else if (freeModule) {
  16932. // Export for Node.js.
  16933. (freeModule.exports = _)._ = _;
  16934. // Export for CommonJS support.
  16935. freeExports._ = _;
  16936. }
  16937. else {
  16938. // Export to the global object.
  16939. root._ = _;
  16940. }
  16941. }.call(this));
  16942. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(13)(module)))
  16943. /***/ }),
  16944. /* 13 */
  16945. /***/ (function(module, exports) {
  16946. module.exports = function(module) {
  16947. if(!module.webpackPolyfill) {
  16948. module.deprecate = function() {};
  16949. module.paths = [];
  16950. // module.parent = undefined by default
  16951. if(!module.children) module.children = [];
  16952. Object.defineProperty(module, "loaded", {
  16953. enumerable: true,
  16954. get: function() {
  16955. return module.l;
  16956. }
  16957. });
  16958. Object.defineProperty(module, "id", {
  16959. enumerable: true,
  16960. get: function() {
  16961. return module.i;
  16962. }
  16963. });
  16964. module.webpackPolyfill = 1;
  16965. }
  16966. return module;
  16967. };
  16968. /***/ }),
  16969. /* 14 */
  16970. /***/ (function(module, exports, __webpack_require__) {
  16971. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  16972. * jQuery JavaScript Library v3.3.1
  16973. * https://jquery.com/
  16974. *
  16975. * Includes Sizzle.js
  16976. * https://sizzlejs.com/
  16977. *
  16978. * Copyright JS Foundation and other contributors
  16979. * Released under the MIT license
  16980. * https://jquery.org/license
  16981. *
  16982. * Date: 2018-01-20T17:24Z
  16983. */
  16984. ( function( global, factory ) {
  16985. "use strict";
  16986. if ( typeof module === "object" && typeof module.exports === "object" ) {
  16987. // For CommonJS and CommonJS-like environments where a proper `window`
  16988. // is present, execute the factory and get jQuery.
  16989. // For environments that do not have a `window` with a `document`
  16990. // (such as Node.js), expose a factory as module.exports.
  16991. // This accentuates the need for the creation of a real `window`.
  16992. // e.g. var jQuery = require("jquery")(window);
  16993. // See ticket #14549 for more info.
  16994. module.exports = global.document ?
  16995. factory( global, true ) :
  16996. function( w ) {
  16997. if ( !w.document ) {
  16998. throw new Error( "jQuery requires a window with a document" );
  16999. }
  17000. return factory( w );
  17001. };
  17002. } else {
  17003. factory( global );
  17004. }
  17005. // Pass this if window is not defined yet
  17006. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  17007. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  17008. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  17009. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  17010. // enough that all such attempts are guarded in a try block.
  17011. "use strict";
  17012. var arr = [];
  17013. var document = window.document;
  17014. var getProto = Object.getPrototypeOf;
  17015. var slice = arr.slice;
  17016. var concat = arr.concat;
  17017. var push = arr.push;
  17018. var indexOf = arr.indexOf;
  17019. var class2type = {};
  17020. var toString = class2type.toString;
  17021. var hasOwn = class2type.hasOwnProperty;
  17022. var fnToString = hasOwn.toString;
  17023. var ObjectFunctionString = fnToString.call( Object );
  17024. var support = {};
  17025. var isFunction = function isFunction( obj ) {
  17026. // Support: Chrome <=57, Firefox <=52
  17027. // In some browsers, typeof returns "function" for HTML <object> elements
  17028. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  17029. // We don't want to classify *any* DOM node as a function.
  17030. return typeof obj === "function" && typeof obj.nodeType !== "number";
  17031. };
  17032. var isWindow = function isWindow( obj ) {
  17033. return obj != null && obj === obj.window;
  17034. };
  17035. var preservedScriptAttributes = {
  17036. type: true,
  17037. src: true,
  17038. noModule: true
  17039. };
  17040. function DOMEval( code, doc, node ) {
  17041. doc = doc || document;
  17042. var i,
  17043. script = doc.createElement( "script" );
  17044. script.text = code;
  17045. if ( node ) {
  17046. for ( i in preservedScriptAttributes ) {
  17047. if ( node[ i ] ) {
  17048. script[ i ] = node[ i ];
  17049. }
  17050. }
  17051. }
  17052. doc.head.appendChild( script ).parentNode.removeChild( script );
  17053. }
  17054. function toType( obj ) {
  17055. if ( obj == null ) {
  17056. return obj + "";
  17057. }
  17058. // Support: Android <=2.3 only (functionish RegExp)
  17059. return typeof obj === "object" || typeof obj === "function" ?
  17060. class2type[ toString.call( obj ) ] || "object" :
  17061. typeof obj;
  17062. }
  17063. /* global Symbol */
  17064. // Defining this global in .eslintrc.json would create a danger of using the global
  17065. // unguarded in another place, it seems safer to define global only for this module
  17066. var
  17067. version = "3.3.1",
  17068. // Define a local copy of jQuery
  17069. jQuery = function( selector, context ) {
  17070. // The jQuery object is actually just the init constructor 'enhanced'
  17071. // Need init if jQuery is called (just allow error to be thrown if not included)
  17072. return new jQuery.fn.init( selector, context );
  17073. },
  17074. // Support: Android <=4.0 only
  17075. // Make sure we trim BOM and NBSP
  17076. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  17077. jQuery.fn = jQuery.prototype = {
  17078. // The current version of jQuery being used
  17079. jquery: version,
  17080. constructor: jQuery,
  17081. // The default length of a jQuery object is 0
  17082. length: 0,
  17083. toArray: function() {
  17084. return slice.call( this );
  17085. },
  17086. // Get the Nth element in the matched element set OR
  17087. // Get the whole matched element set as a clean array
  17088. get: function( num ) {
  17089. // Return all the elements in a clean array
  17090. if ( num == null ) {
  17091. return slice.call( this );
  17092. }
  17093. // Return just the one element from the set
  17094. return num < 0 ? this[ num + this.length ] : this[ num ];
  17095. },
  17096. // Take an array of elements and push it onto the stack
  17097. // (returning the new matched element set)
  17098. pushStack: function( elems ) {
  17099. // Build a new jQuery matched element set
  17100. var ret = jQuery.merge( this.constructor(), elems );
  17101. // Add the old object onto the stack (as a reference)
  17102. ret.prevObject = this;
  17103. // Return the newly-formed element set
  17104. return ret;
  17105. },
  17106. // Execute a callback for every element in the matched set.
  17107. each: function( callback ) {
  17108. return jQuery.each( this, callback );
  17109. },
  17110. map: function( callback ) {
  17111. return this.pushStack( jQuery.map( this, function( elem, i ) {
  17112. return callback.call( elem, i, elem );
  17113. } ) );
  17114. },
  17115. slice: function() {
  17116. return this.pushStack( slice.apply( this, arguments ) );
  17117. },
  17118. first: function() {
  17119. return this.eq( 0 );
  17120. },
  17121. last: function() {
  17122. return this.eq( -1 );
  17123. },
  17124. eq: function( i ) {
  17125. var len = this.length,
  17126. j = +i + ( i < 0 ? len : 0 );
  17127. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  17128. },
  17129. end: function() {
  17130. return this.prevObject || this.constructor();
  17131. },
  17132. // For internal use only.
  17133. // Behaves like an Array's method, not like a jQuery method.
  17134. push: push,
  17135. sort: arr.sort,
  17136. splice: arr.splice
  17137. };
  17138. jQuery.extend = jQuery.fn.extend = function() {
  17139. var options, name, src, copy, copyIsArray, clone,
  17140. target = arguments[ 0 ] || {},
  17141. i = 1,
  17142. length = arguments.length,
  17143. deep = false;
  17144. // Handle a deep copy situation
  17145. if ( typeof target === "boolean" ) {
  17146. deep = target;
  17147. // Skip the boolean and the target
  17148. target = arguments[ i ] || {};
  17149. i++;
  17150. }
  17151. // Handle case when target is a string or something (possible in deep copy)
  17152. if ( typeof target !== "object" && !isFunction( target ) ) {
  17153. target = {};
  17154. }
  17155. // Extend jQuery itself if only one argument is passed
  17156. if ( i === length ) {
  17157. target = this;
  17158. i--;
  17159. }
  17160. for ( ; i < length; i++ ) {
  17161. // Only deal with non-null/undefined values
  17162. if ( ( options = arguments[ i ] ) != null ) {
  17163. // Extend the base object
  17164. for ( name in options ) {
  17165. src = target[ name ];
  17166. copy = options[ name ];
  17167. // Prevent never-ending loop
  17168. if ( target === copy ) {
  17169. continue;
  17170. }
  17171. // Recurse if we're merging plain objects or arrays
  17172. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  17173. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  17174. if ( copyIsArray ) {
  17175. copyIsArray = false;
  17176. clone = src && Array.isArray( src ) ? src : [];
  17177. } else {
  17178. clone = src && jQuery.isPlainObject( src ) ? src : {};
  17179. }
  17180. // Never move original objects, clone them
  17181. target[ name ] = jQuery.extend( deep, clone, copy );
  17182. // Don't bring in undefined values
  17183. } else if ( copy !== undefined ) {
  17184. target[ name ] = copy;
  17185. }
  17186. }
  17187. }
  17188. }
  17189. // Return the modified object
  17190. return target;
  17191. };
  17192. jQuery.extend( {
  17193. // Unique for each copy of jQuery on the page
  17194. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  17195. // Assume jQuery is ready without the ready module
  17196. isReady: true,
  17197. error: function( msg ) {
  17198. throw new Error( msg );
  17199. },
  17200. noop: function() {},
  17201. isPlainObject: function( obj ) {
  17202. var proto, Ctor;
  17203. // Detect obvious negatives
  17204. // Use toString instead of jQuery.type to catch host objects
  17205. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  17206. return false;
  17207. }
  17208. proto = getProto( obj );
  17209. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  17210. if ( !proto ) {
  17211. return true;
  17212. }
  17213. // Objects with prototype are plain iff they were constructed by a global Object function
  17214. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  17215. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  17216. },
  17217. isEmptyObject: function( obj ) {
  17218. /* eslint-disable no-unused-vars */
  17219. // See https://github.com/eslint/eslint/issues/6125
  17220. var name;
  17221. for ( name in obj ) {
  17222. return false;
  17223. }
  17224. return true;
  17225. },
  17226. // Evaluates a script in a global context
  17227. globalEval: function( code ) {
  17228. DOMEval( code );
  17229. },
  17230. each: function( obj, callback ) {
  17231. var length, i = 0;
  17232. if ( isArrayLike( obj ) ) {
  17233. length = obj.length;
  17234. for ( ; i < length; i++ ) {
  17235. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17236. break;
  17237. }
  17238. }
  17239. } else {
  17240. for ( i in obj ) {
  17241. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17242. break;
  17243. }
  17244. }
  17245. }
  17246. return obj;
  17247. },
  17248. // Support: Android <=4.0 only
  17249. trim: function( text ) {
  17250. return text == null ?
  17251. "" :
  17252. ( text + "" ).replace( rtrim, "" );
  17253. },
  17254. // results is for internal usage only
  17255. makeArray: function( arr, results ) {
  17256. var ret = results || [];
  17257. if ( arr != null ) {
  17258. if ( isArrayLike( Object( arr ) ) ) {
  17259. jQuery.merge( ret,
  17260. typeof arr === "string" ?
  17261. [ arr ] : arr
  17262. );
  17263. } else {
  17264. push.call( ret, arr );
  17265. }
  17266. }
  17267. return ret;
  17268. },
  17269. inArray: function( elem, arr, i ) {
  17270. return arr == null ? -1 : indexOf.call( arr, elem, i );
  17271. },
  17272. // Support: Android <=4.0 only, PhantomJS 1 only
  17273. // push.apply(_, arraylike) throws on ancient WebKit
  17274. merge: function( first, second ) {
  17275. var len = +second.length,
  17276. j = 0,
  17277. i = first.length;
  17278. for ( ; j < len; j++ ) {
  17279. first[ i++ ] = second[ j ];
  17280. }
  17281. first.length = i;
  17282. return first;
  17283. },
  17284. grep: function( elems, callback, invert ) {
  17285. var callbackInverse,
  17286. matches = [],
  17287. i = 0,
  17288. length = elems.length,
  17289. callbackExpect = !invert;
  17290. // Go through the array, only saving the items
  17291. // that pass the validator function
  17292. for ( ; i < length; i++ ) {
  17293. callbackInverse = !callback( elems[ i ], i );
  17294. if ( callbackInverse !== callbackExpect ) {
  17295. matches.push( elems[ i ] );
  17296. }
  17297. }
  17298. return matches;
  17299. },
  17300. // arg is for internal usage only
  17301. map: function( elems, callback, arg ) {
  17302. var length, value,
  17303. i = 0,
  17304. ret = [];
  17305. // Go through the array, translating each of the items to their new values
  17306. if ( isArrayLike( elems ) ) {
  17307. length = elems.length;
  17308. for ( ; i < length; i++ ) {
  17309. value = callback( elems[ i ], i, arg );
  17310. if ( value != null ) {
  17311. ret.push( value );
  17312. }
  17313. }
  17314. // Go through every key on the object,
  17315. } else {
  17316. for ( i in elems ) {
  17317. value = callback( elems[ i ], i, arg );
  17318. if ( value != null ) {
  17319. ret.push( value );
  17320. }
  17321. }
  17322. }
  17323. // Flatten any nested arrays
  17324. return concat.apply( [], ret );
  17325. },
  17326. // A global GUID counter for objects
  17327. guid: 1,
  17328. // jQuery.support is not used in Core but other projects attach their
  17329. // properties to it so it needs to exist.
  17330. support: support
  17331. } );
  17332. if ( typeof Symbol === "function" ) {
  17333. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  17334. }
  17335. // Populate the class2type map
  17336. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  17337. function( i, name ) {
  17338. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  17339. } );
  17340. function isArrayLike( obj ) {
  17341. // Support: real iOS 8.2 only (not reproducible in simulator)
  17342. // `in` check used to prevent JIT error (gh-2145)
  17343. // hasOwn isn't used here due to false negatives
  17344. // regarding Nodelist length in IE
  17345. var length = !!obj && "length" in obj && obj.length,
  17346. type = toType( obj );
  17347. if ( isFunction( obj ) || isWindow( obj ) ) {
  17348. return false;
  17349. }
  17350. return type === "array" || length === 0 ||
  17351. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  17352. }
  17353. var Sizzle =
  17354. /*!
  17355. * Sizzle CSS Selector Engine v2.3.3
  17356. * https://sizzlejs.com/
  17357. *
  17358. * Copyright jQuery Foundation and other contributors
  17359. * Released under the MIT license
  17360. * http://jquery.org/license
  17361. *
  17362. * Date: 2016-08-08
  17363. */
  17364. (function( window ) {
  17365. var i,
  17366. support,
  17367. Expr,
  17368. getText,
  17369. isXML,
  17370. tokenize,
  17371. compile,
  17372. select,
  17373. outermostContext,
  17374. sortInput,
  17375. hasDuplicate,
  17376. // Local document vars
  17377. setDocument,
  17378. document,
  17379. docElem,
  17380. documentIsHTML,
  17381. rbuggyQSA,
  17382. rbuggyMatches,
  17383. matches,
  17384. contains,
  17385. // Instance-specific data
  17386. expando = "sizzle" + 1 * new Date(),
  17387. preferredDoc = window.document,
  17388. dirruns = 0,
  17389. done = 0,
  17390. classCache = createCache(),
  17391. tokenCache = createCache(),
  17392. compilerCache = createCache(),
  17393. sortOrder = function( a, b ) {
  17394. if ( a === b ) {
  17395. hasDuplicate = true;
  17396. }
  17397. return 0;
  17398. },
  17399. // Instance methods
  17400. hasOwn = ({}).hasOwnProperty,
  17401. arr = [],
  17402. pop = arr.pop,
  17403. push_native = arr.push,
  17404. push = arr.push,
  17405. slice = arr.slice,
  17406. // Use a stripped-down indexOf as it's faster than native
  17407. // https://jsperf.com/thor-indexof-vs-for/5
  17408. indexOf = function( list, elem ) {
  17409. var i = 0,
  17410. len = list.length;
  17411. for ( ; i < len; i++ ) {
  17412. if ( list[i] === elem ) {
  17413. return i;
  17414. }
  17415. }
  17416. return -1;
  17417. },
  17418. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  17419. // Regular expressions
  17420. // http://www.w3.org/TR/css3-selectors/#whitespace
  17421. whitespace = "[\\x20\\t\\r\\n\\f]",
  17422. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  17423. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  17424. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  17425. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  17426. // Operator (capture 2)
  17427. "*([*^$|!~]?=)" + whitespace +
  17428. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  17429. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  17430. "*\\]",
  17431. pseudos = ":(" + identifier + ")(?:\\((" +
  17432. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  17433. // 1. quoted (capture 3; capture 4 or capture 5)
  17434. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  17435. // 2. simple (capture 6)
  17436. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  17437. // 3. anything else (capture 2)
  17438. ".*" +
  17439. ")\\)|)",
  17440. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  17441. rwhitespace = new RegExp( whitespace + "+", "g" ),
  17442. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  17443. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  17444. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  17445. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  17446. rpseudo = new RegExp( pseudos ),
  17447. ridentifier = new RegExp( "^" + identifier + "$" ),
  17448. matchExpr = {
  17449. "ID": new RegExp( "^#(" + identifier + ")" ),
  17450. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  17451. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  17452. "ATTR": new RegExp( "^" + attributes ),
  17453. "PSEUDO": new RegExp( "^" + pseudos ),
  17454. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  17455. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  17456. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  17457. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  17458. // For use in libraries implementing .is()
  17459. // We use this for POS matching in `select`
  17460. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  17461. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  17462. },
  17463. rinputs = /^(?:input|select|textarea|button)$/i,
  17464. rheader = /^h\d$/i,
  17465. rnative = /^[^{]+\{\s*\[native \w/,
  17466. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  17467. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  17468. rsibling = /[+~]/,
  17469. // CSS escapes
  17470. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  17471. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  17472. funescape = function( _, escaped, escapedWhitespace ) {
  17473. var high = "0x" + escaped - 0x10000;
  17474. // NaN means non-codepoint
  17475. // Support: Firefox<24
  17476. // Workaround erroneous numeric interpretation of +"0x"
  17477. return high !== high || escapedWhitespace ?
  17478. escaped :
  17479. high < 0 ?
  17480. // BMP codepoint
  17481. String.fromCharCode( high + 0x10000 ) :
  17482. // Supplemental Plane codepoint (surrogate pair)
  17483. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  17484. },
  17485. // CSS string/identifier serialization
  17486. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  17487. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  17488. fcssescape = function( ch, asCodePoint ) {
  17489. if ( asCodePoint ) {
  17490. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  17491. if ( ch === "\0" ) {
  17492. return "\uFFFD";
  17493. }
  17494. // Control characters and (dependent upon position) numbers get escaped as code points
  17495. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  17496. }
  17497. // Other potentially-special ASCII characters get backslash-escaped
  17498. return "\\" + ch;
  17499. },
  17500. // Used for iframes
  17501. // See setDocument()
  17502. // Removing the function wrapper causes a "Permission Denied"
  17503. // error in IE
  17504. unloadHandler = function() {
  17505. setDocument();
  17506. },
  17507. disabledAncestor = addCombinator(
  17508. function( elem ) {
  17509. return elem.disabled === true && ("form" in elem || "label" in elem);
  17510. },
  17511. { dir: "parentNode", next: "legend" }
  17512. );
  17513. // Optimize for push.apply( _, NodeList )
  17514. try {
  17515. push.apply(
  17516. (arr = slice.call( preferredDoc.childNodes )),
  17517. preferredDoc.childNodes
  17518. );
  17519. // Support: Android<4.0
  17520. // Detect silently failing push.apply
  17521. arr[ preferredDoc.childNodes.length ].nodeType;
  17522. } catch ( e ) {
  17523. push = { apply: arr.length ?
  17524. // Leverage slice if possible
  17525. function( target, els ) {
  17526. push_native.apply( target, slice.call(els) );
  17527. } :
  17528. // Support: IE<9
  17529. // Otherwise append directly
  17530. function( target, els ) {
  17531. var j = target.length,
  17532. i = 0;
  17533. // Can't trust NodeList.length
  17534. while ( (target[j++] = els[i++]) ) {}
  17535. target.length = j - 1;
  17536. }
  17537. };
  17538. }
  17539. function Sizzle( selector, context, results, seed ) {
  17540. var m, i, elem, nid, match, groups, newSelector,
  17541. newContext = context && context.ownerDocument,
  17542. // nodeType defaults to 9, since context defaults to document
  17543. nodeType = context ? context.nodeType : 9;
  17544. results = results || [];
  17545. // Return early from calls with invalid selector or context
  17546. if ( typeof selector !== "string" || !selector ||
  17547. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  17548. return results;
  17549. }
  17550. // Try to shortcut find operations (as opposed to filters) in HTML documents
  17551. if ( !seed ) {
  17552. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  17553. setDocument( context );
  17554. }
  17555. context = context || document;
  17556. if ( documentIsHTML ) {
  17557. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  17558. // (excepting DocumentFragment context, where the methods don't exist)
  17559. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  17560. // ID selector
  17561. if ( (m = match[1]) ) {
  17562. // Document context
  17563. if ( nodeType === 9 ) {
  17564. if ( (elem = context.getElementById( m )) ) {
  17565. // Support: IE, Opera, Webkit
  17566. // TODO: identify versions
  17567. // getElementById can match elements by name instead of ID
  17568. if ( elem.id === m ) {
  17569. results.push( elem );
  17570. return results;
  17571. }
  17572. } else {
  17573. return results;
  17574. }
  17575. // Element context
  17576. } else {
  17577. // Support: IE, Opera, Webkit
  17578. // TODO: identify versions
  17579. // getElementById can match elements by name instead of ID
  17580. if ( newContext && (elem = newContext.getElementById( m )) &&
  17581. contains( context, elem ) &&
  17582. elem.id === m ) {
  17583. results.push( elem );
  17584. return results;
  17585. }
  17586. }
  17587. // Type selector
  17588. } else if ( match[2] ) {
  17589. push.apply( results, context.getElementsByTagName( selector ) );
  17590. return results;
  17591. // Class selector
  17592. } else if ( (m = match[3]) && support.getElementsByClassName &&
  17593. context.getElementsByClassName ) {
  17594. push.apply( results, context.getElementsByClassName( m ) );
  17595. return results;
  17596. }
  17597. }
  17598. // Take advantage of querySelectorAll
  17599. if ( support.qsa &&
  17600. !compilerCache[ selector + " " ] &&
  17601. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  17602. if ( nodeType !== 1 ) {
  17603. newContext = context;
  17604. newSelector = selector;
  17605. // qSA looks outside Element context, which is not what we want
  17606. // Thanks to Andrew Dupont for this workaround technique
  17607. // Support: IE <=8
  17608. // Exclude object elements
  17609. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  17610. // Capture the context ID, setting it first if necessary
  17611. if ( (nid = context.getAttribute( "id" )) ) {
  17612. nid = nid.replace( rcssescape, fcssescape );
  17613. } else {
  17614. context.setAttribute( "id", (nid = expando) );
  17615. }
  17616. // Prefix every selector in the list
  17617. groups = tokenize( selector );
  17618. i = groups.length;
  17619. while ( i-- ) {
  17620. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  17621. }
  17622. newSelector = groups.join( "," );
  17623. // Expand context for sibling selectors
  17624. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  17625. context;
  17626. }
  17627. if ( newSelector ) {
  17628. try {
  17629. push.apply( results,
  17630. newContext.querySelectorAll( newSelector )
  17631. );
  17632. return results;
  17633. } catch ( qsaError ) {
  17634. } finally {
  17635. if ( nid === expando ) {
  17636. context.removeAttribute( "id" );
  17637. }
  17638. }
  17639. }
  17640. }
  17641. }
  17642. }
  17643. // All others
  17644. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  17645. }
  17646. /**
  17647. * Create key-value caches of limited size
  17648. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  17649. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  17650. * deleting the oldest entry
  17651. */
  17652. function createCache() {
  17653. var keys = [];
  17654. function cache( key, value ) {
  17655. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  17656. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  17657. // Only keep the most recent entries
  17658. delete cache[ keys.shift() ];
  17659. }
  17660. return (cache[ key + " " ] = value);
  17661. }
  17662. return cache;
  17663. }
  17664. /**
  17665. * Mark a function for special use by Sizzle
  17666. * @param {Function} fn The function to mark
  17667. */
  17668. function markFunction( fn ) {
  17669. fn[ expando ] = true;
  17670. return fn;
  17671. }
  17672. /**
  17673. * Support testing using an element
  17674. * @param {Function} fn Passed the created element and returns a boolean result
  17675. */
  17676. function assert( fn ) {
  17677. var el = document.createElement("fieldset");
  17678. try {
  17679. return !!fn( el );
  17680. } catch (e) {
  17681. return false;
  17682. } finally {
  17683. // Remove from its parent by default
  17684. if ( el.parentNode ) {
  17685. el.parentNode.removeChild( el );
  17686. }
  17687. // release memory in IE
  17688. el = null;
  17689. }
  17690. }
  17691. /**
  17692. * Adds the same handler for all of the specified attrs
  17693. * @param {String} attrs Pipe-separated list of attributes
  17694. * @param {Function} handler The method that will be applied
  17695. */
  17696. function addHandle( attrs, handler ) {
  17697. var arr = attrs.split("|"),
  17698. i = arr.length;
  17699. while ( i-- ) {
  17700. Expr.attrHandle[ arr[i] ] = handler;
  17701. }
  17702. }
  17703. /**
  17704. * Checks document order of two siblings
  17705. * @param {Element} a
  17706. * @param {Element} b
  17707. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  17708. */
  17709. function siblingCheck( a, b ) {
  17710. var cur = b && a,
  17711. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  17712. a.sourceIndex - b.sourceIndex;
  17713. // Use IE sourceIndex if available on both nodes
  17714. if ( diff ) {
  17715. return diff;
  17716. }
  17717. // Check if b follows a
  17718. if ( cur ) {
  17719. while ( (cur = cur.nextSibling) ) {
  17720. if ( cur === b ) {
  17721. return -1;
  17722. }
  17723. }
  17724. }
  17725. return a ? 1 : -1;
  17726. }
  17727. /**
  17728. * Returns a function to use in pseudos for input types
  17729. * @param {String} type
  17730. */
  17731. function createInputPseudo( type ) {
  17732. return function( elem ) {
  17733. var name = elem.nodeName.toLowerCase();
  17734. return name === "input" && elem.type === type;
  17735. };
  17736. }
  17737. /**
  17738. * Returns a function to use in pseudos for buttons
  17739. * @param {String} type
  17740. */
  17741. function createButtonPseudo( type ) {
  17742. return function( elem ) {
  17743. var name = elem.nodeName.toLowerCase();
  17744. return (name === "input" || name === "button") && elem.type === type;
  17745. };
  17746. }
  17747. /**
  17748. * Returns a function to use in pseudos for :enabled/:disabled
  17749. * @param {Boolean} disabled true for :disabled; false for :enabled
  17750. */
  17751. function createDisabledPseudo( disabled ) {
  17752. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  17753. return function( elem ) {
  17754. // Only certain elements can match :enabled or :disabled
  17755. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  17756. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  17757. if ( "form" in elem ) {
  17758. // Check for inherited disabledness on relevant non-disabled elements:
  17759. // * listed form-associated elements in a disabled fieldset
  17760. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  17761. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  17762. // * option elements in a disabled optgroup
  17763. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  17764. // All such elements have a "form" property.
  17765. if ( elem.parentNode && elem.disabled === false ) {
  17766. // Option elements defer to a parent optgroup if present
  17767. if ( "label" in elem ) {
  17768. if ( "label" in elem.parentNode ) {
  17769. return elem.parentNode.disabled === disabled;
  17770. } else {
  17771. return elem.disabled === disabled;
  17772. }
  17773. }
  17774. // Support: IE 6 - 11
  17775. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  17776. return elem.isDisabled === disabled ||
  17777. // Where there is no isDisabled, check manually
  17778. /* jshint -W018 */
  17779. elem.isDisabled !== !disabled &&
  17780. disabledAncestor( elem ) === disabled;
  17781. }
  17782. return elem.disabled === disabled;
  17783. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  17784. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  17785. // even exist on them, let alone have a boolean value.
  17786. } else if ( "label" in elem ) {
  17787. return elem.disabled === disabled;
  17788. }
  17789. // Remaining elements are neither :enabled nor :disabled
  17790. return false;
  17791. };
  17792. }
  17793. /**
  17794. * Returns a function to use in pseudos for positionals
  17795. * @param {Function} fn
  17796. */
  17797. function createPositionalPseudo( fn ) {
  17798. return markFunction(function( argument ) {
  17799. argument = +argument;
  17800. return markFunction(function( seed, matches ) {
  17801. var j,
  17802. matchIndexes = fn( [], seed.length, argument ),
  17803. i = matchIndexes.length;
  17804. // Match elements found at the specified indexes
  17805. while ( i-- ) {
  17806. if ( seed[ (j = matchIndexes[i]) ] ) {
  17807. seed[j] = !(matches[j] = seed[j]);
  17808. }
  17809. }
  17810. });
  17811. });
  17812. }
  17813. /**
  17814. * Checks a node for validity as a Sizzle context
  17815. * @param {Element|Object=} context
  17816. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  17817. */
  17818. function testContext( context ) {
  17819. return context && typeof context.getElementsByTagName !== "undefined" && context;
  17820. }
  17821. // Expose support vars for convenience
  17822. support = Sizzle.support = {};
  17823. /**
  17824. * Detects XML nodes
  17825. * @param {Element|Object} elem An element or a document
  17826. * @returns {Boolean} True iff elem is a non-HTML XML node
  17827. */
  17828. isXML = Sizzle.isXML = function( elem ) {
  17829. // documentElement is verified for cases where it doesn't yet exist
  17830. // (such as loading iframes in IE - #4833)
  17831. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  17832. return documentElement ? documentElement.nodeName !== "HTML" : false;
  17833. };
  17834. /**
  17835. * Sets document-related variables once based on the current document
  17836. * @param {Element|Object} [doc] An element or document object to use to set the document
  17837. * @returns {Object} Returns the current document
  17838. */
  17839. setDocument = Sizzle.setDocument = function( node ) {
  17840. var hasCompare, subWindow,
  17841. doc = node ? node.ownerDocument || node : preferredDoc;
  17842. // Return early if doc is invalid or already selected
  17843. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  17844. return document;
  17845. }
  17846. // Update global variables
  17847. document = doc;
  17848. docElem = document.documentElement;
  17849. documentIsHTML = !isXML( document );
  17850. // Support: IE 9-11, Edge
  17851. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  17852. if ( preferredDoc !== document &&
  17853. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  17854. // Support: IE 11, Edge
  17855. if ( subWindow.addEventListener ) {
  17856. subWindow.addEventListener( "unload", unloadHandler, false );
  17857. // Support: IE 9 - 10 only
  17858. } else if ( subWindow.attachEvent ) {
  17859. subWindow.attachEvent( "onunload", unloadHandler );
  17860. }
  17861. }
  17862. /* Attributes
  17863. ---------------------------------------------------------------------- */
  17864. // Support: IE<8
  17865. // Verify that getAttribute really returns attributes and not properties
  17866. // (excepting IE8 booleans)
  17867. support.attributes = assert(function( el ) {
  17868. el.className = "i";
  17869. return !el.getAttribute("className");
  17870. });
  17871. /* getElement(s)By*
  17872. ---------------------------------------------------------------------- */
  17873. // Check if getElementsByTagName("*") returns only elements
  17874. support.getElementsByTagName = assert(function( el ) {
  17875. el.appendChild( document.createComment("") );
  17876. return !el.getElementsByTagName("*").length;
  17877. });
  17878. // Support: IE<9
  17879. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  17880. // Support: IE<10
  17881. // Check if getElementById returns elements by name
  17882. // The broken getElementById methods don't pick up programmatically-set names,
  17883. // so use a roundabout getElementsByName test
  17884. support.getById = assert(function( el ) {
  17885. docElem.appendChild( el ).id = expando;
  17886. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  17887. });
  17888. // ID filter and find
  17889. if ( support.getById ) {
  17890. Expr.filter["ID"] = function( id ) {
  17891. var attrId = id.replace( runescape, funescape );
  17892. return function( elem ) {
  17893. return elem.getAttribute("id") === attrId;
  17894. };
  17895. };
  17896. Expr.find["ID"] = function( id, context ) {
  17897. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  17898. var elem = context.getElementById( id );
  17899. return elem ? [ elem ] : [];
  17900. }
  17901. };
  17902. } else {
  17903. Expr.filter["ID"] = function( id ) {
  17904. var attrId = id.replace( runescape, funescape );
  17905. return function( elem ) {
  17906. var node = typeof elem.getAttributeNode !== "undefined" &&
  17907. elem.getAttributeNode("id");
  17908. return node && node.value === attrId;
  17909. };
  17910. };
  17911. // Support: IE 6 - 7 only
  17912. // getElementById is not reliable as a find shortcut
  17913. Expr.find["ID"] = function( id, context ) {
  17914. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  17915. var node, i, elems,
  17916. elem = context.getElementById( id );
  17917. if ( elem ) {
  17918. // Verify the id attribute
  17919. node = elem.getAttributeNode("id");
  17920. if ( node && node.value === id ) {
  17921. return [ elem ];
  17922. }
  17923. // Fall back on getElementsByName
  17924. elems = context.getElementsByName( id );
  17925. i = 0;
  17926. while ( (elem = elems[i++]) ) {
  17927. node = elem.getAttributeNode("id");
  17928. if ( node && node.value === id ) {
  17929. return [ elem ];
  17930. }
  17931. }
  17932. }
  17933. return [];
  17934. }
  17935. };
  17936. }
  17937. // Tag
  17938. Expr.find["TAG"] = support.getElementsByTagName ?
  17939. function( tag, context ) {
  17940. if ( typeof context.getElementsByTagName !== "undefined" ) {
  17941. return context.getElementsByTagName( tag );
  17942. // DocumentFragment nodes don't have gEBTN
  17943. } else if ( support.qsa ) {
  17944. return context.querySelectorAll( tag );
  17945. }
  17946. } :
  17947. function( tag, context ) {
  17948. var elem,
  17949. tmp = [],
  17950. i = 0,
  17951. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  17952. results = context.getElementsByTagName( tag );
  17953. // Filter out possible comments
  17954. if ( tag === "*" ) {
  17955. while ( (elem = results[i++]) ) {
  17956. if ( elem.nodeType === 1 ) {
  17957. tmp.push( elem );
  17958. }
  17959. }
  17960. return tmp;
  17961. }
  17962. return results;
  17963. };
  17964. // Class
  17965. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  17966. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  17967. return context.getElementsByClassName( className );
  17968. }
  17969. };
  17970. /* QSA/matchesSelector
  17971. ---------------------------------------------------------------------- */
  17972. // QSA and matchesSelector support
  17973. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  17974. rbuggyMatches = [];
  17975. // qSa(:focus) reports false when true (Chrome 21)
  17976. // We allow this because of a bug in IE8/9 that throws an error
  17977. // whenever `document.activeElement` is accessed on an iframe
  17978. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  17979. // See https://bugs.jquery.com/ticket/13378
  17980. rbuggyQSA = [];
  17981. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  17982. // Build QSA regex
  17983. // Regex strategy adopted from Diego Perini
  17984. assert(function( el ) {
  17985. // Select is set to empty string on purpose
  17986. // This is to test IE's treatment of not explicitly
  17987. // setting a boolean content attribute,
  17988. // since its presence should be enough
  17989. // https://bugs.jquery.com/ticket/12359
  17990. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  17991. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  17992. "<option selected=''></option></select>";
  17993. // Support: IE8, Opera 11-12.16
  17994. // Nothing should be selected when empty strings follow ^= or $= or *=
  17995. // The test attribute must be unknown in Opera but "safe" for WinRT
  17996. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  17997. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  17998. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  17999. }
  18000. // Support: IE8
  18001. // Boolean attributes and "value" are not treated correctly
  18002. if ( !el.querySelectorAll("[selected]").length ) {
  18003. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  18004. }
  18005. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  18006. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  18007. rbuggyQSA.push("~=");
  18008. }
  18009. // Webkit/Opera - :checked should return selected option elements
  18010. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  18011. // IE8 throws error here and will not see later tests
  18012. if ( !el.querySelectorAll(":checked").length ) {
  18013. rbuggyQSA.push(":checked");
  18014. }
  18015. // Support: Safari 8+, iOS 8+
  18016. // https://bugs.webkit.org/show_bug.cgi?id=136851
  18017. // In-page `selector#id sibling-combinator selector` fails
  18018. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  18019. rbuggyQSA.push(".#.+[+~]");
  18020. }
  18021. });
  18022. assert(function( el ) {
  18023. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  18024. "<select disabled='disabled'><option/></select>";
  18025. // Support: Windows 8 Native Apps
  18026. // The type and name attributes are restricted during .innerHTML assignment
  18027. var input = document.createElement("input");
  18028. input.setAttribute( "type", "hidden" );
  18029. el.appendChild( input ).setAttribute( "name", "D" );
  18030. // Support: IE8
  18031. // Enforce case-sensitivity of name attribute
  18032. if ( el.querySelectorAll("[name=d]").length ) {
  18033. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  18034. }
  18035. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  18036. // IE8 throws error here and will not see later tests
  18037. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  18038. rbuggyQSA.push( ":enabled", ":disabled" );
  18039. }
  18040. // Support: IE9-11+
  18041. // IE's :disabled selector does not pick up the children of disabled fieldsets
  18042. docElem.appendChild( el ).disabled = true;
  18043. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  18044. rbuggyQSA.push( ":enabled", ":disabled" );
  18045. }
  18046. // Opera 10-11 does not throw on post-comma invalid pseudos
  18047. el.querySelectorAll("*,:x");
  18048. rbuggyQSA.push(",.*:");
  18049. });
  18050. }
  18051. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  18052. docElem.webkitMatchesSelector ||
  18053. docElem.mozMatchesSelector ||
  18054. docElem.oMatchesSelector ||
  18055. docElem.msMatchesSelector) )) ) {
  18056. assert(function( el ) {
  18057. // Check to see if it's possible to do matchesSelector
  18058. // on a disconnected node (IE 9)
  18059. support.disconnectedMatch = matches.call( el, "*" );
  18060. // This should fail with an exception
  18061. // Gecko does not error, returns false instead
  18062. matches.call( el, "[s!='']:x" );
  18063. rbuggyMatches.push( "!=", pseudos );
  18064. });
  18065. }
  18066. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  18067. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  18068. /* Contains
  18069. ---------------------------------------------------------------------- */
  18070. hasCompare = rnative.test( docElem.compareDocumentPosition );
  18071. // Element contains another
  18072. // Purposefully self-exclusive
  18073. // As in, an element does not contain itself
  18074. contains = hasCompare || rnative.test( docElem.contains ) ?
  18075. function( a, b ) {
  18076. var adown = a.nodeType === 9 ? a.documentElement : a,
  18077. bup = b && b.parentNode;
  18078. return a === bup || !!( bup && bup.nodeType === 1 && (
  18079. adown.contains ?
  18080. adown.contains( bup ) :
  18081. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  18082. ));
  18083. } :
  18084. function( a, b ) {
  18085. if ( b ) {
  18086. while ( (b = b.parentNode) ) {
  18087. if ( b === a ) {
  18088. return true;
  18089. }
  18090. }
  18091. }
  18092. return false;
  18093. };
  18094. /* Sorting
  18095. ---------------------------------------------------------------------- */
  18096. // Document order sorting
  18097. sortOrder = hasCompare ?
  18098. function( a, b ) {
  18099. // Flag for duplicate removal
  18100. if ( a === b ) {
  18101. hasDuplicate = true;
  18102. return 0;
  18103. }
  18104. // Sort on method existence if only one input has compareDocumentPosition
  18105. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  18106. if ( compare ) {
  18107. return compare;
  18108. }
  18109. // Calculate position if both inputs belong to the same document
  18110. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  18111. a.compareDocumentPosition( b ) :
  18112. // Otherwise we know they are disconnected
  18113. 1;
  18114. // Disconnected nodes
  18115. if ( compare & 1 ||
  18116. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  18117. // Choose the first element that is related to our preferred document
  18118. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  18119. return -1;
  18120. }
  18121. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  18122. return 1;
  18123. }
  18124. // Maintain original order
  18125. return sortInput ?
  18126. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  18127. 0;
  18128. }
  18129. return compare & 4 ? -1 : 1;
  18130. } :
  18131. function( a, b ) {
  18132. // Exit early if the nodes are identical
  18133. if ( a === b ) {
  18134. hasDuplicate = true;
  18135. return 0;
  18136. }
  18137. var cur,
  18138. i = 0,
  18139. aup = a.parentNode,
  18140. bup = b.parentNode,
  18141. ap = [ a ],
  18142. bp = [ b ];
  18143. // Parentless nodes are either documents or disconnected
  18144. if ( !aup || !bup ) {
  18145. return a === document ? -1 :
  18146. b === document ? 1 :
  18147. aup ? -1 :
  18148. bup ? 1 :
  18149. sortInput ?
  18150. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  18151. 0;
  18152. // If the nodes are siblings, we can do a quick check
  18153. } else if ( aup === bup ) {
  18154. return siblingCheck( a, b );
  18155. }
  18156. // Otherwise we need full lists of their ancestors for comparison
  18157. cur = a;
  18158. while ( (cur = cur.parentNode) ) {
  18159. ap.unshift( cur );
  18160. }
  18161. cur = b;
  18162. while ( (cur = cur.parentNode) ) {
  18163. bp.unshift( cur );
  18164. }
  18165. // Walk down the tree looking for a discrepancy
  18166. while ( ap[i] === bp[i] ) {
  18167. i++;
  18168. }
  18169. return i ?
  18170. // Do a sibling check if the nodes have a common ancestor
  18171. siblingCheck( ap[i], bp[i] ) :
  18172. // Otherwise nodes in our document sort first
  18173. ap[i] === preferredDoc ? -1 :
  18174. bp[i] === preferredDoc ? 1 :
  18175. 0;
  18176. };
  18177. return document;
  18178. };
  18179. Sizzle.matches = function( expr, elements ) {
  18180. return Sizzle( expr, null, null, elements );
  18181. };
  18182. Sizzle.matchesSelector = function( elem, expr ) {
  18183. // Set document vars if needed
  18184. if ( ( elem.ownerDocument || elem ) !== document ) {
  18185. setDocument( elem );
  18186. }
  18187. // Make sure that attribute selectors are quoted
  18188. expr = expr.replace( rattributeQuotes, "='$1']" );
  18189. if ( support.matchesSelector && documentIsHTML &&
  18190. !compilerCache[ expr + " " ] &&
  18191. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  18192. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  18193. try {
  18194. var ret = matches.call( elem, expr );
  18195. // IE 9's matchesSelector returns false on disconnected nodes
  18196. if ( ret || support.disconnectedMatch ||
  18197. // As well, disconnected nodes are said to be in a document
  18198. // fragment in IE 9
  18199. elem.document && elem.document.nodeType !== 11 ) {
  18200. return ret;
  18201. }
  18202. } catch (e) {}
  18203. }
  18204. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  18205. };
  18206. Sizzle.contains = function( context, elem ) {
  18207. // Set document vars if needed
  18208. if ( ( context.ownerDocument || context ) !== document ) {
  18209. setDocument( context );
  18210. }
  18211. return contains( context, elem );
  18212. };
  18213. Sizzle.attr = function( elem, name ) {
  18214. // Set document vars if needed
  18215. if ( ( elem.ownerDocument || elem ) !== document ) {
  18216. setDocument( elem );
  18217. }
  18218. var fn = Expr.attrHandle[ name.toLowerCase() ],
  18219. // Don't get fooled by Object.prototype properties (jQuery #13807)
  18220. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  18221. fn( elem, name, !documentIsHTML ) :
  18222. undefined;
  18223. return val !== undefined ?
  18224. val :
  18225. support.attributes || !documentIsHTML ?
  18226. elem.getAttribute( name ) :
  18227. (val = elem.getAttributeNode(name)) && val.specified ?
  18228. val.value :
  18229. null;
  18230. };
  18231. Sizzle.escape = function( sel ) {
  18232. return (sel + "").replace( rcssescape, fcssescape );
  18233. };
  18234. Sizzle.error = function( msg ) {
  18235. throw new Error( "Syntax error, unrecognized expression: " + msg );
  18236. };
  18237. /**
  18238. * Document sorting and removing duplicates
  18239. * @param {ArrayLike} results
  18240. */
  18241. Sizzle.uniqueSort = function( results ) {
  18242. var elem,
  18243. duplicates = [],
  18244. j = 0,
  18245. i = 0;
  18246. // Unless we *know* we can detect duplicates, assume their presence
  18247. hasDuplicate = !support.detectDuplicates;
  18248. sortInput = !support.sortStable && results.slice( 0 );
  18249. results.sort( sortOrder );
  18250. if ( hasDuplicate ) {
  18251. while ( (elem = results[i++]) ) {
  18252. if ( elem === results[ i ] ) {
  18253. j = duplicates.push( i );
  18254. }
  18255. }
  18256. while ( j-- ) {
  18257. results.splice( duplicates[ j ], 1 );
  18258. }
  18259. }
  18260. // Clear input after sorting to release objects
  18261. // See https://github.com/jquery/sizzle/pull/225
  18262. sortInput = null;
  18263. return results;
  18264. };
  18265. /**
  18266. * Utility function for retrieving the text value of an array of DOM nodes
  18267. * @param {Array|Element} elem
  18268. */
  18269. getText = Sizzle.getText = function( elem ) {
  18270. var node,
  18271. ret = "",
  18272. i = 0,
  18273. nodeType = elem.nodeType;
  18274. if ( !nodeType ) {
  18275. // If no nodeType, this is expected to be an array
  18276. while ( (node = elem[i++]) ) {
  18277. // Do not traverse comment nodes
  18278. ret += getText( node );
  18279. }
  18280. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  18281. // Use textContent for elements
  18282. // innerText usage removed for consistency of new lines (jQuery #11153)
  18283. if ( typeof elem.textContent === "string" ) {
  18284. return elem.textContent;
  18285. } else {
  18286. // Traverse its children
  18287. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18288. ret += getText( elem );
  18289. }
  18290. }
  18291. } else if ( nodeType === 3 || nodeType === 4 ) {
  18292. return elem.nodeValue;
  18293. }
  18294. // Do not include comment or processing instruction nodes
  18295. return ret;
  18296. };
  18297. Expr = Sizzle.selectors = {
  18298. // Can be adjusted by the user
  18299. cacheLength: 50,
  18300. createPseudo: markFunction,
  18301. match: matchExpr,
  18302. attrHandle: {},
  18303. find: {},
  18304. relative: {
  18305. ">": { dir: "parentNode", first: true },
  18306. " ": { dir: "parentNode" },
  18307. "+": { dir: "previousSibling", first: true },
  18308. "~": { dir: "previousSibling" }
  18309. },
  18310. preFilter: {
  18311. "ATTR": function( match ) {
  18312. match[1] = match[1].replace( runescape, funescape );
  18313. // Move the given value to match[3] whether quoted or unquoted
  18314. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  18315. if ( match[2] === "~=" ) {
  18316. match[3] = " " + match[3] + " ";
  18317. }
  18318. return match.slice( 0, 4 );
  18319. },
  18320. "CHILD": function( match ) {
  18321. /* matches from matchExpr["CHILD"]
  18322. 1 type (only|nth|...)
  18323. 2 what (child|of-type)
  18324. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  18325. 4 xn-component of xn+y argument ([+-]?\d*n|)
  18326. 5 sign of xn-component
  18327. 6 x of xn-component
  18328. 7 sign of y-component
  18329. 8 y of y-component
  18330. */
  18331. match[1] = match[1].toLowerCase();
  18332. if ( match[1].slice( 0, 3 ) === "nth" ) {
  18333. // nth-* requires argument
  18334. if ( !match[3] ) {
  18335. Sizzle.error( match[0] );
  18336. }
  18337. // numeric x and y parameters for Expr.filter.CHILD
  18338. // remember that false/true cast respectively to 0/1
  18339. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  18340. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  18341. // other types prohibit arguments
  18342. } else if ( match[3] ) {
  18343. Sizzle.error( match[0] );
  18344. }
  18345. return match;
  18346. },
  18347. "PSEUDO": function( match ) {
  18348. var excess,
  18349. unquoted = !match[6] && match[2];
  18350. if ( matchExpr["CHILD"].test( match[0] ) ) {
  18351. return null;
  18352. }
  18353. // Accept quoted arguments as-is
  18354. if ( match[3] ) {
  18355. match[2] = match[4] || match[5] || "";
  18356. // Strip excess characters from unquoted arguments
  18357. } else if ( unquoted && rpseudo.test( unquoted ) &&
  18358. // Get excess from tokenize (recursively)
  18359. (excess = tokenize( unquoted, true )) &&
  18360. // advance to the next closing parenthesis
  18361. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  18362. // excess is a negative index
  18363. match[0] = match[0].slice( 0, excess );
  18364. match[2] = unquoted.slice( 0, excess );
  18365. }
  18366. // Return only captures needed by the pseudo filter method (type and argument)
  18367. return match.slice( 0, 3 );
  18368. }
  18369. },
  18370. filter: {
  18371. "TAG": function( nodeNameSelector ) {
  18372. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  18373. return nodeNameSelector === "*" ?
  18374. function() { return true; } :
  18375. function( elem ) {
  18376. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  18377. };
  18378. },
  18379. "CLASS": function( className ) {
  18380. var pattern = classCache[ className + " " ];
  18381. return pattern ||
  18382. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  18383. classCache( className, function( elem ) {
  18384. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  18385. });
  18386. },
  18387. "ATTR": function( name, operator, check ) {
  18388. return function( elem ) {
  18389. var result = Sizzle.attr( elem, name );
  18390. if ( result == null ) {
  18391. return operator === "!=";
  18392. }
  18393. if ( !operator ) {
  18394. return true;
  18395. }
  18396. result += "";
  18397. return operator === "=" ? result === check :
  18398. operator === "!=" ? result !== check :
  18399. operator === "^=" ? check && result.indexOf( check ) === 0 :
  18400. operator === "*=" ? check && result.indexOf( check ) > -1 :
  18401. operator === "$=" ? check && result.slice( -check.length ) === check :
  18402. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  18403. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  18404. false;
  18405. };
  18406. },
  18407. "CHILD": function( type, what, argument, first, last ) {
  18408. var simple = type.slice( 0, 3 ) !== "nth",
  18409. forward = type.slice( -4 ) !== "last",
  18410. ofType = what === "of-type";
  18411. return first === 1 && last === 0 ?
  18412. // Shortcut for :nth-*(n)
  18413. function( elem ) {
  18414. return !!elem.parentNode;
  18415. } :
  18416. function( elem, context, xml ) {
  18417. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  18418. dir = simple !== forward ? "nextSibling" : "previousSibling",
  18419. parent = elem.parentNode,
  18420. name = ofType && elem.nodeName.toLowerCase(),
  18421. useCache = !xml && !ofType,
  18422. diff = false;
  18423. if ( parent ) {
  18424. // :(first|last|only)-(child|of-type)
  18425. if ( simple ) {
  18426. while ( dir ) {
  18427. node = elem;
  18428. while ( (node = node[ dir ]) ) {
  18429. if ( ofType ?
  18430. node.nodeName.toLowerCase() === name :
  18431. node.nodeType === 1 ) {
  18432. return false;
  18433. }
  18434. }
  18435. // Reverse direction for :only-* (if we haven't yet done so)
  18436. start = dir = type === "only" && !start && "nextSibling";
  18437. }
  18438. return true;
  18439. }
  18440. start = [ forward ? parent.firstChild : parent.lastChild ];
  18441. // non-xml :nth-child(...) stores cache data on `parent`
  18442. if ( forward && useCache ) {
  18443. // Seek `elem` from a previously-cached index
  18444. // ...in a gzip-friendly way
  18445. node = parent;
  18446. outerCache = node[ expando ] || (node[ expando ] = {});
  18447. // Support: IE <9 only
  18448. // Defend against cloned attroperties (jQuery gh-1709)
  18449. uniqueCache = outerCache[ node.uniqueID ] ||
  18450. (outerCache[ node.uniqueID ] = {});
  18451. cache = uniqueCache[ type ] || [];
  18452. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18453. diff = nodeIndex && cache[ 2 ];
  18454. node = nodeIndex && parent.childNodes[ nodeIndex ];
  18455. while ( (node = ++nodeIndex && node && node[ dir ] ||
  18456. // Fallback to seeking `elem` from the start
  18457. (diff = nodeIndex = 0) || start.pop()) ) {
  18458. // When found, cache indexes on `parent` and break
  18459. if ( node.nodeType === 1 && ++diff && node === elem ) {
  18460. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  18461. break;
  18462. }
  18463. }
  18464. } else {
  18465. // Use previously-cached element index if available
  18466. if ( useCache ) {
  18467. // ...in a gzip-friendly way
  18468. node = elem;
  18469. outerCache = node[ expando ] || (node[ expando ] = {});
  18470. // Support: IE <9 only
  18471. // Defend against cloned attroperties (jQuery gh-1709)
  18472. uniqueCache = outerCache[ node.uniqueID ] ||
  18473. (outerCache[ node.uniqueID ] = {});
  18474. cache = uniqueCache[ type ] || [];
  18475. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18476. diff = nodeIndex;
  18477. }
  18478. // xml :nth-child(...)
  18479. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  18480. if ( diff === false ) {
  18481. // Use the same loop as above to seek `elem` from the start
  18482. while ( (node = ++nodeIndex && node && node[ dir ] ||
  18483. (diff = nodeIndex = 0) || start.pop()) ) {
  18484. if ( ( ofType ?
  18485. node.nodeName.toLowerCase() === name :
  18486. node.nodeType === 1 ) &&
  18487. ++diff ) {
  18488. // Cache the index of each encountered element
  18489. if ( useCache ) {
  18490. outerCache = node[ expando ] || (node[ expando ] = {});
  18491. // Support: IE <9 only
  18492. // Defend against cloned attroperties (jQuery gh-1709)
  18493. uniqueCache = outerCache[ node.uniqueID ] ||
  18494. (outerCache[ node.uniqueID ] = {});
  18495. uniqueCache[ type ] = [ dirruns, diff ];
  18496. }
  18497. if ( node === elem ) {
  18498. break;
  18499. }
  18500. }
  18501. }
  18502. }
  18503. }
  18504. // Incorporate the offset, then check against cycle size
  18505. diff -= last;
  18506. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  18507. }
  18508. };
  18509. },
  18510. "PSEUDO": function( pseudo, argument ) {
  18511. // pseudo-class names are case-insensitive
  18512. // http://www.w3.org/TR/selectors/#pseudo-classes
  18513. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  18514. // Remember that setFilters inherits from pseudos
  18515. var args,
  18516. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  18517. Sizzle.error( "unsupported pseudo: " + pseudo );
  18518. // The user may use createPseudo to indicate that
  18519. // arguments are needed to create the filter function
  18520. // just as Sizzle does
  18521. if ( fn[ expando ] ) {
  18522. return fn( argument );
  18523. }
  18524. // But maintain support for old signatures
  18525. if ( fn.length > 1 ) {
  18526. args = [ pseudo, pseudo, "", argument ];
  18527. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  18528. markFunction(function( seed, matches ) {
  18529. var idx,
  18530. matched = fn( seed, argument ),
  18531. i = matched.length;
  18532. while ( i-- ) {
  18533. idx = indexOf( seed, matched[i] );
  18534. seed[ idx ] = !( matches[ idx ] = matched[i] );
  18535. }
  18536. }) :
  18537. function( elem ) {
  18538. return fn( elem, 0, args );
  18539. };
  18540. }
  18541. return fn;
  18542. }
  18543. },
  18544. pseudos: {
  18545. // Potentially complex pseudos
  18546. "not": markFunction(function( selector ) {
  18547. // Trim the selector passed to compile
  18548. // to avoid treating leading and trailing
  18549. // spaces as combinators
  18550. var input = [],
  18551. results = [],
  18552. matcher = compile( selector.replace( rtrim, "$1" ) );
  18553. return matcher[ expando ] ?
  18554. markFunction(function( seed, matches, context, xml ) {
  18555. var elem,
  18556. unmatched = matcher( seed, null, xml, [] ),
  18557. i = seed.length;
  18558. // Match elements unmatched by `matcher`
  18559. while ( i-- ) {
  18560. if ( (elem = unmatched[i]) ) {
  18561. seed[i] = !(matches[i] = elem);
  18562. }
  18563. }
  18564. }) :
  18565. function( elem, context, xml ) {
  18566. input[0] = elem;
  18567. matcher( input, null, xml, results );
  18568. // Don't keep the element (issue #299)
  18569. input[0] = null;
  18570. return !results.pop();
  18571. };
  18572. }),
  18573. "has": markFunction(function( selector ) {
  18574. return function( elem ) {
  18575. return Sizzle( selector, elem ).length > 0;
  18576. };
  18577. }),
  18578. "contains": markFunction(function( text ) {
  18579. text = text.replace( runescape, funescape );
  18580. return function( elem ) {
  18581. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  18582. };
  18583. }),
  18584. // "Whether an element is represented by a :lang() selector
  18585. // is based solely on the element's language value
  18586. // being equal to the identifier C,
  18587. // or beginning with the identifier C immediately followed by "-".
  18588. // The matching of C against the element's language value is performed case-insensitively.
  18589. // The identifier C does not have to be a valid language name."
  18590. // http://www.w3.org/TR/selectors/#lang-pseudo
  18591. "lang": markFunction( function( lang ) {
  18592. // lang value must be a valid identifier
  18593. if ( !ridentifier.test(lang || "") ) {
  18594. Sizzle.error( "unsupported lang: " + lang );
  18595. }
  18596. lang = lang.replace( runescape, funescape ).toLowerCase();
  18597. return function( elem ) {
  18598. var elemLang;
  18599. do {
  18600. if ( (elemLang = documentIsHTML ?
  18601. elem.lang :
  18602. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  18603. elemLang = elemLang.toLowerCase();
  18604. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  18605. }
  18606. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  18607. return false;
  18608. };
  18609. }),
  18610. // Miscellaneous
  18611. "target": function( elem ) {
  18612. var hash = window.location && window.location.hash;
  18613. return hash && hash.slice( 1 ) === elem.id;
  18614. },
  18615. "root": function( elem ) {
  18616. return elem === docElem;
  18617. },
  18618. "focus": function( elem ) {
  18619. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  18620. },
  18621. // Boolean properties
  18622. "enabled": createDisabledPseudo( false ),
  18623. "disabled": createDisabledPseudo( true ),
  18624. "checked": function( elem ) {
  18625. // In CSS3, :checked should return both checked and selected elements
  18626. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  18627. var nodeName = elem.nodeName.toLowerCase();
  18628. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  18629. },
  18630. "selected": function( elem ) {
  18631. // Accessing this property makes selected-by-default
  18632. // options in Safari work properly
  18633. if ( elem.parentNode ) {
  18634. elem.parentNode.selectedIndex;
  18635. }
  18636. return elem.selected === true;
  18637. },
  18638. // Contents
  18639. "empty": function( elem ) {
  18640. // http://www.w3.org/TR/selectors/#empty-pseudo
  18641. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  18642. // but not by others (comment: 8; processing instruction: 7; etc.)
  18643. // nodeType < 6 works because attributes (2) do not appear as children
  18644. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18645. if ( elem.nodeType < 6 ) {
  18646. return false;
  18647. }
  18648. }
  18649. return true;
  18650. },
  18651. "parent": function( elem ) {
  18652. return !Expr.pseudos["empty"]( elem );
  18653. },
  18654. // Element/input types
  18655. "header": function( elem ) {
  18656. return rheader.test( elem.nodeName );
  18657. },
  18658. "input": function( elem ) {
  18659. return rinputs.test( elem.nodeName );
  18660. },
  18661. "button": function( elem ) {
  18662. var name = elem.nodeName.toLowerCase();
  18663. return name === "input" && elem.type === "button" || name === "button";
  18664. },
  18665. "text": function( elem ) {
  18666. var attr;
  18667. return elem.nodeName.toLowerCase() === "input" &&
  18668. elem.type === "text" &&
  18669. // Support: IE<8
  18670. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  18671. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  18672. },
  18673. // Position-in-collection
  18674. "first": createPositionalPseudo(function() {
  18675. return [ 0 ];
  18676. }),
  18677. "last": createPositionalPseudo(function( matchIndexes, length ) {
  18678. return [ length - 1 ];
  18679. }),
  18680. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18681. return [ argument < 0 ? argument + length : argument ];
  18682. }),
  18683. "even": createPositionalPseudo(function( matchIndexes, length ) {
  18684. var i = 0;
  18685. for ( ; i < length; i += 2 ) {
  18686. matchIndexes.push( i );
  18687. }
  18688. return matchIndexes;
  18689. }),
  18690. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  18691. var i = 1;
  18692. for ( ; i < length; i += 2 ) {
  18693. matchIndexes.push( i );
  18694. }
  18695. return matchIndexes;
  18696. }),
  18697. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18698. var i = argument < 0 ? argument + length : argument;
  18699. for ( ; --i >= 0; ) {
  18700. matchIndexes.push( i );
  18701. }
  18702. return matchIndexes;
  18703. }),
  18704. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  18705. var i = argument < 0 ? argument + length : argument;
  18706. for ( ; ++i < length; ) {
  18707. matchIndexes.push( i );
  18708. }
  18709. return matchIndexes;
  18710. })
  18711. }
  18712. };
  18713. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  18714. // Add button/input type pseudos
  18715. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  18716. Expr.pseudos[ i ] = createInputPseudo( i );
  18717. }
  18718. for ( i in { submit: true, reset: true } ) {
  18719. Expr.pseudos[ i ] = createButtonPseudo( i );
  18720. }
  18721. // Easy API for creating new setFilters
  18722. function setFilters() {}
  18723. setFilters.prototype = Expr.filters = Expr.pseudos;
  18724. Expr.setFilters = new setFilters();
  18725. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  18726. var matched, match, tokens, type,
  18727. soFar, groups, preFilters,
  18728. cached = tokenCache[ selector + " " ];
  18729. if ( cached ) {
  18730. return parseOnly ? 0 : cached.slice( 0 );
  18731. }
  18732. soFar = selector;
  18733. groups = [];
  18734. preFilters = Expr.preFilter;
  18735. while ( soFar ) {
  18736. // Comma and first run
  18737. if ( !matched || (match = rcomma.exec( soFar )) ) {
  18738. if ( match ) {
  18739. // Don't consume trailing commas as valid
  18740. soFar = soFar.slice( match[0].length ) || soFar;
  18741. }
  18742. groups.push( (tokens = []) );
  18743. }
  18744. matched = false;
  18745. // Combinators
  18746. if ( (match = rcombinators.exec( soFar )) ) {
  18747. matched = match.shift();
  18748. tokens.push({
  18749. value: matched,
  18750. // Cast descendant combinators to space
  18751. type: match[0].replace( rtrim, " " )
  18752. });
  18753. soFar = soFar.slice( matched.length );
  18754. }
  18755. // Filters
  18756. for ( type in Expr.filter ) {
  18757. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  18758. (match = preFilters[ type ]( match ))) ) {
  18759. matched = match.shift();
  18760. tokens.push({
  18761. value: matched,
  18762. type: type,
  18763. matches: match
  18764. });
  18765. soFar = soFar.slice( matched.length );
  18766. }
  18767. }
  18768. if ( !matched ) {
  18769. break;
  18770. }
  18771. }
  18772. // Return the length of the invalid excess
  18773. // if we're just parsing
  18774. // Otherwise, throw an error or return tokens
  18775. return parseOnly ?
  18776. soFar.length :
  18777. soFar ?
  18778. Sizzle.error( selector ) :
  18779. // Cache the tokens
  18780. tokenCache( selector, groups ).slice( 0 );
  18781. };
  18782. function toSelector( tokens ) {
  18783. var i = 0,
  18784. len = tokens.length,
  18785. selector = "";
  18786. for ( ; i < len; i++ ) {
  18787. selector += tokens[i].value;
  18788. }
  18789. return selector;
  18790. }
  18791. function addCombinator( matcher, combinator, base ) {
  18792. var dir = combinator.dir,
  18793. skip = combinator.next,
  18794. key = skip || dir,
  18795. checkNonElements = base && key === "parentNode",
  18796. doneName = done++;
  18797. return combinator.first ?
  18798. // Check against closest ancestor/preceding element
  18799. function( elem, context, xml ) {
  18800. while ( (elem = elem[ dir ]) ) {
  18801. if ( elem.nodeType === 1 || checkNonElements ) {
  18802. return matcher( elem, context, xml );
  18803. }
  18804. }
  18805. return false;
  18806. } :
  18807. // Check against all ancestor/preceding elements
  18808. function( elem, context, xml ) {
  18809. var oldCache, uniqueCache, outerCache,
  18810. newCache = [ dirruns, doneName ];
  18811. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  18812. if ( xml ) {
  18813. while ( (elem = elem[ dir ]) ) {
  18814. if ( elem.nodeType === 1 || checkNonElements ) {
  18815. if ( matcher( elem, context, xml ) ) {
  18816. return true;
  18817. }
  18818. }
  18819. }
  18820. } else {
  18821. while ( (elem = elem[ dir ]) ) {
  18822. if ( elem.nodeType === 1 || checkNonElements ) {
  18823. outerCache = elem[ expando ] || (elem[ expando ] = {});
  18824. // Support: IE <9 only
  18825. // Defend against cloned attroperties (jQuery gh-1709)
  18826. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  18827. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  18828. elem = elem[ dir ] || elem;
  18829. } else if ( (oldCache = uniqueCache[ key ]) &&
  18830. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  18831. // Assign to newCache so results back-propagate to previous elements
  18832. return (newCache[ 2 ] = oldCache[ 2 ]);
  18833. } else {
  18834. // Reuse newcache so results back-propagate to previous elements
  18835. uniqueCache[ key ] = newCache;
  18836. // A match means we're done; a fail means we have to keep checking
  18837. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  18838. return true;
  18839. }
  18840. }
  18841. }
  18842. }
  18843. }
  18844. return false;
  18845. };
  18846. }
  18847. function elementMatcher( matchers ) {
  18848. return matchers.length > 1 ?
  18849. function( elem, context, xml ) {
  18850. var i = matchers.length;
  18851. while ( i-- ) {
  18852. if ( !matchers[i]( elem, context, xml ) ) {
  18853. return false;
  18854. }
  18855. }
  18856. return true;
  18857. } :
  18858. matchers[0];
  18859. }
  18860. function multipleContexts( selector, contexts, results ) {
  18861. var i = 0,
  18862. len = contexts.length;
  18863. for ( ; i < len; i++ ) {
  18864. Sizzle( selector, contexts[i], results );
  18865. }
  18866. return results;
  18867. }
  18868. function condense( unmatched, map, filter, context, xml ) {
  18869. var elem,
  18870. newUnmatched = [],
  18871. i = 0,
  18872. len = unmatched.length,
  18873. mapped = map != null;
  18874. for ( ; i < len; i++ ) {
  18875. if ( (elem = unmatched[i]) ) {
  18876. if ( !filter || filter( elem, context, xml ) ) {
  18877. newUnmatched.push( elem );
  18878. if ( mapped ) {
  18879. map.push( i );
  18880. }
  18881. }
  18882. }
  18883. }
  18884. return newUnmatched;
  18885. }
  18886. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  18887. if ( postFilter && !postFilter[ expando ] ) {
  18888. postFilter = setMatcher( postFilter );
  18889. }
  18890. if ( postFinder && !postFinder[ expando ] ) {
  18891. postFinder = setMatcher( postFinder, postSelector );
  18892. }
  18893. return markFunction(function( seed, results, context, xml ) {
  18894. var temp, i, elem,
  18895. preMap = [],
  18896. postMap = [],
  18897. preexisting = results.length,
  18898. // Get initial elements from seed or context
  18899. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  18900. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  18901. matcherIn = preFilter && ( seed || !selector ) ?
  18902. condense( elems, preMap, preFilter, context, xml ) :
  18903. elems,
  18904. matcherOut = matcher ?
  18905. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  18906. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  18907. // ...intermediate processing is necessary
  18908. [] :
  18909. // ...otherwise use results directly
  18910. results :
  18911. matcherIn;
  18912. // Find primary matches
  18913. if ( matcher ) {
  18914. matcher( matcherIn, matcherOut, context, xml );
  18915. }
  18916. // Apply postFilter
  18917. if ( postFilter ) {
  18918. temp = condense( matcherOut, postMap );
  18919. postFilter( temp, [], context, xml );
  18920. // Un-match failing elements by moving them back to matcherIn
  18921. i = temp.length;
  18922. while ( i-- ) {
  18923. if ( (elem = temp[i]) ) {
  18924. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  18925. }
  18926. }
  18927. }
  18928. if ( seed ) {
  18929. if ( postFinder || preFilter ) {
  18930. if ( postFinder ) {
  18931. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  18932. temp = [];
  18933. i = matcherOut.length;
  18934. while ( i-- ) {
  18935. if ( (elem = matcherOut[i]) ) {
  18936. // Restore matcherIn since elem is not yet a final match
  18937. temp.push( (matcherIn[i] = elem) );
  18938. }
  18939. }
  18940. postFinder( null, (matcherOut = []), temp, xml );
  18941. }
  18942. // Move matched elements from seed to results to keep them synchronized
  18943. i = matcherOut.length;
  18944. while ( i-- ) {
  18945. if ( (elem = matcherOut[i]) &&
  18946. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  18947. seed[temp] = !(results[temp] = elem);
  18948. }
  18949. }
  18950. }
  18951. // Add elements to results, through postFinder if defined
  18952. } else {
  18953. matcherOut = condense(
  18954. matcherOut === results ?
  18955. matcherOut.splice( preexisting, matcherOut.length ) :
  18956. matcherOut
  18957. );
  18958. if ( postFinder ) {
  18959. postFinder( null, results, matcherOut, xml );
  18960. } else {
  18961. push.apply( results, matcherOut );
  18962. }
  18963. }
  18964. });
  18965. }
  18966. function matcherFromTokens( tokens ) {
  18967. var checkContext, matcher, j,
  18968. len = tokens.length,
  18969. leadingRelative = Expr.relative[ tokens[0].type ],
  18970. implicitRelative = leadingRelative || Expr.relative[" "],
  18971. i = leadingRelative ? 1 : 0,
  18972. // The foundational matcher ensures that elements are reachable from top-level context(s)
  18973. matchContext = addCombinator( function( elem ) {
  18974. return elem === checkContext;
  18975. }, implicitRelative, true ),
  18976. matchAnyContext = addCombinator( function( elem ) {
  18977. return indexOf( checkContext, elem ) > -1;
  18978. }, implicitRelative, true ),
  18979. matchers = [ function( elem, context, xml ) {
  18980. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  18981. (checkContext = context).nodeType ?
  18982. matchContext( elem, context, xml ) :
  18983. matchAnyContext( elem, context, xml ) );
  18984. // Avoid hanging onto element (issue #299)
  18985. checkContext = null;
  18986. return ret;
  18987. } ];
  18988. for ( ; i < len; i++ ) {
  18989. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  18990. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  18991. } else {
  18992. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  18993. // Return special upon seeing a positional matcher
  18994. if ( matcher[ expando ] ) {
  18995. // Find the next relative operator (if any) for proper handling
  18996. j = ++i;
  18997. for ( ; j < len; j++ ) {
  18998. if ( Expr.relative[ tokens[j].type ] ) {
  18999. break;
  19000. }
  19001. }
  19002. return setMatcher(
  19003. i > 1 && elementMatcher( matchers ),
  19004. i > 1 && toSelector(
  19005. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  19006. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  19007. ).replace( rtrim, "$1" ),
  19008. matcher,
  19009. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  19010. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  19011. j < len && toSelector( tokens )
  19012. );
  19013. }
  19014. matchers.push( matcher );
  19015. }
  19016. }
  19017. return elementMatcher( matchers );
  19018. }
  19019. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  19020. var bySet = setMatchers.length > 0,
  19021. byElement = elementMatchers.length > 0,
  19022. superMatcher = function( seed, context, xml, results, outermost ) {
  19023. var elem, j, matcher,
  19024. matchedCount = 0,
  19025. i = "0",
  19026. unmatched = seed && [],
  19027. setMatched = [],
  19028. contextBackup = outermostContext,
  19029. // We must always have either seed elements or outermost context
  19030. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  19031. // Use integer dirruns iff this is the outermost matcher
  19032. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  19033. len = elems.length;
  19034. if ( outermost ) {
  19035. outermostContext = context === document || context || outermost;
  19036. }
  19037. // Add elements passing elementMatchers directly to results
  19038. // Support: IE<9, Safari
  19039. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  19040. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  19041. if ( byElement && elem ) {
  19042. j = 0;
  19043. if ( !context && elem.ownerDocument !== document ) {
  19044. setDocument( elem );
  19045. xml = !documentIsHTML;
  19046. }
  19047. while ( (matcher = elementMatchers[j++]) ) {
  19048. if ( matcher( elem, context || document, xml) ) {
  19049. results.push( elem );
  19050. break;
  19051. }
  19052. }
  19053. if ( outermost ) {
  19054. dirruns = dirrunsUnique;
  19055. }
  19056. }
  19057. // Track unmatched elements for set filters
  19058. if ( bySet ) {
  19059. // They will have gone through all possible matchers
  19060. if ( (elem = !matcher && elem) ) {
  19061. matchedCount--;
  19062. }
  19063. // Lengthen the array for every element, matched or not
  19064. if ( seed ) {
  19065. unmatched.push( elem );
  19066. }
  19067. }
  19068. }
  19069. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  19070. // makes the latter nonnegative.
  19071. matchedCount += i;
  19072. // Apply set filters to unmatched elements
  19073. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  19074. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  19075. // no element matchers and no seed.
  19076. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  19077. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  19078. // numerically zero.
  19079. if ( bySet && i !== matchedCount ) {
  19080. j = 0;
  19081. while ( (matcher = setMatchers[j++]) ) {
  19082. matcher( unmatched, setMatched, context, xml );
  19083. }
  19084. if ( seed ) {
  19085. // Reintegrate element matches to eliminate the need for sorting
  19086. if ( matchedCount > 0 ) {
  19087. while ( i-- ) {
  19088. if ( !(unmatched[i] || setMatched[i]) ) {
  19089. setMatched[i] = pop.call( results );
  19090. }
  19091. }
  19092. }
  19093. // Discard index placeholder values to get only actual matches
  19094. setMatched = condense( setMatched );
  19095. }
  19096. // Add matches to results
  19097. push.apply( results, setMatched );
  19098. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  19099. if ( outermost && !seed && setMatched.length > 0 &&
  19100. ( matchedCount + setMatchers.length ) > 1 ) {
  19101. Sizzle.uniqueSort( results );
  19102. }
  19103. }
  19104. // Override manipulation of globals by nested matchers
  19105. if ( outermost ) {
  19106. dirruns = dirrunsUnique;
  19107. outermostContext = contextBackup;
  19108. }
  19109. return unmatched;
  19110. };
  19111. return bySet ?
  19112. markFunction( superMatcher ) :
  19113. superMatcher;
  19114. }
  19115. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  19116. var i,
  19117. setMatchers = [],
  19118. elementMatchers = [],
  19119. cached = compilerCache[ selector + " " ];
  19120. if ( !cached ) {
  19121. // Generate a function of recursive functions that can be used to check each element
  19122. if ( !match ) {
  19123. match = tokenize( selector );
  19124. }
  19125. i = match.length;
  19126. while ( i-- ) {
  19127. cached = matcherFromTokens( match[i] );
  19128. if ( cached[ expando ] ) {
  19129. setMatchers.push( cached );
  19130. } else {
  19131. elementMatchers.push( cached );
  19132. }
  19133. }
  19134. // Cache the compiled function
  19135. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  19136. // Save selector and tokenization
  19137. cached.selector = selector;
  19138. }
  19139. return cached;
  19140. };
  19141. /**
  19142. * A low-level selection function that works with Sizzle's compiled
  19143. * selector functions
  19144. * @param {String|Function} selector A selector or a pre-compiled
  19145. * selector function built with Sizzle.compile
  19146. * @param {Element} context
  19147. * @param {Array} [results]
  19148. * @param {Array} [seed] A set of elements to match against
  19149. */
  19150. select = Sizzle.select = function( selector, context, results, seed ) {
  19151. var i, tokens, token, type, find,
  19152. compiled = typeof selector === "function" && selector,
  19153. match = !seed && tokenize( (selector = compiled.selector || selector) );
  19154. results = results || [];
  19155. // Try to minimize operations if there is only one selector in the list and no seed
  19156. // (the latter of which guarantees us context)
  19157. if ( match.length === 1 ) {
  19158. // Reduce context if the leading compound selector is an ID
  19159. tokens = match[0] = match[0].slice( 0 );
  19160. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  19161. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  19162. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  19163. if ( !context ) {
  19164. return results;
  19165. // Precompiled matchers will still verify ancestry, so step up a level
  19166. } else if ( compiled ) {
  19167. context = context.parentNode;
  19168. }
  19169. selector = selector.slice( tokens.shift().value.length );
  19170. }
  19171. // Fetch a seed set for right-to-left matching
  19172. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  19173. while ( i-- ) {
  19174. token = tokens[i];
  19175. // Abort if we hit a combinator
  19176. if ( Expr.relative[ (type = token.type) ] ) {
  19177. break;
  19178. }
  19179. if ( (find = Expr.find[ type ]) ) {
  19180. // Search, expanding context for leading sibling combinators
  19181. if ( (seed = find(
  19182. token.matches[0].replace( runescape, funescape ),
  19183. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  19184. )) ) {
  19185. // If seed is empty or no tokens remain, we can return early
  19186. tokens.splice( i, 1 );
  19187. selector = seed.length && toSelector( tokens );
  19188. if ( !selector ) {
  19189. push.apply( results, seed );
  19190. return results;
  19191. }
  19192. break;
  19193. }
  19194. }
  19195. }
  19196. }
  19197. // Compile and execute a filtering function if one is not provided
  19198. // Provide `match` to avoid retokenization if we modified the selector above
  19199. ( compiled || compile( selector, match ) )(
  19200. seed,
  19201. context,
  19202. !documentIsHTML,
  19203. results,
  19204. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  19205. );
  19206. return results;
  19207. };
  19208. // One-time assignments
  19209. // Sort stability
  19210. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  19211. // Support: Chrome 14-35+
  19212. // Always assume duplicates if they aren't passed to the comparison function
  19213. support.detectDuplicates = !!hasDuplicate;
  19214. // Initialize against the default document
  19215. setDocument();
  19216. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  19217. // Detached nodes confoundingly follow *each other*
  19218. support.sortDetached = assert(function( el ) {
  19219. // Should return 1, but returns 4 (following)
  19220. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  19221. });
  19222. // Support: IE<8
  19223. // Prevent attribute/property "interpolation"
  19224. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  19225. if ( !assert(function( el ) {
  19226. el.innerHTML = "<a href='#'></a>";
  19227. return el.firstChild.getAttribute("href") === "#" ;
  19228. }) ) {
  19229. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  19230. if ( !isXML ) {
  19231. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  19232. }
  19233. });
  19234. }
  19235. // Support: IE<9
  19236. // Use defaultValue in place of getAttribute("value")
  19237. if ( !support.attributes || !assert(function( el ) {
  19238. el.innerHTML = "<input/>";
  19239. el.firstChild.setAttribute( "value", "" );
  19240. return el.firstChild.getAttribute( "value" ) === "";
  19241. }) ) {
  19242. addHandle( "value", function( elem, name, isXML ) {
  19243. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  19244. return elem.defaultValue;
  19245. }
  19246. });
  19247. }
  19248. // Support: IE<9
  19249. // Use getAttributeNode to fetch booleans when getAttribute lies
  19250. if ( !assert(function( el ) {
  19251. return el.getAttribute("disabled") == null;
  19252. }) ) {
  19253. addHandle( booleans, function( elem, name, isXML ) {
  19254. var val;
  19255. if ( !isXML ) {
  19256. return elem[ name ] === true ? name.toLowerCase() :
  19257. (val = elem.getAttributeNode( name )) && val.specified ?
  19258. val.value :
  19259. null;
  19260. }
  19261. });
  19262. }
  19263. return Sizzle;
  19264. })( window );
  19265. jQuery.find = Sizzle;
  19266. jQuery.expr = Sizzle.selectors;
  19267. // Deprecated
  19268. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  19269. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  19270. jQuery.text = Sizzle.getText;
  19271. jQuery.isXMLDoc = Sizzle.isXML;
  19272. jQuery.contains = Sizzle.contains;
  19273. jQuery.escapeSelector = Sizzle.escape;
  19274. var dir = function( elem, dir, until ) {
  19275. var matched = [],
  19276. truncate = until !== undefined;
  19277. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  19278. if ( elem.nodeType === 1 ) {
  19279. if ( truncate && jQuery( elem ).is( until ) ) {
  19280. break;
  19281. }
  19282. matched.push( elem );
  19283. }
  19284. }
  19285. return matched;
  19286. };
  19287. var siblings = function( n, elem ) {
  19288. var matched = [];
  19289. for ( ; n; n = n.nextSibling ) {
  19290. if ( n.nodeType === 1 && n !== elem ) {
  19291. matched.push( n );
  19292. }
  19293. }
  19294. return matched;
  19295. };
  19296. var rneedsContext = jQuery.expr.match.needsContext;
  19297. function nodeName( elem, name ) {
  19298. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  19299. };
  19300. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  19301. // Implement the identical functionality for filter and not
  19302. function winnow( elements, qualifier, not ) {
  19303. if ( isFunction( qualifier ) ) {
  19304. return jQuery.grep( elements, function( elem, i ) {
  19305. return !!qualifier.call( elem, i, elem ) !== not;
  19306. } );
  19307. }
  19308. // Single element
  19309. if ( qualifier.nodeType ) {
  19310. return jQuery.grep( elements, function( elem ) {
  19311. return ( elem === qualifier ) !== not;
  19312. } );
  19313. }
  19314. // Arraylike of elements (jQuery, arguments, Array)
  19315. if ( typeof qualifier !== "string" ) {
  19316. return jQuery.grep( elements, function( elem ) {
  19317. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  19318. } );
  19319. }
  19320. // Filtered directly for both simple and complex selectors
  19321. return jQuery.filter( qualifier, elements, not );
  19322. }
  19323. jQuery.filter = function( expr, elems, not ) {
  19324. var elem = elems[ 0 ];
  19325. if ( not ) {
  19326. expr = ":not(" + expr + ")";
  19327. }
  19328. if ( elems.length === 1 && elem.nodeType === 1 ) {
  19329. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  19330. }
  19331. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  19332. return elem.nodeType === 1;
  19333. } ) );
  19334. };
  19335. jQuery.fn.extend( {
  19336. find: function( selector ) {
  19337. var i, ret,
  19338. len = this.length,
  19339. self = this;
  19340. if ( typeof selector !== "string" ) {
  19341. return this.pushStack( jQuery( selector ).filter( function() {
  19342. for ( i = 0; i < len; i++ ) {
  19343. if ( jQuery.contains( self[ i ], this ) ) {
  19344. return true;
  19345. }
  19346. }
  19347. } ) );
  19348. }
  19349. ret = this.pushStack( [] );
  19350. for ( i = 0; i < len; i++ ) {
  19351. jQuery.find( selector, self[ i ], ret );
  19352. }
  19353. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  19354. },
  19355. filter: function( selector ) {
  19356. return this.pushStack( winnow( this, selector || [], false ) );
  19357. },
  19358. not: function( selector ) {
  19359. return this.pushStack( winnow( this, selector || [], true ) );
  19360. },
  19361. is: function( selector ) {
  19362. return !!winnow(
  19363. this,
  19364. // If this is a positional/relative selector, check membership in the returned set
  19365. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  19366. typeof selector === "string" && rneedsContext.test( selector ) ?
  19367. jQuery( selector ) :
  19368. selector || [],
  19369. false
  19370. ).length;
  19371. }
  19372. } );
  19373. // Initialize a jQuery object
  19374. // A central reference to the root jQuery(document)
  19375. var rootjQuery,
  19376. // A simple way to check for HTML strings
  19377. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  19378. // Strict HTML recognition (#11290: must start with <)
  19379. // Shortcut simple #id case for speed
  19380. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  19381. init = jQuery.fn.init = function( selector, context, root ) {
  19382. var match, elem;
  19383. // HANDLE: $(""), $(null), $(undefined), $(false)
  19384. if ( !selector ) {
  19385. return this;
  19386. }
  19387. // Method init() accepts an alternate rootjQuery
  19388. // so migrate can support jQuery.sub (gh-2101)
  19389. root = root || rootjQuery;
  19390. // Handle HTML strings
  19391. if ( typeof selector === "string" ) {
  19392. if ( selector[ 0 ] === "<" &&
  19393. selector[ selector.length - 1 ] === ">" &&
  19394. selector.length >= 3 ) {
  19395. // Assume that strings that start and end with <> are HTML and skip the regex check
  19396. match = [ null, selector, null ];
  19397. } else {
  19398. match = rquickExpr.exec( selector );
  19399. }
  19400. // Match html or make sure no context is specified for #id
  19401. if ( match && ( match[ 1 ] || !context ) ) {
  19402. // HANDLE: $(html) -> $(array)
  19403. if ( match[ 1 ] ) {
  19404. context = context instanceof jQuery ? context[ 0 ] : context;
  19405. // Option to run scripts is true for back-compat
  19406. // Intentionally let the error be thrown if parseHTML is not present
  19407. jQuery.merge( this, jQuery.parseHTML(
  19408. match[ 1 ],
  19409. context && context.nodeType ? context.ownerDocument || context : document,
  19410. true
  19411. ) );
  19412. // HANDLE: $(html, props)
  19413. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  19414. for ( match in context ) {
  19415. // Properties of context are called as methods if possible
  19416. if ( isFunction( this[ match ] ) ) {
  19417. this[ match ]( context[ match ] );
  19418. // ...and otherwise set as attributes
  19419. } else {
  19420. this.attr( match, context[ match ] );
  19421. }
  19422. }
  19423. }
  19424. return this;
  19425. // HANDLE: $(#id)
  19426. } else {
  19427. elem = document.getElementById( match[ 2 ] );
  19428. if ( elem ) {
  19429. // Inject the element directly into the jQuery object
  19430. this[ 0 ] = elem;
  19431. this.length = 1;
  19432. }
  19433. return this;
  19434. }
  19435. // HANDLE: $(expr, $(...))
  19436. } else if ( !context || context.jquery ) {
  19437. return ( context || root ).find( selector );
  19438. // HANDLE: $(expr, context)
  19439. // (which is just equivalent to: $(context).find(expr)
  19440. } else {
  19441. return this.constructor( context ).find( selector );
  19442. }
  19443. // HANDLE: $(DOMElement)
  19444. } else if ( selector.nodeType ) {
  19445. this[ 0 ] = selector;
  19446. this.length = 1;
  19447. return this;
  19448. // HANDLE: $(function)
  19449. // Shortcut for document ready
  19450. } else if ( isFunction( selector ) ) {
  19451. return root.ready !== undefined ?
  19452. root.ready( selector ) :
  19453. // Execute immediately if ready is not present
  19454. selector( jQuery );
  19455. }
  19456. return jQuery.makeArray( selector, this );
  19457. };
  19458. // Give the init function the jQuery prototype for later instantiation
  19459. init.prototype = jQuery.fn;
  19460. // Initialize central reference
  19461. rootjQuery = jQuery( document );
  19462. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  19463. // Methods guaranteed to produce a unique set when starting from a unique set
  19464. guaranteedUnique = {
  19465. children: true,
  19466. contents: true,
  19467. next: true,
  19468. prev: true
  19469. };
  19470. jQuery.fn.extend( {
  19471. has: function( target ) {
  19472. var targets = jQuery( target, this ),
  19473. l = targets.length;
  19474. return this.filter( function() {
  19475. var i = 0;
  19476. for ( ; i < l; i++ ) {
  19477. if ( jQuery.contains( this, targets[ i ] ) ) {
  19478. return true;
  19479. }
  19480. }
  19481. } );
  19482. },
  19483. closest: function( selectors, context ) {
  19484. var cur,
  19485. i = 0,
  19486. l = this.length,
  19487. matched = [],
  19488. targets = typeof selectors !== "string" && jQuery( selectors );
  19489. // Positional selectors never match, since there's no _selection_ context
  19490. if ( !rneedsContext.test( selectors ) ) {
  19491. for ( ; i < l; i++ ) {
  19492. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  19493. // Always skip document fragments
  19494. if ( cur.nodeType < 11 && ( targets ?
  19495. targets.index( cur ) > -1 :
  19496. // Don't pass non-elements to Sizzle
  19497. cur.nodeType === 1 &&
  19498. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  19499. matched.push( cur );
  19500. break;
  19501. }
  19502. }
  19503. }
  19504. }
  19505. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  19506. },
  19507. // Determine the position of an element within the set
  19508. index: function( elem ) {
  19509. // No argument, return index in parent
  19510. if ( !elem ) {
  19511. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  19512. }
  19513. // Index in selector
  19514. if ( typeof elem === "string" ) {
  19515. return indexOf.call( jQuery( elem ), this[ 0 ] );
  19516. }
  19517. // Locate the position of the desired element
  19518. return indexOf.call( this,
  19519. // If it receives a jQuery object, the first element is used
  19520. elem.jquery ? elem[ 0 ] : elem
  19521. );
  19522. },
  19523. add: function( selector, context ) {
  19524. return this.pushStack(
  19525. jQuery.uniqueSort(
  19526. jQuery.merge( this.get(), jQuery( selector, context ) )
  19527. )
  19528. );
  19529. },
  19530. addBack: function( selector ) {
  19531. return this.add( selector == null ?
  19532. this.prevObject : this.prevObject.filter( selector )
  19533. );
  19534. }
  19535. } );
  19536. function sibling( cur, dir ) {
  19537. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  19538. return cur;
  19539. }
  19540. jQuery.each( {
  19541. parent: function( elem ) {
  19542. var parent = elem.parentNode;
  19543. return parent && parent.nodeType !== 11 ? parent : null;
  19544. },
  19545. parents: function( elem ) {
  19546. return dir( elem, "parentNode" );
  19547. },
  19548. parentsUntil: function( elem, i, until ) {
  19549. return dir( elem, "parentNode", until );
  19550. },
  19551. next: function( elem ) {
  19552. return sibling( elem, "nextSibling" );
  19553. },
  19554. prev: function( elem ) {
  19555. return sibling( elem, "previousSibling" );
  19556. },
  19557. nextAll: function( elem ) {
  19558. return dir( elem, "nextSibling" );
  19559. },
  19560. prevAll: function( elem ) {
  19561. return dir( elem, "previousSibling" );
  19562. },
  19563. nextUntil: function( elem, i, until ) {
  19564. return dir( elem, "nextSibling", until );
  19565. },
  19566. prevUntil: function( elem, i, until ) {
  19567. return dir( elem, "previousSibling", until );
  19568. },
  19569. siblings: function( elem ) {
  19570. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  19571. },
  19572. children: function( elem ) {
  19573. return siblings( elem.firstChild );
  19574. },
  19575. contents: function( elem ) {
  19576. if ( nodeName( elem, "iframe" ) ) {
  19577. return elem.contentDocument;
  19578. }
  19579. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  19580. // Treat the template element as a regular one in browsers that
  19581. // don't support it.
  19582. if ( nodeName( elem, "template" ) ) {
  19583. elem = elem.content || elem;
  19584. }
  19585. return jQuery.merge( [], elem.childNodes );
  19586. }
  19587. }, function( name, fn ) {
  19588. jQuery.fn[ name ] = function( until, selector ) {
  19589. var matched = jQuery.map( this, fn, until );
  19590. if ( name.slice( -5 ) !== "Until" ) {
  19591. selector = until;
  19592. }
  19593. if ( selector && typeof selector === "string" ) {
  19594. matched = jQuery.filter( selector, matched );
  19595. }
  19596. if ( this.length > 1 ) {
  19597. // Remove duplicates
  19598. if ( !guaranteedUnique[ name ] ) {
  19599. jQuery.uniqueSort( matched );
  19600. }
  19601. // Reverse order for parents* and prev-derivatives
  19602. if ( rparentsprev.test( name ) ) {
  19603. matched.reverse();
  19604. }
  19605. }
  19606. return this.pushStack( matched );
  19607. };
  19608. } );
  19609. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  19610. // Convert String-formatted options into Object-formatted ones
  19611. function createOptions( options ) {
  19612. var object = {};
  19613. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  19614. object[ flag ] = true;
  19615. } );
  19616. return object;
  19617. }
  19618. /*
  19619. * Create a callback list using the following parameters:
  19620. *
  19621. * options: an optional list of space-separated options that will change how
  19622. * the callback list behaves or a more traditional option object
  19623. *
  19624. * By default a callback list will act like an event callback list and can be
  19625. * "fired" multiple times.
  19626. *
  19627. * Possible options:
  19628. *
  19629. * once: will ensure the callback list can only be fired once (like a Deferred)
  19630. *
  19631. * memory: will keep track of previous values and will call any callback added
  19632. * after the list has been fired right away with the latest "memorized"
  19633. * values (like a Deferred)
  19634. *
  19635. * unique: will ensure a callback can only be added once (no duplicate in the list)
  19636. *
  19637. * stopOnFalse: interrupt callings when a callback returns false
  19638. *
  19639. */
  19640. jQuery.Callbacks = function( options ) {
  19641. // Convert options from String-formatted to Object-formatted if needed
  19642. // (we check in cache first)
  19643. options = typeof options === "string" ?
  19644. createOptions( options ) :
  19645. jQuery.extend( {}, options );
  19646. var // Flag to know if list is currently firing
  19647. firing,
  19648. // Last fire value for non-forgettable lists
  19649. memory,
  19650. // Flag to know if list was already fired
  19651. fired,
  19652. // Flag to prevent firing
  19653. locked,
  19654. // Actual callback list
  19655. list = [],
  19656. // Queue of execution data for repeatable lists
  19657. queue = [],
  19658. // Index of currently firing callback (modified by add/remove as needed)
  19659. firingIndex = -1,
  19660. // Fire callbacks
  19661. fire = function() {
  19662. // Enforce single-firing
  19663. locked = locked || options.once;
  19664. // Execute callbacks for all pending executions,
  19665. // respecting firingIndex overrides and runtime changes
  19666. fired = firing = true;
  19667. for ( ; queue.length; firingIndex = -1 ) {
  19668. memory = queue.shift();
  19669. while ( ++firingIndex < list.length ) {
  19670. // Run callback and check for early termination
  19671. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  19672. options.stopOnFalse ) {
  19673. // Jump to end and forget the data so .add doesn't re-fire
  19674. firingIndex = list.length;
  19675. memory = false;
  19676. }
  19677. }
  19678. }
  19679. // Forget the data if we're done with it
  19680. if ( !options.memory ) {
  19681. memory = false;
  19682. }
  19683. firing = false;
  19684. // Clean up if we're done firing for good
  19685. if ( locked ) {
  19686. // Keep an empty list if we have data for future add calls
  19687. if ( memory ) {
  19688. list = [];
  19689. // Otherwise, this object is spent
  19690. } else {
  19691. list = "";
  19692. }
  19693. }
  19694. },
  19695. // Actual Callbacks object
  19696. self = {
  19697. // Add a callback or a collection of callbacks to the list
  19698. add: function() {
  19699. if ( list ) {
  19700. // If we have memory from a past run, we should fire after adding
  19701. if ( memory && !firing ) {
  19702. firingIndex = list.length - 1;
  19703. queue.push( memory );
  19704. }
  19705. ( function add( args ) {
  19706. jQuery.each( args, function( _, arg ) {
  19707. if ( isFunction( arg ) ) {
  19708. if ( !options.unique || !self.has( arg ) ) {
  19709. list.push( arg );
  19710. }
  19711. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  19712. // Inspect recursively
  19713. add( arg );
  19714. }
  19715. } );
  19716. } )( arguments );
  19717. if ( memory && !firing ) {
  19718. fire();
  19719. }
  19720. }
  19721. return this;
  19722. },
  19723. // Remove a callback from the list
  19724. remove: function() {
  19725. jQuery.each( arguments, function( _, arg ) {
  19726. var index;
  19727. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  19728. list.splice( index, 1 );
  19729. // Handle firing indexes
  19730. if ( index <= firingIndex ) {
  19731. firingIndex--;
  19732. }
  19733. }
  19734. } );
  19735. return this;
  19736. },
  19737. // Check if a given callback is in the list.
  19738. // If no argument is given, return whether or not list has callbacks attached.
  19739. has: function( fn ) {
  19740. return fn ?
  19741. jQuery.inArray( fn, list ) > -1 :
  19742. list.length > 0;
  19743. },
  19744. // Remove all callbacks from the list
  19745. empty: function() {
  19746. if ( list ) {
  19747. list = [];
  19748. }
  19749. return this;
  19750. },
  19751. // Disable .fire and .add
  19752. // Abort any current/pending executions
  19753. // Clear all callbacks and values
  19754. disable: function() {
  19755. locked = queue = [];
  19756. list = memory = "";
  19757. return this;
  19758. },
  19759. disabled: function() {
  19760. return !list;
  19761. },
  19762. // Disable .fire
  19763. // Also disable .add unless we have memory (since it would have no effect)
  19764. // Abort any pending executions
  19765. lock: function() {
  19766. locked = queue = [];
  19767. if ( !memory && !firing ) {
  19768. list = memory = "";
  19769. }
  19770. return this;
  19771. },
  19772. locked: function() {
  19773. return !!locked;
  19774. },
  19775. // Call all callbacks with the given context and arguments
  19776. fireWith: function( context, args ) {
  19777. if ( !locked ) {
  19778. args = args || [];
  19779. args = [ context, args.slice ? args.slice() : args ];
  19780. queue.push( args );
  19781. if ( !firing ) {
  19782. fire();
  19783. }
  19784. }
  19785. return this;
  19786. },
  19787. // Call all the callbacks with the given arguments
  19788. fire: function() {
  19789. self.fireWith( this, arguments );
  19790. return this;
  19791. },
  19792. // To know if the callbacks have already been called at least once
  19793. fired: function() {
  19794. return !!fired;
  19795. }
  19796. };
  19797. return self;
  19798. };
  19799. function Identity( v ) {
  19800. return v;
  19801. }
  19802. function Thrower( ex ) {
  19803. throw ex;
  19804. }
  19805. function adoptValue( value, resolve, reject, noValue ) {
  19806. var method;
  19807. try {
  19808. // Check for promise aspect first to privilege synchronous behavior
  19809. if ( value && isFunction( ( method = value.promise ) ) ) {
  19810. method.call( value ).done( resolve ).fail( reject );
  19811. // Other thenables
  19812. } else if ( value && isFunction( ( method = value.then ) ) ) {
  19813. method.call( value, resolve, reject );
  19814. // Other non-thenables
  19815. } else {
  19816. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  19817. // * false: [ value ].slice( 0 ) => resolve( value )
  19818. // * true: [ value ].slice( 1 ) => resolve()
  19819. resolve.apply( undefined, [ value ].slice( noValue ) );
  19820. }
  19821. // For Promises/A+, convert exceptions into rejections
  19822. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  19823. // Deferred#then to conditionally suppress rejection.
  19824. } catch ( value ) {
  19825. // Support: Android 4.0 only
  19826. // Strict mode functions invoked without .call/.apply get global-object context
  19827. reject.apply( undefined, [ value ] );
  19828. }
  19829. }
  19830. jQuery.extend( {
  19831. Deferred: function( func ) {
  19832. var tuples = [
  19833. // action, add listener, callbacks,
  19834. // ... .then handlers, argument index, [final state]
  19835. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  19836. jQuery.Callbacks( "memory" ), 2 ],
  19837. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  19838. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  19839. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  19840. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  19841. ],
  19842. state = "pending",
  19843. promise = {
  19844. state: function() {
  19845. return state;
  19846. },
  19847. always: function() {
  19848. deferred.done( arguments ).fail( arguments );
  19849. return this;
  19850. },
  19851. "catch": function( fn ) {
  19852. return promise.then( null, fn );
  19853. },
  19854. // Keep pipe for back-compat
  19855. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  19856. var fns = arguments;
  19857. return jQuery.Deferred( function( newDefer ) {
  19858. jQuery.each( tuples, function( i, tuple ) {
  19859. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  19860. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  19861. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  19862. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  19863. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  19864. deferred[ tuple[ 1 ] ]( function() {
  19865. var returned = fn && fn.apply( this, arguments );
  19866. if ( returned && isFunction( returned.promise ) ) {
  19867. returned.promise()
  19868. .progress( newDefer.notify )
  19869. .done( newDefer.resolve )
  19870. .fail( newDefer.reject );
  19871. } else {
  19872. newDefer[ tuple[ 0 ] + "With" ](
  19873. this,
  19874. fn ? [ returned ] : arguments
  19875. );
  19876. }
  19877. } );
  19878. } );
  19879. fns = null;
  19880. } ).promise();
  19881. },
  19882. then: function( onFulfilled, onRejected, onProgress ) {
  19883. var maxDepth = 0;
  19884. function resolve( depth, deferred, handler, special ) {
  19885. return function() {
  19886. var that = this,
  19887. args = arguments,
  19888. mightThrow = function() {
  19889. var returned, then;
  19890. // Support: Promises/A+ section 2.3.3.3.3
  19891. // https://promisesaplus.com/#point-59
  19892. // Ignore double-resolution attempts
  19893. if ( depth < maxDepth ) {
  19894. return;
  19895. }
  19896. returned = handler.apply( that, args );
  19897. // Support: Promises/A+ section 2.3.1
  19898. // https://promisesaplus.com/#point-48
  19899. if ( returned === deferred.promise() ) {
  19900. throw new TypeError( "Thenable self-resolution" );
  19901. }
  19902. // Support: Promises/A+ sections 2.3.3.1, 3.5
  19903. // https://promisesaplus.com/#point-54
  19904. // https://promisesaplus.com/#point-75
  19905. // Retrieve `then` only once
  19906. then = returned &&
  19907. // Support: Promises/A+ section 2.3.4
  19908. // https://promisesaplus.com/#point-64
  19909. // Only check objects and functions for thenability
  19910. ( typeof returned === "object" ||
  19911. typeof returned === "function" ) &&
  19912. returned.then;
  19913. // Handle a returned thenable
  19914. if ( isFunction( then ) ) {
  19915. // Special processors (notify) just wait for resolution
  19916. if ( special ) {
  19917. then.call(
  19918. returned,
  19919. resolve( maxDepth, deferred, Identity, special ),
  19920. resolve( maxDepth, deferred, Thrower, special )
  19921. );
  19922. // Normal processors (resolve) also hook into progress
  19923. } else {
  19924. // ...and disregard older resolution values
  19925. maxDepth++;
  19926. then.call(
  19927. returned,
  19928. resolve( maxDepth, deferred, Identity, special ),
  19929. resolve( maxDepth, deferred, Thrower, special ),
  19930. resolve( maxDepth, deferred, Identity,
  19931. deferred.notifyWith )
  19932. );
  19933. }
  19934. // Handle all other returned values
  19935. } else {
  19936. // Only substitute handlers pass on context
  19937. // and multiple values (non-spec behavior)
  19938. if ( handler !== Identity ) {
  19939. that = undefined;
  19940. args = [ returned ];
  19941. }
  19942. // Process the value(s)
  19943. // Default process is resolve
  19944. ( special || deferred.resolveWith )( that, args );
  19945. }
  19946. },
  19947. // Only normal processors (resolve) catch and reject exceptions
  19948. process = special ?
  19949. mightThrow :
  19950. function() {
  19951. try {
  19952. mightThrow();
  19953. } catch ( e ) {
  19954. if ( jQuery.Deferred.exceptionHook ) {
  19955. jQuery.Deferred.exceptionHook( e,
  19956. process.stackTrace );
  19957. }
  19958. // Support: Promises/A+ section 2.3.3.3.4.1
  19959. // https://promisesaplus.com/#point-61
  19960. // Ignore post-resolution exceptions
  19961. if ( depth + 1 >= maxDepth ) {
  19962. // Only substitute handlers pass on context
  19963. // and multiple values (non-spec behavior)
  19964. if ( handler !== Thrower ) {
  19965. that = undefined;
  19966. args = [ e ];
  19967. }
  19968. deferred.rejectWith( that, args );
  19969. }
  19970. }
  19971. };
  19972. // Support: Promises/A+ section 2.3.3.3.1
  19973. // https://promisesaplus.com/#point-57
  19974. // Re-resolve promises immediately to dodge false rejection from
  19975. // subsequent errors
  19976. if ( depth ) {
  19977. process();
  19978. } else {
  19979. // Call an optional hook to record the stack, in case of exception
  19980. // since it's otherwise lost when execution goes async
  19981. if ( jQuery.Deferred.getStackHook ) {
  19982. process.stackTrace = jQuery.Deferred.getStackHook();
  19983. }
  19984. window.setTimeout( process );
  19985. }
  19986. };
  19987. }
  19988. return jQuery.Deferred( function( newDefer ) {
  19989. // progress_handlers.add( ... )
  19990. tuples[ 0 ][ 3 ].add(
  19991. resolve(
  19992. 0,
  19993. newDefer,
  19994. isFunction( onProgress ) ?
  19995. onProgress :
  19996. Identity,
  19997. newDefer.notifyWith
  19998. )
  19999. );
  20000. // fulfilled_handlers.add( ... )
  20001. tuples[ 1 ][ 3 ].add(
  20002. resolve(
  20003. 0,
  20004. newDefer,
  20005. isFunction( onFulfilled ) ?
  20006. onFulfilled :
  20007. Identity
  20008. )
  20009. );
  20010. // rejected_handlers.add( ... )
  20011. tuples[ 2 ][ 3 ].add(
  20012. resolve(
  20013. 0,
  20014. newDefer,
  20015. isFunction( onRejected ) ?
  20016. onRejected :
  20017. Thrower
  20018. )
  20019. );
  20020. } ).promise();
  20021. },
  20022. // Get a promise for this deferred
  20023. // If obj is provided, the promise aspect is added to the object
  20024. promise: function( obj ) {
  20025. return obj != null ? jQuery.extend( obj, promise ) : promise;
  20026. }
  20027. },
  20028. deferred = {};
  20029. // Add list-specific methods
  20030. jQuery.each( tuples, function( i, tuple ) {
  20031. var list = tuple[ 2 ],
  20032. stateString = tuple[ 5 ];
  20033. // promise.progress = list.add
  20034. // promise.done = list.add
  20035. // promise.fail = list.add
  20036. promise[ tuple[ 1 ] ] = list.add;
  20037. // Handle state
  20038. if ( stateString ) {
  20039. list.add(
  20040. function() {
  20041. // state = "resolved" (i.e., fulfilled)
  20042. // state = "rejected"
  20043. state = stateString;
  20044. },
  20045. // rejected_callbacks.disable
  20046. // fulfilled_callbacks.disable
  20047. tuples[ 3 - i ][ 2 ].disable,
  20048. // rejected_handlers.disable
  20049. // fulfilled_handlers.disable
  20050. tuples[ 3 - i ][ 3 ].disable,
  20051. // progress_callbacks.lock
  20052. tuples[ 0 ][ 2 ].lock,
  20053. // progress_handlers.lock
  20054. tuples[ 0 ][ 3 ].lock
  20055. );
  20056. }
  20057. // progress_handlers.fire
  20058. // fulfilled_handlers.fire
  20059. // rejected_handlers.fire
  20060. list.add( tuple[ 3 ].fire );
  20061. // deferred.notify = function() { deferred.notifyWith(...) }
  20062. // deferred.resolve = function() { deferred.resolveWith(...) }
  20063. // deferred.reject = function() { deferred.rejectWith(...) }
  20064. deferred[ tuple[ 0 ] ] = function() {
  20065. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  20066. return this;
  20067. };
  20068. // deferred.notifyWith = list.fireWith
  20069. // deferred.resolveWith = list.fireWith
  20070. // deferred.rejectWith = list.fireWith
  20071. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  20072. } );
  20073. // Make the deferred a promise
  20074. promise.promise( deferred );
  20075. // Call given func if any
  20076. if ( func ) {
  20077. func.call( deferred, deferred );
  20078. }
  20079. // All done!
  20080. return deferred;
  20081. },
  20082. // Deferred helper
  20083. when: function( singleValue ) {
  20084. var
  20085. // count of uncompleted subordinates
  20086. remaining = arguments.length,
  20087. // count of unprocessed arguments
  20088. i = remaining,
  20089. // subordinate fulfillment data
  20090. resolveContexts = Array( i ),
  20091. resolveValues = slice.call( arguments ),
  20092. // the master Deferred
  20093. master = jQuery.Deferred(),
  20094. // subordinate callback factory
  20095. updateFunc = function( i ) {
  20096. return function( value ) {
  20097. resolveContexts[ i ] = this;
  20098. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  20099. if ( !( --remaining ) ) {
  20100. master.resolveWith( resolveContexts, resolveValues );
  20101. }
  20102. };
  20103. };
  20104. // Single- and empty arguments are adopted like Promise.resolve
  20105. if ( remaining <= 1 ) {
  20106. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  20107. !remaining );
  20108. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  20109. if ( master.state() === "pending" ||
  20110. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  20111. return master.then();
  20112. }
  20113. }
  20114. // Multiple arguments are aggregated like Promise.all array elements
  20115. while ( i-- ) {
  20116. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  20117. }
  20118. return master.promise();
  20119. }
  20120. } );
  20121. // These usually indicate a programmer mistake during development,
  20122. // warn about them ASAP rather than swallowing them by default.
  20123. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  20124. jQuery.Deferred.exceptionHook = function( error, stack ) {
  20125. // Support: IE 8 - 9 only
  20126. // Console exists when dev tools are open, which can happen at any time
  20127. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  20128. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  20129. }
  20130. };
  20131. jQuery.readyException = function( error ) {
  20132. window.setTimeout( function() {
  20133. throw error;
  20134. } );
  20135. };
  20136. // The deferred used on DOM ready
  20137. var readyList = jQuery.Deferred();
  20138. jQuery.fn.ready = function( fn ) {
  20139. readyList
  20140. .then( fn )
  20141. // Wrap jQuery.readyException in a function so that the lookup
  20142. // happens at the time of error handling instead of callback
  20143. // registration.
  20144. .catch( function( error ) {
  20145. jQuery.readyException( error );
  20146. } );
  20147. return this;
  20148. };
  20149. jQuery.extend( {
  20150. // Is the DOM ready to be used? Set to true once it occurs.
  20151. isReady: false,
  20152. // A counter to track how many items to wait for before
  20153. // the ready event fires. See #6781
  20154. readyWait: 1,
  20155. // Handle when the DOM is ready
  20156. ready: function( wait ) {
  20157. // Abort if there are pending holds or we're already ready
  20158. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  20159. return;
  20160. }
  20161. // Remember that the DOM is ready
  20162. jQuery.isReady = true;
  20163. // If a normal DOM Ready event fired, decrement, and wait if need be
  20164. if ( wait !== true && --jQuery.readyWait > 0 ) {
  20165. return;
  20166. }
  20167. // If there are functions bound, to execute
  20168. readyList.resolveWith( document, [ jQuery ] );
  20169. }
  20170. } );
  20171. jQuery.ready.then = readyList.then;
  20172. // The ready event handler and self cleanup method
  20173. function completed() {
  20174. document.removeEventListener( "DOMContentLoaded", completed );
  20175. window.removeEventListener( "load", completed );
  20176. jQuery.ready();
  20177. }
  20178. // Catch cases where $(document).ready() is called
  20179. // after the browser event has already occurred.
  20180. // Support: IE <=9 - 10 only
  20181. // Older IE sometimes signals "interactive" too soon
  20182. if ( document.readyState === "complete" ||
  20183. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  20184. // Handle it asynchronously to allow scripts the opportunity to delay ready
  20185. window.setTimeout( jQuery.ready );
  20186. } else {
  20187. // Use the handy event callback
  20188. document.addEventListener( "DOMContentLoaded", completed );
  20189. // A fallback to window.onload, that will always work
  20190. window.addEventListener( "load", completed );
  20191. }
  20192. // Multifunctional method to get and set values of a collection
  20193. // The value/s can optionally be executed if it's a function
  20194. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  20195. var i = 0,
  20196. len = elems.length,
  20197. bulk = key == null;
  20198. // Sets many values
  20199. if ( toType( key ) === "object" ) {
  20200. chainable = true;
  20201. for ( i in key ) {
  20202. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  20203. }
  20204. // Sets one value
  20205. } else if ( value !== undefined ) {
  20206. chainable = true;
  20207. if ( !isFunction( value ) ) {
  20208. raw = true;
  20209. }
  20210. if ( bulk ) {
  20211. // Bulk operations run against the entire set
  20212. if ( raw ) {
  20213. fn.call( elems, value );
  20214. fn = null;
  20215. // ...except when executing function values
  20216. } else {
  20217. bulk = fn;
  20218. fn = function( elem, key, value ) {
  20219. return bulk.call( jQuery( elem ), value );
  20220. };
  20221. }
  20222. }
  20223. if ( fn ) {
  20224. for ( ; i < len; i++ ) {
  20225. fn(
  20226. elems[ i ], key, raw ?
  20227. value :
  20228. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  20229. );
  20230. }
  20231. }
  20232. }
  20233. if ( chainable ) {
  20234. return elems;
  20235. }
  20236. // Gets
  20237. if ( bulk ) {
  20238. return fn.call( elems );
  20239. }
  20240. return len ? fn( elems[ 0 ], key ) : emptyGet;
  20241. };
  20242. // Matches dashed string for camelizing
  20243. var rmsPrefix = /^-ms-/,
  20244. rdashAlpha = /-([a-z])/g;
  20245. // Used by camelCase as callback to replace()
  20246. function fcamelCase( all, letter ) {
  20247. return letter.toUpperCase();
  20248. }
  20249. // Convert dashed to camelCase; used by the css and data modules
  20250. // Support: IE <=9 - 11, Edge 12 - 15
  20251. // Microsoft forgot to hump their vendor prefix (#9572)
  20252. function camelCase( string ) {
  20253. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  20254. }
  20255. var acceptData = function( owner ) {
  20256. // Accepts only:
  20257. // - Node
  20258. // - Node.ELEMENT_NODE
  20259. // - Node.DOCUMENT_NODE
  20260. // - Object
  20261. // - Any
  20262. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  20263. };
  20264. function Data() {
  20265. this.expando = jQuery.expando + Data.uid++;
  20266. }
  20267. Data.uid = 1;
  20268. Data.prototype = {
  20269. cache: function( owner ) {
  20270. // Check if the owner object already has a cache
  20271. var value = owner[ this.expando ];
  20272. // If not, create one
  20273. if ( !value ) {
  20274. value = {};
  20275. // We can accept data for non-element nodes in modern browsers,
  20276. // but we should not, see #8335.
  20277. // Always return an empty object.
  20278. if ( acceptData( owner ) ) {
  20279. // If it is a node unlikely to be stringify-ed or looped over
  20280. // use plain assignment
  20281. if ( owner.nodeType ) {
  20282. owner[ this.expando ] = value;
  20283. // Otherwise secure it in a non-enumerable property
  20284. // configurable must be true to allow the property to be
  20285. // deleted when data is removed
  20286. } else {
  20287. Object.defineProperty( owner, this.expando, {
  20288. value: value,
  20289. configurable: true
  20290. } );
  20291. }
  20292. }
  20293. }
  20294. return value;
  20295. },
  20296. set: function( owner, data, value ) {
  20297. var prop,
  20298. cache = this.cache( owner );
  20299. // Handle: [ owner, key, value ] args
  20300. // Always use camelCase key (gh-2257)
  20301. if ( typeof data === "string" ) {
  20302. cache[ camelCase( data ) ] = value;
  20303. // Handle: [ owner, { properties } ] args
  20304. } else {
  20305. // Copy the properties one-by-one to the cache object
  20306. for ( prop in data ) {
  20307. cache[ camelCase( prop ) ] = data[ prop ];
  20308. }
  20309. }
  20310. return cache;
  20311. },
  20312. get: function( owner, key ) {
  20313. return key === undefined ?
  20314. this.cache( owner ) :
  20315. // Always use camelCase key (gh-2257)
  20316. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  20317. },
  20318. access: function( owner, key, value ) {
  20319. // In cases where either:
  20320. //
  20321. // 1. No key was specified
  20322. // 2. A string key was specified, but no value provided
  20323. //
  20324. // Take the "read" path and allow the get method to determine
  20325. // which value to return, respectively either:
  20326. //
  20327. // 1. The entire cache object
  20328. // 2. The data stored at the key
  20329. //
  20330. if ( key === undefined ||
  20331. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  20332. return this.get( owner, key );
  20333. }
  20334. // When the key is not a string, or both a key and value
  20335. // are specified, set or extend (existing objects) with either:
  20336. //
  20337. // 1. An object of properties
  20338. // 2. A key and value
  20339. //
  20340. this.set( owner, key, value );
  20341. // Since the "set" path can have two possible entry points
  20342. // return the expected data based on which path was taken[*]
  20343. return value !== undefined ? value : key;
  20344. },
  20345. remove: function( owner, key ) {
  20346. var i,
  20347. cache = owner[ this.expando ];
  20348. if ( cache === undefined ) {
  20349. return;
  20350. }
  20351. if ( key !== undefined ) {
  20352. // Support array or space separated string of keys
  20353. if ( Array.isArray( key ) ) {
  20354. // If key is an array of keys...
  20355. // We always set camelCase keys, so remove that.
  20356. key = key.map( camelCase );
  20357. } else {
  20358. key = camelCase( key );
  20359. // If a key with the spaces exists, use it.
  20360. // Otherwise, create an array by matching non-whitespace
  20361. key = key in cache ?
  20362. [ key ] :
  20363. ( key.match( rnothtmlwhite ) || [] );
  20364. }
  20365. i = key.length;
  20366. while ( i-- ) {
  20367. delete cache[ key[ i ] ];
  20368. }
  20369. }
  20370. // Remove the expando if there's no more data
  20371. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  20372. // Support: Chrome <=35 - 45
  20373. // Webkit & Blink performance suffers when deleting properties
  20374. // from DOM nodes, so set to undefined instead
  20375. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  20376. if ( owner.nodeType ) {
  20377. owner[ this.expando ] = undefined;
  20378. } else {
  20379. delete owner[ this.expando ];
  20380. }
  20381. }
  20382. },
  20383. hasData: function( owner ) {
  20384. var cache = owner[ this.expando ];
  20385. return cache !== undefined && !jQuery.isEmptyObject( cache );
  20386. }
  20387. };
  20388. var dataPriv = new Data();
  20389. var dataUser = new Data();
  20390. // Implementation Summary
  20391. //
  20392. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  20393. // 2. Improve the module's maintainability by reducing the storage
  20394. // paths to a single mechanism.
  20395. // 3. Use the same single mechanism to support "private" and "user" data.
  20396. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  20397. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  20398. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  20399. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  20400. rmultiDash = /[A-Z]/g;
  20401. function getData( data ) {
  20402. if ( data === "true" ) {
  20403. return true;
  20404. }
  20405. if ( data === "false" ) {
  20406. return false;
  20407. }
  20408. if ( data === "null" ) {
  20409. return null;
  20410. }
  20411. // Only convert to a number if it doesn't change the string
  20412. if ( data === +data + "" ) {
  20413. return +data;
  20414. }
  20415. if ( rbrace.test( data ) ) {
  20416. return JSON.parse( data );
  20417. }
  20418. return data;
  20419. }
  20420. function dataAttr( elem, key, data ) {
  20421. var name;
  20422. // If nothing was found internally, try to fetch any
  20423. // data from the HTML5 data-* attribute
  20424. if ( data === undefined && elem.nodeType === 1 ) {
  20425. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  20426. data = elem.getAttribute( name );
  20427. if ( typeof data === "string" ) {
  20428. try {
  20429. data = getData( data );
  20430. } catch ( e ) {}
  20431. // Make sure we set the data so it isn't changed later
  20432. dataUser.set( elem, key, data );
  20433. } else {
  20434. data = undefined;
  20435. }
  20436. }
  20437. return data;
  20438. }
  20439. jQuery.extend( {
  20440. hasData: function( elem ) {
  20441. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  20442. },
  20443. data: function( elem, name, data ) {
  20444. return dataUser.access( elem, name, data );
  20445. },
  20446. removeData: function( elem, name ) {
  20447. dataUser.remove( elem, name );
  20448. },
  20449. // TODO: Now that all calls to _data and _removeData have been replaced
  20450. // with direct calls to dataPriv methods, these can be deprecated.
  20451. _data: function( elem, name, data ) {
  20452. return dataPriv.access( elem, name, data );
  20453. },
  20454. _removeData: function( elem, name ) {
  20455. dataPriv.remove( elem, name );
  20456. }
  20457. } );
  20458. jQuery.fn.extend( {
  20459. data: function( key, value ) {
  20460. var i, name, data,
  20461. elem = this[ 0 ],
  20462. attrs = elem && elem.attributes;
  20463. // Gets all values
  20464. if ( key === undefined ) {
  20465. if ( this.length ) {
  20466. data = dataUser.get( elem );
  20467. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  20468. i = attrs.length;
  20469. while ( i-- ) {
  20470. // Support: IE 11 only
  20471. // The attrs elements can be null (#14894)
  20472. if ( attrs[ i ] ) {
  20473. name = attrs[ i ].name;
  20474. if ( name.indexOf( "data-" ) === 0 ) {
  20475. name = camelCase( name.slice( 5 ) );
  20476. dataAttr( elem, name, data[ name ] );
  20477. }
  20478. }
  20479. }
  20480. dataPriv.set( elem, "hasDataAttrs", true );
  20481. }
  20482. }
  20483. return data;
  20484. }
  20485. // Sets multiple values
  20486. if ( typeof key === "object" ) {
  20487. return this.each( function() {
  20488. dataUser.set( this, key );
  20489. } );
  20490. }
  20491. return access( this, function( value ) {
  20492. var data;
  20493. // The calling jQuery object (element matches) is not empty
  20494. // (and therefore has an element appears at this[ 0 ]) and the
  20495. // `value` parameter was not undefined. An empty jQuery object
  20496. // will result in `undefined` for elem = this[ 0 ] which will
  20497. // throw an exception if an attempt to read a data cache is made.
  20498. if ( elem && value === undefined ) {
  20499. // Attempt to get data from the cache
  20500. // The key will always be camelCased in Data
  20501. data = dataUser.get( elem, key );
  20502. if ( data !== undefined ) {
  20503. return data;
  20504. }
  20505. // Attempt to "discover" the data in
  20506. // HTML5 custom data-* attrs
  20507. data = dataAttr( elem, key );
  20508. if ( data !== undefined ) {
  20509. return data;
  20510. }
  20511. // We tried really hard, but the data doesn't exist.
  20512. return;
  20513. }
  20514. // Set the data...
  20515. this.each( function() {
  20516. // We always store the camelCased key
  20517. dataUser.set( this, key, value );
  20518. } );
  20519. }, null, value, arguments.length > 1, null, true );
  20520. },
  20521. removeData: function( key ) {
  20522. return this.each( function() {
  20523. dataUser.remove( this, key );
  20524. } );
  20525. }
  20526. } );
  20527. jQuery.extend( {
  20528. queue: function( elem, type, data ) {
  20529. var queue;
  20530. if ( elem ) {
  20531. type = ( type || "fx" ) + "queue";
  20532. queue = dataPriv.get( elem, type );
  20533. // Speed up dequeue by getting out quickly if this is just a lookup
  20534. if ( data ) {
  20535. if ( !queue || Array.isArray( data ) ) {
  20536. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  20537. } else {
  20538. queue.push( data );
  20539. }
  20540. }
  20541. return queue || [];
  20542. }
  20543. },
  20544. dequeue: function( elem, type ) {
  20545. type = type || "fx";
  20546. var queue = jQuery.queue( elem, type ),
  20547. startLength = queue.length,
  20548. fn = queue.shift(),
  20549. hooks = jQuery._queueHooks( elem, type ),
  20550. next = function() {
  20551. jQuery.dequeue( elem, type );
  20552. };
  20553. // If the fx queue is dequeued, always remove the progress sentinel
  20554. if ( fn === "inprogress" ) {
  20555. fn = queue.shift();
  20556. startLength--;
  20557. }
  20558. if ( fn ) {
  20559. // Add a progress sentinel to prevent the fx queue from being
  20560. // automatically dequeued
  20561. if ( type === "fx" ) {
  20562. queue.unshift( "inprogress" );
  20563. }
  20564. // Clear up the last queue stop function
  20565. delete hooks.stop;
  20566. fn.call( elem, next, hooks );
  20567. }
  20568. if ( !startLength && hooks ) {
  20569. hooks.empty.fire();
  20570. }
  20571. },
  20572. // Not public - generate a queueHooks object, or return the current one
  20573. _queueHooks: function( elem, type ) {
  20574. var key = type + "queueHooks";
  20575. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  20576. empty: jQuery.Callbacks( "once memory" ).add( function() {
  20577. dataPriv.remove( elem, [ type + "queue", key ] );
  20578. } )
  20579. } );
  20580. }
  20581. } );
  20582. jQuery.fn.extend( {
  20583. queue: function( type, data ) {
  20584. var setter = 2;
  20585. if ( typeof type !== "string" ) {
  20586. data = type;
  20587. type = "fx";
  20588. setter--;
  20589. }
  20590. if ( arguments.length < setter ) {
  20591. return jQuery.queue( this[ 0 ], type );
  20592. }
  20593. return data === undefined ?
  20594. this :
  20595. this.each( function() {
  20596. var queue = jQuery.queue( this, type, data );
  20597. // Ensure a hooks for this queue
  20598. jQuery._queueHooks( this, type );
  20599. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  20600. jQuery.dequeue( this, type );
  20601. }
  20602. } );
  20603. },
  20604. dequeue: function( type ) {
  20605. return this.each( function() {
  20606. jQuery.dequeue( this, type );
  20607. } );
  20608. },
  20609. clearQueue: function( type ) {
  20610. return this.queue( type || "fx", [] );
  20611. },
  20612. // Get a promise resolved when queues of a certain type
  20613. // are emptied (fx is the type by default)
  20614. promise: function( type, obj ) {
  20615. var tmp,
  20616. count = 1,
  20617. defer = jQuery.Deferred(),
  20618. elements = this,
  20619. i = this.length,
  20620. resolve = function() {
  20621. if ( !( --count ) ) {
  20622. defer.resolveWith( elements, [ elements ] );
  20623. }
  20624. };
  20625. if ( typeof type !== "string" ) {
  20626. obj = type;
  20627. type = undefined;
  20628. }
  20629. type = type || "fx";
  20630. while ( i-- ) {
  20631. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  20632. if ( tmp && tmp.empty ) {
  20633. count++;
  20634. tmp.empty.add( resolve );
  20635. }
  20636. }
  20637. resolve();
  20638. return defer.promise( obj );
  20639. }
  20640. } );
  20641. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  20642. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  20643. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  20644. var isHiddenWithinTree = function( elem, el ) {
  20645. // isHiddenWithinTree might be called from jQuery#filter function;
  20646. // in that case, element will be second argument
  20647. elem = el || elem;
  20648. // Inline style trumps all
  20649. return elem.style.display === "none" ||
  20650. elem.style.display === "" &&
  20651. // Otherwise, check computed style
  20652. // Support: Firefox <=43 - 45
  20653. // Disconnected elements can have computed display: none, so first confirm that elem is
  20654. // in the document.
  20655. jQuery.contains( elem.ownerDocument, elem ) &&
  20656. jQuery.css( elem, "display" ) === "none";
  20657. };
  20658. var swap = function( elem, options, callback, args ) {
  20659. var ret, name,
  20660. old = {};
  20661. // Remember the old values, and insert the new ones
  20662. for ( name in options ) {
  20663. old[ name ] = elem.style[ name ];
  20664. elem.style[ name ] = options[ name ];
  20665. }
  20666. ret = callback.apply( elem, args || [] );
  20667. // Revert the old values
  20668. for ( name in options ) {
  20669. elem.style[ name ] = old[ name ];
  20670. }
  20671. return ret;
  20672. };
  20673. function adjustCSS( elem, prop, valueParts, tween ) {
  20674. var adjusted, scale,
  20675. maxIterations = 20,
  20676. currentValue = tween ?
  20677. function() {
  20678. return tween.cur();
  20679. } :
  20680. function() {
  20681. return jQuery.css( elem, prop, "" );
  20682. },
  20683. initial = currentValue(),
  20684. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  20685. // Starting value computation is required for potential unit mismatches
  20686. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  20687. rcssNum.exec( jQuery.css( elem, prop ) );
  20688. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  20689. // Support: Firefox <=54
  20690. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  20691. initial = initial / 2;
  20692. // Trust units reported by jQuery.css
  20693. unit = unit || initialInUnit[ 3 ];
  20694. // Iteratively approximate from a nonzero starting point
  20695. initialInUnit = +initial || 1;
  20696. while ( maxIterations-- ) {
  20697. // Evaluate and update our best guess (doubling guesses that zero out).
  20698. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  20699. jQuery.style( elem, prop, initialInUnit + unit );
  20700. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  20701. maxIterations = 0;
  20702. }
  20703. initialInUnit = initialInUnit / scale;
  20704. }
  20705. initialInUnit = initialInUnit * 2;
  20706. jQuery.style( elem, prop, initialInUnit + unit );
  20707. // Make sure we update the tween properties later on
  20708. valueParts = valueParts || [];
  20709. }
  20710. if ( valueParts ) {
  20711. initialInUnit = +initialInUnit || +initial || 0;
  20712. // Apply relative offset (+=/-=) if specified
  20713. adjusted = valueParts[ 1 ] ?
  20714. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  20715. +valueParts[ 2 ];
  20716. if ( tween ) {
  20717. tween.unit = unit;
  20718. tween.start = initialInUnit;
  20719. tween.end = adjusted;
  20720. }
  20721. }
  20722. return adjusted;
  20723. }
  20724. var defaultDisplayMap = {};
  20725. function getDefaultDisplay( elem ) {
  20726. var temp,
  20727. doc = elem.ownerDocument,
  20728. nodeName = elem.nodeName,
  20729. display = defaultDisplayMap[ nodeName ];
  20730. if ( display ) {
  20731. return display;
  20732. }
  20733. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  20734. display = jQuery.css( temp, "display" );
  20735. temp.parentNode.removeChild( temp );
  20736. if ( display === "none" ) {
  20737. display = "block";
  20738. }
  20739. defaultDisplayMap[ nodeName ] = display;
  20740. return display;
  20741. }
  20742. function showHide( elements, show ) {
  20743. var display, elem,
  20744. values = [],
  20745. index = 0,
  20746. length = elements.length;
  20747. // Determine new display value for elements that need to change
  20748. for ( ; index < length; index++ ) {
  20749. elem = elements[ index ];
  20750. if ( !elem.style ) {
  20751. continue;
  20752. }
  20753. display = elem.style.display;
  20754. if ( show ) {
  20755. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  20756. // check is required in this first loop unless we have a nonempty display value (either
  20757. // inline or about-to-be-restored)
  20758. if ( display === "none" ) {
  20759. values[ index ] = dataPriv.get( elem, "display" ) || null;
  20760. if ( !values[ index ] ) {
  20761. elem.style.display = "";
  20762. }
  20763. }
  20764. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  20765. values[ index ] = getDefaultDisplay( elem );
  20766. }
  20767. } else {
  20768. if ( display !== "none" ) {
  20769. values[ index ] = "none";
  20770. // Remember what we're overwriting
  20771. dataPriv.set( elem, "display", display );
  20772. }
  20773. }
  20774. }
  20775. // Set the display of the elements in a second loop to avoid constant reflow
  20776. for ( index = 0; index < length; index++ ) {
  20777. if ( values[ index ] != null ) {
  20778. elements[ index ].style.display = values[ index ];
  20779. }
  20780. }
  20781. return elements;
  20782. }
  20783. jQuery.fn.extend( {
  20784. show: function() {
  20785. return showHide( this, true );
  20786. },
  20787. hide: function() {
  20788. return showHide( this );
  20789. },
  20790. toggle: function( state ) {
  20791. if ( typeof state === "boolean" ) {
  20792. return state ? this.show() : this.hide();
  20793. }
  20794. return this.each( function() {
  20795. if ( isHiddenWithinTree( this ) ) {
  20796. jQuery( this ).show();
  20797. } else {
  20798. jQuery( this ).hide();
  20799. }
  20800. } );
  20801. }
  20802. } );
  20803. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  20804. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  20805. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  20806. // We have to close these tags to support XHTML (#13200)
  20807. var wrapMap = {
  20808. // Support: IE <=9 only
  20809. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  20810. // XHTML parsers do not magically insert elements in the
  20811. // same way that tag soup parsers do. So we cannot shorten
  20812. // this by omitting <tbody> or other required elements.
  20813. thead: [ 1, "<table>", "</table>" ],
  20814. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  20815. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  20816. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  20817. _default: [ 0, "", "" ]
  20818. };
  20819. // Support: IE <=9 only
  20820. wrapMap.optgroup = wrapMap.option;
  20821. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  20822. wrapMap.th = wrapMap.td;
  20823. function getAll( context, tag ) {
  20824. // Support: IE <=9 - 11 only
  20825. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  20826. var ret;
  20827. if ( typeof context.getElementsByTagName !== "undefined" ) {
  20828. ret = context.getElementsByTagName( tag || "*" );
  20829. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  20830. ret = context.querySelectorAll( tag || "*" );
  20831. } else {
  20832. ret = [];
  20833. }
  20834. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  20835. return jQuery.merge( [ context ], ret );
  20836. }
  20837. return ret;
  20838. }
  20839. // Mark scripts as having already been evaluated
  20840. function setGlobalEval( elems, refElements ) {
  20841. var i = 0,
  20842. l = elems.length;
  20843. for ( ; i < l; i++ ) {
  20844. dataPriv.set(
  20845. elems[ i ],
  20846. "globalEval",
  20847. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  20848. );
  20849. }
  20850. }
  20851. var rhtml = /<|&#?\w+;/;
  20852. function buildFragment( elems, context, scripts, selection, ignored ) {
  20853. var elem, tmp, tag, wrap, contains, j,
  20854. fragment = context.createDocumentFragment(),
  20855. nodes = [],
  20856. i = 0,
  20857. l = elems.length;
  20858. for ( ; i < l; i++ ) {
  20859. elem = elems[ i ];
  20860. if ( elem || elem === 0 ) {
  20861. // Add nodes directly
  20862. if ( toType( elem ) === "object" ) {
  20863. // Support: Android <=4.0 only, PhantomJS 1 only
  20864. // push.apply(_, arraylike) throws on ancient WebKit
  20865. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  20866. // Convert non-html into a text node
  20867. } else if ( !rhtml.test( elem ) ) {
  20868. nodes.push( context.createTextNode( elem ) );
  20869. // Convert html into DOM nodes
  20870. } else {
  20871. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  20872. // Deserialize a standard representation
  20873. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  20874. wrap = wrapMap[ tag ] || wrapMap._default;
  20875. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  20876. // Descend through wrappers to the right content
  20877. j = wrap[ 0 ];
  20878. while ( j-- ) {
  20879. tmp = tmp.lastChild;
  20880. }
  20881. // Support: Android <=4.0 only, PhantomJS 1 only
  20882. // push.apply(_, arraylike) throws on ancient WebKit
  20883. jQuery.merge( nodes, tmp.childNodes );
  20884. // Remember the top-level container
  20885. tmp = fragment.firstChild;
  20886. // Ensure the created nodes are orphaned (#12392)
  20887. tmp.textContent = "";
  20888. }
  20889. }
  20890. }
  20891. // Remove wrapper from fragment
  20892. fragment.textContent = "";
  20893. i = 0;
  20894. while ( ( elem = nodes[ i++ ] ) ) {
  20895. // Skip elements already in the context collection (trac-4087)
  20896. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  20897. if ( ignored ) {
  20898. ignored.push( elem );
  20899. }
  20900. continue;
  20901. }
  20902. contains = jQuery.contains( elem.ownerDocument, elem );
  20903. // Append to fragment
  20904. tmp = getAll( fragment.appendChild( elem ), "script" );
  20905. // Preserve script evaluation history
  20906. if ( contains ) {
  20907. setGlobalEval( tmp );
  20908. }
  20909. // Capture executables
  20910. if ( scripts ) {
  20911. j = 0;
  20912. while ( ( elem = tmp[ j++ ] ) ) {
  20913. if ( rscriptType.test( elem.type || "" ) ) {
  20914. scripts.push( elem );
  20915. }
  20916. }
  20917. }
  20918. }
  20919. return fragment;
  20920. }
  20921. ( function() {
  20922. var fragment = document.createDocumentFragment(),
  20923. div = fragment.appendChild( document.createElement( "div" ) ),
  20924. input = document.createElement( "input" );
  20925. // Support: Android 4.0 - 4.3 only
  20926. // Check state lost if the name is set (#11217)
  20927. // Support: Windows Web Apps (WWA)
  20928. // `name` and `type` must use .setAttribute for WWA (#14901)
  20929. input.setAttribute( "type", "radio" );
  20930. input.setAttribute( "checked", "checked" );
  20931. input.setAttribute( "name", "t" );
  20932. div.appendChild( input );
  20933. // Support: Android <=4.1 only
  20934. // Older WebKit doesn't clone checked state correctly in fragments
  20935. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  20936. // Support: IE <=11 only
  20937. // Make sure textarea (and checkbox) defaultValue is properly cloned
  20938. div.innerHTML = "<textarea>x</textarea>";
  20939. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  20940. } )();
  20941. var documentElement = document.documentElement;
  20942. var
  20943. rkeyEvent = /^key/,
  20944. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  20945. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  20946. function returnTrue() {
  20947. return true;
  20948. }
  20949. function returnFalse() {
  20950. return false;
  20951. }
  20952. // Support: IE <=9 only
  20953. // See #13393 for more info
  20954. function safeActiveElement() {
  20955. try {
  20956. return document.activeElement;
  20957. } catch ( err ) { }
  20958. }
  20959. function on( elem, types, selector, data, fn, one ) {
  20960. var origFn, type;
  20961. // Types can be a map of types/handlers
  20962. if ( typeof types === "object" ) {
  20963. // ( types-Object, selector, data )
  20964. if ( typeof selector !== "string" ) {
  20965. // ( types-Object, data )
  20966. data = data || selector;
  20967. selector = undefined;
  20968. }
  20969. for ( type in types ) {
  20970. on( elem, type, selector, data, types[ type ], one );
  20971. }
  20972. return elem;
  20973. }
  20974. if ( data == null && fn == null ) {
  20975. // ( types, fn )
  20976. fn = selector;
  20977. data = selector = undefined;
  20978. } else if ( fn == null ) {
  20979. if ( typeof selector === "string" ) {
  20980. // ( types, selector, fn )
  20981. fn = data;
  20982. data = undefined;
  20983. } else {
  20984. // ( types, data, fn )
  20985. fn = data;
  20986. data = selector;
  20987. selector = undefined;
  20988. }
  20989. }
  20990. if ( fn === false ) {
  20991. fn = returnFalse;
  20992. } else if ( !fn ) {
  20993. return elem;
  20994. }
  20995. if ( one === 1 ) {
  20996. origFn = fn;
  20997. fn = function( event ) {
  20998. // Can use an empty set, since event contains the info
  20999. jQuery().off( event );
  21000. return origFn.apply( this, arguments );
  21001. };
  21002. // Use same guid so caller can remove using origFn
  21003. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  21004. }
  21005. return elem.each( function() {
  21006. jQuery.event.add( this, types, fn, data, selector );
  21007. } );
  21008. }
  21009. /*
  21010. * Helper functions for managing events -- not part of the public interface.
  21011. * Props to Dean Edwards' addEvent library for many of the ideas.
  21012. */
  21013. jQuery.event = {
  21014. global: {},
  21015. add: function( elem, types, handler, data, selector ) {
  21016. var handleObjIn, eventHandle, tmp,
  21017. events, t, handleObj,
  21018. special, handlers, type, namespaces, origType,
  21019. elemData = dataPriv.get( elem );
  21020. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  21021. if ( !elemData ) {
  21022. return;
  21023. }
  21024. // Caller can pass in an object of custom data in lieu of the handler
  21025. if ( handler.handler ) {
  21026. handleObjIn = handler;
  21027. handler = handleObjIn.handler;
  21028. selector = handleObjIn.selector;
  21029. }
  21030. // Ensure that invalid selectors throw exceptions at attach time
  21031. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  21032. if ( selector ) {
  21033. jQuery.find.matchesSelector( documentElement, selector );
  21034. }
  21035. // Make sure that the handler has a unique ID, used to find/remove it later
  21036. if ( !handler.guid ) {
  21037. handler.guid = jQuery.guid++;
  21038. }
  21039. // Init the element's event structure and main handler, if this is the first
  21040. if ( !( events = elemData.events ) ) {
  21041. events = elemData.events = {};
  21042. }
  21043. if ( !( eventHandle = elemData.handle ) ) {
  21044. eventHandle = elemData.handle = function( e ) {
  21045. // Discard the second event of a jQuery.event.trigger() and
  21046. // when an event is called after a page has unloaded
  21047. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  21048. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  21049. };
  21050. }
  21051. // Handle multiple events separated by a space
  21052. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  21053. t = types.length;
  21054. while ( t-- ) {
  21055. tmp = rtypenamespace.exec( types[ t ] ) || [];
  21056. type = origType = tmp[ 1 ];
  21057. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  21058. // There *must* be a type, no attaching namespace-only handlers
  21059. if ( !type ) {
  21060. continue;
  21061. }
  21062. // If event changes its type, use the special event handlers for the changed type
  21063. special = jQuery.event.special[ type ] || {};
  21064. // If selector defined, determine special event api type, otherwise given type
  21065. type = ( selector ? special.delegateType : special.bindType ) || type;
  21066. // Update special based on newly reset type
  21067. special = jQuery.event.special[ type ] || {};
  21068. // handleObj is passed to all event handlers
  21069. handleObj = jQuery.extend( {
  21070. type: type,
  21071. origType: origType,
  21072. data: data,
  21073. handler: handler,
  21074. guid: handler.guid,
  21075. selector: selector,
  21076. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  21077. namespace: namespaces.join( "." )
  21078. }, handleObjIn );
  21079. // Init the event handler queue if we're the first
  21080. if ( !( handlers = events[ type ] ) ) {
  21081. handlers = events[ type ] = [];
  21082. handlers.delegateCount = 0;
  21083. // Only use addEventListener if the special events handler returns false
  21084. if ( !special.setup ||
  21085. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  21086. if ( elem.addEventListener ) {
  21087. elem.addEventListener( type, eventHandle );
  21088. }
  21089. }
  21090. }
  21091. if ( special.add ) {
  21092. special.add.call( elem, handleObj );
  21093. if ( !handleObj.handler.guid ) {
  21094. handleObj.handler.guid = handler.guid;
  21095. }
  21096. }
  21097. // Add to the element's handler list, delegates in front
  21098. if ( selector ) {
  21099. handlers.splice( handlers.delegateCount++, 0, handleObj );
  21100. } else {
  21101. handlers.push( handleObj );
  21102. }
  21103. // Keep track of which events have ever been used, for event optimization
  21104. jQuery.event.global[ type ] = true;
  21105. }
  21106. },
  21107. // Detach an event or set of events from an element
  21108. remove: function( elem, types, handler, selector, mappedTypes ) {
  21109. var j, origCount, tmp,
  21110. events, t, handleObj,
  21111. special, handlers, type, namespaces, origType,
  21112. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  21113. if ( !elemData || !( events = elemData.events ) ) {
  21114. return;
  21115. }
  21116. // Once for each type.namespace in types; type may be omitted
  21117. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  21118. t = types.length;
  21119. while ( t-- ) {
  21120. tmp = rtypenamespace.exec( types[ t ] ) || [];
  21121. type = origType = tmp[ 1 ];
  21122. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  21123. // Unbind all events (on this namespace, if provided) for the element
  21124. if ( !type ) {
  21125. for ( type in events ) {
  21126. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  21127. }
  21128. continue;
  21129. }
  21130. special = jQuery.event.special[ type ] || {};
  21131. type = ( selector ? special.delegateType : special.bindType ) || type;
  21132. handlers = events[ type ] || [];
  21133. tmp = tmp[ 2 ] &&
  21134. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  21135. // Remove matching events
  21136. origCount = j = handlers.length;
  21137. while ( j-- ) {
  21138. handleObj = handlers[ j ];
  21139. if ( ( mappedTypes || origType === handleObj.origType ) &&
  21140. ( !handler || handler.guid === handleObj.guid ) &&
  21141. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  21142. ( !selector || selector === handleObj.selector ||
  21143. selector === "**" && handleObj.selector ) ) {
  21144. handlers.splice( j, 1 );
  21145. if ( handleObj.selector ) {
  21146. handlers.delegateCount--;
  21147. }
  21148. if ( special.remove ) {
  21149. special.remove.call( elem, handleObj );
  21150. }
  21151. }
  21152. }
  21153. // Remove generic event handler if we removed something and no more handlers exist
  21154. // (avoids potential for endless recursion during removal of special event handlers)
  21155. if ( origCount && !handlers.length ) {
  21156. if ( !special.teardown ||
  21157. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  21158. jQuery.removeEvent( elem, type, elemData.handle );
  21159. }
  21160. delete events[ type ];
  21161. }
  21162. }
  21163. // Remove data and the expando if it's no longer used
  21164. if ( jQuery.isEmptyObject( events ) ) {
  21165. dataPriv.remove( elem, "handle events" );
  21166. }
  21167. },
  21168. dispatch: function( nativeEvent ) {
  21169. // Make a writable jQuery.Event from the native event object
  21170. var event = jQuery.event.fix( nativeEvent );
  21171. var i, j, ret, matched, handleObj, handlerQueue,
  21172. args = new Array( arguments.length ),
  21173. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  21174. special = jQuery.event.special[ event.type ] || {};
  21175. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  21176. args[ 0 ] = event;
  21177. for ( i = 1; i < arguments.length; i++ ) {
  21178. args[ i ] = arguments[ i ];
  21179. }
  21180. event.delegateTarget = this;
  21181. // Call the preDispatch hook for the mapped type, and let it bail if desired
  21182. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  21183. return;
  21184. }
  21185. // Determine handlers
  21186. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  21187. // Run delegates first; they may want to stop propagation beneath us
  21188. i = 0;
  21189. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  21190. event.currentTarget = matched.elem;
  21191. j = 0;
  21192. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  21193. !event.isImmediatePropagationStopped() ) {
  21194. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  21195. // a subset or equal to those in the bound event (both can have no namespace).
  21196. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  21197. event.handleObj = handleObj;
  21198. event.data = handleObj.data;
  21199. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  21200. handleObj.handler ).apply( matched.elem, args );
  21201. if ( ret !== undefined ) {
  21202. if ( ( event.result = ret ) === false ) {
  21203. event.preventDefault();
  21204. event.stopPropagation();
  21205. }
  21206. }
  21207. }
  21208. }
  21209. }
  21210. // Call the postDispatch hook for the mapped type
  21211. if ( special.postDispatch ) {
  21212. special.postDispatch.call( this, event );
  21213. }
  21214. return event.result;
  21215. },
  21216. handlers: function( event, handlers ) {
  21217. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  21218. handlerQueue = [],
  21219. delegateCount = handlers.delegateCount,
  21220. cur = event.target;
  21221. // Find delegate handlers
  21222. if ( delegateCount &&
  21223. // Support: IE <=9
  21224. // Black-hole SVG <use> instance trees (trac-13180)
  21225. cur.nodeType &&
  21226. // Support: Firefox <=42
  21227. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  21228. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  21229. // Support: IE 11 only
  21230. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  21231. !( event.type === "click" && event.button >= 1 ) ) {
  21232. for ( ; cur !== this; cur = cur.parentNode || this ) {
  21233. // Don't check non-elements (#13208)
  21234. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  21235. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  21236. matchedHandlers = [];
  21237. matchedSelectors = {};
  21238. for ( i = 0; i < delegateCount; i++ ) {
  21239. handleObj = handlers[ i ];
  21240. // Don't conflict with Object.prototype properties (#13203)
  21241. sel = handleObj.selector + " ";
  21242. if ( matchedSelectors[ sel ] === undefined ) {
  21243. matchedSelectors[ sel ] = handleObj.needsContext ?
  21244. jQuery( sel, this ).index( cur ) > -1 :
  21245. jQuery.find( sel, this, null, [ cur ] ).length;
  21246. }
  21247. if ( matchedSelectors[ sel ] ) {
  21248. matchedHandlers.push( handleObj );
  21249. }
  21250. }
  21251. if ( matchedHandlers.length ) {
  21252. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  21253. }
  21254. }
  21255. }
  21256. }
  21257. // Add the remaining (directly-bound) handlers
  21258. cur = this;
  21259. if ( delegateCount < handlers.length ) {
  21260. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  21261. }
  21262. return handlerQueue;
  21263. },
  21264. addProp: function( name, hook ) {
  21265. Object.defineProperty( jQuery.Event.prototype, name, {
  21266. enumerable: true,
  21267. configurable: true,
  21268. get: isFunction( hook ) ?
  21269. function() {
  21270. if ( this.originalEvent ) {
  21271. return hook( this.originalEvent );
  21272. }
  21273. } :
  21274. function() {
  21275. if ( this.originalEvent ) {
  21276. return this.originalEvent[ name ];
  21277. }
  21278. },
  21279. set: function( value ) {
  21280. Object.defineProperty( this, name, {
  21281. enumerable: true,
  21282. configurable: true,
  21283. writable: true,
  21284. value: value
  21285. } );
  21286. }
  21287. } );
  21288. },
  21289. fix: function( originalEvent ) {
  21290. return originalEvent[ jQuery.expando ] ?
  21291. originalEvent :
  21292. new jQuery.Event( originalEvent );
  21293. },
  21294. special: {
  21295. load: {
  21296. // Prevent triggered image.load events from bubbling to window.load
  21297. noBubble: true
  21298. },
  21299. focus: {
  21300. // Fire native event if possible so blur/focus sequence is correct
  21301. trigger: function() {
  21302. if ( this !== safeActiveElement() && this.focus ) {
  21303. this.focus();
  21304. return false;
  21305. }
  21306. },
  21307. delegateType: "focusin"
  21308. },
  21309. blur: {
  21310. trigger: function() {
  21311. if ( this === safeActiveElement() && this.blur ) {
  21312. this.blur();
  21313. return false;
  21314. }
  21315. },
  21316. delegateType: "focusout"
  21317. },
  21318. click: {
  21319. // For checkbox, fire native event so checked state will be right
  21320. trigger: function() {
  21321. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  21322. this.click();
  21323. return false;
  21324. }
  21325. },
  21326. // For cross-browser consistency, don't fire native .click() on links
  21327. _default: function( event ) {
  21328. return nodeName( event.target, "a" );
  21329. }
  21330. },
  21331. beforeunload: {
  21332. postDispatch: function( event ) {
  21333. // Support: Firefox 20+
  21334. // Firefox doesn't alert if the returnValue field is not set.
  21335. if ( event.result !== undefined && event.originalEvent ) {
  21336. event.originalEvent.returnValue = event.result;
  21337. }
  21338. }
  21339. }
  21340. }
  21341. };
  21342. jQuery.removeEvent = function( elem, type, handle ) {
  21343. // This "if" is needed for plain objects
  21344. if ( elem.removeEventListener ) {
  21345. elem.removeEventListener( type, handle );
  21346. }
  21347. };
  21348. jQuery.Event = function( src, props ) {
  21349. // Allow instantiation without the 'new' keyword
  21350. if ( !( this instanceof jQuery.Event ) ) {
  21351. return new jQuery.Event( src, props );
  21352. }
  21353. // Event object
  21354. if ( src && src.type ) {
  21355. this.originalEvent = src;
  21356. this.type = src.type;
  21357. // Events bubbling up the document may have been marked as prevented
  21358. // by a handler lower down the tree; reflect the correct value.
  21359. this.isDefaultPrevented = src.defaultPrevented ||
  21360. src.defaultPrevented === undefined &&
  21361. // Support: Android <=2.3 only
  21362. src.returnValue === false ?
  21363. returnTrue :
  21364. returnFalse;
  21365. // Create target properties
  21366. // Support: Safari <=6 - 7 only
  21367. // Target should not be a text node (#504, #13143)
  21368. this.target = ( src.target && src.target.nodeType === 3 ) ?
  21369. src.target.parentNode :
  21370. src.target;
  21371. this.currentTarget = src.currentTarget;
  21372. this.relatedTarget = src.relatedTarget;
  21373. // Event type
  21374. } else {
  21375. this.type = src;
  21376. }
  21377. // Put explicitly provided properties onto the event object
  21378. if ( props ) {
  21379. jQuery.extend( this, props );
  21380. }
  21381. // Create a timestamp if incoming event doesn't have one
  21382. this.timeStamp = src && src.timeStamp || Date.now();
  21383. // Mark it as fixed
  21384. this[ jQuery.expando ] = true;
  21385. };
  21386. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  21387. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  21388. jQuery.Event.prototype = {
  21389. constructor: jQuery.Event,
  21390. isDefaultPrevented: returnFalse,
  21391. isPropagationStopped: returnFalse,
  21392. isImmediatePropagationStopped: returnFalse,
  21393. isSimulated: false,
  21394. preventDefault: function() {
  21395. var e = this.originalEvent;
  21396. this.isDefaultPrevented = returnTrue;
  21397. if ( e && !this.isSimulated ) {
  21398. e.preventDefault();
  21399. }
  21400. },
  21401. stopPropagation: function() {
  21402. var e = this.originalEvent;
  21403. this.isPropagationStopped = returnTrue;
  21404. if ( e && !this.isSimulated ) {
  21405. e.stopPropagation();
  21406. }
  21407. },
  21408. stopImmediatePropagation: function() {
  21409. var e = this.originalEvent;
  21410. this.isImmediatePropagationStopped = returnTrue;
  21411. if ( e && !this.isSimulated ) {
  21412. e.stopImmediatePropagation();
  21413. }
  21414. this.stopPropagation();
  21415. }
  21416. };
  21417. // Includes all common event props including KeyEvent and MouseEvent specific props
  21418. jQuery.each( {
  21419. altKey: true,
  21420. bubbles: true,
  21421. cancelable: true,
  21422. changedTouches: true,
  21423. ctrlKey: true,
  21424. detail: true,
  21425. eventPhase: true,
  21426. metaKey: true,
  21427. pageX: true,
  21428. pageY: true,
  21429. shiftKey: true,
  21430. view: true,
  21431. "char": true,
  21432. charCode: true,
  21433. key: true,
  21434. keyCode: true,
  21435. button: true,
  21436. buttons: true,
  21437. clientX: true,
  21438. clientY: true,
  21439. offsetX: true,
  21440. offsetY: true,
  21441. pointerId: true,
  21442. pointerType: true,
  21443. screenX: true,
  21444. screenY: true,
  21445. targetTouches: true,
  21446. toElement: true,
  21447. touches: true,
  21448. which: function( event ) {
  21449. var button = event.button;
  21450. // Add which for key events
  21451. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  21452. return event.charCode != null ? event.charCode : event.keyCode;
  21453. }
  21454. // Add which for click: 1 === left; 2 === middle; 3 === right
  21455. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  21456. if ( button & 1 ) {
  21457. return 1;
  21458. }
  21459. if ( button & 2 ) {
  21460. return 3;
  21461. }
  21462. if ( button & 4 ) {
  21463. return 2;
  21464. }
  21465. return 0;
  21466. }
  21467. return event.which;
  21468. }
  21469. }, jQuery.event.addProp );
  21470. // Create mouseenter/leave events using mouseover/out and event-time checks
  21471. // so that event delegation works in jQuery.
  21472. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  21473. //
  21474. // Support: Safari 7 only
  21475. // Safari sends mouseenter too often; see:
  21476. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  21477. // for the description of the bug (it existed in older Chrome versions as well).
  21478. jQuery.each( {
  21479. mouseenter: "mouseover",
  21480. mouseleave: "mouseout",
  21481. pointerenter: "pointerover",
  21482. pointerleave: "pointerout"
  21483. }, function( orig, fix ) {
  21484. jQuery.event.special[ orig ] = {
  21485. delegateType: fix,
  21486. bindType: fix,
  21487. handle: function( event ) {
  21488. var ret,
  21489. target = this,
  21490. related = event.relatedTarget,
  21491. handleObj = event.handleObj;
  21492. // For mouseenter/leave call the handler if related is outside the target.
  21493. // NB: No relatedTarget if the mouse left/entered the browser window
  21494. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  21495. event.type = handleObj.origType;
  21496. ret = handleObj.handler.apply( this, arguments );
  21497. event.type = fix;
  21498. }
  21499. return ret;
  21500. }
  21501. };
  21502. } );
  21503. jQuery.fn.extend( {
  21504. on: function( types, selector, data, fn ) {
  21505. return on( this, types, selector, data, fn );
  21506. },
  21507. one: function( types, selector, data, fn ) {
  21508. return on( this, types, selector, data, fn, 1 );
  21509. },
  21510. off: function( types, selector, fn ) {
  21511. var handleObj, type;
  21512. if ( types && types.preventDefault && types.handleObj ) {
  21513. // ( event ) dispatched jQuery.Event
  21514. handleObj = types.handleObj;
  21515. jQuery( types.delegateTarget ).off(
  21516. handleObj.namespace ?
  21517. handleObj.origType + "." + handleObj.namespace :
  21518. handleObj.origType,
  21519. handleObj.selector,
  21520. handleObj.handler
  21521. );
  21522. return this;
  21523. }
  21524. if ( typeof types === "object" ) {
  21525. // ( types-object [, selector] )
  21526. for ( type in types ) {
  21527. this.off( type, selector, types[ type ] );
  21528. }
  21529. return this;
  21530. }
  21531. if ( selector === false || typeof selector === "function" ) {
  21532. // ( types [, fn] )
  21533. fn = selector;
  21534. selector = undefined;
  21535. }
  21536. if ( fn === false ) {
  21537. fn = returnFalse;
  21538. }
  21539. return this.each( function() {
  21540. jQuery.event.remove( this, types, fn, selector );
  21541. } );
  21542. }
  21543. } );
  21544. var
  21545. /* eslint-disable max-len */
  21546. // See https://github.com/eslint/eslint/issues/3229
  21547. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  21548. /* eslint-enable */
  21549. // Support: IE <=10 - 11, Edge 12 - 13 only
  21550. // In IE/Edge using regex groups here causes severe slowdowns.
  21551. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  21552. rnoInnerhtml = /<script|<style|<link/i,
  21553. // checked="checked" or checked
  21554. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  21555. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  21556. // Prefer a tbody over its parent table for containing new rows
  21557. function manipulationTarget( elem, content ) {
  21558. if ( nodeName( elem, "table" ) &&
  21559. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  21560. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  21561. }
  21562. return elem;
  21563. }
  21564. // Replace/restore the type attribute of script elements for safe DOM manipulation
  21565. function disableScript( elem ) {
  21566. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  21567. return elem;
  21568. }
  21569. function restoreScript( elem ) {
  21570. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  21571. elem.type = elem.type.slice( 5 );
  21572. } else {
  21573. elem.removeAttribute( "type" );
  21574. }
  21575. return elem;
  21576. }
  21577. function cloneCopyEvent( src, dest ) {
  21578. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  21579. if ( dest.nodeType !== 1 ) {
  21580. return;
  21581. }
  21582. // 1. Copy private data: events, handlers, etc.
  21583. if ( dataPriv.hasData( src ) ) {
  21584. pdataOld = dataPriv.access( src );
  21585. pdataCur = dataPriv.set( dest, pdataOld );
  21586. events = pdataOld.events;
  21587. if ( events ) {
  21588. delete pdataCur.handle;
  21589. pdataCur.events = {};
  21590. for ( type in events ) {
  21591. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  21592. jQuery.event.add( dest, type, events[ type ][ i ] );
  21593. }
  21594. }
  21595. }
  21596. }
  21597. // 2. Copy user data
  21598. if ( dataUser.hasData( src ) ) {
  21599. udataOld = dataUser.access( src );
  21600. udataCur = jQuery.extend( {}, udataOld );
  21601. dataUser.set( dest, udataCur );
  21602. }
  21603. }
  21604. // Fix IE bugs, see support tests
  21605. function fixInput( src, dest ) {
  21606. var nodeName = dest.nodeName.toLowerCase();
  21607. // Fails to persist the checked state of a cloned checkbox or radio button.
  21608. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  21609. dest.checked = src.checked;
  21610. // Fails to return the selected option to the default selected state when cloning options
  21611. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  21612. dest.defaultValue = src.defaultValue;
  21613. }
  21614. }
  21615. function domManip( collection, args, callback, ignored ) {
  21616. // Flatten any nested arrays
  21617. args = concat.apply( [], args );
  21618. var fragment, first, scripts, hasScripts, node, doc,
  21619. i = 0,
  21620. l = collection.length,
  21621. iNoClone = l - 1,
  21622. value = args[ 0 ],
  21623. valueIsFunction = isFunction( value );
  21624. // We can't cloneNode fragments that contain checked, in WebKit
  21625. if ( valueIsFunction ||
  21626. ( l > 1 && typeof value === "string" &&
  21627. !support.checkClone && rchecked.test( value ) ) ) {
  21628. return collection.each( function( index ) {
  21629. var self = collection.eq( index );
  21630. if ( valueIsFunction ) {
  21631. args[ 0 ] = value.call( this, index, self.html() );
  21632. }
  21633. domManip( self, args, callback, ignored );
  21634. } );
  21635. }
  21636. if ( l ) {
  21637. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  21638. first = fragment.firstChild;
  21639. if ( fragment.childNodes.length === 1 ) {
  21640. fragment = first;
  21641. }
  21642. // Require either new content or an interest in ignored elements to invoke the callback
  21643. if ( first || ignored ) {
  21644. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  21645. hasScripts = scripts.length;
  21646. // Use the original fragment for the last item
  21647. // instead of the first because it can end up
  21648. // being emptied incorrectly in certain situations (#8070).
  21649. for ( ; i < l; i++ ) {
  21650. node = fragment;
  21651. if ( i !== iNoClone ) {
  21652. node = jQuery.clone( node, true, true );
  21653. // Keep references to cloned scripts for later restoration
  21654. if ( hasScripts ) {
  21655. // Support: Android <=4.0 only, PhantomJS 1 only
  21656. // push.apply(_, arraylike) throws on ancient WebKit
  21657. jQuery.merge( scripts, getAll( node, "script" ) );
  21658. }
  21659. }
  21660. callback.call( collection[ i ], node, i );
  21661. }
  21662. if ( hasScripts ) {
  21663. doc = scripts[ scripts.length - 1 ].ownerDocument;
  21664. // Reenable scripts
  21665. jQuery.map( scripts, restoreScript );
  21666. // Evaluate executable scripts on first document insertion
  21667. for ( i = 0; i < hasScripts; i++ ) {
  21668. node = scripts[ i ];
  21669. if ( rscriptType.test( node.type || "" ) &&
  21670. !dataPriv.access( node, "globalEval" ) &&
  21671. jQuery.contains( doc, node ) ) {
  21672. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  21673. // Optional AJAX dependency, but won't run scripts if not present
  21674. if ( jQuery._evalUrl ) {
  21675. jQuery._evalUrl( node.src );
  21676. }
  21677. } else {
  21678. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  21679. }
  21680. }
  21681. }
  21682. }
  21683. }
  21684. }
  21685. return collection;
  21686. }
  21687. function remove( elem, selector, keepData ) {
  21688. var node,
  21689. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  21690. i = 0;
  21691. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  21692. if ( !keepData && node.nodeType === 1 ) {
  21693. jQuery.cleanData( getAll( node ) );
  21694. }
  21695. if ( node.parentNode ) {
  21696. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  21697. setGlobalEval( getAll( node, "script" ) );
  21698. }
  21699. node.parentNode.removeChild( node );
  21700. }
  21701. }
  21702. return elem;
  21703. }
  21704. jQuery.extend( {
  21705. htmlPrefilter: function( html ) {
  21706. return html.replace( rxhtmlTag, "<$1></$2>" );
  21707. },
  21708. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  21709. var i, l, srcElements, destElements,
  21710. clone = elem.cloneNode( true ),
  21711. inPage = jQuery.contains( elem.ownerDocument, elem );
  21712. // Fix IE cloning issues
  21713. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  21714. !jQuery.isXMLDoc( elem ) ) {
  21715. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  21716. destElements = getAll( clone );
  21717. srcElements = getAll( elem );
  21718. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  21719. fixInput( srcElements[ i ], destElements[ i ] );
  21720. }
  21721. }
  21722. // Copy the events from the original to the clone
  21723. if ( dataAndEvents ) {
  21724. if ( deepDataAndEvents ) {
  21725. srcElements = srcElements || getAll( elem );
  21726. destElements = destElements || getAll( clone );
  21727. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  21728. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  21729. }
  21730. } else {
  21731. cloneCopyEvent( elem, clone );
  21732. }
  21733. }
  21734. // Preserve script evaluation history
  21735. destElements = getAll( clone, "script" );
  21736. if ( destElements.length > 0 ) {
  21737. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  21738. }
  21739. // Return the cloned set
  21740. return clone;
  21741. },
  21742. cleanData: function( elems ) {
  21743. var data, elem, type,
  21744. special = jQuery.event.special,
  21745. i = 0;
  21746. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  21747. if ( acceptData( elem ) ) {
  21748. if ( ( data = elem[ dataPriv.expando ] ) ) {
  21749. if ( data.events ) {
  21750. for ( type in data.events ) {
  21751. if ( special[ type ] ) {
  21752. jQuery.event.remove( elem, type );
  21753. // This is a shortcut to avoid jQuery.event.remove's overhead
  21754. } else {
  21755. jQuery.removeEvent( elem, type, data.handle );
  21756. }
  21757. }
  21758. }
  21759. // Support: Chrome <=35 - 45+
  21760. // Assign undefined instead of using delete, see Data#remove
  21761. elem[ dataPriv.expando ] = undefined;
  21762. }
  21763. if ( elem[ dataUser.expando ] ) {
  21764. // Support: Chrome <=35 - 45+
  21765. // Assign undefined instead of using delete, see Data#remove
  21766. elem[ dataUser.expando ] = undefined;
  21767. }
  21768. }
  21769. }
  21770. }
  21771. } );
  21772. jQuery.fn.extend( {
  21773. detach: function( selector ) {
  21774. return remove( this, selector, true );
  21775. },
  21776. remove: function( selector ) {
  21777. return remove( this, selector );
  21778. },
  21779. text: function( value ) {
  21780. return access( this, function( value ) {
  21781. return value === undefined ?
  21782. jQuery.text( this ) :
  21783. this.empty().each( function() {
  21784. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21785. this.textContent = value;
  21786. }
  21787. } );
  21788. }, null, value, arguments.length );
  21789. },
  21790. append: function() {
  21791. return domManip( this, arguments, function( elem ) {
  21792. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21793. var target = manipulationTarget( this, elem );
  21794. target.appendChild( elem );
  21795. }
  21796. } );
  21797. },
  21798. prepend: function() {
  21799. return domManip( this, arguments, function( elem ) {
  21800. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  21801. var target = manipulationTarget( this, elem );
  21802. target.insertBefore( elem, target.firstChild );
  21803. }
  21804. } );
  21805. },
  21806. before: function() {
  21807. return domManip( this, arguments, function( elem ) {
  21808. if ( this.parentNode ) {
  21809. this.parentNode.insertBefore( elem, this );
  21810. }
  21811. } );
  21812. },
  21813. after: function() {
  21814. return domManip( this, arguments, function( elem ) {
  21815. if ( this.parentNode ) {
  21816. this.parentNode.insertBefore( elem, this.nextSibling );
  21817. }
  21818. } );
  21819. },
  21820. empty: function() {
  21821. var elem,
  21822. i = 0;
  21823. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  21824. if ( elem.nodeType === 1 ) {
  21825. // Prevent memory leaks
  21826. jQuery.cleanData( getAll( elem, false ) );
  21827. // Remove any remaining nodes
  21828. elem.textContent = "";
  21829. }
  21830. }
  21831. return this;
  21832. },
  21833. clone: function( dataAndEvents, deepDataAndEvents ) {
  21834. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  21835. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  21836. return this.map( function() {
  21837. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  21838. } );
  21839. },
  21840. html: function( value ) {
  21841. return access( this, function( value ) {
  21842. var elem = this[ 0 ] || {},
  21843. i = 0,
  21844. l = this.length;
  21845. if ( value === undefined && elem.nodeType === 1 ) {
  21846. return elem.innerHTML;
  21847. }
  21848. // See if we can take a shortcut and just use innerHTML
  21849. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  21850. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  21851. value = jQuery.htmlPrefilter( value );
  21852. try {
  21853. for ( ; i < l; i++ ) {
  21854. elem = this[ i ] || {};
  21855. // Remove element nodes and prevent memory leaks
  21856. if ( elem.nodeType === 1 ) {
  21857. jQuery.cleanData( getAll( elem, false ) );
  21858. elem.innerHTML = value;
  21859. }
  21860. }
  21861. elem = 0;
  21862. // If using innerHTML throws an exception, use the fallback method
  21863. } catch ( e ) {}
  21864. }
  21865. if ( elem ) {
  21866. this.empty().append( value );
  21867. }
  21868. }, null, value, arguments.length );
  21869. },
  21870. replaceWith: function() {
  21871. var ignored = [];
  21872. // Make the changes, replacing each non-ignored context element with the new content
  21873. return domManip( this, arguments, function( elem ) {
  21874. var parent = this.parentNode;
  21875. if ( jQuery.inArray( this, ignored ) < 0 ) {
  21876. jQuery.cleanData( getAll( this ) );
  21877. if ( parent ) {
  21878. parent.replaceChild( elem, this );
  21879. }
  21880. }
  21881. // Force callback invocation
  21882. }, ignored );
  21883. }
  21884. } );
  21885. jQuery.each( {
  21886. appendTo: "append",
  21887. prependTo: "prepend",
  21888. insertBefore: "before",
  21889. insertAfter: "after",
  21890. replaceAll: "replaceWith"
  21891. }, function( name, original ) {
  21892. jQuery.fn[ name ] = function( selector ) {
  21893. var elems,
  21894. ret = [],
  21895. insert = jQuery( selector ),
  21896. last = insert.length - 1,
  21897. i = 0;
  21898. for ( ; i <= last; i++ ) {
  21899. elems = i === last ? this : this.clone( true );
  21900. jQuery( insert[ i ] )[ original ]( elems );
  21901. // Support: Android <=4.0 only, PhantomJS 1 only
  21902. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  21903. push.apply( ret, elems.get() );
  21904. }
  21905. return this.pushStack( ret );
  21906. };
  21907. } );
  21908. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  21909. var getStyles = function( elem ) {
  21910. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  21911. // IE throws on elements created in popups
  21912. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  21913. var view = elem.ownerDocument.defaultView;
  21914. if ( !view || !view.opener ) {
  21915. view = window;
  21916. }
  21917. return view.getComputedStyle( elem );
  21918. };
  21919. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  21920. ( function() {
  21921. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  21922. // so they're executed at the same time to save the second computation.
  21923. function computeStyleTests() {
  21924. // This is a singleton, we need to execute it only once
  21925. if ( !div ) {
  21926. return;
  21927. }
  21928. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  21929. "margin-top:1px;padding:0;border:0";
  21930. div.style.cssText =
  21931. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  21932. "margin:auto;border:1px;padding:1px;" +
  21933. "width:60%;top:1%";
  21934. documentElement.appendChild( container ).appendChild( div );
  21935. var divStyle = window.getComputedStyle( div );
  21936. pixelPositionVal = divStyle.top !== "1%";
  21937. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  21938. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  21939. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  21940. // Some styles come back with percentage values, even though they shouldn't
  21941. div.style.right = "60%";
  21942. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  21943. // Support: IE 9 - 11 only
  21944. // Detect misreporting of content dimensions for box-sizing:border-box elements
  21945. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  21946. // Support: IE 9 only
  21947. // Detect overflow:scroll screwiness (gh-3699)
  21948. div.style.position = "absolute";
  21949. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  21950. documentElement.removeChild( container );
  21951. // Nullify the div so it wouldn't be stored in the memory and
  21952. // it will also be a sign that checks already performed
  21953. div = null;
  21954. }
  21955. function roundPixelMeasures( measure ) {
  21956. return Math.round( parseFloat( measure ) );
  21957. }
  21958. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  21959. reliableMarginLeftVal,
  21960. container = document.createElement( "div" ),
  21961. div = document.createElement( "div" );
  21962. // Finish early in limited (non-browser) environments
  21963. if ( !div.style ) {
  21964. return;
  21965. }
  21966. // Support: IE <=9 - 11 only
  21967. // Style of cloned element affects source element cloned (#8908)
  21968. div.style.backgroundClip = "content-box";
  21969. div.cloneNode( true ).style.backgroundClip = "";
  21970. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  21971. jQuery.extend( support, {
  21972. boxSizingReliable: function() {
  21973. computeStyleTests();
  21974. return boxSizingReliableVal;
  21975. },
  21976. pixelBoxStyles: function() {
  21977. computeStyleTests();
  21978. return pixelBoxStylesVal;
  21979. },
  21980. pixelPosition: function() {
  21981. computeStyleTests();
  21982. return pixelPositionVal;
  21983. },
  21984. reliableMarginLeft: function() {
  21985. computeStyleTests();
  21986. return reliableMarginLeftVal;
  21987. },
  21988. scrollboxSize: function() {
  21989. computeStyleTests();
  21990. return scrollboxSizeVal;
  21991. }
  21992. } );
  21993. } )();
  21994. function curCSS( elem, name, computed ) {
  21995. var width, minWidth, maxWidth, ret,
  21996. // Support: Firefox 51+
  21997. // Retrieving style before computed somehow
  21998. // fixes an issue with getting wrong values
  21999. // on detached elements
  22000. style = elem.style;
  22001. computed = computed || getStyles( elem );
  22002. // getPropertyValue is needed for:
  22003. // .css('filter') (IE 9 only, #12537)
  22004. // .css('--customProperty) (#3144)
  22005. if ( computed ) {
  22006. ret = computed.getPropertyValue( name ) || computed[ name ];
  22007. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  22008. ret = jQuery.style( elem, name );
  22009. }
  22010. // A tribute to the "awesome hack by Dean Edwards"
  22011. // Android Browser returns percentage for some values,
  22012. // but width seems to be reliably pixels.
  22013. // This is against the CSSOM draft spec:
  22014. // https://drafts.csswg.org/cssom/#resolved-values
  22015. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  22016. // Remember the original values
  22017. width = style.width;
  22018. minWidth = style.minWidth;
  22019. maxWidth = style.maxWidth;
  22020. // Put in the new values to get a computed value out
  22021. style.minWidth = style.maxWidth = style.width = ret;
  22022. ret = computed.width;
  22023. // Revert the changed values
  22024. style.width = width;
  22025. style.minWidth = minWidth;
  22026. style.maxWidth = maxWidth;
  22027. }
  22028. }
  22029. return ret !== undefined ?
  22030. // Support: IE <=9 - 11 only
  22031. // IE returns zIndex value as an integer.
  22032. ret + "" :
  22033. ret;
  22034. }
  22035. function addGetHookIf( conditionFn, hookFn ) {
  22036. // Define the hook, we'll check on the first run if it's really needed.
  22037. return {
  22038. get: function() {
  22039. if ( conditionFn() ) {
  22040. // Hook not needed (or it's not possible to use it due
  22041. // to missing dependency), remove it.
  22042. delete this.get;
  22043. return;
  22044. }
  22045. // Hook needed; redefine it so that the support test is not executed again.
  22046. return ( this.get = hookFn ).apply( this, arguments );
  22047. }
  22048. };
  22049. }
  22050. var
  22051. // Swappable if display is none or starts with table
  22052. // except "table", "table-cell", or "table-caption"
  22053. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  22054. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  22055. rcustomProp = /^--/,
  22056. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  22057. cssNormalTransform = {
  22058. letterSpacing: "0",
  22059. fontWeight: "400"
  22060. },
  22061. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  22062. emptyStyle = document.createElement( "div" ).style;
  22063. // Return a css property mapped to a potentially vendor prefixed property
  22064. function vendorPropName( name ) {
  22065. // Shortcut for names that are not vendor prefixed
  22066. if ( name in emptyStyle ) {
  22067. return name;
  22068. }
  22069. // Check for vendor prefixed names
  22070. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  22071. i = cssPrefixes.length;
  22072. while ( i-- ) {
  22073. name = cssPrefixes[ i ] + capName;
  22074. if ( name in emptyStyle ) {
  22075. return name;
  22076. }
  22077. }
  22078. }
  22079. // Return a property mapped along what jQuery.cssProps suggests or to
  22080. // a vendor prefixed property.
  22081. function finalPropName( name ) {
  22082. var ret = jQuery.cssProps[ name ];
  22083. if ( !ret ) {
  22084. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  22085. }
  22086. return ret;
  22087. }
  22088. function setPositiveNumber( elem, value, subtract ) {
  22089. // Any relative (+/-) values have already been
  22090. // normalized at this point
  22091. var matches = rcssNum.exec( value );
  22092. return matches ?
  22093. // Guard against undefined "subtract", e.g., when used as in cssHooks
  22094. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  22095. value;
  22096. }
  22097. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  22098. var i = dimension === "width" ? 1 : 0,
  22099. extra = 0,
  22100. delta = 0;
  22101. // Adjustment may not be necessary
  22102. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  22103. return 0;
  22104. }
  22105. for ( ; i < 4; i += 2 ) {
  22106. // Both box models exclude margin
  22107. if ( box === "margin" ) {
  22108. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  22109. }
  22110. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  22111. if ( !isBorderBox ) {
  22112. // Add padding
  22113. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  22114. // For "border" or "margin", add border
  22115. if ( box !== "padding" ) {
  22116. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22117. // But still keep track of it otherwise
  22118. } else {
  22119. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22120. }
  22121. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  22122. // "padding" or "margin"
  22123. } else {
  22124. // For "content", subtract padding
  22125. if ( box === "content" ) {
  22126. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  22127. }
  22128. // For "content" or "padding", subtract border
  22129. if ( box !== "margin" ) {
  22130. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22131. }
  22132. }
  22133. }
  22134. // Account for positive content-box scroll gutter when requested by providing computedVal
  22135. if ( !isBorderBox && computedVal >= 0 ) {
  22136. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  22137. // Assuming integer scroll gutter, subtract the rest and round down
  22138. delta += Math.max( 0, Math.ceil(
  22139. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  22140. computedVal -
  22141. delta -
  22142. extra -
  22143. 0.5
  22144. ) );
  22145. }
  22146. return delta;
  22147. }
  22148. function getWidthOrHeight( elem, dimension, extra ) {
  22149. // Start with computed style
  22150. var styles = getStyles( elem ),
  22151. val = curCSS( elem, dimension, styles ),
  22152. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  22153. valueIsBorderBox = isBorderBox;
  22154. // Support: Firefox <=54
  22155. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  22156. if ( rnumnonpx.test( val ) ) {
  22157. if ( !extra ) {
  22158. return val;
  22159. }
  22160. val = "auto";
  22161. }
  22162. // Check for style in case a browser which returns unreliable values
  22163. // for getComputedStyle silently falls back to the reliable elem.style
  22164. valueIsBorderBox = valueIsBorderBox &&
  22165. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  22166. // Fall back to offsetWidth/offsetHeight when value is "auto"
  22167. // This happens for inline elements with no explicit setting (gh-3571)
  22168. // Support: Android <=4.1 - 4.3 only
  22169. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  22170. if ( val === "auto" ||
  22171. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  22172. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  22173. // offsetWidth/offsetHeight provide border-box values
  22174. valueIsBorderBox = true;
  22175. }
  22176. // Normalize "" and auto
  22177. val = parseFloat( val ) || 0;
  22178. // Adjust for the element's box model
  22179. return ( val +
  22180. boxModelAdjustment(
  22181. elem,
  22182. dimension,
  22183. extra || ( isBorderBox ? "border" : "content" ),
  22184. valueIsBorderBox,
  22185. styles,
  22186. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  22187. val
  22188. )
  22189. ) + "px";
  22190. }
  22191. jQuery.extend( {
  22192. // Add in style property hooks for overriding the default
  22193. // behavior of getting and setting a style property
  22194. cssHooks: {
  22195. opacity: {
  22196. get: function( elem, computed ) {
  22197. if ( computed ) {
  22198. // We should always get a number back from opacity
  22199. var ret = curCSS( elem, "opacity" );
  22200. return ret === "" ? "1" : ret;
  22201. }
  22202. }
  22203. }
  22204. },
  22205. // Don't automatically add "px" to these possibly-unitless properties
  22206. cssNumber: {
  22207. "animationIterationCount": true,
  22208. "columnCount": true,
  22209. "fillOpacity": true,
  22210. "flexGrow": true,
  22211. "flexShrink": true,
  22212. "fontWeight": true,
  22213. "lineHeight": true,
  22214. "opacity": true,
  22215. "order": true,
  22216. "orphans": true,
  22217. "widows": true,
  22218. "zIndex": true,
  22219. "zoom": true
  22220. },
  22221. // Add in properties whose names you wish to fix before
  22222. // setting or getting the value
  22223. cssProps: {},
  22224. // Get and set the style property on a DOM Node
  22225. style: function( elem, name, value, extra ) {
  22226. // Don't set styles on text and comment nodes
  22227. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  22228. return;
  22229. }
  22230. // Make sure that we're working with the right name
  22231. var ret, type, hooks,
  22232. origName = camelCase( name ),
  22233. isCustomProp = rcustomProp.test( name ),
  22234. style = elem.style;
  22235. // Make sure that we're working with the right name. We don't
  22236. // want to query the value if it is a CSS custom property
  22237. // since they are user-defined.
  22238. if ( !isCustomProp ) {
  22239. name = finalPropName( origName );
  22240. }
  22241. // Gets hook for the prefixed version, then unprefixed version
  22242. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22243. // Check if we're setting a value
  22244. if ( value !== undefined ) {
  22245. type = typeof value;
  22246. // Convert "+=" or "-=" to relative numbers (#7345)
  22247. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  22248. value = adjustCSS( elem, name, ret );
  22249. // Fixes bug #9237
  22250. type = "number";
  22251. }
  22252. // Make sure that null and NaN values aren't set (#7116)
  22253. if ( value == null || value !== value ) {
  22254. return;
  22255. }
  22256. // If a number was passed in, add the unit (except for certain CSS properties)
  22257. if ( type === "number" ) {
  22258. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  22259. }
  22260. // background-* props affect original clone's values
  22261. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  22262. style[ name ] = "inherit";
  22263. }
  22264. // If a hook was provided, use that value, otherwise just set the specified value
  22265. if ( !hooks || !( "set" in hooks ) ||
  22266. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  22267. if ( isCustomProp ) {
  22268. style.setProperty( name, value );
  22269. } else {
  22270. style[ name ] = value;
  22271. }
  22272. }
  22273. } else {
  22274. // If a hook was provided get the non-computed value from there
  22275. if ( hooks && "get" in hooks &&
  22276. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  22277. return ret;
  22278. }
  22279. // Otherwise just get the value from the style object
  22280. return style[ name ];
  22281. }
  22282. },
  22283. css: function( elem, name, extra, styles ) {
  22284. var val, num, hooks,
  22285. origName = camelCase( name ),
  22286. isCustomProp = rcustomProp.test( name );
  22287. // Make sure that we're working with the right name. We don't
  22288. // want to modify the value if it is a CSS custom property
  22289. // since they are user-defined.
  22290. if ( !isCustomProp ) {
  22291. name = finalPropName( origName );
  22292. }
  22293. // Try prefixed name followed by the unprefixed name
  22294. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22295. // If a hook was provided get the computed value from there
  22296. if ( hooks && "get" in hooks ) {
  22297. val = hooks.get( elem, true, extra );
  22298. }
  22299. // Otherwise, if a way to get the computed value exists, use that
  22300. if ( val === undefined ) {
  22301. val = curCSS( elem, name, styles );
  22302. }
  22303. // Convert "normal" to computed value
  22304. if ( val === "normal" && name in cssNormalTransform ) {
  22305. val = cssNormalTransform[ name ];
  22306. }
  22307. // Make numeric if forced or a qualifier was provided and val looks numeric
  22308. if ( extra === "" || extra ) {
  22309. num = parseFloat( val );
  22310. return extra === true || isFinite( num ) ? num || 0 : val;
  22311. }
  22312. return val;
  22313. }
  22314. } );
  22315. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  22316. jQuery.cssHooks[ dimension ] = {
  22317. get: function( elem, computed, extra ) {
  22318. if ( computed ) {
  22319. // Certain elements can have dimension info if we invisibly show them
  22320. // but it must have a current display style that would benefit
  22321. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  22322. // Support: Safari 8+
  22323. // Table columns in Safari have non-zero offsetWidth & zero
  22324. // getBoundingClientRect().width unless display is changed.
  22325. // Support: IE <=11 only
  22326. // Running getBoundingClientRect on a disconnected node
  22327. // in IE throws an error.
  22328. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  22329. swap( elem, cssShow, function() {
  22330. return getWidthOrHeight( elem, dimension, extra );
  22331. } ) :
  22332. getWidthOrHeight( elem, dimension, extra );
  22333. }
  22334. },
  22335. set: function( elem, value, extra ) {
  22336. var matches,
  22337. styles = getStyles( elem ),
  22338. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  22339. subtract = extra && boxModelAdjustment(
  22340. elem,
  22341. dimension,
  22342. extra,
  22343. isBorderBox,
  22344. styles
  22345. );
  22346. // Account for unreliable border-box dimensions by comparing offset* to computed and
  22347. // faking a content-box to get border and padding (gh-3699)
  22348. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  22349. subtract -= Math.ceil(
  22350. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  22351. parseFloat( styles[ dimension ] ) -
  22352. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  22353. 0.5
  22354. );
  22355. }
  22356. // Convert to pixels if value adjustment is needed
  22357. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  22358. ( matches[ 3 ] || "px" ) !== "px" ) {
  22359. elem.style[ dimension ] = value;
  22360. value = jQuery.css( elem, dimension );
  22361. }
  22362. return setPositiveNumber( elem, value, subtract );
  22363. }
  22364. };
  22365. } );
  22366. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  22367. function( elem, computed ) {
  22368. if ( computed ) {
  22369. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  22370. elem.getBoundingClientRect().left -
  22371. swap( elem, { marginLeft: 0 }, function() {
  22372. return elem.getBoundingClientRect().left;
  22373. } )
  22374. ) + "px";
  22375. }
  22376. }
  22377. );
  22378. // These hooks are used by animate to expand properties
  22379. jQuery.each( {
  22380. margin: "",
  22381. padding: "",
  22382. border: "Width"
  22383. }, function( prefix, suffix ) {
  22384. jQuery.cssHooks[ prefix + suffix ] = {
  22385. expand: function( value ) {
  22386. var i = 0,
  22387. expanded = {},
  22388. // Assumes a single number if not a string
  22389. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  22390. for ( ; i < 4; i++ ) {
  22391. expanded[ prefix + cssExpand[ i ] + suffix ] =
  22392. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  22393. }
  22394. return expanded;
  22395. }
  22396. };
  22397. if ( prefix !== "margin" ) {
  22398. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  22399. }
  22400. } );
  22401. jQuery.fn.extend( {
  22402. css: function( name, value ) {
  22403. return access( this, function( elem, name, value ) {
  22404. var styles, len,
  22405. map = {},
  22406. i = 0;
  22407. if ( Array.isArray( name ) ) {
  22408. styles = getStyles( elem );
  22409. len = name.length;
  22410. for ( ; i < len; i++ ) {
  22411. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  22412. }
  22413. return map;
  22414. }
  22415. return value !== undefined ?
  22416. jQuery.style( elem, name, value ) :
  22417. jQuery.css( elem, name );
  22418. }, name, value, arguments.length > 1 );
  22419. }
  22420. } );
  22421. function Tween( elem, options, prop, end, easing ) {
  22422. return new Tween.prototype.init( elem, options, prop, end, easing );
  22423. }
  22424. jQuery.Tween = Tween;
  22425. Tween.prototype = {
  22426. constructor: Tween,
  22427. init: function( elem, options, prop, end, easing, unit ) {
  22428. this.elem = elem;
  22429. this.prop = prop;
  22430. this.easing = easing || jQuery.easing._default;
  22431. this.options = options;
  22432. this.start = this.now = this.cur();
  22433. this.end = end;
  22434. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  22435. },
  22436. cur: function() {
  22437. var hooks = Tween.propHooks[ this.prop ];
  22438. return hooks && hooks.get ?
  22439. hooks.get( this ) :
  22440. Tween.propHooks._default.get( this );
  22441. },
  22442. run: function( percent ) {
  22443. var eased,
  22444. hooks = Tween.propHooks[ this.prop ];
  22445. if ( this.options.duration ) {
  22446. this.pos = eased = jQuery.easing[ this.easing ](
  22447. percent, this.options.duration * percent, 0, 1, this.options.duration
  22448. );
  22449. } else {
  22450. this.pos = eased = percent;
  22451. }
  22452. this.now = ( this.end - this.start ) * eased + this.start;
  22453. if ( this.options.step ) {
  22454. this.options.step.call( this.elem, this.now, this );
  22455. }
  22456. if ( hooks && hooks.set ) {
  22457. hooks.set( this );
  22458. } else {
  22459. Tween.propHooks._default.set( this );
  22460. }
  22461. return this;
  22462. }
  22463. };
  22464. Tween.prototype.init.prototype = Tween.prototype;
  22465. Tween.propHooks = {
  22466. _default: {
  22467. get: function( tween ) {
  22468. var result;
  22469. // Use a property on the element directly when it is not a DOM element,
  22470. // or when there is no matching style property that exists.
  22471. if ( tween.elem.nodeType !== 1 ||
  22472. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  22473. return tween.elem[ tween.prop ];
  22474. }
  22475. // Passing an empty string as a 3rd parameter to .css will automatically
  22476. // attempt a parseFloat and fallback to a string if the parse fails.
  22477. // Simple values such as "10px" are parsed to Float;
  22478. // complex values such as "rotate(1rad)" are returned as-is.
  22479. result = jQuery.css( tween.elem, tween.prop, "" );
  22480. // Empty strings, null, undefined and "auto" are converted to 0.
  22481. return !result || result === "auto" ? 0 : result;
  22482. },
  22483. set: function( tween ) {
  22484. // Use step hook for back compat.
  22485. // Use cssHook if its there.
  22486. // Use .style if available and use plain properties where available.
  22487. if ( jQuery.fx.step[ tween.prop ] ) {
  22488. jQuery.fx.step[ tween.prop ]( tween );
  22489. } else if ( tween.elem.nodeType === 1 &&
  22490. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  22491. jQuery.cssHooks[ tween.prop ] ) ) {
  22492. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  22493. } else {
  22494. tween.elem[ tween.prop ] = tween.now;
  22495. }
  22496. }
  22497. }
  22498. };
  22499. // Support: IE <=9 only
  22500. // Panic based approach to setting things on disconnected nodes
  22501. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  22502. set: function( tween ) {
  22503. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  22504. tween.elem[ tween.prop ] = tween.now;
  22505. }
  22506. }
  22507. };
  22508. jQuery.easing = {
  22509. linear: function( p ) {
  22510. return p;
  22511. },
  22512. swing: function( p ) {
  22513. return 0.5 - Math.cos( p * Math.PI ) / 2;
  22514. },
  22515. _default: "swing"
  22516. };
  22517. jQuery.fx = Tween.prototype.init;
  22518. // Back compat <1.8 extension point
  22519. jQuery.fx.step = {};
  22520. var
  22521. fxNow, inProgress,
  22522. rfxtypes = /^(?:toggle|show|hide)$/,
  22523. rrun = /queueHooks$/;
  22524. function schedule() {
  22525. if ( inProgress ) {
  22526. if ( document.hidden === false && window.requestAnimationFrame ) {
  22527. window.requestAnimationFrame( schedule );
  22528. } else {
  22529. window.setTimeout( schedule, jQuery.fx.interval );
  22530. }
  22531. jQuery.fx.tick();
  22532. }
  22533. }
  22534. // Animations created synchronously will run synchronously
  22535. function createFxNow() {
  22536. window.setTimeout( function() {
  22537. fxNow = undefined;
  22538. } );
  22539. return ( fxNow = Date.now() );
  22540. }
  22541. // Generate parameters to create a standard animation
  22542. function genFx( type, includeWidth ) {
  22543. var which,
  22544. i = 0,
  22545. attrs = { height: type };
  22546. // If we include width, step value is 1 to do all cssExpand values,
  22547. // otherwise step value is 2 to skip over Left and Right
  22548. includeWidth = includeWidth ? 1 : 0;
  22549. for ( ; i < 4; i += 2 - includeWidth ) {
  22550. which = cssExpand[ i ];
  22551. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  22552. }
  22553. if ( includeWidth ) {
  22554. attrs.opacity = attrs.width = type;
  22555. }
  22556. return attrs;
  22557. }
  22558. function createTween( value, prop, animation ) {
  22559. var tween,
  22560. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  22561. index = 0,
  22562. length = collection.length;
  22563. for ( ; index < length; index++ ) {
  22564. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  22565. // We're done with this property
  22566. return tween;
  22567. }
  22568. }
  22569. }
  22570. function defaultPrefilter( elem, props, opts ) {
  22571. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  22572. isBox = "width" in props || "height" in props,
  22573. anim = this,
  22574. orig = {},
  22575. style = elem.style,
  22576. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  22577. dataShow = dataPriv.get( elem, "fxshow" );
  22578. // Queue-skipping animations hijack the fx hooks
  22579. if ( !opts.queue ) {
  22580. hooks = jQuery._queueHooks( elem, "fx" );
  22581. if ( hooks.unqueued == null ) {
  22582. hooks.unqueued = 0;
  22583. oldfire = hooks.empty.fire;
  22584. hooks.empty.fire = function() {
  22585. if ( !hooks.unqueued ) {
  22586. oldfire();
  22587. }
  22588. };
  22589. }
  22590. hooks.unqueued++;
  22591. anim.always( function() {
  22592. // Ensure the complete handler is called before this completes
  22593. anim.always( function() {
  22594. hooks.unqueued--;
  22595. if ( !jQuery.queue( elem, "fx" ).length ) {
  22596. hooks.empty.fire();
  22597. }
  22598. } );
  22599. } );
  22600. }
  22601. // Detect show/hide animations
  22602. for ( prop in props ) {
  22603. value = props[ prop ];
  22604. if ( rfxtypes.test( value ) ) {
  22605. delete props[ prop ];
  22606. toggle = toggle || value === "toggle";
  22607. if ( value === ( hidden ? "hide" : "show" ) ) {
  22608. // Pretend to be hidden if this is a "show" and
  22609. // there is still data from a stopped show/hide
  22610. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  22611. hidden = true;
  22612. // Ignore all other no-op show/hide data
  22613. } else {
  22614. continue;
  22615. }
  22616. }
  22617. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  22618. }
  22619. }
  22620. // Bail out if this is a no-op like .hide().hide()
  22621. propTween = !jQuery.isEmptyObject( props );
  22622. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  22623. return;
  22624. }
  22625. // Restrict "overflow" and "display" styles during box animations
  22626. if ( isBox && elem.nodeType === 1 ) {
  22627. // Support: IE <=9 - 11, Edge 12 - 15
  22628. // Record all 3 overflow attributes because IE does not infer the shorthand
  22629. // from identically-valued overflowX and overflowY and Edge just mirrors
  22630. // the overflowX value there.
  22631. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  22632. // Identify a display type, preferring old show/hide data over the CSS cascade
  22633. restoreDisplay = dataShow && dataShow.display;
  22634. if ( restoreDisplay == null ) {
  22635. restoreDisplay = dataPriv.get( elem, "display" );
  22636. }
  22637. display = jQuery.css( elem, "display" );
  22638. if ( display === "none" ) {
  22639. if ( restoreDisplay ) {
  22640. display = restoreDisplay;
  22641. } else {
  22642. // Get nonempty value(s) by temporarily forcing visibility
  22643. showHide( [ elem ], true );
  22644. restoreDisplay = elem.style.display || restoreDisplay;
  22645. display = jQuery.css( elem, "display" );
  22646. showHide( [ elem ] );
  22647. }
  22648. }
  22649. // Animate inline elements as inline-block
  22650. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  22651. if ( jQuery.css( elem, "float" ) === "none" ) {
  22652. // Restore the original display value at the end of pure show/hide animations
  22653. if ( !propTween ) {
  22654. anim.done( function() {
  22655. style.display = restoreDisplay;
  22656. } );
  22657. if ( restoreDisplay == null ) {
  22658. display = style.display;
  22659. restoreDisplay = display === "none" ? "" : display;
  22660. }
  22661. }
  22662. style.display = "inline-block";
  22663. }
  22664. }
  22665. }
  22666. if ( opts.overflow ) {
  22667. style.overflow = "hidden";
  22668. anim.always( function() {
  22669. style.overflow = opts.overflow[ 0 ];
  22670. style.overflowX = opts.overflow[ 1 ];
  22671. style.overflowY = opts.overflow[ 2 ];
  22672. } );
  22673. }
  22674. // Implement show/hide animations
  22675. propTween = false;
  22676. for ( prop in orig ) {
  22677. // General show/hide setup for this element animation
  22678. if ( !propTween ) {
  22679. if ( dataShow ) {
  22680. if ( "hidden" in dataShow ) {
  22681. hidden = dataShow.hidden;
  22682. }
  22683. } else {
  22684. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  22685. }
  22686. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  22687. if ( toggle ) {
  22688. dataShow.hidden = !hidden;
  22689. }
  22690. // Show elements before animating them
  22691. if ( hidden ) {
  22692. showHide( [ elem ], true );
  22693. }
  22694. /* eslint-disable no-loop-func */
  22695. anim.done( function() {
  22696. /* eslint-enable no-loop-func */
  22697. // The final step of a "hide" animation is actually hiding the element
  22698. if ( !hidden ) {
  22699. showHide( [ elem ] );
  22700. }
  22701. dataPriv.remove( elem, "fxshow" );
  22702. for ( prop in orig ) {
  22703. jQuery.style( elem, prop, orig[ prop ] );
  22704. }
  22705. } );
  22706. }
  22707. // Per-property setup
  22708. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  22709. if ( !( prop in dataShow ) ) {
  22710. dataShow[ prop ] = propTween.start;
  22711. if ( hidden ) {
  22712. propTween.end = propTween.start;
  22713. propTween.start = 0;
  22714. }
  22715. }
  22716. }
  22717. }
  22718. function propFilter( props, specialEasing ) {
  22719. var index, name, easing, value, hooks;
  22720. // camelCase, specialEasing and expand cssHook pass
  22721. for ( index in props ) {
  22722. name = camelCase( index );
  22723. easing = specialEasing[ name ];
  22724. value = props[ index ];
  22725. if ( Array.isArray( value ) ) {
  22726. easing = value[ 1 ];
  22727. value = props[ index ] = value[ 0 ];
  22728. }
  22729. if ( index !== name ) {
  22730. props[ name ] = value;
  22731. delete props[ index ];
  22732. }
  22733. hooks = jQuery.cssHooks[ name ];
  22734. if ( hooks && "expand" in hooks ) {
  22735. value = hooks.expand( value );
  22736. delete props[ name ];
  22737. // Not quite $.extend, this won't overwrite existing keys.
  22738. // Reusing 'index' because we have the correct "name"
  22739. for ( index in value ) {
  22740. if ( !( index in props ) ) {
  22741. props[ index ] = value[ index ];
  22742. specialEasing[ index ] = easing;
  22743. }
  22744. }
  22745. } else {
  22746. specialEasing[ name ] = easing;
  22747. }
  22748. }
  22749. }
  22750. function Animation( elem, properties, options ) {
  22751. var result,
  22752. stopped,
  22753. index = 0,
  22754. length = Animation.prefilters.length,
  22755. deferred = jQuery.Deferred().always( function() {
  22756. // Don't match elem in the :animated selector
  22757. delete tick.elem;
  22758. } ),
  22759. tick = function() {
  22760. if ( stopped ) {
  22761. return false;
  22762. }
  22763. var currentTime = fxNow || createFxNow(),
  22764. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  22765. // Support: Android 2.3 only
  22766. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  22767. temp = remaining / animation.duration || 0,
  22768. percent = 1 - temp,
  22769. index = 0,
  22770. length = animation.tweens.length;
  22771. for ( ; index < length; index++ ) {
  22772. animation.tweens[ index ].run( percent );
  22773. }
  22774. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  22775. // If there's more to do, yield
  22776. if ( percent < 1 && length ) {
  22777. return remaining;
  22778. }
  22779. // If this was an empty animation, synthesize a final progress notification
  22780. if ( !length ) {
  22781. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  22782. }
  22783. // Resolve the animation and report its conclusion
  22784. deferred.resolveWith( elem, [ animation ] );
  22785. return false;
  22786. },
  22787. animation = deferred.promise( {
  22788. elem: elem,
  22789. props: jQuery.extend( {}, properties ),
  22790. opts: jQuery.extend( true, {
  22791. specialEasing: {},
  22792. easing: jQuery.easing._default
  22793. }, options ),
  22794. originalProperties: properties,
  22795. originalOptions: options,
  22796. startTime: fxNow || createFxNow(),
  22797. duration: options.duration,
  22798. tweens: [],
  22799. createTween: function( prop, end ) {
  22800. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  22801. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  22802. animation.tweens.push( tween );
  22803. return tween;
  22804. },
  22805. stop: function( gotoEnd ) {
  22806. var index = 0,
  22807. // If we are going to the end, we want to run all the tweens
  22808. // otherwise we skip this part
  22809. length = gotoEnd ? animation.tweens.length : 0;
  22810. if ( stopped ) {
  22811. return this;
  22812. }
  22813. stopped = true;
  22814. for ( ; index < length; index++ ) {
  22815. animation.tweens[ index ].run( 1 );
  22816. }
  22817. // Resolve when we played the last frame; otherwise, reject
  22818. if ( gotoEnd ) {
  22819. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  22820. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  22821. } else {
  22822. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  22823. }
  22824. return this;
  22825. }
  22826. } ),
  22827. props = animation.props;
  22828. propFilter( props, animation.opts.specialEasing );
  22829. for ( ; index < length; index++ ) {
  22830. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  22831. if ( result ) {
  22832. if ( isFunction( result.stop ) ) {
  22833. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  22834. result.stop.bind( result );
  22835. }
  22836. return result;
  22837. }
  22838. }
  22839. jQuery.map( props, createTween, animation );
  22840. if ( isFunction( animation.opts.start ) ) {
  22841. animation.opts.start.call( elem, animation );
  22842. }
  22843. // Attach callbacks from options
  22844. animation
  22845. .progress( animation.opts.progress )
  22846. .done( animation.opts.done, animation.opts.complete )
  22847. .fail( animation.opts.fail )
  22848. .always( animation.opts.always );
  22849. jQuery.fx.timer(
  22850. jQuery.extend( tick, {
  22851. elem: elem,
  22852. anim: animation,
  22853. queue: animation.opts.queue
  22854. } )
  22855. );
  22856. return animation;
  22857. }
  22858. jQuery.Animation = jQuery.extend( Animation, {
  22859. tweeners: {
  22860. "*": [ function( prop, value ) {
  22861. var tween = this.createTween( prop, value );
  22862. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  22863. return tween;
  22864. } ]
  22865. },
  22866. tweener: function( props, callback ) {
  22867. if ( isFunction( props ) ) {
  22868. callback = props;
  22869. props = [ "*" ];
  22870. } else {
  22871. props = props.match( rnothtmlwhite );
  22872. }
  22873. var prop,
  22874. index = 0,
  22875. length = props.length;
  22876. for ( ; index < length; index++ ) {
  22877. prop = props[ index ];
  22878. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  22879. Animation.tweeners[ prop ].unshift( callback );
  22880. }
  22881. },
  22882. prefilters: [ defaultPrefilter ],
  22883. prefilter: function( callback, prepend ) {
  22884. if ( prepend ) {
  22885. Animation.prefilters.unshift( callback );
  22886. } else {
  22887. Animation.prefilters.push( callback );
  22888. }
  22889. }
  22890. } );
  22891. jQuery.speed = function( speed, easing, fn ) {
  22892. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  22893. complete: fn || !fn && easing ||
  22894. isFunction( speed ) && speed,
  22895. duration: speed,
  22896. easing: fn && easing || easing && !isFunction( easing ) && easing
  22897. };
  22898. // Go to the end state if fx are off
  22899. if ( jQuery.fx.off ) {
  22900. opt.duration = 0;
  22901. } else {
  22902. if ( typeof opt.duration !== "number" ) {
  22903. if ( opt.duration in jQuery.fx.speeds ) {
  22904. opt.duration = jQuery.fx.speeds[ opt.duration ];
  22905. } else {
  22906. opt.duration = jQuery.fx.speeds._default;
  22907. }
  22908. }
  22909. }
  22910. // Normalize opt.queue - true/undefined/null -> "fx"
  22911. if ( opt.queue == null || opt.queue === true ) {
  22912. opt.queue = "fx";
  22913. }
  22914. // Queueing
  22915. opt.old = opt.complete;
  22916. opt.complete = function() {
  22917. if ( isFunction( opt.old ) ) {
  22918. opt.old.call( this );
  22919. }
  22920. if ( opt.queue ) {
  22921. jQuery.dequeue( this, opt.queue );
  22922. }
  22923. };
  22924. return opt;
  22925. };
  22926. jQuery.fn.extend( {
  22927. fadeTo: function( speed, to, easing, callback ) {
  22928. // Show any hidden elements after setting opacity to 0
  22929. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  22930. // Animate to the value specified
  22931. .end().animate( { opacity: to }, speed, easing, callback );
  22932. },
  22933. animate: function( prop, speed, easing, callback ) {
  22934. var empty = jQuery.isEmptyObject( prop ),
  22935. optall = jQuery.speed( speed, easing, callback ),
  22936. doAnimation = function() {
  22937. // Operate on a copy of prop so per-property easing won't be lost
  22938. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  22939. // Empty animations, or finishing resolves immediately
  22940. if ( empty || dataPriv.get( this, "finish" ) ) {
  22941. anim.stop( true );
  22942. }
  22943. };
  22944. doAnimation.finish = doAnimation;
  22945. return empty || optall.queue === false ?
  22946. this.each( doAnimation ) :
  22947. this.queue( optall.queue, doAnimation );
  22948. },
  22949. stop: function( type, clearQueue, gotoEnd ) {
  22950. var stopQueue = function( hooks ) {
  22951. var stop = hooks.stop;
  22952. delete hooks.stop;
  22953. stop( gotoEnd );
  22954. };
  22955. if ( typeof type !== "string" ) {
  22956. gotoEnd = clearQueue;
  22957. clearQueue = type;
  22958. type = undefined;
  22959. }
  22960. if ( clearQueue && type !== false ) {
  22961. this.queue( type || "fx", [] );
  22962. }
  22963. return this.each( function() {
  22964. var dequeue = true,
  22965. index = type != null && type + "queueHooks",
  22966. timers = jQuery.timers,
  22967. data = dataPriv.get( this );
  22968. if ( index ) {
  22969. if ( data[ index ] && data[ index ].stop ) {
  22970. stopQueue( data[ index ] );
  22971. }
  22972. } else {
  22973. for ( index in data ) {
  22974. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  22975. stopQueue( data[ index ] );
  22976. }
  22977. }
  22978. }
  22979. for ( index = timers.length; index--; ) {
  22980. if ( timers[ index ].elem === this &&
  22981. ( type == null || timers[ index ].queue === type ) ) {
  22982. timers[ index ].anim.stop( gotoEnd );
  22983. dequeue = false;
  22984. timers.splice( index, 1 );
  22985. }
  22986. }
  22987. // Start the next in the queue if the last step wasn't forced.
  22988. // Timers currently will call their complete callbacks, which
  22989. // will dequeue but only if they were gotoEnd.
  22990. if ( dequeue || !gotoEnd ) {
  22991. jQuery.dequeue( this, type );
  22992. }
  22993. } );
  22994. },
  22995. finish: function( type ) {
  22996. if ( type !== false ) {
  22997. type = type || "fx";
  22998. }
  22999. return this.each( function() {
  23000. var index,
  23001. data = dataPriv.get( this ),
  23002. queue = data[ type + "queue" ],
  23003. hooks = data[ type + "queueHooks" ],
  23004. timers = jQuery.timers,
  23005. length = queue ? queue.length : 0;
  23006. // Enable finishing flag on private data
  23007. data.finish = true;
  23008. // Empty the queue first
  23009. jQuery.queue( this, type, [] );
  23010. if ( hooks && hooks.stop ) {
  23011. hooks.stop.call( this, true );
  23012. }
  23013. // Look for any active animations, and finish them
  23014. for ( index = timers.length; index--; ) {
  23015. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  23016. timers[ index ].anim.stop( true );
  23017. timers.splice( index, 1 );
  23018. }
  23019. }
  23020. // Look for any animations in the old queue and finish them
  23021. for ( index = 0; index < length; index++ ) {
  23022. if ( queue[ index ] && queue[ index ].finish ) {
  23023. queue[ index ].finish.call( this );
  23024. }
  23025. }
  23026. // Turn off finishing flag
  23027. delete data.finish;
  23028. } );
  23029. }
  23030. } );
  23031. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  23032. var cssFn = jQuery.fn[ name ];
  23033. jQuery.fn[ name ] = function( speed, easing, callback ) {
  23034. return speed == null || typeof speed === "boolean" ?
  23035. cssFn.apply( this, arguments ) :
  23036. this.animate( genFx( name, true ), speed, easing, callback );
  23037. };
  23038. } );
  23039. // Generate shortcuts for custom animations
  23040. jQuery.each( {
  23041. slideDown: genFx( "show" ),
  23042. slideUp: genFx( "hide" ),
  23043. slideToggle: genFx( "toggle" ),
  23044. fadeIn: { opacity: "show" },
  23045. fadeOut: { opacity: "hide" },
  23046. fadeToggle: { opacity: "toggle" }
  23047. }, function( name, props ) {
  23048. jQuery.fn[ name ] = function( speed, easing, callback ) {
  23049. return this.animate( props, speed, easing, callback );
  23050. };
  23051. } );
  23052. jQuery.timers = [];
  23053. jQuery.fx.tick = function() {
  23054. var timer,
  23055. i = 0,
  23056. timers = jQuery.timers;
  23057. fxNow = Date.now();
  23058. for ( ; i < timers.length; i++ ) {
  23059. timer = timers[ i ];
  23060. // Run the timer and safely remove it when done (allowing for external removal)
  23061. if ( !timer() && timers[ i ] === timer ) {
  23062. timers.splice( i--, 1 );
  23063. }
  23064. }
  23065. if ( !timers.length ) {
  23066. jQuery.fx.stop();
  23067. }
  23068. fxNow = undefined;
  23069. };
  23070. jQuery.fx.timer = function( timer ) {
  23071. jQuery.timers.push( timer );
  23072. jQuery.fx.start();
  23073. };
  23074. jQuery.fx.interval = 13;
  23075. jQuery.fx.start = function() {
  23076. if ( inProgress ) {
  23077. return;
  23078. }
  23079. inProgress = true;
  23080. schedule();
  23081. };
  23082. jQuery.fx.stop = function() {
  23083. inProgress = null;
  23084. };
  23085. jQuery.fx.speeds = {
  23086. slow: 600,
  23087. fast: 200,
  23088. // Default speed
  23089. _default: 400
  23090. };
  23091. // Based off of the plugin by Clint Helfers, with permission.
  23092. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  23093. jQuery.fn.delay = function( time, type ) {
  23094. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  23095. type = type || "fx";
  23096. return this.queue( type, function( next, hooks ) {
  23097. var timeout = window.setTimeout( next, time );
  23098. hooks.stop = function() {
  23099. window.clearTimeout( timeout );
  23100. };
  23101. } );
  23102. };
  23103. ( function() {
  23104. var input = document.createElement( "input" ),
  23105. select = document.createElement( "select" ),
  23106. opt = select.appendChild( document.createElement( "option" ) );
  23107. input.type = "checkbox";
  23108. // Support: Android <=4.3 only
  23109. // Default value for a checkbox should be "on"
  23110. support.checkOn = input.value !== "";
  23111. // Support: IE <=11 only
  23112. // Must access selectedIndex to make default options select
  23113. support.optSelected = opt.selected;
  23114. // Support: IE <=11 only
  23115. // An input loses its value after becoming a radio
  23116. input = document.createElement( "input" );
  23117. input.value = "t";
  23118. input.type = "radio";
  23119. support.radioValue = input.value === "t";
  23120. } )();
  23121. var boolHook,
  23122. attrHandle = jQuery.expr.attrHandle;
  23123. jQuery.fn.extend( {
  23124. attr: function( name, value ) {
  23125. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  23126. },
  23127. removeAttr: function( name ) {
  23128. return this.each( function() {
  23129. jQuery.removeAttr( this, name );
  23130. } );
  23131. }
  23132. } );
  23133. jQuery.extend( {
  23134. attr: function( elem, name, value ) {
  23135. var ret, hooks,
  23136. nType = elem.nodeType;
  23137. // Don't get/set attributes on text, comment and attribute nodes
  23138. if ( nType === 3 || nType === 8 || nType === 2 ) {
  23139. return;
  23140. }
  23141. // Fallback to prop when attributes are not supported
  23142. if ( typeof elem.getAttribute === "undefined" ) {
  23143. return jQuery.prop( elem, name, value );
  23144. }
  23145. // Attribute hooks are determined by the lowercase version
  23146. // Grab necessary hook if one is defined
  23147. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  23148. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  23149. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  23150. }
  23151. if ( value !== undefined ) {
  23152. if ( value === null ) {
  23153. jQuery.removeAttr( elem, name );
  23154. return;
  23155. }
  23156. if ( hooks && "set" in hooks &&
  23157. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  23158. return ret;
  23159. }
  23160. elem.setAttribute( name, value + "" );
  23161. return value;
  23162. }
  23163. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  23164. return ret;
  23165. }
  23166. ret = jQuery.find.attr( elem, name );
  23167. // Non-existent attributes return null, we normalize to undefined
  23168. return ret == null ? undefined : ret;
  23169. },
  23170. attrHooks: {
  23171. type: {
  23172. set: function( elem, value ) {
  23173. if ( !support.radioValue && value === "radio" &&
  23174. nodeName( elem, "input" ) ) {
  23175. var val = elem.value;
  23176. elem.setAttribute( "type", value );
  23177. if ( val ) {
  23178. elem.value = val;
  23179. }
  23180. return value;
  23181. }
  23182. }
  23183. }
  23184. },
  23185. removeAttr: function( elem, value ) {
  23186. var name,
  23187. i = 0,
  23188. // Attribute names can contain non-HTML whitespace characters
  23189. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  23190. attrNames = value && value.match( rnothtmlwhite );
  23191. if ( attrNames && elem.nodeType === 1 ) {
  23192. while ( ( name = attrNames[ i++ ] ) ) {
  23193. elem.removeAttribute( name );
  23194. }
  23195. }
  23196. }
  23197. } );
  23198. // Hooks for boolean attributes
  23199. boolHook = {
  23200. set: function( elem, value, name ) {
  23201. if ( value === false ) {
  23202. // Remove boolean attributes when set to false
  23203. jQuery.removeAttr( elem, name );
  23204. } else {
  23205. elem.setAttribute( name, name );
  23206. }
  23207. return name;
  23208. }
  23209. };
  23210. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  23211. var getter = attrHandle[ name ] || jQuery.find.attr;
  23212. attrHandle[ name ] = function( elem, name, isXML ) {
  23213. var ret, handle,
  23214. lowercaseName = name.toLowerCase();
  23215. if ( !isXML ) {
  23216. // Avoid an infinite loop by temporarily removing this function from the getter
  23217. handle = attrHandle[ lowercaseName ];
  23218. attrHandle[ lowercaseName ] = ret;
  23219. ret = getter( elem, name, isXML ) != null ?
  23220. lowercaseName :
  23221. null;
  23222. attrHandle[ lowercaseName ] = handle;
  23223. }
  23224. return ret;
  23225. };
  23226. } );
  23227. var rfocusable = /^(?:input|select|textarea|button)$/i,
  23228. rclickable = /^(?:a|area)$/i;
  23229. jQuery.fn.extend( {
  23230. prop: function( name, value ) {
  23231. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  23232. },
  23233. removeProp: function( name ) {
  23234. return this.each( function() {
  23235. delete this[ jQuery.propFix[ name ] || name ];
  23236. } );
  23237. }
  23238. } );
  23239. jQuery.extend( {
  23240. prop: function( elem, name, value ) {
  23241. var ret, hooks,
  23242. nType = elem.nodeType;
  23243. // Don't get/set properties on text, comment and attribute nodes
  23244. if ( nType === 3 || nType === 8 || nType === 2 ) {
  23245. return;
  23246. }
  23247. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  23248. // Fix name and attach hooks
  23249. name = jQuery.propFix[ name ] || name;
  23250. hooks = jQuery.propHooks[ name ];
  23251. }
  23252. if ( value !== undefined ) {
  23253. if ( hooks && "set" in hooks &&
  23254. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  23255. return ret;
  23256. }
  23257. return ( elem[ name ] = value );
  23258. }
  23259. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  23260. return ret;
  23261. }
  23262. return elem[ name ];
  23263. },
  23264. propHooks: {
  23265. tabIndex: {
  23266. get: function( elem ) {
  23267. // Support: IE <=9 - 11 only
  23268. // elem.tabIndex doesn't always return the
  23269. // correct value when it hasn't been explicitly set
  23270. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  23271. // Use proper attribute retrieval(#12072)
  23272. var tabindex = jQuery.find.attr( elem, "tabindex" );
  23273. if ( tabindex ) {
  23274. return parseInt( tabindex, 10 );
  23275. }
  23276. if (
  23277. rfocusable.test( elem.nodeName ) ||
  23278. rclickable.test( elem.nodeName ) &&
  23279. elem.href
  23280. ) {
  23281. return 0;
  23282. }
  23283. return -1;
  23284. }
  23285. }
  23286. },
  23287. propFix: {
  23288. "for": "htmlFor",
  23289. "class": "className"
  23290. }
  23291. } );
  23292. // Support: IE <=11 only
  23293. // Accessing the selectedIndex property
  23294. // forces the browser to respect setting selected
  23295. // on the option
  23296. // The getter ensures a default option is selected
  23297. // when in an optgroup
  23298. // eslint rule "no-unused-expressions" is disabled for this code
  23299. // since it considers such accessions noop
  23300. if ( !support.optSelected ) {
  23301. jQuery.propHooks.selected = {
  23302. get: function( elem ) {
  23303. /* eslint no-unused-expressions: "off" */
  23304. var parent = elem.parentNode;
  23305. if ( parent && parent.parentNode ) {
  23306. parent.parentNode.selectedIndex;
  23307. }
  23308. return null;
  23309. },
  23310. set: function( elem ) {
  23311. /* eslint no-unused-expressions: "off" */
  23312. var parent = elem.parentNode;
  23313. if ( parent ) {
  23314. parent.selectedIndex;
  23315. if ( parent.parentNode ) {
  23316. parent.parentNode.selectedIndex;
  23317. }
  23318. }
  23319. }
  23320. };
  23321. }
  23322. jQuery.each( [
  23323. "tabIndex",
  23324. "readOnly",
  23325. "maxLength",
  23326. "cellSpacing",
  23327. "cellPadding",
  23328. "rowSpan",
  23329. "colSpan",
  23330. "useMap",
  23331. "frameBorder",
  23332. "contentEditable"
  23333. ], function() {
  23334. jQuery.propFix[ this.toLowerCase() ] = this;
  23335. } );
  23336. // Strip and collapse whitespace according to HTML spec
  23337. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  23338. function stripAndCollapse( value ) {
  23339. var tokens = value.match( rnothtmlwhite ) || [];
  23340. return tokens.join( " " );
  23341. }
  23342. function getClass( elem ) {
  23343. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  23344. }
  23345. function classesToArray( value ) {
  23346. if ( Array.isArray( value ) ) {
  23347. return value;
  23348. }
  23349. if ( typeof value === "string" ) {
  23350. return value.match( rnothtmlwhite ) || [];
  23351. }
  23352. return [];
  23353. }
  23354. jQuery.fn.extend( {
  23355. addClass: function( value ) {
  23356. var classes, elem, cur, curValue, clazz, j, finalValue,
  23357. i = 0;
  23358. if ( isFunction( value ) ) {
  23359. return this.each( function( j ) {
  23360. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  23361. } );
  23362. }
  23363. classes = classesToArray( value );
  23364. if ( classes.length ) {
  23365. while ( ( elem = this[ i++ ] ) ) {
  23366. curValue = getClass( elem );
  23367. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23368. if ( cur ) {
  23369. j = 0;
  23370. while ( ( clazz = classes[ j++ ] ) ) {
  23371. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  23372. cur += clazz + " ";
  23373. }
  23374. }
  23375. // Only assign if different to avoid unneeded rendering.
  23376. finalValue = stripAndCollapse( cur );
  23377. if ( curValue !== finalValue ) {
  23378. elem.setAttribute( "class", finalValue );
  23379. }
  23380. }
  23381. }
  23382. }
  23383. return this;
  23384. },
  23385. removeClass: function( value ) {
  23386. var classes, elem, cur, curValue, clazz, j, finalValue,
  23387. i = 0;
  23388. if ( isFunction( value ) ) {
  23389. return this.each( function( j ) {
  23390. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  23391. } );
  23392. }
  23393. if ( !arguments.length ) {
  23394. return this.attr( "class", "" );
  23395. }
  23396. classes = classesToArray( value );
  23397. if ( classes.length ) {
  23398. while ( ( elem = this[ i++ ] ) ) {
  23399. curValue = getClass( elem );
  23400. // This expression is here for better compressibility (see addClass)
  23401. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23402. if ( cur ) {
  23403. j = 0;
  23404. while ( ( clazz = classes[ j++ ] ) ) {
  23405. // Remove *all* instances
  23406. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  23407. cur = cur.replace( " " + clazz + " ", " " );
  23408. }
  23409. }
  23410. // Only assign if different to avoid unneeded rendering.
  23411. finalValue = stripAndCollapse( cur );
  23412. if ( curValue !== finalValue ) {
  23413. elem.setAttribute( "class", finalValue );
  23414. }
  23415. }
  23416. }
  23417. }
  23418. return this;
  23419. },
  23420. toggleClass: function( value, stateVal ) {
  23421. var type = typeof value,
  23422. isValidValue = type === "string" || Array.isArray( value );
  23423. if ( typeof stateVal === "boolean" && isValidValue ) {
  23424. return stateVal ? this.addClass( value ) : this.removeClass( value );
  23425. }
  23426. if ( isFunction( value ) ) {
  23427. return this.each( function( i ) {
  23428. jQuery( this ).toggleClass(
  23429. value.call( this, i, getClass( this ), stateVal ),
  23430. stateVal
  23431. );
  23432. } );
  23433. }
  23434. return this.each( function() {
  23435. var className, i, self, classNames;
  23436. if ( isValidValue ) {
  23437. // Toggle individual class names
  23438. i = 0;
  23439. self = jQuery( this );
  23440. classNames = classesToArray( value );
  23441. while ( ( className = classNames[ i++ ] ) ) {
  23442. // Check each className given, space separated list
  23443. if ( self.hasClass( className ) ) {
  23444. self.removeClass( className );
  23445. } else {
  23446. self.addClass( className );
  23447. }
  23448. }
  23449. // Toggle whole class name
  23450. } else if ( value === undefined || type === "boolean" ) {
  23451. className = getClass( this );
  23452. if ( className ) {
  23453. // Store className if set
  23454. dataPriv.set( this, "__className__", className );
  23455. }
  23456. // If the element has a class name or if we're passed `false`,
  23457. // then remove the whole classname (if there was one, the above saved it).
  23458. // Otherwise bring back whatever was previously saved (if anything),
  23459. // falling back to the empty string if nothing was stored.
  23460. if ( this.setAttribute ) {
  23461. this.setAttribute( "class",
  23462. className || value === false ?
  23463. "" :
  23464. dataPriv.get( this, "__className__" ) || ""
  23465. );
  23466. }
  23467. }
  23468. } );
  23469. },
  23470. hasClass: function( selector ) {
  23471. var className, elem,
  23472. i = 0;
  23473. className = " " + selector + " ";
  23474. while ( ( elem = this[ i++ ] ) ) {
  23475. if ( elem.nodeType === 1 &&
  23476. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  23477. return true;
  23478. }
  23479. }
  23480. return false;
  23481. }
  23482. } );
  23483. var rreturn = /\r/g;
  23484. jQuery.fn.extend( {
  23485. val: function( value ) {
  23486. var hooks, ret, valueIsFunction,
  23487. elem = this[ 0 ];
  23488. if ( !arguments.length ) {
  23489. if ( elem ) {
  23490. hooks = jQuery.valHooks[ elem.type ] ||
  23491. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  23492. if ( hooks &&
  23493. "get" in hooks &&
  23494. ( ret = hooks.get( elem, "value" ) ) !== undefined
  23495. ) {
  23496. return ret;
  23497. }
  23498. ret = elem.value;
  23499. // Handle most common string cases
  23500. if ( typeof ret === "string" ) {
  23501. return ret.replace( rreturn, "" );
  23502. }
  23503. // Handle cases where value is null/undef or number
  23504. return ret == null ? "" : ret;
  23505. }
  23506. return;
  23507. }
  23508. valueIsFunction = isFunction( value );
  23509. return this.each( function( i ) {
  23510. var val;
  23511. if ( this.nodeType !== 1 ) {
  23512. return;
  23513. }
  23514. if ( valueIsFunction ) {
  23515. val = value.call( this, i, jQuery( this ).val() );
  23516. } else {
  23517. val = value;
  23518. }
  23519. // Treat null/undefined as ""; convert numbers to string
  23520. if ( val == null ) {
  23521. val = "";
  23522. } else if ( typeof val === "number" ) {
  23523. val += "";
  23524. } else if ( Array.isArray( val ) ) {
  23525. val = jQuery.map( val, function( value ) {
  23526. return value == null ? "" : value + "";
  23527. } );
  23528. }
  23529. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  23530. // If set returns undefined, fall back to normal setting
  23531. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  23532. this.value = val;
  23533. }
  23534. } );
  23535. }
  23536. } );
  23537. jQuery.extend( {
  23538. valHooks: {
  23539. option: {
  23540. get: function( elem ) {
  23541. var val = jQuery.find.attr( elem, "value" );
  23542. return val != null ?
  23543. val :
  23544. // Support: IE <=10 - 11 only
  23545. // option.text throws exceptions (#14686, #14858)
  23546. // Strip and collapse whitespace
  23547. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  23548. stripAndCollapse( jQuery.text( elem ) );
  23549. }
  23550. },
  23551. select: {
  23552. get: function( elem ) {
  23553. var value, option, i,
  23554. options = elem.options,
  23555. index = elem.selectedIndex,
  23556. one = elem.type === "select-one",
  23557. values = one ? null : [],
  23558. max = one ? index + 1 : options.length;
  23559. if ( index < 0 ) {
  23560. i = max;
  23561. } else {
  23562. i = one ? index : 0;
  23563. }
  23564. // Loop through all the selected options
  23565. for ( ; i < max; i++ ) {
  23566. option = options[ i ];
  23567. // Support: IE <=9 only
  23568. // IE8-9 doesn't update selected after form reset (#2551)
  23569. if ( ( option.selected || i === index ) &&
  23570. // Don't return options that are disabled or in a disabled optgroup
  23571. !option.disabled &&
  23572. ( !option.parentNode.disabled ||
  23573. !nodeName( option.parentNode, "optgroup" ) ) ) {
  23574. // Get the specific value for the option
  23575. value = jQuery( option ).val();
  23576. // We don't need an array for one selects
  23577. if ( one ) {
  23578. return value;
  23579. }
  23580. // Multi-Selects return an array
  23581. values.push( value );
  23582. }
  23583. }
  23584. return values;
  23585. },
  23586. set: function( elem, value ) {
  23587. var optionSet, option,
  23588. options = elem.options,
  23589. values = jQuery.makeArray( value ),
  23590. i = options.length;
  23591. while ( i-- ) {
  23592. option = options[ i ];
  23593. /* eslint-disable no-cond-assign */
  23594. if ( option.selected =
  23595. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  23596. ) {
  23597. optionSet = true;
  23598. }
  23599. /* eslint-enable no-cond-assign */
  23600. }
  23601. // Force browsers to behave consistently when non-matching value is set
  23602. if ( !optionSet ) {
  23603. elem.selectedIndex = -1;
  23604. }
  23605. return values;
  23606. }
  23607. }
  23608. }
  23609. } );
  23610. // Radios and checkboxes getter/setter
  23611. jQuery.each( [ "radio", "checkbox" ], function() {
  23612. jQuery.valHooks[ this ] = {
  23613. set: function( elem, value ) {
  23614. if ( Array.isArray( value ) ) {
  23615. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  23616. }
  23617. }
  23618. };
  23619. if ( !support.checkOn ) {
  23620. jQuery.valHooks[ this ].get = function( elem ) {
  23621. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  23622. };
  23623. }
  23624. } );
  23625. // Return jQuery for attributes-only inclusion
  23626. support.focusin = "onfocusin" in window;
  23627. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  23628. stopPropagationCallback = function( e ) {
  23629. e.stopPropagation();
  23630. };
  23631. jQuery.extend( jQuery.event, {
  23632. trigger: function( event, data, elem, onlyHandlers ) {
  23633. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  23634. eventPath = [ elem || document ],
  23635. type = hasOwn.call( event, "type" ) ? event.type : event,
  23636. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  23637. cur = lastElement = tmp = elem = elem || document;
  23638. // Don't do events on text and comment nodes
  23639. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  23640. return;
  23641. }
  23642. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  23643. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  23644. return;
  23645. }
  23646. if ( type.indexOf( "." ) > -1 ) {
  23647. // Namespaced trigger; create a regexp to match event type in handle()
  23648. namespaces = type.split( "." );
  23649. type = namespaces.shift();
  23650. namespaces.sort();
  23651. }
  23652. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  23653. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  23654. event = event[ jQuery.expando ] ?
  23655. event :
  23656. new jQuery.Event( type, typeof event === "object" && event );
  23657. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  23658. event.isTrigger = onlyHandlers ? 2 : 3;
  23659. event.namespace = namespaces.join( "." );
  23660. event.rnamespace = event.namespace ?
  23661. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  23662. null;
  23663. // Clean up the event in case it is being reused
  23664. event.result = undefined;
  23665. if ( !event.target ) {
  23666. event.target = elem;
  23667. }
  23668. // Clone any incoming data and prepend the event, creating the handler arg list
  23669. data = data == null ?
  23670. [ event ] :
  23671. jQuery.makeArray( data, [ event ] );
  23672. // Allow special events to draw outside the lines
  23673. special = jQuery.event.special[ type ] || {};
  23674. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  23675. return;
  23676. }
  23677. // Determine event propagation path in advance, per W3C events spec (#9951)
  23678. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  23679. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  23680. bubbleType = special.delegateType || type;
  23681. if ( !rfocusMorph.test( bubbleType + type ) ) {
  23682. cur = cur.parentNode;
  23683. }
  23684. for ( ; cur; cur = cur.parentNode ) {
  23685. eventPath.push( cur );
  23686. tmp = cur;
  23687. }
  23688. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  23689. if ( tmp === ( elem.ownerDocument || document ) ) {
  23690. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  23691. }
  23692. }
  23693. // Fire handlers on the event path
  23694. i = 0;
  23695. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  23696. lastElement = cur;
  23697. event.type = i > 1 ?
  23698. bubbleType :
  23699. special.bindType || type;
  23700. // jQuery handler
  23701. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  23702. dataPriv.get( cur, "handle" );
  23703. if ( handle ) {
  23704. handle.apply( cur, data );
  23705. }
  23706. // Native handler
  23707. handle = ontype && cur[ ontype ];
  23708. if ( handle && handle.apply && acceptData( cur ) ) {
  23709. event.result = handle.apply( cur, data );
  23710. if ( event.result === false ) {
  23711. event.preventDefault();
  23712. }
  23713. }
  23714. }
  23715. event.type = type;
  23716. // If nobody prevented the default action, do it now
  23717. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  23718. if ( ( !special._default ||
  23719. special._default.apply( eventPath.pop(), data ) === false ) &&
  23720. acceptData( elem ) ) {
  23721. // Call a native DOM method on the target with the same name as the event.
  23722. // Don't do default actions on window, that's where global variables be (#6170)
  23723. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  23724. // Don't re-trigger an onFOO event when we call its FOO() method
  23725. tmp = elem[ ontype ];
  23726. if ( tmp ) {
  23727. elem[ ontype ] = null;
  23728. }
  23729. // Prevent re-triggering of the same event, since we already bubbled it above
  23730. jQuery.event.triggered = type;
  23731. if ( event.isPropagationStopped() ) {
  23732. lastElement.addEventListener( type, stopPropagationCallback );
  23733. }
  23734. elem[ type ]();
  23735. if ( event.isPropagationStopped() ) {
  23736. lastElement.removeEventListener( type, stopPropagationCallback );
  23737. }
  23738. jQuery.event.triggered = undefined;
  23739. if ( tmp ) {
  23740. elem[ ontype ] = tmp;
  23741. }
  23742. }
  23743. }
  23744. }
  23745. return event.result;
  23746. },
  23747. // Piggyback on a donor event to simulate a different one
  23748. // Used only for `focus(in | out)` events
  23749. simulate: function( type, elem, event ) {
  23750. var e = jQuery.extend(
  23751. new jQuery.Event(),
  23752. event,
  23753. {
  23754. type: type,
  23755. isSimulated: true
  23756. }
  23757. );
  23758. jQuery.event.trigger( e, null, elem );
  23759. }
  23760. } );
  23761. jQuery.fn.extend( {
  23762. trigger: function( type, data ) {
  23763. return this.each( function() {
  23764. jQuery.event.trigger( type, data, this );
  23765. } );
  23766. },
  23767. triggerHandler: function( type, data ) {
  23768. var elem = this[ 0 ];
  23769. if ( elem ) {
  23770. return jQuery.event.trigger( type, data, elem, true );
  23771. }
  23772. }
  23773. } );
  23774. // Support: Firefox <=44
  23775. // Firefox doesn't have focus(in | out) events
  23776. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  23777. //
  23778. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  23779. // focus(in | out) events fire after focus & blur events,
  23780. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  23781. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  23782. if ( !support.focusin ) {
  23783. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  23784. // Attach a single capturing handler on the document while someone wants focusin/focusout
  23785. var handler = function( event ) {
  23786. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  23787. };
  23788. jQuery.event.special[ fix ] = {
  23789. setup: function() {
  23790. var doc = this.ownerDocument || this,
  23791. attaches = dataPriv.access( doc, fix );
  23792. if ( !attaches ) {
  23793. doc.addEventListener( orig, handler, true );
  23794. }
  23795. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  23796. },
  23797. teardown: function() {
  23798. var doc = this.ownerDocument || this,
  23799. attaches = dataPriv.access( doc, fix ) - 1;
  23800. if ( !attaches ) {
  23801. doc.removeEventListener( orig, handler, true );
  23802. dataPriv.remove( doc, fix );
  23803. } else {
  23804. dataPriv.access( doc, fix, attaches );
  23805. }
  23806. }
  23807. };
  23808. } );
  23809. }
  23810. var location = window.location;
  23811. var nonce = Date.now();
  23812. var rquery = ( /\?/ );
  23813. // Cross-browser xml parsing
  23814. jQuery.parseXML = function( data ) {
  23815. var xml;
  23816. if ( !data || typeof data !== "string" ) {
  23817. return null;
  23818. }
  23819. // Support: IE 9 - 11 only
  23820. // IE throws on parseFromString with invalid input.
  23821. try {
  23822. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  23823. } catch ( e ) {
  23824. xml = undefined;
  23825. }
  23826. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  23827. jQuery.error( "Invalid XML: " + data );
  23828. }
  23829. return xml;
  23830. };
  23831. var
  23832. rbracket = /\[\]$/,
  23833. rCRLF = /\r?\n/g,
  23834. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  23835. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  23836. function buildParams( prefix, obj, traditional, add ) {
  23837. var name;
  23838. if ( Array.isArray( obj ) ) {
  23839. // Serialize array item.
  23840. jQuery.each( obj, function( i, v ) {
  23841. if ( traditional || rbracket.test( prefix ) ) {
  23842. // Treat each array item as a scalar.
  23843. add( prefix, v );
  23844. } else {
  23845. // Item is non-scalar (array or object), encode its numeric index.
  23846. buildParams(
  23847. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  23848. v,
  23849. traditional,
  23850. add
  23851. );
  23852. }
  23853. } );
  23854. } else if ( !traditional && toType( obj ) === "object" ) {
  23855. // Serialize object item.
  23856. for ( name in obj ) {
  23857. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  23858. }
  23859. } else {
  23860. // Serialize scalar item.
  23861. add( prefix, obj );
  23862. }
  23863. }
  23864. // Serialize an array of form elements or a set of
  23865. // key/values into a query string
  23866. jQuery.param = function( a, traditional ) {
  23867. var prefix,
  23868. s = [],
  23869. add = function( key, valueOrFunction ) {
  23870. // If value is a function, invoke it and use its return value
  23871. var value = isFunction( valueOrFunction ) ?
  23872. valueOrFunction() :
  23873. valueOrFunction;
  23874. s[ s.length ] = encodeURIComponent( key ) + "=" +
  23875. encodeURIComponent( value == null ? "" : value );
  23876. };
  23877. // If an array was passed in, assume that it is an array of form elements.
  23878. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  23879. // Serialize the form elements
  23880. jQuery.each( a, function() {
  23881. add( this.name, this.value );
  23882. } );
  23883. } else {
  23884. // If traditional, encode the "old" way (the way 1.3.2 or older
  23885. // did it), otherwise encode params recursively.
  23886. for ( prefix in a ) {
  23887. buildParams( prefix, a[ prefix ], traditional, add );
  23888. }
  23889. }
  23890. // Return the resulting serialization
  23891. return s.join( "&" );
  23892. };
  23893. jQuery.fn.extend( {
  23894. serialize: function() {
  23895. return jQuery.param( this.serializeArray() );
  23896. },
  23897. serializeArray: function() {
  23898. return this.map( function() {
  23899. // Can add propHook for "elements" to filter or add form elements
  23900. var elements = jQuery.prop( this, "elements" );
  23901. return elements ? jQuery.makeArray( elements ) : this;
  23902. } )
  23903. .filter( function() {
  23904. var type = this.type;
  23905. // Use .is( ":disabled" ) so that fieldset[disabled] works
  23906. return this.name && !jQuery( this ).is( ":disabled" ) &&
  23907. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  23908. ( this.checked || !rcheckableType.test( type ) );
  23909. } )
  23910. .map( function( i, elem ) {
  23911. var val = jQuery( this ).val();
  23912. if ( val == null ) {
  23913. return null;
  23914. }
  23915. if ( Array.isArray( val ) ) {
  23916. return jQuery.map( val, function( val ) {
  23917. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  23918. } );
  23919. }
  23920. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  23921. } ).get();
  23922. }
  23923. } );
  23924. var
  23925. r20 = /%20/g,
  23926. rhash = /#.*$/,
  23927. rantiCache = /([?&])_=[^&]*/,
  23928. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  23929. // #7653, #8125, #8152: local protocol detection
  23930. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  23931. rnoContent = /^(?:GET|HEAD)$/,
  23932. rprotocol = /^\/\//,
  23933. /* Prefilters
  23934. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  23935. * 2) These are called:
  23936. * - BEFORE asking for a transport
  23937. * - AFTER param serialization (s.data is a string if s.processData is true)
  23938. * 3) key is the dataType
  23939. * 4) the catchall symbol "*" can be used
  23940. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  23941. */
  23942. prefilters = {},
  23943. /* Transports bindings
  23944. * 1) key is the dataType
  23945. * 2) the catchall symbol "*" can be used
  23946. * 3) selection will start with transport dataType and THEN go to "*" if needed
  23947. */
  23948. transports = {},
  23949. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  23950. allTypes = "*/".concat( "*" ),
  23951. // Anchor tag for parsing the document origin
  23952. originAnchor = document.createElement( "a" );
  23953. originAnchor.href = location.href;
  23954. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  23955. function addToPrefiltersOrTransports( structure ) {
  23956. // dataTypeExpression is optional and defaults to "*"
  23957. return function( dataTypeExpression, func ) {
  23958. if ( typeof dataTypeExpression !== "string" ) {
  23959. func = dataTypeExpression;
  23960. dataTypeExpression = "*";
  23961. }
  23962. var dataType,
  23963. i = 0,
  23964. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  23965. if ( isFunction( func ) ) {
  23966. // For each dataType in the dataTypeExpression
  23967. while ( ( dataType = dataTypes[ i++ ] ) ) {
  23968. // Prepend if requested
  23969. if ( dataType[ 0 ] === "+" ) {
  23970. dataType = dataType.slice( 1 ) || "*";
  23971. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  23972. // Otherwise append
  23973. } else {
  23974. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  23975. }
  23976. }
  23977. }
  23978. };
  23979. }
  23980. // Base inspection function for prefilters and transports
  23981. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  23982. var inspected = {},
  23983. seekingTransport = ( structure === transports );
  23984. function inspect( dataType ) {
  23985. var selected;
  23986. inspected[ dataType ] = true;
  23987. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  23988. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  23989. if ( typeof dataTypeOrTransport === "string" &&
  23990. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  23991. options.dataTypes.unshift( dataTypeOrTransport );
  23992. inspect( dataTypeOrTransport );
  23993. return false;
  23994. } else if ( seekingTransport ) {
  23995. return !( selected = dataTypeOrTransport );
  23996. }
  23997. } );
  23998. return selected;
  23999. }
  24000. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  24001. }
  24002. // A special extend for ajax options
  24003. // that takes "flat" options (not to be deep extended)
  24004. // Fixes #9887
  24005. function ajaxExtend( target, src ) {
  24006. var key, deep,
  24007. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  24008. for ( key in src ) {
  24009. if ( src[ key ] !== undefined ) {
  24010. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  24011. }
  24012. }
  24013. if ( deep ) {
  24014. jQuery.extend( true, target, deep );
  24015. }
  24016. return target;
  24017. }
  24018. /* Handles responses to an ajax request:
  24019. * - finds the right dataType (mediates between content-type and expected dataType)
  24020. * - returns the corresponding response
  24021. */
  24022. function ajaxHandleResponses( s, jqXHR, responses ) {
  24023. var ct, type, finalDataType, firstDataType,
  24024. contents = s.contents,
  24025. dataTypes = s.dataTypes;
  24026. // Remove auto dataType and get content-type in the process
  24027. while ( dataTypes[ 0 ] === "*" ) {
  24028. dataTypes.shift();
  24029. if ( ct === undefined ) {
  24030. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  24031. }
  24032. }
  24033. // Check if we're dealing with a known content-type
  24034. if ( ct ) {
  24035. for ( type in contents ) {
  24036. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  24037. dataTypes.unshift( type );
  24038. break;
  24039. }
  24040. }
  24041. }
  24042. // Check to see if we have a response for the expected dataType
  24043. if ( dataTypes[ 0 ] in responses ) {
  24044. finalDataType = dataTypes[ 0 ];
  24045. } else {
  24046. // Try convertible dataTypes
  24047. for ( type in responses ) {
  24048. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  24049. finalDataType = type;
  24050. break;
  24051. }
  24052. if ( !firstDataType ) {
  24053. firstDataType = type;
  24054. }
  24055. }
  24056. // Or just use first one
  24057. finalDataType = finalDataType || firstDataType;
  24058. }
  24059. // If we found a dataType
  24060. // We add the dataType to the list if needed
  24061. // and return the corresponding response
  24062. if ( finalDataType ) {
  24063. if ( finalDataType !== dataTypes[ 0 ] ) {
  24064. dataTypes.unshift( finalDataType );
  24065. }
  24066. return responses[ finalDataType ];
  24067. }
  24068. }
  24069. /* Chain conversions given the request and the original response
  24070. * Also sets the responseXXX fields on the jqXHR instance
  24071. */
  24072. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  24073. var conv2, current, conv, tmp, prev,
  24074. converters = {},
  24075. // Work with a copy of dataTypes in case we need to modify it for conversion
  24076. dataTypes = s.dataTypes.slice();
  24077. // Create converters map with lowercased keys
  24078. if ( dataTypes[ 1 ] ) {
  24079. for ( conv in s.converters ) {
  24080. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  24081. }
  24082. }
  24083. current = dataTypes.shift();
  24084. // Convert to each sequential dataType
  24085. while ( current ) {
  24086. if ( s.responseFields[ current ] ) {
  24087. jqXHR[ s.responseFields[ current ] ] = response;
  24088. }
  24089. // Apply the dataFilter if provided
  24090. if ( !prev && isSuccess && s.dataFilter ) {
  24091. response = s.dataFilter( response, s.dataType );
  24092. }
  24093. prev = current;
  24094. current = dataTypes.shift();
  24095. if ( current ) {
  24096. // There's only work to do if current dataType is non-auto
  24097. if ( current === "*" ) {
  24098. current = prev;
  24099. // Convert response if prev dataType is non-auto and differs from current
  24100. } else if ( prev !== "*" && prev !== current ) {
  24101. // Seek a direct converter
  24102. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  24103. // If none found, seek a pair
  24104. if ( !conv ) {
  24105. for ( conv2 in converters ) {
  24106. // If conv2 outputs current
  24107. tmp = conv2.split( " " );
  24108. if ( tmp[ 1 ] === current ) {
  24109. // If prev can be converted to accepted input
  24110. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  24111. converters[ "* " + tmp[ 0 ] ];
  24112. if ( conv ) {
  24113. // Condense equivalence converters
  24114. if ( conv === true ) {
  24115. conv = converters[ conv2 ];
  24116. // Otherwise, insert the intermediate dataType
  24117. } else if ( converters[ conv2 ] !== true ) {
  24118. current = tmp[ 0 ];
  24119. dataTypes.unshift( tmp[ 1 ] );
  24120. }
  24121. break;
  24122. }
  24123. }
  24124. }
  24125. }
  24126. // Apply converter (if not an equivalence)
  24127. if ( conv !== true ) {
  24128. // Unless errors are allowed to bubble, catch and return them
  24129. if ( conv && s.throws ) {
  24130. response = conv( response );
  24131. } else {
  24132. try {
  24133. response = conv( response );
  24134. } catch ( e ) {
  24135. return {
  24136. state: "parsererror",
  24137. error: conv ? e : "No conversion from " + prev + " to " + current
  24138. };
  24139. }
  24140. }
  24141. }
  24142. }
  24143. }
  24144. }
  24145. return { state: "success", data: response };
  24146. }
  24147. jQuery.extend( {
  24148. // Counter for holding the number of active queries
  24149. active: 0,
  24150. // Last-Modified header cache for next request
  24151. lastModified: {},
  24152. etag: {},
  24153. ajaxSettings: {
  24154. url: location.href,
  24155. type: "GET",
  24156. isLocal: rlocalProtocol.test( location.protocol ),
  24157. global: true,
  24158. processData: true,
  24159. async: true,
  24160. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  24161. /*
  24162. timeout: 0,
  24163. data: null,
  24164. dataType: null,
  24165. username: null,
  24166. password: null,
  24167. cache: null,
  24168. throws: false,
  24169. traditional: false,
  24170. headers: {},
  24171. */
  24172. accepts: {
  24173. "*": allTypes,
  24174. text: "text/plain",
  24175. html: "text/html",
  24176. xml: "application/xml, text/xml",
  24177. json: "application/json, text/javascript"
  24178. },
  24179. contents: {
  24180. xml: /\bxml\b/,
  24181. html: /\bhtml/,
  24182. json: /\bjson\b/
  24183. },
  24184. responseFields: {
  24185. xml: "responseXML",
  24186. text: "responseText",
  24187. json: "responseJSON"
  24188. },
  24189. // Data converters
  24190. // Keys separate source (or catchall "*") and destination types with a single space
  24191. converters: {
  24192. // Convert anything to text
  24193. "* text": String,
  24194. // Text to html (true = no transformation)
  24195. "text html": true,
  24196. // Evaluate text as a json expression
  24197. "text json": JSON.parse,
  24198. // Parse text as xml
  24199. "text xml": jQuery.parseXML
  24200. },
  24201. // For options that shouldn't be deep extended:
  24202. // you can add your own custom options here if
  24203. // and when you create one that shouldn't be
  24204. // deep extended (see ajaxExtend)
  24205. flatOptions: {
  24206. url: true,
  24207. context: true
  24208. }
  24209. },
  24210. // Creates a full fledged settings object into target
  24211. // with both ajaxSettings and settings fields.
  24212. // If target is omitted, writes into ajaxSettings.
  24213. ajaxSetup: function( target, settings ) {
  24214. return settings ?
  24215. // Building a settings object
  24216. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  24217. // Extending ajaxSettings
  24218. ajaxExtend( jQuery.ajaxSettings, target );
  24219. },
  24220. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  24221. ajaxTransport: addToPrefiltersOrTransports( transports ),
  24222. // Main method
  24223. ajax: function( url, options ) {
  24224. // If url is an object, simulate pre-1.5 signature
  24225. if ( typeof url === "object" ) {
  24226. options = url;
  24227. url = undefined;
  24228. }
  24229. // Force options to be an object
  24230. options = options || {};
  24231. var transport,
  24232. // URL without anti-cache param
  24233. cacheURL,
  24234. // Response headers
  24235. responseHeadersString,
  24236. responseHeaders,
  24237. // timeout handle
  24238. timeoutTimer,
  24239. // Url cleanup var
  24240. urlAnchor,
  24241. // Request state (becomes false upon send and true upon completion)
  24242. completed,
  24243. // To know if global events are to be dispatched
  24244. fireGlobals,
  24245. // Loop variable
  24246. i,
  24247. // uncached part of the url
  24248. uncached,
  24249. // Create the final options object
  24250. s = jQuery.ajaxSetup( {}, options ),
  24251. // Callbacks context
  24252. callbackContext = s.context || s,
  24253. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  24254. globalEventContext = s.context &&
  24255. ( callbackContext.nodeType || callbackContext.jquery ) ?
  24256. jQuery( callbackContext ) :
  24257. jQuery.event,
  24258. // Deferreds
  24259. deferred = jQuery.Deferred(),
  24260. completeDeferred = jQuery.Callbacks( "once memory" ),
  24261. // Status-dependent callbacks
  24262. statusCode = s.statusCode || {},
  24263. // Headers (they are sent all at once)
  24264. requestHeaders = {},
  24265. requestHeadersNames = {},
  24266. // Default abort message
  24267. strAbort = "canceled",
  24268. // Fake xhr
  24269. jqXHR = {
  24270. readyState: 0,
  24271. // Builds headers hashtable if needed
  24272. getResponseHeader: function( key ) {
  24273. var match;
  24274. if ( completed ) {
  24275. if ( !responseHeaders ) {
  24276. responseHeaders = {};
  24277. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  24278. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  24279. }
  24280. }
  24281. match = responseHeaders[ key.toLowerCase() ];
  24282. }
  24283. return match == null ? null : match;
  24284. },
  24285. // Raw string
  24286. getAllResponseHeaders: function() {
  24287. return completed ? responseHeadersString : null;
  24288. },
  24289. // Caches the header
  24290. setRequestHeader: function( name, value ) {
  24291. if ( completed == null ) {
  24292. name = requestHeadersNames[ name.toLowerCase() ] =
  24293. requestHeadersNames[ name.toLowerCase() ] || name;
  24294. requestHeaders[ name ] = value;
  24295. }
  24296. return this;
  24297. },
  24298. // Overrides response content-type header
  24299. overrideMimeType: function( type ) {
  24300. if ( completed == null ) {
  24301. s.mimeType = type;
  24302. }
  24303. return this;
  24304. },
  24305. // Status-dependent callbacks
  24306. statusCode: function( map ) {
  24307. var code;
  24308. if ( map ) {
  24309. if ( completed ) {
  24310. // Execute the appropriate callbacks
  24311. jqXHR.always( map[ jqXHR.status ] );
  24312. } else {
  24313. // Lazy-add the new callbacks in a way that preserves old ones
  24314. for ( code in map ) {
  24315. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  24316. }
  24317. }
  24318. }
  24319. return this;
  24320. },
  24321. // Cancel the request
  24322. abort: function( statusText ) {
  24323. var finalText = statusText || strAbort;
  24324. if ( transport ) {
  24325. transport.abort( finalText );
  24326. }
  24327. done( 0, finalText );
  24328. return this;
  24329. }
  24330. };
  24331. // Attach deferreds
  24332. deferred.promise( jqXHR );
  24333. // Add protocol if not provided (prefilters might expect it)
  24334. // Handle falsy url in the settings object (#10093: consistency with old signature)
  24335. // We also use the url parameter if available
  24336. s.url = ( ( url || s.url || location.href ) + "" )
  24337. .replace( rprotocol, location.protocol + "//" );
  24338. // Alias method option to type as per ticket #12004
  24339. s.type = options.method || options.type || s.method || s.type;
  24340. // Extract dataTypes list
  24341. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  24342. // A cross-domain request is in order when the origin doesn't match the current origin.
  24343. if ( s.crossDomain == null ) {
  24344. urlAnchor = document.createElement( "a" );
  24345. // Support: IE <=8 - 11, Edge 12 - 15
  24346. // IE throws exception on accessing the href property if url is malformed,
  24347. // e.g. http://example.com:80x/
  24348. try {
  24349. urlAnchor.href = s.url;
  24350. // Support: IE <=8 - 11 only
  24351. // Anchor's host property isn't correctly set when s.url is relative
  24352. urlAnchor.href = urlAnchor.href;
  24353. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  24354. urlAnchor.protocol + "//" + urlAnchor.host;
  24355. } catch ( e ) {
  24356. // If there is an error parsing the URL, assume it is crossDomain,
  24357. // it can be rejected by the transport if it is invalid
  24358. s.crossDomain = true;
  24359. }
  24360. }
  24361. // Convert data if not already a string
  24362. if ( s.data && s.processData && typeof s.data !== "string" ) {
  24363. s.data = jQuery.param( s.data, s.traditional );
  24364. }
  24365. // Apply prefilters
  24366. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  24367. // If request was aborted inside a prefilter, stop there
  24368. if ( completed ) {
  24369. return jqXHR;
  24370. }
  24371. // We can fire global events as of now if asked to
  24372. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  24373. fireGlobals = jQuery.event && s.global;
  24374. // Watch for a new set of requests
  24375. if ( fireGlobals && jQuery.active++ === 0 ) {
  24376. jQuery.event.trigger( "ajaxStart" );
  24377. }
  24378. // Uppercase the type
  24379. s.type = s.type.toUpperCase();
  24380. // Determine if request has content
  24381. s.hasContent = !rnoContent.test( s.type );
  24382. // Save the URL in case we're toying with the If-Modified-Since
  24383. // and/or If-None-Match header later on
  24384. // Remove hash to simplify url manipulation
  24385. cacheURL = s.url.replace( rhash, "" );
  24386. // More options handling for requests with no content
  24387. if ( !s.hasContent ) {
  24388. // Remember the hash so we can put it back
  24389. uncached = s.url.slice( cacheURL.length );
  24390. // If data is available and should be processed, append data to url
  24391. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  24392. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  24393. // #9682: remove data so that it's not used in an eventual retry
  24394. delete s.data;
  24395. }
  24396. // Add or update anti-cache param if needed
  24397. if ( s.cache === false ) {
  24398. cacheURL = cacheURL.replace( rantiCache, "$1" );
  24399. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  24400. }
  24401. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  24402. s.url = cacheURL + uncached;
  24403. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  24404. } else if ( s.data && s.processData &&
  24405. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  24406. s.data = s.data.replace( r20, "+" );
  24407. }
  24408. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24409. if ( s.ifModified ) {
  24410. if ( jQuery.lastModified[ cacheURL ] ) {
  24411. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  24412. }
  24413. if ( jQuery.etag[ cacheURL ] ) {
  24414. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  24415. }
  24416. }
  24417. // Set the correct header, if data is being sent
  24418. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  24419. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  24420. }
  24421. // Set the Accepts header for the server, depending on the dataType
  24422. jqXHR.setRequestHeader(
  24423. "Accept",
  24424. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  24425. s.accepts[ s.dataTypes[ 0 ] ] +
  24426. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  24427. s.accepts[ "*" ]
  24428. );
  24429. // Check for headers option
  24430. for ( i in s.headers ) {
  24431. jqXHR.setRequestHeader( i, s.headers[ i ] );
  24432. }
  24433. // Allow custom headers/mimetypes and early abort
  24434. if ( s.beforeSend &&
  24435. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  24436. // Abort if not done already and return
  24437. return jqXHR.abort();
  24438. }
  24439. // Aborting is no longer a cancellation
  24440. strAbort = "abort";
  24441. // Install callbacks on deferreds
  24442. completeDeferred.add( s.complete );
  24443. jqXHR.done( s.success );
  24444. jqXHR.fail( s.error );
  24445. // Get transport
  24446. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  24447. // If no transport, we auto-abort
  24448. if ( !transport ) {
  24449. done( -1, "No Transport" );
  24450. } else {
  24451. jqXHR.readyState = 1;
  24452. // Send global event
  24453. if ( fireGlobals ) {
  24454. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  24455. }
  24456. // If request was aborted inside ajaxSend, stop there
  24457. if ( completed ) {
  24458. return jqXHR;
  24459. }
  24460. // Timeout
  24461. if ( s.async && s.timeout > 0 ) {
  24462. timeoutTimer = window.setTimeout( function() {
  24463. jqXHR.abort( "timeout" );
  24464. }, s.timeout );
  24465. }
  24466. try {
  24467. completed = false;
  24468. transport.send( requestHeaders, done );
  24469. } catch ( e ) {
  24470. // Rethrow post-completion exceptions
  24471. if ( completed ) {
  24472. throw e;
  24473. }
  24474. // Propagate others as results
  24475. done( -1, e );
  24476. }
  24477. }
  24478. // Callback for when everything is done
  24479. function done( status, nativeStatusText, responses, headers ) {
  24480. var isSuccess, success, error, response, modified,
  24481. statusText = nativeStatusText;
  24482. // Ignore repeat invocations
  24483. if ( completed ) {
  24484. return;
  24485. }
  24486. completed = true;
  24487. // Clear timeout if it exists
  24488. if ( timeoutTimer ) {
  24489. window.clearTimeout( timeoutTimer );
  24490. }
  24491. // Dereference transport for early garbage collection
  24492. // (no matter how long the jqXHR object will be used)
  24493. transport = undefined;
  24494. // Cache response headers
  24495. responseHeadersString = headers || "";
  24496. // Set readyState
  24497. jqXHR.readyState = status > 0 ? 4 : 0;
  24498. // Determine if successful
  24499. isSuccess = status >= 200 && status < 300 || status === 304;
  24500. // Get response data
  24501. if ( responses ) {
  24502. response = ajaxHandleResponses( s, jqXHR, responses );
  24503. }
  24504. // Convert no matter what (that way responseXXX fields are always set)
  24505. response = ajaxConvert( s, response, jqXHR, isSuccess );
  24506. // If successful, handle type chaining
  24507. if ( isSuccess ) {
  24508. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24509. if ( s.ifModified ) {
  24510. modified = jqXHR.getResponseHeader( "Last-Modified" );
  24511. if ( modified ) {
  24512. jQuery.lastModified[ cacheURL ] = modified;
  24513. }
  24514. modified = jqXHR.getResponseHeader( "etag" );
  24515. if ( modified ) {
  24516. jQuery.etag[ cacheURL ] = modified;
  24517. }
  24518. }
  24519. // if no content
  24520. if ( status === 204 || s.type === "HEAD" ) {
  24521. statusText = "nocontent";
  24522. // if not modified
  24523. } else if ( status === 304 ) {
  24524. statusText = "notmodified";
  24525. // If we have data, let's convert it
  24526. } else {
  24527. statusText = response.state;
  24528. success = response.data;
  24529. error = response.error;
  24530. isSuccess = !error;
  24531. }
  24532. } else {
  24533. // Extract error from statusText and normalize for non-aborts
  24534. error = statusText;
  24535. if ( status || !statusText ) {
  24536. statusText = "error";
  24537. if ( status < 0 ) {
  24538. status = 0;
  24539. }
  24540. }
  24541. }
  24542. // Set data for the fake xhr object
  24543. jqXHR.status = status;
  24544. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  24545. // Success/Error
  24546. if ( isSuccess ) {
  24547. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  24548. } else {
  24549. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  24550. }
  24551. // Status-dependent callbacks
  24552. jqXHR.statusCode( statusCode );
  24553. statusCode = undefined;
  24554. if ( fireGlobals ) {
  24555. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  24556. [ jqXHR, s, isSuccess ? success : error ] );
  24557. }
  24558. // Complete
  24559. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  24560. if ( fireGlobals ) {
  24561. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  24562. // Handle the global AJAX counter
  24563. if ( !( --jQuery.active ) ) {
  24564. jQuery.event.trigger( "ajaxStop" );
  24565. }
  24566. }
  24567. }
  24568. return jqXHR;
  24569. },
  24570. getJSON: function( url, data, callback ) {
  24571. return jQuery.get( url, data, callback, "json" );
  24572. },
  24573. getScript: function( url, callback ) {
  24574. return jQuery.get( url, undefined, callback, "script" );
  24575. }
  24576. } );
  24577. jQuery.each( [ "get", "post" ], function( i, method ) {
  24578. jQuery[ method ] = function( url, data, callback, type ) {
  24579. // Shift arguments if data argument was omitted
  24580. if ( isFunction( data ) ) {
  24581. type = type || callback;
  24582. callback = data;
  24583. data = undefined;
  24584. }
  24585. // The url can be an options object (which then must have .url)
  24586. return jQuery.ajax( jQuery.extend( {
  24587. url: url,
  24588. type: method,
  24589. dataType: type,
  24590. data: data,
  24591. success: callback
  24592. }, jQuery.isPlainObject( url ) && url ) );
  24593. };
  24594. } );
  24595. jQuery._evalUrl = function( url ) {
  24596. return jQuery.ajax( {
  24597. url: url,
  24598. // Make this explicit, since user can override this through ajaxSetup (#11264)
  24599. type: "GET",
  24600. dataType: "script",
  24601. cache: true,
  24602. async: false,
  24603. global: false,
  24604. "throws": true
  24605. } );
  24606. };
  24607. jQuery.fn.extend( {
  24608. wrapAll: function( html ) {
  24609. var wrap;
  24610. if ( this[ 0 ] ) {
  24611. if ( isFunction( html ) ) {
  24612. html = html.call( this[ 0 ] );
  24613. }
  24614. // The elements to wrap the target around
  24615. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  24616. if ( this[ 0 ].parentNode ) {
  24617. wrap.insertBefore( this[ 0 ] );
  24618. }
  24619. wrap.map( function() {
  24620. var elem = this;
  24621. while ( elem.firstElementChild ) {
  24622. elem = elem.firstElementChild;
  24623. }
  24624. return elem;
  24625. } ).append( this );
  24626. }
  24627. return this;
  24628. },
  24629. wrapInner: function( html ) {
  24630. if ( isFunction( html ) ) {
  24631. return this.each( function( i ) {
  24632. jQuery( this ).wrapInner( html.call( this, i ) );
  24633. } );
  24634. }
  24635. return this.each( function() {
  24636. var self = jQuery( this ),
  24637. contents = self.contents();
  24638. if ( contents.length ) {
  24639. contents.wrapAll( html );
  24640. } else {
  24641. self.append( html );
  24642. }
  24643. } );
  24644. },
  24645. wrap: function( html ) {
  24646. var htmlIsFunction = isFunction( html );
  24647. return this.each( function( i ) {
  24648. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  24649. } );
  24650. },
  24651. unwrap: function( selector ) {
  24652. this.parent( selector ).not( "body" ).each( function() {
  24653. jQuery( this ).replaceWith( this.childNodes );
  24654. } );
  24655. return this;
  24656. }
  24657. } );
  24658. jQuery.expr.pseudos.hidden = function( elem ) {
  24659. return !jQuery.expr.pseudos.visible( elem );
  24660. };
  24661. jQuery.expr.pseudos.visible = function( elem ) {
  24662. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  24663. };
  24664. jQuery.ajaxSettings.xhr = function() {
  24665. try {
  24666. return new window.XMLHttpRequest();
  24667. } catch ( e ) {}
  24668. };
  24669. var xhrSuccessStatus = {
  24670. // File protocol always yields status code 0, assume 200
  24671. 0: 200,
  24672. // Support: IE <=9 only
  24673. // #1450: sometimes IE returns 1223 when it should be 204
  24674. 1223: 204
  24675. },
  24676. xhrSupported = jQuery.ajaxSettings.xhr();
  24677. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  24678. support.ajax = xhrSupported = !!xhrSupported;
  24679. jQuery.ajaxTransport( function( options ) {
  24680. var callback, errorCallback;
  24681. // Cross domain only allowed if supported through XMLHttpRequest
  24682. if ( support.cors || xhrSupported && !options.crossDomain ) {
  24683. return {
  24684. send: function( headers, complete ) {
  24685. var i,
  24686. xhr = options.xhr();
  24687. xhr.open(
  24688. options.type,
  24689. options.url,
  24690. options.async,
  24691. options.username,
  24692. options.password
  24693. );
  24694. // Apply custom fields if provided
  24695. if ( options.xhrFields ) {
  24696. for ( i in options.xhrFields ) {
  24697. xhr[ i ] = options.xhrFields[ i ];
  24698. }
  24699. }
  24700. // Override mime type if needed
  24701. if ( options.mimeType && xhr.overrideMimeType ) {
  24702. xhr.overrideMimeType( options.mimeType );
  24703. }
  24704. // X-Requested-With header
  24705. // For cross-domain requests, seeing as conditions for a preflight are
  24706. // akin to a jigsaw puzzle, we simply never set it to be sure.
  24707. // (it can always be set on a per-request basis or even using ajaxSetup)
  24708. // For same-domain requests, won't change header if already provided.
  24709. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  24710. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  24711. }
  24712. // Set headers
  24713. for ( i in headers ) {
  24714. xhr.setRequestHeader( i, headers[ i ] );
  24715. }
  24716. // Callback
  24717. callback = function( type ) {
  24718. return function() {
  24719. if ( callback ) {
  24720. callback = errorCallback = xhr.onload =
  24721. xhr.onerror = xhr.onabort = xhr.ontimeout =
  24722. xhr.onreadystatechange = null;
  24723. if ( type === "abort" ) {
  24724. xhr.abort();
  24725. } else if ( type === "error" ) {
  24726. // Support: IE <=9 only
  24727. // On a manual native abort, IE9 throws
  24728. // errors on any property access that is not readyState
  24729. if ( typeof xhr.status !== "number" ) {
  24730. complete( 0, "error" );
  24731. } else {
  24732. complete(
  24733. // File: protocol always yields status 0; see #8605, #14207
  24734. xhr.status,
  24735. xhr.statusText
  24736. );
  24737. }
  24738. } else {
  24739. complete(
  24740. xhrSuccessStatus[ xhr.status ] || xhr.status,
  24741. xhr.statusText,
  24742. // Support: IE <=9 only
  24743. // IE9 has no XHR2 but throws on binary (trac-11426)
  24744. // For XHR2 non-text, let the caller handle it (gh-2498)
  24745. ( xhr.responseType || "text" ) !== "text" ||
  24746. typeof xhr.responseText !== "string" ?
  24747. { binary: xhr.response } :
  24748. { text: xhr.responseText },
  24749. xhr.getAllResponseHeaders()
  24750. );
  24751. }
  24752. }
  24753. };
  24754. };
  24755. // Listen to events
  24756. xhr.onload = callback();
  24757. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  24758. // Support: IE 9 only
  24759. // Use onreadystatechange to replace onabort
  24760. // to handle uncaught aborts
  24761. if ( xhr.onabort !== undefined ) {
  24762. xhr.onabort = errorCallback;
  24763. } else {
  24764. xhr.onreadystatechange = function() {
  24765. // Check readyState before timeout as it changes
  24766. if ( xhr.readyState === 4 ) {
  24767. // Allow onerror to be called first,
  24768. // but that will not handle a native abort
  24769. // Also, save errorCallback to a variable
  24770. // as xhr.onerror cannot be accessed
  24771. window.setTimeout( function() {
  24772. if ( callback ) {
  24773. errorCallback();
  24774. }
  24775. } );
  24776. }
  24777. };
  24778. }
  24779. // Create the abort callback
  24780. callback = callback( "abort" );
  24781. try {
  24782. // Do send the request (this may raise an exception)
  24783. xhr.send( options.hasContent && options.data || null );
  24784. } catch ( e ) {
  24785. // #14683: Only rethrow if this hasn't been notified as an error yet
  24786. if ( callback ) {
  24787. throw e;
  24788. }
  24789. }
  24790. },
  24791. abort: function() {
  24792. if ( callback ) {
  24793. callback();
  24794. }
  24795. }
  24796. };
  24797. }
  24798. } );
  24799. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  24800. jQuery.ajaxPrefilter( function( s ) {
  24801. if ( s.crossDomain ) {
  24802. s.contents.script = false;
  24803. }
  24804. } );
  24805. // Install script dataType
  24806. jQuery.ajaxSetup( {
  24807. accepts: {
  24808. script: "text/javascript, application/javascript, " +
  24809. "application/ecmascript, application/x-ecmascript"
  24810. },
  24811. contents: {
  24812. script: /\b(?:java|ecma)script\b/
  24813. },
  24814. converters: {
  24815. "text script": function( text ) {
  24816. jQuery.globalEval( text );
  24817. return text;
  24818. }
  24819. }
  24820. } );
  24821. // Handle cache's special case and crossDomain
  24822. jQuery.ajaxPrefilter( "script", function( s ) {
  24823. if ( s.cache === undefined ) {
  24824. s.cache = false;
  24825. }
  24826. if ( s.crossDomain ) {
  24827. s.type = "GET";
  24828. }
  24829. } );
  24830. // Bind script tag hack transport
  24831. jQuery.ajaxTransport( "script", function( s ) {
  24832. // This transport only deals with cross domain requests
  24833. if ( s.crossDomain ) {
  24834. var script, callback;
  24835. return {
  24836. send: function( _, complete ) {
  24837. script = jQuery( "<script>" ).prop( {
  24838. charset: s.scriptCharset,
  24839. src: s.url
  24840. } ).on(
  24841. "load error",
  24842. callback = function( evt ) {
  24843. script.remove();
  24844. callback = null;
  24845. if ( evt ) {
  24846. complete( evt.type === "error" ? 404 : 200, evt.type );
  24847. }
  24848. }
  24849. );
  24850. // Use native DOM manipulation to avoid our domManip AJAX trickery
  24851. document.head.appendChild( script[ 0 ] );
  24852. },
  24853. abort: function() {
  24854. if ( callback ) {
  24855. callback();
  24856. }
  24857. }
  24858. };
  24859. }
  24860. } );
  24861. var oldCallbacks = [],
  24862. rjsonp = /(=)\?(?=&|$)|\?\?/;
  24863. // Default jsonp settings
  24864. jQuery.ajaxSetup( {
  24865. jsonp: "callback",
  24866. jsonpCallback: function() {
  24867. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  24868. this[ callback ] = true;
  24869. return callback;
  24870. }
  24871. } );
  24872. // Detect, normalize options and install callbacks for jsonp requests
  24873. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  24874. var callbackName, overwritten, responseContainer,
  24875. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  24876. "url" :
  24877. typeof s.data === "string" &&
  24878. ( s.contentType || "" )
  24879. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  24880. rjsonp.test( s.data ) && "data"
  24881. );
  24882. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  24883. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  24884. // Get callback name, remembering preexisting value associated with it
  24885. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  24886. s.jsonpCallback() :
  24887. s.jsonpCallback;
  24888. // Insert callback into url or form data
  24889. if ( jsonProp ) {
  24890. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  24891. } else if ( s.jsonp !== false ) {
  24892. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  24893. }
  24894. // Use data converter to retrieve json after script execution
  24895. s.converters[ "script json" ] = function() {
  24896. if ( !responseContainer ) {
  24897. jQuery.error( callbackName + " was not called" );
  24898. }
  24899. return responseContainer[ 0 ];
  24900. };
  24901. // Force json dataType
  24902. s.dataTypes[ 0 ] = "json";
  24903. // Install callback
  24904. overwritten = window[ callbackName ];
  24905. window[ callbackName ] = function() {
  24906. responseContainer = arguments;
  24907. };
  24908. // Clean-up function (fires after converters)
  24909. jqXHR.always( function() {
  24910. // If previous value didn't exist - remove it
  24911. if ( overwritten === undefined ) {
  24912. jQuery( window ).removeProp( callbackName );
  24913. // Otherwise restore preexisting value
  24914. } else {
  24915. window[ callbackName ] = overwritten;
  24916. }
  24917. // Save back as free
  24918. if ( s[ callbackName ] ) {
  24919. // Make sure that re-using the options doesn't screw things around
  24920. s.jsonpCallback = originalSettings.jsonpCallback;
  24921. // Save the callback name for future use
  24922. oldCallbacks.push( callbackName );
  24923. }
  24924. // Call if it was a function and we have a response
  24925. if ( responseContainer && isFunction( overwritten ) ) {
  24926. overwritten( responseContainer[ 0 ] );
  24927. }
  24928. responseContainer = overwritten = undefined;
  24929. } );
  24930. // Delegate to script
  24931. return "script";
  24932. }
  24933. } );
  24934. // Support: Safari 8 only
  24935. // In Safari 8 documents created via document.implementation.createHTMLDocument
  24936. // collapse sibling forms: the second one becomes a child of the first one.
  24937. // Because of that, this security measure has to be disabled in Safari 8.
  24938. // https://bugs.webkit.org/show_bug.cgi?id=137337
  24939. support.createHTMLDocument = ( function() {
  24940. var body = document.implementation.createHTMLDocument( "" ).body;
  24941. body.innerHTML = "<form></form><form></form>";
  24942. return body.childNodes.length === 2;
  24943. } )();
  24944. // Argument "data" should be string of html
  24945. // context (optional): If specified, the fragment will be created in this context,
  24946. // defaults to document
  24947. // keepScripts (optional): If true, will include scripts passed in the html string
  24948. jQuery.parseHTML = function( data, context, keepScripts ) {
  24949. if ( typeof data !== "string" ) {
  24950. return [];
  24951. }
  24952. if ( typeof context === "boolean" ) {
  24953. keepScripts = context;
  24954. context = false;
  24955. }
  24956. var base, parsed, scripts;
  24957. if ( !context ) {
  24958. // Stop scripts or inline event handlers from being executed immediately
  24959. // by using document.implementation
  24960. if ( support.createHTMLDocument ) {
  24961. context = document.implementation.createHTMLDocument( "" );
  24962. // Set the base href for the created document
  24963. // so any parsed elements with URLs
  24964. // are based on the document's URL (gh-2965)
  24965. base = context.createElement( "base" );
  24966. base.href = document.location.href;
  24967. context.head.appendChild( base );
  24968. } else {
  24969. context = document;
  24970. }
  24971. }
  24972. parsed = rsingleTag.exec( data );
  24973. scripts = !keepScripts && [];
  24974. // Single tag
  24975. if ( parsed ) {
  24976. return [ context.createElement( parsed[ 1 ] ) ];
  24977. }
  24978. parsed = buildFragment( [ data ], context, scripts );
  24979. if ( scripts && scripts.length ) {
  24980. jQuery( scripts ).remove();
  24981. }
  24982. return jQuery.merge( [], parsed.childNodes );
  24983. };
  24984. /**
  24985. * Load a url into a page
  24986. */
  24987. jQuery.fn.load = function( url, params, callback ) {
  24988. var selector, type, response,
  24989. self = this,
  24990. off = url.indexOf( " " );
  24991. if ( off > -1 ) {
  24992. selector = stripAndCollapse( url.slice( off ) );
  24993. url = url.slice( 0, off );
  24994. }
  24995. // If it's a function
  24996. if ( isFunction( params ) ) {
  24997. // We assume that it's the callback
  24998. callback = params;
  24999. params = undefined;
  25000. // Otherwise, build a param string
  25001. } else if ( params && typeof params === "object" ) {
  25002. type = "POST";
  25003. }
  25004. // If we have elements to modify, make the request
  25005. if ( self.length > 0 ) {
  25006. jQuery.ajax( {
  25007. url: url,
  25008. // If "type" variable is undefined, then "GET" method will be used.
  25009. // Make value of this field explicit since
  25010. // user can override it through ajaxSetup method
  25011. type: type || "GET",
  25012. dataType: "html",
  25013. data: params
  25014. } ).done( function( responseText ) {
  25015. // Save response for use in complete callback
  25016. response = arguments;
  25017. self.html( selector ?
  25018. // If a selector was specified, locate the right elements in a dummy div
  25019. // Exclude scripts to avoid IE 'Permission Denied' errors
  25020. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  25021. // Otherwise use the full result
  25022. responseText );
  25023. // If the request succeeds, this function gets "data", "status", "jqXHR"
  25024. // but they are ignored because response was set above.
  25025. // If it fails, this function gets "jqXHR", "status", "error"
  25026. } ).always( callback && function( jqXHR, status ) {
  25027. self.each( function() {
  25028. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  25029. } );
  25030. } );
  25031. }
  25032. return this;
  25033. };
  25034. // Attach a bunch of functions for handling common AJAX events
  25035. jQuery.each( [
  25036. "ajaxStart",
  25037. "ajaxStop",
  25038. "ajaxComplete",
  25039. "ajaxError",
  25040. "ajaxSuccess",
  25041. "ajaxSend"
  25042. ], function( i, type ) {
  25043. jQuery.fn[ type ] = function( fn ) {
  25044. return this.on( type, fn );
  25045. };
  25046. } );
  25047. jQuery.expr.pseudos.animated = function( elem ) {
  25048. return jQuery.grep( jQuery.timers, function( fn ) {
  25049. return elem === fn.elem;
  25050. } ).length;
  25051. };
  25052. jQuery.offset = {
  25053. setOffset: function( elem, options, i ) {
  25054. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  25055. position = jQuery.css( elem, "position" ),
  25056. curElem = jQuery( elem ),
  25057. props = {};
  25058. // Set position first, in-case top/left are set even on static elem
  25059. if ( position === "static" ) {
  25060. elem.style.position = "relative";
  25061. }
  25062. curOffset = curElem.offset();
  25063. curCSSTop = jQuery.css( elem, "top" );
  25064. curCSSLeft = jQuery.css( elem, "left" );
  25065. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  25066. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  25067. // Need to be able to calculate position if either
  25068. // top or left is auto and position is either absolute or fixed
  25069. if ( calculatePosition ) {
  25070. curPosition = curElem.position();
  25071. curTop = curPosition.top;
  25072. curLeft = curPosition.left;
  25073. } else {
  25074. curTop = parseFloat( curCSSTop ) || 0;
  25075. curLeft = parseFloat( curCSSLeft ) || 0;
  25076. }
  25077. if ( isFunction( options ) ) {
  25078. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  25079. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  25080. }
  25081. if ( options.top != null ) {
  25082. props.top = ( options.top - curOffset.top ) + curTop;
  25083. }
  25084. if ( options.left != null ) {
  25085. props.left = ( options.left - curOffset.left ) + curLeft;
  25086. }
  25087. if ( "using" in options ) {
  25088. options.using.call( elem, props );
  25089. } else {
  25090. curElem.css( props );
  25091. }
  25092. }
  25093. };
  25094. jQuery.fn.extend( {
  25095. // offset() relates an element's border box to the document origin
  25096. offset: function( options ) {
  25097. // Preserve chaining for setter
  25098. if ( arguments.length ) {
  25099. return options === undefined ?
  25100. this :
  25101. this.each( function( i ) {
  25102. jQuery.offset.setOffset( this, options, i );
  25103. } );
  25104. }
  25105. var rect, win,
  25106. elem = this[ 0 ];
  25107. if ( !elem ) {
  25108. return;
  25109. }
  25110. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  25111. // Support: IE <=11 only
  25112. // Running getBoundingClientRect on a
  25113. // disconnected node in IE throws an error
  25114. if ( !elem.getClientRects().length ) {
  25115. return { top: 0, left: 0 };
  25116. }
  25117. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  25118. rect = elem.getBoundingClientRect();
  25119. win = elem.ownerDocument.defaultView;
  25120. return {
  25121. top: rect.top + win.pageYOffset,
  25122. left: rect.left + win.pageXOffset
  25123. };
  25124. },
  25125. // position() relates an element's margin box to its offset parent's padding box
  25126. // This corresponds to the behavior of CSS absolute positioning
  25127. position: function() {
  25128. if ( !this[ 0 ] ) {
  25129. return;
  25130. }
  25131. var offsetParent, offset, doc,
  25132. elem = this[ 0 ],
  25133. parentOffset = { top: 0, left: 0 };
  25134. // position:fixed elements are offset from the viewport, which itself always has zero offset
  25135. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  25136. // Assume position:fixed implies availability of getBoundingClientRect
  25137. offset = elem.getBoundingClientRect();
  25138. } else {
  25139. offset = this.offset();
  25140. // Account for the *real* offset parent, which can be the document or its root element
  25141. // when a statically positioned element is identified
  25142. doc = elem.ownerDocument;
  25143. offsetParent = elem.offsetParent || doc.documentElement;
  25144. while ( offsetParent &&
  25145. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  25146. jQuery.css( offsetParent, "position" ) === "static" ) {
  25147. offsetParent = offsetParent.parentNode;
  25148. }
  25149. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  25150. // Incorporate borders into its offset, since they are outside its content origin
  25151. parentOffset = jQuery( offsetParent ).offset();
  25152. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  25153. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  25154. }
  25155. }
  25156. // Subtract parent offsets and element margins
  25157. return {
  25158. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  25159. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  25160. };
  25161. },
  25162. // This method will return documentElement in the following cases:
  25163. // 1) For the element inside the iframe without offsetParent, this method will return
  25164. // documentElement of the parent window
  25165. // 2) For the hidden or detached element
  25166. // 3) For body or html element, i.e. in case of the html node - it will return itself
  25167. //
  25168. // but those exceptions were never presented as a real life use-cases
  25169. // and might be considered as more preferable results.
  25170. //
  25171. // This logic, however, is not guaranteed and can change at any point in the future
  25172. offsetParent: function() {
  25173. return this.map( function() {
  25174. var offsetParent = this.offsetParent;
  25175. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  25176. offsetParent = offsetParent.offsetParent;
  25177. }
  25178. return offsetParent || documentElement;
  25179. } );
  25180. }
  25181. } );
  25182. // Create scrollLeft and scrollTop methods
  25183. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  25184. var top = "pageYOffset" === prop;
  25185. jQuery.fn[ method ] = function( val ) {
  25186. return access( this, function( elem, method, val ) {
  25187. // Coalesce documents and windows
  25188. var win;
  25189. if ( isWindow( elem ) ) {
  25190. win = elem;
  25191. } else if ( elem.nodeType === 9 ) {
  25192. win = elem.defaultView;
  25193. }
  25194. if ( val === undefined ) {
  25195. return win ? win[ prop ] : elem[ method ];
  25196. }
  25197. if ( win ) {
  25198. win.scrollTo(
  25199. !top ? val : win.pageXOffset,
  25200. top ? val : win.pageYOffset
  25201. );
  25202. } else {
  25203. elem[ method ] = val;
  25204. }
  25205. }, method, val, arguments.length );
  25206. };
  25207. } );
  25208. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  25209. // Add the top/left cssHooks using jQuery.fn.position
  25210. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  25211. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  25212. // getComputedStyle returns percent when specified for top/left/bottom/right;
  25213. // rather than make the css module depend on the offset module, just check for it here
  25214. jQuery.each( [ "top", "left" ], function( i, prop ) {
  25215. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  25216. function( elem, computed ) {
  25217. if ( computed ) {
  25218. computed = curCSS( elem, prop );
  25219. // If curCSS returns percentage, fallback to offset
  25220. return rnumnonpx.test( computed ) ?
  25221. jQuery( elem ).position()[ prop ] + "px" :
  25222. computed;
  25223. }
  25224. }
  25225. );
  25226. } );
  25227. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  25228. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  25229. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  25230. function( defaultExtra, funcName ) {
  25231. // Margin is only for outerHeight, outerWidth
  25232. jQuery.fn[ funcName ] = function( margin, value ) {
  25233. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  25234. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  25235. return access( this, function( elem, type, value ) {
  25236. var doc;
  25237. if ( isWindow( elem ) ) {
  25238. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  25239. return funcName.indexOf( "outer" ) === 0 ?
  25240. elem[ "inner" + name ] :
  25241. elem.document.documentElement[ "client" + name ];
  25242. }
  25243. // Get document width or height
  25244. if ( elem.nodeType === 9 ) {
  25245. doc = elem.documentElement;
  25246. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  25247. // whichever is greatest
  25248. return Math.max(
  25249. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  25250. elem.body[ "offset" + name ], doc[ "offset" + name ],
  25251. doc[ "client" + name ]
  25252. );
  25253. }
  25254. return value === undefined ?
  25255. // Get width or height on the element, requesting but not forcing parseFloat
  25256. jQuery.css( elem, type, extra ) :
  25257. // Set width or height on the element
  25258. jQuery.style( elem, type, value, extra );
  25259. }, type, chainable ? margin : undefined, chainable );
  25260. };
  25261. } );
  25262. } );
  25263. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  25264. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  25265. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  25266. function( i, name ) {
  25267. // Handle event binding
  25268. jQuery.fn[ name ] = function( data, fn ) {
  25269. return arguments.length > 0 ?
  25270. this.on( name, null, data, fn ) :
  25271. this.trigger( name );
  25272. };
  25273. } );
  25274. jQuery.fn.extend( {
  25275. hover: function( fnOver, fnOut ) {
  25276. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  25277. }
  25278. } );
  25279. jQuery.fn.extend( {
  25280. bind: function( types, data, fn ) {
  25281. return this.on( types, null, data, fn );
  25282. },
  25283. unbind: function( types, fn ) {
  25284. return this.off( types, null, fn );
  25285. },
  25286. delegate: function( selector, types, data, fn ) {
  25287. return this.on( types, selector, data, fn );
  25288. },
  25289. undelegate: function( selector, types, fn ) {
  25290. // ( namespace ) or ( selector, types [, fn] )
  25291. return arguments.length === 1 ?
  25292. this.off( selector, "**" ) :
  25293. this.off( types, selector || "**", fn );
  25294. }
  25295. } );
  25296. // Bind a function to a context, optionally partially applying any
  25297. // arguments.
  25298. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  25299. // However, it is not slated for removal any time soon
  25300. jQuery.proxy = function( fn, context ) {
  25301. var tmp, args, proxy;
  25302. if ( typeof context === "string" ) {
  25303. tmp = fn[ context ];
  25304. context = fn;
  25305. fn = tmp;
  25306. }
  25307. // Quick check to determine if target is callable, in the spec
  25308. // this throws a TypeError, but we will just return undefined.
  25309. if ( !isFunction( fn ) ) {
  25310. return undefined;
  25311. }
  25312. // Simulated bind
  25313. args = slice.call( arguments, 2 );
  25314. proxy = function() {
  25315. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  25316. };
  25317. // Set the guid of unique handler to the same of original handler, so it can be removed
  25318. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  25319. return proxy;
  25320. };
  25321. jQuery.holdReady = function( hold ) {
  25322. if ( hold ) {
  25323. jQuery.readyWait++;
  25324. } else {
  25325. jQuery.ready( true );
  25326. }
  25327. };
  25328. jQuery.isArray = Array.isArray;
  25329. jQuery.parseJSON = JSON.parse;
  25330. jQuery.nodeName = nodeName;
  25331. jQuery.isFunction = isFunction;
  25332. jQuery.isWindow = isWindow;
  25333. jQuery.camelCase = camelCase;
  25334. jQuery.type = toType;
  25335. jQuery.now = Date.now;
  25336. jQuery.isNumeric = function( obj ) {
  25337. // As of jQuery 3.0, isNumeric is limited to
  25338. // strings and numbers (primitives or objects)
  25339. // that can be coerced to finite numbers (gh-2662)
  25340. var type = jQuery.type( obj );
  25341. return ( type === "number" || type === "string" ) &&
  25342. // parseFloat NaNs numeric-cast false positives ("")
  25343. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  25344. // subtraction forces infinities to NaN
  25345. !isNaN( obj - parseFloat( obj ) );
  25346. };
  25347. // Register as a named AMD module, since jQuery can be concatenated with other
  25348. // files that may use define, but not via a proper concatenation script that
  25349. // understands anonymous AMD modules. A named AMD is safest and most robust
  25350. // way to register. Lowercase jquery is used because AMD module names are
  25351. // derived from file names, and jQuery is normally delivered in a lowercase
  25352. // file name. Do this after creating the global so that if an AMD module wants
  25353. // to call noConflict to hide this version of jQuery, it will work.
  25354. // Note that for maximum portability, libraries that are not jQuery should
  25355. // declare themselves as anonymous modules, and avoid setting a global if an
  25356. // AMD loader is present. jQuery is a special case. For more information, see
  25357. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  25358. if ( true ) {
  25359. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  25360. return jQuery;
  25361. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  25362. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  25363. }
  25364. var
  25365. // Map over jQuery in case of overwrite
  25366. _jQuery = window.jQuery,
  25367. // Map over the $ in case of overwrite
  25368. _$ = window.$;
  25369. jQuery.noConflict = function( deep ) {
  25370. if ( window.$ === jQuery ) {
  25371. window.$ = _$;
  25372. }
  25373. if ( deep && window.jQuery === jQuery ) {
  25374. window.jQuery = _jQuery;
  25375. }
  25376. return jQuery;
  25377. };
  25378. // Expose jQuery and $ identifiers, even in AMD
  25379. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  25380. // and CommonJS for browser emulators (#13566)
  25381. if ( !noGlobal ) {
  25382. window.jQuery = window.$ = jQuery;
  25383. }
  25384. return jQuery;
  25385. } );
  25386. /***/ }),
  25387. /* 15 */
  25388. /***/ (function(module, exports) {
  25389. /*!
  25390. * Bootstrap v3.3.7 (http://getbootstrap.com)
  25391. * Copyright 2011-2016 Twitter, Inc.
  25392. * Licensed under the MIT license
  25393. */
  25394. if (typeof jQuery === 'undefined') {
  25395. throw new Error('Bootstrap\'s JavaScript requires jQuery')
  25396. }
  25397. +function ($) {
  25398. 'use strict';
  25399. var version = $.fn.jquery.split(' ')[0].split('.')
  25400. if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
  25401. throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  25402. }
  25403. }(jQuery);
  25404. /* ========================================================================
  25405. * Bootstrap: transition.js v3.3.7
  25406. * http://getbootstrap.com/javascript/#transitions
  25407. * ========================================================================
  25408. * Copyright 2011-2016 Twitter, Inc.
  25409. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25410. * ======================================================================== */
  25411. +function ($) {
  25412. 'use strict';
  25413. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  25414. // ============================================================
  25415. function transitionEnd() {
  25416. var el = document.createElement('bootstrap')
  25417. var transEndEventNames = {
  25418. WebkitTransition : 'webkitTransitionEnd',
  25419. MozTransition : 'transitionend',
  25420. OTransition : 'oTransitionEnd otransitionend',
  25421. transition : 'transitionend'
  25422. }
  25423. for (var name in transEndEventNames) {
  25424. if (el.style[name] !== undefined) {
  25425. return { end: transEndEventNames[name] }
  25426. }
  25427. }
  25428. return false // explicit for ie8 ( ._.)
  25429. }
  25430. // http://blog.alexmaccaw.com/css-transitions
  25431. $.fn.emulateTransitionEnd = function (duration) {
  25432. var called = false
  25433. var $el = this
  25434. $(this).one('bsTransitionEnd', function () { called = true })
  25435. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  25436. setTimeout(callback, duration)
  25437. return this
  25438. }
  25439. $(function () {
  25440. $.support.transition = transitionEnd()
  25441. if (!$.support.transition) return
  25442. $.event.special.bsTransitionEnd = {
  25443. bindType: $.support.transition.end,
  25444. delegateType: $.support.transition.end,
  25445. handle: function (e) {
  25446. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  25447. }
  25448. }
  25449. })
  25450. }(jQuery);
  25451. /* ========================================================================
  25452. * Bootstrap: alert.js v3.3.7
  25453. * http://getbootstrap.com/javascript/#alerts
  25454. * ========================================================================
  25455. * Copyright 2011-2016 Twitter, Inc.
  25456. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25457. * ======================================================================== */
  25458. +function ($) {
  25459. 'use strict';
  25460. // ALERT CLASS DEFINITION
  25461. // ======================
  25462. var dismiss = '[data-dismiss="alert"]'
  25463. var Alert = function (el) {
  25464. $(el).on('click', dismiss, this.close)
  25465. }
  25466. Alert.VERSION = '3.3.7'
  25467. Alert.TRANSITION_DURATION = 150
  25468. Alert.prototype.close = function (e) {
  25469. var $this = $(this)
  25470. var selector = $this.attr('data-target')
  25471. if (!selector) {
  25472. selector = $this.attr('href')
  25473. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25474. }
  25475. var $parent = $(selector === '#' ? [] : selector)
  25476. if (e) e.preventDefault()
  25477. if (!$parent.length) {
  25478. $parent = $this.closest('.alert')
  25479. }
  25480. $parent.trigger(e = $.Event('close.bs.alert'))
  25481. if (e.isDefaultPrevented()) return
  25482. $parent.removeClass('in')
  25483. function removeElement() {
  25484. // detach from parent, fire event then clean up data
  25485. $parent.detach().trigger('closed.bs.alert').remove()
  25486. }
  25487. $.support.transition && $parent.hasClass('fade') ?
  25488. $parent
  25489. .one('bsTransitionEnd', removeElement)
  25490. .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
  25491. removeElement()
  25492. }
  25493. // ALERT PLUGIN DEFINITION
  25494. // =======================
  25495. function Plugin(option) {
  25496. return this.each(function () {
  25497. var $this = $(this)
  25498. var data = $this.data('bs.alert')
  25499. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  25500. if (typeof option == 'string') data[option].call($this)
  25501. })
  25502. }
  25503. var old = $.fn.alert
  25504. $.fn.alert = Plugin
  25505. $.fn.alert.Constructor = Alert
  25506. // ALERT NO CONFLICT
  25507. // =================
  25508. $.fn.alert.noConflict = function () {
  25509. $.fn.alert = old
  25510. return this
  25511. }
  25512. // ALERT DATA-API
  25513. // ==============
  25514. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  25515. }(jQuery);
  25516. /* ========================================================================
  25517. * Bootstrap: button.js v3.3.7
  25518. * http://getbootstrap.com/javascript/#buttons
  25519. * ========================================================================
  25520. * Copyright 2011-2016 Twitter, Inc.
  25521. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25522. * ======================================================================== */
  25523. +function ($) {
  25524. 'use strict';
  25525. // BUTTON PUBLIC CLASS DEFINITION
  25526. // ==============================
  25527. var Button = function (element, options) {
  25528. this.$element = $(element)
  25529. this.options = $.extend({}, Button.DEFAULTS, options)
  25530. this.isLoading = false
  25531. }
  25532. Button.VERSION = '3.3.7'
  25533. Button.DEFAULTS = {
  25534. loadingText: 'loading...'
  25535. }
  25536. Button.prototype.setState = function (state) {
  25537. var d = 'disabled'
  25538. var $el = this.$element
  25539. var val = $el.is('input') ? 'val' : 'html'
  25540. var data = $el.data()
  25541. state += 'Text'
  25542. if (data.resetText == null) $el.data('resetText', $el[val]())
  25543. // push to event loop to allow forms to submit
  25544. setTimeout($.proxy(function () {
  25545. $el[val](data[state] == null ? this.options[state] : data[state])
  25546. if (state == 'loadingText') {
  25547. this.isLoading = true
  25548. $el.addClass(d).attr(d, d).prop(d, true)
  25549. } else if (this.isLoading) {
  25550. this.isLoading = false
  25551. $el.removeClass(d).removeAttr(d).prop(d, false)
  25552. }
  25553. }, this), 0)
  25554. }
  25555. Button.prototype.toggle = function () {
  25556. var changed = true
  25557. var $parent = this.$element.closest('[data-toggle="buttons"]')
  25558. if ($parent.length) {
  25559. var $input = this.$element.find('input')
  25560. if ($input.prop('type') == 'radio') {
  25561. if ($input.prop('checked')) changed = false
  25562. $parent.find('.active').removeClass('active')
  25563. this.$element.addClass('active')
  25564. } else if ($input.prop('type') == 'checkbox') {
  25565. if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
  25566. this.$element.toggleClass('active')
  25567. }
  25568. $input.prop('checked', this.$element.hasClass('active'))
  25569. if (changed) $input.trigger('change')
  25570. } else {
  25571. this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
  25572. this.$element.toggleClass('active')
  25573. }
  25574. }
  25575. // BUTTON PLUGIN DEFINITION
  25576. // ========================
  25577. function Plugin(option) {
  25578. return this.each(function () {
  25579. var $this = $(this)
  25580. var data = $this.data('bs.button')
  25581. var options = typeof option == 'object' && option
  25582. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  25583. if (option == 'toggle') data.toggle()
  25584. else if (option) data.setState(option)
  25585. })
  25586. }
  25587. var old = $.fn.button
  25588. $.fn.button = Plugin
  25589. $.fn.button.Constructor = Button
  25590. // BUTTON NO CONFLICT
  25591. // ==================
  25592. $.fn.button.noConflict = function () {
  25593. $.fn.button = old
  25594. return this
  25595. }
  25596. // BUTTON DATA-API
  25597. // ===============
  25598. $(document)
  25599. .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  25600. var $btn = $(e.target).closest('.btn')
  25601. Plugin.call($btn, 'toggle')
  25602. if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
  25603. // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
  25604. e.preventDefault()
  25605. // The target component still receive the focus
  25606. if ($btn.is('input,button')) $btn.trigger('focus')
  25607. else $btn.find('input:visible,button:visible').first().trigger('focus')
  25608. }
  25609. })
  25610. .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  25611. $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
  25612. })
  25613. }(jQuery);
  25614. /* ========================================================================
  25615. * Bootstrap: carousel.js v3.3.7
  25616. * http://getbootstrap.com/javascript/#carousel
  25617. * ========================================================================
  25618. * Copyright 2011-2016 Twitter, Inc.
  25619. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25620. * ======================================================================== */
  25621. +function ($) {
  25622. 'use strict';
  25623. // CAROUSEL CLASS DEFINITION
  25624. // =========================
  25625. var Carousel = function (element, options) {
  25626. this.$element = $(element)
  25627. this.$indicators = this.$element.find('.carousel-indicators')
  25628. this.options = options
  25629. this.paused = null
  25630. this.sliding = null
  25631. this.interval = null
  25632. this.$active = null
  25633. this.$items = null
  25634. this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
  25635. this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
  25636. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  25637. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  25638. }
  25639. Carousel.VERSION = '3.3.7'
  25640. Carousel.TRANSITION_DURATION = 600
  25641. Carousel.DEFAULTS = {
  25642. interval: 5000,
  25643. pause: 'hover',
  25644. wrap: true,
  25645. keyboard: true
  25646. }
  25647. Carousel.prototype.keydown = function (e) {
  25648. if (/input|textarea/i.test(e.target.tagName)) return
  25649. switch (e.which) {
  25650. case 37: this.prev(); break
  25651. case 39: this.next(); break
  25652. default: return
  25653. }
  25654. e.preventDefault()
  25655. }
  25656. Carousel.prototype.cycle = function (e) {
  25657. e || (this.paused = false)
  25658. this.interval && clearInterval(this.interval)
  25659. this.options.interval
  25660. && !this.paused
  25661. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  25662. return this
  25663. }
  25664. Carousel.prototype.getItemIndex = function (item) {
  25665. this.$items = item.parent().children('.item')
  25666. return this.$items.index(item || this.$active)
  25667. }
  25668. Carousel.prototype.getItemForDirection = function (direction, active) {
  25669. var activeIndex = this.getItemIndex(active)
  25670. var willWrap = (direction == 'prev' && activeIndex === 0)
  25671. || (direction == 'next' && activeIndex == (this.$items.length - 1))
  25672. if (willWrap && !this.options.wrap) return active
  25673. var delta = direction == 'prev' ? -1 : 1
  25674. var itemIndex = (activeIndex + delta) % this.$items.length
  25675. return this.$items.eq(itemIndex)
  25676. }
  25677. Carousel.prototype.to = function (pos) {
  25678. var that = this
  25679. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  25680. if (pos > (this.$items.length - 1) || pos < 0) return
  25681. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  25682. if (activeIndex == pos) return this.pause().cycle()
  25683. return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  25684. }
  25685. Carousel.prototype.pause = function (e) {
  25686. e || (this.paused = true)
  25687. if (this.$element.find('.next, .prev').length && $.support.transition) {
  25688. this.$element.trigger($.support.transition.end)
  25689. this.cycle(true)
  25690. }
  25691. this.interval = clearInterval(this.interval)
  25692. return this
  25693. }
  25694. Carousel.prototype.next = function () {
  25695. if (this.sliding) return
  25696. return this.slide('next')
  25697. }
  25698. Carousel.prototype.prev = function () {
  25699. if (this.sliding) return
  25700. return this.slide('prev')
  25701. }
  25702. Carousel.prototype.slide = function (type, next) {
  25703. var $active = this.$element.find('.item.active')
  25704. var $next = next || this.getItemForDirection(type, $active)
  25705. var isCycling = this.interval
  25706. var direction = type == 'next' ? 'left' : 'right'
  25707. var that = this
  25708. if ($next.hasClass('active')) return (this.sliding = false)
  25709. var relatedTarget = $next[0]
  25710. var slideEvent = $.Event('slide.bs.carousel', {
  25711. relatedTarget: relatedTarget,
  25712. direction: direction
  25713. })
  25714. this.$element.trigger(slideEvent)
  25715. if (slideEvent.isDefaultPrevented()) return
  25716. this.sliding = true
  25717. isCycling && this.pause()
  25718. if (this.$indicators.length) {
  25719. this.$indicators.find('.active').removeClass('active')
  25720. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  25721. $nextIndicator && $nextIndicator.addClass('active')
  25722. }
  25723. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  25724. if ($.support.transition && this.$element.hasClass('slide')) {
  25725. $next.addClass(type)
  25726. $next[0].offsetWidth // force reflow
  25727. $active.addClass(direction)
  25728. $next.addClass(direction)
  25729. $active
  25730. .one('bsTransitionEnd', function () {
  25731. $next.removeClass([type, direction].join(' ')).addClass('active')
  25732. $active.removeClass(['active', direction].join(' '))
  25733. that.sliding = false
  25734. setTimeout(function () {
  25735. that.$element.trigger(slidEvent)
  25736. }, 0)
  25737. })
  25738. .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
  25739. } else {
  25740. $active.removeClass('active')
  25741. $next.addClass('active')
  25742. this.sliding = false
  25743. this.$element.trigger(slidEvent)
  25744. }
  25745. isCycling && this.cycle()
  25746. return this
  25747. }
  25748. // CAROUSEL PLUGIN DEFINITION
  25749. // ==========================
  25750. function Plugin(option) {
  25751. return this.each(function () {
  25752. var $this = $(this)
  25753. var data = $this.data('bs.carousel')
  25754. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  25755. var action = typeof option == 'string' ? option : options.slide
  25756. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  25757. if (typeof option == 'number') data.to(option)
  25758. else if (action) data[action]()
  25759. else if (options.interval) data.pause().cycle()
  25760. })
  25761. }
  25762. var old = $.fn.carousel
  25763. $.fn.carousel = Plugin
  25764. $.fn.carousel.Constructor = Carousel
  25765. // CAROUSEL NO CONFLICT
  25766. // ====================
  25767. $.fn.carousel.noConflict = function () {
  25768. $.fn.carousel = old
  25769. return this
  25770. }
  25771. // CAROUSEL DATA-API
  25772. // =================
  25773. var clickHandler = function (e) {
  25774. var href
  25775. var $this = $(this)
  25776. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  25777. if (!$target.hasClass('carousel')) return
  25778. var options = $.extend({}, $target.data(), $this.data())
  25779. var slideIndex = $this.attr('data-slide-to')
  25780. if (slideIndex) options.interval = false
  25781. Plugin.call($target, options)
  25782. if (slideIndex) {
  25783. $target.data('bs.carousel').to(slideIndex)
  25784. }
  25785. e.preventDefault()
  25786. }
  25787. $(document)
  25788. .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
  25789. .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
  25790. $(window).on('load', function () {
  25791. $('[data-ride="carousel"]').each(function () {
  25792. var $carousel = $(this)
  25793. Plugin.call($carousel, $carousel.data())
  25794. })
  25795. })
  25796. }(jQuery);
  25797. /* ========================================================================
  25798. * Bootstrap: collapse.js v3.3.7
  25799. * http://getbootstrap.com/javascript/#collapse
  25800. * ========================================================================
  25801. * Copyright 2011-2016 Twitter, Inc.
  25802. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25803. * ======================================================================== */
  25804. /* jshint latedef: false */
  25805. +function ($) {
  25806. 'use strict';
  25807. // COLLAPSE PUBLIC CLASS DEFINITION
  25808. // ================================
  25809. var Collapse = function (element, options) {
  25810. this.$element = $(element)
  25811. this.options = $.extend({}, Collapse.DEFAULTS, options)
  25812. this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
  25813. '[data-toggle="collapse"][data-target="#' + element.id + '"]')
  25814. this.transitioning = null
  25815. if (this.options.parent) {
  25816. this.$parent = this.getParent()
  25817. } else {
  25818. this.addAriaAndCollapsedClass(this.$element, this.$trigger)
  25819. }
  25820. if (this.options.toggle) this.toggle()
  25821. }
  25822. Collapse.VERSION = '3.3.7'
  25823. Collapse.TRANSITION_DURATION = 350
  25824. Collapse.DEFAULTS = {
  25825. toggle: true
  25826. }
  25827. Collapse.prototype.dimension = function () {
  25828. var hasWidth = this.$element.hasClass('width')
  25829. return hasWidth ? 'width' : 'height'
  25830. }
  25831. Collapse.prototype.show = function () {
  25832. if (this.transitioning || this.$element.hasClass('in')) return
  25833. var activesData
  25834. var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
  25835. if (actives && actives.length) {
  25836. activesData = actives.data('bs.collapse')
  25837. if (activesData && activesData.transitioning) return
  25838. }
  25839. var startEvent = $.Event('show.bs.collapse')
  25840. this.$element.trigger(startEvent)
  25841. if (startEvent.isDefaultPrevented()) return
  25842. if (actives && actives.length) {
  25843. Plugin.call(actives, 'hide')
  25844. activesData || actives.data('bs.collapse', null)
  25845. }
  25846. var dimension = this.dimension()
  25847. this.$element
  25848. .removeClass('collapse')
  25849. .addClass('collapsing')[dimension](0)
  25850. .attr('aria-expanded', true)
  25851. this.$trigger
  25852. .removeClass('collapsed')
  25853. .attr('aria-expanded', true)
  25854. this.transitioning = 1
  25855. var complete = function () {
  25856. this.$element
  25857. .removeClass('collapsing')
  25858. .addClass('collapse in')[dimension]('')
  25859. this.transitioning = 0
  25860. this.$element
  25861. .trigger('shown.bs.collapse')
  25862. }
  25863. if (!$.support.transition) return complete.call(this)
  25864. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  25865. this.$element
  25866. .one('bsTransitionEnd', $.proxy(complete, this))
  25867. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  25868. }
  25869. Collapse.prototype.hide = function () {
  25870. if (this.transitioning || !this.$element.hasClass('in')) return
  25871. var startEvent = $.Event('hide.bs.collapse')
  25872. this.$element.trigger(startEvent)
  25873. if (startEvent.isDefaultPrevented()) return
  25874. var dimension = this.dimension()
  25875. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  25876. this.$element
  25877. .addClass('collapsing')
  25878. .removeClass('collapse in')
  25879. .attr('aria-expanded', false)
  25880. this.$trigger
  25881. .addClass('collapsed')
  25882. .attr('aria-expanded', false)
  25883. this.transitioning = 1
  25884. var complete = function () {
  25885. this.transitioning = 0
  25886. this.$element
  25887. .removeClass('collapsing')
  25888. .addClass('collapse')
  25889. .trigger('hidden.bs.collapse')
  25890. }
  25891. if (!$.support.transition) return complete.call(this)
  25892. this.$element
  25893. [dimension](0)
  25894. .one('bsTransitionEnd', $.proxy(complete, this))
  25895. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  25896. }
  25897. Collapse.prototype.toggle = function () {
  25898. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  25899. }
  25900. Collapse.prototype.getParent = function () {
  25901. return $(this.options.parent)
  25902. .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
  25903. .each($.proxy(function (i, element) {
  25904. var $element = $(element)
  25905. this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
  25906. }, this))
  25907. .end()
  25908. }
  25909. Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
  25910. var isOpen = $element.hasClass('in')
  25911. $element.attr('aria-expanded', isOpen)
  25912. $trigger
  25913. .toggleClass('collapsed', !isOpen)
  25914. .attr('aria-expanded', isOpen)
  25915. }
  25916. function getTargetFromTrigger($trigger) {
  25917. var href
  25918. var target = $trigger.attr('data-target')
  25919. || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  25920. return $(target)
  25921. }
  25922. // COLLAPSE PLUGIN DEFINITION
  25923. // ==========================
  25924. function Plugin(option) {
  25925. return this.each(function () {
  25926. var $this = $(this)
  25927. var data = $this.data('bs.collapse')
  25928. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  25929. if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
  25930. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  25931. if (typeof option == 'string') data[option]()
  25932. })
  25933. }
  25934. var old = $.fn.collapse
  25935. $.fn.collapse = Plugin
  25936. $.fn.collapse.Constructor = Collapse
  25937. // COLLAPSE NO CONFLICT
  25938. // ====================
  25939. $.fn.collapse.noConflict = function () {
  25940. $.fn.collapse = old
  25941. return this
  25942. }
  25943. // COLLAPSE DATA-API
  25944. // =================
  25945. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  25946. var $this = $(this)
  25947. if (!$this.attr('data-target')) e.preventDefault()
  25948. var $target = getTargetFromTrigger($this)
  25949. var data = $target.data('bs.collapse')
  25950. var option = data ? 'toggle' : $this.data()
  25951. Plugin.call($target, option)
  25952. })
  25953. }(jQuery);
  25954. /* ========================================================================
  25955. * Bootstrap: dropdown.js v3.3.7
  25956. * http://getbootstrap.com/javascript/#dropdowns
  25957. * ========================================================================
  25958. * Copyright 2011-2016 Twitter, Inc.
  25959. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25960. * ======================================================================== */
  25961. +function ($) {
  25962. 'use strict';
  25963. // DROPDOWN CLASS DEFINITION
  25964. // =========================
  25965. var backdrop = '.dropdown-backdrop'
  25966. var toggle = '[data-toggle="dropdown"]'
  25967. var Dropdown = function (element) {
  25968. $(element).on('click.bs.dropdown', this.toggle)
  25969. }
  25970. Dropdown.VERSION = '3.3.7'
  25971. function getParent($this) {
  25972. var selector = $this.attr('data-target')
  25973. if (!selector) {
  25974. selector = $this.attr('href')
  25975. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25976. }
  25977. var $parent = selector && $(selector)
  25978. return $parent && $parent.length ? $parent : $this.parent()
  25979. }
  25980. function clearMenus(e) {
  25981. if (e && e.which === 3) return
  25982. $(backdrop).remove()
  25983. $(toggle).each(function () {
  25984. var $this = $(this)
  25985. var $parent = getParent($this)
  25986. var relatedTarget = { relatedTarget: this }
  25987. if (!$parent.hasClass('open')) return
  25988. if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
  25989. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  25990. if (e.isDefaultPrevented()) return
  25991. $this.attr('aria-expanded', 'false')
  25992. $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
  25993. })
  25994. }
  25995. Dropdown.prototype.toggle = function (e) {
  25996. var $this = $(this)
  25997. if ($this.is('.disabled, :disabled')) return
  25998. var $parent = getParent($this)
  25999. var isActive = $parent.hasClass('open')
  26000. clearMenus()
  26001. if (!isActive) {
  26002. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  26003. // if mobile we use a backdrop because click events don't delegate
  26004. $(document.createElement('div'))
  26005. .addClass('dropdown-backdrop')
  26006. .insertAfter($(this))
  26007. .on('click', clearMenus)
  26008. }
  26009. var relatedTarget = { relatedTarget: this }
  26010. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  26011. if (e.isDefaultPrevented()) return
  26012. $this
  26013. .trigger('focus')
  26014. .attr('aria-expanded', 'true')
  26015. $parent
  26016. .toggleClass('open')
  26017. .trigger($.Event('shown.bs.dropdown', relatedTarget))
  26018. }
  26019. return false
  26020. }
  26021. Dropdown.prototype.keydown = function (e) {
  26022. if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
  26023. var $this = $(this)
  26024. e.preventDefault()
  26025. e.stopPropagation()
  26026. if ($this.is('.disabled, :disabled')) return
  26027. var $parent = getParent($this)
  26028. var isActive = $parent.hasClass('open')
  26029. if (!isActive && e.which != 27 || isActive && e.which == 27) {
  26030. if (e.which == 27) $parent.find(toggle).trigger('focus')
  26031. return $this.trigger('click')
  26032. }
  26033. var desc = ' li:not(.disabled):visible a'
  26034. var $items = $parent.find('.dropdown-menu' + desc)
  26035. if (!$items.length) return
  26036. var index = $items.index(e.target)
  26037. if (e.which == 38 && index > 0) index-- // up
  26038. if (e.which == 40 && index < $items.length - 1) index++ // down
  26039. if (!~index) index = 0
  26040. $items.eq(index).trigger('focus')
  26041. }
  26042. // DROPDOWN PLUGIN DEFINITION
  26043. // ==========================
  26044. function Plugin(option) {
  26045. return this.each(function () {
  26046. var $this = $(this)
  26047. var data = $this.data('bs.dropdown')
  26048. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  26049. if (typeof option == 'string') data[option].call($this)
  26050. })
  26051. }
  26052. var old = $.fn.dropdown
  26053. $.fn.dropdown = Plugin
  26054. $.fn.dropdown.Constructor = Dropdown
  26055. // DROPDOWN NO CONFLICT
  26056. // ====================
  26057. $.fn.dropdown.noConflict = function () {
  26058. $.fn.dropdown = old
  26059. return this
  26060. }
  26061. // APPLY TO STANDARD DROPDOWN ELEMENTS
  26062. // ===================================
  26063. $(document)
  26064. .on('click.bs.dropdown.data-api', clearMenus)
  26065. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  26066. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  26067. .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
  26068. .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
  26069. }(jQuery);
  26070. /* ========================================================================
  26071. * Bootstrap: modal.js v3.3.7
  26072. * http://getbootstrap.com/javascript/#modals
  26073. * ========================================================================
  26074. * Copyright 2011-2016 Twitter, Inc.
  26075. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26076. * ======================================================================== */
  26077. +function ($) {
  26078. 'use strict';
  26079. // MODAL CLASS DEFINITION
  26080. // ======================
  26081. var Modal = function (element, options) {
  26082. this.options = options
  26083. this.$body = $(document.body)
  26084. this.$element = $(element)
  26085. this.$dialog = this.$element.find('.modal-dialog')
  26086. this.$backdrop = null
  26087. this.isShown = null
  26088. this.originalBodyPad = null
  26089. this.scrollbarWidth = 0
  26090. this.ignoreBackdropClick = false
  26091. if (this.options.remote) {
  26092. this.$element
  26093. .find('.modal-content')
  26094. .load(this.options.remote, $.proxy(function () {
  26095. this.$element.trigger('loaded.bs.modal')
  26096. }, this))
  26097. }
  26098. }
  26099. Modal.VERSION = '3.3.7'
  26100. Modal.TRANSITION_DURATION = 300
  26101. Modal.BACKDROP_TRANSITION_DURATION = 150
  26102. Modal.DEFAULTS = {
  26103. backdrop: true,
  26104. keyboard: true,
  26105. show: true
  26106. }
  26107. Modal.prototype.toggle = function (_relatedTarget) {
  26108. return this.isShown ? this.hide() : this.show(_relatedTarget)
  26109. }
  26110. Modal.prototype.show = function (_relatedTarget) {
  26111. var that = this
  26112. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  26113. this.$element.trigger(e)
  26114. if (this.isShown || e.isDefaultPrevented()) return
  26115. this.isShown = true
  26116. this.checkScrollbar()
  26117. this.setScrollbar()
  26118. this.$body.addClass('modal-open')
  26119. this.escape()
  26120. this.resize()
  26121. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  26122. this.$dialog.on('mousedown.dismiss.bs.modal', function () {
  26123. that.$element.one('mouseup.dismiss.bs.modal', function (e) {
  26124. if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
  26125. })
  26126. })
  26127. this.backdrop(function () {
  26128. var transition = $.support.transition && that.$element.hasClass('fade')
  26129. if (!that.$element.parent().length) {
  26130. that.$element.appendTo(that.$body) // don't move modals dom position
  26131. }
  26132. that.$element
  26133. .show()
  26134. .scrollTop(0)
  26135. that.adjustDialog()
  26136. if (transition) {
  26137. that.$element[0].offsetWidth // force reflow
  26138. }
  26139. that.$element.addClass('in')
  26140. that.enforceFocus()
  26141. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  26142. transition ?
  26143. that.$dialog // wait for modal to slide in
  26144. .one('bsTransitionEnd', function () {
  26145. that.$element.trigger('focus').trigger(e)
  26146. })
  26147. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  26148. that.$element.trigger('focus').trigger(e)
  26149. })
  26150. }
  26151. Modal.prototype.hide = function (e) {
  26152. if (e) e.preventDefault()
  26153. e = $.Event('hide.bs.modal')
  26154. this.$element.trigger(e)
  26155. if (!this.isShown || e.isDefaultPrevented()) return
  26156. this.isShown = false
  26157. this.escape()
  26158. this.resize()
  26159. $(document).off('focusin.bs.modal')
  26160. this.$element
  26161. .removeClass('in')
  26162. .off('click.dismiss.bs.modal')
  26163. .off('mouseup.dismiss.bs.modal')
  26164. this.$dialog.off('mousedown.dismiss.bs.modal')
  26165. $.support.transition && this.$element.hasClass('fade') ?
  26166. this.$element
  26167. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  26168. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  26169. this.hideModal()
  26170. }
  26171. Modal.prototype.enforceFocus = function () {
  26172. $(document)
  26173. .off('focusin.bs.modal') // guard against infinite focus loop
  26174. .on('focusin.bs.modal', $.proxy(function (e) {
  26175. if (document !== e.target &&
  26176. this.$element[0] !== e.target &&
  26177. !this.$element.has(e.target).length) {
  26178. this.$element.trigger('focus')
  26179. }
  26180. }, this))
  26181. }
  26182. Modal.prototype.escape = function () {
  26183. if (this.isShown && this.options.keyboard) {
  26184. this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
  26185. e.which == 27 && this.hide()
  26186. }, this))
  26187. } else if (!this.isShown) {
  26188. this.$element.off('keydown.dismiss.bs.modal')
  26189. }
  26190. }
  26191. Modal.prototype.resize = function () {
  26192. if (this.isShown) {
  26193. $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
  26194. } else {
  26195. $(window).off('resize.bs.modal')
  26196. }
  26197. }
  26198. Modal.prototype.hideModal = function () {
  26199. var that = this
  26200. this.$element.hide()
  26201. this.backdrop(function () {
  26202. that.$body.removeClass('modal-open')
  26203. that.resetAdjustments()
  26204. that.resetScrollbar()
  26205. that.$element.trigger('hidden.bs.modal')
  26206. })
  26207. }
  26208. Modal.prototype.removeBackdrop = function () {
  26209. this.$backdrop && this.$backdrop.remove()
  26210. this.$backdrop = null
  26211. }
  26212. Modal.prototype.backdrop = function (callback) {
  26213. var that = this
  26214. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  26215. if (this.isShown && this.options.backdrop) {
  26216. var doAnimate = $.support.transition && animate
  26217. this.$backdrop = $(document.createElement('div'))
  26218. .addClass('modal-backdrop ' + animate)
  26219. .appendTo(this.$body)
  26220. this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
  26221. if (this.ignoreBackdropClick) {
  26222. this.ignoreBackdropClick = false
  26223. return
  26224. }
  26225. if (e.target !== e.currentTarget) return
  26226. this.options.backdrop == 'static'
  26227. ? this.$element[0].focus()
  26228. : this.hide()
  26229. }, this))
  26230. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  26231. this.$backdrop.addClass('in')
  26232. if (!callback) return
  26233. doAnimate ?
  26234. this.$backdrop
  26235. .one('bsTransitionEnd', callback)
  26236. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  26237. callback()
  26238. } else if (!this.isShown && this.$backdrop) {
  26239. this.$backdrop.removeClass('in')
  26240. var callbackRemove = function () {
  26241. that.removeBackdrop()
  26242. callback && callback()
  26243. }
  26244. $.support.transition && this.$element.hasClass('fade') ?
  26245. this.$backdrop
  26246. .one('bsTransitionEnd', callbackRemove)
  26247. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  26248. callbackRemove()
  26249. } else if (callback) {
  26250. callback()
  26251. }
  26252. }
  26253. // these following methods are used to handle overflowing modals
  26254. Modal.prototype.handleUpdate = function () {
  26255. this.adjustDialog()
  26256. }
  26257. Modal.prototype.adjustDialog = function () {
  26258. var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
  26259. this.$element.css({
  26260. paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
  26261. paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
  26262. })
  26263. }
  26264. Modal.prototype.resetAdjustments = function () {
  26265. this.$element.css({
  26266. paddingLeft: '',
  26267. paddingRight: ''
  26268. })
  26269. }
  26270. Modal.prototype.checkScrollbar = function () {
  26271. var fullWindowWidth = window.innerWidth
  26272. if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
  26273. var documentElementRect = document.documentElement.getBoundingClientRect()
  26274. fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
  26275. }
  26276. this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
  26277. this.scrollbarWidth = this.measureScrollbar()
  26278. }
  26279. Modal.prototype.setScrollbar = function () {
  26280. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  26281. this.originalBodyPad = document.body.style.paddingRight || ''
  26282. if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
  26283. }
  26284. Modal.prototype.resetScrollbar = function () {
  26285. this.$body.css('padding-right', this.originalBodyPad)
  26286. }
  26287. Modal.prototype.measureScrollbar = function () { // thx walsh
  26288. var scrollDiv = document.createElement('div')
  26289. scrollDiv.className = 'modal-scrollbar-measure'
  26290. this.$body.append(scrollDiv)
  26291. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  26292. this.$body[0].removeChild(scrollDiv)
  26293. return scrollbarWidth
  26294. }
  26295. // MODAL PLUGIN DEFINITION
  26296. // =======================
  26297. function Plugin(option, _relatedTarget) {
  26298. return this.each(function () {
  26299. var $this = $(this)
  26300. var data = $this.data('bs.modal')
  26301. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  26302. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  26303. if (typeof option == 'string') data[option](_relatedTarget)
  26304. else if (options.show) data.show(_relatedTarget)
  26305. })
  26306. }
  26307. var old = $.fn.modal
  26308. $.fn.modal = Plugin
  26309. $.fn.modal.Constructor = Modal
  26310. // MODAL NO CONFLICT
  26311. // =================
  26312. $.fn.modal.noConflict = function () {
  26313. $.fn.modal = old
  26314. return this
  26315. }
  26316. // MODAL DATA-API
  26317. // ==============
  26318. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  26319. var $this = $(this)
  26320. var href = $this.attr('href')
  26321. var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
  26322. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  26323. if ($this.is('a')) e.preventDefault()
  26324. $target.one('show.bs.modal', function (showEvent) {
  26325. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  26326. $target.one('hidden.bs.modal', function () {
  26327. $this.is(':visible') && $this.trigger('focus')
  26328. })
  26329. })
  26330. Plugin.call($target, option, this)
  26331. })
  26332. }(jQuery);
  26333. /* ========================================================================
  26334. * Bootstrap: tooltip.js v3.3.7
  26335. * http://getbootstrap.com/javascript/#tooltip
  26336. * Inspired by the original jQuery.tipsy by Jason Frame
  26337. * ========================================================================
  26338. * Copyright 2011-2016 Twitter, Inc.
  26339. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26340. * ======================================================================== */
  26341. +function ($) {
  26342. 'use strict';
  26343. // TOOLTIP PUBLIC CLASS DEFINITION
  26344. // ===============================
  26345. var Tooltip = function (element, options) {
  26346. this.type = null
  26347. this.options = null
  26348. this.enabled = null
  26349. this.timeout = null
  26350. this.hoverState = null
  26351. this.$element = null
  26352. this.inState = null
  26353. this.init('tooltip', element, options)
  26354. }
  26355. Tooltip.VERSION = '3.3.7'
  26356. Tooltip.TRANSITION_DURATION = 150
  26357. Tooltip.DEFAULTS = {
  26358. animation: true,
  26359. placement: 'top',
  26360. selector: false,
  26361. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  26362. trigger: 'hover focus',
  26363. title: '',
  26364. delay: 0,
  26365. html: false,
  26366. container: false,
  26367. viewport: {
  26368. selector: 'body',
  26369. padding: 0
  26370. }
  26371. }
  26372. Tooltip.prototype.init = function (type, element, options) {
  26373. this.enabled = true
  26374. this.type = type
  26375. this.$element = $(element)
  26376. this.options = this.getOptions(options)
  26377. this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
  26378. this.inState = { click: false, hover: false, focus: false }
  26379. if (this.$element[0] instanceof document.constructor && !this.options.selector) {
  26380. throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
  26381. }
  26382. var triggers = this.options.trigger.split(' ')
  26383. for (var i = triggers.length; i--;) {
  26384. var trigger = triggers[i]
  26385. if (trigger == 'click') {
  26386. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  26387. } else if (trigger != 'manual') {
  26388. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  26389. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  26390. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  26391. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  26392. }
  26393. }
  26394. this.options.selector ?
  26395. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  26396. this.fixTitle()
  26397. }
  26398. Tooltip.prototype.getDefaults = function () {
  26399. return Tooltip.DEFAULTS
  26400. }
  26401. Tooltip.prototype.getOptions = function (options) {
  26402. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  26403. if (options.delay && typeof options.delay == 'number') {
  26404. options.delay = {
  26405. show: options.delay,
  26406. hide: options.delay
  26407. }
  26408. }
  26409. return options
  26410. }
  26411. Tooltip.prototype.getDelegateOptions = function () {
  26412. var options = {}
  26413. var defaults = this.getDefaults()
  26414. this._options && $.each(this._options, function (key, value) {
  26415. if (defaults[key] != value) options[key] = value
  26416. })
  26417. return options
  26418. }
  26419. Tooltip.prototype.enter = function (obj) {
  26420. var self = obj instanceof this.constructor ?
  26421. obj : $(obj.currentTarget).data('bs.' + this.type)
  26422. if (!self) {
  26423. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  26424. $(obj.currentTarget).data('bs.' + this.type, self)
  26425. }
  26426. if (obj instanceof $.Event) {
  26427. self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
  26428. }
  26429. if (self.tip().hasClass('in') || self.hoverState == 'in') {
  26430. self.hoverState = 'in'
  26431. return
  26432. }
  26433. clearTimeout(self.timeout)
  26434. self.hoverState = 'in'
  26435. if (!self.options.delay || !self.options.delay.show) return self.show()
  26436. self.timeout = setTimeout(function () {
  26437. if (self.hoverState == 'in') self.show()
  26438. }, self.options.delay.show)
  26439. }
  26440. Tooltip.prototype.isInStateTrue = function () {
  26441. for (var key in this.inState) {
  26442. if (this.inState[key]) return true
  26443. }
  26444. return false
  26445. }
  26446. Tooltip.prototype.leave = function (obj) {
  26447. var self = obj instanceof this.constructor ?
  26448. obj : $(obj.currentTarget).data('bs.' + this.type)
  26449. if (!self) {
  26450. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  26451. $(obj.currentTarget).data('bs.' + this.type, self)
  26452. }
  26453. if (obj instanceof $.Event) {
  26454. self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
  26455. }
  26456. if (self.isInStateTrue()) return
  26457. clearTimeout(self.timeout)
  26458. self.hoverState = 'out'
  26459. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  26460. self.timeout = setTimeout(function () {
  26461. if (self.hoverState == 'out') self.hide()
  26462. }, self.options.delay.hide)
  26463. }
  26464. Tooltip.prototype.show = function () {
  26465. var e = $.Event('show.bs.' + this.type)
  26466. if (this.hasContent() && this.enabled) {
  26467. this.$element.trigger(e)
  26468. var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
  26469. if (e.isDefaultPrevented() || !inDom) return
  26470. var that = this
  26471. var $tip = this.tip()
  26472. var tipId = this.getUID(this.type)
  26473. this.setContent()
  26474. $tip.attr('id', tipId)
  26475. this.$element.attr('aria-describedby', tipId)
  26476. if (this.options.animation) $tip.addClass('fade')
  26477. var placement = typeof this.options.placement == 'function' ?
  26478. this.options.placement.call(this, $tip[0], this.$element[0]) :
  26479. this.options.placement
  26480. var autoToken = /\s?auto?\s?/i
  26481. var autoPlace = autoToken.test(placement)
  26482. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  26483. $tip
  26484. .detach()
  26485. .css({ top: 0, left: 0, display: 'block' })
  26486. .addClass(placement)
  26487. .data('bs.' + this.type, this)
  26488. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  26489. this.$element.trigger('inserted.bs.' + this.type)
  26490. var pos = this.getPosition()
  26491. var actualWidth = $tip[0].offsetWidth
  26492. var actualHeight = $tip[0].offsetHeight
  26493. if (autoPlace) {
  26494. var orgPlacement = placement
  26495. var viewportDim = this.getPosition(this.$viewport)
  26496. placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
  26497. placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
  26498. placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
  26499. placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
  26500. placement
  26501. $tip
  26502. .removeClass(orgPlacement)
  26503. .addClass(placement)
  26504. }
  26505. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  26506. this.applyPlacement(calculatedOffset, placement)
  26507. var complete = function () {
  26508. var prevHoverState = that.hoverState
  26509. that.$element.trigger('shown.bs.' + that.type)
  26510. that.hoverState = null
  26511. if (prevHoverState == 'out') that.leave(that)
  26512. }
  26513. $.support.transition && this.$tip.hasClass('fade') ?
  26514. $tip
  26515. .one('bsTransitionEnd', complete)
  26516. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  26517. complete()
  26518. }
  26519. }
  26520. Tooltip.prototype.applyPlacement = function (offset, placement) {
  26521. var $tip = this.tip()
  26522. var width = $tip[0].offsetWidth
  26523. var height = $tip[0].offsetHeight
  26524. // manually read margins because getBoundingClientRect includes difference
  26525. var marginTop = parseInt($tip.css('margin-top'), 10)
  26526. var marginLeft = parseInt($tip.css('margin-left'), 10)
  26527. // we must check for NaN for ie 8/9
  26528. if (isNaN(marginTop)) marginTop = 0
  26529. if (isNaN(marginLeft)) marginLeft = 0
  26530. offset.top += marginTop
  26531. offset.left += marginLeft
  26532. // $.fn.offset doesn't round pixel values
  26533. // so we use setOffset directly with our own function B-0
  26534. $.offset.setOffset($tip[0], $.extend({
  26535. using: function (props) {
  26536. $tip.css({
  26537. top: Math.round(props.top),
  26538. left: Math.round(props.left)
  26539. })
  26540. }
  26541. }, offset), 0)
  26542. $tip.addClass('in')
  26543. // check to see if placing tip in new offset caused the tip to resize itself
  26544. var actualWidth = $tip[0].offsetWidth
  26545. var actualHeight = $tip[0].offsetHeight
  26546. if (placement == 'top' && actualHeight != height) {
  26547. offset.top = offset.top + height - actualHeight
  26548. }
  26549. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  26550. if (delta.left) offset.left += delta.left
  26551. else offset.top += delta.top
  26552. var isVertical = /top|bottom/.test(placement)
  26553. var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  26554. var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
  26555. $tip.offset(offset)
  26556. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  26557. }
  26558. Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
  26559. this.arrow()
  26560. .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
  26561. .css(isVertical ? 'top' : 'left', '')
  26562. }
  26563. Tooltip.prototype.setContent = function () {
  26564. var $tip = this.tip()
  26565. var title = this.getTitle()
  26566. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  26567. $tip.removeClass('fade in top bottom left right')
  26568. }
  26569. Tooltip.prototype.hide = function (callback) {
  26570. var that = this
  26571. var $tip = $(this.$tip)
  26572. var e = $.Event('hide.bs.' + this.type)
  26573. function complete() {
  26574. if (that.hoverState != 'in') $tip.detach()
  26575. if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
  26576. that.$element
  26577. .removeAttr('aria-describedby')
  26578. .trigger('hidden.bs.' + that.type)
  26579. }
  26580. callback && callback()
  26581. }
  26582. this.$element.trigger(e)
  26583. if (e.isDefaultPrevented()) return
  26584. $tip.removeClass('in')
  26585. $.support.transition && $tip.hasClass('fade') ?
  26586. $tip
  26587. .one('bsTransitionEnd', complete)
  26588. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  26589. complete()
  26590. this.hoverState = null
  26591. return this
  26592. }
  26593. Tooltip.prototype.fixTitle = function () {
  26594. var $e = this.$element
  26595. if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
  26596. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  26597. }
  26598. }
  26599. Tooltip.prototype.hasContent = function () {
  26600. return this.getTitle()
  26601. }
  26602. Tooltip.prototype.getPosition = function ($element) {
  26603. $element = $element || this.$element
  26604. var el = $element[0]
  26605. var isBody = el.tagName == 'BODY'
  26606. var elRect = el.getBoundingClientRect()
  26607. if (elRect.width == null) {
  26608. // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
  26609. elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
  26610. }
  26611. var isSvg = window.SVGElement && el instanceof window.SVGElement
  26612. // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
  26613. // See https://github.com/twbs/bootstrap/issues/20280
  26614. var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
  26615. var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
  26616. var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
  26617. return $.extend({}, elRect, scroll, outerDims, elOffset)
  26618. }
  26619. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  26620. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  26621. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  26622. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  26623. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  26624. }
  26625. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  26626. var delta = { top: 0, left: 0 }
  26627. if (!this.$viewport) return delta
  26628. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  26629. var viewportDimensions = this.getPosition(this.$viewport)
  26630. if (/right|left/.test(placement)) {
  26631. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  26632. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  26633. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  26634. delta.top = viewportDimensions.top - topEdgeOffset
  26635. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  26636. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  26637. }
  26638. } else {
  26639. var leftEdgeOffset = pos.left - viewportPadding
  26640. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  26641. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  26642. delta.left = viewportDimensions.left - leftEdgeOffset
  26643. } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
  26644. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  26645. }
  26646. }
  26647. return delta
  26648. }
  26649. Tooltip.prototype.getTitle = function () {
  26650. var title
  26651. var $e = this.$element
  26652. var o = this.options
  26653. title = $e.attr('data-original-title')
  26654. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  26655. return title
  26656. }
  26657. Tooltip.prototype.getUID = function (prefix) {
  26658. do prefix += ~~(Math.random() * 1000000)
  26659. while (document.getElementById(prefix))
  26660. return prefix
  26661. }
  26662. Tooltip.prototype.tip = function () {
  26663. if (!this.$tip) {
  26664. this.$tip = $(this.options.template)
  26665. if (this.$tip.length != 1) {
  26666. throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
  26667. }
  26668. }
  26669. return this.$tip
  26670. }
  26671. Tooltip.prototype.arrow = function () {
  26672. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  26673. }
  26674. Tooltip.prototype.enable = function () {
  26675. this.enabled = true
  26676. }
  26677. Tooltip.prototype.disable = function () {
  26678. this.enabled = false
  26679. }
  26680. Tooltip.prototype.toggleEnabled = function () {
  26681. this.enabled = !this.enabled
  26682. }
  26683. Tooltip.prototype.toggle = function (e) {
  26684. var self = this
  26685. if (e) {
  26686. self = $(e.currentTarget).data('bs.' + this.type)
  26687. if (!self) {
  26688. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  26689. $(e.currentTarget).data('bs.' + this.type, self)
  26690. }
  26691. }
  26692. if (e) {
  26693. self.inState.click = !self.inState.click
  26694. if (self.isInStateTrue()) self.enter(self)
  26695. else self.leave(self)
  26696. } else {
  26697. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  26698. }
  26699. }
  26700. Tooltip.prototype.destroy = function () {
  26701. var that = this
  26702. clearTimeout(this.timeout)
  26703. this.hide(function () {
  26704. that.$element.off('.' + that.type).removeData('bs.' + that.type)
  26705. if (that.$tip) {
  26706. that.$tip.detach()
  26707. }
  26708. that.$tip = null
  26709. that.$arrow = null
  26710. that.$viewport = null
  26711. that.$element = null
  26712. })
  26713. }
  26714. // TOOLTIP PLUGIN DEFINITION
  26715. // =========================
  26716. function Plugin(option) {
  26717. return this.each(function () {
  26718. var $this = $(this)
  26719. var data = $this.data('bs.tooltip')
  26720. var options = typeof option == 'object' && option
  26721. if (!data && /destroy|hide/.test(option)) return
  26722. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  26723. if (typeof option == 'string') data[option]()
  26724. })
  26725. }
  26726. var old = $.fn.tooltip
  26727. $.fn.tooltip = Plugin
  26728. $.fn.tooltip.Constructor = Tooltip
  26729. // TOOLTIP NO CONFLICT
  26730. // ===================
  26731. $.fn.tooltip.noConflict = function () {
  26732. $.fn.tooltip = old
  26733. return this
  26734. }
  26735. }(jQuery);
  26736. /* ========================================================================
  26737. * Bootstrap: popover.js v3.3.7
  26738. * http://getbootstrap.com/javascript/#popovers
  26739. * ========================================================================
  26740. * Copyright 2011-2016 Twitter, Inc.
  26741. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26742. * ======================================================================== */
  26743. +function ($) {
  26744. 'use strict';
  26745. // POPOVER PUBLIC CLASS DEFINITION
  26746. // ===============================
  26747. var Popover = function (element, options) {
  26748. this.init('popover', element, options)
  26749. }
  26750. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  26751. Popover.VERSION = '3.3.7'
  26752. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  26753. placement: 'right',
  26754. trigger: 'click',
  26755. content: '',
  26756. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  26757. })
  26758. // NOTE: POPOVER EXTENDS tooltip.js
  26759. // ================================
  26760. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  26761. Popover.prototype.constructor = Popover
  26762. Popover.prototype.getDefaults = function () {
  26763. return Popover.DEFAULTS
  26764. }
  26765. Popover.prototype.setContent = function () {
  26766. var $tip = this.tip()
  26767. var title = this.getTitle()
  26768. var content = this.getContent()
  26769. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  26770. $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
  26771. this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
  26772. ](content)
  26773. $tip.removeClass('fade top bottom left right in')
  26774. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  26775. // this manually by checking the contents.
  26776. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  26777. }
  26778. Popover.prototype.hasContent = function () {
  26779. return this.getTitle() || this.getContent()
  26780. }
  26781. Popover.prototype.getContent = function () {
  26782. var $e = this.$element
  26783. var o = this.options
  26784. return $e.attr('data-content')
  26785. || (typeof o.content == 'function' ?
  26786. o.content.call($e[0]) :
  26787. o.content)
  26788. }
  26789. Popover.prototype.arrow = function () {
  26790. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  26791. }
  26792. // POPOVER PLUGIN DEFINITION
  26793. // =========================
  26794. function Plugin(option) {
  26795. return this.each(function () {
  26796. var $this = $(this)
  26797. var data = $this.data('bs.popover')
  26798. var options = typeof option == 'object' && option
  26799. if (!data && /destroy|hide/.test(option)) return
  26800. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  26801. if (typeof option == 'string') data[option]()
  26802. })
  26803. }
  26804. var old = $.fn.popover
  26805. $.fn.popover = Plugin
  26806. $.fn.popover.Constructor = Popover
  26807. // POPOVER NO CONFLICT
  26808. // ===================
  26809. $.fn.popover.noConflict = function () {
  26810. $.fn.popover = old
  26811. return this
  26812. }
  26813. }(jQuery);
  26814. /* ========================================================================
  26815. * Bootstrap: scrollspy.js v3.3.7
  26816. * http://getbootstrap.com/javascript/#scrollspy
  26817. * ========================================================================
  26818. * Copyright 2011-2016 Twitter, Inc.
  26819. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26820. * ======================================================================== */
  26821. +function ($) {
  26822. 'use strict';
  26823. // SCROLLSPY CLASS DEFINITION
  26824. // ==========================
  26825. function ScrollSpy(element, options) {
  26826. this.$body = $(document.body)
  26827. this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
  26828. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  26829. this.selector = (this.options.target || '') + ' .nav li > a'
  26830. this.offsets = []
  26831. this.targets = []
  26832. this.activeTarget = null
  26833. this.scrollHeight = 0
  26834. this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
  26835. this.refresh()
  26836. this.process()
  26837. }
  26838. ScrollSpy.VERSION = '3.3.7'
  26839. ScrollSpy.DEFAULTS = {
  26840. offset: 10
  26841. }
  26842. ScrollSpy.prototype.getScrollHeight = function () {
  26843. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  26844. }
  26845. ScrollSpy.prototype.refresh = function () {
  26846. var that = this
  26847. var offsetMethod = 'offset'
  26848. var offsetBase = 0
  26849. this.offsets = []
  26850. this.targets = []
  26851. this.scrollHeight = this.getScrollHeight()
  26852. if (!$.isWindow(this.$scrollElement[0])) {
  26853. offsetMethod = 'position'
  26854. offsetBase = this.$scrollElement.scrollTop()
  26855. }
  26856. this.$body
  26857. .find(this.selector)
  26858. .map(function () {
  26859. var $el = $(this)
  26860. var href = $el.data('target') || $el.attr('href')
  26861. var $href = /^#./.test(href) && $(href)
  26862. return ($href
  26863. && $href.length
  26864. && $href.is(':visible')
  26865. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  26866. })
  26867. .sort(function (a, b) { return a[0] - b[0] })
  26868. .each(function () {
  26869. that.offsets.push(this[0])
  26870. that.targets.push(this[1])
  26871. })
  26872. }
  26873. ScrollSpy.prototype.process = function () {
  26874. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  26875. var scrollHeight = this.getScrollHeight()
  26876. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  26877. var offsets = this.offsets
  26878. var targets = this.targets
  26879. var activeTarget = this.activeTarget
  26880. var i
  26881. if (this.scrollHeight != scrollHeight) {
  26882. this.refresh()
  26883. }
  26884. if (scrollTop >= maxScroll) {
  26885. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  26886. }
  26887. if (activeTarget && scrollTop < offsets[0]) {
  26888. this.activeTarget = null
  26889. return this.clear()
  26890. }
  26891. for (i = offsets.length; i--;) {
  26892. activeTarget != targets[i]
  26893. && scrollTop >= offsets[i]
  26894. && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
  26895. && this.activate(targets[i])
  26896. }
  26897. }
  26898. ScrollSpy.prototype.activate = function (target) {
  26899. this.activeTarget = target
  26900. this.clear()
  26901. var selector = this.selector +
  26902. '[data-target="' + target + '"],' +
  26903. this.selector + '[href="' + target + '"]'
  26904. var active = $(selector)
  26905. .parents('li')
  26906. .addClass('active')
  26907. if (active.parent('.dropdown-menu').length) {
  26908. active = active
  26909. .closest('li.dropdown')
  26910. .addClass('active')
  26911. }
  26912. active.trigger('activate.bs.scrollspy')
  26913. }
  26914. ScrollSpy.prototype.clear = function () {
  26915. $(this.selector)
  26916. .parentsUntil(this.options.target, '.active')
  26917. .removeClass('active')
  26918. }
  26919. // SCROLLSPY PLUGIN DEFINITION
  26920. // ===========================
  26921. function Plugin(option) {
  26922. return this.each(function () {
  26923. var $this = $(this)
  26924. var data = $this.data('bs.scrollspy')
  26925. var options = typeof option == 'object' && option
  26926. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  26927. if (typeof option == 'string') data[option]()
  26928. })
  26929. }
  26930. var old = $.fn.scrollspy
  26931. $.fn.scrollspy = Plugin
  26932. $.fn.scrollspy.Constructor = ScrollSpy
  26933. // SCROLLSPY NO CONFLICT
  26934. // =====================
  26935. $.fn.scrollspy.noConflict = function () {
  26936. $.fn.scrollspy = old
  26937. return this
  26938. }
  26939. // SCROLLSPY DATA-API
  26940. // ==================
  26941. $(window).on('load.bs.scrollspy.data-api', function () {
  26942. $('[data-spy="scroll"]').each(function () {
  26943. var $spy = $(this)
  26944. Plugin.call($spy, $spy.data())
  26945. })
  26946. })
  26947. }(jQuery);
  26948. /* ========================================================================
  26949. * Bootstrap: tab.js v3.3.7
  26950. * http://getbootstrap.com/javascript/#tabs
  26951. * ========================================================================
  26952. * Copyright 2011-2016 Twitter, Inc.
  26953. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26954. * ======================================================================== */
  26955. +function ($) {
  26956. 'use strict';
  26957. // TAB CLASS DEFINITION
  26958. // ====================
  26959. var Tab = function (element) {
  26960. // jscs:disable requireDollarBeforejQueryAssignment
  26961. this.element = $(element)
  26962. // jscs:enable requireDollarBeforejQueryAssignment
  26963. }
  26964. Tab.VERSION = '3.3.7'
  26965. Tab.TRANSITION_DURATION = 150
  26966. Tab.prototype.show = function () {
  26967. var $this = this.element
  26968. var $ul = $this.closest('ul:not(.dropdown-menu)')
  26969. var selector = $this.data('target')
  26970. if (!selector) {
  26971. selector = $this.attr('href')
  26972. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  26973. }
  26974. if ($this.parent('li').hasClass('active')) return
  26975. var $previous = $ul.find('.active:last a')
  26976. var hideEvent = $.Event('hide.bs.tab', {
  26977. relatedTarget: $this[0]
  26978. })
  26979. var showEvent = $.Event('show.bs.tab', {
  26980. relatedTarget: $previous[0]
  26981. })
  26982. $previous.trigger(hideEvent)
  26983. $this.trigger(showEvent)
  26984. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
  26985. var $target = $(selector)
  26986. this.activate($this.closest('li'), $ul)
  26987. this.activate($target, $target.parent(), function () {
  26988. $previous.trigger({
  26989. type: 'hidden.bs.tab',
  26990. relatedTarget: $this[0]
  26991. })
  26992. $this.trigger({
  26993. type: 'shown.bs.tab',
  26994. relatedTarget: $previous[0]
  26995. })
  26996. })
  26997. }
  26998. Tab.prototype.activate = function (element, container, callback) {
  26999. var $active = container.find('> .active')
  27000. var transition = callback
  27001. && $.support.transition
  27002. && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
  27003. function next() {
  27004. $active
  27005. .removeClass('active')
  27006. .find('> .dropdown-menu > .active')
  27007. .removeClass('active')
  27008. .end()
  27009. .find('[data-toggle="tab"]')
  27010. .attr('aria-expanded', false)
  27011. element
  27012. .addClass('active')
  27013. .find('[data-toggle="tab"]')
  27014. .attr('aria-expanded', true)
  27015. if (transition) {
  27016. element[0].offsetWidth // reflow for transition
  27017. element.addClass('in')
  27018. } else {
  27019. element.removeClass('fade')
  27020. }
  27021. if (element.parent('.dropdown-menu').length) {
  27022. element
  27023. .closest('li.dropdown')
  27024. .addClass('active')
  27025. .end()
  27026. .find('[data-toggle="tab"]')
  27027. .attr('aria-expanded', true)
  27028. }
  27029. callback && callback()
  27030. }
  27031. $active.length && transition ?
  27032. $active
  27033. .one('bsTransitionEnd', next)
  27034. .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
  27035. next()
  27036. $active.removeClass('in')
  27037. }
  27038. // TAB PLUGIN DEFINITION
  27039. // =====================
  27040. function Plugin(option) {
  27041. return this.each(function () {
  27042. var $this = $(this)
  27043. var data = $this.data('bs.tab')
  27044. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  27045. if (typeof option == 'string') data[option]()
  27046. })
  27047. }
  27048. var old = $.fn.tab
  27049. $.fn.tab = Plugin
  27050. $.fn.tab.Constructor = Tab
  27051. // TAB NO CONFLICT
  27052. // ===============
  27053. $.fn.tab.noConflict = function () {
  27054. $.fn.tab = old
  27055. return this
  27056. }
  27057. // TAB DATA-API
  27058. // ============
  27059. var clickHandler = function (e) {
  27060. e.preventDefault()
  27061. Plugin.call($(this), 'show')
  27062. }
  27063. $(document)
  27064. .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
  27065. .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
  27066. }(jQuery);
  27067. /* ========================================================================
  27068. * Bootstrap: affix.js v3.3.7
  27069. * http://getbootstrap.com/javascript/#affix
  27070. * ========================================================================
  27071. * Copyright 2011-2016 Twitter, Inc.
  27072. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27073. * ======================================================================== */
  27074. +function ($) {
  27075. 'use strict';
  27076. // AFFIX CLASS DEFINITION
  27077. // ======================
  27078. var Affix = function (element, options) {
  27079. this.options = $.extend({}, Affix.DEFAULTS, options)
  27080. this.$target = $(this.options.target)
  27081. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  27082. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  27083. this.$element = $(element)
  27084. this.affixed = null
  27085. this.unpin = null
  27086. this.pinnedOffset = null
  27087. this.checkPosition()
  27088. }
  27089. Affix.VERSION = '3.3.7'
  27090. Affix.RESET = 'affix affix-top affix-bottom'
  27091. Affix.DEFAULTS = {
  27092. offset: 0,
  27093. target: window
  27094. }
  27095. Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  27096. var scrollTop = this.$target.scrollTop()
  27097. var position = this.$element.offset()
  27098. var targetHeight = this.$target.height()
  27099. if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  27100. if (this.affixed == 'bottom') {
  27101. if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  27102. return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  27103. }
  27104. var initializing = this.affixed == null
  27105. var colliderTop = initializing ? scrollTop : position.top
  27106. var colliderHeight = initializing ? targetHeight : height
  27107. if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  27108. if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  27109. return false
  27110. }
  27111. Affix.prototype.getPinnedOffset = function () {
  27112. if (this.pinnedOffset) return this.pinnedOffset
  27113. this.$element.removeClass(Affix.RESET).addClass('affix')
  27114. var scrollTop = this.$target.scrollTop()
  27115. var position = this.$element.offset()
  27116. return (this.pinnedOffset = position.top - scrollTop)
  27117. }
  27118. Affix.prototype.checkPositionWithEventLoop = function () {
  27119. setTimeout($.proxy(this.checkPosition, this), 1)
  27120. }
  27121. Affix.prototype.checkPosition = function () {
  27122. if (!this.$element.is(':visible')) return
  27123. var height = this.$element.height()
  27124. var offset = this.options.offset
  27125. var offsetTop = offset.top
  27126. var offsetBottom = offset.bottom
  27127. var scrollHeight = Math.max($(document).height(), $(document.body).height())
  27128. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  27129. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  27130. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  27131. var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  27132. if (this.affixed != affix) {
  27133. if (this.unpin != null) this.$element.css('top', '')
  27134. var affixType = 'affix' + (affix ? '-' + affix : '')
  27135. var e = $.Event(affixType + '.bs.affix')
  27136. this.$element.trigger(e)
  27137. if (e.isDefaultPrevented()) return
  27138. this.affixed = affix
  27139. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  27140. this.$element
  27141. .removeClass(Affix.RESET)
  27142. .addClass(affixType)
  27143. .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  27144. }
  27145. if (affix == 'bottom') {
  27146. this.$element.offset({
  27147. top: scrollHeight - height - offsetBottom
  27148. })
  27149. }
  27150. }
  27151. // AFFIX PLUGIN DEFINITION
  27152. // =======================
  27153. function Plugin(option) {
  27154. return this.each(function () {
  27155. var $this = $(this)
  27156. var data = $this.data('bs.affix')
  27157. var options = typeof option == 'object' && option
  27158. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  27159. if (typeof option == 'string') data[option]()
  27160. })
  27161. }
  27162. var old = $.fn.affix
  27163. $.fn.affix = Plugin
  27164. $.fn.affix.Constructor = Affix
  27165. // AFFIX NO CONFLICT
  27166. // =================
  27167. $.fn.affix.noConflict = function () {
  27168. $.fn.affix = old
  27169. return this
  27170. }
  27171. // AFFIX DATA-API
  27172. // ==============
  27173. $(window).on('load', function () {
  27174. $('[data-spy="affix"]').each(function () {
  27175. var $spy = $(this)
  27176. var data = $spy.data()
  27177. data.offset = data.offset || {}
  27178. if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  27179. if (data.offsetTop != null) data.offset.top = data.offsetTop
  27180. Plugin.call($spy, data)
  27181. })
  27182. })
  27183. }(jQuery);
  27184. /***/ }),
  27185. /* 16 */
  27186. /***/ (function(module, exports, __webpack_require__) {
  27187. "use strict";
  27188. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  27189. * Vue.js v2.5.13
  27190. * (c) 2014-2017 Evan You
  27191. * Released under the MIT License.
  27192. */
  27193. /* */
  27194. var emptyObject = Object.freeze({});
  27195. // these helpers produces better vm code in JS engines due to their
  27196. // explicitness and function inlining
  27197. function isUndef (v) {
  27198. return v === undefined || v === null
  27199. }
  27200. function isDef (v) {
  27201. return v !== undefined && v !== null
  27202. }
  27203. function isTrue (v) {
  27204. return v === true
  27205. }
  27206. function isFalse (v) {
  27207. return v === false
  27208. }
  27209. /**
  27210. * Check if value is primitive
  27211. */
  27212. function isPrimitive (value) {
  27213. return (
  27214. typeof value === 'string' ||
  27215. typeof value === 'number' ||
  27216. // $flow-disable-line
  27217. typeof value === 'symbol' ||
  27218. typeof value === 'boolean'
  27219. )
  27220. }
  27221. /**
  27222. * Quick object check - this is primarily used to tell
  27223. * Objects from primitive values when we know the value
  27224. * is a JSON-compliant type.
  27225. */
  27226. function isObject (obj) {
  27227. return obj !== null && typeof obj === 'object'
  27228. }
  27229. /**
  27230. * Get the raw type string of a value e.g. [object Object]
  27231. */
  27232. var _toString = Object.prototype.toString;
  27233. function toRawType (value) {
  27234. return _toString.call(value).slice(8, -1)
  27235. }
  27236. /**
  27237. * Strict object type check. Only returns true
  27238. * for plain JavaScript objects.
  27239. */
  27240. function isPlainObject (obj) {
  27241. return _toString.call(obj) === '[object Object]'
  27242. }
  27243. function isRegExp (v) {
  27244. return _toString.call(v) === '[object RegExp]'
  27245. }
  27246. /**
  27247. * Check if val is a valid array index.
  27248. */
  27249. function isValidArrayIndex (val) {
  27250. var n = parseFloat(String(val));
  27251. return n >= 0 && Math.floor(n) === n && isFinite(val)
  27252. }
  27253. /**
  27254. * Convert a value to a string that is actually rendered.
  27255. */
  27256. function toString (val) {
  27257. return val == null
  27258. ? ''
  27259. : typeof val === 'object'
  27260. ? JSON.stringify(val, null, 2)
  27261. : String(val)
  27262. }
  27263. /**
  27264. * Convert a input value to a number for persistence.
  27265. * If the conversion fails, return original string.
  27266. */
  27267. function toNumber (val) {
  27268. var n = parseFloat(val);
  27269. return isNaN(n) ? val : n
  27270. }
  27271. /**
  27272. * Make a map and return a function for checking if a key
  27273. * is in that map.
  27274. */
  27275. function makeMap (
  27276. str,
  27277. expectsLowerCase
  27278. ) {
  27279. var map = Object.create(null);
  27280. var list = str.split(',');
  27281. for (var i = 0; i < list.length; i++) {
  27282. map[list[i]] = true;
  27283. }
  27284. return expectsLowerCase
  27285. ? function (val) { return map[val.toLowerCase()]; }
  27286. : function (val) { return map[val]; }
  27287. }
  27288. /**
  27289. * Check if a tag is a built-in tag.
  27290. */
  27291. var isBuiltInTag = makeMap('slot,component', true);
  27292. /**
  27293. * Check if a attribute is a reserved attribute.
  27294. */
  27295. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  27296. /**
  27297. * Remove an item from an array
  27298. */
  27299. function remove (arr, item) {
  27300. if (arr.length) {
  27301. var index = arr.indexOf(item);
  27302. if (index > -1) {
  27303. return arr.splice(index, 1)
  27304. }
  27305. }
  27306. }
  27307. /**
  27308. * Check whether the object has the property.
  27309. */
  27310. var hasOwnProperty = Object.prototype.hasOwnProperty;
  27311. function hasOwn (obj, key) {
  27312. return hasOwnProperty.call(obj, key)
  27313. }
  27314. /**
  27315. * Create a cached version of a pure function.
  27316. */
  27317. function cached (fn) {
  27318. var cache = Object.create(null);
  27319. return (function cachedFn (str) {
  27320. var hit = cache[str];
  27321. return hit || (cache[str] = fn(str))
  27322. })
  27323. }
  27324. /**
  27325. * Camelize a hyphen-delimited string.
  27326. */
  27327. var camelizeRE = /-(\w)/g;
  27328. var camelize = cached(function (str) {
  27329. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  27330. });
  27331. /**
  27332. * Capitalize a string.
  27333. */
  27334. var capitalize = cached(function (str) {
  27335. return str.charAt(0).toUpperCase() + str.slice(1)
  27336. });
  27337. /**
  27338. * Hyphenate a camelCase string.
  27339. */
  27340. var hyphenateRE = /\B([A-Z])/g;
  27341. var hyphenate = cached(function (str) {
  27342. return str.replace(hyphenateRE, '-$1').toLowerCase()
  27343. });
  27344. /**
  27345. * Simple bind, faster than native
  27346. */
  27347. function bind (fn, ctx) {
  27348. function boundFn (a) {
  27349. var l = arguments.length;
  27350. return l
  27351. ? l > 1
  27352. ? fn.apply(ctx, arguments)
  27353. : fn.call(ctx, a)
  27354. : fn.call(ctx)
  27355. }
  27356. // record original fn length
  27357. boundFn._length = fn.length;
  27358. return boundFn
  27359. }
  27360. /**
  27361. * Convert an Array-like object to a real Array.
  27362. */
  27363. function toArray (list, start) {
  27364. start = start || 0;
  27365. var i = list.length - start;
  27366. var ret = new Array(i);
  27367. while (i--) {
  27368. ret[i] = list[i + start];
  27369. }
  27370. return ret
  27371. }
  27372. /**
  27373. * Mix properties into target object.
  27374. */
  27375. function extend (to, _from) {
  27376. for (var key in _from) {
  27377. to[key] = _from[key];
  27378. }
  27379. return to
  27380. }
  27381. /**
  27382. * Merge an Array of Objects into a single Object.
  27383. */
  27384. function toObject (arr) {
  27385. var res = {};
  27386. for (var i = 0; i < arr.length; i++) {
  27387. if (arr[i]) {
  27388. extend(res, arr[i]);
  27389. }
  27390. }
  27391. return res
  27392. }
  27393. /**
  27394. * Perform no operation.
  27395. * Stubbing args to make Flow happy without leaving useless transpiled code
  27396. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  27397. */
  27398. function noop (a, b, c) {}
  27399. /**
  27400. * Always return false.
  27401. */
  27402. var no = function (a, b, c) { return false; };
  27403. /**
  27404. * Return same value
  27405. */
  27406. var identity = function (_) { return _; };
  27407. /**
  27408. * Generate a static keys string from compiler modules.
  27409. */
  27410. function genStaticKeys (modules) {
  27411. return modules.reduce(function (keys, m) {
  27412. return keys.concat(m.staticKeys || [])
  27413. }, []).join(',')
  27414. }
  27415. /**
  27416. * Check if two values are loosely equal - that is,
  27417. * if they are plain objects, do they have the same shape?
  27418. */
  27419. function looseEqual (a, b) {
  27420. if (a === b) { return true }
  27421. var isObjectA = isObject(a);
  27422. var isObjectB = isObject(b);
  27423. if (isObjectA && isObjectB) {
  27424. try {
  27425. var isArrayA = Array.isArray(a);
  27426. var isArrayB = Array.isArray(b);
  27427. if (isArrayA && isArrayB) {
  27428. return a.length === b.length && a.every(function (e, i) {
  27429. return looseEqual(e, b[i])
  27430. })
  27431. } else if (!isArrayA && !isArrayB) {
  27432. var keysA = Object.keys(a);
  27433. var keysB = Object.keys(b);
  27434. return keysA.length === keysB.length && keysA.every(function (key) {
  27435. return looseEqual(a[key], b[key])
  27436. })
  27437. } else {
  27438. /* istanbul ignore next */
  27439. return false
  27440. }
  27441. } catch (e) {
  27442. /* istanbul ignore next */
  27443. return false
  27444. }
  27445. } else if (!isObjectA && !isObjectB) {
  27446. return String(a) === String(b)
  27447. } else {
  27448. return false
  27449. }
  27450. }
  27451. function looseIndexOf (arr, val) {
  27452. for (var i = 0; i < arr.length; i++) {
  27453. if (looseEqual(arr[i], val)) { return i }
  27454. }
  27455. return -1
  27456. }
  27457. /**
  27458. * Ensure a function is called only once.
  27459. */
  27460. function once (fn) {
  27461. var called = false;
  27462. return function () {
  27463. if (!called) {
  27464. called = true;
  27465. fn.apply(this, arguments);
  27466. }
  27467. }
  27468. }
  27469. var SSR_ATTR = 'data-server-rendered';
  27470. var ASSET_TYPES = [
  27471. 'component',
  27472. 'directive',
  27473. 'filter'
  27474. ];
  27475. var LIFECYCLE_HOOKS = [
  27476. 'beforeCreate',
  27477. 'created',
  27478. 'beforeMount',
  27479. 'mounted',
  27480. 'beforeUpdate',
  27481. 'updated',
  27482. 'beforeDestroy',
  27483. 'destroyed',
  27484. 'activated',
  27485. 'deactivated',
  27486. 'errorCaptured'
  27487. ];
  27488. /* */
  27489. var config = ({
  27490. /**
  27491. * Option merge strategies (used in core/util/options)
  27492. */
  27493. // $flow-disable-line
  27494. optionMergeStrategies: Object.create(null),
  27495. /**
  27496. * Whether to suppress warnings.
  27497. */
  27498. silent: false,
  27499. /**
  27500. * Show production mode tip message on boot?
  27501. */
  27502. productionTip: "development" !== 'production',
  27503. /**
  27504. * Whether to enable devtools
  27505. */
  27506. devtools: "development" !== 'production',
  27507. /**
  27508. * Whether to record perf
  27509. */
  27510. performance: false,
  27511. /**
  27512. * Error handler for watcher errors
  27513. */
  27514. errorHandler: null,
  27515. /**
  27516. * Warn handler for watcher warns
  27517. */
  27518. warnHandler: null,
  27519. /**
  27520. * Ignore certain custom elements
  27521. */
  27522. ignoredElements: [],
  27523. /**
  27524. * Custom user key aliases for v-on
  27525. */
  27526. // $flow-disable-line
  27527. keyCodes: Object.create(null),
  27528. /**
  27529. * Check if a tag is reserved so that it cannot be registered as a
  27530. * component. This is platform-dependent and may be overwritten.
  27531. */
  27532. isReservedTag: no,
  27533. /**
  27534. * Check if an attribute is reserved so that it cannot be used as a component
  27535. * prop. This is platform-dependent and may be overwritten.
  27536. */
  27537. isReservedAttr: no,
  27538. /**
  27539. * Check if a tag is an unknown element.
  27540. * Platform-dependent.
  27541. */
  27542. isUnknownElement: no,
  27543. /**
  27544. * Get the namespace of an element
  27545. */
  27546. getTagNamespace: noop,
  27547. /**
  27548. * Parse the real tag name for the specific platform.
  27549. */
  27550. parsePlatformTagName: identity,
  27551. /**
  27552. * Check if an attribute must be bound using property, e.g. value
  27553. * Platform-dependent.
  27554. */
  27555. mustUseProp: no,
  27556. /**
  27557. * Exposed for legacy reasons
  27558. */
  27559. _lifecycleHooks: LIFECYCLE_HOOKS
  27560. });
  27561. /* */
  27562. /**
  27563. * Check if a string starts with $ or _
  27564. */
  27565. function isReserved (str) {
  27566. var c = (str + '').charCodeAt(0);
  27567. return c === 0x24 || c === 0x5F
  27568. }
  27569. /**
  27570. * Define a property.
  27571. */
  27572. function def (obj, key, val, enumerable) {
  27573. Object.defineProperty(obj, key, {
  27574. value: val,
  27575. enumerable: !!enumerable,
  27576. writable: true,
  27577. configurable: true
  27578. });
  27579. }
  27580. /**
  27581. * Parse simple path.
  27582. */
  27583. var bailRE = /[^\w.$]/;
  27584. function parsePath (path) {
  27585. if (bailRE.test(path)) {
  27586. return
  27587. }
  27588. var segments = path.split('.');
  27589. return function (obj) {
  27590. for (var i = 0; i < segments.length; i++) {
  27591. if (!obj) { return }
  27592. obj = obj[segments[i]];
  27593. }
  27594. return obj
  27595. }
  27596. }
  27597. /* */
  27598. // can we use __proto__?
  27599. var hasProto = '__proto__' in {};
  27600. // Browser environment sniffing
  27601. var inBrowser = typeof window !== 'undefined';
  27602. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  27603. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  27604. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  27605. var isIE = UA && /msie|trident/.test(UA);
  27606. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  27607. var isEdge = UA && UA.indexOf('edge/') > 0;
  27608. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  27609. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  27610. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  27611. // Firefox has a "watch" function on Object.prototype...
  27612. var nativeWatch = ({}).watch;
  27613. var supportsPassive = false;
  27614. if (inBrowser) {
  27615. try {
  27616. var opts = {};
  27617. Object.defineProperty(opts, 'passive', ({
  27618. get: function get () {
  27619. /* istanbul ignore next */
  27620. supportsPassive = true;
  27621. }
  27622. })); // https://github.com/facebook/flow/issues/285
  27623. window.addEventListener('test-passive', null, opts);
  27624. } catch (e) {}
  27625. }
  27626. // this needs to be lazy-evaled because vue may be required before
  27627. // vue-server-renderer can set VUE_ENV
  27628. var _isServer;
  27629. var isServerRendering = function () {
  27630. if (_isServer === undefined) {
  27631. /* istanbul ignore if */
  27632. if (!inBrowser && typeof global !== 'undefined') {
  27633. // detect presence of vue-server-renderer and avoid
  27634. // Webpack shimming the process
  27635. _isServer = global['process'].env.VUE_ENV === 'server';
  27636. } else {
  27637. _isServer = false;
  27638. }
  27639. }
  27640. return _isServer
  27641. };
  27642. // detect devtools
  27643. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  27644. /* istanbul ignore next */
  27645. function isNative (Ctor) {
  27646. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  27647. }
  27648. var hasSymbol =
  27649. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  27650. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  27651. var _Set;
  27652. /* istanbul ignore if */ // $flow-disable-line
  27653. if (typeof Set !== 'undefined' && isNative(Set)) {
  27654. // use native Set when available.
  27655. _Set = Set;
  27656. } else {
  27657. // a non-standard Set polyfill that only works with primitive keys.
  27658. _Set = (function () {
  27659. function Set () {
  27660. this.set = Object.create(null);
  27661. }
  27662. Set.prototype.has = function has (key) {
  27663. return this.set[key] === true
  27664. };
  27665. Set.prototype.add = function add (key) {
  27666. this.set[key] = true;
  27667. };
  27668. Set.prototype.clear = function clear () {
  27669. this.set = Object.create(null);
  27670. };
  27671. return Set;
  27672. }());
  27673. }
  27674. /* */
  27675. var warn = noop;
  27676. var tip = noop;
  27677. var generateComponentTrace = (noop); // work around flow check
  27678. var formatComponentName = (noop);
  27679. if (true) {
  27680. var hasConsole = typeof console !== 'undefined';
  27681. var classifyRE = /(?:^|[-_])(\w)/g;
  27682. var classify = function (str) { return str
  27683. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  27684. .replace(/[-_]/g, ''); };
  27685. warn = function (msg, vm) {
  27686. var trace = vm ? generateComponentTrace(vm) : '';
  27687. if (config.warnHandler) {
  27688. config.warnHandler.call(null, msg, vm, trace);
  27689. } else if (hasConsole && (!config.silent)) {
  27690. console.error(("[Vue warn]: " + msg + trace));
  27691. }
  27692. };
  27693. tip = function (msg, vm) {
  27694. if (hasConsole && (!config.silent)) {
  27695. console.warn("[Vue tip]: " + msg + (
  27696. vm ? generateComponentTrace(vm) : ''
  27697. ));
  27698. }
  27699. };
  27700. formatComponentName = function (vm, includeFile) {
  27701. if (vm.$root === vm) {
  27702. return '<Root>'
  27703. }
  27704. var options = typeof vm === 'function' && vm.cid != null
  27705. ? vm.options
  27706. : vm._isVue
  27707. ? vm.$options || vm.constructor.options
  27708. : vm || {};
  27709. var name = options.name || options._componentTag;
  27710. var file = options.__file;
  27711. if (!name && file) {
  27712. var match = file.match(/([^/\\]+)\.vue$/);
  27713. name = match && match[1];
  27714. }
  27715. return (
  27716. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  27717. (file && includeFile !== false ? (" at " + file) : '')
  27718. )
  27719. };
  27720. var repeat = function (str, n) {
  27721. var res = '';
  27722. while (n) {
  27723. if (n % 2 === 1) { res += str; }
  27724. if (n > 1) { str += str; }
  27725. n >>= 1;
  27726. }
  27727. return res
  27728. };
  27729. generateComponentTrace = function (vm) {
  27730. if (vm._isVue && vm.$parent) {
  27731. var tree = [];
  27732. var currentRecursiveSequence = 0;
  27733. while (vm) {
  27734. if (tree.length > 0) {
  27735. var last = tree[tree.length - 1];
  27736. if (last.constructor === vm.constructor) {
  27737. currentRecursiveSequence++;
  27738. vm = vm.$parent;
  27739. continue
  27740. } else if (currentRecursiveSequence > 0) {
  27741. tree[tree.length - 1] = [last, currentRecursiveSequence];
  27742. currentRecursiveSequence = 0;
  27743. }
  27744. }
  27745. tree.push(vm);
  27746. vm = vm.$parent;
  27747. }
  27748. return '\n\nfound in\n\n' + tree
  27749. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  27750. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  27751. : formatComponentName(vm))); })
  27752. .join('\n')
  27753. } else {
  27754. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  27755. }
  27756. };
  27757. }
  27758. /* */
  27759. var uid = 0;
  27760. /**
  27761. * A dep is an observable that can have multiple
  27762. * directives subscribing to it.
  27763. */
  27764. var Dep = function Dep () {
  27765. this.id = uid++;
  27766. this.subs = [];
  27767. };
  27768. Dep.prototype.addSub = function addSub (sub) {
  27769. this.subs.push(sub);
  27770. };
  27771. Dep.prototype.removeSub = function removeSub (sub) {
  27772. remove(this.subs, sub);
  27773. };
  27774. Dep.prototype.depend = function depend () {
  27775. if (Dep.target) {
  27776. Dep.target.addDep(this);
  27777. }
  27778. };
  27779. Dep.prototype.notify = function notify () {
  27780. // stabilize the subscriber list first
  27781. var subs = this.subs.slice();
  27782. for (var i = 0, l = subs.length; i < l; i++) {
  27783. subs[i].update();
  27784. }
  27785. };
  27786. // the current target watcher being evaluated.
  27787. // this is globally unique because there could be only one
  27788. // watcher being evaluated at any time.
  27789. Dep.target = null;
  27790. var targetStack = [];
  27791. function pushTarget (_target) {
  27792. if (Dep.target) { targetStack.push(Dep.target); }
  27793. Dep.target = _target;
  27794. }
  27795. function popTarget () {
  27796. Dep.target = targetStack.pop();
  27797. }
  27798. /* */
  27799. var VNode = function VNode (
  27800. tag,
  27801. data,
  27802. children,
  27803. text,
  27804. elm,
  27805. context,
  27806. componentOptions,
  27807. asyncFactory
  27808. ) {
  27809. this.tag = tag;
  27810. this.data = data;
  27811. this.children = children;
  27812. this.text = text;
  27813. this.elm = elm;
  27814. this.ns = undefined;
  27815. this.context = context;
  27816. this.fnContext = undefined;
  27817. this.fnOptions = undefined;
  27818. this.fnScopeId = undefined;
  27819. this.key = data && data.key;
  27820. this.componentOptions = componentOptions;
  27821. this.componentInstance = undefined;
  27822. this.parent = undefined;
  27823. this.raw = false;
  27824. this.isStatic = false;
  27825. this.isRootInsert = true;
  27826. this.isComment = false;
  27827. this.isCloned = false;
  27828. this.isOnce = false;
  27829. this.asyncFactory = asyncFactory;
  27830. this.asyncMeta = undefined;
  27831. this.isAsyncPlaceholder = false;
  27832. };
  27833. var prototypeAccessors = { child: { configurable: true } };
  27834. // DEPRECATED: alias for componentInstance for backwards compat.
  27835. /* istanbul ignore next */
  27836. prototypeAccessors.child.get = function () {
  27837. return this.componentInstance
  27838. };
  27839. Object.defineProperties( VNode.prototype, prototypeAccessors );
  27840. var createEmptyVNode = function (text) {
  27841. if ( text === void 0 ) text = '';
  27842. var node = new VNode();
  27843. node.text = text;
  27844. node.isComment = true;
  27845. return node
  27846. };
  27847. function createTextVNode (val) {
  27848. return new VNode(undefined, undefined, undefined, String(val))
  27849. }
  27850. // optimized shallow clone
  27851. // used for static nodes and slot nodes because they may be reused across
  27852. // multiple renders, cloning them avoids errors when DOM manipulations rely
  27853. // on their elm reference.
  27854. function cloneVNode (vnode, deep) {
  27855. var componentOptions = vnode.componentOptions;
  27856. var cloned = new VNode(
  27857. vnode.tag,
  27858. vnode.data,
  27859. vnode.children,
  27860. vnode.text,
  27861. vnode.elm,
  27862. vnode.context,
  27863. componentOptions,
  27864. vnode.asyncFactory
  27865. );
  27866. cloned.ns = vnode.ns;
  27867. cloned.isStatic = vnode.isStatic;
  27868. cloned.key = vnode.key;
  27869. cloned.isComment = vnode.isComment;
  27870. cloned.fnContext = vnode.fnContext;
  27871. cloned.fnOptions = vnode.fnOptions;
  27872. cloned.fnScopeId = vnode.fnScopeId;
  27873. cloned.isCloned = true;
  27874. if (deep) {
  27875. if (vnode.children) {
  27876. cloned.children = cloneVNodes(vnode.children, true);
  27877. }
  27878. if (componentOptions && componentOptions.children) {
  27879. componentOptions.children = cloneVNodes(componentOptions.children, true);
  27880. }
  27881. }
  27882. return cloned
  27883. }
  27884. function cloneVNodes (vnodes, deep) {
  27885. var len = vnodes.length;
  27886. var res = new Array(len);
  27887. for (var i = 0; i < len; i++) {
  27888. res[i] = cloneVNode(vnodes[i], deep);
  27889. }
  27890. return res
  27891. }
  27892. /*
  27893. * not type checking this file because flow doesn't play well with
  27894. * dynamically accessing methods on Array prototype
  27895. */
  27896. var arrayProto = Array.prototype;
  27897. var arrayMethods = Object.create(arrayProto);[
  27898. 'push',
  27899. 'pop',
  27900. 'shift',
  27901. 'unshift',
  27902. 'splice',
  27903. 'sort',
  27904. 'reverse'
  27905. ].forEach(function (method) {
  27906. // cache original method
  27907. var original = arrayProto[method];
  27908. def(arrayMethods, method, function mutator () {
  27909. var args = [], len = arguments.length;
  27910. while ( len-- ) args[ len ] = arguments[ len ];
  27911. var result = original.apply(this, args);
  27912. var ob = this.__ob__;
  27913. var inserted;
  27914. switch (method) {
  27915. case 'push':
  27916. case 'unshift':
  27917. inserted = args;
  27918. break
  27919. case 'splice':
  27920. inserted = args.slice(2);
  27921. break
  27922. }
  27923. if (inserted) { ob.observeArray(inserted); }
  27924. // notify change
  27925. ob.dep.notify();
  27926. return result
  27927. });
  27928. });
  27929. /* */
  27930. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  27931. /**
  27932. * By default, when a reactive property is set, the new value is
  27933. * also converted to become reactive. However when passing down props,
  27934. * we don't want to force conversion because the value may be a nested value
  27935. * under a frozen data structure. Converting it would defeat the optimization.
  27936. */
  27937. var observerState = {
  27938. shouldConvert: true
  27939. };
  27940. /**
  27941. * Observer class that are attached to each observed
  27942. * object. Once attached, the observer converts target
  27943. * object's property keys into getter/setters that
  27944. * collect dependencies and dispatches updates.
  27945. */
  27946. var Observer = function Observer (value) {
  27947. this.value = value;
  27948. this.dep = new Dep();
  27949. this.vmCount = 0;
  27950. def(value, '__ob__', this);
  27951. if (Array.isArray(value)) {
  27952. var augment = hasProto
  27953. ? protoAugment
  27954. : copyAugment;
  27955. augment(value, arrayMethods, arrayKeys);
  27956. this.observeArray(value);
  27957. } else {
  27958. this.walk(value);
  27959. }
  27960. };
  27961. /**
  27962. * Walk through each property and convert them into
  27963. * getter/setters. This method should only be called when
  27964. * value type is Object.
  27965. */
  27966. Observer.prototype.walk = function walk (obj) {
  27967. var keys = Object.keys(obj);
  27968. for (var i = 0; i < keys.length; i++) {
  27969. defineReactive(obj, keys[i], obj[keys[i]]);
  27970. }
  27971. };
  27972. /**
  27973. * Observe a list of Array items.
  27974. */
  27975. Observer.prototype.observeArray = function observeArray (items) {
  27976. for (var i = 0, l = items.length; i < l; i++) {
  27977. observe(items[i]);
  27978. }
  27979. };
  27980. // helpers
  27981. /**
  27982. * Augment an target Object or Array by intercepting
  27983. * the prototype chain using __proto__
  27984. */
  27985. function protoAugment (target, src, keys) {
  27986. /* eslint-disable no-proto */
  27987. target.__proto__ = src;
  27988. /* eslint-enable no-proto */
  27989. }
  27990. /**
  27991. * Augment an target Object or Array by defining
  27992. * hidden properties.
  27993. */
  27994. /* istanbul ignore next */
  27995. function copyAugment (target, src, keys) {
  27996. for (var i = 0, l = keys.length; i < l; i++) {
  27997. var key = keys[i];
  27998. def(target, key, src[key]);
  27999. }
  28000. }
  28001. /**
  28002. * Attempt to create an observer instance for a value,
  28003. * returns the new observer if successfully observed,
  28004. * or the existing observer if the value already has one.
  28005. */
  28006. function observe (value, asRootData) {
  28007. if (!isObject(value) || value instanceof VNode) {
  28008. return
  28009. }
  28010. var ob;
  28011. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  28012. ob = value.__ob__;
  28013. } else if (
  28014. observerState.shouldConvert &&
  28015. !isServerRendering() &&
  28016. (Array.isArray(value) || isPlainObject(value)) &&
  28017. Object.isExtensible(value) &&
  28018. !value._isVue
  28019. ) {
  28020. ob = new Observer(value);
  28021. }
  28022. if (asRootData && ob) {
  28023. ob.vmCount++;
  28024. }
  28025. return ob
  28026. }
  28027. /**
  28028. * Define a reactive property on an Object.
  28029. */
  28030. function defineReactive (
  28031. obj,
  28032. key,
  28033. val,
  28034. customSetter,
  28035. shallow
  28036. ) {
  28037. var dep = new Dep();
  28038. var property = Object.getOwnPropertyDescriptor(obj, key);
  28039. if (property && property.configurable === false) {
  28040. return
  28041. }
  28042. // cater for pre-defined getter/setters
  28043. var getter = property && property.get;
  28044. var setter = property && property.set;
  28045. var childOb = !shallow && observe(val);
  28046. Object.defineProperty(obj, key, {
  28047. enumerable: true,
  28048. configurable: true,
  28049. get: function reactiveGetter () {
  28050. var value = getter ? getter.call(obj) : val;
  28051. if (Dep.target) {
  28052. dep.depend();
  28053. if (childOb) {
  28054. childOb.dep.depend();
  28055. if (Array.isArray(value)) {
  28056. dependArray(value);
  28057. }
  28058. }
  28059. }
  28060. return value
  28061. },
  28062. set: function reactiveSetter (newVal) {
  28063. var value = getter ? getter.call(obj) : val;
  28064. /* eslint-disable no-self-compare */
  28065. if (newVal === value || (newVal !== newVal && value !== value)) {
  28066. return
  28067. }
  28068. /* eslint-enable no-self-compare */
  28069. if ("development" !== 'production' && customSetter) {
  28070. customSetter();
  28071. }
  28072. if (setter) {
  28073. setter.call(obj, newVal);
  28074. } else {
  28075. val = newVal;
  28076. }
  28077. childOb = !shallow && observe(newVal);
  28078. dep.notify();
  28079. }
  28080. });
  28081. }
  28082. /**
  28083. * Set a property on an object. Adds the new property and
  28084. * triggers change notification if the property doesn't
  28085. * already exist.
  28086. */
  28087. function set (target, key, val) {
  28088. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28089. target.length = Math.max(target.length, key);
  28090. target.splice(key, 1, val);
  28091. return val
  28092. }
  28093. if (key in target && !(key in Object.prototype)) {
  28094. target[key] = val;
  28095. return val
  28096. }
  28097. var ob = (target).__ob__;
  28098. if (target._isVue || (ob && ob.vmCount)) {
  28099. "development" !== 'production' && warn(
  28100. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  28101. 'at runtime - declare it upfront in the data option.'
  28102. );
  28103. return val
  28104. }
  28105. if (!ob) {
  28106. target[key] = val;
  28107. return val
  28108. }
  28109. defineReactive(ob.value, key, val);
  28110. ob.dep.notify();
  28111. return val
  28112. }
  28113. /**
  28114. * Delete a property and trigger change if necessary.
  28115. */
  28116. function del (target, key) {
  28117. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28118. target.splice(key, 1);
  28119. return
  28120. }
  28121. var ob = (target).__ob__;
  28122. if (target._isVue || (ob && ob.vmCount)) {
  28123. "development" !== 'production' && warn(
  28124. 'Avoid deleting properties on a Vue instance or its root $data ' +
  28125. '- just set it to null.'
  28126. );
  28127. return
  28128. }
  28129. if (!hasOwn(target, key)) {
  28130. return
  28131. }
  28132. delete target[key];
  28133. if (!ob) {
  28134. return
  28135. }
  28136. ob.dep.notify();
  28137. }
  28138. /**
  28139. * Collect dependencies on array elements when the array is touched, since
  28140. * we cannot intercept array element access like property getters.
  28141. */
  28142. function dependArray (value) {
  28143. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  28144. e = value[i];
  28145. e && e.__ob__ && e.__ob__.dep.depend();
  28146. if (Array.isArray(e)) {
  28147. dependArray(e);
  28148. }
  28149. }
  28150. }
  28151. /* */
  28152. /**
  28153. * Option overwriting strategies are functions that handle
  28154. * how to merge a parent option value and a child option
  28155. * value into the final value.
  28156. */
  28157. var strats = config.optionMergeStrategies;
  28158. /**
  28159. * Options with restrictions
  28160. */
  28161. if (true) {
  28162. strats.el = strats.propsData = function (parent, child, vm, key) {
  28163. if (!vm) {
  28164. warn(
  28165. "option \"" + key + "\" can only be used during instance " +
  28166. 'creation with the `new` keyword.'
  28167. );
  28168. }
  28169. return defaultStrat(parent, child)
  28170. };
  28171. }
  28172. /**
  28173. * Helper that recursively merges two data objects together.
  28174. */
  28175. function mergeData (to, from) {
  28176. if (!from) { return to }
  28177. var key, toVal, fromVal;
  28178. var keys = Object.keys(from);
  28179. for (var i = 0; i < keys.length; i++) {
  28180. key = keys[i];
  28181. toVal = to[key];
  28182. fromVal = from[key];
  28183. if (!hasOwn(to, key)) {
  28184. set(to, key, fromVal);
  28185. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  28186. mergeData(toVal, fromVal);
  28187. }
  28188. }
  28189. return to
  28190. }
  28191. /**
  28192. * Data
  28193. */
  28194. function mergeDataOrFn (
  28195. parentVal,
  28196. childVal,
  28197. vm
  28198. ) {
  28199. if (!vm) {
  28200. // in a Vue.extend merge, both should be functions
  28201. if (!childVal) {
  28202. return parentVal
  28203. }
  28204. if (!parentVal) {
  28205. return childVal
  28206. }
  28207. // when parentVal & childVal are both present,
  28208. // we need to return a function that returns the
  28209. // merged result of both functions... no need to
  28210. // check if parentVal is a function here because
  28211. // it has to be a function to pass previous merges.
  28212. return function mergedDataFn () {
  28213. return mergeData(
  28214. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  28215. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  28216. )
  28217. }
  28218. } else {
  28219. return function mergedInstanceDataFn () {
  28220. // instance merge
  28221. var instanceData = typeof childVal === 'function'
  28222. ? childVal.call(vm, vm)
  28223. : childVal;
  28224. var defaultData = typeof parentVal === 'function'
  28225. ? parentVal.call(vm, vm)
  28226. : parentVal;
  28227. if (instanceData) {
  28228. return mergeData(instanceData, defaultData)
  28229. } else {
  28230. return defaultData
  28231. }
  28232. }
  28233. }
  28234. }
  28235. strats.data = function (
  28236. parentVal,
  28237. childVal,
  28238. vm
  28239. ) {
  28240. if (!vm) {
  28241. if (childVal && typeof childVal !== 'function') {
  28242. "development" !== 'production' && warn(
  28243. 'The "data" option should be a function ' +
  28244. 'that returns a per-instance value in component ' +
  28245. 'definitions.',
  28246. vm
  28247. );
  28248. return parentVal
  28249. }
  28250. return mergeDataOrFn(parentVal, childVal)
  28251. }
  28252. return mergeDataOrFn(parentVal, childVal, vm)
  28253. };
  28254. /**
  28255. * Hooks and props are merged as arrays.
  28256. */
  28257. function mergeHook (
  28258. parentVal,
  28259. childVal
  28260. ) {
  28261. return childVal
  28262. ? parentVal
  28263. ? parentVal.concat(childVal)
  28264. : Array.isArray(childVal)
  28265. ? childVal
  28266. : [childVal]
  28267. : parentVal
  28268. }
  28269. LIFECYCLE_HOOKS.forEach(function (hook) {
  28270. strats[hook] = mergeHook;
  28271. });
  28272. /**
  28273. * Assets
  28274. *
  28275. * When a vm is present (instance creation), we need to do
  28276. * a three-way merge between constructor options, instance
  28277. * options and parent options.
  28278. */
  28279. function mergeAssets (
  28280. parentVal,
  28281. childVal,
  28282. vm,
  28283. key
  28284. ) {
  28285. var res = Object.create(parentVal || null);
  28286. if (childVal) {
  28287. "development" !== 'production' && assertObjectType(key, childVal, vm);
  28288. return extend(res, childVal)
  28289. } else {
  28290. return res
  28291. }
  28292. }
  28293. ASSET_TYPES.forEach(function (type) {
  28294. strats[type + 's'] = mergeAssets;
  28295. });
  28296. /**
  28297. * Watchers.
  28298. *
  28299. * Watchers hashes should not overwrite one
  28300. * another, so we merge them as arrays.
  28301. */
  28302. strats.watch = function (
  28303. parentVal,
  28304. childVal,
  28305. vm,
  28306. key
  28307. ) {
  28308. // work around Firefox's Object.prototype.watch...
  28309. if (parentVal === nativeWatch) { parentVal = undefined; }
  28310. if (childVal === nativeWatch) { childVal = undefined; }
  28311. /* istanbul ignore if */
  28312. if (!childVal) { return Object.create(parentVal || null) }
  28313. if (true) {
  28314. assertObjectType(key, childVal, vm);
  28315. }
  28316. if (!parentVal) { return childVal }
  28317. var ret = {};
  28318. extend(ret, parentVal);
  28319. for (var key$1 in childVal) {
  28320. var parent = ret[key$1];
  28321. var child = childVal[key$1];
  28322. if (parent && !Array.isArray(parent)) {
  28323. parent = [parent];
  28324. }
  28325. ret[key$1] = parent
  28326. ? parent.concat(child)
  28327. : Array.isArray(child) ? child : [child];
  28328. }
  28329. return ret
  28330. };
  28331. /**
  28332. * Other object hashes.
  28333. */
  28334. strats.props =
  28335. strats.methods =
  28336. strats.inject =
  28337. strats.computed = function (
  28338. parentVal,
  28339. childVal,
  28340. vm,
  28341. key
  28342. ) {
  28343. if (childVal && "development" !== 'production') {
  28344. assertObjectType(key, childVal, vm);
  28345. }
  28346. if (!parentVal) { return childVal }
  28347. var ret = Object.create(null);
  28348. extend(ret, parentVal);
  28349. if (childVal) { extend(ret, childVal); }
  28350. return ret
  28351. };
  28352. strats.provide = mergeDataOrFn;
  28353. /**
  28354. * Default strategy.
  28355. */
  28356. var defaultStrat = function (parentVal, childVal) {
  28357. return childVal === undefined
  28358. ? parentVal
  28359. : childVal
  28360. };
  28361. /**
  28362. * Validate component names
  28363. */
  28364. function checkComponents (options) {
  28365. for (var key in options.components) {
  28366. validateComponentName(key);
  28367. }
  28368. }
  28369. function validateComponentName (name) {
  28370. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  28371. warn(
  28372. 'Invalid component name: "' + name + '". Component names ' +
  28373. 'can only contain alphanumeric characters and the hyphen, ' +
  28374. 'and must start with a letter.'
  28375. );
  28376. }
  28377. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  28378. warn(
  28379. 'Do not use built-in or reserved HTML elements as component ' +
  28380. 'id: ' + name
  28381. );
  28382. }
  28383. }
  28384. /**
  28385. * Ensure all props option syntax are normalized into the
  28386. * Object-based format.
  28387. */
  28388. function normalizeProps (options, vm) {
  28389. var props = options.props;
  28390. if (!props) { return }
  28391. var res = {};
  28392. var i, val, name;
  28393. if (Array.isArray(props)) {
  28394. i = props.length;
  28395. while (i--) {
  28396. val = props[i];
  28397. if (typeof val === 'string') {
  28398. name = camelize(val);
  28399. res[name] = { type: null };
  28400. } else if (true) {
  28401. warn('props must be strings when using array syntax.');
  28402. }
  28403. }
  28404. } else if (isPlainObject(props)) {
  28405. for (var key in props) {
  28406. val = props[key];
  28407. name = camelize(key);
  28408. res[name] = isPlainObject(val)
  28409. ? val
  28410. : { type: val };
  28411. }
  28412. } else if (true) {
  28413. warn(
  28414. "Invalid value for option \"props\": expected an Array or an Object, " +
  28415. "but got " + (toRawType(props)) + ".",
  28416. vm
  28417. );
  28418. }
  28419. options.props = res;
  28420. }
  28421. /**
  28422. * Normalize all injections into Object-based format
  28423. */
  28424. function normalizeInject (options, vm) {
  28425. var inject = options.inject;
  28426. if (!inject) { return }
  28427. var normalized = options.inject = {};
  28428. if (Array.isArray(inject)) {
  28429. for (var i = 0; i < inject.length; i++) {
  28430. normalized[inject[i]] = { from: inject[i] };
  28431. }
  28432. } else if (isPlainObject(inject)) {
  28433. for (var key in inject) {
  28434. var val = inject[key];
  28435. normalized[key] = isPlainObject(val)
  28436. ? extend({ from: key }, val)
  28437. : { from: val };
  28438. }
  28439. } else if (true) {
  28440. warn(
  28441. "Invalid value for option \"inject\": expected an Array or an Object, " +
  28442. "but got " + (toRawType(inject)) + ".",
  28443. vm
  28444. );
  28445. }
  28446. }
  28447. /**
  28448. * Normalize raw function directives into object format.
  28449. */
  28450. function normalizeDirectives (options) {
  28451. var dirs = options.directives;
  28452. if (dirs) {
  28453. for (var key in dirs) {
  28454. var def = dirs[key];
  28455. if (typeof def === 'function') {
  28456. dirs[key] = { bind: def, update: def };
  28457. }
  28458. }
  28459. }
  28460. }
  28461. function assertObjectType (name, value, vm) {
  28462. if (!isPlainObject(value)) {
  28463. warn(
  28464. "Invalid value for option \"" + name + "\": expected an Object, " +
  28465. "but got " + (toRawType(value)) + ".",
  28466. vm
  28467. );
  28468. }
  28469. }
  28470. /**
  28471. * Merge two option objects into a new one.
  28472. * Core utility used in both instantiation and inheritance.
  28473. */
  28474. function mergeOptions (
  28475. parent,
  28476. child,
  28477. vm
  28478. ) {
  28479. if (true) {
  28480. checkComponents(child);
  28481. }
  28482. if (typeof child === 'function') {
  28483. child = child.options;
  28484. }
  28485. normalizeProps(child, vm);
  28486. normalizeInject(child, vm);
  28487. normalizeDirectives(child);
  28488. var extendsFrom = child.extends;
  28489. if (extendsFrom) {
  28490. parent = mergeOptions(parent, extendsFrom, vm);
  28491. }
  28492. if (child.mixins) {
  28493. for (var i = 0, l = child.mixins.length; i < l; i++) {
  28494. parent = mergeOptions(parent, child.mixins[i], vm);
  28495. }
  28496. }
  28497. var options = {};
  28498. var key;
  28499. for (key in parent) {
  28500. mergeField(key);
  28501. }
  28502. for (key in child) {
  28503. if (!hasOwn(parent, key)) {
  28504. mergeField(key);
  28505. }
  28506. }
  28507. function mergeField (key) {
  28508. var strat = strats[key] || defaultStrat;
  28509. options[key] = strat(parent[key], child[key], vm, key);
  28510. }
  28511. return options
  28512. }
  28513. /**
  28514. * Resolve an asset.
  28515. * This function is used because child instances need access
  28516. * to assets defined in its ancestor chain.
  28517. */
  28518. function resolveAsset (
  28519. options,
  28520. type,
  28521. id,
  28522. warnMissing
  28523. ) {
  28524. /* istanbul ignore if */
  28525. if (typeof id !== 'string') {
  28526. return
  28527. }
  28528. var assets = options[type];
  28529. // check local registration variations first
  28530. if (hasOwn(assets, id)) { return assets[id] }
  28531. var camelizedId = camelize(id);
  28532. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  28533. var PascalCaseId = capitalize(camelizedId);
  28534. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  28535. // fallback to prototype chain
  28536. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  28537. if ("development" !== 'production' && warnMissing && !res) {
  28538. warn(
  28539. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  28540. options
  28541. );
  28542. }
  28543. return res
  28544. }
  28545. /* */
  28546. function validateProp (
  28547. key,
  28548. propOptions,
  28549. propsData,
  28550. vm
  28551. ) {
  28552. var prop = propOptions[key];
  28553. var absent = !hasOwn(propsData, key);
  28554. var value = propsData[key];
  28555. // handle boolean props
  28556. if (isType(Boolean, prop.type)) {
  28557. if (absent && !hasOwn(prop, 'default')) {
  28558. value = false;
  28559. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  28560. value = true;
  28561. }
  28562. }
  28563. // check default value
  28564. if (value === undefined) {
  28565. value = getPropDefaultValue(vm, prop, key);
  28566. // since the default value is a fresh copy,
  28567. // make sure to observe it.
  28568. var prevShouldConvert = observerState.shouldConvert;
  28569. observerState.shouldConvert = true;
  28570. observe(value);
  28571. observerState.shouldConvert = prevShouldConvert;
  28572. }
  28573. if (
  28574. true
  28575. ) {
  28576. assertProp(prop, key, value, vm, absent);
  28577. }
  28578. return value
  28579. }
  28580. /**
  28581. * Get the default value of a prop.
  28582. */
  28583. function getPropDefaultValue (vm, prop, key) {
  28584. // no default, return undefined
  28585. if (!hasOwn(prop, 'default')) {
  28586. return undefined
  28587. }
  28588. var def = prop.default;
  28589. // warn against non-factory defaults for Object & Array
  28590. if ("development" !== 'production' && isObject(def)) {
  28591. warn(
  28592. 'Invalid default value for prop "' + key + '": ' +
  28593. 'Props with type Object/Array must use a factory function ' +
  28594. 'to return the default value.',
  28595. vm
  28596. );
  28597. }
  28598. // the raw prop value was also undefined from previous render,
  28599. // return previous default value to avoid unnecessary watcher trigger
  28600. if (vm && vm.$options.propsData &&
  28601. vm.$options.propsData[key] === undefined &&
  28602. vm._props[key] !== undefined
  28603. ) {
  28604. return vm._props[key]
  28605. }
  28606. // call factory function for non-Function types
  28607. // a value is Function if its prototype is function even across different execution context
  28608. return typeof def === 'function' && getType(prop.type) !== 'Function'
  28609. ? def.call(vm)
  28610. : def
  28611. }
  28612. /**
  28613. * Assert whether a prop is valid.
  28614. */
  28615. function assertProp (
  28616. prop,
  28617. name,
  28618. value,
  28619. vm,
  28620. absent
  28621. ) {
  28622. if (prop.required && absent) {
  28623. warn(
  28624. 'Missing required prop: "' + name + '"',
  28625. vm
  28626. );
  28627. return
  28628. }
  28629. if (value == null && !prop.required) {
  28630. return
  28631. }
  28632. var type = prop.type;
  28633. var valid = !type || type === true;
  28634. var expectedTypes = [];
  28635. if (type) {
  28636. if (!Array.isArray(type)) {
  28637. type = [type];
  28638. }
  28639. for (var i = 0; i < type.length && !valid; i++) {
  28640. var assertedType = assertType(value, type[i]);
  28641. expectedTypes.push(assertedType.expectedType || '');
  28642. valid = assertedType.valid;
  28643. }
  28644. }
  28645. if (!valid) {
  28646. warn(
  28647. "Invalid prop: type check failed for prop \"" + name + "\"." +
  28648. " Expected " + (expectedTypes.map(capitalize).join(', ')) +
  28649. ", got " + (toRawType(value)) + ".",
  28650. vm
  28651. );
  28652. return
  28653. }
  28654. var validator = prop.validator;
  28655. if (validator) {
  28656. if (!validator(value)) {
  28657. warn(
  28658. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  28659. vm
  28660. );
  28661. }
  28662. }
  28663. }
  28664. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  28665. function assertType (value, type) {
  28666. var valid;
  28667. var expectedType = getType(type);
  28668. if (simpleCheckRE.test(expectedType)) {
  28669. var t = typeof value;
  28670. valid = t === expectedType.toLowerCase();
  28671. // for primitive wrapper objects
  28672. if (!valid && t === 'object') {
  28673. valid = value instanceof type;
  28674. }
  28675. } else if (expectedType === 'Object') {
  28676. valid = isPlainObject(value);
  28677. } else if (expectedType === 'Array') {
  28678. valid = Array.isArray(value);
  28679. } else {
  28680. valid = value instanceof type;
  28681. }
  28682. return {
  28683. valid: valid,
  28684. expectedType: expectedType
  28685. }
  28686. }
  28687. /**
  28688. * Use function string name to check built-in types,
  28689. * because a simple equality check will fail when running
  28690. * across different vms / iframes.
  28691. */
  28692. function getType (fn) {
  28693. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  28694. return match ? match[1] : ''
  28695. }
  28696. function isType (type, fn) {
  28697. if (!Array.isArray(fn)) {
  28698. return getType(fn) === getType(type)
  28699. }
  28700. for (var i = 0, len = fn.length; i < len; i++) {
  28701. if (getType(fn[i]) === getType(type)) {
  28702. return true
  28703. }
  28704. }
  28705. /* istanbul ignore next */
  28706. return false
  28707. }
  28708. /* */
  28709. function handleError (err, vm, info) {
  28710. if (vm) {
  28711. var cur = vm;
  28712. while ((cur = cur.$parent)) {
  28713. var hooks = cur.$options.errorCaptured;
  28714. if (hooks) {
  28715. for (var i = 0; i < hooks.length; i++) {
  28716. try {
  28717. var capture = hooks[i].call(cur, err, vm, info) === false;
  28718. if (capture) { return }
  28719. } catch (e) {
  28720. globalHandleError(e, cur, 'errorCaptured hook');
  28721. }
  28722. }
  28723. }
  28724. }
  28725. }
  28726. globalHandleError(err, vm, info);
  28727. }
  28728. function globalHandleError (err, vm, info) {
  28729. if (config.errorHandler) {
  28730. try {
  28731. return config.errorHandler.call(null, err, vm, info)
  28732. } catch (e) {
  28733. logError(e, null, 'config.errorHandler');
  28734. }
  28735. }
  28736. logError(err, vm, info);
  28737. }
  28738. function logError (err, vm, info) {
  28739. if (true) {
  28740. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  28741. }
  28742. /* istanbul ignore else */
  28743. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  28744. console.error(err);
  28745. } else {
  28746. throw err
  28747. }
  28748. }
  28749. /* */
  28750. /* globals MessageChannel */
  28751. var callbacks = [];
  28752. var pending = false;
  28753. function flushCallbacks () {
  28754. pending = false;
  28755. var copies = callbacks.slice(0);
  28756. callbacks.length = 0;
  28757. for (var i = 0; i < copies.length; i++) {
  28758. copies[i]();
  28759. }
  28760. }
  28761. // Here we have async deferring wrappers using both micro and macro tasks.
  28762. // In < 2.4 we used micro tasks everywhere, but there are some scenarios where
  28763. // micro tasks have too high a priority and fires in between supposedly
  28764. // sequential events (e.g. #4521, #6690) or even between bubbling of the same
  28765. // event (#6566). However, using macro tasks everywhere also has subtle problems
  28766. // when state is changed right before repaint (e.g. #6813, out-in transitions).
  28767. // Here we use micro task by default, but expose a way to force macro task when
  28768. // needed (e.g. in event handlers attached by v-on).
  28769. var microTimerFunc;
  28770. var macroTimerFunc;
  28771. var useMacroTask = false;
  28772. // Determine (macro) Task defer implementation.
  28773. // Technically setImmediate should be the ideal choice, but it's only available
  28774. // in IE. The only polyfill that consistently queues the callback after all DOM
  28775. // events triggered in the same loop is by using MessageChannel.
  28776. /* istanbul ignore if */
  28777. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  28778. macroTimerFunc = function () {
  28779. setImmediate(flushCallbacks);
  28780. };
  28781. } else if (typeof MessageChannel !== 'undefined' && (
  28782. isNative(MessageChannel) ||
  28783. // PhantomJS
  28784. MessageChannel.toString() === '[object MessageChannelConstructor]'
  28785. )) {
  28786. var channel = new MessageChannel();
  28787. var port = channel.port2;
  28788. channel.port1.onmessage = flushCallbacks;
  28789. macroTimerFunc = function () {
  28790. port.postMessage(1);
  28791. };
  28792. } else {
  28793. /* istanbul ignore next */
  28794. macroTimerFunc = function () {
  28795. setTimeout(flushCallbacks, 0);
  28796. };
  28797. }
  28798. // Determine MicroTask defer implementation.
  28799. /* istanbul ignore next, $flow-disable-line */
  28800. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  28801. var p = Promise.resolve();
  28802. microTimerFunc = function () {
  28803. p.then(flushCallbacks);
  28804. // in problematic UIWebViews, Promise.then doesn't completely break, but
  28805. // it can get stuck in a weird state where callbacks are pushed into the
  28806. // microtask queue but the queue isn't being flushed, until the browser
  28807. // needs to do some other work, e.g. handle a timer. Therefore we can
  28808. // "force" the microtask queue to be flushed by adding an empty timer.
  28809. if (isIOS) { setTimeout(noop); }
  28810. };
  28811. } else {
  28812. // fallback to macro
  28813. microTimerFunc = macroTimerFunc;
  28814. }
  28815. /**
  28816. * Wrap a function so that if any code inside triggers state change,
  28817. * the changes are queued using a Task instead of a MicroTask.
  28818. */
  28819. function withMacroTask (fn) {
  28820. return fn._withTask || (fn._withTask = function () {
  28821. useMacroTask = true;
  28822. var res = fn.apply(null, arguments);
  28823. useMacroTask = false;
  28824. return res
  28825. })
  28826. }
  28827. function nextTick (cb, ctx) {
  28828. var _resolve;
  28829. callbacks.push(function () {
  28830. if (cb) {
  28831. try {
  28832. cb.call(ctx);
  28833. } catch (e) {
  28834. handleError(e, ctx, 'nextTick');
  28835. }
  28836. } else if (_resolve) {
  28837. _resolve(ctx);
  28838. }
  28839. });
  28840. if (!pending) {
  28841. pending = true;
  28842. if (useMacroTask) {
  28843. macroTimerFunc();
  28844. } else {
  28845. microTimerFunc();
  28846. }
  28847. }
  28848. // $flow-disable-line
  28849. if (!cb && typeof Promise !== 'undefined') {
  28850. return new Promise(function (resolve) {
  28851. _resolve = resolve;
  28852. })
  28853. }
  28854. }
  28855. /* */
  28856. var mark;
  28857. var measure;
  28858. if (true) {
  28859. var perf = inBrowser && window.performance;
  28860. /* istanbul ignore if */
  28861. if (
  28862. perf &&
  28863. perf.mark &&
  28864. perf.measure &&
  28865. perf.clearMarks &&
  28866. perf.clearMeasures
  28867. ) {
  28868. mark = function (tag) { return perf.mark(tag); };
  28869. measure = function (name, startTag, endTag) {
  28870. perf.measure(name, startTag, endTag);
  28871. perf.clearMarks(startTag);
  28872. perf.clearMarks(endTag);
  28873. perf.clearMeasures(name);
  28874. };
  28875. }
  28876. }
  28877. /* not type checking this file because flow doesn't play well with Proxy */
  28878. var initProxy;
  28879. if (true) {
  28880. var allowedGlobals = makeMap(
  28881. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  28882. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  28883. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  28884. 'require' // for Webpack/Browserify
  28885. );
  28886. var warnNonPresent = function (target, key) {
  28887. warn(
  28888. "Property or method \"" + key + "\" is not defined on the instance but " +
  28889. 'referenced during render. Make sure that this property is reactive, ' +
  28890. 'either in the data option, or for class-based components, by ' +
  28891. 'initializing the property. ' +
  28892. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  28893. target
  28894. );
  28895. };
  28896. var hasProxy =
  28897. typeof Proxy !== 'undefined' &&
  28898. Proxy.toString().match(/native code/);
  28899. if (hasProxy) {
  28900. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  28901. config.keyCodes = new Proxy(config.keyCodes, {
  28902. set: function set (target, key, value) {
  28903. if (isBuiltInModifier(key)) {
  28904. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  28905. return false
  28906. } else {
  28907. target[key] = value;
  28908. return true
  28909. }
  28910. }
  28911. });
  28912. }
  28913. var hasHandler = {
  28914. has: function has (target, key) {
  28915. var has = key in target;
  28916. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  28917. if (!has && !isAllowed) {
  28918. warnNonPresent(target, key);
  28919. }
  28920. return has || !isAllowed
  28921. }
  28922. };
  28923. var getHandler = {
  28924. get: function get (target, key) {
  28925. if (typeof key === 'string' && !(key in target)) {
  28926. warnNonPresent(target, key);
  28927. }
  28928. return target[key]
  28929. }
  28930. };
  28931. initProxy = function initProxy (vm) {
  28932. if (hasProxy) {
  28933. // determine which proxy handler to use
  28934. var options = vm.$options;
  28935. var handlers = options.render && options.render._withStripped
  28936. ? getHandler
  28937. : hasHandler;
  28938. vm._renderProxy = new Proxy(vm, handlers);
  28939. } else {
  28940. vm._renderProxy = vm;
  28941. }
  28942. };
  28943. }
  28944. /* */
  28945. var seenObjects = new _Set();
  28946. /**
  28947. * Recursively traverse an object to evoke all converted
  28948. * getters, so that every nested property inside the object
  28949. * is collected as a "deep" dependency.
  28950. */
  28951. function traverse (val) {
  28952. _traverse(val, seenObjects);
  28953. seenObjects.clear();
  28954. }
  28955. function _traverse (val, seen) {
  28956. var i, keys;
  28957. var isA = Array.isArray(val);
  28958. if ((!isA && !isObject(val)) || Object.isFrozen(val)) {
  28959. return
  28960. }
  28961. if (val.__ob__) {
  28962. var depId = val.__ob__.dep.id;
  28963. if (seen.has(depId)) {
  28964. return
  28965. }
  28966. seen.add(depId);
  28967. }
  28968. if (isA) {
  28969. i = val.length;
  28970. while (i--) { _traverse(val[i], seen); }
  28971. } else {
  28972. keys = Object.keys(val);
  28973. i = keys.length;
  28974. while (i--) { _traverse(val[keys[i]], seen); }
  28975. }
  28976. }
  28977. /* */
  28978. var normalizeEvent = cached(function (name) {
  28979. var passive = name.charAt(0) === '&';
  28980. name = passive ? name.slice(1) : name;
  28981. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  28982. name = once$$1 ? name.slice(1) : name;
  28983. var capture = name.charAt(0) === '!';
  28984. name = capture ? name.slice(1) : name;
  28985. return {
  28986. name: name,
  28987. once: once$$1,
  28988. capture: capture,
  28989. passive: passive
  28990. }
  28991. });
  28992. function createFnInvoker (fns) {
  28993. function invoker () {
  28994. var arguments$1 = arguments;
  28995. var fns = invoker.fns;
  28996. if (Array.isArray(fns)) {
  28997. var cloned = fns.slice();
  28998. for (var i = 0; i < cloned.length; i++) {
  28999. cloned[i].apply(null, arguments$1);
  29000. }
  29001. } else {
  29002. // return handler return value for single handlers
  29003. return fns.apply(null, arguments)
  29004. }
  29005. }
  29006. invoker.fns = fns;
  29007. return invoker
  29008. }
  29009. function updateListeners (
  29010. on,
  29011. oldOn,
  29012. add,
  29013. remove$$1,
  29014. vm
  29015. ) {
  29016. var name, def, cur, old, event;
  29017. for (name in on) {
  29018. def = cur = on[name];
  29019. old = oldOn[name];
  29020. event = normalizeEvent(name);
  29021. /* istanbul ignore if */
  29022. if (isUndef(cur)) {
  29023. "development" !== 'production' && warn(
  29024. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  29025. vm
  29026. );
  29027. } else if (isUndef(old)) {
  29028. if (isUndef(cur.fns)) {
  29029. cur = on[name] = createFnInvoker(cur);
  29030. }
  29031. add(event.name, cur, event.once, event.capture, event.passive, event.params);
  29032. } else if (cur !== old) {
  29033. old.fns = cur;
  29034. on[name] = old;
  29035. }
  29036. }
  29037. for (name in oldOn) {
  29038. if (isUndef(on[name])) {
  29039. event = normalizeEvent(name);
  29040. remove$$1(event.name, oldOn[name], event.capture);
  29041. }
  29042. }
  29043. }
  29044. /* */
  29045. function mergeVNodeHook (def, hookKey, hook) {
  29046. if (def instanceof VNode) {
  29047. def = def.data.hook || (def.data.hook = {});
  29048. }
  29049. var invoker;
  29050. var oldHook = def[hookKey];
  29051. function wrappedHook () {
  29052. hook.apply(this, arguments);
  29053. // important: remove merged hook to ensure it's called only once
  29054. // and prevent memory leak
  29055. remove(invoker.fns, wrappedHook);
  29056. }
  29057. if (isUndef(oldHook)) {
  29058. // no existing hook
  29059. invoker = createFnInvoker([wrappedHook]);
  29060. } else {
  29061. /* istanbul ignore if */
  29062. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  29063. // already a merged invoker
  29064. invoker = oldHook;
  29065. invoker.fns.push(wrappedHook);
  29066. } else {
  29067. // existing plain hook
  29068. invoker = createFnInvoker([oldHook, wrappedHook]);
  29069. }
  29070. }
  29071. invoker.merged = true;
  29072. def[hookKey] = invoker;
  29073. }
  29074. /* */
  29075. function extractPropsFromVNodeData (
  29076. data,
  29077. Ctor,
  29078. tag
  29079. ) {
  29080. // we are only extracting raw values here.
  29081. // validation and default values are handled in the child
  29082. // component itself.
  29083. var propOptions = Ctor.options.props;
  29084. if (isUndef(propOptions)) {
  29085. return
  29086. }
  29087. var res = {};
  29088. var attrs = data.attrs;
  29089. var props = data.props;
  29090. if (isDef(attrs) || isDef(props)) {
  29091. for (var key in propOptions) {
  29092. var altKey = hyphenate(key);
  29093. if (true) {
  29094. var keyInLowerCase = key.toLowerCase();
  29095. if (
  29096. key !== keyInLowerCase &&
  29097. attrs && hasOwn(attrs, keyInLowerCase)
  29098. ) {
  29099. tip(
  29100. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  29101. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  29102. " \"" + key + "\". " +
  29103. "Note that HTML attributes are case-insensitive and camelCased " +
  29104. "props need to use their kebab-case equivalents when using in-DOM " +
  29105. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  29106. );
  29107. }
  29108. }
  29109. checkProp(res, props, key, altKey, true) ||
  29110. checkProp(res, attrs, key, altKey, false);
  29111. }
  29112. }
  29113. return res
  29114. }
  29115. function checkProp (
  29116. res,
  29117. hash,
  29118. key,
  29119. altKey,
  29120. preserve
  29121. ) {
  29122. if (isDef(hash)) {
  29123. if (hasOwn(hash, key)) {
  29124. res[key] = hash[key];
  29125. if (!preserve) {
  29126. delete hash[key];
  29127. }
  29128. return true
  29129. } else if (hasOwn(hash, altKey)) {
  29130. res[key] = hash[altKey];
  29131. if (!preserve) {
  29132. delete hash[altKey];
  29133. }
  29134. return true
  29135. }
  29136. }
  29137. return false
  29138. }
  29139. /* */
  29140. // The template compiler attempts to minimize the need for normalization by
  29141. // statically analyzing the template at compile time.
  29142. //
  29143. // For plain HTML markup, normalization can be completely skipped because the
  29144. // generated render function is guaranteed to return Array<VNode>. There are
  29145. // two cases where extra normalization is needed:
  29146. // 1. When the children contains components - because a functional component
  29147. // may return an Array instead of a single root. In this case, just a simple
  29148. // normalization is needed - if any child is an Array, we flatten the whole
  29149. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  29150. // because functional components already normalize their own children.
  29151. function simpleNormalizeChildren (children) {
  29152. for (var i = 0; i < children.length; i++) {
  29153. if (Array.isArray(children[i])) {
  29154. return Array.prototype.concat.apply([], children)
  29155. }
  29156. }
  29157. return children
  29158. }
  29159. // 2. When the children contains constructs that always generated nested Arrays,
  29160. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  29161. // with hand-written render functions / JSX. In such cases a full normalization
  29162. // is needed to cater to all possible types of children values.
  29163. function normalizeChildren (children) {
  29164. return isPrimitive(children)
  29165. ? [createTextVNode(children)]
  29166. : Array.isArray(children)
  29167. ? normalizeArrayChildren(children)
  29168. : undefined
  29169. }
  29170. function isTextNode (node) {
  29171. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  29172. }
  29173. function normalizeArrayChildren (children, nestedIndex) {
  29174. var res = [];
  29175. var i, c, lastIndex, last;
  29176. for (i = 0; i < children.length; i++) {
  29177. c = children[i];
  29178. if (isUndef(c) || typeof c === 'boolean') { continue }
  29179. lastIndex = res.length - 1;
  29180. last = res[lastIndex];
  29181. // nested
  29182. if (Array.isArray(c)) {
  29183. if (c.length > 0) {
  29184. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  29185. // merge adjacent text nodes
  29186. if (isTextNode(c[0]) && isTextNode(last)) {
  29187. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  29188. c.shift();
  29189. }
  29190. res.push.apply(res, c);
  29191. }
  29192. } else if (isPrimitive(c)) {
  29193. if (isTextNode(last)) {
  29194. // merge adjacent text nodes
  29195. // this is necessary for SSR hydration because text nodes are
  29196. // essentially merged when rendered to HTML strings
  29197. res[lastIndex] = createTextVNode(last.text + c);
  29198. } else if (c !== '') {
  29199. // convert primitive to vnode
  29200. res.push(createTextVNode(c));
  29201. }
  29202. } else {
  29203. if (isTextNode(c) && isTextNode(last)) {
  29204. // merge adjacent text nodes
  29205. res[lastIndex] = createTextVNode(last.text + c.text);
  29206. } else {
  29207. // default key for nested array children (likely generated by v-for)
  29208. if (isTrue(children._isVList) &&
  29209. isDef(c.tag) &&
  29210. isUndef(c.key) &&
  29211. isDef(nestedIndex)) {
  29212. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  29213. }
  29214. res.push(c);
  29215. }
  29216. }
  29217. }
  29218. return res
  29219. }
  29220. /* */
  29221. function ensureCtor (comp, base) {
  29222. if (
  29223. comp.__esModule ||
  29224. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  29225. ) {
  29226. comp = comp.default;
  29227. }
  29228. return isObject(comp)
  29229. ? base.extend(comp)
  29230. : comp
  29231. }
  29232. function createAsyncPlaceholder (
  29233. factory,
  29234. data,
  29235. context,
  29236. children,
  29237. tag
  29238. ) {
  29239. var node = createEmptyVNode();
  29240. node.asyncFactory = factory;
  29241. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  29242. return node
  29243. }
  29244. function resolveAsyncComponent (
  29245. factory,
  29246. baseCtor,
  29247. context
  29248. ) {
  29249. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  29250. return factory.errorComp
  29251. }
  29252. if (isDef(factory.resolved)) {
  29253. return factory.resolved
  29254. }
  29255. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  29256. return factory.loadingComp
  29257. }
  29258. if (isDef(factory.contexts)) {
  29259. // already pending
  29260. factory.contexts.push(context);
  29261. } else {
  29262. var contexts = factory.contexts = [context];
  29263. var sync = true;
  29264. var forceRender = function () {
  29265. for (var i = 0, l = contexts.length; i < l; i++) {
  29266. contexts[i].$forceUpdate();
  29267. }
  29268. };
  29269. var resolve = once(function (res) {
  29270. // cache resolved
  29271. factory.resolved = ensureCtor(res, baseCtor);
  29272. // invoke callbacks only if this is not a synchronous resolve
  29273. // (async resolves are shimmed as synchronous during SSR)
  29274. if (!sync) {
  29275. forceRender();
  29276. }
  29277. });
  29278. var reject = once(function (reason) {
  29279. "development" !== 'production' && warn(
  29280. "Failed to resolve async component: " + (String(factory)) +
  29281. (reason ? ("\nReason: " + reason) : '')
  29282. );
  29283. if (isDef(factory.errorComp)) {
  29284. factory.error = true;
  29285. forceRender();
  29286. }
  29287. });
  29288. var res = factory(resolve, reject);
  29289. if (isObject(res)) {
  29290. if (typeof res.then === 'function') {
  29291. // () => Promise
  29292. if (isUndef(factory.resolved)) {
  29293. res.then(resolve, reject);
  29294. }
  29295. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  29296. res.component.then(resolve, reject);
  29297. if (isDef(res.error)) {
  29298. factory.errorComp = ensureCtor(res.error, baseCtor);
  29299. }
  29300. if (isDef(res.loading)) {
  29301. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  29302. if (res.delay === 0) {
  29303. factory.loading = true;
  29304. } else {
  29305. setTimeout(function () {
  29306. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  29307. factory.loading = true;
  29308. forceRender();
  29309. }
  29310. }, res.delay || 200);
  29311. }
  29312. }
  29313. if (isDef(res.timeout)) {
  29314. setTimeout(function () {
  29315. if (isUndef(factory.resolved)) {
  29316. reject(
  29317. true
  29318. ? ("timeout (" + (res.timeout) + "ms)")
  29319. : null
  29320. );
  29321. }
  29322. }, res.timeout);
  29323. }
  29324. }
  29325. }
  29326. sync = false;
  29327. // return in case resolved synchronously
  29328. return factory.loading
  29329. ? factory.loadingComp
  29330. : factory.resolved
  29331. }
  29332. }
  29333. /* */
  29334. function isAsyncPlaceholder (node) {
  29335. return node.isComment && node.asyncFactory
  29336. }
  29337. /* */
  29338. function getFirstComponentChild (children) {
  29339. if (Array.isArray(children)) {
  29340. for (var i = 0; i < children.length; i++) {
  29341. var c = children[i];
  29342. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  29343. return c
  29344. }
  29345. }
  29346. }
  29347. }
  29348. /* */
  29349. /* */
  29350. function initEvents (vm) {
  29351. vm._events = Object.create(null);
  29352. vm._hasHookEvent = false;
  29353. // init parent attached events
  29354. var listeners = vm.$options._parentListeners;
  29355. if (listeners) {
  29356. updateComponentListeners(vm, listeners);
  29357. }
  29358. }
  29359. var target;
  29360. function add (event, fn, once) {
  29361. if (once) {
  29362. target.$once(event, fn);
  29363. } else {
  29364. target.$on(event, fn);
  29365. }
  29366. }
  29367. function remove$1 (event, fn) {
  29368. target.$off(event, fn);
  29369. }
  29370. function updateComponentListeners (
  29371. vm,
  29372. listeners,
  29373. oldListeners
  29374. ) {
  29375. target = vm;
  29376. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  29377. target = undefined;
  29378. }
  29379. function eventsMixin (Vue) {
  29380. var hookRE = /^hook:/;
  29381. Vue.prototype.$on = function (event, fn) {
  29382. var this$1 = this;
  29383. var vm = this;
  29384. if (Array.isArray(event)) {
  29385. for (var i = 0, l = event.length; i < l; i++) {
  29386. this$1.$on(event[i], fn);
  29387. }
  29388. } else {
  29389. (vm._events[event] || (vm._events[event] = [])).push(fn);
  29390. // optimize hook:event cost by using a boolean flag marked at registration
  29391. // instead of a hash lookup
  29392. if (hookRE.test(event)) {
  29393. vm._hasHookEvent = true;
  29394. }
  29395. }
  29396. return vm
  29397. };
  29398. Vue.prototype.$once = function (event, fn) {
  29399. var vm = this;
  29400. function on () {
  29401. vm.$off(event, on);
  29402. fn.apply(vm, arguments);
  29403. }
  29404. on.fn = fn;
  29405. vm.$on(event, on);
  29406. return vm
  29407. };
  29408. Vue.prototype.$off = function (event, fn) {
  29409. var this$1 = this;
  29410. var vm = this;
  29411. // all
  29412. if (!arguments.length) {
  29413. vm._events = Object.create(null);
  29414. return vm
  29415. }
  29416. // array of events
  29417. if (Array.isArray(event)) {
  29418. for (var i = 0, l = event.length; i < l; i++) {
  29419. this$1.$off(event[i], fn);
  29420. }
  29421. return vm
  29422. }
  29423. // specific event
  29424. var cbs = vm._events[event];
  29425. if (!cbs) {
  29426. return vm
  29427. }
  29428. if (!fn) {
  29429. vm._events[event] = null;
  29430. return vm
  29431. }
  29432. if (fn) {
  29433. // specific handler
  29434. var cb;
  29435. var i$1 = cbs.length;
  29436. while (i$1--) {
  29437. cb = cbs[i$1];
  29438. if (cb === fn || cb.fn === fn) {
  29439. cbs.splice(i$1, 1);
  29440. break
  29441. }
  29442. }
  29443. }
  29444. return vm
  29445. };
  29446. Vue.prototype.$emit = function (event) {
  29447. var vm = this;
  29448. if (true) {
  29449. var lowerCaseEvent = event.toLowerCase();
  29450. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  29451. tip(
  29452. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  29453. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  29454. "Note that HTML attributes are case-insensitive and you cannot use " +
  29455. "v-on to listen to camelCase events when using in-DOM templates. " +
  29456. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  29457. );
  29458. }
  29459. }
  29460. var cbs = vm._events[event];
  29461. if (cbs) {
  29462. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  29463. var args = toArray(arguments, 1);
  29464. for (var i = 0, l = cbs.length; i < l; i++) {
  29465. try {
  29466. cbs[i].apply(vm, args);
  29467. } catch (e) {
  29468. handleError(e, vm, ("event handler for \"" + event + "\""));
  29469. }
  29470. }
  29471. }
  29472. return vm
  29473. };
  29474. }
  29475. /* */
  29476. /**
  29477. * Runtime helper for resolving raw children VNodes into a slot object.
  29478. */
  29479. function resolveSlots (
  29480. children,
  29481. context
  29482. ) {
  29483. var slots = {};
  29484. if (!children) {
  29485. return slots
  29486. }
  29487. for (var i = 0, l = children.length; i < l; i++) {
  29488. var child = children[i];
  29489. var data = child.data;
  29490. // remove slot attribute if the node is resolved as a Vue slot node
  29491. if (data && data.attrs && data.attrs.slot) {
  29492. delete data.attrs.slot;
  29493. }
  29494. // named slots should only be respected if the vnode was rendered in the
  29495. // same context.
  29496. if ((child.context === context || child.fnContext === context) &&
  29497. data && data.slot != null
  29498. ) {
  29499. var name = data.slot;
  29500. var slot = (slots[name] || (slots[name] = []));
  29501. if (child.tag === 'template') {
  29502. slot.push.apply(slot, child.children || []);
  29503. } else {
  29504. slot.push(child);
  29505. }
  29506. } else {
  29507. (slots.default || (slots.default = [])).push(child);
  29508. }
  29509. }
  29510. // ignore slots that contains only whitespace
  29511. for (var name$1 in slots) {
  29512. if (slots[name$1].every(isWhitespace)) {
  29513. delete slots[name$1];
  29514. }
  29515. }
  29516. return slots
  29517. }
  29518. function isWhitespace (node) {
  29519. return (node.isComment && !node.asyncFactory) || node.text === ' '
  29520. }
  29521. function resolveScopedSlots (
  29522. fns, // see flow/vnode
  29523. res
  29524. ) {
  29525. res = res || {};
  29526. for (var i = 0; i < fns.length; i++) {
  29527. if (Array.isArray(fns[i])) {
  29528. resolveScopedSlots(fns[i], res);
  29529. } else {
  29530. res[fns[i].key] = fns[i].fn;
  29531. }
  29532. }
  29533. return res
  29534. }
  29535. /* */
  29536. var activeInstance = null;
  29537. var isUpdatingChildComponent = false;
  29538. function initLifecycle (vm) {
  29539. var options = vm.$options;
  29540. // locate first non-abstract parent
  29541. var parent = options.parent;
  29542. if (parent && !options.abstract) {
  29543. while (parent.$options.abstract && parent.$parent) {
  29544. parent = parent.$parent;
  29545. }
  29546. parent.$children.push(vm);
  29547. }
  29548. vm.$parent = parent;
  29549. vm.$root = parent ? parent.$root : vm;
  29550. vm.$children = [];
  29551. vm.$refs = {};
  29552. vm._watcher = null;
  29553. vm._inactive = null;
  29554. vm._directInactive = false;
  29555. vm._isMounted = false;
  29556. vm._isDestroyed = false;
  29557. vm._isBeingDestroyed = false;
  29558. }
  29559. function lifecycleMixin (Vue) {
  29560. Vue.prototype._update = function (vnode, hydrating) {
  29561. var vm = this;
  29562. if (vm._isMounted) {
  29563. callHook(vm, 'beforeUpdate');
  29564. }
  29565. var prevEl = vm.$el;
  29566. var prevVnode = vm._vnode;
  29567. var prevActiveInstance = activeInstance;
  29568. activeInstance = vm;
  29569. vm._vnode = vnode;
  29570. // Vue.prototype.__patch__ is injected in entry points
  29571. // based on the rendering backend used.
  29572. if (!prevVnode) {
  29573. // initial render
  29574. vm.$el = vm.__patch__(
  29575. vm.$el, vnode, hydrating, false /* removeOnly */,
  29576. vm.$options._parentElm,
  29577. vm.$options._refElm
  29578. );
  29579. // no need for the ref nodes after initial patch
  29580. // this prevents keeping a detached DOM tree in memory (#5851)
  29581. vm.$options._parentElm = vm.$options._refElm = null;
  29582. } else {
  29583. // updates
  29584. vm.$el = vm.__patch__(prevVnode, vnode);
  29585. }
  29586. activeInstance = prevActiveInstance;
  29587. // update __vue__ reference
  29588. if (prevEl) {
  29589. prevEl.__vue__ = null;
  29590. }
  29591. if (vm.$el) {
  29592. vm.$el.__vue__ = vm;
  29593. }
  29594. // if parent is an HOC, update its $el as well
  29595. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  29596. vm.$parent.$el = vm.$el;
  29597. }
  29598. // updated hook is called by the scheduler to ensure that children are
  29599. // updated in a parent's updated hook.
  29600. };
  29601. Vue.prototype.$forceUpdate = function () {
  29602. var vm = this;
  29603. if (vm._watcher) {
  29604. vm._watcher.update();
  29605. }
  29606. };
  29607. Vue.prototype.$destroy = function () {
  29608. var vm = this;
  29609. if (vm._isBeingDestroyed) {
  29610. return
  29611. }
  29612. callHook(vm, 'beforeDestroy');
  29613. vm._isBeingDestroyed = true;
  29614. // remove self from parent
  29615. var parent = vm.$parent;
  29616. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  29617. remove(parent.$children, vm);
  29618. }
  29619. // teardown watchers
  29620. if (vm._watcher) {
  29621. vm._watcher.teardown();
  29622. }
  29623. var i = vm._watchers.length;
  29624. while (i--) {
  29625. vm._watchers[i].teardown();
  29626. }
  29627. // remove reference from data ob
  29628. // frozen object may not have observer.
  29629. if (vm._data.__ob__) {
  29630. vm._data.__ob__.vmCount--;
  29631. }
  29632. // call the last hook...
  29633. vm._isDestroyed = true;
  29634. // invoke destroy hooks on current rendered tree
  29635. vm.__patch__(vm._vnode, null);
  29636. // fire destroyed hook
  29637. callHook(vm, 'destroyed');
  29638. // turn off all instance listeners.
  29639. vm.$off();
  29640. // remove __vue__ reference
  29641. if (vm.$el) {
  29642. vm.$el.__vue__ = null;
  29643. }
  29644. // release circular reference (#6759)
  29645. if (vm.$vnode) {
  29646. vm.$vnode.parent = null;
  29647. }
  29648. };
  29649. }
  29650. function mountComponent (
  29651. vm,
  29652. el,
  29653. hydrating
  29654. ) {
  29655. vm.$el = el;
  29656. if (!vm.$options.render) {
  29657. vm.$options.render = createEmptyVNode;
  29658. if (true) {
  29659. /* istanbul ignore if */
  29660. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  29661. vm.$options.el || el) {
  29662. warn(
  29663. 'You are using the runtime-only build of Vue where the template ' +
  29664. 'compiler is not available. Either pre-compile the templates into ' +
  29665. 'render functions, or use the compiler-included build.',
  29666. vm
  29667. );
  29668. } else {
  29669. warn(
  29670. 'Failed to mount component: template or render function not defined.',
  29671. vm
  29672. );
  29673. }
  29674. }
  29675. }
  29676. callHook(vm, 'beforeMount');
  29677. var updateComponent;
  29678. /* istanbul ignore if */
  29679. if ("development" !== 'production' && config.performance && mark) {
  29680. updateComponent = function () {
  29681. var name = vm._name;
  29682. var id = vm._uid;
  29683. var startTag = "vue-perf-start:" + id;
  29684. var endTag = "vue-perf-end:" + id;
  29685. mark(startTag);
  29686. var vnode = vm._render();
  29687. mark(endTag);
  29688. measure(("vue " + name + " render"), startTag, endTag);
  29689. mark(startTag);
  29690. vm._update(vnode, hydrating);
  29691. mark(endTag);
  29692. measure(("vue " + name + " patch"), startTag, endTag);
  29693. };
  29694. } else {
  29695. updateComponent = function () {
  29696. vm._update(vm._render(), hydrating);
  29697. };
  29698. }
  29699. // we set this to vm._watcher inside the watcher's constructor
  29700. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  29701. // component's mounted hook), which relies on vm._watcher being already defined
  29702. new Watcher(vm, updateComponent, noop, null, true /* isRenderWatcher */);
  29703. hydrating = false;
  29704. // manually mounted instance, call mounted on self
  29705. // mounted is called for render-created child components in its inserted hook
  29706. if (vm.$vnode == null) {
  29707. vm._isMounted = true;
  29708. callHook(vm, 'mounted');
  29709. }
  29710. return vm
  29711. }
  29712. function updateChildComponent (
  29713. vm,
  29714. propsData,
  29715. listeners,
  29716. parentVnode,
  29717. renderChildren
  29718. ) {
  29719. if (true) {
  29720. isUpdatingChildComponent = true;
  29721. }
  29722. // determine whether component has slot children
  29723. // we need to do this before overwriting $options._renderChildren
  29724. var hasChildren = !!(
  29725. renderChildren || // has new static slots
  29726. vm.$options._renderChildren || // has old static slots
  29727. parentVnode.data.scopedSlots || // has new scoped slots
  29728. vm.$scopedSlots !== emptyObject // has old scoped slots
  29729. );
  29730. vm.$options._parentVnode = parentVnode;
  29731. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  29732. if (vm._vnode) { // update child tree's parent
  29733. vm._vnode.parent = parentVnode;
  29734. }
  29735. vm.$options._renderChildren = renderChildren;
  29736. // update $attrs and $listeners hash
  29737. // these are also reactive so they may trigger child update if the child
  29738. // used them during render
  29739. vm.$attrs = (parentVnode.data && parentVnode.data.attrs) || emptyObject;
  29740. vm.$listeners = listeners || emptyObject;
  29741. // update props
  29742. if (propsData && vm.$options.props) {
  29743. observerState.shouldConvert = false;
  29744. var props = vm._props;
  29745. var propKeys = vm.$options._propKeys || [];
  29746. for (var i = 0; i < propKeys.length; i++) {
  29747. var key = propKeys[i];
  29748. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  29749. }
  29750. observerState.shouldConvert = true;
  29751. // keep a copy of raw propsData
  29752. vm.$options.propsData = propsData;
  29753. }
  29754. // update listeners
  29755. if (listeners) {
  29756. var oldListeners = vm.$options._parentListeners;
  29757. vm.$options._parentListeners = listeners;
  29758. updateComponentListeners(vm, listeners, oldListeners);
  29759. }
  29760. // resolve slots + force update if has children
  29761. if (hasChildren) {
  29762. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  29763. vm.$forceUpdate();
  29764. }
  29765. if (true) {
  29766. isUpdatingChildComponent = false;
  29767. }
  29768. }
  29769. function isInInactiveTree (vm) {
  29770. while (vm && (vm = vm.$parent)) {
  29771. if (vm._inactive) { return true }
  29772. }
  29773. return false
  29774. }
  29775. function activateChildComponent (vm, direct) {
  29776. if (direct) {
  29777. vm._directInactive = false;
  29778. if (isInInactiveTree(vm)) {
  29779. return
  29780. }
  29781. } else if (vm._directInactive) {
  29782. return
  29783. }
  29784. if (vm._inactive || vm._inactive === null) {
  29785. vm._inactive = false;
  29786. for (var i = 0; i < vm.$children.length; i++) {
  29787. activateChildComponent(vm.$children[i]);
  29788. }
  29789. callHook(vm, 'activated');
  29790. }
  29791. }
  29792. function deactivateChildComponent (vm, direct) {
  29793. if (direct) {
  29794. vm._directInactive = true;
  29795. if (isInInactiveTree(vm)) {
  29796. return
  29797. }
  29798. }
  29799. if (!vm._inactive) {
  29800. vm._inactive = true;
  29801. for (var i = 0; i < vm.$children.length; i++) {
  29802. deactivateChildComponent(vm.$children[i]);
  29803. }
  29804. callHook(vm, 'deactivated');
  29805. }
  29806. }
  29807. function callHook (vm, hook) {
  29808. var handlers = vm.$options[hook];
  29809. if (handlers) {
  29810. for (var i = 0, j = handlers.length; i < j; i++) {
  29811. try {
  29812. handlers[i].call(vm);
  29813. } catch (e) {
  29814. handleError(e, vm, (hook + " hook"));
  29815. }
  29816. }
  29817. }
  29818. if (vm._hasHookEvent) {
  29819. vm.$emit('hook:' + hook);
  29820. }
  29821. }
  29822. /* */
  29823. var MAX_UPDATE_COUNT = 100;
  29824. var queue = [];
  29825. var activatedChildren = [];
  29826. var has = {};
  29827. var circular = {};
  29828. var waiting = false;
  29829. var flushing = false;
  29830. var index = 0;
  29831. /**
  29832. * Reset the scheduler's state.
  29833. */
  29834. function resetSchedulerState () {
  29835. index = queue.length = activatedChildren.length = 0;
  29836. has = {};
  29837. if (true) {
  29838. circular = {};
  29839. }
  29840. waiting = flushing = false;
  29841. }
  29842. /**
  29843. * Flush both queues and run the watchers.
  29844. */
  29845. function flushSchedulerQueue () {
  29846. flushing = true;
  29847. var watcher, id;
  29848. // Sort queue before flush.
  29849. // This ensures that:
  29850. // 1. Components are updated from parent to child. (because parent is always
  29851. // created before the child)
  29852. // 2. A component's user watchers are run before its render watcher (because
  29853. // user watchers are created before the render watcher)
  29854. // 3. If a component is destroyed during a parent component's watcher run,
  29855. // its watchers can be skipped.
  29856. queue.sort(function (a, b) { return a.id - b.id; });
  29857. // do not cache length because more watchers might be pushed
  29858. // as we run existing watchers
  29859. for (index = 0; index < queue.length; index++) {
  29860. watcher = queue[index];
  29861. id = watcher.id;
  29862. has[id] = null;
  29863. watcher.run();
  29864. // in dev build, check and stop circular updates.
  29865. if ("development" !== 'production' && has[id] != null) {
  29866. circular[id] = (circular[id] || 0) + 1;
  29867. if (circular[id] > MAX_UPDATE_COUNT) {
  29868. warn(
  29869. 'You may have an infinite update loop ' + (
  29870. watcher.user
  29871. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  29872. : "in a component render function."
  29873. ),
  29874. watcher.vm
  29875. );
  29876. break
  29877. }
  29878. }
  29879. }
  29880. // keep copies of post queues before resetting state
  29881. var activatedQueue = activatedChildren.slice();
  29882. var updatedQueue = queue.slice();
  29883. resetSchedulerState();
  29884. // call component updated and activated hooks
  29885. callActivatedHooks(activatedQueue);
  29886. callUpdatedHooks(updatedQueue);
  29887. // devtool hook
  29888. /* istanbul ignore if */
  29889. if (devtools && config.devtools) {
  29890. devtools.emit('flush');
  29891. }
  29892. }
  29893. function callUpdatedHooks (queue) {
  29894. var i = queue.length;
  29895. while (i--) {
  29896. var watcher = queue[i];
  29897. var vm = watcher.vm;
  29898. if (vm._watcher === watcher && vm._isMounted) {
  29899. callHook(vm, 'updated');
  29900. }
  29901. }
  29902. }
  29903. /**
  29904. * Queue a kept-alive component that was activated during patch.
  29905. * The queue will be processed after the entire tree has been patched.
  29906. */
  29907. function queueActivatedComponent (vm) {
  29908. // setting _inactive to false here so that a render function can
  29909. // rely on checking whether it's in an inactive tree (e.g. router-view)
  29910. vm._inactive = false;
  29911. activatedChildren.push(vm);
  29912. }
  29913. function callActivatedHooks (queue) {
  29914. for (var i = 0; i < queue.length; i++) {
  29915. queue[i]._inactive = true;
  29916. activateChildComponent(queue[i], true /* true */);
  29917. }
  29918. }
  29919. /**
  29920. * Push a watcher into the watcher queue.
  29921. * Jobs with duplicate IDs will be skipped unless it's
  29922. * pushed when the queue is being flushed.
  29923. */
  29924. function queueWatcher (watcher) {
  29925. var id = watcher.id;
  29926. if (has[id] == null) {
  29927. has[id] = true;
  29928. if (!flushing) {
  29929. queue.push(watcher);
  29930. } else {
  29931. // if already flushing, splice the watcher based on its id
  29932. // if already past its id, it will be run next immediately.
  29933. var i = queue.length - 1;
  29934. while (i > index && queue[i].id > watcher.id) {
  29935. i--;
  29936. }
  29937. queue.splice(i + 1, 0, watcher);
  29938. }
  29939. // queue the flush
  29940. if (!waiting) {
  29941. waiting = true;
  29942. nextTick(flushSchedulerQueue);
  29943. }
  29944. }
  29945. }
  29946. /* */
  29947. var uid$2 = 0;
  29948. /**
  29949. * A watcher parses an expression, collects dependencies,
  29950. * and fires callback when the expression value changes.
  29951. * This is used for both the $watch() api and directives.
  29952. */
  29953. var Watcher = function Watcher (
  29954. vm,
  29955. expOrFn,
  29956. cb,
  29957. options,
  29958. isRenderWatcher
  29959. ) {
  29960. this.vm = vm;
  29961. if (isRenderWatcher) {
  29962. vm._watcher = this;
  29963. }
  29964. vm._watchers.push(this);
  29965. // options
  29966. if (options) {
  29967. this.deep = !!options.deep;
  29968. this.user = !!options.user;
  29969. this.lazy = !!options.lazy;
  29970. this.sync = !!options.sync;
  29971. } else {
  29972. this.deep = this.user = this.lazy = this.sync = false;
  29973. }
  29974. this.cb = cb;
  29975. this.id = ++uid$2; // uid for batching
  29976. this.active = true;
  29977. this.dirty = this.lazy; // for lazy watchers
  29978. this.deps = [];
  29979. this.newDeps = [];
  29980. this.depIds = new _Set();
  29981. this.newDepIds = new _Set();
  29982. this.expression = true
  29983. ? expOrFn.toString()
  29984. : '';
  29985. // parse expression for getter
  29986. if (typeof expOrFn === 'function') {
  29987. this.getter = expOrFn;
  29988. } else {
  29989. this.getter = parsePath(expOrFn);
  29990. if (!this.getter) {
  29991. this.getter = function () {};
  29992. "development" !== 'production' && warn(
  29993. "Failed watching path: \"" + expOrFn + "\" " +
  29994. 'Watcher only accepts simple dot-delimited paths. ' +
  29995. 'For full control, use a function instead.',
  29996. vm
  29997. );
  29998. }
  29999. }
  30000. this.value = this.lazy
  30001. ? undefined
  30002. : this.get();
  30003. };
  30004. /**
  30005. * Evaluate the getter, and re-collect dependencies.
  30006. */
  30007. Watcher.prototype.get = function get () {
  30008. pushTarget(this);
  30009. var value;
  30010. var vm = this.vm;
  30011. try {
  30012. value = this.getter.call(vm, vm);
  30013. } catch (e) {
  30014. if (this.user) {
  30015. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  30016. } else {
  30017. throw e
  30018. }
  30019. } finally {
  30020. // "touch" every property so they are all tracked as
  30021. // dependencies for deep watching
  30022. if (this.deep) {
  30023. traverse(value);
  30024. }
  30025. popTarget();
  30026. this.cleanupDeps();
  30027. }
  30028. return value
  30029. };
  30030. /**
  30031. * Add a dependency to this directive.
  30032. */
  30033. Watcher.prototype.addDep = function addDep (dep) {
  30034. var id = dep.id;
  30035. if (!this.newDepIds.has(id)) {
  30036. this.newDepIds.add(id);
  30037. this.newDeps.push(dep);
  30038. if (!this.depIds.has(id)) {
  30039. dep.addSub(this);
  30040. }
  30041. }
  30042. };
  30043. /**
  30044. * Clean up for dependency collection.
  30045. */
  30046. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  30047. var this$1 = this;
  30048. var i = this.deps.length;
  30049. while (i--) {
  30050. var dep = this$1.deps[i];
  30051. if (!this$1.newDepIds.has(dep.id)) {
  30052. dep.removeSub(this$1);
  30053. }
  30054. }
  30055. var tmp = this.depIds;
  30056. this.depIds = this.newDepIds;
  30057. this.newDepIds = tmp;
  30058. this.newDepIds.clear();
  30059. tmp = this.deps;
  30060. this.deps = this.newDeps;
  30061. this.newDeps = tmp;
  30062. this.newDeps.length = 0;
  30063. };
  30064. /**
  30065. * Subscriber interface.
  30066. * Will be called when a dependency changes.
  30067. */
  30068. Watcher.prototype.update = function update () {
  30069. /* istanbul ignore else */
  30070. if (this.lazy) {
  30071. this.dirty = true;
  30072. } else if (this.sync) {
  30073. this.run();
  30074. } else {
  30075. queueWatcher(this);
  30076. }
  30077. };
  30078. /**
  30079. * Scheduler job interface.
  30080. * Will be called by the scheduler.
  30081. */
  30082. Watcher.prototype.run = function run () {
  30083. if (this.active) {
  30084. var value = this.get();
  30085. if (
  30086. value !== this.value ||
  30087. // Deep watchers and watchers on Object/Arrays should fire even
  30088. // when the value is the same, because the value may
  30089. // have mutated.
  30090. isObject(value) ||
  30091. this.deep
  30092. ) {
  30093. // set new value
  30094. var oldValue = this.value;
  30095. this.value = value;
  30096. if (this.user) {
  30097. try {
  30098. this.cb.call(this.vm, value, oldValue);
  30099. } catch (e) {
  30100. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  30101. }
  30102. } else {
  30103. this.cb.call(this.vm, value, oldValue);
  30104. }
  30105. }
  30106. }
  30107. };
  30108. /**
  30109. * Evaluate the value of the watcher.
  30110. * This only gets called for lazy watchers.
  30111. */
  30112. Watcher.prototype.evaluate = function evaluate () {
  30113. this.value = this.get();
  30114. this.dirty = false;
  30115. };
  30116. /**
  30117. * Depend on all deps collected by this watcher.
  30118. */
  30119. Watcher.prototype.depend = function depend () {
  30120. var this$1 = this;
  30121. var i = this.deps.length;
  30122. while (i--) {
  30123. this$1.deps[i].depend();
  30124. }
  30125. };
  30126. /**
  30127. * Remove self from all dependencies' subscriber list.
  30128. */
  30129. Watcher.prototype.teardown = function teardown () {
  30130. var this$1 = this;
  30131. if (this.active) {
  30132. // remove self from vm's watcher list
  30133. // this is a somewhat expensive operation so we skip it
  30134. // if the vm is being destroyed.
  30135. if (!this.vm._isBeingDestroyed) {
  30136. remove(this.vm._watchers, this);
  30137. }
  30138. var i = this.deps.length;
  30139. while (i--) {
  30140. this$1.deps[i].removeSub(this$1);
  30141. }
  30142. this.active = false;
  30143. }
  30144. };
  30145. /* */
  30146. var sharedPropertyDefinition = {
  30147. enumerable: true,
  30148. configurable: true,
  30149. get: noop,
  30150. set: noop
  30151. };
  30152. function proxy (target, sourceKey, key) {
  30153. sharedPropertyDefinition.get = function proxyGetter () {
  30154. return this[sourceKey][key]
  30155. };
  30156. sharedPropertyDefinition.set = function proxySetter (val) {
  30157. this[sourceKey][key] = val;
  30158. };
  30159. Object.defineProperty(target, key, sharedPropertyDefinition);
  30160. }
  30161. function initState (vm) {
  30162. vm._watchers = [];
  30163. var opts = vm.$options;
  30164. if (opts.props) { initProps(vm, opts.props); }
  30165. if (opts.methods) { initMethods(vm, opts.methods); }
  30166. if (opts.data) {
  30167. initData(vm);
  30168. } else {
  30169. observe(vm._data = {}, true /* asRootData */);
  30170. }
  30171. if (opts.computed) { initComputed(vm, opts.computed); }
  30172. if (opts.watch && opts.watch !== nativeWatch) {
  30173. initWatch(vm, opts.watch);
  30174. }
  30175. }
  30176. function initProps (vm, propsOptions) {
  30177. var propsData = vm.$options.propsData || {};
  30178. var props = vm._props = {};
  30179. // cache prop keys so that future props updates can iterate using Array
  30180. // instead of dynamic object key enumeration.
  30181. var keys = vm.$options._propKeys = [];
  30182. var isRoot = !vm.$parent;
  30183. // root instance props should be converted
  30184. observerState.shouldConvert = isRoot;
  30185. var loop = function ( key ) {
  30186. keys.push(key);
  30187. var value = validateProp(key, propsOptions, propsData, vm);
  30188. /* istanbul ignore else */
  30189. if (true) {
  30190. var hyphenatedKey = hyphenate(key);
  30191. if (isReservedAttribute(hyphenatedKey) ||
  30192. config.isReservedAttr(hyphenatedKey)) {
  30193. warn(
  30194. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  30195. vm
  30196. );
  30197. }
  30198. defineReactive(props, key, value, function () {
  30199. if (vm.$parent && !isUpdatingChildComponent) {
  30200. warn(
  30201. "Avoid mutating a prop directly since the value will be " +
  30202. "overwritten whenever the parent component re-renders. " +
  30203. "Instead, use a data or computed property based on the prop's " +
  30204. "value. Prop being mutated: \"" + key + "\"",
  30205. vm
  30206. );
  30207. }
  30208. });
  30209. } else {
  30210. defineReactive(props, key, value);
  30211. }
  30212. // static props are already proxied on the component's prototype
  30213. // during Vue.extend(). We only need to proxy props defined at
  30214. // instantiation here.
  30215. if (!(key in vm)) {
  30216. proxy(vm, "_props", key);
  30217. }
  30218. };
  30219. for (var key in propsOptions) loop( key );
  30220. observerState.shouldConvert = true;
  30221. }
  30222. function initData (vm) {
  30223. var data = vm.$options.data;
  30224. data = vm._data = typeof data === 'function'
  30225. ? getData(data, vm)
  30226. : data || {};
  30227. if (!isPlainObject(data)) {
  30228. data = {};
  30229. "development" !== 'production' && warn(
  30230. 'data functions should return an object:\n' +
  30231. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  30232. vm
  30233. );
  30234. }
  30235. // proxy data on instance
  30236. var keys = Object.keys(data);
  30237. var props = vm.$options.props;
  30238. var methods = vm.$options.methods;
  30239. var i = keys.length;
  30240. while (i--) {
  30241. var key = keys[i];
  30242. if (true) {
  30243. if (methods && hasOwn(methods, key)) {
  30244. warn(
  30245. ("Method \"" + key + "\" has already been defined as a data property."),
  30246. vm
  30247. );
  30248. }
  30249. }
  30250. if (props && hasOwn(props, key)) {
  30251. "development" !== 'production' && warn(
  30252. "The data property \"" + key + "\" is already declared as a prop. " +
  30253. "Use prop default value instead.",
  30254. vm
  30255. );
  30256. } else if (!isReserved(key)) {
  30257. proxy(vm, "_data", key);
  30258. }
  30259. }
  30260. // observe data
  30261. observe(data, true /* asRootData */);
  30262. }
  30263. function getData (data, vm) {
  30264. try {
  30265. return data.call(vm, vm)
  30266. } catch (e) {
  30267. handleError(e, vm, "data()");
  30268. return {}
  30269. }
  30270. }
  30271. var computedWatcherOptions = { lazy: true };
  30272. function initComputed (vm, computed) {
  30273. // $flow-disable-line
  30274. var watchers = vm._computedWatchers = Object.create(null);
  30275. // computed properties are just getters during SSR
  30276. var isSSR = isServerRendering();
  30277. for (var key in computed) {
  30278. var userDef = computed[key];
  30279. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  30280. if ("development" !== 'production' && getter == null) {
  30281. warn(
  30282. ("Getter is missing for computed property \"" + key + "\"."),
  30283. vm
  30284. );
  30285. }
  30286. if (!isSSR) {
  30287. // create internal watcher for the computed property.
  30288. watchers[key] = new Watcher(
  30289. vm,
  30290. getter || noop,
  30291. noop,
  30292. computedWatcherOptions
  30293. );
  30294. }
  30295. // component-defined computed properties are already defined on the
  30296. // component prototype. We only need to define computed properties defined
  30297. // at instantiation here.
  30298. if (!(key in vm)) {
  30299. defineComputed(vm, key, userDef);
  30300. } else if (true) {
  30301. if (key in vm.$data) {
  30302. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  30303. } else if (vm.$options.props && key in vm.$options.props) {
  30304. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  30305. }
  30306. }
  30307. }
  30308. }
  30309. function defineComputed (
  30310. target,
  30311. key,
  30312. userDef
  30313. ) {
  30314. var shouldCache = !isServerRendering();
  30315. if (typeof userDef === 'function') {
  30316. sharedPropertyDefinition.get = shouldCache
  30317. ? createComputedGetter(key)
  30318. : userDef;
  30319. sharedPropertyDefinition.set = noop;
  30320. } else {
  30321. sharedPropertyDefinition.get = userDef.get
  30322. ? shouldCache && userDef.cache !== false
  30323. ? createComputedGetter(key)
  30324. : userDef.get
  30325. : noop;
  30326. sharedPropertyDefinition.set = userDef.set
  30327. ? userDef.set
  30328. : noop;
  30329. }
  30330. if ("development" !== 'production' &&
  30331. sharedPropertyDefinition.set === noop) {
  30332. sharedPropertyDefinition.set = function () {
  30333. warn(
  30334. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  30335. this
  30336. );
  30337. };
  30338. }
  30339. Object.defineProperty(target, key, sharedPropertyDefinition);
  30340. }
  30341. function createComputedGetter (key) {
  30342. return function computedGetter () {
  30343. var watcher = this._computedWatchers && this._computedWatchers[key];
  30344. if (watcher) {
  30345. if (watcher.dirty) {
  30346. watcher.evaluate();
  30347. }
  30348. if (Dep.target) {
  30349. watcher.depend();
  30350. }
  30351. return watcher.value
  30352. }
  30353. }
  30354. }
  30355. function initMethods (vm, methods) {
  30356. var props = vm.$options.props;
  30357. for (var key in methods) {
  30358. if (true) {
  30359. if (methods[key] == null) {
  30360. warn(
  30361. "Method \"" + key + "\" has an undefined value in the component definition. " +
  30362. "Did you reference the function correctly?",
  30363. vm
  30364. );
  30365. }
  30366. if (props && hasOwn(props, key)) {
  30367. warn(
  30368. ("Method \"" + key + "\" has already been defined as a prop."),
  30369. vm
  30370. );
  30371. }
  30372. if ((key in vm) && isReserved(key)) {
  30373. warn(
  30374. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  30375. "Avoid defining component methods that start with _ or $."
  30376. );
  30377. }
  30378. }
  30379. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  30380. }
  30381. }
  30382. function initWatch (vm, watch) {
  30383. for (var key in watch) {
  30384. var handler = watch[key];
  30385. if (Array.isArray(handler)) {
  30386. for (var i = 0; i < handler.length; i++) {
  30387. createWatcher(vm, key, handler[i]);
  30388. }
  30389. } else {
  30390. createWatcher(vm, key, handler);
  30391. }
  30392. }
  30393. }
  30394. function createWatcher (
  30395. vm,
  30396. keyOrFn,
  30397. handler,
  30398. options
  30399. ) {
  30400. if (isPlainObject(handler)) {
  30401. options = handler;
  30402. handler = handler.handler;
  30403. }
  30404. if (typeof handler === 'string') {
  30405. handler = vm[handler];
  30406. }
  30407. return vm.$watch(keyOrFn, handler, options)
  30408. }
  30409. function stateMixin (Vue) {
  30410. // flow somehow has problems with directly declared definition object
  30411. // when using Object.defineProperty, so we have to procedurally build up
  30412. // the object here.
  30413. var dataDef = {};
  30414. dataDef.get = function () { return this._data };
  30415. var propsDef = {};
  30416. propsDef.get = function () { return this._props };
  30417. if (true) {
  30418. dataDef.set = function (newData) {
  30419. warn(
  30420. 'Avoid replacing instance root $data. ' +
  30421. 'Use nested data properties instead.',
  30422. this
  30423. );
  30424. };
  30425. propsDef.set = function () {
  30426. warn("$props is readonly.", this);
  30427. };
  30428. }
  30429. Object.defineProperty(Vue.prototype, '$data', dataDef);
  30430. Object.defineProperty(Vue.prototype, '$props', propsDef);
  30431. Vue.prototype.$set = set;
  30432. Vue.prototype.$delete = del;
  30433. Vue.prototype.$watch = function (
  30434. expOrFn,
  30435. cb,
  30436. options
  30437. ) {
  30438. var vm = this;
  30439. if (isPlainObject(cb)) {
  30440. return createWatcher(vm, expOrFn, cb, options)
  30441. }
  30442. options = options || {};
  30443. options.user = true;
  30444. var watcher = new Watcher(vm, expOrFn, cb, options);
  30445. if (options.immediate) {
  30446. cb.call(vm, watcher.value);
  30447. }
  30448. return function unwatchFn () {
  30449. watcher.teardown();
  30450. }
  30451. };
  30452. }
  30453. /* */
  30454. function initProvide (vm) {
  30455. var provide = vm.$options.provide;
  30456. if (provide) {
  30457. vm._provided = typeof provide === 'function'
  30458. ? provide.call(vm)
  30459. : provide;
  30460. }
  30461. }
  30462. function initInjections (vm) {
  30463. var result = resolveInject(vm.$options.inject, vm);
  30464. if (result) {
  30465. observerState.shouldConvert = false;
  30466. Object.keys(result).forEach(function (key) {
  30467. /* istanbul ignore else */
  30468. if (true) {
  30469. defineReactive(vm, key, result[key], function () {
  30470. warn(
  30471. "Avoid mutating an injected value directly since the changes will be " +
  30472. "overwritten whenever the provided component re-renders. " +
  30473. "injection being mutated: \"" + key + "\"",
  30474. vm
  30475. );
  30476. });
  30477. } else {
  30478. defineReactive(vm, key, result[key]);
  30479. }
  30480. });
  30481. observerState.shouldConvert = true;
  30482. }
  30483. }
  30484. function resolveInject (inject, vm) {
  30485. if (inject) {
  30486. // inject is :any because flow is not smart enough to figure out cached
  30487. var result = Object.create(null);
  30488. var keys = hasSymbol
  30489. ? Reflect.ownKeys(inject).filter(function (key) {
  30490. /* istanbul ignore next */
  30491. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  30492. })
  30493. : Object.keys(inject);
  30494. for (var i = 0; i < keys.length; i++) {
  30495. var key = keys[i];
  30496. var provideKey = inject[key].from;
  30497. var source = vm;
  30498. while (source) {
  30499. if (source._provided && provideKey in source._provided) {
  30500. result[key] = source._provided[provideKey];
  30501. break
  30502. }
  30503. source = source.$parent;
  30504. }
  30505. if (!source) {
  30506. if ('default' in inject[key]) {
  30507. var provideDefault = inject[key].default;
  30508. result[key] = typeof provideDefault === 'function'
  30509. ? provideDefault.call(vm)
  30510. : provideDefault;
  30511. } else if (true) {
  30512. warn(("Injection \"" + key + "\" not found"), vm);
  30513. }
  30514. }
  30515. }
  30516. return result
  30517. }
  30518. }
  30519. /* */
  30520. /**
  30521. * Runtime helper for rendering v-for lists.
  30522. */
  30523. function renderList (
  30524. val,
  30525. render
  30526. ) {
  30527. var ret, i, l, keys, key;
  30528. if (Array.isArray(val) || typeof val === 'string') {
  30529. ret = new Array(val.length);
  30530. for (i = 0, l = val.length; i < l; i++) {
  30531. ret[i] = render(val[i], i);
  30532. }
  30533. } else if (typeof val === 'number') {
  30534. ret = new Array(val);
  30535. for (i = 0; i < val; i++) {
  30536. ret[i] = render(i + 1, i);
  30537. }
  30538. } else if (isObject(val)) {
  30539. keys = Object.keys(val);
  30540. ret = new Array(keys.length);
  30541. for (i = 0, l = keys.length; i < l; i++) {
  30542. key = keys[i];
  30543. ret[i] = render(val[key], key, i);
  30544. }
  30545. }
  30546. if (isDef(ret)) {
  30547. (ret)._isVList = true;
  30548. }
  30549. return ret
  30550. }
  30551. /* */
  30552. /**
  30553. * Runtime helper for rendering <slot>
  30554. */
  30555. function renderSlot (
  30556. name,
  30557. fallback,
  30558. props,
  30559. bindObject
  30560. ) {
  30561. var scopedSlotFn = this.$scopedSlots[name];
  30562. var nodes;
  30563. if (scopedSlotFn) { // scoped slot
  30564. props = props || {};
  30565. if (bindObject) {
  30566. if ("development" !== 'production' && !isObject(bindObject)) {
  30567. warn(
  30568. 'slot v-bind without argument expects an Object',
  30569. this
  30570. );
  30571. }
  30572. props = extend(extend({}, bindObject), props);
  30573. }
  30574. nodes = scopedSlotFn(props) || fallback;
  30575. } else {
  30576. var slotNodes = this.$slots[name];
  30577. // warn duplicate slot usage
  30578. if (slotNodes) {
  30579. if ("development" !== 'production' && slotNodes._rendered) {
  30580. warn(
  30581. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  30582. "- this will likely cause render errors.",
  30583. this
  30584. );
  30585. }
  30586. slotNodes._rendered = true;
  30587. }
  30588. nodes = slotNodes || fallback;
  30589. }
  30590. var target = props && props.slot;
  30591. if (target) {
  30592. return this.$createElement('template', { slot: target }, nodes)
  30593. } else {
  30594. return nodes
  30595. }
  30596. }
  30597. /* */
  30598. /**
  30599. * Runtime helper for resolving filters
  30600. */
  30601. function resolveFilter (id) {
  30602. return resolveAsset(this.$options, 'filters', id, true) || identity
  30603. }
  30604. /* */
  30605. /**
  30606. * Runtime helper for checking keyCodes from config.
  30607. * exposed as Vue.prototype._k
  30608. * passing in eventKeyName as last argument separately for backwards compat
  30609. */
  30610. function checkKeyCodes (
  30611. eventKeyCode,
  30612. key,
  30613. builtInAlias,
  30614. eventKeyName
  30615. ) {
  30616. var keyCodes = config.keyCodes[key] || builtInAlias;
  30617. if (keyCodes) {
  30618. if (Array.isArray(keyCodes)) {
  30619. return keyCodes.indexOf(eventKeyCode) === -1
  30620. } else {
  30621. return keyCodes !== eventKeyCode
  30622. }
  30623. } else if (eventKeyName) {
  30624. return hyphenate(eventKeyName) !== key
  30625. }
  30626. }
  30627. /* */
  30628. /**
  30629. * Runtime helper for merging v-bind="object" into a VNode's data.
  30630. */
  30631. function bindObjectProps (
  30632. data,
  30633. tag,
  30634. value,
  30635. asProp,
  30636. isSync
  30637. ) {
  30638. if (value) {
  30639. if (!isObject(value)) {
  30640. "development" !== 'production' && warn(
  30641. 'v-bind without argument expects an Object or Array value',
  30642. this
  30643. );
  30644. } else {
  30645. if (Array.isArray(value)) {
  30646. value = toObject(value);
  30647. }
  30648. var hash;
  30649. var loop = function ( key ) {
  30650. if (
  30651. key === 'class' ||
  30652. key === 'style' ||
  30653. isReservedAttribute(key)
  30654. ) {
  30655. hash = data;
  30656. } else {
  30657. var type = data.attrs && data.attrs.type;
  30658. hash = asProp || config.mustUseProp(tag, type, key)
  30659. ? data.domProps || (data.domProps = {})
  30660. : data.attrs || (data.attrs = {});
  30661. }
  30662. if (!(key in hash)) {
  30663. hash[key] = value[key];
  30664. if (isSync) {
  30665. var on = data.on || (data.on = {});
  30666. on[("update:" + key)] = function ($event) {
  30667. value[key] = $event;
  30668. };
  30669. }
  30670. }
  30671. };
  30672. for (var key in value) loop( key );
  30673. }
  30674. }
  30675. return data
  30676. }
  30677. /* */
  30678. /**
  30679. * Runtime helper for rendering static trees.
  30680. */
  30681. function renderStatic (
  30682. index,
  30683. isInFor
  30684. ) {
  30685. var cached = this._staticTrees || (this._staticTrees = []);
  30686. var tree = cached[index];
  30687. // if has already-rendered static tree and not inside v-for,
  30688. // we can reuse the same tree by doing a shallow clone.
  30689. if (tree && !isInFor) {
  30690. return Array.isArray(tree)
  30691. ? cloneVNodes(tree)
  30692. : cloneVNode(tree)
  30693. }
  30694. // otherwise, render a fresh tree.
  30695. tree = cached[index] = this.$options.staticRenderFns[index].call(
  30696. this._renderProxy,
  30697. null,
  30698. this // for render fns generated for functional component templates
  30699. );
  30700. markStatic(tree, ("__static__" + index), false);
  30701. return tree
  30702. }
  30703. /**
  30704. * Runtime helper for v-once.
  30705. * Effectively it means marking the node as static with a unique key.
  30706. */
  30707. function markOnce (
  30708. tree,
  30709. index,
  30710. key
  30711. ) {
  30712. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  30713. return tree
  30714. }
  30715. function markStatic (
  30716. tree,
  30717. key,
  30718. isOnce
  30719. ) {
  30720. if (Array.isArray(tree)) {
  30721. for (var i = 0; i < tree.length; i++) {
  30722. if (tree[i] && typeof tree[i] !== 'string') {
  30723. markStaticNode(tree[i], (key + "_" + i), isOnce);
  30724. }
  30725. }
  30726. } else {
  30727. markStaticNode(tree, key, isOnce);
  30728. }
  30729. }
  30730. function markStaticNode (node, key, isOnce) {
  30731. node.isStatic = true;
  30732. node.key = key;
  30733. node.isOnce = isOnce;
  30734. }
  30735. /* */
  30736. function bindObjectListeners (data, value) {
  30737. if (value) {
  30738. if (!isPlainObject(value)) {
  30739. "development" !== 'production' && warn(
  30740. 'v-on without argument expects an Object value',
  30741. this
  30742. );
  30743. } else {
  30744. var on = data.on = data.on ? extend({}, data.on) : {};
  30745. for (var key in value) {
  30746. var existing = on[key];
  30747. var ours = value[key];
  30748. on[key] = existing ? [].concat(existing, ours) : ours;
  30749. }
  30750. }
  30751. }
  30752. return data
  30753. }
  30754. /* */
  30755. function installRenderHelpers (target) {
  30756. target._o = markOnce;
  30757. target._n = toNumber;
  30758. target._s = toString;
  30759. target._l = renderList;
  30760. target._t = renderSlot;
  30761. target._q = looseEqual;
  30762. target._i = looseIndexOf;
  30763. target._m = renderStatic;
  30764. target._f = resolveFilter;
  30765. target._k = checkKeyCodes;
  30766. target._b = bindObjectProps;
  30767. target._v = createTextVNode;
  30768. target._e = createEmptyVNode;
  30769. target._u = resolveScopedSlots;
  30770. target._g = bindObjectListeners;
  30771. }
  30772. /* */
  30773. function FunctionalRenderContext (
  30774. data,
  30775. props,
  30776. children,
  30777. parent,
  30778. Ctor
  30779. ) {
  30780. var options = Ctor.options;
  30781. this.data = data;
  30782. this.props = props;
  30783. this.children = children;
  30784. this.parent = parent;
  30785. this.listeners = data.on || emptyObject;
  30786. this.injections = resolveInject(options.inject, parent);
  30787. this.slots = function () { return resolveSlots(children, parent); };
  30788. // ensure the createElement function in functional components
  30789. // gets a unique context - this is necessary for correct named slot check
  30790. var contextVm = Object.create(parent);
  30791. var isCompiled = isTrue(options._compiled);
  30792. var needNormalization = !isCompiled;
  30793. // support for compiled functional template
  30794. if (isCompiled) {
  30795. // exposing $options for renderStatic()
  30796. this.$options = options;
  30797. // pre-resolve slots for renderSlot()
  30798. this.$slots = this.slots();
  30799. this.$scopedSlots = data.scopedSlots || emptyObject;
  30800. }
  30801. if (options._scopeId) {
  30802. this._c = function (a, b, c, d) {
  30803. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  30804. if (vnode) {
  30805. vnode.fnScopeId = options._scopeId;
  30806. vnode.fnContext = parent;
  30807. }
  30808. return vnode
  30809. };
  30810. } else {
  30811. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  30812. }
  30813. }
  30814. installRenderHelpers(FunctionalRenderContext.prototype);
  30815. function createFunctionalComponent (
  30816. Ctor,
  30817. propsData,
  30818. data,
  30819. contextVm,
  30820. children
  30821. ) {
  30822. var options = Ctor.options;
  30823. var props = {};
  30824. var propOptions = options.props;
  30825. if (isDef(propOptions)) {
  30826. for (var key in propOptions) {
  30827. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  30828. }
  30829. } else {
  30830. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  30831. if (isDef(data.props)) { mergeProps(props, data.props); }
  30832. }
  30833. var renderContext = new FunctionalRenderContext(
  30834. data,
  30835. props,
  30836. children,
  30837. contextVm,
  30838. Ctor
  30839. );
  30840. var vnode = options.render.call(null, renderContext._c, renderContext);
  30841. if (vnode instanceof VNode) {
  30842. vnode.fnContext = contextVm;
  30843. vnode.fnOptions = options;
  30844. if (data.slot) {
  30845. (vnode.data || (vnode.data = {})).slot = data.slot;
  30846. }
  30847. }
  30848. return vnode
  30849. }
  30850. function mergeProps (to, from) {
  30851. for (var key in from) {
  30852. to[camelize(key)] = from[key];
  30853. }
  30854. }
  30855. /* */
  30856. // Register the component hook to weex native render engine.
  30857. // The hook will be triggered by native, not javascript.
  30858. // Updates the state of the component to weex native render engine.
  30859. /* */
  30860. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  30861. // listening on native callback
  30862. /* */
  30863. /* */
  30864. // hooks to be invoked on component VNodes during patch
  30865. var componentVNodeHooks = {
  30866. init: function init (
  30867. vnode,
  30868. hydrating,
  30869. parentElm,
  30870. refElm
  30871. ) {
  30872. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  30873. var child = vnode.componentInstance = createComponentInstanceForVnode(
  30874. vnode,
  30875. activeInstance,
  30876. parentElm,
  30877. refElm
  30878. );
  30879. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  30880. } else if (vnode.data.keepAlive) {
  30881. // kept-alive components, treat as a patch
  30882. var mountedNode = vnode; // work around flow
  30883. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  30884. }
  30885. },
  30886. prepatch: function prepatch (oldVnode, vnode) {
  30887. var options = vnode.componentOptions;
  30888. var child = vnode.componentInstance = oldVnode.componentInstance;
  30889. updateChildComponent(
  30890. child,
  30891. options.propsData, // updated props
  30892. options.listeners, // updated listeners
  30893. vnode, // new parent vnode
  30894. options.children // new children
  30895. );
  30896. },
  30897. insert: function insert (vnode) {
  30898. var context = vnode.context;
  30899. var componentInstance = vnode.componentInstance;
  30900. if (!componentInstance._isMounted) {
  30901. componentInstance._isMounted = true;
  30902. callHook(componentInstance, 'mounted');
  30903. }
  30904. if (vnode.data.keepAlive) {
  30905. if (context._isMounted) {
  30906. // vue-router#1212
  30907. // During updates, a kept-alive component's child components may
  30908. // change, so directly walking the tree here may call activated hooks
  30909. // on incorrect children. Instead we push them into a queue which will
  30910. // be processed after the whole patch process ended.
  30911. queueActivatedComponent(componentInstance);
  30912. } else {
  30913. activateChildComponent(componentInstance, true /* direct */);
  30914. }
  30915. }
  30916. },
  30917. destroy: function destroy (vnode) {
  30918. var componentInstance = vnode.componentInstance;
  30919. if (!componentInstance._isDestroyed) {
  30920. if (!vnode.data.keepAlive) {
  30921. componentInstance.$destroy();
  30922. } else {
  30923. deactivateChildComponent(componentInstance, true /* direct */);
  30924. }
  30925. }
  30926. }
  30927. };
  30928. var hooksToMerge = Object.keys(componentVNodeHooks);
  30929. function createComponent (
  30930. Ctor,
  30931. data,
  30932. context,
  30933. children,
  30934. tag
  30935. ) {
  30936. if (isUndef(Ctor)) {
  30937. return
  30938. }
  30939. var baseCtor = context.$options._base;
  30940. // plain options object: turn it into a constructor
  30941. if (isObject(Ctor)) {
  30942. Ctor = baseCtor.extend(Ctor);
  30943. }
  30944. // if at this stage it's not a constructor or an async component factory,
  30945. // reject.
  30946. if (typeof Ctor !== 'function') {
  30947. if (true) {
  30948. warn(("Invalid Component definition: " + (String(Ctor))), context);
  30949. }
  30950. return
  30951. }
  30952. // async component
  30953. var asyncFactory;
  30954. if (isUndef(Ctor.cid)) {
  30955. asyncFactory = Ctor;
  30956. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  30957. if (Ctor === undefined) {
  30958. // return a placeholder node for async component, which is rendered
  30959. // as a comment node but preserves all the raw information for the node.
  30960. // the information will be used for async server-rendering and hydration.
  30961. return createAsyncPlaceholder(
  30962. asyncFactory,
  30963. data,
  30964. context,
  30965. children,
  30966. tag
  30967. )
  30968. }
  30969. }
  30970. data = data || {};
  30971. // resolve constructor options in case global mixins are applied after
  30972. // component constructor creation
  30973. resolveConstructorOptions(Ctor);
  30974. // transform component v-model data into props & events
  30975. if (isDef(data.model)) {
  30976. transformModel(Ctor.options, data);
  30977. }
  30978. // extract props
  30979. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  30980. // functional component
  30981. if (isTrue(Ctor.options.functional)) {
  30982. return createFunctionalComponent(Ctor, propsData, data, context, children)
  30983. }
  30984. // extract listeners, since these needs to be treated as
  30985. // child component listeners instead of DOM listeners
  30986. var listeners = data.on;
  30987. // replace with listeners with .native modifier
  30988. // so it gets processed during parent component patch.
  30989. data.on = data.nativeOn;
  30990. if (isTrue(Ctor.options.abstract)) {
  30991. // abstract components do not keep anything
  30992. // other than props & listeners & slot
  30993. // work around flow
  30994. var slot = data.slot;
  30995. data = {};
  30996. if (slot) {
  30997. data.slot = slot;
  30998. }
  30999. }
  31000. // merge component management hooks onto the placeholder node
  31001. mergeHooks(data);
  31002. // return a placeholder vnode
  31003. var name = Ctor.options.name || tag;
  31004. var vnode = new VNode(
  31005. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  31006. data, undefined, undefined, undefined, context,
  31007. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  31008. asyncFactory
  31009. );
  31010. // Weex specific: invoke recycle-list optimized @render function for
  31011. // extracting cell-slot template.
  31012. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  31013. /* istanbul ignore if */
  31014. return vnode
  31015. }
  31016. function createComponentInstanceForVnode (
  31017. vnode, // we know it's MountedComponentVNode but flow doesn't
  31018. parent, // activeInstance in lifecycle state
  31019. parentElm,
  31020. refElm
  31021. ) {
  31022. var options = {
  31023. _isComponent: true,
  31024. parent: parent,
  31025. _parentVnode: vnode,
  31026. _parentElm: parentElm || null,
  31027. _refElm: refElm || null
  31028. };
  31029. // check inline-template render functions
  31030. var inlineTemplate = vnode.data.inlineTemplate;
  31031. if (isDef(inlineTemplate)) {
  31032. options.render = inlineTemplate.render;
  31033. options.staticRenderFns = inlineTemplate.staticRenderFns;
  31034. }
  31035. return new vnode.componentOptions.Ctor(options)
  31036. }
  31037. function mergeHooks (data) {
  31038. if (!data.hook) {
  31039. data.hook = {};
  31040. }
  31041. for (var i = 0; i < hooksToMerge.length; i++) {
  31042. var key = hooksToMerge[i];
  31043. var fromParent = data.hook[key];
  31044. var ours = componentVNodeHooks[key];
  31045. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  31046. }
  31047. }
  31048. function mergeHook$1 (one, two) {
  31049. return function (a, b, c, d) {
  31050. one(a, b, c, d);
  31051. two(a, b, c, d);
  31052. }
  31053. }
  31054. // transform component v-model info (value and callback) into
  31055. // prop and event handler respectively.
  31056. function transformModel (options, data) {
  31057. var prop = (options.model && options.model.prop) || 'value';
  31058. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  31059. var on = data.on || (data.on = {});
  31060. if (isDef(on[event])) {
  31061. on[event] = [data.model.callback].concat(on[event]);
  31062. } else {
  31063. on[event] = data.model.callback;
  31064. }
  31065. }
  31066. /* */
  31067. var SIMPLE_NORMALIZE = 1;
  31068. var ALWAYS_NORMALIZE = 2;
  31069. // wrapper function for providing a more flexible interface
  31070. // without getting yelled at by flow
  31071. function createElement (
  31072. context,
  31073. tag,
  31074. data,
  31075. children,
  31076. normalizationType,
  31077. alwaysNormalize
  31078. ) {
  31079. if (Array.isArray(data) || isPrimitive(data)) {
  31080. normalizationType = children;
  31081. children = data;
  31082. data = undefined;
  31083. }
  31084. if (isTrue(alwaysNormalize)) {
  31085. normalizationType = ALWAYS_NORMALIZE;
  31086. }
  31087. return _createElement(context, tag, data, children, normalizationType)
  31088. }
  31089. function _createElement (
  31090. context,
  31091. tag,
  31092. data,
  31093. children,
  31094. normalizationType
  31095. ) {
  31096. if (isDef(data) && isDef((data).__ob__)) {
  31097. "development" !== 'production' && warn(
  31098. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  31099. 'Always create fresh vnode data objects in each render!',
  31100. context
  31101. );
  31102. return createEmptyVNode()
  31103. }
  31104. // object syntax in v-bind
  31105. if (isDef(data) && isDef(data.is)) {
  31106. tag = data.is;
  31107. }
  31108. if (!tag) {
  31109. // in case of component :is set to falsy value
  31110. return createEmptyVNode()
  31111. }
  31112. // warn against non-primitive key
  31113. if ("development" !== 'production' &&
  31114. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  31115. ) {
  31116. {
  31117. warn(
  31118. 'Avoid using non-primitive value as key, ' +
  31119. 'use string/number value instead.',
  31120. context
  31121. );
  31122. }
  31123. }
  31124. // support single function children as default scoped slot
  31125. if (Array.isArray(children) &&
  31126. typeof children[0] === 'function'
  31127. ) {
  31128. data = data || {};
  31129. data.scopedSlots = { default: children[0] };
  31130. children.length = 0;
  31131. }
  31132. if (normalizationType === ALWAYS_NORMALIZE) {
  31133. children = normalizeChildren(children);
  31134. } else if (normalizationType === SIMPLE_NORMALIZE) {
  31135. children = simpleNormalizeChildren(children);
  31136. }
  31137. var vnode, ns;
  31138. if (typeof tag === 'string') {
  31139. var Ctor;
  31140. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  31141. if (config.isReservedTag(tag)) {
  31142. // platform built-in elements
  31143. vnode = new VNode(
  31144. config.parsePlatformTagName(tag), data, children,
  31145. undefined, undefined, context
  31146. );
  31147. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  31148. // component
  31149. vnode = createComponent(Ctor, data, context, children, tag);
  31150. } else {
  31151. // unknown or unlisted namespaced elements
  31152. // check at runtime because it may get assigned a namespace when its
  31153. // parent normalizes children
  31154. vnode = new VNode(
  31155. tag, data, children,
  31156. undefined, undefined, context
  31157. );
  31158. }
  31159. } else {
  31160. // direct component options / constructor
  31161. vnode = createComponent(tag, data, context, children);
  31162. }
  31163. if (isDef(vnode)) {
  31164. if (ns) { applyNS(vnode, ns); }
  31165. return vnode
  31166. } else {
  31167. return createEmptyVNode()
  31168. }
  31169. }
  31170. function applyNS (vnode, ns, force) {
  31171. vnode.ns = ns;
  31172. if (vnode.tag === 'foreignObject') {
  31173. // use default namespace inside foreignObject
  31174. ns = undefined;
  31175. force = true;
  31176. }
  31177. if (isDef(vnode.children)) {
  31178. for (var i = 0, l = vnode.children.length; i < l; i++) {
  31179. var child = vnode.children[i];
  31180. if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force))) {
  31181. applyNS(child, ns, force);
  31182. }
  31183. }
  31184. }
  31185. }
  31186. /* */
  31187. function initRender (vm) {
  31188. vm._vnode = null; // the root of the child tree
  31189. vm._staticTrees = null; // v-once cached trees
  31190. var options = vm.$options;
  31191. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  31192. var renderContext = parentVnode && parentVnode.context;
  31193. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  31194. vm.$scopedSlots = emptyObject;
  31195. // bind the createElement fn to this instance
  31196. // so that we get proper render context inside it.
  31197. // args order: tag, data, children, normalizationType, alwaysNormalize
  31198. // internal version is used by render functions compiled from templates
  31199. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  31200. // normalization is always applied for the public version, used in
  31201. // user-written render functions.
  31202. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  31203. // $attrs & $listeners are exposed for easier HOC creation.
  31204. // they need to be reactive so that HOCs using them are always updated
  31205. var parentData = parentVnode && parentVnode.data;
  31206. /* istanbul ignore else */
  31207. if (true) {
  31208. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  31209. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  31210. }, true);
  31211. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  31212. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  31213. }, true);
  31214. } else {
  31215. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  31216. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  31217. }
  31218. }
  31219. function renderMixin (Vue) {
  31220. // install runtime convenience helpers
  31221. installRenderHelpers(Vue.prototype);
  31222. Vue.prototype.$nextTick = function (fn) {
  31223. return nextTick(fn, this)
  31224. };
  31225. Vue.prototype._render = function () {
  31226. var vm = this;
  31227. var ref = vm.$options;
  31228. var render = ref.render;
  31229. var _parentVnode = ref._parentVnode;
  31230. if (vm._isMounted) {
  31231. // if the parent didn't update, the slot nodes will be the ones from
  31232. // last render. They need to be cloned to ensure "freshness" for this render.
  31233. for (var key in vm.$slots) {
  31234. var slot = vm.$slots[key];
  31235. // _rendered is a flag added by renderSlot, but may not be present
  31236. // if the slot is passed from manually written render functions
  31237. if (slot._rendered || (slot[0] && slot[0].elm)) {
  31238. vm.$slots[key] = cloneVNodes(slot, true /* deep */);
  31239. }
  31240. }
  31241. }
  31242. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  31243. // set parent vnode. this allows render functions to have access
  31244. // to the data on the placeholder node.
  31245. vm.$vnode = _parentVnode;
  31246. // render self
  31247. var vnode;
  31248. try {
  31249. vnode = render.call(vm._renderProxy, vm.$createElement);
  31250. } catch (e) {
  31251. handleError(e, vm, "render");
  31252. // return error render result,
  31253. // or previous vnode to prevent render error causing blank component
  31254. /* istanbul ignore else */
  31255. if (true) {
  31256. if (vm.$options.renderError) {
  31257. try {
  31258. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  31259. } catch (e) {
  31260. handleError(e, vm, "renderError");
  31261. vnode = vm._vnode;
  31262. }
  31263. } else {
  31264. vnode = vm._vnode;
  31265. }
  31266. } else {
  31267. vnode = vm._vnode;
  31268. }
  31269. }
  31270. // return empty vnode in case the render function errored out
  31271. if (!(vnode instanceof VNode)) {
  31272. if ("development" !== 'production' && Array.isArray(vnode)) {
  31273. warn(
  31274. 'Multiple root nodes returned from render function. Render function ' +
  31275. 'should return a single root node.',
  31276. vm
  31277. );
  31278. }
  31279. vnode = createEmptyVNode();
  31280. }
  31281. // set parent
  31282. vnode.parent = _parentVnode;
  31283. return vnode
  31284. };
  31285. }
  31286. /* */
  31287. var uid$1 = 0;
  31288. function initMixin (Vue) {
  31289. Vue.prototype._init = function (options) {
  31290. var vm = this;
  31291. // a uid
  31292. vm._uid = uid$1++;
  31293. var startTag, endTag;
  31294. /* istanbul ignore if */
  31295. if ("development" !== 'production' && config.performance && mark) {
  31296. startTag = "vue-perf-start:" + (vm._uid);
  31297. endTag = "vue-perf-end:" + (vm._uid);
  31298. mark(startTag);
  31299. }
  31300. // a flag to avoid this being observed
  31301. vm._isVue = true;
  31302. // merge options
  31303. if (options && options._isComponent) {
  31304. // optimize internal component instantiation
  31305. // since dynamic options merging is pretty slow, and none of the
  31306. // internal component options needs special treatment.
  31307. initInternalComponent(vm, options);
  31308. } else {
  31309. vm.$options = mergeOptions(
  31310. resolveConstructorOptions(vm.constructor),
  31311. options || {},
  31312. vm
  31313. );
  31314. }
  31315. /* istanbul ignore else */
  31316. if (true) {
  31317. initProxy(vm);
  31318. } else {
  31319. vm._renderProxy = vm;
  31320. }
  31321. // expose real self
  31322. vm._self = vm;
  31323. initLifecycle(vm);
  31324. initEvents(vm);
  31325. initRender(vm);
  31326. callHook(vm, 'beforeCreate');
  31327. initInjections(vm); // resolve injections before data/props
  31328. initState(vm);
  31329. initProvide(vm); // resolve provide after data/props
  31330. callHook(vm, 'created');
  31331. /* istanbul ignore if */
  31332. if ("development" !== 'production' && config.performance && mark) {
  31333. vm._name = formatComponentName(vm, false);
  31334. mark(endTag);
  31335. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  31336. }
  31337. if (vm.$options.el) {
  31338. vm.$mount(vm.$options.el);
  31339. }
  31340. };
  31341. }
  31342. function initInternalComponent (vm, options) {
  31343. var opts = vm.$options = Object.create(vm.constructor.options);
  31344. // doing this because it's faster than dynamic enumeration.
  31345. var parentVnode = options._parentVnode;
  31346. opts.parent = options.parent;
  31347. opts._parentVnode = parentVnode;
  31348. opts._parentElm = options._parentElm;
  31349. opts._refElm = options._refElm;
  31350. var vnodeComponentOptions = parentVnode.componentOptions;
  31351. opts.propsData = vnodeComponentOptions.propsData;
  31352. opts._parentListeners = vnodeComponentOptions.listeners;
  31353. opts._renderChildren = vnodeComponentOptions.children;
  31354. opts._componentTag = vnodeComponentOptions.tag;
  31355. if (options.render) {
  31356. opts.render = options.render;
  31357. opts.staticRenderFns = options.staticRenderFns;
  31358. }
  31359. }
  31360. function resolveConstructorOptions (Ctor) {
  31361. var options = Ctor.options;
  31362. if (Ctor.super) {
  31363. var superOptions = resolveConstructorOptions(Ctor.super);
  31364. var cachedSuperOptions = Ctor.superOptions;
  31365. if (superOptions !== cachedSuperOptions) {
  31366. // super option changed,
  31367. // need to resolve new options.
  31368. Ctor.superOptions = superOptions;
  31369. // check if there are any late-modified/attached options (#4976)
  31370. var modifiedOptions = resolveModifiedOptions(Ctor);
  31371. // update base extend options
  31372. if (modifiedOptions) {
  31373. extend(Ctor.extendOptions, modifiedOptions);
  31374. }
  31375. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  31376. if (options.name) {
  31377. options.components[options.name] = Ctor;
  31378. }
  31379. }
  31380. }
  31381. return options
  31382. }
  31383. function resolveModifiedOptions (Ctor) {
  31384. var modified;
  31385. var latest = Ctor.options;
  31386. var extended = Ctor.extendOptions;
  31387. var sealed = Ctor.sealedOptions;
  31388. for (var key in latest) {
  31389. if (latest[key] !== sealed[key]) {
  31390. if (!modified) { modified = {}; }
  31391. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  31392. }
  31393. }
  31394. return modified
  31395. }
  31396. function dedupe (latest, extended, sealed) {
  31397. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  31398. // between merges
  31399. if (Array.isArray(latest)) {
  31400. var res = [];
  31401. sealed = Array.isArray(sealed) ? sealed : [sealed];
  31402. extended = Array.isArray(extended) ? extended : [extended];
  31403. for (var i = 0; i < latest.length; i++) {
  31404. // push original options and not sealed options to exclude duplicated options
  31405. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  31406. res.push(latest[i]);
  31407. }
  31408. }
  31409. return res
  31410. } else {
  31411. return latest
  31412. }
  31413. }
  31414. function Vue$3 (options) {
  31415. if ("development" !== 'production' &&
  31416. !(this instanceof Vue$3)
  31417. ) {
  31418. warn('Vue is a constructor and should be called with the `new` keyword');
  31419. }
  31420. this._init(options);
  31421. }
  31422. initMixin(Vue$3);
  31423. stateMixin(Vue$3);
  31424. eventsMixin(Vue$3);
  31425. lifecycleMixin(Vue$3);
  31426. renderMixin(Vue$3);
  31427. /* */
  31428. function initUse (Vue) {
  31429. Vue.use = function (plugin) {
  31430. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  31431. if (installedPlugins.indexOf(plugin) > -1) {
  31432. return this
  31433. }
  31434. // additional parameters
  31435. var args = toArray(arguments, 1);
  31436. args.unshift(this);
  31437. if (typeof plugin.install === 'function') {
  31438. plugin.install.apply(plugin, args);
  31439. } else if (typeof plugin === 'function') {
  31440. plugin.apply(null, args);
  31441. }
  31442. installedPlugins.push(plugin);
  31443. return this
  31444. };
  31445. }
  31446. /* */
  31447. function initMixin$1 (Vue) {
  31448. Vue.mixin = function (mixin) {
  31449. this.options = mergeOptions(this.options, mixin);
  31450. return this
  31451. };
  31452. }
  31453. /* */
  31454. function initExtend (Vue) {
  31455. /**
  31456. * Each instance constructor, including Vue, has a unique
  31457. * cid. This enables us to create wrapped "child
  31458. * constructors" for prototypal inheritance and cache them.
  31459. */
  31460. Vue.cid = 0;
  31461. var cid = 1;
  31462. /**
  31463. * Class inheritance
  31464. */
  31465. Vue.extend = function (extendOptions) {
  31466. extendOptions = extendOptions || {};
  31467. var Super = this;
  31468. var SuperId = Super.cid;
  31469. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  31470. if (cachedCtors[SuperId]) {
  31471. return cachedCtors[SuperId]
  31472. }
  31473. var name = extendOptions.name || Super.options.name;
  31474. if ("development" !== 'production' && name) {
  31475. validateComponentName(name);
  31476. }
  31477. var Sub = function VueComponent (options) {
  31478. this._init(options);
  31479. };
  31480. Sub.prototype = Object.create(Super.prototype);
  31481. Sub.prototype.constructor = Sub;
  31482. Sub.cid = cid++;
  31483. Sub.options = mergeOptions(
  31484. Super.options,
  31485. extendOptions
  31486. );
  31487. Sub['super'] = Super;
  31488. // For props and computed properties, we define the proxy getters on
  31489. // the Vue instances at extension time, on the extended prototype. This
  31490. // avoids Object.defineProperty calls for each instance created.
  31491. if (Sub.options.props) {
  31492. initProps$1(Sub);
  31493. }
  31494. if (Sub.options.computed) {
  31495. initComputed$1(Sub);
  31496. }
  31497. // allow further extension/mixin/plugin usage
  31498. Sub.extend = Super.extend;
  31499. Sub.mixin = Super.mixin;
  31500. Sub.use = Super.use;
  31501. // create asset registers, so extended classes
  31502. // can have their private assets too.
  31503. ASSET_TYPES.forEach(function (type) {
  31504. Sub[type] = Super[type];
  31505. });
  31506. // enable recursive self-lookup
  31507. if (name) {
  31508. Sub.options.components[name] = Sub;
  31509. }
  31510. // keep a reference to the super options at extension time.
  31511. // later at instantiation we can check if Super's options have
  31512. // been updated.
  31513. Sub.superOptions = Super.options;
  31514. Sub.extendOptions = extendOptions;
  31515. Sub.sealedOptions = extend({}, Sub.options);
  31516. // cache constructor
  31517. cachedCtors[SuperId] = Sub;
  31518. return Sub
  31519. };
  31520. }
  31521. function initProps$1 (Comp) {
  31522. var props = Comp.options.props;
  31523. for (var key in props) {
  31524. proxy(Comp.prototype, "_props", key);
  31525. }
  31526. }
  31527. function initComputed$1 (Comp) {
  31528. var computed = Comp.options.computed;
  31529. for (var key in computed) {
  31530. defineComputed(Comp.prototype, key, computed[key]);
  31531. }
  31532. }
  31533. /* */
  31534. function initAssetRegisters (Vue) {
  31535. /**
  31536. * Create asset registration methods.
  31537. */
  31538. ASSET_TYPES.forEach(function (type) {
  31539. Vue[type] = function (
  31540. id,
  31541. definition
  31542. ) {
  31543. if (!definition) {
  31544. return this.options[type + 's'][id]
  31545. } else {
  31546. /* istanbul ignore if */
  31547. if ("development" !== 'production' && type === 'component') {
  31548. validateComponentName(id);
  31549. }
  31550. if (type === 'component' && isPlainObject(definition)) {
  31551. definition.name = definition.name || id;
  31552. definition = this.options._base.extend(definition);
  31553. }
  31554. if (type === 'directive' && typeof definition === 'function') {
  31555. definition = { bind: definition, update: definition };
  31556. }
  31557. this.options[type + 's'][id] = definition;
  31558. return definition
  31559. }
  31560. };
  31561. });
  31562. }
  31563. /* */
  31564. function getComponentName (opts) {
  31565. return opts && (opts.Ctor.options.name || opts.tag)
  31566. }
  31567. function matches (pattern, name) {
  31568. if (Array.isArray(pattern)) {
  31569. return pattern.indexOf(name) > -1
  31570. } else if (typeof pattern === 'string') {
  31571. return pattern.split(',').indexOf(name) > -1
  31572. } else if (isRegExp(pattern)) {
  31573. return pattern.test(name)
  31574. }
  31575. /* istanbul ignore next */
  31576. return false
  31577. }
  31578. function pruneCache (keepAliveInstance, filter) {
  31579. var cache = keepAliveInstance.cache;
  31580. var keys = keepAliveInstance.keys;
  31581. var _vnode = keepAliveInstance._vnode;
  31582. for (var key in cache) {
  31583. var cachedNode = cache[key];
  31584. if (cachedNode) {
  31585. var name = getComponentName(cachedNode.componentOptions);
  31586. if (name && !filter(name)) {
  31587. pruneCacheEntry(cache, key, keys, _vnode);
  31588. }
  31589. }
  31590. }
  31591. }
  31592. function pruneCacheEntry (
  31593. cache,
  31594. key,
  31595. keys,
  31596. current
  31597. ) {
  31598. var cached$$1 = cache[key];
  31599. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  31600. cached$$1.componentInstance.$destroy();
  31601. }
  31602. cache[key] = null;
  31603. remove(keys, key);
  31604. }
  31605. var patternTypes = [String, RegExp, Array];
  31606. var KeepAlive = {
  31607. name: 'keep-alive',
  31608. abstract: true,
  31609. props: {
  31610. include: patternTypes,
  31611. exclude: patternTypes,
  31612. max: [String, Number]
  31613. },
  31614. created: function created () {
  31615. this.cache = Object.create(null);
  31616. this.keys = [];
  31617. },
  31618. destroyed: function destroyed () {
  31619. var this$1 = this;
  31620. for (var key in this$1.cache) {
  31621. pruneCacheEntry(this$1.cache, key, this$1.keys);
  31622. }
  31623. },
  31624. watch: {
  31625. include: function include (val) {
  31626. pruneCache(this, function (name) { return matches(val, name); });
  31627. },
  31628. exclude: function exclude (val) {
  31629. pruneCache(this, function (name) { return !matches(val, name); });
  31630. }
  31631. },
  31632. render: function render () {
  31633. var slot = this.$slots.default;
  31634. var vnode = getFirstComponentChild(slot);
  31635. var componentOptions = vnode && vnode.componentOptions;
  31636. if (componentOptions) {
  31637. // check pattern
  31638. var name = getComponentName(componentOptions);
  31639. var ref = this;
  31640. var include = ref.include;
  31641. var exclude = ref.exclude;
  31642. if (
  31643. // not included
  31644. (include && (!name || !matches(include, name))) ||
  31645. // excluded
  31646. (exclude && name && matches(exclude, name))
  31647. ) {
  31648. return vnode
  31649. }
  31650. var ref$1 = this;
  31651. var cache = ref$1.cache;
  31652. var keys = ref$1.keys;
  31653. var key = vnode.key == null
  31654. // same constructor may get registered as different local components
  31655. // so cid alone is not enough (#3269)
  31656. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  31657. : vnode.key;
  31658. if (cache[key]) {
  31659. vnode.componentInstance = cache[key].componentInstance;
  31660. // make current key freshest
  31661. remove(keys, key);
  31662. keys.push(key);
  31663. } else {
  31664. cache[key] = vnode;
  31665. keys.push(key);
  31666. // prune oldest entry
  31667. if (this.max && keys.length > parseInt(this.max)) {
  31668. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  31669. }
  31670. }
  31671. vnode.data.keepAlive = true;
  31672. }
  31673. return vnode || (slot && slot[0])
  31674. }
  31675. };
  31676. var builtInComponents = {
  31677. KeepAlive: KeepAlive
  31678. };
  31679. /* */
  31680. function initGlobalAPI (Vue) {
  31681. // config
  31682. var configDef = {};
  31683. configDef.get = function () { return config; };
  31684. if (true) {
  31685. configDef.set = function () {
  31686. warn(
  31687. 'Do not replace the Vue.config object, set individual fields instead.'
  31688. );
  31689. };
  31690. }
  31691. Object.defineProperty(Vue, 'config', configDef);
  31692. // exposed util methods.
  31693. // NOTE: these are not considered part of the public API - avoid relying on
  31694. // them unless you are aware of the risk.
  31695. Vue.util = {
  31696. warn: warn,
  31697. extend: extend,
  31698. mergeOptions: mergeOptions,
  31699. defineReactive: defineReactive
  31700. };
  31701. Vue.set = set;
  31702. Vue.delete = del;
  31703. Vue.nextTick = nextTick;
  31704. Vue.options = Object.create(null);
  31705. ASSET_TYPES.forEach(function (type) {
  31706. Vue.options[type + 's'] = Object.create(null);
  31707. });
  31708. // this is used to identify the "base" constructor to extend all plain-object
  31709. // components with in Weex's multi-instance scenarios.
  31710. Vue.options._base = Vue;
  31711. extend(Vue.options.components, builtInComponents);
  31712. initUse(Vue);
  31713. initMixin$1(Vue);
  31714. initExtend(Vue);
  31715. initAssetRegisters(Vue);
  31716. }
  31717. initGlobalAPI(Vue$3);
  31718. Object.defineProperty(Vue$3.prototype, '$isServer', {
  31719. get: isServerRendering
  31720. });
  31721. Object.defineProperty(Vue$3.prototype, '$ssrContext', {
  31722. get: function get () {
  31723. /* istanbul ignore next */
  31724. return this.$vnode && this.$vnode.ssrContext
  31725. }
  31726. });
  31727. Vue$3.version = '2.5.13';
  31728. /* */
  31729. // these are reserved for web because they are directly compiled away
  31730. // during template compilation
  31731. var isReservedAttr = makeMap('style,class');
  31732. // attributes that should be using props for binding
  31733. var acceptValue = makeMap('input,textarea,option,select,progress');
  31734. var mustUseProp = function (tag, type, attr) {
  31735. return (
  31736. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  31737. (attr === 'selected' && tag === 'option') ||
  31738. (attr === 'checked' && tag === 'input') ||
  31739. (attr === 'muted' && tag === 'video')
  31740. )
  31741. };
  31742. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  31743. var isBooleanAttr = makeMap(
  31744. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  31745. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  31746. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  31747. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  31748. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  31749. 'truespeed,typemustmatch,visible'
  31750. );
  31751. var xlinkNS = 'http://www.w3.org/1999/xlink';
  31752. var isXlink = function (name) {
  31753. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  31754. };
  31755. var getXlinkProp = function (name) {
  31756. return isXlink(name) ? name.slice(6, name.length) : ''
  31757. };
  31758. var isFalsyAttrValue = function (val) {
  31759. return val == null || val === false
  31760. };
  31761. /* */
  31762. function genClassForVnode (vnode) {
  31763. var data = vnode.data;
  31764. var parentNode = vnode;
  31765. var childNode = vnode;
  31766. while (isDef(childNode.componentInstance)) {
  31767. childNode = childNode.componentInstance._vnode;
  31768. if (childNode && childNode.data) {
  31769. data = mergeClassData(childNode.data, data);
  31770. }
  31771. }
  31772. while (isDef(parentNode = parentNode.parent)) {
  31773. if (parentNode && parentNode.data) {
  31774. data = mergeClassData(data, parentNode.data);
  31775. }
  31776. }
  31777. return renderClass(data.staticClass, data.class)
  31778. }
  31779. function mergeClassData (child, parent) {
  31780. return {
  31781. staticClass: concat(child.staticClass, parent.staticClass),
  31782. class: isDef(child.class)
  31783. ? [child.class, parent.class]
  31784. : parent.class
  31785. }
  31786. }
  31787. function renderClass (
  31788. staticClass,
  31789. dynamicClass
  31790. ) {
  31791. if (isDef(staticClass) || isDef(dynamicClass)) {
  31792. return concat(staticClass, stringifyClass(dynamicClass))
  31793. }
  31794. /* istanbul ignore next */
  31795. return ''
  31796. }
  31797. function concat (a, b) {
  31798. return a ? b ? (a + ' ' + b) : a : (b || '')
  31799. }
  31800. function stringifyClass (value) {
  31801. if (Array.isArray(value)) {
  31802. return stringifyArray(value)
  31803. }
  31804. if (isObject(value)) {
  31805. return stringifyObject(value)
  31806. }
  31807. if (typeof value === 'string') {
  31808. return value
  31809. }
  31810. /* istanbul ignore next */
  31811. return ''
  31812. }
  31813. function stringifyArray (value) {
  31814. var res = '';
  31815. var stringified;
  31816. for (var i = 0, l = value.length; i < l; i++) {
  31817. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  31818. if (res) { res += ' '; }
  31819. res += stringified;
  31820. }
  31821. }
  31822. return res
  31823. }
  31824. function stringifyObject (value) {
  31825. var res = '';
  31826. for (var key in value) {
  31827. if (value[key]) {
  31828. if (res) { res += ' '; }
  31829. res += key;
  31830. }
  31831. }
  31832. return res
  31833. }
  31834. /* */
  31835. var namespaceMap = {
  31836. svg: 'http://www.w3.org/2000/svg',
  31837. math: 'http://www.w3.org/1998/Math/MathML'
  31838. };
  31839. var isHTMLTag = makeMap(
  31840. 'html,body,base,head,link,meta,style,title,' +
  31841. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  31842. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  31843. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  31844. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  31845. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  31846. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  31847. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  31848. 'output,progress,select,textarea,' +
  31849. 'details,dialog,menu,menuitem,summary,' +
  31850. 'content,element,shadow,template,blockquote,iframe,tfoot'
  31851. );
  31852. // this map is intentionally selective, only covering SVG elements that may
  31853. // contain child elements.
  31854. var isSVG = makeMap(
  31855. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  31856. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  31857. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  31858. true
  31859. );
  31860. var isPreTag = function (tag) { return tag === 'pre'; };
  31861. var isReservedTag = function (tag) {
  31862. return isHTMLTag(tag) || isSVG(tag)
  31863. };
  31864. function getTagNamespace (tag) {
  31865. if (isSVG(tag)) {
  31866. return 'svg'
  31867. }
  31868. // basic support for MathML
  31869. // note it doesn't support other MathML elements being component roots
  31870. if (tag === 'math') {
  31871. return 'math'
  31872. }
  31873. }
  31874. var unknownElementCache = Object.create(null);
  31875. function isUnknownElement (tag) {
  31876. /* istanbul ignore if */
  31877. if (!inBrowser) {
  31878. return true
  31879. }
  31880. if (isReservedTag(tag)) {
  31881. return false
  31882. }
  31883. tag = tag.toLowerCase();
  31884. /* istanbul ignore if */
  31885. if (unknownElementCache[tag] != null) {
  31886. return unknownElementCache[tag]
  31887. }
  31888. var el = document.createElement(tag);
  31889. if (tag.indexOf('-') > -1) {
  31890. // http://stackoverflow.com/a/28210364/1070244
  31891. return (unknownElementCache[tag] = (
  31892. el.constructor === window.HTMLUnknownElement ||
  31893. el.constructor === window.HTMLElement
  31894. ))
  31895. } else {
  31896. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  31897. }
  31898. }
  31899. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  31900. /* */
  31901. /**
  31902. * Query an element selector if it's not an element already.
  31903. */
  31904. function query (el) {
  31905. if (typeof el === 'string') {
  31906. var selected = document.querySelector(el);
  31907. if (!selected) {
  31908. "development" !== 'production' && warn(
  31909. 'Cannot find element: ' + el
  31910. );
  31911. return document.createElement('div')
  31912. }
  31913. return selected
  31914. } else {
  31915. return el
  31916. }
  31917. }
  31918. /* */
  31919. function createElement$1 (tagName, vnode) {
  31920. var elm = document.createElement(tagName);
  31921. if (tagName !== 'select') {
  31922. return elm
  31923. }
  31924. // false or null will remove the attribute but undefined will not
  31925. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  31926. elm.setAttribute('multiple', 'multiple');
  31927. }
  31928. return elm
  31929. }
  31930. function createElementNS (namespace, tagName) {
  31931. return document.createElementNS(namespaceMap[namespace], tagName)
  31932. }
  31933. function createTextNode (text) {
  31934. return document.createTextNode(text)
  31935. }
  31936. function createComment (text) {
  31937. return document.createComment(text)
  31938. }
  31939. function insertBefore (parentNode, newNode, referenceNode) {
  31940. parentNode.insertBefore(newNode, referenceNode);
  31941. }
  31942. function removeChild (node, child) {
  31943. node.removeChild(child);
  31944. }
  31945. function appendChild (node, child) {
  31946. node.appendChild(child);
  31947. }
  31948. function parentNode (node) {
  31949. return node.parentNode
  31950. }
  31951. function nextSibling (node) {
  31952. return node.nextSibling
  31953. }
  31954. function tagName (node) {
  31955. return node.tagName
  31956. }
  31957. function setTextContent (node, text) {
  31958. node.textContent = text;
  31959. }
  31960. function setAttribute (node, key, val) {
  31961. node.setAttribute(key, val);
  31962. }
  31963. var nodeOps = Object.freeze({
  31964. createElement: createElement$1,
  31965. createElementNS: createElementNS,
  31966. createTextNode: createTextNode,
  31967. createComment: createComment,
  31968. insertBefore: insertBefore,
  31969. removeChild: removeChild,
  31970. appendChild: appendChild,
  31971. parentNode: parentNode,
  31972. nextSibling: nextSibling,
  31973. tagName: tagName,
  31974. setTextContent: setTextContent,
  31975. setAttribute: setAttribute
  31976. });
  31977. /* */
  31978. var ref = {
  31979. create: function create (_, vnode) {
  31980. registerRef(vnode);
  31981. },
  31982. update: function update (oldVnode, vnode) {
  31983. if (oldVnode.data.ref !== vnode.data.ref) {
  31984. registerRef(oldVnode, true);
  31985. registerRef(vnode);
  31986. }
  31987. },
  31988. destroy: function destroy (vnode) {
  31989. registerRef(vnode, true);
  31990. }
  31991. };
  31992. function registerRef (vnode, isRemoval) {
  31993. var key = vnode.data.ref;
  31994. if (!key) { return }
  31995. var vm = vnode.context;
  31996. var ref = vnode.componentInstance || vnode.elm;
  31997. var refs = vm.$refs;
  31998. if (isRemoval) {
  31999. if (Array.isArray(refs[key])) {
  32000. remove(refs[key], ref);
  32001. } else if (refs[key] === ref) {
  32002. refs[key] = undefined;
  32003. }
  32004. } else {
  32005. if (vnode.data.refInFor) {
  32006. if (!Array.isArray(refs[key])) {
  32007. refs[key] = [ref];
  32008. } else if (refs[key].indexOf(ref) < 0) {
  32009. // $flow-disable-line
  32010. refs[key].push(ref);
  32011. }
  32012. } else {
  32013. refs[key] = ref;
  32014. }
  32015. }
  32016. }
  32017. /**
  32018. * Virtual DOM patching algorithm based on Snabbdom by
  32019. * Simon Friis Vindum (@paldepind)
  32020. * Licensed under the MIT License
  32021. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  32022. *
  32023. * modified by Evan You (@yyx990803)
  32024. *
  32025. * Not type-checking this because this file is perf-critical and the cost
  32026. * of making flow understand it is not worth it.
  32027. */
  32028. var emptyNode = new VNode('', {}, []);
  32029. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  32030. function sameVnode (a, b) {
  32031. return (
  32032. a.key === b.key && (
  32033. (
  32034. a.tag === b.tag &&
  32035. a.isComment === b.isComment &&
  32036. isDef(a.data) === isDef(b.data) &&
  32037. sameInputType(a, b)
  32038. ) || (
  32039. isTrue(a.isAsyncPlaceholder) &&
  32040. a.asyncFactory === b.asyncFactory &&
  32041. isUndef(b.asyncFactory.error)
  32042. )
  32043. )
  32044. )
  32045. }
  32046. function sameInputType (a, b) {
  32047. if (a.tag !== 'input') { return true }
  32048. var i;
  32049. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  32050. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  32051. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  32052. }
  32053. function createKeyToOldIdx (children, beginIdx, endIdx) {
  32054. var i, key;
  32055. var map = {};
  32056. for (i = beginIdx; i <= endIdx; ++i) {
  32057. key = children[i].key;
  32058. if (isDef(key)) { map[key] = i; }
  32059. }
  32060. return map
  32061. }
  32062. function createPatchFunction (backend) {
  32063. var i, j;
  32064. var cbs = {};
  32065. var modules = backend.modules;
  32066. var nodeOps = backend.nodeOps;
  32067. for (i = 0; i < hooks.length; ++i) {
  32068. cbs[hooks[i]] = [];
  32069. for (j = 0; j < modules.length; ++j) {
  32070. if (isDef(modules[j][hooks[i]])) {
  32071. cbs[hooks[i]].push(modules[j][hooks[i]]);
  32072. }
  32073. }
  32074. }
  32075. function emptyNodeAt (elm) {
  32076. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  32077. }
  32078. function createRmCb (childElm, listeners) {
  32079. function remove () {
  32080. if (--remove.listeners === 0) {
  32081. removeNode(childElm);
  32082. }
  32083. }
  32084. remove.listeners = listeners;
  32085. return remove
  32086. }
  32087. function removeNode (el) {
  32088. var parent = nodeOps.parentNode(el);
  32089. // element may have already been removed due to v-html / v-text
  32090. if (isDef(parent)) {
  32091. nodeOps.removeChild(parent, el);
  32092. }
  32093. }
  32094. function isUnknownElement$$1 (vnode, inVPre) {
  32095. return (
  32096. !inVPre &&
  32097. !vnode.ns &&
  32098. !(
  32099. config.ignoredElements.length &&
  32100. config.ignoredElements.some(function (ignore) {
  32101. return isRegExp(ignore)
  32102. ? ignore.test(vnode.tag)
  32103. : ignore === vnode.tag
  32104. })
  32105. ) &&
  32106. config.isUnknownElement(vnode.tag)
  32107. )
  32108. }
  32109. var creatingElmInVPre = 0;
  32110. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  32111. vnode.isRootInsert = !nested; // for transition enter check
  32112. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  32113. return
  32114. }
  32115. var data = vnode.data;
  32116. var children = vnode.children;
  32117. var tag = vnode.tag;
  32118. if (isDef(tag)) {
  32119. if (true) {
  32120. if (data && data.pre) {
  32121. creatingElmInVPre++;
  32122. }
  32123. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  32124. warn(
  32125. 'Unknown custom element: <' + tag + '> - did you ' +
  32126. 'register the component correctly? For recursive components, ' +
  32127. 'make sure to provide the "name" option.',
  32128. vnode.context
  32129. );
  32130. }
  32131. }
  32132. vnode.elm = vnode.ns
  32133. ? nodeOps.createElementNS(vnode.ns, tag)
  32134. : nodeOps.createElement(tag, vnode);
  32135. setScope(vnode);
  32136. /* istanbul ignore if */
  32137. {
  32138. createChildren(vnode, children, insertedVnodeQueue);
  32139. if (isDef(data)) {
  32140. invokeCreateHooks(vnode, insertedVnodeQueue);
  32141. }
  32142. insert(parentElm, vnode.elm, refElm);
  32143. }
  32144. if ("development" !== 'production' && data && data.pre) {
  32145. creatingElmInVPre--;
  32146. }
  32147. } else if (isTrue(vnode.isComment)) {
  32148. vnode.elm = nodeOps.createComment(vnode.text);
  32149. insert(parentElm, vnode.elm, refElm);
  32150. } else {
  32151. vnode.elm = nodeOps.createTextNode(vnode.text);
  32152. insert(parentElm, vnode.elm, refElm);
  32153. }
  32154. }
  32155. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32156. var i = vnode.data;
  32157. if (isDef(i)) {
  32158. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  32159. if (isDef(i = i.hook) && isDef(i = i.init)) {
  32160. i(vnode, false /* hydrating */, parentElm, refElm);
  32161. }
  32162. // after calling the init hook, if the vnode is a child component
  32163. // it should've created a child instance and mounted it. the child
  32164. // component also has set the placeholder vnode's elm.
  32165. // in that case we can just return the element and be done.
  32166. if (isDef(vnode.componentInstance)) {
  32167. initComponent(vnode, insertedVnodeQueue);
  32168. if (isTrue(isReactivated)) {
  32169. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  32170. }
  32171. return true
  32172. }
  32173. }
  32174. }
  32175. function initComponent (vnode, insertedVnodeQueue) {
  32176. if (isDef(vnode.data.pendingInsert)) {
  32177. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  32178. vnode.data.pendingInsert = null;
  32179. }
  32180. vnode.elm = vnode.componentInstance.$el;
  32181. if (isPatchable(vnode)) {
  32182. invokeCreateHooks(vnode, insertedVnodeQueue);
  32183. setScope(vnode);
  32184. } else {
  32185. // empty component root.
  32186. // skip all element-related modules except for ref (#3455)
  32187. registerRef(vnode);
  32188. // make sure to invoke the insert hook
  32189. insertedVnodeQueue.push(vnode);
  32190. }
  32191. }
  32192. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32193. var i;
  32194. // hack for #4339: a reactivated component with inner transition
  32195. // does not trigger because the inner node's created hooks are not called
  32196. // again. It's not ideal to involve module-specific logic in here but
  32197. // there doesn't seem to be a better way to do it.
  32198. var innerNode = vnode;
  32199. while (innerNode.componentInstance) {
  32200. innerNode = innerNode.componentInstance._vnode;
  32201. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  32202. for (i = 0; i < cbs.activate.length; ++i) {
  32203. cbs.activate[i](emptyNode, innerNode);
  32204. }
  32205. insertedVnodeQueue.push(innerNode);
  32206. break
  32207. }
  32208. }
  32209. // unlike a newly created component,
  32210. // a reactivated keep-alive component doesn't insert itself
  32211. insert(parentElm, vnode.elm, refElm);
  32212. }
  32213. function insert (parent, elm, ref$$1) {
  32214. if (isDef(parent)) {
  32215. if (isDef(ref$$1)) {
  32216. if (ref$$1.parentNode === parent) {
  32217. nodeOps.insertBefore(parent, elm, ref$$1);
  32218. }
  32219. } else {
  32220. nodeOps.appendChild(parent, elm);
  32221. }
  32222. }
  32223. }
  32224. function createChildren (vnode, children, insertedVnodeQueue) {
  32225. if (Array.isArray(children)) {
  32226. if (true) {
  32227. checkDuplicateKeys(children);
  32228. }
  32229. for (var i = 0; i < children.length; ++i) {
  32230. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  32231. }
  32232. } else if (isPrimitive(vnode.text)) {
  32233. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  32234. }
  32235. }
  32236. function isPatchable (vnode) {
  32237. while (vnode.componentInstance) {
  32238. vnode = vnode.componentInstance._vnode;
  32239. }
  32240. return isDef(vnode.tag)
  32241. }
  32242. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  32243. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  32244. cbs.create[i$1](emptyNode, vnode);
  32245. }
  32246. i = vnode.data.hook; // Reuse variable
  32247. if (isDef(i)) {
  32248. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  32249. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  32250. }
  32251. }
  32252. // set scope id attribute for scoped CSS.
  32253. // this is implemented as a special case to avoid the overhead
  32254. // of going through the normal attribute patching process.
  32255. function setScope (vnode) {
  32256. var i;
  32257. if (isDef(i = vnode.fnScopeId)) {
  32258. nodeOps.setAttribute(vnode.elm, i, '');
  32259. } else {
  32260. var ancestor = vnode;
  32261. while (ancestor) {
  32262. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  32263. nodeOps.setAttribute(vnode.elm, i, '');
  32264. }
  32265. ancestor = ancestor.parent;
  32266. }
  32267. }
  32268. // for slot content they should also get the scopeId from the host instance.
  32269. if (isDef(i = activeInstance) &&
  32270. i !== vnode.context &&
  32271. i !== vnode.fnContext &&
  32272. isDef(i = i.$options._scopeId)
  32273. ) {
  32274. nodeOps.setAttribute(vnode.elm, i, '');
  32275. }
  32276. }
  32277. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  32278. for (; startIdx <= endIdx; ++startIdx) {
  32279. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  32280. }
  32281. }
  32282. function invokeDestroyHook (vnode) {
  32283. var i, j;
  32284. var data = vnode.data;
  32285. if (isDef(data)) {
  32286. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  32287. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  32288. }
  32289. if (isDef(i = vnode.children)) {
  32290. for (j = 0; j < vnode.children.length; ++j) {
  32291. invokeDestroyHook(vnode.children[j]);
  32292. }
  32293. }
  32294. }
  32295. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  32296. for (; startIdx <= endIdx; ++startIdx) {
  32297. var ch = vnodes[startIdx];
  32298. if (isDef(ch)) {
  32299. if (isDef(ch.tag)) {
  32300. removeAndInvokeRemoveHook(ch);
  32301. invokeDestroyHook(ch);
  32302. } else { // Text node
  32303. removeNode(ch.elm);
  32304. }
  32305. }
  32306. }
  32307. }
  32308. function removeAndInvokeRemoveHook (vnode, rm) {
  32309. if (isDef(rm) || isDef(vnode.data)) {
  32310. var i;
  32311. var listeners = cbs.remove.length + 1;
  32312. if (isDef(rm)) {
  32313. // we have a recursively passed down rm callback
  32314. // increase the listeners count
  32315. rm.listeners += listeners;
  32316. } else {
  32317. // directly removing
  32318. rm = createRmCb(vnode.elm, listeners);
  32319. }
  32320. // recursively invoke hooks on child component root node
  32321. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  32322. removeAndInvokeRemoveHook(i, rm);
  32323. }
  32324. for (i = 0; i < cbs.remove.length; ++i) {
  32325. cbs.remove[i](vnode, rm);
  32326. }
  32327. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  32328. i(vnode, rm);
  32329. } else {
  32330. rm();
  32331. }
  32332. } else {
  32333. removeNode(vnode.elm);
  32334. }
  32335. }
  32336. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  32337. var oldStartIdx = 0;
  32338. var newStartIdx = 0;
  32339. var oldEndIdx = oldCh.length - 1;
  32340. var oldStartVnode = oldCh[0];
  32341. var oldEndVnode = oldCh[oldEndIdx];
  32342. var newEndIdx = newCh.length - 1;
  32343. var newStartVnode = newCh[0];
  32344. var newEndVnode = newCh[newEndIdx];
  32345. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  32346. // removeOnly is a special flag used only by <transition-group>
  32347. // to ensure removed elements stay in correct relative positions
  32348. // during leaving transitions
  32349. var canMove = !removeOnly;
  32350. if (true) {
  32351. checkDuplicateKeys(newCh);
  32352. }
  32353. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  32354. if (isUndef(oldStartVnode)) {
  32355. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  32356. } else if (isUndef(oldEndVnode)) {
  32357. oldEndVnode = oldCh[--oldEndIdx];
  32358. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  32359. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  32360. oldStartVnode = oldCh[++oldStartIdx];
  32361. newStartVnode = newCh[++newStartIdx];
  32362. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  32363. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  32364. oldEndVnode = oldCh[--oldEndIdx];
  32365. newEndVnode = newCh[--newEndIdx];
  32366. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  32367. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  32368. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  32369. oldStartVnode = oldCh[++oldStartIdx];
  32370. newEndVnode = newCh[--newEndIdx];
  32371. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  32372. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  32373. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  32374. oldEndVnode = oldCh[--oldEndIdx];
  32375. newStartVnode = newCh[++newStartIdx];
  32376. } else {
  32377. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  32378. idxInOld = isDef(newStartVnode.key)
  32379. ? oldKeyToIdx[newStartVnode.key]
  32380. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  32381. if (isUndef(idxInOld)) { // New element
  32382. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  32383. } else {
  32384. vnodeToMove = oldCh[idxInOld];
  32385. if (sameVnode(vnodeToMove, newStartVnode)) {
  32386. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
  32387. oldCh[idxInOld] = undefined;
  32388. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  32389. } else {
  32390. // same key but different element. treat as new element
  32391. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  32392. }
  32393. }
  32394. newStartVnode = newCh[++newStartIdx];
  32395. }
  32396. }
  32397. if (oldStartIdx > oldEndIdx) {
  32398. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  32399. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  32400. } else if (newStartIdx > newEndIdx) {
  32401. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  32402. }
  32403. }
  32404. function checkDuplicateKeys (children) {
  32405. var seenKeys = {};
  32406. for (var i = 0; i < children.length; i++) {
  32407. var vnode = children[i];
  32408. var key = vnode.key;
  32409. if (isDef(key)) {
  32410. if (seenKeys[key]) {
  32411. warn(
  32412. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  32413. vnode.context
  32414. );
  32415. } else {
  32416. seenKeys[key] = true;
  32417. }
  32418. }
  32419. }
  32420. }
  32421. function findIdxInOld (node, oldCh, start, end) {
  32422. for (var i = start; i < end; i++) {
  32423. var c = oldCh[i];
  32424. if (isDef(c) && sameVnode(node, c)) { return i }
  32425. }
  32426. }
  32427. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  32428. if (oldVnode === vnode) {
  32429. return
  32430. }
  32431. var elm = vnode.elm = oldVnode.elm;
  32432. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  32433. if (isDef(vnode.asyncFactory.resolved)) {
  32434. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  32435. } else {
  32436. vnode.isAsyncPlaceholder = true;
  32437. }
  32438. return
  32439. }
  32440. // reuse element for static trees.
  32441. // note we only do this if the vnode is cloned -
  32442. // if the new node is not cloned it means the render functions have been
  32443. // reset by the hot-reload-api and we need to do a proper re-render.
  32444. if (isTrue(vnode.isStatic) &&
  32445. isTrue(oldVnode.isStatic) &&
  32446. vnode.key === oldVnode.key &&
  32447. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  32448. ) {
  32449. vnode.componentInstance = oldVnode.componentInstance;
  32450. return
  32451. }
  32452. var i;
  32453. var data = vnode.data;
  32454. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  32455. i(oldVnode, vnode);
  32456. }
  32457. var oldCh = oldVnode.children;
  32458. var ch = vnode.children;
  32459. if (isDef(data) && isPatchable(vnode)) {
  32460. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  32461. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  32462. }
  32463. if (isUndef(vnode.text)) {
  32464. if (isDef(oldCh) && isDef(ch)) {
  32465. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  32466. } else if (isDef(ch)) {
  32467. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  32468. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  32469. } else if (isDef(oldCh)) {
  32470. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  32471. } else if (isDef(oldVnode.text)) {
  32472. nodeOps.setTextContent(elm, '');
  32473. }
  32474. } else if (oldVnode.text !== vnode.text) {
  32475. nodeOps.setTextContent(elm, vnode.text);
  32476. }
  32477. if (isDef(data)) {
  32478. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  32479. }
  32480. }
  32481. function invokeInsertHook (vnode, queue, initial) {
  32482. // delay insert hooks for component root nodes, invoke them after the
  32483. // element is really inserted
  32484. if (isTrue(initial) && isDef(vnode.parent)) {
  32485. vnode.parent.data.pendingInsert = queue;
  32486. } else {
  32487. for (var i = 0; i < queue.length; ++i) {
  32488. queue[i].data.hook.insert(queue[i]);
  32489. }
  32490. }
  32491. }
  32492. var hydrationBailed = false;
  32493. // list of modules that can skip create hook during hydration because they
  32494. // are already rendered on the client or has no need for initialization
  32495. // Note: style is excluded because it relies on initial clone for future
  32496. // deep updates (#7063).
  32497. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  32498. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  32499. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  32500. var i;
  32501. var tag = vnode.tag;
  32502. var data = vnode.data;
  32503. var children = vnode.children;
  32504. inVPre = inVPre || (data && data.pre);
  32505. vnode.elm = elm;
  32506. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  32507. vnode.isAsyncPlaceholder = true;
  32508. return true
  32509. }
  32510. // assert node match
  32511. if (true) {
  32512. if (!assertNodeMatch(elm, vnode, inVPre)) {
  32513. return false
  32514. }
  32515. }
  32516. if (isDef(data)) {
  32517. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  32518. if (isDef(i = vnode.componentInstance)) {
  32519. // child component. it should have hydrated its own tree.
  32520. initComponent(vnode, insertedVnodeQueue);
  32521. return true
  32522. }
  32523. }
  32524. if (isDef(tag)) {
  32525. if (isDef(children)) {
  32526. // empty element, allow client to pick up and populate children
  32527. if (!elm.hasChildNodes()) {
  32528. createChildren(vnode, children, insertedVnodeQueue);
  32529. } else {
  32530. // v-html and domProps: innerHTML
  32531. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  32532. if (i !== elm.innerHTML) {
  32533. /* istanbul ignore if */
  32534. if ("development" !== 'production' &&
  32535. typeof console !== 'undefined' &&
  32536. !hydrationBailed
  32537. ) {
  32538. hydrationBailed = true;
  32539. console.warn('Parent: ', elm);
  32540. console.warn('server innerHTML: ', i);
  32541. console.warn('client innerHTML: ', elm.innerHTML);
  32542. }
  32543. return false
  32544. }
  32545. } else {
  32546. // iterate and compare children lists
  32547. var childrenMatch = true;
  32548. var childNode = elm.firstChild;
  32549. for (var i$1 = 0; i$1 < children.length; i$1++) {
  32550. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  32551. childrenMatch = false;
  32552. break
  32553. }
  32554. childNode = childNode.nextSibling;
  32555. }
  32556. // if childNode is not null, it means the actual childNodes list is
  32557. // longer than the virtual children list.
  32558. if (!childrenMatch || childNode) {
  32559. /* istanbul ignore if */
  32560. if ("development" !== 'production' &&
  32561. typeof console !== 'undefined' &&
  32562. !hydrationBailed
  32563. ) {
  32564. hydrationBailed = true;
  32565. console.warn('Parent: ', elm);
  32566. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  32567. }
  32568. return false
  32569. }
  32570. }
  32571. }
  32572. }
  32573. if (isDef(data)) {
  32574. var fullInvoke = false;
  32575. for (var key in data) {
  32576. if (!isRenderedModule(key)) {
  32577. fullInvoke = true;
  32578. invokeCreateHooks(vnode, insertedVnodeQueue);
  32579. break
  32580. }
  32581. }
  32582. if (!fullInvoke && data['class']) {
  32583. // ensure collecting deps for deep class bindings for future updates
  32584. traverse(data['class']);
  32585. }
  32586. }
  32587. } else if (elm.data !== vnode.text) {
  32588. elm.data = vnode.text;
  32589. }
  32590. return true
  32591. }
  32592. function assertNodeMatch (node, vnode, inVPre) {
  32593. if (isDef(vnode.tag)) {
  32594. return vnode.tag.indexOf('vue-component') === 0 || (
  32595. !isUnknownElement$$1(vnode, inVPre) &&
  32596. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  32597. )
  32598. } else {
  32599. return node.nodeType === (vnode.isComment ? 8 : 3)
  32600. }
  32601. }
  32602. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  32603. if (isUndef(vnode)) {
  32604. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  32605. return
  32606. }
  32607. var isInitialPatch = false;
  32608. var insertedVnodeQueue = [];
  32609. if (isUndef(oldVnode)) {
  32610. // empty mount (likely as component), create new root element
  32611. isInitialPatch = true;
  32612. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  32613. } else {
  32614. var isRealElement = isDef(oldVnode.nodeType);
  32615. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  32616. // patch existing root node
  32617. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  32618. } else {
  32619. if (isRealElement) {
  32620. // mounting to a real element
  32621. // check if this is server-rendered content and if we can perform
  32622. // a successful hydration.
  32623. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  32624. oldVnode.removeAttribute(SSR_ATTR);
  32625. hydrating = true;
  32626. }
  32627. if (isTrue(hydrating)) {
  32628. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  32629. invokeInsertHook(vnode, insertedVnodeQueue, true);
  32630. return oldVnode
  32631. } else if (true) {
  32632. warn(
  32633. 'The client-side rendered virtual DOM tree is not matching ' +
  32634. 'server-rendered content. This is likely caused by incorrect ' +
  32635. 'HTML markup, for example nesting block-level elements inside ' +
  32636. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  32637. 'full client-side render.'
  32638. );
  32639. }
  32640. }
  32641. // either not server-rendered, or hydration failed.
  32642. // create an empty node and replace it
  32643. oldVnode = emptyNodeAt(oldVnode);
  32644. }
  32645. // replacing existing element
  32646. var oldElm = oldVnode.elm;
  32647. var parentElm$1 = nodeOps.parentNode(oldElm);
  32648. // create new node
  32649. createElm(
  32650. vnode,
  32651. insertedVnodeQueue,
  32652. // extremely rare edge case: do not insert if old element is in a
  32653. // leaving transition. Only happens when combining transition +
  32654. // keep-alive + HOCs. (#4590)
  32655. oldElm._leaveCb ? null : parentElm$1,
  32656. nodeOps.nextSibling(oldElm)
  32657. );
  32658. // update parent placeholder node element, recursively
  32659. if (isDef(vnode.parent)) {
  32660. var ancestor = vnode.parent;
  32661. var patchable = isPatchable(vnode);
  32662. while (ancestor) {
  32663. for (var i = 0; i < cbs.destroy.length; ++i) {
  32664. cbs.destroy[i](ancestor);
  32665. }
  32666. ancestor.elm = vnode.elm;
  32667. if (patchable) {
  32668. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  32669. cbs.create[i$1](emptyNode, ancestor);
  32670. }
  32671. // #6513
  32672. // invoke insert hooks that may have been merged by create hooks.
  32673. // e.g. for directives that uses the "inserted" hook.
  32674. var insert = ancestor.data.hook.insert;
  32675. if (insert.merged) {
  32676. // start at index 1 to avoid re-invoking component mounted hook
  32677. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  32678. insert.fns[i$2]();
  32679. }
  32680. }
  32681. } else {
  32682. registerRef(ancestor);
  32683. }
  32684. ancestor = ancestor.parent;
  32685. }
  32686. }
  32687. // destroy old node
  32688. if (isDef(parentElm$1)) {
  32689. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  32690. } else if (isDef(oldVnode.tag)) {
  32691. invokeDestroyHook(oldVnode);
  32692. }
  32693. }
  32694. }
  32695. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  32696. return vnode.elm
  32697. }
  32698. }
  32699. /* */
  32700. var directives = {
  32701. create: updateDirectives,
  32702. update: updateDirectives,
  32703. destroy: function unbindDirectives (vnode) {
  32704. updateDirectives(vnode, emptyNode);
  32705. }
  32706. };
  32707. function updateDirectives (oldVnode, vnode) {
  32708. if (oldVnode.data.directives || vnode.data.directives) {
  32709. _update(oldVnode, vnode);
  32710. }
  32711. }
  32712. function _update (oldVnode, vnode) {
  32713. var isCreate = oldVnode === emptyNode;
  32714. var isDestroy = vnode === emptyNode;
  32715. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  32716. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  32717. var dirsWithInsert = [];
  32718. var dirsWithPostpatch = [];
  32719. var key, oldDir, dir;
  32720. for (key in newDirs) {
  32721. oldDir = oldDirs[key];
  32722. dir = newDirs[key];
  32723. if (!oldDir) {
  32724. // new directive, bind
  32725. callHook$1(dir, 'bind', vnode, oldVnode);
  32726. if (dir.def && dir.def.inserted) {
  32727. dirsWithInsert.push(dir);
  32728. }
  32729. } else {
  32730. // existing directive, update
  32731. dir.oldValue = oldDir.value;
  32732. callHook$1(dir, 'update', vnode, oldVnode);
  32733. if (dir.def && dir.def.componentUpdated) {
  32734. dirsWithPostpatch.push(dir);
  32735. }
  32736. }
  32737. }
  32738. if (dirsWithInsert.length) {
  32739. var callInsert = function () {
  32740. for (var i = 0; i < dirsWithInsert.length; i++) {
  32741. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  32742. }
  32743. };
  32744. if (isCreate) {
  32745. mergeVNodeHook(vnode, 'insert', callInsert);
  32746. } else {
  32747. callInsert();
  32748. }
  32749. }
  32750. if (dirsWithPostpatch.length) {
  32751. mergeVNodeHook(vnode, 'postpatch', function () {
  32752. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  32753. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  32754. }
  32755. });
  32756. }
  32757. if (!isCreate) {
  32758. for (key in oldDirs) {
  32759. if (!newDirs[key]) {
  32760. // no longer present, unbind
  32761. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  32762. }
  32763. }
  32764. }
  32765. }
  32766. var emptyModifiers = Object.create(null);
  32767. function normalizeDirectives$1 (
  32768. dirs,
  32769. vm
  32770. ) {
  32771. var res = Object.create(null);
  32772. if (!dirs) {
  32773. // $flow-disable-line
  32774. return res
  32775. }
  32776. var i, dir;
  32777. for (i = 0; i < dirs.length; i++) {
  32778. dir = dirs[i];
  32779. if (!dir.modifiers) {
  32780. // $flow-disable-line
  32781. dir.modifiers = emptyModifiers;
  32782. }
  32783. res[getRawDirName(dir)] = dir;
  32784. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  32785. }
  32786. // $flow-disable-line
  32787. return res
  32788. }
  32789. function getRawDirName (dir) {
  32790. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  32791. }
  32792. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  32793. var fn = dir.def && dir.def[hook];
  32794. if (fn) {
  32795. try {
  32796. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  32797. } catch (e) {
  32798. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  32799. }
  32800. }
  32801. }
  32802. var baseModules = [
  32803. ref,
  32804. directives
  32805. ];
  32806. /* */
  32807. function updateAttrs (oldVnode, vnode) {
  32808. var opts = vnode.componentOptions;
  32809. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  32810. return
  32811. }
  32812. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  32813. return
  32814. }
  32815. var key, cur, old;
  32816. var elm = vnode.elm;
  32817. var oldAttrs = oldVnode.data.attrs || {};
  32818. var attrs = vnode.data.attrs || {};
  32819. // clone observed objects, as the user probably wants to mutate it
  32820. if (isDef(attrs.__ob__)) {
  32821. attrs = vnode.data.attrs = extend({}, attrs);
  32822. }
  32823. for (key in attrs) {
  32824. cur = attrs[key];
  32825. old = oldAttrs[key];
  32826. if (old !== cur) {
  32827. setAttr(elm, key, cur);
  32828. }
  32829. }
  32830. // #4391: in IE9, setting type can reset value for input[type=radio]
  32831. // #6666: IE/Edge forces progress value down to 1 before setting a max
  32832. /* istanbul ignore if */
  32833. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  32834. setAttr(elm, 'value', attrs.value);
  32835. }
  32836. for (key in oldAttrs) {
  32837. if (isUndef(attrs[key])) {
  32838. if (isXlink(key)) {
  32839. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  32840. } else if (!isEnumeratedAttr(key)) {
  32841. elm.removeAttribute(key);
  32842. }
  32843. }
  32844. }
  32845. }
  32846. function setAttr (el, key, value) {
  32847. if (isBooleanAttr(key)) {
  32848. // set attribute for blank value
  32849. // e.g. <option disabled>Select one</option>
  32850. if (isFalsyAttrValue(value)) {
  32851. el.removeAttribute(key);
  32852. } else {
  32853. // technically allowfullscreen is a boolean attribute for <iframe>,
  32854. // but Flash expects a value of "true" when used on <embed> tag
  32855. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  32856. ? 'true'
  32857. : key;
  32858. el.setAttribute(key, value);
  32859. }
  32860. } else if (isEnumeratedAttr(key)) {
  32861. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  32862. } else if (isXlink(key)) {
  32863. if (isFalsyAttrValue(value)) {
  32864. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  32865. } else {
  32866. el.setAttributeNS(xlinkNS, key, value);
  32867. }
  32868. } else {
  32869. if (isFalsyAttrValue(value)) {
  32870. el.removeAttribute(key);
  32871. } else {
  32872. // #7138: IE10 & 11 fires input event when setting placeholder on
  32873. // <textarea>... block the first input event and remove the blocker
  32874. // immediately.
  32875. /* istanbul ignore if */
  32876. if (
  32877. isIE && !isIE9 &&
  32878. el.tagName === 'TEXTAREA' &&
  32879. key === 'placeholder' && !el.__ieph
  32880. ) {
  32881. var blocker = function (e) {
  32882. e.stopImmediatePropagation();
  32883. el.removeEventListener('input', blocker);
  32884. };
  32885. el.addEventListener('input', blocker);
  32886. // $flow-disable-line
  32887. el.__ieph = true; /* IE placeholder patched */
  32888. }
  32889. el.setAttribute(key, value);
  32890. }
  32891. }
  32892. }
  32893. var attrs = {
  32894. create: updateAttrs,
  32895. update: updateAttrs
  32896. };
  32897. /* */
  32898. function updateClass (oldVnode, vnode) {
  32899. var el = vnode.elm;
  32900. var data = vnode.data;
  32901. var oldData = oldVnode.data;
  32902. if (
  32903. isUndef(data.staticClass) &&
  32904. isUndef(data.class) && (
  32905. isUndef(oldData) || (
  32906. isUndef(oldData.staticClass) &&
  32907. isUndef(oldData.class)
  32908. )
  32909. )
  32910. ) {
  32911. return
  32912. }
  32913. var cls = genClassForVnode(vnode);
  32914. // handle transition classes
  32915. var transitionClass = el._transitionClasses;
  32916. if (isDef(transitionClass)) {
  32917. cls = concat(cls, stringifyClass(transitionClass));
  32918. }
  32919. // set the class
  32920. if (cls !== el._prevClass) {
  32921. el.setAttribute('class', cls);
  32922. el._prevClass = cls;
  32923. }
  32924. }
  32925. var klass = {
  32926. create: updateClass,
  32927. update: updateClass
  32928. };
  32929. /* */
  32930. var validDivisionCharRE = /[\w).+\-_$\]]/;
  32931. function parseFilters (exp) {
  32932. var inSingle = false;
  32933. var inDouble = false;
  32934. var inTemplateString = false;
  32935. var inRegex = false;
  32936. var curly = 0;
  32937. var square = 0;
  32938. var paren = 0;
  32939. var lastFilterIndex = 0;
  32940. var c, prev, i, expression, filters;
  32941. for (i = 0; i < exp.length; i++) {
  32942. prev = c;
  32943. c = exp.charCodeAt(i);
  32944. if (inSingle) {
  32945. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  32946. } else if (inDouble) {
  32947. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  32948. } else if (inTemplateString) {
  32949. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  32950. } else if (inRegex) {
  32951. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  32952. } else if (
  32953. c === 0x7C && // pipe
  32954. exp.charCodeAt(i + 1) !== 0x7C &&
  32955. exp.charCodeAt(i - 1) !== 0x7C &&
  32956. !curly && !square && !paren
  32957. ) {
  32958. if (expression === undefined) {
  32959. // first filter, end of expression
  32960. lastFilterIndex = i + 1;
  32961. expression = exp.slice(0, i).trim();
  32962. } else {
  32963. pushFilter();
  32964. }
  32965. } else {
  32966. switch (c) {
  32967. case 0x22: inDouble = true; break // "
  32968. case 0x27: inSingle = true; break // '
  32969. case 0x60: inTemplateString = true; break // `
  32970. case 0x28: paren++; break // (
  32971. case 0x29: paren--; break // )
  32972. case 0x5B: square++; break // [
  32973. case 0x5D: square--; break // ]
  32974. case 0x7B: curly++; break // {
  32975. case 0x7D: curly--; break // }
  32976. }
  32977. if (c === 0x2f) { // /
  32978. var j = i - 1;
  32979. var p = (void 0);
  32980. // find first non-whitespace prev char
  32981. for (; j >= 0; j--) {
  32982. p = exp.charAt(j);
  32983. if (p !== ' ') { break }
  32984. }
  32985. if (!p || !validDivisionCharRE.test(p)) {
  32986. inRegex = true;
  32987. }
  32988. }
  32989. }
  32990. }
  32991. if (expression === undefined) {
  32992. expression = exp.slice(0, i).trim();
  32993. } else if (lastFilterIndex !== 0) {
  32994. pushFilter();
  32995. }
  32996. function pushFilter () {
  32997. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  32998. lastFilterIndex = i + 1;
  32999. }
  33000. if (filters) {
  33001. for (i = 0; i < filters.length; i++) {
  33002. expression = wrapFilter(expression, filters[i]);
  33003. }
  33004. }
  33005. return expression
  33006. }
  33007. function wrapFilter (exp, filter) {
  33008. var i = filter.indexOf('(');
  33009. if (i < 0) {
  33010. // _f: resolveFilter
  33011. return ("_f(\"" + filter + "\")(" + exp + ")")
  33012. } else {
  33013. var name = filter.slice(0, i);
  33014. var args = filter.slice(i + 1);
  33015. return ("_f(\"" + name + "\")(" + exp + "," + args)
  33016. }
  33017. }
  33018. /* */
  33019. function baseWarn (msg) {
  33020. console.error(("[Vue compiler]: " + msg));
  33021. }
  33022. function pluckModuleFunction (
  33023. modules,
  33024. key
  33025. ) {
  33026. return modules
  33027. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  33028. : []
  33029. }
  33030. function addProp (el, name, value) {
  33031. (el.props || (el.props = [])).push({ name: name, value: value });
  33032. el.plain = false;
  33033. }
  33034. function addAttr (el, name, value) {
  33035. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  33036. el.plain = false;
  33037. }
  33038. // add a raw attr (use this in preTransforms)
  33039. function addRawAttr (el, name, value) {
  33040. el.attrsMap[name] = value;
  33041. el.attrsList.push({ name: name, value: value });
  33042. }
  33043. function addDirective (
  33044. el,
  33045. name,
  33046. rawName,
  33047. value,
  33048. arg,
  33049. modifiers
  33050. ) {
  33051. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  33052. el.plain = false;
  33053. }
  33054. function addHandler (
  33055. el,
  33056. name,
  33057. value,
  33058. modifiers,
  33059. important,
  33060. warn
  33061. ) {
  33062. modifiers = modifiers || emptyObject;
  33063. // warn prevent and passive modifier
  33064. /* istanbul ignore if */
  33065. if (
  33066. "development" !== 'production' && warn &&
  33067. modifiers.prevent && modifiers.passive
  33068. ) {
  33069. warn(
  33070. 'passive and prevent can\'t be used together. ' +
  33071. 'Passive handler can\'t prevent default event.'
  33072. );
  33073. }
  33074. // check capture modifier
  33075. if (modifiers.capture) {
  33076. delete modifiers.capture;
  33077. name = '!' + name; // mark the event as captured
  33078. }
  33079. if (modifiers.once) {
  33080. delete modifiers.once;
  33081. name = '~' + name; // mark the event as once
  33082. }
  33083. /* istanbul ignore if */
  33084. if (modifiers.passive) {
  33085. delete modifiers.passive;
  33086. name = '&' + name; // mark the event as passive
  33087. }
  33088. // normalize click.right and click.middle since they don't actually fire
  33089. // this is technically browser-specific, but at least for now browsers are
  33090. // the only target envs that have right/middle clicks.
  33091. if (name === 'click') {
  33092. if (modifiers.right) {
  33093. name = 'contextmenu';
  33094. delete modifiers.right;
  33095. } else if (modifiers.middle) {
  33096. name = 'mouseup';
  33097. }
  33098. }
  33099. var events;
  33100. if (modifiers.native) {
  33101. delete modifiers.native;
  33102. events = el.nativeEvents || (el.nativeEvents = {});
  33103. } else {
  33104. events = el.events || (el.events = {});
  33105. }
  33106. var newHandler = { value: value };
  33107. if (modifiers !== emptyObject) {
  33108. newHandler.modifiers = modifiers;
  33109. }
  33110. var handlers = events[name];
  33111. /* istanbul ignore if */
  33112. if (Array.isArray(handlers)) {
  33113. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  33114. } else if (handlers) {
  33115. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  33116. } else {
  33117. events[name] = newHandler;
  33118. }
  33119. el.plain = false;
  33120. }
  33121. function getBindingAttr (
  33122. el,
  33123. name,
  33124. getStatic
  33125. ) {
  33126. var dynamicValue =
  33127. getAndRemoveAttr(el, ':' + name) ||
  33128. getAndRemoveAttr(el, 'v-bind:' + name);
  33129. if (dynamicValue != null) {
  33130. return parseFilters(dynamicValue)
  33131. } else if (getStatic !== false) {
  33132. var staticValue = getAndRemoveAttr(el, name);
  33133. if (staticValue != null) {
  33134. return JSON.stringify(staticValue)
  33135. }
  33136. }
  33137. }
  33138. // note: this only removes the attr from the Array (attrsList) so that it
  33139. // doesn't get processed by processAttrs.
  33140. // By default it does NOT remove it from the map (attrsMap) because the map is
  33141. // needed during codegen.
  33142. function getAndRemoveAttr (
  33143. el,
  33144. name,
  33145. removeFromMap
  33146. ) {
  33147. var val;
  33148. if ((val = el.attrsMap[name]) != null) {
  33149. var list = el.attrsList;
  33150. for (var i = 0, l = list.length; i < l; i++) {
  33151. if (list[i].name === name) {
  33152. list.splice(i, 1);
  33153. break
  33154. }
  33155. }
  33156. }
  33157. if (removeFromMap) {
  33158. delete el.attrsMap[name];
  33159. }
  33160. return val
  33161. }
  33162. /* */
  33163. /**
  33164. * Cross-platform code generation for component v-model
  33165. */
  33166. function genComponentModel (
  33167. el,
  33168. value,
  33169. modifiers
  33170. ) {
  33171. var ref = modifiers || {};
  33172. var number = ref.number;
  33173. var trim = ref.trim;
  33174. var baseValueExpression = '$$v';
  33175. var valueExpression = baseValueExpression;
  33176. if (trim) {
  33177. valueExpression =
  33178. "(typeof " + baseValueExpression + " === 'string'" +
  33179. "? " + baseValueExpression + ".trim()" +
  33180. ": " + baseValueExpression + ")";
  33181. }
  33182. if (number) {
  33183. valueExpression = "_n(" + valueExpression + ")";
  33184. }
  33185. var assignment = genAssignmentCode(value, valueExpression);
  33186. el.model = {
  33187. value: ("(" + value + ")"),
  33188. expression: ("\"" + value + "\""),
  33189. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  33190. };
  33191. }
  33192. /**
  33193. * Cross-platform codegen helper for generating v-model value assignment code.
  33194. */
  33195. function genAssignmentCode (
  33196. value,
  33197. assignment
  33198. ) {
  33199. var res = parseModel(value);
  33200. if (res.key === null) {
  33201. return (value + "=" + assignment)
  33202. } else {
  33203. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  33204. }
  33205. }
  33206. /**
  33207. * Parse a v-model expression into a base path and a final key segment.
  33208. * Handles both dot-path and possible square brackets.
  33209. *
  33210. * Possible cases:
  33211. *
  33212. * - test
  33213. * - test[key]
  33214. * - test[test1[key]]
  33215. * - test["a"][key]
  33216. * - xxx.test[a[a].test1[key]]
  33217. * - test.xxx.a["asa"][test1[key]]
  33218. *
  33219. */
  33220. var len;
  33221. var str;
  33222. var chr;
  33223. var index$1;
  33224. var expressionPos;
  33225. var expressionEndPos;
  33226. function parseModel (val) {
  33227. len = val.length;
  33228. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  33229. index$1 = val.lastIndexOf('.');
  33230. if (index$1 > -1) {
  33231. return {
  33232. exp: val.slice(0, index$1),
  33233. key: '"' + val.slice(index$1 + 1) + '"'
  33234. }
  33235. } else {
  33236. return {
  33237. exp: val,
  33238. key: null
  33239. }
  33240. }
  33241. }
  33242. str = val;
  33243. index$1 = expressionPos = expressionEndPos = 0;
  33244. while (!eof()) {
  33245. chr = next();
  33246. /* istanbul ignore if */
  33247. if (isStringStart(chr)) {
  33248. parseString(chr);
  33249. } else if (chr === 0x5B) {
  33250. parseBracket(chr);
  33251. }
  33252. }
  33253. return {
  33254. exp: val.slice(0, expressionPos),
  33255. key: val.slice(expressionPos + 1, expressionEndPos)
  33256. }
  33257. }
  33258. function next () {
  33259. return str.charCodeAt(++index$1)
  33260. }
  33261. function eof () {
  33262. return index$1 >= len
  33263. }
  33264. function isStringStart (chr) {
  33265. return chr === 0x22 || chr === 0x27
  33266. }
  33267. function parseBracket (chr) {
  33268. var inBracket = 1;
  33269. expressionPos = index$1;
  33270. while (!eof()) {
  33271. chr = next();
  33272. if (isStringStart(chr)) {
  33273. parseString(chr);
  33274. continue
  33275. }
  33276. if (chr === 0x5B) { inBracket++; }
  33277. if (chr === 0x5D) { inBracket--; }
  33278. if (inBracket === 0) {
  33279. expressionEndPos = index$1;
  33280. break
  33281. }
  33282. }
  33283. }
  33284. function parseString (chr) {
  33285. var stringQuote = chr;
  33286. while (!eof()) {
  33287. chr = next();
  33288. if (chr === stringQuote) {
  33289. break
  33290. }
  33291. }
  33292. }
  33293. /* */
  33294. var warn$1;
  33295. // in some cases, the event used has to be determined at runtime
  33296. // so we used some reserved tokens during compile.
  33297. var RANGE_TOKEN = '__r';
  33298. var CHECKBOX_RADIO_TOKEN = '__c';
  33299. function model (
  33300. el,
  33301. dir,
  33302. _warn
  33303. ) {
  33304. warn$1 = _warn;
  33305. var value = dir.value;
  33306. var modifiers = dir.modifiers;
  33307. var tag = el.tag;
  33308. var type = el.attrsMap.type;
  33309. if (true) {
  33310. // inputs with type="file" are read only and setting the input's
  33311. // value will throw an error.
  33312. if (tag === 'input' && type === 'file') {
  33313. warn$1(
  33314. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  33315. "File inputs are read only. Use a v-on:change listener instead."
  33316. );
  33317. }
  33318. }
  33319. if (el.component) {
  33320. genComponentModel(el, value, modifiers);
  33321. // component v-model doesn't need extra runtime
  33322. return false
  33323. } else if (tag === 'select') {
  33324. genSelect(el, value, modifiers);
  33325. } else if (tag === 'input' && type === 'checkbox') {
  33326. genCheckboxModel(el, value, modifiers);
  33327. } else if (tag === 'input' && type === 'radio') {
  33328. genRadioModel(el, value, modifiers);
  33329. } else if (tag === 'input' || tag === 'textarea') {
  33330. genDefaultModel(el, value, modifiers);
  33331. } else if (!config.isReservedTag(tag)) {
  33332. genComponentModel(el, value, modifiers);
  33333. // component v-model doesn't need extra runtime
  33334. return false
  33335. } else if (true) {
  33336. warn$1(
  33337. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  33338. "v-model is not supported on this element type. " +
  33339. 'If you are working with contenteditable, it\'s recommended to ' +
  33340. 'wrap a library dedicated for that purpose inside a custom component.'
  33341. );
  33342. }
  33343. // ensure runtime directive metadata
  33344. return true
  33345. }
  33346. function genCheckboxModel (
  33347. el,
  33348. value,
  33349. modifiers
  33350. ) {
  33351. var number = modifiers && modifiers.number;
  33352. var valueBinding = getBindingAttr(el, 'value') || 'null';
  33353. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  33354. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  33355. addProp(el, 'checked',
  33356. "Array.isArray(" + value + ")" +
  33357. "?_i(" + value + "," + valueBinding + ")>-1" + (
  33358. trueValueBinding === 'true'
  33359. ? (":(" + value + ")")
  33360. : (":_q(" + value + "," + trueValueBinding + ")")
  33361. )
  33362. );
  33363. addHandler(el, 'change',
  33364. "var $$a=" + value + "," +
  33365. '$$el=$event.target,' +
  33366. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  33367. 'if(Array.isArray($$a)){' +
  33368. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  33369. '$$i=_i($$a,$$v);' +
  33370. "if($$el.checked){$$i<0&&(" + value + "=$$a.concat([$$v]))}" +
  33371. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  33372. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  33373. null, true
  33374. );
  33375. }
  33376. function genRadioModel (
  33377. el,
  33378. value,
  33379. modifiers
  33380. ) {
  33381. var number = modifiers && modifiers.number;
  33382. var valueBinding = getBindingAttr(el, 'value') || 'null';
  33383. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  33384. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  33385. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  33386. }
  33387. function genSelect (
  33388. el,
  33389. value,
  33390. modifiers
  33391. ) {
  33392. var number = modifiers && modifiers.number;
  33393. var selectedVal = "Array.prototype.filter" +
  33394. ".call($event.target.options,function(o){return o.selected})" +
  33395. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  33396. "return " + (number ? '_n(val)' : 'val') + "})";
  33397. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  33398. var code = "var $$selectedVal = " + selectedVal + ";";
  33399. code = code + " " + (genAssignmentCode(value, assignment));
  33400. addHandler(el, 'change', code, null, true);
  33401. }
  33402. function genDefaultModel (
  33403. el,
  33404. value,
  33405. modifiers
  33406. ) {
  33407. var type = el.attrsMap.type;
  33408. // warn if v-bind:value conflicts with v-model
  33409. if (true) {
  33410. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  33411. if (value$1) {
  33412. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  33413. warn$1(
  33414. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  33415. 'because the latter already expands to a value binding internally'
  33416. );
  33417. }
  33418. }
  33419. var ref = modifiers || {};
  33420. var lazy = ref.lazy;
  33421. var number = ref.number;
  33422. var trim = ref.trim;
  33423. var needCompositionGuard = !lazy && type !== 'range';
  33424. var event = lazy
  33425. ? 'change'
  33426. : type === 'range'
  33427. ? RANGE_TOKEN
  33428. : 'input';
  33429. var valueExpression = '$event.target.value';
  33430. if (trim) {
  33431. valueExpression = "$event.target.value.trim()";
  33432. }
  33433. if (number) {
  33434. valueExpression = "_n(" + valueExpression + ")";
  33435. }
  33436. var code = genAssignmentCode(value, valueExpression);
  33437. if (needCompositionGuard) {
  33438. code = "if($event.target.composing)return;" + code;
  33439. }
  33440. addProp(el, 'value', ("(" + value + ")"));
  33441. addHandler(el, event, code, null, true);
  33442. if (trim || number) {
  33443. addHandler(el, 'blur', '$forceUpdate()');
  33444. }
  33445. }
  33446. /* */
  33447. // normalize v-model event tokens that can only be determined at runtime.
  33448. // it's important to place the event as the first in the array because
  33449. // the whole point is ensuring the v-model callback gets called before
  33450. // user-attached handlers.
  33451. function normalizeEvents (on) {
  33452. /* istanbul ignore if */
  33453. if (isDef(on[RANGE_TOKEN])) {
  33454. // IE input[type=range] only supports `change` event
  33455. var event = isIE ? 'change' : 'input';
  33456. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  33457. delete on[RANGE_TOKEN];
  33458. }
  33459. // This was originally intended to fix #4521 but no longer necessary
  33460. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  33461. /* istanbul ignore if */
  33462. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  33463. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  33464. delete on[CHECKBOX_RADIO_TOKEN];
  33465. }
  33466. }
  33467. var target$1;
  33468. function createOnceHandler (handler, event, capture) {
  33469. var _target = target$1; // save current target element in closure
  33470. return function onceHandler () {
  33471. var res = handler.apply(null, arguments);
  33472. if (res !== null) {
  33473. remove$2(event, onceHandler, capture, _target);
  33474. }
  33475. }
  33476. }
  33477. function add$1 (
  33478. event,
  33479. handler,
  33480. once$$1,
  33481. capture,
  33482. passive
  33483. ) {
  33484. handler = withMacroTask(handler);
  33485. if (once$$1) { handler = createOnceHandler(handler, event, capture); }
  33486. target$1.addEventListener(
  33487. event,
  33488. handler,
  33489. supportsPassive
  33490. ? { capture: capture, passive: passive }
  33491. : capture
  33492. );
  33493. }
  33494. function remove$2 (
  33495. event,
  33496. handler,
  33497. capture,
  33498. _target
  33499. ) {
  33500. (_target || target$1).removeEventListener(
  33501. event,
  33502. handler._withTask || handler,
  33503. capture
  33504. );
  33505. }
  33506. function updateDOMListeners (oldVnode, vnode) {
  33507. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  33508. return
  33509. }
  33510. var on = vnode.data.on || {};
  33511. var oldOn = oldVnode.data.on || {};
  33512. target$1 = vnode.elm;
  33513. normalizeEvents(on);
  33514. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  33515. target$1 = undefined;
  33516. }
  33517. var events = {
  33518. create: updateDOMListeners,
  33519. update: updateDOMListeners
  33520. };
  33521. /* */
  33522. function updateDOMProps (oldVnode, vnode) {
  33523. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  33524. return
  33525. }
  33526. var key, cur;
  33527. var elm = vnode.elm;
  33528. var oldProps = oldVnode.data.domProps || {};
  33529. var props = vnode.data.domProps || {};
  33530. // clone observed objects, as the user probably wants to mutate it
  33531. if (isDef(props.__ob__)) {
  33532. props = vnode.data.domProps = extend({}, props);
  33533. }
  33534. for (key in oldProps) {
  33535. if (isUndef(props[key])) {
  33536. elm[key] = '';
  33537. }
  33538. }
  33539. for (key in props) {
  33540. cur = props[key];
  33541. // ignore children if the node has textContent or innerHTML,
  33542. // as these will throw away existing DOM nodes and cause removal errors
  33543. // on subsequent patches (#3360)
  33544. if (key === 'textContent' || key === 'innerHTML') {
  33545. if (vnode.children) { vnode.children.length = 0; }
  33546. if (cur === oldProps[key]) { continue }
  33547. // #6601 work around Chrome version <= 55 bug where single textNode
  33548. // replaced by innerHTML/textContent retains its parentNode property
  33549. if (elm.childNodes.length === 1) {
  33550. elm.removeChild(elm.childNodes[0]);
  33551. }
  33552. }
  33553. if (key === 'value') {
  33554. // store value as _value as well since
  33555. // non-string values will be stringified
  33556. elm._value = cur;
  33557. // avoid resetting cursor position when value is the same
  33558. var strCur = isUndef(cur) ? '' : String(cur);
  33559. if (shouldUpdateValue(elm, strCur)) {
  33560. elm.value = strCur;
  33561. }
  33562. } else {
  33563. elm[key] = cur;
  33564. }
  33565. }
  33566. }
  33567. // check platforms/web/util/attrs.js acceptValue
  33568. function shouldUpdateValue (elm, checkVal) {
  33569. return (!elm.composing && (
  33570. elm.tagName === 'OPTION' ||
  33571. isNotInFocusAndDirty(elm, checkVal) ||
  33572. isDirtyWithModifiers(elm, checkVal)
  33573. ))
  33574. }
  33575. function isNotInFocusAndDirty (elm, checkVal) {
  33576. // return true when textbox (.number and .trim) loses focus and its value is
  33577. // not equal to the updated value
  33578. var notInFocus = true;
  33579. // #6157
  33580. // work around IE bug when accessing document.activeElement in an iframe
  33581. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  33582. return notInFocus && elm.value !== checkVal
  33583. }
  33584. function isDirtyWithModifiers (elm, newVal) {
  33585. var value = elm.value;
  33586. var modifiers = elm._vModifiers; // injected by v-model runtime
  33587. if (isDef(modifiers)) {
  33588. if (modifiers.lazy) {
  33589. // inputs with lazy should only be updated when not in focus
  33590. return false
  33591. }
  33592. if (modifiers.number) {
  33593. return toNumber(value) !== toNumber(newVal)
  33594. }
  33595. if (modifiers.trim) {
  33596. return value.trim() !== newVal.trim()
  33597. }
  33598. }
  33599. return value !== newVal
  33600. }
  33601. var domProps = {
  33602. create: updateDOMProps,
  33603. update: updateDOMProps
  33604. };
  33605. /* */
  33606. var parseStyleText = cached(function (cssText) {
  33607. var res = {};
  33608. var listDelimiter = /;(?![^(]*\))/g;
  33609. var propertyDelimiter = /:(.+)/;
  33610. cssText.split(listDelimiter).forEach(function (item) {
  33611. if (item) {
  33612. var tmp = item.split(propertyDelimiter);
  33613. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  33614. }
  33615. });
  33616. return res
  33617. });
  33618. // merge static and dynamic style data on the same vnode
  33619. function normalizeStyleData (data) {
  33620. var style = normalizeStyleBinding(data.style);
  33621. // static style is pre-processed into an object during compilation
  33622. // and is always a fresh object, so it's safe to merge into it
  33623. return data.staticStyle
  33624. ? extend(data.staticStyle, style)
  33625. : style
  33626. }
  33627. // normalize possible array / string values into Object
  33628. function normalizeStyleBinding (bindingStyle) {
  33629. if (Array.isArray(bindingStyle)) {
  33630. return toObject(bindingStyle)
  33631. }
  33632. if (typeof bindingStyle === 'string') {
  33633. return parseStyleText(bindingStyle)
  33634. }
  33635. return bindingStyle
  33636. }
  33637. /**
  33638. * parent component style should be after child's
  33639. * so that parent component's style could override it
  33640. */
  33641. function getStyle (vnode, checkChild) {
  33642. var res = {};
  33643. var styleData;
  33644. if (checkChild) {
  33645. var childNode = vnode;
  33646. while (childNode.componentInstance) {
  33647. childNode = childNode.componentInstance._vnode;
  33648. if (
  33649. childNode && childNode.data &&
  33650. (styleData = normalizeStyleData(childNode.data))
  33651. ) {
  33652. extend(res, styleData);
  33653. }
  33654. }
  33655. }
  33656. if ((styleData = normalizeStyleData(vnode.data))) {
  33657. extend(res, styleData);
  33658. }
  33659. var parentNode = vnode;
  33660. while ((parentNode = parentNode.parent)) {
  33661. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  33662. extend(res, styleData);
  33663. }
  33664. }
  33665. return res
  33666. }
  33667. /* */
  33668. var cssVarRE = /^--/;
  33669. var importantRE = /\s*!important$/;
  33670. var setProp = function (el, name, val) {
  33671. /* istanbul ignore if */
  33672. if (cssVarRE.test(name)) {
  33673. el.style.setProperty(name, val);
  33674. } else if (importantRE.test(val)) {
  33675. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  33676. } else {
  33677. var normalizedName = normalize(name);
  33678. if (Array.isArray(val)) {
  33679. // Support values array created by autoprefixer, e.g.
  33680. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  33681. // Set them one by one, and the browser will only set those it can recognize
  33682. for (var i = 0, len = val.length; i < len; i++) {
  33683. el.style[normalizedName] = val[i];
  33684. }
  33685. } else {
  33686. el.style[normalizedName] = val;
  33687. }
  33688. }
  33689. };
  33690. var vendorNames = ['Webkit', 'Moz', 'ms'];
  33691. var emptyStyle;
  33692. var normalize = cached(function (prop) {
  33693. emptyStyle = emptyStyle || document.createElement('div').style;
  33694. prop = camelize(prop);
  33695. if (prop !== 'filter' && (prop in emptyStyle)) {
  33696. return prop
  33697. }
  33698. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  33699. for (var i = 0; i < vendorNames.length; i++) {
  33700. var name = vendorNames[i] + capName;
  33701. if (name in emptyStyle) {
  33702. return name
  33703. }
  33704. }
  33705. });
  33706. function updateStyle (oldVnode, vnode) {
  33707. var data = vnode.data;
  33708. var oldData = oldVnode.data;
  33709. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  33710. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  33711. ) {
  33712. return
  33713. }
  33714. var cur, name;
  33715. var el = vnode.elm;
  33716. var oldStaticStyle = oldData.staticStyle;
  33717. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  33718. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  33719. var oldStyle = oldStaticStyle || oldStyleBinding;
  33720. var style = normalizeStyleBinding(vnode.data.style) || {};
  33721. // store normalized style under a different key for next diff
  33722. // make sure to clone it if it's reactive, since the user likely wants
  33723. // to mutate it.
  33724. vnode.data.normalizedStyle = isDef(style.__ob__)
  33725. ? extend({}, style)
  33726. : style;
  33727. var newStyle = getStyle(vnode, true);
  33728. for (name in oldStyle) {
  33729. if (isUndef(newStyle[name])) {
  33730. setProp(el, name, '');
  33731. }
  33732. }
  33733. for (name in newStyle) {
  33734. cur = newStyle[name];
  33735. if (cur !== oldStyle[name]) {
  33736. // ie9 setting to null has no effect, must use empty string
  33737. setProp(el, name, cur == null ? '' : cur);
  33738. }
  33739. }
  33740. }
  33741. var style = {
  33742. create: updateStyle,
  33743. update: updateStyle
  33744. };
  33745. /* */
  33746. /**
  33747. * Add class with compatibility for SVG since classList is not supported on
  33748. * SVG elements in IE
  33749. */
  33750. function addClass (el, cls) {
  33751. /* istanbul ignore if */
  33752. if (!cls || !(cls = cls.trim())) {
  33753. return
  33754. }
  33755. /* istanbul ignore else */
  33756. if (el.classList) {
  33757. if (cls.indexOf(' ') > -1) {
  33758. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  33759. } else {
  33760. el.classList.add(cls);
  33761. }
  33762. } else {
  33763. var cur = " " + (el.getAttribute('class') || '') + " ";
  33764. if (cur.indexOf(' ' + cls + ' ') < 0) {
  33765. el.setAttribute('class', (cur + cls).trim());
  33766. }
  33767. }
  33768. }
  33769. /**
  33770. * Remove class with compatibility for SVG since classList is not supported on
  33771. * SVG elements in IE
  33772. */
  33773. function removeClass (el, cls) {
  33774. /* istanbul ignore if */
  33775. if (!cls || !(cls = cls.trim())) {
  33776. return
  33777. }
  33778. /* istanbul ignore else */
  33779. if (el.classList) {
  33780. if (cls.indexOf(' ') > -1) {
  33781. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  33782. } else {
  33783. el.classList.remove(cls);
  33784. }
  33785. if (!el.classList.length) {
  33786. el.removeAttribute('class');
  33787. }
  33788. } else {
  33789. var cur = " " + (el.getAttribute('class') || '') + " ";
  33790. var tar = ' ' + cls + ' ';
  33791. while (cur.indexOf(tar) >= 0) {
  33792. cur = cur.replace(tar, ' ');
  33793. }
  33794. cur = cur.trim();
  33795. if (cur) {
  33796. el.setAttribute('class', cur);
  33797. } else {
  33798. el.removeAttribute('class');
  33799. }
  33800. }
  33801. }
  33802. /* */
  33803. function resolveTransition (def) {
  33804. if (!def) {
  33805. return
  33806. }
  33807. /* istanbul ignore else */
  33808. if (typeof def === 'object') {
  33809. var res = {};
  33810. if (def.css !== false) {
  33811. extend(res, autoCssTransition(def.name || 'v'));
  33812. }
  33813. extend(res, def);
  33814. return res
  33815. } else if (typeof def === 'string') {
  33816. return autoCssTransition(def)
  33817. }
  33818. }
  33819. var autoCssTransition = cached(function (name) {
  33820. return {
  33821. enterClass: (name + "-enter"),
  33822. enterToClass: (name + "-enter-to"),
  33823. enterActiveClass: (name + "-enter-active"),
  33824. leaveClass: (name + "-leave"),
  33825. leaveToClass: (name + "-leave-to"),
  33826. leaveActiveClass: (name + "-leave-active")
  33827. }
  33828. });
  33829. var hasTransition = inBrowser && !isIE9;
  33830. var TRANSITION = 'transition';
  33831. var ANIMATION = 'animation';
  33832. // Transition property/event sniffing
  33833. var transitionProp = 'transition';
  33834. var transitionEndEvent = 'transitionend';
  33835. var animationProp = 'animation';
  33836. var animationEndEvent = 'animationend';
  33837. if (hasTransition) {
  33838. /* istanbul ignore if */
  33839. if (window.ontransitionend === undefined &&
  33840. window.onwebkittransitionend !== undefined
  33841. ) {
  33842. transitionProp = 'WebkitTransition';
  33843. transitionEndEvent = 'webkitTransitionEnd';
  33844. }
  33845. if (window.onanimationend === undefined &&
  33846. window.onwebkitanimationend !== undefined
  33847. ) {
  33848. animationProp = 'WebkitAnimation';
  33849. animationEndEvent = 'webkitAnimationEnd';
  33850. }
  33851. }
  33852. // binding to window is necessary to make hot reload work in IE in strict mode
  33853. var raf = inBrowser
  33854. ? window.requestAnimationFrame
  33855. ? window.requestAnimationFrame.bind(window)
  33856. : setTimeout
  33857. : /* istanbul ignore next */ function (fn) { return fn(); };
  33858. function nextFrame (fn) {
  33859. raf(function () {
  33860. raf(fn);
  33861. });
  33862. }
  33863. function addTransitionClass (el, cls) {
  33864. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  33865. if (transitionClasses.indexOf(cls) < 0) {
  33866. transitionClasses.push(cls);
  33867. addClass(el, cls);
  33868. }
  33869. }
  33870. function removeTransitionClass (el, cls) {
  33871. if (el._transitionClasses) {
  33872. remove(el._transitionClasses, cls);
  33873. }
  33874. removeClass(el, cls);
  33875. }
  33876. function whenTransitionEnds (
  33877. el,
  33878. expectedType,
  33879. cb
  33880. ) {
  33881. var ref = getTransitionInfo(el, expectedType);
  33882. var type = ref.type;
  33883. var timeout = ref.timeout;
  33884. var propCount = ref.propCount;
  33885. if (!type) { return cb() }
  33886. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  33887. var ended = 0;
  33888. var end = function () {
  33889. el.removeEventListener(event, onEnd);
  33890. cb();
  33891. };
  33892. var onEnd = function (e) {
  33893. if (e.target === el) {
  33894. if (++ended >= propCount) {
  33895. end();
  33896. }
  33897. }
  33898. };
  33899. setTimeout(function () {
  33900. if (ended < propCount) {
  33901. end();
  33902. }
  33903. }, timeout + 1);
  33904. el.addEventListener(event, onEnd);
  33905. }
  33906. var transformRE = /\b(transform|all)(,|$)/;
  33907. function getTransitionInfo (el, expectedType) {
  33908. var styles = window.getComputedStyle(el);
  33909. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  33910. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  33911. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  33912. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  33913. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  33914. var animationTimeout = getTimeout(animationDelays, animationDurations);
  33915. var type;
  33916. var timeout = 0;
  33917. var propCount = 0;
  33918. /* istanbul ignore if */
  33919. if (expectedType === TRANSITION) {
  33920. if (transitionTimeout > 0) {
  33921. type = TRANSITION;
  33922. timeout = transitionTimeout;
  33923. propCount = transitionDurations.length;
  33924. }
  33925. } else if (expectedType === ANIMATION) {
  33926. if (animationTimeout > 0) {
  33927. type = ANIMATION;
  33928. timeout = animationTimeout;
  33929. propCount = animationDurations.length;
  33930. }
  33931. } else {
  33932. timeout = Math.max(transitionTimeout, animationTimeout);
  33933. type = timeout > 0
  33934. ? transitionTimeout > animationTimeout
  33935. ? TRANSITION
  33936. : ANIMATION
  33937. : null;
  33938. propCount = type
  33939. ? type === TRANSITION
  33940. ? transitionDurations.length
  33941. : animationDurations.length
  33942. : 0;
  33943. }
  33944. var hasTransform =
  33945. type === TRANSITION &&
  33946. transformRE.test(styles[transitionProp + 'Property']);
  33947. return {
  33948. type: type,
  33949. timeout: timeout,
  33950. propCount: propCount,
  33951. hasTransform: hasTransform
  33952. }
  33953. }
  33954. function getTimeout (delays, durations) {
  33955. /* istanbul ignore next */
  33956. while (delays.length < durations.length) {
  33957. delays = delays.concat(delays);
  33958. }
  33959. return Math.max.apply(null, durations.map(function (d, i) {
  33960. return toMs(d) + toMs(delays[i])
  33961. }))
  33962. }
  33963. function toMs (s) {
  33964. return Number(s.slice(0, -1)) * 1000
  33965. }
  33966. /* */
  33967. function enter (vnode, toggleDisplay) {
  33968. var el = vnode.elm;
  33969. // call leave callback now
  33970. if (isDef(el._leaveCb)) {
  33971. el._leaveCb.cancelled = true;
  33972. el._leaveCb();
  33973. }
  33974. var data = resolveTransition(vnode.data.transition);
  33975. if (isUndef(data)) {
  33976. return
  33977. }
  33978. /* istanbul ignore if */
  33979. if (isDef(el._enterCb) || el.nodeType !== 1) {
  33980. return
  33981. }
  33982. var css = data.css;
  33983. var type = data.type;
  33984. var enterClass = data.enterClass;
  33985. var enterToClass = data.enterToClass;
  33986. var enterActiveClass = data.enterActiveClass;
  33987. var appearClass = data.appearClass;
  33988. var appearToClass = data.appearToClass;
  33989. var appearActiveClass = data.appearActiveClass;
  33990. var beforeEnter = data.beforeEnter;
  33991. var enter = data.enter;
  33992. var afterEnter = data.afterEnter;
  33993. var enterCancelled = data.enterCancelled;
  33994. var beforeAppear = data.beforeAppear;
  33995. var appear = data.appear;
  33996. var afterAppear = data.afterAppear;
  33997. var appearCancelled = data.appearCancelled;
  33998. var duration = data.duration;
  33999. // activeInstance will always be the <transition> component managing this
  34000. // transition. One edge case to check is when the <transition> is placed
  34001. // as the root node of a child component. In that case we need to check
  34002. // <transition>'s parent for appear check.
  34003. var context = activeInstance;
  34004. var transitionNode = activeInstance.$vnode;
  34005. while (transitionNode && transitionNode.parent) {
  34006. transitionNode = transitionNode.parent;
  34007. context = transitionNode.context;
  34008. }
  34009. var isAppear = !context._isMounted || !vnode.isRootInsert;
  34010. if (isAppear && !appear && appear !== '') {
  34011. return
  34012. }
  34013. var startClass = isAppear && appearClass
  34014. ? appearClass
  34015. : enterClass;
  34016. var activeClass = isAppear && appearActiveClass
  34017. ? appearActiveClass
  34018. : enterActiveClass;
  34019. var toClass = isAppear && appearToClass
  34020. ? appearToClass
  34021. : enterToClass;
  34022. var beforeEnterHook = isAppear
  34023. ? (beforeAppear || beforeEnter)
  34024. : beforeEnter;
  34025. var enterHook = isAppear
  34026. ? (typeof appear === 'function' ? appear : enter)
  34027. : enter;
  34028. var afterEnterHook = isAppear
  34029. ? (afterAppear || afterEnter)
  34030. : afterEnter;
  34031. var enterCancelledHook = isAppear
  34032. ? (appearCancelled || enterCancelled)
  34033. : enterCancelled;
  34034. var explicitEnterDuration = toNumber(
  34035. isObject(duration)
  34036. ? duration.enter
  34037. : duration
  34038. );
  34039. if ("development" !== 'production' && explicitEnterDuration != null) {
  34040. checkDuration(explicitEnterDuration, 'enter', vnode);
  34041. }
  34042. var expectsCSS = css !== false && !isIE9;
  34043. var userWantsControl = getHookArgumentsLength(enterHook);
  34044. var cb = el._enterCb = once(function () {
  34045. if (expectsCSS) {
  34046. removeTransitionClass(el, toClass);
  34047. removeTransitionClass(el, activeClass);
  34048. }
  34049. if (cb.cancelled) {
  34050. if (expectsCSS) {
  34051. removeTransitionClass(el, startClass);
  34052. }
  34053. enterCancelledHook && enterCancelledHook(el);
  34054. } else {
  34055. afterEnterHook && afterEnterHook(el);
  34056. }
  34057. el._enterCb = null;
  34058. });
  34059. if (!vnode.data.show) {
  34060. // remove pending leave element on enter by injecting an insert hook
  34061. mergeVNodeHook(vnode, 'insert', function () {
  34062. var parent = el.parentNode;
  34063. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  34064. if (pendingNode &&
  34065. pendingNode.tag === vnode.tag &&
  34066. pendingNode.elm._leaveCb
  34067. ) {
  34068. pendingNode.elm._leaveCb();
  34069. }
  34070. enterHook && enterHook(el, cb);
  34071. });
  34072. }
  34073. // start enter transition
  34074. beforeEnterHook && beforeEnterHook(el);
  34075. if (expectsCSS) {
  34076. addTransitionClass(el, startClass);
  34077. addTransitionClass(el, activeClass);
  34078. nextFrame(function () {
  34079. addTransitionClass(el, toClass);
  34080. removeTransitionClass(el, startClass);
  34081. if (!cb.cancelled && !userWantsControl) {
  34082. if (isValidDuration(explicitEnterDuration)) {
  34083. setTimeout(cb, explicitEnterDuration);
  34084. } else {
  34085. whenTransitionEnds(el, type, cb);
  34086. }
  34087. }
  34088. });
  34089. }
  34090. if (vnode.data.show) {
  34091. toggleDisplay && toggleDisplay();
  34092. enterHook && enterHook(el, cb);
  34093. }
  34094. if (!expectsCSS && !userWantsControl) {
  34095. cb();
  34096. }
  34097. }
  34098. function leave (vnode, rm) {
  34099. var el = vnode.elm;
  34100. // call enter callback now
  34101. if (isDef(el._enterCb)) {
  34102. el._enterCb.cancelled = true;
  34103. el._enterCb();
  34104. }
  34105. var data = resolveTransition(vnode.data.transition);
  34106. if (isUndef(data) || el.nodeType !== 1) {
  34107. return rm()
  34108. }
  34109. /* istanbul ignore if */
  34110. if (isDef(el._leaveCb)) {
  34111. return
  34112. }
  34113. var css = data.css;
  34114. var type = data.type;
  34115. var leaveClass = data.leaveClass;
  34116. var leaveToClass = data.leaveToClass;
  34117. var leaveActiveClass = data.leaveActiveClass;
  34118. var beforeLeave = data.beforeLeave;
  34119. var leave = data.leave;
  34120. var afterLeave = data.afterLeave;
  34121. var leaveCancelled = data.leaveCancelled;
  34122. var delayLeave = data.delayLeave;
  34123. var duration = data.duration;
  34124. var expectsCSS = css !== false && !isIE9;
  34125. var userWantsControl = getHookArgumentsLength(leave);
  34126. var explicitLeaveDuration = toNumber(
  34127. isObject(duration)
  34128. ? duration.leave
  34129. : duration
  34130. );
  34131. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  34132. checkDuration(explicitLeaveDuration, 'leave', vnode);
  34133. }
  34134. var cb = el._leaveCb = once(function () {
  34135. if (el.parentNode && el.parentNode._pending) {
  34136. el.parentNode._pending[vnode.key] = null;
  34137. }
  34138. if (expectsCSS) {
  34139. removeTransitionClass(el, leaveToClass);
  34140. removeTransitionClass(el, leaveActiveClass);
  34141. }
  34142. if (cb.cancelled) {
  34143. if (expectsCSS) {
  34144. removeTransitionClass(el, leaveClass);
  34145. }
  34146. leaveCancelled && leaveCancelled(el);
  34147. } else {
  34148. rm();
  34149. afterLeave && afterLeave(el);
  34150. }
  34151. el._leaveCb = null;
  34152. });
  34153. if (delayLeave) {
  34154. delayLeave(performLeave);
  34155. } else {
  34156. performLeave();
  34157. }
  34158. function performLeave () {
  34159. // the delayed leave may have already been cancelled
  34160. if (cb.cancelled) {
  34161. return
  34162. }
  34163. // record leaving element
  34164. if (!vnode.data.show) {
  34165. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  34166. }
  34167. beforeLeave && beforeLeave(el);
  34168. if (expectsCSS) {
  34169. addTransitionClass(el, leaveClass);
  34170. addTransitionClass(el, leaveActiveClass);
  34171. nextFrame(function () {
  34172. addTransitionClass(el, leaveToClass);
  34173. removeTransitionClass(el, leaveClass);
  34174. if (!cb.cancelled && !userWantsControl) {
  34175. if (isValidDuration(explicitLeaveDuration)) {
  34176. setTimeout(cb, explicitLeaveDuration);
  34177. } else {
  34178. whenTransitionEnds(el, type, cb);
  34179. }
  34180. }
  34181. });
  34182. }
  34183. leave && leave(el, cb);
  34184. if (!expectsCSS && !userWantsControl) {
  34185. cb();
  34186. }
  34187. }
  34188. }
  34189. // only used in dev mode
  34190. function checkDuration (val, name, vnode) {
  34191. if (typeof val !== 'number') {
  34192. warn(
  34193. "<transition> explicit " + name + " duration is not a valid number - " +
  34194. "got " + (JSON.stringify(val)) + ".",
  34195. vnode.context
  34196. );
  34197. } else if (isNaN(val)) {
  34198. warn(
  34199. "<transition> explicit " + name + " duration is NaN - " +
  34200. 'the duration expression might be incorrect.',
  34201. vnode.context
  34202. );
  34203. }
  34204. }
  34205. function isValidDuration (val) {
  34206. return typeof val === 'number' && !isNaN(val)
  34207. }
  34208. /**
  34209. * Normalize a transition hook's argument length. The hook may be:
  34210. * - a merged hook (invoker) with the original in .fns
  34211. * - a wrapped component method (check ._length)
  34212. * - a plain function (.length)
  34213. */
  34214. function getHookArgumentsLength (fn) {
  34215. if (isUndef(fn)) {
  34216. return false
  34217. }
  34218. var invokerFns = fn.fns;
  34219. if (isDef(invokerFns)) {
  34220. // invoker
  34221. return getHookArgumentsLength(
  34222. Array.isArray(invokerFns)
  34223. ? invokerFns[0]
  34224. : invokerFns
  34225. )
  34226. } else {
  34227. return (fn._length || fn.length) > 1
  34228. }
  34229. }
  34230. function _enter (_, vnode) {
  34231. if (vnode.data.show !== true) {
  34232. enter(vnode);
  34233. }
  34234. }
  34235. var transition = inBrowser ? {
  34236. create: _enter,
  34237. activate: _enter,
  34238. remove: function remove$$1 (vnode, rm) {
  34239. /* istanbul ignore else */
  34240. if (vnode.data.show !== true) {
  34241. leave(vnode, rm);
  34242. } else {
  34243. rm();
  34244. }
  34245. }
  34246. } : {};
  34247. var platformModules = [
  34248. attrs,
  34249. klass,
  34250. events,
  34251. domProps,
  34252. style,
  34253. transition
  34254. ];
  34255. /* */
  34256. // the directive module should be applied last, after all
  34257. // built-in modules have been applied.
  34258. var modules = platformModules.concat(baseModules);
  34259. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  34260. /**
  34261. * Not type checking this file because flow doesn't like attaching
  34262. * properties to Elements.
  34263. */
  34264. /* istanbul ignore if */
  34265. if (isIE9) {
  34266. // http://www.matts411.com/post/internet-explorer-9-oninput/
  34267. document.addEventListener('selectionchange', function () {
  34268. var el = document.activeElement;
  34269. if (el && el.vmodel) {
  34270. trigger(el, 'input');
  34271. }
  34272. });
  34273. }
  34274. var directive = {
  34275. inserted: function inserted (el, binding, vnode, oldVnode) {
  34276. if (vnode.tag === 'select') {
  34277. // #6903
  34278. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  34279. mergeVNodeHook(vnode, 'postpatch', function () {
  34280. directive.componentUpdated(el, binding, vnode);
  34281. });
  34282. } else {
  34283. setSelected(el, binding, vnode.context);
  34284. }
  34285. el._vOptions = [].map.call(el.options, getValue);
  34286. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  34287. el._vModifiers = binding.modifiers;
  34288. if (!binding.modifiers.lazy) {
  34289. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  34290. // switching focus before confirming composition choice
  34291. // this also fixes the issue where some browsers e.g. iOS Chrome
  34292. // fires "change" instead of "input" on autocomplete.
  34293. el.addEventListener('change', onCompositionEnd);
  34294. if (!isAndroid) {
  34295. el.addEventListener('compositionstart', onCompositionStart);
  34296. el.addEventListener('compositionend', onCompositionEnd);
  34297. }
  34298. /* istanbul ignore if */
  34299. if (isIE9) {
  34300. el.vmodel = true;
  34301. }
  34302. }
  34303. }
  34304. },
  34305. componentUpdated: function componentUpdated (el, binding, vnode) {
  34306. if (vnode.tag === 'select') {
  34307. setSelected(el, binding, vnode.context);
  34308. // in case the options rendered by v-for have changed,
  34309. // it's possible that the value is out-of-sync with the rendered options.
  34310. // detect such cases and filter out values that no longer has a matching
  34311. // option in the DOM.
  34312. var prevOptions = el._vOptions;
  34313. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  34314. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  34315. // trigger change event if
  34316. // no matching option found for at least one value
  34317. var needReset = el.multiple
  34318. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  34319. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  34320. if (needReset) {
  34321. trigger(el, 'change');
  34322. }
  34323. }
  34324. }
  34325. }
  34326. };
  34327. function setSelected (el, binding, vm) {
  34328. actuallySetSelected(el, binding, vm);
  34329. /* istanbul ignore if */
  34330. if (isIE || isEdge) {
  34331. setTimeout(function () {
  34332. actuallySetSelected(el, binding, vm);
  34333. }, 0);
  34334. }
  34335. }
  34336. function actuallySetSelected (el, binding, vm) {
  34337. var value = binding.value;
  34338. var isMultiple = el.multiple;
  34339. if (isMultiple && !Array.isArray(value)) {
  34340. "development" !== 'production' && warn(
  34341. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  34342. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  34343. vm
  34344. );
  34345. return
  34346. }
  34347. var selected, option;
  34348. for (var i = 0, l = el.options.length; i < l; i++) {
  34349. option = el.options[i];
  34350. if (isMultiple) {
  34351. selected = looseIndexOf(value, getValue(option)) > -1;
  34352. if (option.selected !== selected) {
  34353. option.selected = selected;
  34354. }
  34355. } else {
  34356. if (looseEqual(getValue(option), value)) {
  34357. if (el.selectedIndex !== i) {
  34358. el.selectedIndex = i;
  34359. }
  34360. return
  34361. }
  34362. }
  34363. }
  34364. if (!isMultiple) {
  34365. el.selectedIndex = -1;
  34366. }
  34367. }
  34368. function hasNoMatchingOption (value, options) {
  34369. return options.every(function (o) { return !looseEqual(o, value); })
  34370. }
  34371. function getValue (option) {
  34372. return '_value' in option
  34373. ? option._value
  34374. : option.value
  34375. }
  34376. function onCompositionStart (e) {
  34377. e.target.composing = true;
  34378. }
  34379. function onCompositionEnd (e) {
  34380. // prevent triggering an input event for no reason
  34381. if (!e.target.composing) { return }
  34382. e.target.composing = false;
  34383. trigger(e.target, 'input');
  34384. }
  34385. function trigger (el, type) {
  34386. var e = document.createEvent('HTMLEvents');
  34387. e.initEvent(type, true, true);
  34388. el.dispatchEvent(e);
  34389. }
  34390. /* */
  34391. // recursively search for possible transition defined inside the component root
  34392. function locateNode (vnode) {
  34393. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  34394. ? locateNode(vnode.componentInstance._vnode)
  34395. : vnode
  34396. }
  34397. var show = {
  34398. bind: function bind (el, ref, vnode) {
  34399. var value = ref.value;
  34400. vnode = locateNode(vnode);
  34401. var transition$$1 = vnode.data && vnode.data.transition;
  34402. var originalDisplay = el.__vOriginalDisplay =
  34403. el.style.display === 'none' ? '' : el.style.display;
  34404. if (value && transition$$1) {
  34405. vnode.data.show = true;
  34406. enter(vnode, function () {
  34407. el.style.display = originalDisplay;
  34408. });
  34409. } else {
  34410. el.style.display = value ? originalDisplay : 'none';
  34411. }
  34412. },
  34413. update: function update (el, ref, vnode) {
  34414. var value = ref.value;
  34415. var oldValue = ref.oldValue;
  34416. /* istanbul ignore if */
  34417. if (value === oldValue) { return }
  34418. vnode = locateNode(vnode);
  34419. var transition$$1 = vnode.data && vnode.data.transition;
  34420. if (transition$$1) {
  34421. vnode.data.show = true;
  34422. if (value) {
  34423. enter(vnode, function () {
  34424. el.style.display = el.__vOriginalDisplay;
  34425. });
  34426. } else {
  34427. leave(vnode, function () {
  34428. el.style.display = 'none';
  34429. });
  34430. }
  34431. } else {
  34432. el.style.display = value ? el.__vOriginalDisplay : 'none';
  34433. }
  34434. },
  34435. unbind: function unbind (
  34436. el,
  34437. binding,
  34438. vnode,
  34439. oldVnode,
  34440. isDestroy
  34441. ) {
  34442. if (!isDestroy) {
  34443. el.style.display = el.__vOriginalDisplay;
  34444. }
  34445. }
  34446. };
  34447. var platformDirectives = {
  34448. model: directive,
  34449. show: show
  34450. };
  34451. /* */
  34452. // Provides transition support for a single element/component.
  34453. // supports transition mode (out-in / in-out)
  34454. var transitionProps = {
  34455. name: String,
  34456. appear: Boolean,
  34457. css: Boolean,
  34458. mode: String,
  34459. type: String,
  34460. enterClass: String,
  34461. leaveClass: String,
  34462. enterToClass: String,
  34463. leaveToClass: String,
  34464. enterActiveClass: String,
  34465. leaveActiveClass: String,
  34466. appearClass: String,
  34467. appearActiveClass: String,
  34468. appearToClass: String,
  34469. duration: [Number, String, Object]
  34470. };
  34471. // in case the child is also an abstract component, e.g. <keep-alive>
  34472. // we want to recursively retrieve the real component to be rendered
  34473. function getRealChild (vnode) {
  34474. var compOptions = vnode && vnode.componentOptions;
  34475. if (compOptions && compOptions.Ctor.options.abstract) {
  34476. return getRealChild(getFirstComponentChild(compOptions.children))
  34477. } else {
  34478. return vnode
  34479. }
  34480. }
  34481. function extractTransitionData (comp) {
  34482. var data = {};
  34483. var options = comp.$options;
  34484. // props
  34485. for (var key in options.propsData) {
  34486. data[key] = comp[key];
  34487. }
  34488. // events.
  34489. // extract listeners and pass them directly to the transition methods
  34490. var listeners = options._parentListeners;
  34491. for (var key$1 in listeners) {
  34492. data[camelize(key$1)] = listeners[key$1];
  34493. }
  34494. return data
  34495. }
  34496. function placeholder (h, rawChild) {
  34497. if (/\d-keep-alive$/.test(rawChild.tag)) {
  34498. return h('keep-alive', {
  34499. props: rawChild.componentOptions.propsData
  34500. })
  34501. }
  34502. }
  34503. function hasParentTransition (vnode) {
  34504. while ((vnode = vnode.parent)) {
  34505. if (vnode.data.transition) {
  34506. return true
  34507. }
  34508. }
  34509. }
  34510. function isSameChild (child, oldChild) {
  34511. return oldChild.key === child.key && oldChild.tag === child.tag
  34512. }
  34513. var Transition = {
  34514. name: 'transition',
  34515. props: transitionProps,
  34516. abstract: true,
  34517. render: function render (h) {
  34518. var this$1 = this;
  34519. var children = this.$slots.default;
  34520. if (!children) {
  34521. return
  34522. }
  34523. // filter out text nodes (possible whitespaces)
  34524. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  34525. /* istanbul ignore if */
  34526. if (!children.length) {
  34527. return
  34528. }
  34529. // warn multiple elements
  34530. if ("development" !== 'production' && children.length > 1) {
  34531. warn(
  34532. '<transition> can only be used on a single element. Use ' +
  34533. '<transition-group> for lists.',
  34534. this.$parent
  34535. );
  34536. }
  34537. var mode = this.mode;
  34538. // warn invalid mode
  34539. if ("development" !== 'production' &&
  34540. mode && mode !== 'in-out' && mode !== 'out-in'
  34541. ) {
  34542. warn(
  34543. 'invalid <transition> mode: ' + mode,
  34544. this.$parent
  34545. );
  34546. }
  34547. var rawChild = children[0];
  34548. // if this is a component root node and the component's
  34549. // parent container node also has transition, skip.
  34550. if (hasParentTransition(this.$vnode)) {
  34551. return rawChild
  34552. }
  34553. // apply transition data to child
  34554. // use getRealChild() to ignore abstract components e.g. keep-alive
  34555. var child = getRealChild(rawChild);
  34556. /* istanbul ignore if */
  34557. if (!child) {
  34558. return rawChild
  34559. }
  34560. if (this._leaving) {
  34561. return placeholder(h, rawChild)
  34562. }
  34563. // ensure a key that is unique to the vnode type and to this transition
  34564. // component instance. This key will be used to remove pending leaving nodes
  34565. // during entering.
  34566. var id = "__transition-" + (this._uid) + "-";
  34567. child.key = child.key == null
  34568. ? child.isComment
  34569. ? id + 'comment'
  34570. : id + child.tag
  34571. : isPrimitive(child.key)
  34572. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  34573. : child.key;
  34574. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  34575. var oldRawChild = this._vnode;
  34576. var oldChild = getRealChild(oldRawChild);
  34577. // mark v-show
  34578. // so that the transition module can hand over the control to the directive
  34579. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  34580. child.data.show = true;
  34581. }
  34582. if (
  34583. oldChild &&
  34584. oldChild.data &&
  34585. !isSameChild(child, oldChild) &&
  34586. !isAsyncPlaceholder(oldChild) &&
  34587. // #6687 component root is a comment node
  34588. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  34589. ) {
  34590. // replace old child transition data with fresh one
  34591. // important for dynamic transitions!
  34592. var oldData = oldChild.data.transition = extend({}, data);
  34593. // handle transition mode
  34594. if (mode === 'out-in') {
  34595. // return placeholder node and queue update when leave finishes
  34596. this._leaving = true;
  34597. mergeVNodeHook(oldData, 'afterLeave', function () {
  34598. this$1._leaving = false;
  34599. this$1.$forceUpdate();
  34600. });
  34601. return placeholder(h, rawChild)
  34602. } else if (mode === 'in-out') {
  34603. if (isAsyncPlaceholder(child)) {
  34604. return oldRawChild
  34605. }
  34606. var delayedLeave;
  34607. var performLeave = function () { delayedLeave(); };
  34608. mergeVNodeHook(data, 'afterEnter', performLeave);
  34609. mergeVNodeHook(data, 'enterCancelled', performLeave);
  34610. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  34611. }
  34612. }
  34613. return rawChild
  34614. }
  34615. };
  34616. /* */
  34617. // Provides transition support for list items.
  34618. // supports move transitions using the FLIP technique.
  34619. // Because the vdom's children update algorithm is "unstable" - i.e.
  34620. // it doesn't guarantee the relative positioning of removed elements,
  34621. // we force transition-group to update its children into two passes:
  34622. // in the first pass, we remove all nodes that need to be removed,
  34623. // triggering their leaving transition; in the second pass, we insert/move
  34624. // into the final desired state. This way in the second pass removed
  34625. // nodes will remain where they should be.
  34626. var props = extend({
  34627. tag: String,
  34628. moveClass: String
  34629. }, transitionProps);
  34630. delete props.mode;
  34631. var TransitionGroup = {
  34632. props: props,
  34633. render: function render (h) {
  34634. var tag = this.tag || this.$vnode.data.tag || 'span';
  34635. var map = Object.create(null);
  34636. var prevChildren = this.prevChildren = this.children;
  34637. var rawChildren = this.$slots.default || [];
  34638. var children = this.children = [];
  34639. var transitionData = extractTransitionData(this);
  34640. for (var i = 0; i < rawChildren.length; i++) {
  34641. var c = rawChildren[i];
  34642. if (c.tag) {
  34643. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  34644. children.push(c);
  34645. map[c.key] = c
  34646. ;(c.data || (c.data = {})).transition = transitionData;
  34647. } else if (true) {
  34648. var opts = c.componentOptions;
  34649. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  34650. warn(("<transition-group> children must be keyed: <" + name + ">"));
  34651. }
  34652. }
  34653. }
  34654. if (prevChildren) {
  34655. var kept = [];
  34656. var removed = [];
  34657. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  34658. var c$1 = prevChildren[i$1];
  34659. c$1.data.transition = transitionData;
  34660. c$1.data.pos = c$1.elm.getBoundingClientRect();
  34661. if (map[c$1.key]) {
  34662. kept.push(c$1);
  34663. } else {
  34664. removed.push(c$1);
  34665. }
  34666. }
  34667. this.kept = h(tag, null, kept);
  34668. this.removed = removed;
  34669. }
  34670. return h(tag, null, children)
  34671. },
  34672. beforeUpdate: function beforeUpdate () {
  34673. // force removing pass
  34674. this.__patch__(
  34675. this._vnode,
  34676. this.kept,
  34677. false, // hydrating
  34678. true // removeOnly (!important avoids unnecessary moves)
  34679. );
  34680. this._vnode = this.kept;
  34681. },
  34682. updated: function updated () {
  34683. var children = this.prevChildren;
  34684. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  34685. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  34686. return
  34687. }
  34688. // we divide the work into three loops to avoid mixing DOM reads and writes
  34689. // in each iteration - which helps prevent layout thrashing.
  34690. children.forEach(callPendingCbs);
  34691. children.forEach(recordPosition);
  34692. children.forEach(applyTranslation);
  34693. // force reflow to put everything in position
  34694. // assign to this to avoid being removed in tree-shaking
  34695. // $flow-disable-line
  34696. this._reflow = document.body.offsetHeight;
  34697. children.forEach(function (c) {
  34698. if (c.data.moved) {
  34699. var el = c.elm;
  34700. var s = el.style;
  34701. addTransitionClass(el, moveClass);
  34702. s.transform = s.WebkitTransform = s.transitionDuration = '';
  34703. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  34704. if (!e || /transform$/.test(e.propertyName)) {
  34705. el.removeEventListener(transitionEndEvent, cb);
  34706. el._moveCb = null;
  34707. removeTransitionClass(el, moveClass);
  34708. }
  34709. });
  34710. }
  34711. });
  34712. },
  34713. methods: {
  34714. hasMove: function hasMove (el, moveClass) {
  34715. /* istanbul ignore if */
  34716. if (!hasTransition) {
  34717. return false
  34718. }
  34719. /* istanbul ignore if */
  34720. if (this._hasMove) {
  34721. return this._hasMove
  34722. }
  34723. // Detect whether an element with the move class applied has
  34724. // CSS transitions. Since the element may be inside an entering
  34725. // transition at this very moment, we make a clone of it and remove
  34726. // all other transition classes applied to ensure only the move class
  34727. // is applied.
  34728. var clone = el.cloneNode();
  34729. if (el._transitionClasses) {
  34730. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  34731. }
  34732. addClass(clone, moveClass);
  34733. clone.style.display = 'none';
  34734. this.$el.appendChild(clone);
  34735. var info = getTransitionInfo(clone);
  34736. this.$el.removeChild(clone);
  34737. return (this._hasMove = info.hasTransform)
  34738. }
  34739. }
  34740. };
  34741. function callPendingCbs (c) {
  34742. /* istanbul ignore if */
  34743. if (c.elm._moveCb) {
  34744. c.elm._moveCb();
  34745. }
  34746. /* istanbul ignore if */
  34747. if (c.elm._enterCb) {
  34748. c.elm._enterCb();
  34749. }
  34750. }
  34751. function recordPosition (c) {
  34752. c.data.newPos = c.elm.getBoundingClientRect();
  34753. }
  34754. function applyTranslation (c) {
  34755. var oldPos = c.data.pos;
  34756. var newPos = c.data.newPos;
  34757. var dx = oldPos.left - newPos.left;
  34758. var dy = oldPos.top - newPos.top;
  34759. if (dx || dy) {
  34760. c.data.moved = true;
  34761. var s = c.elm.style;
  34762. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  34763. s.transitionDuration = '0s';
  34764. }
  34765. }
  34766. var platformComponents = {
  34767. Transition: Transition,
  34768. TransitionGroup: TransitionGroup
  34769. };
  34770. /* */
  34771. // install platform specific utils
  34772. Vue$3.config.mustUseProp = mustUseProp;
  34773. Vue$3.config.isReservedTag = isReservedTag;
  34774. Vue$3.config.isReservedAttr = isReservedAttr;
  34775. Vue$3.config.getTagNamespace = getTagNamespace;
  34776. Vue$3.config.isUnknownElement = isUnknownElement;
  34777. // install platform runtime directives & components
  34778. extend(Vue$3.options.directives, platformDirectives);
  34779. extend(Vue$3.options.components, platformComponents);
  34780. // install platform patch function
  34781. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  34782. // public mount method
  34783. Vue$3.prototype.$mount = function (
  34784. el,
  34785. hydrating
  34786. ) {
  34787. el = el && inBrowser ? query(el) : undefined;
  34788. return mountComponent(this, el, hydrating)
  34789. };
  34790. // devtools global hook
  34791. /* istanbul ignore next */
  34792. Vue$3.nextTick(function () {
  34793. if (config.devtools) {
  34794. if (devtools) {
  34795. devtools.emit('init', Vue$3);
  34796. } else if ("development" !== 'production' && isChrome) {
  34797. console[console.info ? 'info' : 'log'](
  34798. 'Download the Vue Devtools extension for a better development experience:\n' +
  34799. 'https://github.com/vuejs/vue-devtools'
  34800. );
  34801. }
  34802. }
  34803. if ("development" !== 'production' &&
  34804. config.productionTip !== false &&
  34805. inBrowser && typeof console !== 'undefined'
  34806. ) {
  34807. console[console.info ? 'info' : 'log'](
  34808. "You are running Vue in development mode.\n" +
  34809. "Make sure to turn on production mode when deploying for production.\n" +
  34810. "See more tips at https://vuejs.org/guide/deployment.html"
  34811. );
  34812. }
  34813. }, 0);
  34814. /* */
  34815. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  34816. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  34817. var buildRegex = cached(function (delimiters) {
  34818. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  34819. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  34820. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  34821. });
  34822. function parseText (
  34823. text,
  34824. delimiters
  34825. ) {
  34826. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  34827. if (!tagRE.test(text)) {
  34828. return
  34829. }
  34830. var tokens = [];
  34831. var rawTokens = [];
  34832. var lastIndex = tagRE.lastIndex = 0;
  34833. var match, index, tokenValue;
  34834. while ((match = tagRE.exec(text))) {
  34835. index = match.index;
  34836. // push text token
  34837. if (index > lastIndex) {
  34838. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  34839. tokens.push(JSON.stringify(tokenValue));
  34840. }
  34841. // tag token
  34842. var exp = parseFilters(match[1].trim());
  34843. tokens.push(("_s(" + exp + ")"));
  34844. rawTokens.push({ '@binding': exp });
  34845. lastIndex = index + match[0].length;
  34846. }
  34847. if (lastIndex < text.length) {
  34848. rawTokens.push(tokenValue = text.slice(lastIndex));
  34849. tokens.push(JSON.stringify(tokenValue));
  34850. }
  34851. return {
  34852. expression: tokens.join('+'),
  34853. tokens: rawTokens
  34854. }
  34855. }
  34856. /* */
  34857. function transformNode (el, options) {
  34858. var warn = options.warn || baseWarn;
  34859. var staticClass = getAndRemoveAttr(el, 'class');
  34860. if ("development" !== 'production' && staticClass) {
  34861. var res = parseText(staticClass, options.delimiters);
  34862. if (res) {
  34863. warn(
  34864. "class=\"" + staticClass + "\": " +
  34865. 'Interpolation inside attributes has been removed. ' +
  34866. 'Use v-bind or the colon shorthand instead. For example, ' +
  34867. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  34868. );
  34869. }
  34870. }
  34871. if (staticClass) {
  34872. el.staticClass = JSON.stringify(staticClass);
  34873. }
  34874. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  34875. if (classBinding) {
  34876. el.classBinding = classBinding;
  34877. }
  34878. }
  34879. function genData (el) {
  34880. var data = '';
  34881. if (el.staticClass) {
  34882. data += "staticClass:" + (el.staticClass) + ",";
  34883. }
  34884. if (el.classBinding) {
  34885. data += "class:" + (el.classBinding) + ",";
  34886. }
  34887. return data
  34888. }
  34889. var klass$1 = {
  34890. staticKeys: ['staticClass'],
  34891. transformNode: transformNode,
  34892. genData: genData
  34893. };
  34894. /* */
  34895. function transformNode$1 (el, options) {
  34896. var warn = options.warn || baseWarn;
  34897. var staticStyle = getAndRemoveAttr(el, 'style');
  34898. if (staticStyle) {
  34899. /* istanbul ignore if */
  34900. if (true) {
  34901. var res = parseText(staticStyle, options.delimiters);
  34902. if (res) {
  34903. warn(
  34904. "style=\"" + staticStyle + "\": " +
  34905. 'Interpolation inside attributes has been removed. ' +
  34906. 'Use v-bind or the colon shorthand instead. For example, ' +
  34907. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  34908. );
  34909. }
  34910. }
  34911. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  34912. }
  34913. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  34914. if (styleBinding) {
  34915. el.styleBinding = styleBinding;
  34916. }
  34917. }
  34918. function genData$1 (el) {
  34919. var data = '';
  34920. if (el.staticStyle) {
  34921. data += "staticStyle:" + (el.staticStyle) + ",";
  34922. }
  34923. if (el.styleBinding) {
  34924. data += "style:(" + (el.styleBinding) + "),";
  34925. }
  34926. return data
  34927. }
  34928. var style$1 = {
  34929. staticKeys: ['staticStyle'],
  34930. transformNode: transformNode$1,
  34931. genData: genData$1
  34932. };
  34933. /* */
  34934. var decoder;
  34935. var he = {
  34936. decode: function decode (html) {
  34937. decoder = decoder || document.createElement('div');
  34938. decoder.innerHTML = html;
  34939. return decoder.textContent
  34940. }
  34941. };
  34942. /* */
  34943. var isUnaryTag = makeMap(
  34944. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  34945. 'link,meta,param,source,track,wbr'
  34946. );
  34947. // Elements that you can, intentionally, leave open
  34948. // (and which close themselves)
  34949. var canBeLeftOpenTag = makeMap(
  34950. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  34951. );
  34952. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  34953. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  34954. var isNonPhrasingTag = makeMap(
  34955. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  34956. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  34957. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  34958. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  34959. 'title,tr,track'
  34960. );
  34961. /**
  34962. * Not type-checking this file because it's mostly vendor code.
  34963. */
  34964. /*!
  34965. * HTML Parser By John Resig (ejohn.org)
  34966. * Modified by Juriy "kangax" Zaytsev
  34967. * Original code by Erik Arvidsson, Mozilla Public License
  34968. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  34969. */
  34970. // Regular Expressions for parsing tags and attributes
  34971. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  34972. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  34973. // but for Vue templates we can enforce a simple charset
  34974. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  34975. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  34976. var startTagOpen = new RegExp(("^<" + qnameCapture));
  34977. var startTagClose = /^\s*(\/?)>/;
  34978. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  34979. var doctype = /^<!DOCTYPE [^>]+>/i;
  34980. var comment = /^<!--/;
  34981. var conditionalComment = /^<!\[/;
  34982. var IS_REGEX_CAPTURING_BROKEN = false;
  34983. 'x'.replace(/x(.)?/g, function (m, g) {
  34984. IS_REGEX_CAPTURING_BROKEN = g === '';
  34985. });
  34986. // Special Elements (can contain anything)
  34987. var isPlainTextElement = makeMap('script,style,textarea', true);
  34988. var reCache = {};
  34989. var decodingMap = {
  34990. '&lt;': '<',
  34991. '&gt;': '>',
  34992. '&quot;': '"',
  34993. '&amp;': '&',
  34994. '&#10;': '\n',
  34995. '&#9;': '\t'
  34996. };
  34997. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  34998. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
  34999. // #5992
  35000. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  35001. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  35002. function decodeAttr (value, shouldDecodeNewlines) {
  35003. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  35004. return value.replace(re, function (match) { return decodingMap[match]; })
  35005. }
  35006. function parseHTML (html, options) {
  35007. var stack = [];
  35008. var expectHTML = options.expectHTML;
  35009. var isUnaryTag$$1 = options.isUnaryTag || no;
  35010. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  35011. var index = 0;
  35012. var last, lastTag;
  35013. while (html) {
  35014. last = html;
  35015. // Make sure we're not in a plaintext content element like script/style
  35016. if (!lastTag || !isPlainTextElement(lastTag)) {
  35017. var textEnd = html.indexOf('<');
  35018. if (textEnd === 0) {
  35019. // Comment:
  35020. if (comment.test(html)) {
  35021. var commentEnd = html.indexOf('-->');
  35022. if (commentEnd >= 0) {
  35023. if (options.shouldKeepComment) {
  35024. options.comment(html.substring(4, commentEnd));
  35025. }
  35026. advance(commentEnd + 3);
  35027. continue
  35028. }
  35029. }
  35030. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  35031. if (conditionalComment.test(html)) {
  35032. var conditionalEnd = html.indexOf(']>');
  35033. if (conditionalEnd >= 0) {
  35034. advance(conditionalEnd + 2);
  35035. continue
  35036. }
  35037. }
  35038. // Doctype:
  35039. var doctypeMatch = html.match(doctype);
  35040. if (doctypeMatch) {
  35041. advance(doctypeMatch[0].length);
  35042. continue
  35043. }
  35044. // End tag:
  35045. var endTagMatch = html.match(endTag);
  35046. if (endTagMatch) {
  35047. var curIndex = index;
  35048. advance(endTagMatch[0].length);
  35049. parseEndTag(endTagMatch[1], curIndex, index);
  35050. continue
  35051. }
  35052. // Start tag:
  35053. var startTagMatch = parseStartTag();
  35054. if (startTagMatch) {
  35055. handleStartTag(startTagMatch);
  35056. if (shouldIgnoreFirstNewline(lastTag, html)) {
  35057. advance(1);
  35058. }
  35059. continue
  35060. }
  35061. }
  35062. var text = (void 0), rest = (void 0), next = (void 0);
  35063. if (textEnd >= 0) {
  35064. rest = html.slice(textEnd);
  35065. while (
  35066. !endTag.test(rest) &&
  35067. !startTagOpen.test(rest) &&
  35068. !comment.test(rest) &&
  35069. !conditionalComment.test(rest)
  35070. ) {
  35071. // < in plain text, be forgiving and treat it as text
  35072. next = rest.indexOf('<', 1);
  35073. if (next < 0) { break }
  35074. textEnd += next;
  35075. rest = html.slice(textEnd);
  35076. }
  35077. text = html.substring(0, textEnd);
  35078. advance(textEnd);
  35079. }
  35080. if (textEnd < 0) {
  35081. text = html;
  35082. html = '';
  35083. }
  35084. if (options.chars && text) {
  35085. options.chars(text);
  35086. }
  35087. } else {
  35088. var endTagLength = 0;
  35089. var stackedTag = lastTag.toLowerCase();
  35090. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  35091. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  35092. endTagLength = endTag.length;
  35093. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  35094. text = text
  35095. .replace(/<!--([\s\S]*?)-->/g, '$1')
  35096. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  35097. }
  35098. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  35099. text = text.slice(1);
  35100. }
  35101. if (options.chars) {
  35102. options.chars(text);
  35103. }
  35104. return ''
  35105. });
  35106. index += html.length - rest$1.length;
  35107. html = rest$1;
  35108. parseEndTag(stackedTag, index - endTagLength, index);
  35109. }
  35110. if (html === last) {
  35111. options.chars && options.chars(html);
  35112. if ("development" !== 'production' && !stack.length && options.warn) {
  35113. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  35114. }
  35115. break
  35116. }
  35117. }
  35118. // Clean up any remaining tags
  35119. parseEndTag();
  35120. function advance (n) {
  35121. index += n;
  35122. html = html.substring(n);
  35123. }
  35124. function parseStartTag () {
  35125. var start = html.match(startTagOpen);
  35126. if (start) {
  35127. var match = {
  35128. tagName: start[1],
  35129. attrs: [],
  35130. start: index
  35131. };
  35132. advance(start[0].length);
  35133. var end, attr;
  35134. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  35135. advance(attr[0].length);
  35136. match.attrs.push(attr);
  35137. }
  35138. if (end) {
  35139. match.unarySlash = end[1];
  35140. advance(end[0].length);
  35141. match.end = index;
  35142. return match
  35143. }
  35144. }
  35145. }
  35146. function handleStartTag (match) {
  35147. var tagName = match.tagName;
  35148. var unarySlash = match.unarySlash;
  35149. if (expectHTML) {
  35150. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  35151. parseEndTag(lastTag);
  35152. }
  35153. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  35154. parseEndTag(tagName);
  35155. }
  35156. }
  35157. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  35158. var l = match.attrs.length;
  35159. var attrs = new Array(l);
  35160. for (var i = 0; i < l; i++) {
  35161. var args = match.attrs[i];
  35162. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  35163. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  35164. if (args[3] === '') { delete args[3]; }
  35165. if (args[4] === '') { delete args[4]; }
  35166. if (args[5] === '') { delete args[5]; }
  35167. }
  35168. var value = args[3] || args[4] || args[5] || '';
  35169. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  35170. ? options.shouldDecodeNewlinesForHref
  35171. : options.shouldDecodeNewlines;
  35172. attrs[i] = {
  35173. name: args[1],
  35174. value: decodeAttr(value, shouldDecodeNewlines)
  35175. };
  35176. }
  35177. if (!unary) {
  35178. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  35179. lastTag = tagName;
  35180. }
  35181. if (options.start) {
  35182. options.start(tagName, attrs, unary, match.start, match.end);
  35183. }
  35184. }
  35185. function parseEndTag (tagName, start, end) {
  35186. var pos, lowerCasedTagName;
  35187. if (start == null) { start = index; }
  35188. if (end == null) { end = index; }
  35189. if (tagName) {
  35190. lowerCasedTagName = tagName.toLowerCase();
  35191. }
  35192. // Find the closest opened tag of the same type
  35193. if (tagName) {
  35194. for (pos = stack.length - 1; pos >= 0; pos--) {
  35195. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  35196. break
  35197. }
  35198. }
  35199. } else {
  35200. // If no tag name is provided, clean shop
  35201. pos = 0;
  35202. }
  35203. if (pos >= 0) {
  35204. // Close all the open elements, up the stack
  35205. for (var i = stack.length - 1; i >= pos; i--) {
  35206. if ("development" !== 'production' &&
  35207. (i > pos || !tagName) &&
  35208. options.warn
  35209. ) {
  35210. options.warn(
  35211. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  35212. );
  35213. }
  35214. if (options.end) {
  35215. options.end(stack[i].tag, start, end);
  35216. }
  35217. }
  35218. // Remove the open elements from the stack
  35219. stack.length = pos;
  35220. lastTag = pos && stack[pos - 1].tag;
  35221. } else if (lowerCasedTagName === 'br') {
  35222. if (options.start) {
  35223. options.start(tagName, [], true, start, end);
  35224. }
  35225. } else if (lowerCasedTagName === 'p') {
  35226. if (options.start) {
  35227. options.start(tagName, [], false, start, end);
  35228. }
  35229. if (options.end) {
  35230. options.end(tagName, start, end);
  35231. }
  35232. }
  35233. }
  35234. }
  35235. /* */
  35236. var onRE = /^@|^v-on:/;
  35237. var dirRE = /^v-|^@|^:/;
  35238. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  35239. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  35240. var stripParensRE = /^\(|\)$/g;
  35241. var argRE = /:(.*)$/;
  35242. var bindRE = /^:|^v-bind:/;
  35243. var modifierRE = /\.[^.]+/g;
  35244. var decodeHTMLCached = cached(he.decode);
  35245. // configurable state
  35246. var warn$2;
  35247. var delimiters;
  35248. var transforms;
  35249. var preTransforms;
  35250. var postTransforms;
  35251. var platformIsPreTag;
  35252. var platformMustUseProp;
  35253. var platformGetTagNamespace;
  35254. function createASTElement (
  35255. tag,
  35256. attrs,
  35257. parent
  35258. ) {
  35259. return {
  35260. type: 1,
  35261. tag: tag,
  35262. attrsList: attrs,
  35263. attrsMap: makeAttrsMap(attrs),
  35264. parent: parent,
  35265. children: []
  35266. }
  35267. }
  35268. /**
  35269. * Convert HTML string to AST.
  35270. */
  35271. function parse (
  35272. template,
  35273. options
  35274. ) {
  35275. warn$2 = options.warn || baseWarn;
  35276. platformIsPreTag = options.isPreTag || no;
  35277. platformMustUseProp = options.mustUseProp || no;
  35278. platformGetTagNamespace = options.getTagNamespace || no;
  35279. transforms = pluckModuleFunction(options.modules, 'transformNode');
  35280. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  35281. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  35282. delimiters = options.delimiters;
  35283. var stack = [];
  35284. var preserveWhitespace = options.preserveWhitespace !== false;
  35285. var root;
  35286. var currentParent;
  35287. var inVPre = false;
  35288. var inPre = false;
  35289. var warned = false;
  35290. function warnOnce (msg) {
  35291. if (!warned) {
  35292. warned = true;
  35293. warn$2(msg);
  35294. }
  35295. }
  35296. function closeElement (element) {
  35297. // check pre state
  35298. if (element.pre) {
  35299. inVPre = false;
  35300. }
  35301. if (platformIsPreTag(element.tag)) {
  35302. inPre = false;
  35303. }
  35304. // apply post-transforms
  35305. for (var i = 0; i < postTransforms.length; i++) {
  35306. postTransforms[i](element, options);
  35307. }
  35308. }
  35309. parseHTML(template, {
  35310. warn: warn$2,
  35311. expectHTML: options.expectHTML,
  35312. isUnaryTag: options.isUnaryTag,
  35313. canBeLeftOpenTag: options.canBeLeftOpenTag,
  35314. shouldDecodeNewlines: options.shouldDecodeNewlines,
  35315. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  35316. shouldKeepComment: options.comments,
  35317. start: function start (tag, attrs, unary) {
  35318. // check namespace.
  35319. // inherit parent ns if there is one
  35320. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  35321. // handle IE svg bug
  35322. /* istanbul ignore if */
  35323. if (isIE && ns === 'svg') {
  35324. attrs = guardIESVGBug(attrs);
  35325. }
  35326. var element = createASTElement(tag, attrs, currentParent);
  35327. if (ns) {
  35328. element.ns = ns;
  35329. }
  35330. if (isForbiddenTag(element) && !isServerRendering()) {
  35331. element.forbidden = true;
  35332. "development" !== 'production' && warn$2(
  35333. 'Templates should only be responsible for mapping the state to the ' +
  35334. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  35335. "<" + tag + ">" + ', as they will not be parsed.'
  35336. );
  35337. }
  35338. // apply pre-transforms
  35339. for (var i = 0; i < preTransforms.length; i++) {
  35340. element = preTransforms[i](element, options) || element;
  35341. }
  35342. if (!inVPre) {
  35343. processPre(element);
  35344. if (element.pre) {
  35345. inVPre = true;
  35346. }
  35347. }
  35348. if (platformIsPreTag(element.tag)) {
  35349. inPre = true;
  35350. }
  35351. if (inVPre) {
  35352. processRawAttrs(element);
  35353. } else if (!element.processed) {
  35354. // structural directives
  35355. processFor(element);
  35356. processIf(element);
  35357. processOnce(element);
  35358. // element-scope stuff
  35359. processElement(element, options);
  35360. }
  35361. function checkRootConstraints (el) {
  35362. if (true) {
  35363. if (el.tag === 'slot' || el.tag === 'template') {
  35364. warnOnce(
  35365. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  35366. 'contain multiple nodes.'
  35367. );
  35368. }
  35369. if (el.attrsMap.hasOwnProperty('v-for')) {
  35370. warnOnce(
  35371. 'Cannot use v-for on stateful component root element because ' +
  35372. 'it renders multiple elements.'
  35373. );
  35374. }
  35375. }
  35376. }
  35377. // tree management
  35378. if (!root) {
  35379. root = element;
  35380. checkRootConstraints(root);
  35381. } else if (!stack.length) {
  35382. // allow root elements with v-if, v-else-if and v-else
  35383. if (root.if && (element.elseif || element.else)) {
  35384. checkRootConstraints(element);
  35385. addIfCondition(root, {
  35386. exp: element.elseif,
  35387. block: element
  35388. });
  35389. } else if (true) {
  35390. warnOnce(
  35391. "Component template should contain exactly one root element. " +
  35392. "If you are using v-if on multiple elements, " +
  35393. "use v-else-if to chain them instead."
  35394. );
  35395. }
  35396. }
  35397. if (currentParent && !element.forbidden) {
  35398. if (element.elseif || element.else) {
  35399. processIfConditions(element, currentParent);
  35400. } else if (element.slotScope) { // scoped slot
  35401. currentParent.plain = false;
  35402. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  35403. } else {
  35404. currentParent.children.push(element);
  35405. element.parent = currentParent;
  35406. }
  35407. }
  35408. if (!unary) {
  35409. currentParent = element;
  35410. stack.push(element);
  35411. } else {
  35412. closeElement(element);
  35413. }
  35414. },
  35415. end: function end () {
  35416. // remove trailing whitespace
  35417. var element = stack[stack.length - 1];
  35418. var lastNode = element.children[element.children.length - 1];
  35419. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  35420. element.children.pop();
  35421. }
  35422. // pop stack
  35423. stack.length -= 1;
  35424. currentParent = stack[stack.length - 1];
  35425. closeElement(element);
  35426. },
  35427. chars: function chars (text) {
  35428. if (!currentParent) {
  35429. if (true) {
  35430. if (text === template) {
  35431. warnOnce(
  35432. 'Component template requires a root element, rather than just text.'
  35433. );
  35434. } else if ((text = text.trim())) {
  35435. warnOnce(
  35436. ("text \"" + text + "\" outside root element will be ignored.")
  35437. );
  35438. }
  35439. }
  35440. return
  35441. }
  35442. // IE textarea placeholder bug
  35443. /* istanbul ignore if */
  35444. if (isIE &&
  35445. currentParent.tag === 'textarea' &&
  35446. currentParent.attrsMap.placeholder === text
  35447. ) {
  35448. return
  35449. }
  35450. var children = currentParent.children;
  35451. text = inPre || text.trim()
  35452. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  35453. // only preserve whitespace if its not right after a starting tag
  35454. : preserveWhitespace && children.length ? ' ' : '';
  35455. if (text) {
  35456. var res;
  35457. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  35458. children.push({
  35459. type: 2,
  35460. expression: res.expression,
  35461. tokens: res.tokens,
  35462. text: text
  35463. });
  35464. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  35465. children.push({
  35466. type: 3,
  35467. text: text
  35468. });
  35469. }
  35470. }
  35471. },
  35472. comment: function comment (text) {
  35473. currentParent.children.push({
  35474. type: 3,
  35475. text: text,
  35476. isComment: true
  35477. });
  35478. }
  35479. });
  35480. return root
  35481. }
  35482. function processPre (el) {
  35483. if (getAndRemoveAttr(el, 'v-pre') != null) {
  35484. el.pre = true;
  35485. }
  35486. }
  35487. function processRawAttrs (el) {
  35488. var l = el.attrsList.length;
  35489. if (l) {
  35490. var attrs = el.attrs = new Array(l);
  35491. for (var i = 0; i < l; i++) {
  35492. attrs[i] = {
  35493. name: el.attrsList[i].name,
  35494. value: JSON.stringify(el.attrsList[i].value)
  35495. };
  35496. }
  35497. } else if (!el.pre) {
  35498. // non root node in pre blocks with no attributes
  35499. el.plain = true;
  35500. }
  35501. }
  35502. function processElement (element, options) {
  35503. processKey(element);
  35504. // determine whether this is a plain element after
  35505. // removing structural attributes
  35506. element.plain = !element.key && !element.attrsList.length;
  35507. processRef(element);
  35508. processSlot(element);
  35509. processComponent(element);
  35510. for (var i = 0; i < transforms.length; i++) {
  35511. element = transforms[i](element, options) || element;
  35512. }
  35513. processAttrs(element);
  35514. }
  35515. function processKey (el) {
  35516. var exp = getBindingAttr(el, 'key');
  35517. if (exp) {
  35518. if ("development" !== 'production' && el.tag === 'template') {
  35519. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  35520. }
  35521. el.key = exp;
  35522. }
  35523. }
  35524. function processRef (el) {
  35525. var ref = getBindingAttr(el, 'ref');
  35526. if (ref) {
  35527. el.ref = ref;
  35528. el.refInFor = checkInFor(el);
  35529. }
  35530. }
  35531. function processFor (el) {
  35532. var exp;
  35533. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  35534. var res = parseFor(exp);
  35535. if (res) {
  35536. extend(el, res);
  35537. } else if (true) {
  35538. warn$2(
  35539. ("Invalid v-for expression: " + exp)
  35540. );
  35541. }
  35542. }
  35543. }
  35544. function parseFor (exp) {
  35545. var inMatch = exp.match(forAliasRE);
  35546. if (!inMatch) { return }
  35547. var res = {};
  35548. res.for = inMatch[2].trim();
  35549. var alias = inMatch[1].trim().replace(stripParensRE, '');
  35550. var iteratorMatch = alias.match(forIteratorRE);
  35551. if (iteratorMatch) {
  35552. res.alias = alias.replace(forIteratorRE, '');
  35553. res.iterator1 = iteratorMatch[1].trim();
  35554. if (iteratorMatch[2]) {
  35555. res.iterator2 = iteratorMatch[2].trim();
  35556. }
  35557. } else {
  35558. res.alias = alias;
  35559. }
  35560. return res
  35561. }
  35562. function processIf (el) {
  35563. var exp = getAndRemoveAttr(el, 'v-if');
  35564. if (exp) {
  35565. el.if = exp;
  35566. addIfCondition(el, {
  35567. exp: exp,
  35568. block: el
  35569. });
  35570. } else {
  35571. if (getAndRemoveAttr(el, 'v-else') != null) {
  35572. el.else = true;
  35573. }
  35574. var elseif = getAndRemoveAttr(el, 'v-else-if');
  35575. if (elseif) {
  35576. el.elseif = elseif;
  35577. }
  35578. }
  35579. }
  35580. function processIfConditions (el, parent) {
  35581. var prev = findPrevElement(parent.children);
  35582. if (prev && prev.if) {
  35583. addIfCondition(prev, {
  35584. exp: el.elseif,
  35585. block: el
  35586. });
  35587. } else if (true) {
  35588. warn$2(
  35589. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  35590. "used on element <" + (el.tag) + "> without corresponding v-if."
  35591. );
  35592. }
  35593. }
  35594. function findPrevElement (children) {
  35595. var i = children.length;
  35596. while (i--) {
  35597. if (children[i].type === 1) {
  35598. return children[i]
  35599. } else {
  35600. if ("development" !== 'production' && children[i].text !== ' ') {
  35601. warn$2(
  35602. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  35603. "will be ignored."
  35604. );
  35605. }
  35606. children.pop();
  35607. }
  35608. }
  35609. }
  35610. function addIfCondition (el, condition) {
  35611. if (!el.ifConditions) {
  35612. el.ifConditions = [];
  35613. }
  35614. el.ifConditions.push(condition);
  35615. }
  35616. function processOnce (el) {
  35617. var once$$1 = getAndRemoveAttr(el, 'v-once');
  35618. if (once$$1 != null) {
  35619. el.once = true;
  35620. }
  35621. }
  35622. function processSlot (el) {
  35623. if (el.tag === 'slot') {
  35624. el.slotName = getBindingAttr(el, 'name');
  35625. if ("development" !== 'production' && el.key) {
  35626. warn$2(
  35627. "`key` does not work on <slot> because slots are abstract outlets " +
  35628. "and can possibly expand into multiple elements. " +
  35629. "Use the key on a wrapping element instead."
  35630. );
  35631. }
  35632. } else {
  35633. var slotScope;
  35634. if (el.tag === 'template') {
  35635. slotScope = getAndRemoveAttr(el, 'scope');
  35636. /* istanbul ignore if */
  35637. if ("development" !== 'production' && slotScope) {
  35638. warn$2(
  35639. "the \"scope\" attribute for scoped slots have been deprecated and " +
  35640. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  35641. "can also be used on plain elements in addition to <template> to " +
  35642. "denote scoped slots.",
  35643. true
  35644. );
  35645. }
  35646. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  35647. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  35648. /* istanbul ignore if */
  35649. if ("development" !== 'production' && el.attrsMap['v-for']) {
  35650. warn$2(
  35651. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  35652. "(v-for takes higher priority). Use a wrapper <template> for the " +
  35653. "scoped slot to make it clearer.",
  35654. true
  35655. );
  35656. }
  35657. el.slotScope = slotScope;
  35658. }
  35659. var slotTarget = getBindingAttr(el, 'slot');
  35660. if (slotTarget) {
  35661. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  35662. // preserve slot as an attribute for native shadow DOM compat
  35663. // only for non-scoped slots.
  35664. if (el.tag !== 'template' && !el.slotScope) {
  35665. addAttr(el, 'slot', slotTarget);
  35666. }
  35667. }
  35668. }
  35669. }
  35670. function processComponent (el) {
  35671. var binding;
  35672. if ((binding = getBindingAttr(el, 'is'))) {
  35673. el.component = binding;
  35674. }
  35675. if (getAndRemoveAttr(el, 'inline-template') != null) {
  35676. el.inlineTemplate = true;
  35677. }
  35678. }
  35679. function processAttrs (el) {
  35680. var list = el.attrsList;
  35681. var i, l, name, rawName, value, modifiers, isProp;
  35682. for (i = 0, l = list.length; i < l; i++) {
  35683. name = rawName = list[i].name;
  35684. value = list[i].value;
  35685. if (dirRE.test(name)) {
  35686. // mark element as dynamic
  35687. el.hasBindings = true;
  35688. // modifiers
  35689. modifiers = parseModifiers(name);
  35690. if (modifiers) {
  35691. name = name.replace(modifierRE, '');
  35692. }
  35693. if (bindRE.test(name)) { // v-bind
  35694. name = name.replace(bindRE, '');
  35695. value = parseFilters(value);
  35696. isProp = false;
  35697. if (modifiers) {
  35698. if (modifiers.prop) {
  35699. isProp = true;
  35700. name = camelize(name);
  35701. if (name === 'innerHtml') { name = 'innerHTML'; }
  35702. }
  35703. if (modifiers.camel) {
  35704. name = camelize(name);
  35705. }
  35706. if (modifiers.sync) {
  35707. addHandler(
  35708. el,
  35709. ("update:" + (camelize(name))),
  35710. genAssignmentCode(value, "$event")
  35711. );
  35712. }
  35713. }
  35714. if (isProp || (
  35715. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  35716. )) {
  35717. addProp(el, name, value);
  35718. } else {
  35719. addAttr(el, name, value);
  35720. }
  35721. } else if (onRE.test(name)) { // v-on
  35722. name = name.replace(onRE, '');
  35723. addHandler(el, name, value, modifiers, false, warn$2);
  35724. } else { // normal directives
  35725. name = name.replace(dirRE, '');
  35726. // parse arg
  35727. var argMatch = name.match(argRE);
  35728. var arg = argMatch && argMatch[1];
  35729. if (arg) {
  35730. name = name.slice(0, -(arg.length + 1));
  35731. }
  35732. addDirective(el, name, rawName, value, arg, modifiers);
  35733. if ("development" !== 'production' && name === 'model') {
  35734. checkForAliasModel(el, value);
  35735. }
  35736. }
  35737. } else {
  35738. // literal attribute
  35739. if (true) {
  35740. var res = parseText(value, delimiters);
  35741. if (res) {
  35742. warn$2(
  35743. name + "=\"" + value + "\": " +
  35744. 'Interpolation inside attributes has been removed. ' +
  35745. 'Use v-bind or the colon shorthand instead. For example, ' +
  35746. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  35747. );
  35748. }
  35749. }
  35750. addAttr(el, name, JSON.stringify(value));
  35751. // #6887 firefox doesn't update muted state if set via attribute
  35752. // even immediately after element creation
  35753. if (!el.component &&
  35754. name === 'muted' &&
  35755. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  35756. addProp(el, name, 'true');
  35757. }
  35758. }
  35759. }
  35760. }
  35761. function checkInFor (el) {
  35762. var parent = el;
  35763. while (parent) {
  35764. if (parent.for !== undefined) {
  35765. return true
  35766. }
  35767. parent = parent.parent;
  35768. }
  35769. return false
  35770. }
  35771. function parseModifiers (name) {
  35772. var match = name.match(modifierRE);
  35773. if (match) {
  35774. var ret = {};
  35775. match.forEach(function (m) { ret[m.slice(1)] = true; });
  35776. return ret
  35777. }
  35778. }
  35779. function makeAttrsMap (attrs) {
  35780. var map = {};
  35781. for (var i = 0, l = attrs.length; i < l; i++) {
  35782. if (
  35783. "development" !== 'production' &&
  35784. map[attrs[i].name] && !isIE && !isEdge
  35785. ) {
  35786. warn$2('duplicate attribute: ' + attrs[i].name);
  35787. }
  35788. map[attrs[i].name] = attrs[i].value;
  35789. }
  35790. return map
  35791. }
  35792. // for script (e.g. type="x/template") or style, do not decode content
  35793. function isTextTag (el) {
  35794. return el.tag === 'script' || el.tag === 'style'
  35795. }
  35796. function isForbiddenTag (el) {
  35797. return (
  35798. el.tag === 'style' ||
  35799. (el.tag === 'script' && (
  35800. !el.attrsMap.type ||
  35801. el.attrsMap.type === 'text/javascript'
  35802. ))
  35803. )
  35804. }
  35805. var ieNSBug = /^xmlns:NS\d+/;
  35806. var ieNSPrefix = /^NS\d+:/;
  35807. /* istanbul ignore next */
  35808. function guardIESVGBug (attrs) {
  35809. var res = [];
  35810. for (var i = 0; i < attrs.length; i++) {
  35811. var attr = attrs[i];
  35812. if (!ieNSBug.test(attr.name)) {
  35813. attr.name = attr.name.replace(ieNSPrefix, '');
  35814. res.push(attr);
  35815. }
  35816. }
  35817. return res
  35818. }
  35819. function checkForAliasModel (el, value) {
  35820. var _el = el;
  35821. while (_el) {
  35822. if (_el.for && _el.alias === value) {
  35823. warn$2(
  35824. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  35825. "You are binding v-model directly to a v-for iteration alias. " +
  35826. "This will not be able to modify the v-for source array because " +
  35827. "writing to the alias is like modifying a function local variable. " +
  35828. "Consider using an array of objects and use v-model on an object property instead."
  35829. );
  35830. }
  35831. _el = _el.parent;
  35832. }
  35833. }
  35834. /* */
  35835. /**
  35836. * Expand input[v-model] with dyanmic type bindings into v-if-else chains
  35837. * Turn this:
  35838. * <input v-model="data[type]" :type="type">
  35839. * into this:
  35840. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  35841. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  35842. * <input v-else :type="type" v-model="data[type]">
  35843. */
  35844. function preTransformNode (el, options) {
  35845. if (el.tag === 'input') {
  35846. var map = el.attrsMap;
  35847. if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
  35848. var typeBinding = getBindingAttr(el, 'type');
  35849. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  35850. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  35851. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  35852. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  35853. // 1. checkbox
  35854. var branch0 = cloneASTElement(el);
  35855. // process for on the main node
  35856. processFor(branch0);
  35857. addRawAttr(branch0, 'type', 'checkbox');
  35858. processElement(branch0, options);
  35859. branch0.processed = true; // prevent it from double-processed
  35860. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  35861. addIfCondition(branch0, {
  35862. exp: branch0.if,
  35863. block: branch0
  35864. });
  35865. // 2. add radio else-if condition
  35866. var branch1 = cloneASTElement(el);
  35867. getAndRemoveAttr(branch1, 'v-for', true);
  35868. addRawAttr(branch1, 'type', 'radio');
  35869. processElement(branch1, options);
  35870. addIfCondition(branch0, {
  35871. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  35872. block: branch1
  35873. });
  35874. // 3. other
  35875. var branch2 = cloneASTElement(el);
  35876. getAndRemoveAttr(branch2, 'v-for', true);
  35877. addRawAttr(branch2, ':type', typeBinding);
  35878. processElement(branch2, options);
  35879. addIfCondition(branch0, {
  35880. exp: ifCondition,
  35881. block: branch2
  35882. });
  35883. if (hasElse) {
  35884. branch0.else = true;
  35885. } else if (elseIfCondition) {
  35886. branch0.elseif = elseIfCondition;
  35887. }
  35888. return branch0
  35889. }
  35890. }
  35891. }
  35892. function cloneASTElement (el) {
  35893. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  35894. }
  35895. var model$2 = {
  35896. preTransformNode: preTransformNode
  35897. };
  35898. var modules$1 = [
  35899. klass$1,
  35900. style$1,
  35901. model$2
  35902. ];
  35903. /* */
  35904. function text (el, dir) {
  35905. if (dir.value) {
  35906. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  35907. }
  35908. }
  35909. /* */
  35910. function html (el, dir) {
  35911. if (dir.value) {
  35912. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  35913. }
  35914. }
  35915. var directives$1 = {
  35916. model: model,
  35917. text: text,
  35918. html: html
  35919. };
  35920. /* */
  35921. var baseOptions = {
  35922. expectHTML: true,
  35923. modules: modules$1,
  35924. directives: directives$1,
  35925. isPreTag: isPreTag,
  35926. isUnaryTag: isUnaryTag,
  35927. mustUseProp: mustUseProp,
  35928. canBeLeftOpenTag: canBeLeftOpenTag,
  35929. isReservedTag: isReservedTag,
  35930. getTagNamespace: getTagNamespace,
  35931. staticKeys: genStaticKeys(modules$1)
  35932. };
  35933. /* */
  35934. var isStaticKey;
  35935. var isPlatformReservedTag;
  35936. var genStaticKeysCached = cached(genStaticKeys$1);
  35937. /**
  35938. * Goal of the optimizer: walk the generated template AST tree
  35939. * and detect sub-trees that are purely static, i.e. parts of
  35940. * the DOM that never needs to change.
  35941. *
  35942. * Once we detect these sub-trees, we can:
  35943. *
  35944. * 1. Hoist them into constants, so that we no longer need to
  35945. * create fresh nodes for them on each re-render;
  35946. * 2. Completely skip them in the patching process.
  35947. */
  35948. function optimize (root, options) {
  35949. if (!root) { return }
  35950. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  35951. isPlatformReservedTag = options.isReservedTag || no;
  35952. // first pass: mark all non-static nodes.
  35953. markStatic$1(root);
  35954. // second pass: mark static roots.
  35955. markStaticRoots(root, false);
  35956. }
  35957. function genStaticKeys$1 (keys) {
  35958. return makeMap(
  35959. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  35960. (keys ? ',' + keys : '')
  35961. )
  35962. }
  35963. function markStatic$1 (node) {
  35964. node.static = isStatic(node);
  35965. if (node.type === 1) {
  35966. // do not make component slot content static. this avoids
  35967. // 1. components not able to mutate slot nodes
  35968. // 2. static slot content fails for hot-reloading
  35969. if (
  35970. !isPlatformReservedTag(node.tag) &&
  35971. node.tag !== 'slot' &&
  35972. node.attrsMap['inline-template'] == null
  35973. ) {
  35974. return
  35975. }
  35976. for (var i = 0, l = node.children.length; i < l; i++) {
  35977. var child = node.children[i];
  35978. markStatic$1(child);
  35979. if (!child.static) {
  35980. node.static = false;
  35981. }
  35982. }
  35983. if (node.ifConditions) {
  35984. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  35985. var block = node.ifConditions[i$1].block;
  35986. markStatic$1(block);
  35987. if (!block.static) {
  35988. node.static = false;
  35989. }
  35990. }
  35991. }
  35992. }
  35993. }
  35994. function markStaticRoots (node, isInFor) {
  35995. if (node.type === 1) {
  35996. if (node.static || node.once) {
  35997. node.staticInFor = isInFor;
  35998. }
  35999. // For a node to qualify as a static root, it should have children that
  36000. // are not just static text. Otherwise the cost of hoisting out will
  36001. // outweigh the benefits and it's better off to just always render it fresh.
  36002. if (node.static && node.children.length && !(
  36003. node.children.length === 1 &&
  36004. node.children[0].type === 3
  36005. )) {
  36006. node.staticRoot = true;
  36007. return
  36008. } else {
  36009. node.staticRoot = false;
  36010. }
  36011. if (node.children) {
  36012. for (var i = 0, l = node.children.length; i < l; i++) {
  36013. markStaticRoots(node.children[i], isInFor || !!node.for);
  36014. }
  36015. }
  36016. if (node.ifConditions) {
  36017. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  36018. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  36019. }
  36020. }
  36021. }
  36022. }
  36023. function isStatic (node) {
  36024. if (node.type === 2) { // expression
  36025. return false
  36026. }
  36027. if (node.type === 3) { // text
  36028. return true
  36029. }
  36030. return !!(node.pre || (
  36031. !node.hasBindings && // no dynamic bindings
  36032. !node.if && !node.for && // not v-if or v-for or v-else
  36033. !isBuiltInTag(node.tag) && // not a built-in
  36034. isPlatformReservedTag(node.tag) && // not a component
  36035. !isDirectChildOfTemplateFor(node) &&
  36036. Object.keys(node).every(isStaticKey)
  36037. ))
  36038. }
  36039. function isDirectChildOfTemplateFor (node) {
  36040. while (node.parent) {
  36041. node = node.parent;
  36042. if (node.tag !== 'template') {
  36043. return false
  36044. }
  36045. if (node.for) {
  36046. return true
  36047. }
  36048. }
  36049. return false
  36050. }
  36051. /* */
  36052. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  36053. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  36054. // keyCode aliases
  36055. var keyCodes = {
  36056. esc: 27,
  36057. tab: 9,
  36058. enter: 13,
  36059. space: 32,
  36060. up: 38,
  36061. left: 37,
  36062. right: 39,
  36063. down: 40,
  36064. 'delete': [8, 46]
  36065. };
  36066. // #4868: modifiers that prevent the execution of the listener
  36067. // need to explicitly return null so that we can determine whether to remove
  36068. // the listener for .once
  36069. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  36070. var modifierCode = {
  36071. stop: '$event.stopPropagation();',
  36072. prevent: '$event.preventDefault();',
  36073. self: genGuard("$event.target !== $event.currentTarget"),
  36074. ctrl: genGuard("!$event.ctrlKey"),
  36075. shift: genGuard("!$event.shiftKey"),
  36076. alt: genGuard("!$event.altKey"),
  36077. meta: genGuard("!$event.metaKey"),
  36078. left: genGuard("'button' in $event && $event.button !== 0"),
  36079. middle: genGuard("'button' in $event && $event.button !== 1"),
  36080. right: genGuard("'button' in $event && $event.button !== 2")
  36081. };
  36082. function genHandlers (
  36083. events,
  36084. isNative,
  36085. warn
  36086. ) {
  36087. var res = isNative ? 'nativeOn:{' : 'on:{';
  36088. for (var name in events) {
  36089. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  36090. }
  36091. return res.slice(0, -1) + '}'
  36092. }
  36093. function genHandler (
  36094. name,
  36095. handler
  36096. ) {
  36097. if (!handler) {
  36098. return 'function(){}'
  36099. }
  36100. if (Array.isArray(handler)) {
  36101. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  36102. }
  36103. var isMethodPath = simplePathRE.test(handler.value);
  36104. var isFunctionExpression = fnExpRE.test(handler.value);
  36105. if (!handler.modifiers) {
  36106. if (isMethodPath || isFunctionExpression) {
  36107. return handler.value
  36108. }
  36109. /* istanbul ignore if */
  36110. return ("function($event){" + (handler.value) + "}") // inline statement
  36111. } else {
  36112. var code = '';
  36113. var genModifierCode = '';
  36114. var keys = [];
  36115. for (var key in handler.modifiers) {
  36116. if (modifierCode[key]) {
  36117. genModifierCode += modifierCode[key];
  36118. // left/right
  36119. if (keyCodes[key]) {
  36120. keys.push(key);
  36121. }
  36122. } else if (key === 'exact') {
  36123. var modifiers = (handler.modifiers);
  36124. genModifierCode += genGuard(
  36125. ['ctrl', 'shift', 'alt', 'meta']
  36126. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  36127. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  36128. .join('||')
  36129. );
  36130. } else {
  36131. keys.push(key);
  36132. }
  36133. }
  36134. if (keys.length) {
  36135. code += genKeyFilter(keys);
  36136. }
  36137. // Make sure modifiers like prevent and stop get executed after key filtering
  36138. if (genModifierCode) {
  36139. code += genModifierCode;
  36140. }
  36141. var handlerCode = isMethodPath
  36142. ? handler.value + '($event)'
  36143. : isFunctionExpression
  36144. ? ("(" + (handler.value) + ")($event)")
  36145. : handler.value;
  36146. /* istanbul ignore if */
  36147. return ("function($event){" + code + handlerCode + "}")
  36148. }
  36149. }
  36150. function genKeyFilter (keys) {
  36151. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  36152. }
  36153. function genFilterCode (key) {
  36154. var keyVal = parseInt(key, 10);
  36155. if (keyVal) {
  36156. return ("$event.keyCode!==" + keyVal)
  36157. }
  36158. var code = keyCodes[key];
  36159. return (
  36160. "_k($event.keyCode," +
  36161. (JSON.stringify(key)) + "," +
  36162. (JSON.stringify(code)) + "," +
  36163. "$event.key)"
  36164. )
  36165. }
  36166. /* */
  36167. function on (el, dir) {
  36168. if ("development" !== 'production' && dir.modifiers) {
  36169. warn("v-on without argument does not support modifiers.");
  36170. }
  36171. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  36172. }
  36173. /* */
  36174. function bind$1 (el, dir) {
  36175. el.wrapData = function (code) {
  36176. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  36177. };
  36178. }
  36179. /* */
  36180. var baseDirectives = {
  36181. on: on,
  36182. bind: bind$1,
  36183. cloak: noop
  36184. };
  36185. /* */
  36186. var CodegenState = function CodegenState (options) {
  36187. this.options = options;
  36188. this.warn = options.warn || baseWarn;
  36189. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  36190. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  36191. this.directives = extend(extend({}, baseDirectives), options.directives);
  36192. var isReservedTag = options.isReservedTag || no;
  36193. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  36194. this.onceId = 0;
  36195. this.staticRenderFns = [];
  36196. };
  36197. function generate (
  36198. ast,
  36199. options
  36200. ) {
  36201. var state = new CodegenState(options);
  36202. var code = ast ? genElement(ast, state) : '_c("div")';
  36203. return {
  36204. render: ("with(this){return " + code + "}"),
  36205. staticRenderFns: state.staticRenderFns
  36206. }
  36207. }
  36208. function genElement (el, state) {
  36209. if (el.staticRoot && !el.staticProcessed) {
  36210. return genStatic(el, state)
  36211. } else if (el.once && !el.onceProcessed) {
  36212. return genOnce(el, state)
  36213. } else if (el.for && !el.forProcessed) {
  36214. return genFor(el, state)
  36215. } else if (el.if && !el.ifProcessed) {
  36216. return genIf(el, state)
  36217. } else if (el.tag === 'template' && !el.slotTarget) {
  36218. return genChildren(el, state) || 'void 0'
  36219. } else if (el.tag === 'slot') {
  36220. return genSlot(el, state)
  36221. } else {
  36222. // component or element
  36223. var code;
  36224. if (el.component) {
  36225. code = genComponent(el.component, el, state);
  36226. } else {
  36227. var data = el.plain ? undefined : genData$2(el, state);
  36228. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36229. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  36230. }
  36231. // module transforms
  36232. for (var i = 0; i < state.transforms.length; i++) {
  36233. code = state.transforms[i](el, code);
  36234. }
  36235. return code
  36236. }
  36237. }
  36238. // hoist static sub-trees out
  36239. function genStatic (el, state) {
  36240. el.staticProcessed = true;
  36241. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  36242. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  36243. }
  36244. // v-once
  36245. function genOnce (el, state) {
  36246. el.onceProcessed = true;
  36247. if (el.if && !el.ifProcessed) {
  36248. return genIf(el, state)
  36249. } else if (el.staticInFor) {
  36250. var key = '';
  36251. var parent = el.parent;
  36252. while (parent) {
  36253. if (parent.for) {
  36254. key = parent.key;
  36255. break
  36256. }
  36257. parent = parent.parent;
  36258. }
  36259. if (!key) {
  36260. "development" !== 'production' && state.warn(
  36261. "v-once can only be used inside v-for that is keyed. "
  36262. );
  36263. return genElement(el, state)
  36264. }
  36265. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  36266. } else {
  36267. return genStatic(el, state)
  36268. }
  36269. }
  36270. function genIf (
  36271. el,
  36272. state,
  36273. altGen,
  36274. altEmpty
  36275. ) {
  36276. el.ifProcessed = true; // avoid recursion
  36277. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  36278. }
  36279. function genIfConditions (
  36280. conditions,
  36281. state,
  36282. altGen,
  36283. altEmpty
  36284. ) {
  36285. if (!conditions.length) {
  36286. return altEmpty || '_e()'
  36287. }
  36288. var condition = conditions.shift();
  36289. if (condition.exp) {
  36290. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  36291. } else {
  36292. return ("" + (genTernaryExp(condition.block)))
  36293. }
  36294. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  36295. function genTernaryExp (el) {
  36296. return altGen
  36297. ? altGen(el, state)
  36298. : el.once
  36299. ? genOnce(el, state)
  36300. : genElement(el, state)
  36301. }
  36302. }
  36303. function genFor (
  36304. el,
  36305. state,
  36306. altGen,
  36307. altHelper
  36308. ) {
  36309. var exp = el.for;
  36310. var alias = el.alias;
  36311. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  36312. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  36313. if ("development" !== 'production' &&
  36314. state.maybeComponent(el) &&
  36315. el.tag !== 'slot' &&
  36316. el.tag !== 'template' &&
  36317. !el.key
  36318. ) {
  36319. state.warn(
  36320. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  36321. "v-for should have explicit keys. " +
  36322. "See https://vuejs.org/guide/list.html#key for more info.",
  36323. true /* tip */
  36324. );
  36325. }
  36326. el.forProcessed = true; // avoid recursion
  36327. return (altHelper || '_l') + "((" + exp + ")," +
  36328. "function(" + alias + iterator1 + iterator2 + "){" +
  36329. "return " + ((altGen || genElement)(el, state)) +
  36330. '})'
  36331. }
  36332. function genData$2 (el, state) {
  36333. var data = '{';
  36334. // directives first.
  36335. // directives may mutate the el's other properties before they are generated.
  36336. var dirs = genDirectives(el, state);
  36337. if (dirs) { data += dirs + ','; }
  36338. // key
  36339. if (el.key) {
  36340. data += "key:" + (el.key) + ",";
  36341. }
  36342. // ref
  36343. if (el.ref) {
  36344. data += "ref:" + (el.ref) + ",";
  36345. }
  36346. if (el.refInFor) {
  36347. data += "refInFor:true,";
  36348. }
  36349. // pre
  36350. if (el.pre) {
  36351. data += "pre:true,";
  36352. }
  36353. // record original tag name for components using "is" attribute
  36354. if (el.component) {
  36355. data += "tag:\"" + (el.tag) + "\",";
  36356. }
  36357. // module data generation functions
  36358. for (var i = 0; i < state.dataGenFns.length; i++) {
  36359. data += state.dataGenFns[i](el);
  36360. }
  36361. // attributes
  36362. if (el.attrs) {
  36363. data += "attrs:{" + (genProps(el.attrs)) + "},";
  36364. }
  36365. // DOM props
  36366. if (el.props) {
  36367. data += "domProps:{" + (genProps(el.props)) + "},";
  36368. }
  36369. // event handlers
  36370. if (el.events) {
  36371. data += (genHandlers(el.events, false, state.warn)) + ",";
  36372. }
  36373. if (el.nativeEvents) {
  36374. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  36375. }
  36376. // slot target
  36377. // only for non-scoped slots
  36378. if (el.slotTarget && !el.slotScope) {
  36379. data += "slot:" + (el.slotTarget) + ",";
  36380. }
  36381. // scoped slots
  36382. if (el.scopedSlots) {
  36383. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  36384. }
  36385. // component v-model
  36386. if (el.model) {
  36387. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  36388. }
  36389. // inline-template
  36390. if (el.inlineTemplate) {
  36391. var inlineTemplate = genInlineTemplate(el, state);
  36392. if (inlineTemplate) {
  36393. data += inlineTemplate + ",";
  36394. }
  36395. }
  36396. data = data.replace(/,$/, '') + '}';
  36397. // v-bind data wrap
  36398. if (el.wrapData) {
  36399. data = el.wrapData(data);
  36400. }
  36401. // v-on data wrap
  36402. if (el.wrapListeners) {
  36403. data = el.wrapListeners(data);
  36404. }
  36405. return data
  36406. }
  36407. function genDirectives (el, state) {
  36408. var dirs = el.directives;
  36409. if (!dirs) { return }
  36410. var res = 'directives:[';
  36411. var hasRuntime = false;
  36412. var i, l, dir, needRuntime;
  36413. for (i = 0, l = dirs.length; i < l; i++) {
  36414. dir = dirs[i];
  36415. needRuntime = true;
  36416. var gen = state.directives[dir.name];
  36417. if (gen) {
  36418. // compile-time directive that manipulates AST.
  36419. // returns true if it also needs a runtime counterpart.
  36420. needRuntime = !!gen(el, dir, state.warn);
  36421. }
  36422. if (needRuntime) {
  36423. hasRuntime = true;
  36424. 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))) : '') + "},";
  36425. }
  36426. }
  36427. if (hasRuntime) {
  36428. return res.slice(0, -1) + ']'
  36429. }
  36430. }
  36431. function genInlineTemplate (el, state) {
  36432. var ast = el.children[0];
  36433. if ("development" !== 'production' && (
  36434. el.children.length !== 1 || ast.type !== 1
  36435. )) {
  36436. state.warn('Inline-template components must have exactly one child element.');
  36437. }
  36438. if (ast.type === 1) {
  36439. var inlineRenderFns = generate(ast, state.options);
  36440. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  36441. }
  36442. }
  36443. function genScopedSlots (
  36444. slots,
  36445. state
  36446. ) {
  36447. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  36448. return genScopedSlot(key, slots[key], state)
  36449. }).join(',')) + "])")
  36450. }
  36451. function genScopedSlot (
  36452. key,
  36453. el,
  36454. state
  36455. ) {
  36456. if (el.for && !el.forProcessed) {
  36457. return genForScopedSlot(key, el, state)
  36458. }
  36459. var fn = "function(" + (String(el.slotScope)) + "){" +
  36460. "return " + (el.tag === 'template'
  36461. ? el.if
  36462. ? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
  36463. : genChildren(el, state) || 'undefined'
  36464. : genElement(el, state)) + "}";
  36465. return ("{key:" + key + ",fn:" + fn + "}")
  36466. }
  36467. function genForScopedSlot (
  36468. key,
  36469. el,
  36470. state
  36471. ) {
  36472. var exp = el.for;
  36473. var alias = el.alias;
  36474. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  36475. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  36476. el.forProcessed = true; // avoid recursion
  36477. return "_l((" + exp + ")," +
  36478. "function(" + alias + iterator1 + iterator2 + "){" +
  36479. "return " + (genScopedSlot(key, el, state)) +
  36480. '})'
  36481. }
  36482. function genChildren (
  36483. el,
  36484. state,
  36485. checkSkip,
  36486. altGenElement,
  36487. altGenNode
  36488. ) {
  36489. var children = el.children;
  36490. if (children.length) {
  36491. var el$1 = children[0];
  36492. // optimize single v-for
  36493. if (children.length === 1 &&
  36494. el$1.for &&
  36495. el$1.tag !== 'template' &&
  36496. el$1.tag !== 'slot'
  36497. ) {
  36498. return (altGenElement || genElement)(el$1, state)
  36499. }
  36500. var normalizationType = checkSkip
  36501. ? getNormalizationType(children, state.maybeComponent)
  36502. : 0;
  36503. var gen = altGenNode || genNode;
  36504. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  36505. }
  36506. }
  36507. // determine the normalization needed for the children array.
  36508. // 0: no normalization needed
  36509. // 1: simple normalization needed (possible 1-level deep nested array)
  36510. // 2: full normalization needed
  36511. function getNormalizationType (
  36512. children,
  36513. maybeComponent
  36514. ) {
  36515. var res = 0;
  36516. for (var i = 0; i < children.length; i++) {
  36517. var el = children[i];
  36518. if (el.type !== 1) {
  36519. continue
  36520. }
  36521. if (needsNormalization(el) ||
  36522. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  36523. res = 2;
  36524. break
  36525. }
  36526. if (maybeComponent(el) ||
  36527. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  36528. res = 1;
  36529. }
  36530. }
  36531. return res
  36532. }
  36533. function needsNormalization (el) {
  36534. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  36535. }
  36536. function genNode (node, state) {
  36537. if (node.type === 1) {
  36538. return genElement(node, state)
  36539. } if (node.type === 3 && node.isComment) {
  36540. return genComment(node)
  36541. } else {
  36542. return genText(node)
  36543. }
  36544. }
  36545. function genText (text) {
  36546. return ("_v(" + (text.type === 2
  36547. ? text.expression // no need for () because already wrapped in _s()
  36548. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  36549. }
  36550. function genComment (comment) {
  36551. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  36552. }
  36553. function genSlot (el, state) {
  36554. var slotName = el.slotName || '"default"';
  36555. var children = genChildren(el, state);
  36556. var res = "_t(" + slotName + (children ? ("," + children) : '');
  36557. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  36558. var bind$$1 = el.attrsMap['v-bind'];
  36559. if ((attrs || bind$$1) && !children) {
  36560. res += ",null";
  36561. }
  36562. if (attrs) {
  36563. res += "," + attrs;
  36564. }
  36565. if (bind$$1) {
  36566. res += (attrs ? '' : ',null') + "," + bind$$1;
  36567. }
  36568. return res + ')'
  36569. }
  36570. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  36571. function genComponent (
  36572. componentName,
  36573. el,
  36574. state
  36575. ) {
  36576. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36577. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  36578. }
  36579. function genProps (props) {
  36580. var res = '';
  36581. for (var i = 0; i < props.length; i++) {
  36582. var prop = props[i];
  36583. /* istanbul ignore if */
  36584. {
  36585. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  36586. }
  36587. }
  36588. return res.slice(0, -1)
  36589. }
  36590. // #3895, #4268
  36591. function transformSpecialNewlines (text) {
  36592. return text
  36593. .replace(/\u2028/g, '\\u2028')
  36594. .replace(/\u2029/g, '\\u2029')
  36595. }
  36596. /* */
  36597. // these keywords should not appear inside expressions, but operators like
  36598. // typeof, instanceof and in are allowed
  36599. var prohibitedKeywordRE = new RegExp('\\b' + (
  36600. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  36601. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  36602. 'extends,finally,continue,debugger,function,arguments'
  36603. ).split(',').join('\\b|\\b') + '\\b');
  36604. // these unary operators should not be used as property/method names
  36605. var unaryOperatorsRE = new RegExp('\\b' + (
  36606. 'delete,typeof,void'
  36607. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  36608. // strip strings in expressions
  36609. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  36610. // detect problematic expressions in a template
  36611. function detectErrors (ast) {
  36612. var errors = [];
  36613. if (ast) {
  36614. checkNode(ast, errors);
  36615. }
  36616. return errors
  36617. }
  36618. function checkNode (node, errors) {
  36619. if (node.type === 1) {
  36620. for (var name in node.attrsMap) {
  36621. if (dirRE.test(name)) {
  36622. var value = node.attrsMap[name];
  36623. if (value) {
  36624. if (name === 'v-for') {
  36625. checkFor(node, ("v-for=\"" + value + "\""), errors);
  36626. } else if (onRE.test(name)) {
  36627. checkEvent(value, (name + "=\"" + value + "\""), errors);
  36628. } else {
  36629. checkExpression(value, (name + "=\"" + value + "\""), errors);
  36630. }
  36631. }
  36632. }
  36633. }
  36634. if (node.children) {
  36635. for (var i = 0; i < node.children.length; i++) {
  36636. checkNode(node.children[i], errors);
  36637. }
  36638. }
  36639. } else if (node.type === 2) {
  36640. checkExpression(node.expression, node.text, errors);
  36641. }
  36642. }
  36643. function checkEvent (exp, text, errors) {
  36644. var stipped = exp.replace(stripStringRE, '');
  36645. var keywordMatch = stipped.match(unaryOperatorsRE);
  36646. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  36647. errors.push(
  36648. "avoid using JavaScript unary operator as property name: " +
  36649. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  36650. );
  36651. }
  36652. checkExpression(exp, text, errors);
  36653. }
  36654. function checkFor (node, text, errors) {
  36655. checkExpression(node.for || '', text, errors);
  36656. checkIdentifier(node.alias, 'v-for alias', text, errors);
  36657. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  36658. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  36659. }
  36660. function checkIdentifier (
  36661. ident,
  36662. type,
  36663. text,
  36664. errors
  36665. ) {
  36666. if (typeof ident === 'string') {
  36667. try {
  36668. new Function(("var " + ident + "=_"));
  36669. } catch (e) {
  36670. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  36671. }
  36672. }
  36673. }
  36674. function checkExpression (exp, text, errors) {
  36675. try {
  36676. new Function(("return " + exp));
  36677. } catch (e) {
  36678. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  36679. if (keywordMatch) {
  36680. errors.push(
  36681. "avoid using JavaScript keyword as property name: " +
  36682. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
  36683. );
  36684. } else {
  36685. errors.push(
  36686. "invalid expression: " + (e.message) + " in\n\n" +
  36687. " " + exp + "\n\n" +
  36688. " Raw expression: " + (text.trim()) + "\n"
  36689. );
  36690. }
  36691. }
  36692. }
  36693. /* */
  36694. function createFunction (code, errors) {
  36695. try {
  36696. return new Function(code)
  36697. } catch (err) {
  36698. errors.push({ err: err, code: code });
  36699. return noop
  36700. }
  36701. }
  36702. function createCompileToFunctionFn (compile) {
  36703. var cache = Object.create(null);
  36704. return function compileToFunctions (
  36705. template,
  36706. options,
  36707. vm
  36708. ) {
  36709. options = extend({}, options);
  36710. var warn$$1 = options.warn || warn;
  36711. delete options.warn;
  36712. /* istanbul ignore if */
  36713. if (true) {
  36714. // detect possible CSP restriction
  36715. try {
  36716. new Function('return 1');
  36717. } catch (e) {
  36718. if (e.toString().match(/unsafe-eval|CSP/)) {
  36719. warn$$1(
  36720. 'It seems you are using the standalone build of Vue.js in an ' +
  36721. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  36722. 'The template compiler cannot work in this environment. Consider ' +
  36723. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  36724. 'templates into render functions.'
  36725. );
  36726. }
  36727. }
  36728. }
  36729. // check cache
  36730. var key = options.delimiters
  36731. ? String(options.delimiters) + template
  36732. : template;
  36733. if (cache[key]) {
  36734. return cache[key]
  36735. }
  36736. // compile
  36737. var compiled = compile(template, options);
  36738. // check compilation errors/tips
  36739. if (true) {
  36740. if (compiled.errors && compiled.errors.length) {
  36741. warn$$1(
  36742. "Error compiling template:\n\n" + template + "\n\n" +
  36743. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  36744. vm
  36745. );
  36746. }
  36747. if (compiled.tips && compiled.tips.length) {
  36748. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  36749. }
  36750. }
  36751. // turn code into functions
  36752. var res = {};
  36753. var fnGenErrors = [];
  36754. res.render = createFunction(compiled.render, fnGenErrors);
  36755. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  36756. return createFunction(code, fnGenErrors)
  36757. });
  36758. // check function generation errors.
  36759. // this should only happen if there is a bug in the compiler itself.
  36760. // mostly for codegen development use
  36761. /* istanbul ignore if */
  36762. if (true) {
  36763. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  36764. warn$$1(
  36765. "Failed to generate render function:\n\n" +
  36766. fnGenErrors.map(function (ref) {
  36767. var err = ref.err;
  36768. var code = ref.code;
  36769. return ((err.toString()) + " in\n\n" + code + "\n");
  36770. }).join('\n'),
  36771. vm
  36772. );
  36773. }
  36774. }
  36775. return (cache[key] = res)
  36776. }
  36777. }
  36778. /* */
  36779. function createCompilerCreator (baseCompile) {
  36780. return function createCompiler (baseOptions) {
  36781. function compile (
  36782. template,
  36783. options
  36784. ) {
  36785. var finalOptions = Object.create(baseOptions);
  36786. var errors = [];
  36787. var tips = [];
  36788. finalOptions.warn = function (msg, tip) {
  36789. (tip ? tips : errors).push(msg);
  36790. };
  36791. if (options) {
  36792. // merge custom modules
  36793. if (options.modules) {
  36794. finalOptions.modules =
  36795. (baseOptions.modules || []).concat(options.modules);
  36796. }
  36797. // merge custom directives
  36798. if (options.directives) {
  36799. finalOptions.directives = extend(
  36800. Object.create(baseOptions.directives || null),
  36801. options.directives
  36802. );
  36803. }
  36804. // copy other options
  36805. for (var key in options) {
  36806. if (key !== 'modules' && key !== 'directives') {
  36807. finalOptions[key] = options[key];
  36808. }
  36809. }
  36810. }
  36811. var compiled = baseCompile(template, finalOptions);
  36812. if (true) {
  36813. errors.push.apply(errors, detectErrors(compiled.ast));
  36814. }
  36815. compiled.errors = errors;
  36816. compiled.tips = tips;
  36817. return compiled
  36818. }
  36819. return {
  36820. compile: compile,
  36821. compileToFunctions: createCompileToFunctionFn(compile)
  36822. }
  36823. }
  36824. }
  36825. /* */
  36826. // `createCompilerCreator` allows creating compilers that use alternative
  36827. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  36828. // Here we just export a default compiler using the default parts.
  36829. var createCompiler = createCompilerCreator(function baseCompile (
  36830. template,
  36831. options
  36832. ) {
  36833. var ast = parse(template.trim(), options);
  36834. if (options.optimize !== false) {
  36835. optimize(ast, options);
  36836. }
  36837. var code = generate(ast, options);
  36838. return {
  36839. ast: ast,
  36840. render: code.render,
  36841. staticRenderFns: code.staticRenderFns
  36842. }
  36843. });
  36844. /* */
  36845. var ref$1 = createCompiler(baseOptions);
  36846. var compileToFunctions = ref$1.compileToFunctions;
  36847. /* */
  36848. // check whether current browser encodes a char inside attribute values
  36849. var div;
  36850. function getShouldDecode (href) {
  36851. div = div || document.createElement('div');
  36852. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  36853. return div.innerHTML.indexOf('&#10;') > 0
  36854. }
  36855. // #3663: IE encodes newlines inside attribute values while other browsers don't
  36856. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  36857. // #6828: chrome encodes content in a[href]
  36858. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  36859. /* */
  36860. var idToTemplate = cached(function (id) {
  36861. var el = query(id);
  36862. return el && el.innerHTML
  36863. });
  36864. var mount = Vue$3.prototype.$mount;
  36865. Vue$3.prototype.$mount = function (
  36866. el,
  36867. hydrating
  36868. ) {
  36869. el = el && query(el);
  36870. /* istanbul ignore if */
  36871. if (el === document.body || el === document.documentElement) {
  36872. "development" !== 'production' && warn(
  36873. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  36874. );
  36875. return this
  36876. }
  36877. var options = this.$options;
  36878. // resolve template/el and convert to render function
  36879. if (!options.render) {
  36880. var template = options.template;
  36881. if (template) {
  36882. if (typeof template === 'string') {
  36883. if (template.charAt(0) === '#') {
  36884. template = idToTemplate(template);
  36885. /* istanbul ignore if */
  36886. if ("development" !== 'production' && !template) {
  36887. warn(
  36888. ("Template element not found or is empty: " + (options.template)),
  36889. this
  36890. );
  36891. }
  36892. }
  36893. } else if (template.nodeType) {
  36894. template = template.innerHTML;
  36895. } else {
  36896. if (true) {
  36897. warn('invalid template option:' + template, this);
  36898. }
  36899. return this
  36900. }
  36901. } else if (el) {
  36902. template = getOuterHTML(el);
  36903. }
  36904. if (template) {
  36905. /* istanbul ignore if */
  36906. if ("development" !== 'production' && config.performance && mark) {
  36907. mark('compile');
  36908. }
  36909. var ref = compileToFunctions(template, {
  36910. shouldDecodeNewlines: shouldDecodeNewlines,
  36911. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  36912. delimiters: options.delimiters,
  36913. comments: options.comments
  36914. }, this);
  36915. var render = ref.render;
  36916. var staticRenderFns = ref.staticRenderFns;
  36917. options.render = render;
  36918. options.staticRenderFns = staticRenderFns;
  36919. /* istanbul ignore if */
  36920. if ("development" !== 'production' && config.performance && mark) {
  36921. mark('compile end');
  36922. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  36923. }
  36924. }
  36925. }
  36926. return mount.call(this, el, hydrating)
  36927. };
  36928. /**
  36929. * Get outerHTML of elements, taking care
  36930. * of SVG elements in IE as well.
  36931. */
  36932. function getOuterHTML (el) {
  36933. if (el.outerHTML) {
  36934. return el.outerHTML
  36935. } else {
  36936. var container = document.createElement('div');
  36937. container.appendChild(el.cloneNode(true));
  36938. return container.innerHTML
  36939. }
  36940. }
  36941. Vue$3.compile = compileToFunctions;
  36942. module.exports = Vue$3;
  36943. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(17).setImmediate))
  36944. /***/ }),
  36945. /* 17 */
  36946. /***/ (function(module, exports, __webpack_require__) {
  36947. /* WEBPACK VAR INJECTION */(function(global) {var apply = Function.prototype.apply;
  36948. // DOM APIs, for completeness
  36949. exports.setTimeout = function() {
  36950. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  36951. };
  36952. exports.setInterval = function() {
  36953. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  36954. };
  36955. exports.clearTimeout =
  36956. exports.clearInterval = function(timeout) {
  36957. if (timeout) {
  36958. timeout.close();
  36959. }
  36960. };
  36961. function Timeout(id, clearFn) {
  36962. this._id = id;
  36963. this._clearFn = clearFn;
  36964. }
  36965. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  36966. Timeout.prototype.close = function() {
  36967. this._clearFn.call(window, this._id);
  36968. };
  36969. // Does not start the time, just sets up the members needed.
  36970. exports.enroll = function(item, msecs) {
  36971. clearTimeout(item._idleTimeoutId);
  36972. item._idleTimeout = msecs;
  36973. };
  36974. exports.unenroll = function(item) {
  36975. clearTimeout(item._idleTimeoutId);
  36976. item._idleTimeout = -1;
  36977. };
  36978. exports._unrefActive = exports.active = function(item) {
  36979. clearTimeout(item._idleTimeoutId);
  36980. var msecs = item._idleTimeout;
  36981. if (msecs >= 0) {
  36982. item._idleTimeoutId = setTimeout(function onTimeout() {
  36983. if (item._onTimeout)
  36984. item._onTimeout();
  36985. }, msecs);
  36986. }
  36987. };
  36988. // setimmediate attaches itself to the global object
  36989. __webpack_require__(18);
  36990. // On some exotic environments, it's not clear which object `setimmeidate` was
  36991. // able to install onto. Search each possibility in the same order as the
  36992. // `setimmediate` library.
  36993. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  36994. (typeof global !== "undefined" && global.setImmediate) ||
  36995. (this && this.setImmediate);
  36996. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  36997. (typeof global !== "undefined" && global.clearImmediate) ||
  36998. (this && this.clearImmediate);
  36999. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
  37000. /***/ }),
  37001. /* 18 */
  37002. /***/ (function(module, exports, __webpack_require__) {
  37003. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  37004. "use strict";
  37005. if (global.setImmediate) {
  37006. return;
  37007. }
  37008. var nextHandle = 1; // Spec says greater than zero
  37009. var tasksByHandle = {};
  37010. var currentlyRunningATask = false;
  37011. var doc = global.document;
  37012. var registerImmediate;
  37013. function setImmediate(callback) {
  37014. // Callback can either be a function or a string
  37015. if (typeof callback !== "function") {
  37016. callback = new Function("" + callback);
  37017. }
  37018. // Copy function arguments
  37019. var args = new Array(arguments.length - 1);
  37020. for (var i = 0; i < args.length; i++) {
  37021. args[i] = arguments[i + 1];
  37022. }
  37023. // Store and register the task
  37024. var task = { callback: callback, args: args };
  37025. tasksByHandle[nextHandle] = task;
  37026. registerImmediate(nextHandle);
  37027. return nextHandle++;
  37028. }
  37029. function clearImmediate(handle) {
  37030. delete tasksByHandle[handle];
  37031. }
  37032. function run(task) {
  37033. var callback = task.callback;
  37034. var args = task.args;
  37035. switch (args.length) {
  37036. case 0:
  37037. callback();
  37038. break;
  37039. case 1:
  37040. callback(args[0]);
  37041. break;
  37042. case 2:
  37043. callback(args[0], args[1]);
  37044. break;
  37045. case 3:
  37046. callback(args[0], args[1], args[2]);
  37047. break;
  37048. default:
  37049. callback.apply(undefined, args);
  37050. break;
  37051. }
  37052. }
  37053. function runIfPresent(handle) {
  37054. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  37055. // So if we're currently running a task, we'll need to delay this invocation.
  37056. if (currentlyRunningATask) {
  37057. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  37058. // "too much recursion" error.
  37059. setTimeout(runIfPresent, 0, handle);
  37060. } else {
  37061. var task = tasksByHandle[handle];
  37062. if (task) {
  37063. currentlyRunningATask = true;
  37064. try {
  37065. run(task);
  37066. } finally {
  37067. clearImmediate(handle);
  37068. currentlyRunningATask = false;
  37069. }
  37070. }
  37071. }
  37072. }
  37073. function installNextTickImplementation() {
  37074. registerImmediate = function(handle) {
  37075. process.nextTick(function () { runIfPresent(handle); });
  37076. };
  37077. }
  37078. function canUsePostMessage() {
  37079. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  37080. // where `global.postMessage` means something completely different and can't be used for this purpose.
  37081. if (global.postMessage && !global.importScripts) {
  37082. var postMessageIsAsynchronous = true;
  37083. var oldOnMessage = global.onmessage;
  37084. global.onmessage = function() {
  37085. postMessageIsAsynchronous = false;
  37086. };
  37087. global.postMessage("", "*");
  37088. global.onmessage = oldOnMessage;
  37089. return postMessageIsAsynchronous;
  37090. }
  37091. }
  37092. function installPostMessageImplementation() {
  37093. // Installs an event handler on `global` for the `message` event: see
  37094. // * https://developer.mozilla.org/en/DOM/window.postMessage
  37095. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  37096. var messagePrefix = "setImmediate$" + Math.random() + "$";
  37097. var onGlobalMessage = function(event) {
  37098. if (event.source === global &&
  37099. typeof event.data === "string" &&
  37100. event.data.indexOf(messagePrefix) === 0) {
  37101. runIfPresent(+event.data.slice(messagePrefix.length));
  37102. }
  37103. };
  37104. if (global.addEventListener) {
  37105. global.addEventListener("message", onGlobalMessage, false);
  37106. } else {
  37107. global.attachEvent("onmessage", onGlobalMessage);
  37108. }
  37109. registerImmediate = function(handle) {
  37110. global.postMessage(messagePrefix + handle, "*");
  37111. };
  37112. }
  37113. function installMessageChannelImplementation() {
  37114. var channel = new MessageChannel();
  37115. channel.port1.onmessage = function(event) {
  37116. var handle = event.data;
  37117. runIfPresent(handle);
  37118. };
  37119. registerImmediate = function(handle) {
  37120. channel.port2.postMessage(handle);
  37121. };
  37122. }
  37123. function installReadyStateChangeImplementation() {
  37124. var html = doc.documentElement;
  37125. registerImmediate = function(handle) {
  37126. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  37127. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  37128. var script = doc.createElement("script");
  37129. script.onreadystatechange = function () {
  37130. runIfPresent(handle);
  37131. script.onreadystatechange = null;
  37132. html.removeChild(script);
  37133. script = null;
  37134. };
  37135. html.appendChild(script);
  37136. };
  37137. }
  37138. function installSetTimeoutImplementation() {
  37139. registerImmediate = function(handle) {
  37140. setTimeout(runIfPresent, 0, handle);
  37141. };
  37142. }
  37143. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  37144. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  37145. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  37146. // Don't get fooled by e.g. browserify environments.
  37147. if ({}.toString.call(global.process) === "[object process]") {
  37148. // For Node.js before 0.9
  37149. installNextTickImplementation();
  37150. } else if (canUsePostMessage()) {
  37151. // For non-IE10 modern browsers
  37152. installPostMessageImplementation();
  37153. } else if (global.MessageChannel) {
  37154. // For web workers, where supported
  37155. installMessageChannelImplementation();
  37156. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  37157. // For IE 6–8
  37158. installReadyStateChangeImplementation();
  37159. } else {
  37160. // For older browsers
  37161. installSetTimeoutImplementation();
  37162. }
  37163. attachTo.setImmediate = setImmediate;
  37164. attachTo.clearImmediate = clearImmediate;
  37165. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  37166. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(3)))
  37167. /***/ }),
  37168. /* 19 */
  37169. /***/ (function(module, exports, __webpack_require__) {
  37170. module.exports = __webpack_require__(20);
  37171. /***/ }),
  37172. /* 20 */
  37173. /***/ (function(module, exports, __webpack_require__) {
  37174. "use strict";
  37175. var utils = __webpack_require__(0);
  37176. var bind = __webpack_require__(4);
  37177. var Axios = __webpack_require__(22);
  37178. var defaults = __webpack_require__(2);
  37179. /**
  37180. * Create an instance of Axios
  37181. *
  37182. * @param {Object} defaultConfig The default config for the instance
  37183. * @return {Axios} A new instance of Axios
  37184. */
  37185. function createInstance(defaultConfig) {
  37186. var context = new Axios(defaultConfig);
  37187. var instance = bind(Axios.prototype.request, context);
  37188. // Copy axios.prototype to instance
  37189. utils.extend(instance, Axios.prototype, context);
  37190. // Copy context to instance
  37191. utils.extend(instance, context);
  37192. return instance;
  37193. }
  37194. // Create the default instance to be exported
  37195. var axios = createInstance(defaults);
  37196. // Expose Axios class to allow class inheritance
  37197. axios.Axios = Axios;
  37198. // Factory for creating new instances
  37199. axios.create = function create(instanceConfig) {
  37200. return createInstance(utils.merge(defaults, instanceConfig));
  37201. };
  37202. // Expose Cancel & CancelToken
  37203. axios.Cancel = __webpack_require__(8);
  37204. axios.CancelToken = __webpack_require__(36);
  37205. axios.isCancel = __webpack_require__(7);
  37206. // Expose all/spread
  37207. axios.all = function all(promises) {
  37208. return Promise.all(promises);
  37209. };
  37210. axios.spread = __webpack_require__(37);
  37211. module.exports = axios;
  37212. // Allow use of default import syntax in TypeScript
  37213. module.exports.default = axios;
  37214. /***/ }),
  37215. /* 21 */
  37216. /***/ (function(module, exports) {
  37217. /*!
  37218. * Determine if an object is a Buffer
  37219. *
  37220. * @author Feross Aboukhadijeh <https://feross.org>
  37221. * @license MIT
  37222. */
  37223. // The _isBuffer check is for Safari 5-7 support, because it's missing
  37224. // Object.prototype.constructor. Remove this eventually
  37225. module.exports = function (obj) {
  37226. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  37227. }
  37228. function isBuffer (obj) {
  37229. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  37230. }
  37231. // For Node v0.10 support. Remove this eventually.
  37232. function isSlowBuffer (obj) {
  37233. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  37234. }
  37235. /***/ }),
  37236. /* 22 */
  37237. /***/ (function(module, exports, __webpack_require__) {
  37238. "use strict";
  37239. var defaults = __webpack_require__(2);
  37240. var utils = __webpack_require__(0);
  37241. var InterceptorManager = __webpack_require__(31);
  37242. var dispatchRequest = __webpack_require__(32);
  37243. var isAbsoluteURL = __webpack_require__(34);
  37244. var combineURLs = __webpack_require__(35);
  37245. /**
  37246. * Create a new instance of Axios
  37247. *
  37248. * @param {Object} instanceConfig The default config for the instance
  37249. */
  37250. function Axios(instanceConfig) {
  37251. this.defaults = instanceConfig;
  37252. this.interceptors = {
  37253. request: new InterceptorManager(),
  37254. response: new InterceptorManager()
  37255. };
  37256. }
  37257. /**
  37258. * Dispatch a request
  37259. *
  37260. * @param {Object} config The config specific for this request (merged with this.defaults)
  37261. */
  37262. Axios.prototype.request = function request(config) {
  37263. /*eslint no-param-reassign:0*/
  37264. // Allow for axios('example/url'[, config]) a la fetch API
  37265. if (typeof config === 'string') {
  37266. config = utils.merge({
  37267. url: arguments[0]
  37268. }, arguments[1]);
  37269. }
  37270. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  37271. config.method = config.method.toLowerCase();
  37272. // Support baseURL config
  37273. if (config.baseURL && !isAbsoluteURL(config.url)) {
  37274. config.url = combineURLs(config.baseURL, config.url);
  37275. }
  37276. // Hook up interceptors middleware
  37277. var chain = [dispatchRequest, undefined];
  37278. var promise = Promise.resolve(config);
  37279. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  37280. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  37281. });
  37282. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  37283. chain.push(interceptor.fulfilled, interceptor.rejected);
  37284. });
  37285. while (chain.length) {
  37286. promise = promise.then(chain.shift(), chain.shift());
  37287. }
  37288. return promise;
  37289. };
  37290. // Provide aliases for supported request methods
  37291. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  37292. /*eslint func-names:0*/
  37293. Axios.prototype[method] = function(url, config) {
  37294. return this.request(utils.merge(config || {}, {
  37295. method: method,
  37296. url: url
  37297. }));
  37298. };
  37299. });
  37300. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  37301. /*eslint func-names:0*/
  37302. Axios.prototype[method] = function(url, data, config) {
  37303. return this.request(utils.merge(config || {}, {
  37304. method: method,
  37305. url: url,
  37306. data: data
  37307. }));
  37308. };
  37309. });
  37310. module.exports = Axios;
  37311. /***/ }),
  37312. /* 23 */
  37313. /***/ (function(module, exports, __webpack_require__) {
  37314. "use strict";
  37315. var utils = __webpack_require__(0);
  37316. module.exports = function normalizeHeaderName(headers, normalizedName) {
  37317. utils.forEach(headers, function processHeader(value, name) {
  37318. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  37319. headers[normalizedName] = value;
  37320. delete headers[name];
  37321. }
  37322. });
  37323. };
  37324. /***/ }),
  37325. /* 24 */
  37326. /***/ (function(module, exports, __webpack_require__) {
  37327. "use strict";
  37328. var createError = __webpack_require__(6);
  37329. /**
  37330. * Resolve or reject a Promise based on response status.
  37331. *
  37332. * @param {Function} resolve A function that resolves the promise.
  37333. * @param {Function} reject A function that rejects the promise.
  37334. * @param {object} response The response.
  37335. */
  37336. module.exports = function settle(resolve, reject, response) {
  37337. var validateStatus = response.config.validateStatus;
  37338. // Note: status is not exposed by XDomainRequest
  37339. if (!response.status || !validateStatus || validateStatus(response.status)) {
  37340. resolve(response);
  37341. } else {
  37342. reject(createError(
  37343. 'Request failed with status code ' + response.status,
  37344. response.config,
  37345. null,
  37346. response.request,
  37347. response
  37348. ));
  37349. }
  37350. };
  37351. /***/ }),
  37352. /* 25 */
  37353. /***/ (function(module, exports, __webpack_require__) {
  37354. "use strict";
  37355. /**
  37356. * Update an Error with the specified config, error code, and response.
  37357. *
  37358. * @param {Error} error The error to update.
  37359. * @param {Object} config The config.
  37360. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  37361. * @param {Object} [request] The request.
  37362. * @param {Object} [response] The response.
  37363. * @returns {Error} The error.
  37364. */
  37365. module.exports = function enhanceError(error, config, code, request, response) {
  37366. error.config = config;
  37367. if (code) {
  37368. error.code = code;
  37369. }
  37370. error.request = request;
  37371. error.response = response;
  37372. return error;
  37373. };
  37374. /***/ }),
  37375. /* 26 */
  37376. /***/ (function(module, exports, __webpack_require__) {
  37377. "use strict";
  37378. var utils = __webpack_require__(0);
  37379. function encode(val) {
  37380. return encodeURIComponent(val).
  37381. replace(/%40/gi, '@').
  37382. replace(/%3A/gi, ':').
  37383. replace(/%24/g, '$').
  37384. replace(/%2C/gi, ',').
  37385. replace(/%20/g, '+').
  37386. replace(/%5B/gi, '[').
  37387. replace(/%5D/gi, ']');
  37388. }
  37389. /**
  37390. * Build a URL by appending params to the end
  37391. *
  37392. * @param {string} url The base of the url (e.g., http://www.google.com)
  37393. * @param {object} [params] The params to be appended
  37394. * @returns {string} The formatted url
  37395. */
  37396. module.exports = function buildURL(url, params, paramsSerializer) {
  37397. /*eslint no-param-reassign:0*/
  37398. if (!params) {
  37399. return url;
  37400. }
  37401. var serializedParams;
  37402. if (paramsSerializer) {
  37403. serializedParams = paramsSerializer(params);
  37404. } else if (utils.isURLSearchParams(params)) {
  37405. serializedParams = params.toString();
  37406. } else {
  37407. var parts = [];
  37408. utils.forEach(params, function serialize(val, key) {
  37409. if (val === null || typeof val === 'undefined') {
  37410. return;
  37411. }
  37412. if (utils.isArray(val)) {
  37413. key = key + '[]';
  37414. }
  37415. if (!utils.isArray(val)) {
  37416. val = [val];
  37417. }
  37418. utils.forEach(val, function parseValue(v) {
  37419. if (utils.isDate(v)) {
  37420. v = v.toISOString();
  37421. } else if (utils.isObject(v)) {
  37422. v = JSON.stringify(v);
  37423. }
  37424. parts.push(encode(key) + '=' + encode(v));
  37425. });
  37426. });
  37427. serializedParams = parts.join('&');
  37428. }
  37429. if (serializedParams) {
  37430. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  37431. }
  37432. return url;
  37433. };
  37434. /***/ }),
  37435. /* 27 */
  37436. /***/ (function(module, exports, __webpack_require__) {
  37437. "use strict";
  37438. var utils = __webpack_require__(0);
  37439. /**
  37440. * Parse headers into an object
  37441. *
  37442. * ```
  37443. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  37444. * Content-Type: application/json
  37445. * Connection: keep-alive
  37446. * Transfer-Encoding: chunked
  37447. * ```
  37448. *
  37449. * @param {String} headers Headers needing to be parsed
  37450. * @returns {Object} Headers parsed into an object
  37451. */
  37452. module.exports = function parseHeaders(headers) {
  37453. var parsed = {};
  37454. var key;
  37455. var val;
  37456. var i;
  37457. if (!headers) { return parsed; }
  37458. utils.forEach(headers.split('\n'), function parser(line) {
  37459. i = line.indexOf(':');
  37460. key = utils.trim(line.substr(0, i)).toLowerCase();
  37461. val = utils.trim(line.substr(i + 1));
  37462. if (key) {
  37463. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  37464. }
  37465. });
  37466. return parsed;
  37467. };
  37468. /***/ }),
  37469. /* 28 */
  37470. /***/ (function(module, exports, __webpack_require__) {
  37471. "use strict";
  37472. var utils = __webpack_require__(0);
  37473. module.exports = (
  37474. utils.isStandardBrowserEnv() ?
  37475. // Standard browser envs have full support of the APIs needed to test
  37476. // whether the request URL is of the same origin as current location.
  37477. (function standardBrowserEnv() {
  37478. var msie = /(msie|trident)/i.test(navigator.userAgent);
  37479. var urlParsingNode = document.createElement('a');
  37480. var originURL;
  37481. /**
  37482. * Parse a URL to discover it's components
  37483. *
  37484. * @param {String} url The URL to be parsed
  37485. * @returns {Object}
  37486. */
  37487. function resolveURL(url) {
  37488. var href = url;
  37489. if (msie) {
  37490. // IE needs attribute set twice to normalize properties
  37491. urlParsingNode.setAttribute('href', href);
  37492. href = urlParsingNode.href;
  37493. }
  37494. urlParsingNode.setAttribute('href', href);
  37495. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  37496. return {
  37497. href: urlParsingNode.href,
  37498. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  37499. host: urlParsingNode.host,
  37500. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  37501. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  37502. hostname: urlParsingNode.hostname,
  37503. port: urlParsingNode.port,
  37504. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  37505. urlParsingNode.pathname :
  37506. '/' + urlParsingNode.pathname
  37507. };
  37508. }
  37509. originURL = resolveURL(window.location.href);
  37510. /**
  37511. * Determine if a URL shares the same origin as the current location
  37512. *
  37513. * @param {String} requestURL The URL to test
  37514. * @returns {boolean} True if URL shares the same origin, otherwise false
  37515. */
  37516. return function isURLSameOrigin(requestURL) {
  37517. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  37518. return (parsed.protocol === originURL.protocol &&
  37519. parsed.host === originURL.host);
  37520. };
  37521. })() :
  37522. // Non standard browser envs (web workers, react-native) lack needed support.
  37523. (function nonStandardBrowserEnv() {
  37524. return function isURLSameOrigin() {
  37525. return true;
  37526. };
  37527. })()
  37528. );
  37529. /***/ }),
  37530. /* 29 */
  37531. /***/ (function(module, exports, __webpack_require__) {
  37532. "use strict";
  37533. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  37534. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  37535. function E() {
  37536. this.message = 'String contains an invalid character';
  37537. }
  37538. E.prototype = new Error;
  37539. E.prototype.code = 5;
  37540. E.prototype.name = 'InvalidCharacterError';
  37541. function btoa(input) {
  37542. var str = String(input);
  37543. var output = '';
  37544. for (
  37545. // initialize result and counter
  37546. var block, charCode, idx = 0, map = chars;
  37547. // if the next str index does not exist:
  37548. // change the mapping table to "="
  37549. // check if d has no fractional digits
  37550. str.charAt(idx | 0) || (map = '=', idx % 1);
  37551. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  37552. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  37553. ) {
  37554. charCode = str.charCodeAt(idx += 3 / 4);
  37555. if (charCode > 0xFF) {
  37556. throw new E();
  37557. }
  37558. block = block << 8 | charCode;
  37559. }
  37560. return output;
  37561. }
  37562. module.exports = btoa;
  37563. /***/ }),
  37564. /* 30 */
  37565. /***/ (function(module, exports, __webpack_require__) {
  37566. "use strict";
  37567. var utils = __webpack_require__(0);
  37568. module.exports = (
  37569. utils.isStandardBrowserEnv() ?
  37570. // Standard browser envs support document.cookie
  37571. (function standardBrowserEnv() {
  37572. return {
  37573. write: function write(name, value, expires, path, domain, secure) {
  37574. var cookie = [];
  37575. cookie.push(name + '=' + encodeURIComponent(value));
  37576. if (utils.isNumber(expires)) {
  37577. cookie.push('expires=' + new Date(expires).toGMTString());
  37578. }
  37579. if (utils.isString(path)) {
  37580. cookie.push('path=' + path);
  37581. }
  37582. if (utils.isString(domain)) {
  37583. cookie.push('domain=' + domain);
  37584. }
  37585. if (secure === true) {
  37586. cookie.push('secure');
  37587. }
  37588. document.cookie = cookie.join('; ');
  37589. },
  37590. read: function read(name) {
  37591. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  37592. return (match ? decodeURIComponent(match[3]) : null);
  37593. },
  37594. remove: function remove(name) {
  37595. this.write(name, '', Date.now() - 86400000);
  37596. }
  37597. };
  37598. })() :
  37599. // Non standard browser env (web workers, react-native) lack needed support.
  37600. (function nonStandardBrowserEnv() {
  37601. return {
  37602. write: function write() {},
  37603. read: function read() { return null; },
  37604. remove: function remove() {}
  37605. };
  37606. })()
  37607. );
  37608. /***/ }),
  37609. /* 31 */
  37610. /***/ (function(module, exports, __webpack_require__) {
  37611. "use strict";
  37612. var utils = __webpack_require__(0);
  37613. function InterceptorManager() {
  37614. this.handlers = [];
  37615. }
  37616. /**
  37617. * Add a new interceptor to the stack
  37618. *
  37619. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  37620. * @param {Function} rejected The function to handle `reject` for a `Promise`
  37621. *
  37622. * @return {Number} An ID used to remove interceptor later
  37623. */
  37624. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  37625. this.handlers.push({
  37626. fulfilled: fulfilled,
  37627. rejected: rejected
  37628. });
  37629. return this.handlers.length - 1;
  37630. };
  37631. /**
  37632. * Remove an interceptor from the stack
  37633. *
  37634. * @param {Number} id The ID that was returned by `use`
  37635. */
  37636. InterceptorManager.prototype.eject = function eject(id) {
  37637. if (this.handlers[id]) {
  37638. this.handlers[id] = null;
  37639. }
  37640. };
  37641. /**
  37642. * Iterate over all the registered interceptors
  37643. *
  37644. * This method is particularly useful for skipping over any
  37645. * interceptors that may have become `null` calling `eject`.
  37646. *
  37647. * @param {Function} fn The function to call for each interceptor
  37648. */
  37649. InterceptorManager.prototype.forEach = function forEach(fn) {
  37650. utils.forEach(this.handlers, function forEachHandler(h) {
  37651. if (h !== null) {
  37652. fn(h);
  37653. }
  37654. });
  37655. };
  37656. module.exports = InterceptorManager;
  37657. /***/ }),
  37658. /* 32 */
  37659. /***/ (function(module, exports, __webpack_require__) {
  37660. "use strict";
  37661. var utils = __webpack_require__(0);
  37662. var transformData = __webpack_require__(33);
  37663. var isCancel = __webpack_require__(7);
  37664. var defaults = __webpack_require__(2);
  37665. /**
  37666. * Throws a `Cancel` if cancellation has been requested.
  37667. */
  37668. function throwIfCancellationRequested(config) {
  37669. if (config.cancelToken) {
  37670. config.cancelToken.throwIfRequested();
  37671. }
  37672. }
  37673. /**
  37674. * Dispatch a request to the server using the configured adapter.
  37675. *
  37676. * @param {object} config The config that is to be used for the request
  37677. * @returns {Promise} The Promise to be fulfilled
  37678. */
  37679. module.exports = function dispatchRequest(config) {
  37680. throwIfCancellationRequested(config);
  37681. // Ensure headers exist
  37682. config.headers = config.headers || {};
  37683. // Transform request data
  37684. config.data = transformData(
  37685. config.data,
  37686. config.headers,
  37687. config.transformRequest
  37688. );
  37689. // Flatten headers
  37690. config.headers = utils.merge(
  37691. config.headers.common || {},
  37692. config.headers[config.method] || {},
  37693. config.headers || {}
  37694. );
  37695. utils.forEach(
  37696. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  37697. function cleanHeaderConfig(method) {
  37698. delete config.headers[method];
  37699. }
  37700. );
  37701. var adapter = config.adapter || defaults.adapter;
  37702. return adapter(config).then(function onAdapterResolution(response) {
  37703. throwIfCancellationRequested(config);
  37704. // Transform response data
  37705. response.data = transformData(
  37706. response.data,
  37707. response.headers,
  37708. config.transformResponse
  37709. );
  37710. return response;
  37711. }, function onAdapterRejection(reason) {
  37712. if (!isCancel(reason)) {
  37713. throwIfCancellationRequested(config);
  37714. // Transform response data
  37715. if (reason && reason.response) {
  37716. reason.response.data = transformData(
  37717. reason.response.data,
  37718. reason.response.headers,
  37719. config.transformResponse
  37720. );
  37721. }
  37722. }
  37723. return Promise.reject(reason);
  37724. });
  37725. };
  37726. /***/ }),
  37727. /* 33 */
  37728. /***/ (function(module, exports, __webpack_require__) {
  37729. "use strict";
  37730. var utils = __webpack_require__(0);
  37731. /**
  37732. * Transform the data for a request or a response
  37733. *
  37734. * @param {Object|String} data The data to be transformed
  37735. * @param {Array} headers The headers for the request or response
  37736. * @param {Array|Function} fns A single function or Array of functions
  37737. * @returns {*} The resulting transformed data
  37738. */
  37739. module.exports = function transformData(data, headers, fns) {
  37740. /*eslint no-param-reassign:0*/
  37741. utils.forEach(fns, function transform(fn) {
  37742. data = fn(data, headers);
  37743. });
  37744. return data;
  37745. };
  37746. /***/ }),
  37747. /* 34 */
  37748. /***/ (function(module, exports, __webpack_require__) {
  37749. "use strict";
  37750. /**
  37751. * Determines whether the specified URL is absolute
  37752. *
  37753. * @param {string} url The URL to test
  37754. * @returns {boolean} True if the specified URL is absolute, otherwise false
  37755. */
  37756. module.exports = function isAbsoluteURL(url) {
  37757. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  37758. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  37759. // by any combination of letters, digits, plus, period, or hyphen.
  37760. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  37761. };
  37762. /***/ }),
  37763. /* 35 */
  37764. /***/ (function(module, exports, __webpack_require__) {
  37765. "use strict";
  37766. /**
  37767. * Creates a new URL by combining the specified URLs
  37768. *
  37769. * @param {string} baseURL The base URL
  37770. * @param {string} relativeURL The relative URL
  37771. * @returns {string} The combined URL
  37772. */
  37773. module.exports = function combineURLs(baseURL, relativeURL) {
  37774. return relativeURL
  37775. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  37776. : baseURL;
  37777. };
  37778. /***/ }),
  37779. /* 36 */
  37780. /***/ (function(module, exports, __webpack_require__) {
  37781. "use strict";
  37782. var Cancel = __webpack_require__(8);
  37783. /**
  37784. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  37785. *
  37786. * @class
  37787. * @param {Function} executor The executor function.
  37788. */
  37789. function CancelToken(executor) {
  37790. if (typeof executor !== 'function') {
  37791. throw new TypeError('executor must be a function.');
  37792. }
  37793. var resolvePromise;
  37794. this.promise = new Promise(function promiseExecutor(resolve) {
  37795. resolvePromise = resolve;
  37796. });
  37797. var token = this;
  37798. executor(function cancel(message) {
  37799. if (token.reason) {
  37800. // Cancellation has already been requested
  37801. return;
  37802. }
  37803. token.reason = new Cancel(message);
  37804. resolvePromise(token.reason);
  37805. });
  37806. }
  37807. /**
  37808. * Throws a `Cancel` if cancellation has been requested.
  37809. */
  37810. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  37811. if (this.reason) {
  37812. throw this.reason;
  37813. }
  37814. };
  37815. /**
  37816. * Returns an object that contains a new `CancelToken` and a function that, when called,
  37817. * cancels the `CancelToken`.
  37818. */
  37819. CancelToken.source = function source() {
  37820. var cancel;
  37821. var token = new CancelToken(function executor(c) {
  37822. cancel = c;
  37823. });
  37824. return {
  37825. token: token,
  37826. cancel: cancel
  37827. };
  37828. };
  37829. module.exports = CancelToken;
  37830. /***/ }),
  37831. /* 37 */
  37832. /***/ (function(module, exports, __webpack_require__) {
  37833. "use strict";
  37834. /**
  37835. * Syntactic sugar for invoking a function and expanding an array for arguments.
  37836. *
  37837. * Common use case would be to use `Function.prototype.apply`.
  37838. *
  37839. * ```js
  37840. * function f(x, y, z) {}
  37841. * var args = [1, 2, 3];
  37842. * f.apply(null, args);
  37843. * ```
  37844. *
  37845. * With `spread` this example can be re-written.
  37846. *
  37847. * ```js
  37848. * spread(function(x, y, z) {})([1, 2, 3]);
  37849. * ```
  37850. *
  37851. * @param {Function} callback
  37852. * @returns {Function}
  37853. */
  37854. module.exports = function spread(callback) {
  37855. return function wrap(arr) {
  37856. return callback.apply(null, arr);
  37857. };
  37858. };
  37859. /***/ }),
  37860. /* 38 */
  37861. /***/ (function(module, exports, __webpack_require__) {
  37862. var disposed = false
  37863. var normalizeComponent = __webpack_require__(39)
  37864. /* script */
  37865. var __vue_script__ = __webpack_require__(40)
  37866. /* template */
  37867. var __vue_template__ = __webpack_require__(41)
  37868. /* template functional */
  37869. var __vue_template_functional__ = false
  37870. /* styles */
  37871. var __vue_styles__ = null
  37872. /* scopeId */
  37873. var __vue_scopeId__ = null
  37874. /* moduleIdentifier (server only) */
  37875. var __vue_module_identifier__ = null
  37876. var Component = normalizeComponent(
  37877. __vue_script__,
  37878. __vue_template__,
  37879. __vue_template_functional__,
  37880. __vue_styles__,
  37881. __vue_scopeId__,
  37882. __vue_module_identifier__
  37883. )
  37884. Component.options.__file = "resources\\assets\\js\\components\\Example.vue"
  37885. /* hot reload */
  37886. if (false) {(function () {
  37887. var hotAPI = require("vue-hot-reload-api")
  37888. hotAPI.install(require("vue"), false)
  37889. if (!hotAPI.compatible) return
  37890. module.hot.accept()
  37891. if (!module.hot.data) {
  37892. hotAPI.createRecord("data-v-b6ebd97a", Component.options)
  37893. } else {
  37894. hotAPI.reload("data-v-b6ebd97a", Component.options)
  37895. }
  37896. module.hot.dispose(function (data) {
  37897. disposed = true
  37898. })
  37899. })()}
  37900. module.exports = Component.exports
  37901. /***/ }),
  37902. /* 39 */
  37903. /***/ (function(module, exports) {
  37904. /* globals __VUE_SSR_CONTEXT__ */
  37905. // IMPORTANT: Do NOT use ES2015 features in this file.
  37906. // This module is a runtime utility for cleaner component module output and will
  37907. // be included in the final webpack user bundle.
  37908. module.exports = function normalizeComponent (
  37909. rawScriptExports,
  37910. compiledTemplate,
  37911. functionalTemplate,
  37912. injectStyles,
  37913. scopeId,
  37914. moduleIdentifier /* server only */
  37915. ) {
  37916. var esModule
  37917. var scriptExports = rawScriptExports = rawScriptExports || {}
  37918. // ES6 modules interop
  37919. var type = typeof rawScriptExports.default
  37920. if (type === 'object' || type === 'function') {
  37921. esModule = rawScriptExports
  37922. scriptExports = rawScriptExports.default
  37923. }
  37924. // Vue.extend constructor export interop
  37925. var options = typeof scriptExports === 'function'
  37926. ? scriptExports.options
  37927. : scriptExports
  37928. // render functions
  37929. if (compiledTemplate) {
  37930. options.render = compiledTemplate.render
  37931. options.staticRenderFns = compiledTemplate.staticRenderFns
  37932. options._compiled = true
  37933. }
  37934. // functional template
  37935. if (functionalTemplate) {
  37936. options.functional = true
  37937. }
  37938. // scopedId
  37939. if (scopeId) {
  37940. options._scopeId = scopeId
  37941. }
  37942. var hook
  37943. if (moduleIdentifier) { // server build
  37944. hook = function (context) {
  37945. // 2.3 injection
  37946. context =
  37947. context || // cached call
  37948. (this.$vnode && this.$vnode.ssrContext) || // stateful
  37949. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  37950. // 2.2 with runInNewContext: true
  37951. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  37952. context = __VUE_SSR_CONTEXT__
  37953. }
  37954. // inject component styles
  37955. if (injectStyles) {
  37956. injectStyles.call(this, context)
  37957. }
  37958. // register component module identifier for async chunk inferrence
  37959. if (context && context._registeredComponents) {
  37960. context._registeredComponents.add(moduleIdentifier)
  37961. }
  37962. }
  37963. // used by ssr in case component is cached and beforeCreate
  37964. // never gets called
  37965. options._ssrRegister = hook
  37966. } else if (injectStyles) {
  37967. hook = injectStyles
  37968. }
  37969. if (hook) {
  37970. var functional = options.functional
  37971. var existing = functional
  37972. ? options.render
  37973. : options.beforeCreate
  37974. if (!functional) {
  37975. // inject component registration as beforeCreate hook
  37976. options.beforeCreate = existing
  37977. ? [].concat(existing, hook)
  37978. : [hook]
  37979. } else {
  37980. // for template-only hot-reload because in that case the render fn doesn't
  37981. // go through the normalizer
  37982. options._injectStyles = hook
  37983. // register for functioal component in vue file
  37984. options.render = function renderWithStyleInjection (h, context) {
  37985. hook.call(context)
  37986. return existing(h, context)
  37987. }
  37988. }
  37989. }
  37990. return {
  37991. esModule: esModule,
  37992. exports: scriptExports,
  37993. options: options
  37994. }
  37995. }
  37996. /***/ }),
  37997. /* 40 */
  37998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37999. "use strict";
  38000. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  38001. //
  38002. //
  38003. //
  38004. //
  38005. //
  38006. //
  38007. //
  38008. //
  38009. //
  38010. //
  38011. //
  38012. //
  38013. //
  38014. //
  38015. //
  38016. //
  38017. /* harmony default export */ __webpack_exports__["default"] = ({
  38018. mounted: function mounted() {
  38019. console.log('Component mounted.');
  38020. }
  38021. });
  38022. /***/ }),
  38023. /* 41 */
  38024. /***/ (function(module, exports, __webpack_require__) {
  38025. var render = function() {
  38026. var _vm = this
  38027. var _h = _vm.$createElement
  38028. var _c = _vm._self._c || _h
  38029. return _vm._m(0)
  38030. }
  38031. var staticRenderFns = [
  38032. function() {
  38033. var _vm = this
  38034. var _h = _vm.$createElement
  38035. var _c = _vm._self._c || _h
  38036. return _c("div", { staticClass: "container" }, [
  38037. _c("div", { staticClass: "row" }, [
  38038. _c("div", { staticClass: "col-md-8 col-md-offset-2" }, [
  38039. _c("div", { staticClass: "panel panel-default" }, [
  38040. _c("div", { staticClass: "panel-heading" }, [
  38041. _vm._v("Example Component")
  38042. ]),
  38043. _vm._v(" "),
  38044. _c("div", { staticClass: "panel-body" }, [
  38045. _vm._v(
  38046. "\n I'm an example component!\n "
  38047. )
  38048. ])
  38049. ])
  38050. ])
  38051. ])
  38052. ])
  38053. }
  38054. ]
  38055. render._withStripped = true
  38056. module.exports = { render: render, staticRenderFns: staticRenderFns }
  38057. if (false) {
  38058. module.hot.accept()
  38059. if (module.hot.data) {
  38060. require("vue-hot-reload-api") .rerender("data-v-b6ebd97a", module.exports)
  38061. }
  38062. }
  38063. /***/ }),
  38064. /* 42 */
  38065. /***/ (function(module, exports) {
  38066. // removed by extract-text-webpack-plugin
  38067. /***/ })
  38068. /******/ ]);